This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws s3api list-objects --bucket=mys3bucket \ | |
--region=us-west-2 \ | |
--output=text \ | |
--prefix=myprefix \ | |
--query='Contents[].[Key]' | \ | |
xargs -P4 -I % aws s3api put-object-acl \ | |
--acl=public-read \ | |
--region=us-west-2 \ | |
--bucket=mys3bucket \ | |
--key='%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shared `label_name` functionality | |
module Label | |
def label_name | |
"[#{self.class.to_s.upcase}] - Has a Label Name" | |
end | |
end | |
# Car - includes `Label` | |
class Car | |
include Label |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Create a class named Country | |
class Country | |
end | |
# 2. Add the ability to read and write an attribute named "name". This should | |
# be done using two methods. | |
# HINT: the writer method has the `=` at the end | |
# HINT HINT: use an ivar to store the name in the scope of the class | |
class Country | |
def name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define a class | |
class Cup | |
# class definition | |
def initialize | |
puts "I am initializing ... I should be a new cup" | |
@contents = "coffee" | |
end | |
def contents | |
@contents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example used in warmup quiz | |
def function(a, b = 1) | |
a = a.to_i | |
if a == 1 | |
a + 5 / 2 | |
elsif a == 2 | |
a + 5 + 3 | |
elsif a > 2 && a <= 1000 | |
a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a, b = "a", "b" | |
c = "c" | |
d = "d" | |
e = "e" | |
f = "f" | |
# define it - ugly style | |
def function0(arg0, arg1, arg2, arg3, arg4, arg5) | |
puts "you passed in #{arg0}, #{arg1}, #{arg2}, #{arg3}, #{arg4}, and #{arg5}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Create a `day_3` directory under the course directory. | |
# 2. Save this file under the new folder as `warmup.rb`. | |
# 3. Assign any string value to a variable. | |
string = "i hope i do well in class today" | |
# 4. Assign any whole number to a variable. | |
b = 42 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "AGO", | |
"name": "Angola", | |
"population": 21471618, | |
"capital": "Luanda", | |
"latitude": -8.81155, | |
"longitude": 13.242, | |
"income_level": "Upper Middle", | |
"high_income": false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert all of the following country data in to a Hash, like that of Angola | |
# Angola | |
angola = { | |
"id" => "AGO", | |
"name" => "Angola", | |
"population" => 21_471_618, | |
"capital" => "Luanda", | |
"latitude" => -8.81155, | |
"longitude" => 13.242, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Create a `day_2` directory under the course directory. | |
# Check! | |
# 2. Save this file under the new folder as `warmup.rb`. | |
# Check! | |
# 3. Assign your favorite vacation location to a variable called `destination`. | |
destination = "Spain" | |
# 4. Assign the number of days you'd like to visit to a variable called |
NewerOlder