Skip to content

Instantly share code, notes, and snippets.

@dmmfll
Created January 18, 2017 22:24
Show Gist options
  • Save dmmfll/3c2c0c5fab70058905ad82d3de1f2939 to your computer and use it in GitHub Desktop.
Save dmmfll/3c2c0c5fab70058905ad82d3de1f2939 to your computer and use it in GitHub Desktop.
Untitled.*
.ipynb_checkpoints/
gist_url
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
data = (0..25).to_a.zip(("a".."z").to_a)
Hash[data]
keys = ["first", "last"]
names = [
["don", "morehouse"],
["skye", "aniko"],
["bianco", "monaco"]
]
full_names = names.map do |name|
Hash[keys.zip(name)]
end
puts full_names
p ("a".."z").to_a.index 1
[[2, 1]][0][1]
(0..25).each do |i|
puts i if i.odd?
end
{a: 1, b: 2, c: 3, d: "cat"}.each do |k, v|
puts k.class
puts v.class
end
def puts_me(x)
puts x # return is nil
end
p puts_me('hello')
puts puts_me('hello')
def puts_me(x)
x # return is x
end
p puts_me('hello')
puts puts_me('hello')
result = (1...26).step(2).map do |x|
x
end
p result
result = (0...26).each do |x|
puts x.odd?
end
p result
puts 2 ** 0.5
i = 0
while i <= 25
puts i.odd?
i += 1
end
def element_index(element, my_array)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment