Skip to content

Instantly share code, notes, and snippets.

Name: Brendan Manley
Github: https://github.com/manleyhimself
Blog: N/A
Tagline: Where there's a will, there are countless ways.
Profile Picture: https://docs.google.com/drawings/d/1zac66Ku3kT7ZdmMFZrV32IbyuRpXi3LRZnA-YUgeth8/edit
Treehouse Account: http://teamtreehouse.com/brendanmanley
CoderWall Account: https://coderwall.com/manleyhimself
CodeSchool Account: http://www.codeschool.com/users/manleyhimself
Favorite Websites:
@manleyhimself
manleyhimself / gist:6680570
Created September 24, 2013 05:01
DELIVERABLE: Create a numbered list that contains instructions for making a peanut butter and jelly sandwich. FORMAT: Link to Public Gist AUDIENCE: Tourist Alien CONSIDERATIONS: The alien is positioned in front of a table with a plate, a knife, a jar of jelly, a jar of peanut butter, and a loaf of bread. The alien can read and recognize english …
1. An object is a material thing that can be seen and touched. Among the objects in front of you, there should be a flat and circular object. This is a plate.
2. There is also a loaf of bread. This is the the only soft object before you. Moreover, it appears as an oblong shape and is cut into portions. Each single portion of the loaf is known as a slice.
3. The bread is within a clear, light material; known as plastic. On one side of this loaf of bread, there will be a notable excess of plastic. This plastic has been twisted and tied, to hold the bread safely within it.
4. Untie and then untwist the plastic. After untwisting the plastic, you should notice that the loaf of bread is now acessible. It can be touched.
5. Reach inside, remove two slices, and place them on to the plate. They should not be stacked.
6. The next step is to locate the peanut butter jar and the jelly jar. Look for two wide-mouthed, cylindrical objects.
7. Since using color as an identifier may not work because of our physiological dif
def fizzbuzz(limit)
fizz_array = []
buzz_array = []
fb_array = []
num = 1
while num <= limit
if (num % 3 == 0) && (num % 5 == 0)
puts "fizzbuzz"
fb_array << num
elsif num % 3 == 0
def short(tweets)
sub_hash = { "too" => "2", "to" => "2", "two" => "2", "For" => "4", " for " => " 4 ", "four" => "4", " be " => " b ", "you" => "u", " at " => " @ ", "and" => "&"}
if tweets.length > 140
sub_hash.each do |k,v|
tweets.gsub!(k,v) if tweets.include?(k)
end
if tweets.length > 140
tweets[0,140]
else
tweets
def my_each(array)
i = 0
while i < array.length
yield(array[i])
i += 1
end
end
num_array = [5,6,7,8]
def normalize_phone_number(number)
clean_num = number.gsub(/[^0-9]/, "")
clean_num.length != 10 ? number : "(#{clean_num[0,3]}) #{clean_num[3,3]}-#{clean_num[6,4]}"
end
def reverse_each_word(sentence)
sen_array = sentence.split(" ")
sen_rev = sen_array.map { |word| word.reverse}
sen_rev = sen_rev.join(" ")
end
puts reverse_each_word("Hello there, and how are you?")
apple_picker(["apple", "orange", "apple"]) #=> ["apple", "apple"]
apple_picker.map { |x| puts x}
apple_picker.select { |x| puts x }
holiday_supplies = {
:winter => {
:christmas => ["Lights", "Wreath"],
:new_years => ["Party Hats"]
},
:summer => {
:forth_of_july => ["Fireworks", "BBQ"]
},
:fall => {
:thanksgiving => ["Turkey"]
katz_deli = []
def take_a_number(deli_line, customer)
deli_line << customer
deli_line.index(customer) + 1
end
def now_serving(deli_line)
"Currently serving #{deli_line[0]}"