This file contains 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
Coordinates of peanut butter, jelly, plate, knife, bread = [a bunch of numbers separated by commas] | |
Get (stuff) | |
Move free arm to coordinates of stuff | |
Lower arm | |
Close hand around stuff | |
Raise arm | |
end | |
Put (stuff) down |
This file contains 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
Your Name: Raymond Gan | |
Github Username: rayning0 | |
Blog Url: http://rayning0.github.com | |
Tagline: surgery, teacher, chemical engineer, and web developer | |
Profile Picture: http://bit.ly/1anelur | |
Project Euler/algorithms code: https://github.com/rayning0/ProjectEuler-and-Algorithms | |
Favorite Websites: Project Euler (http://projecteuler.net/), fantastic site for computer science/math practice questions. Coursera (https://www.coursera.org/), fantastic site to take hundreds of free online courses from top universities. Longform (http://longform.org/), site that recommends excellent long-form non-fiction from around the web. This American Life (http://www.thisamericanlife.org/), my favorite radio show. It's mesmerizing, each week covering some strange and intimate aspect of American life. The stories are as addictive as butterscotch popcorn! | |
Previous Work Experience: Surgical Neurophysiologist for 4 years. Worked on over 400 surgeries at over 50 hospitals with over 50 surgeons, in 7 states. Started in Boston at 5 hospita |
This file contains 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
# Write a program that tells you the following: | |
# | |
# Hours in a year. How many hours are in a year? | |
# Minutes in a decade. How many minutes are in a decade? | |
# Your age in seconds. How many seconds old are you? | |
# | |
# Define at least the following methods to accomplish these tasks: | |
# | |
# seconds_in_minutes(1) | |
# minutes_in_hours(1) |
This file contains 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
# Raymond Gan | |
def fizzbuzz(n) | |
return "FizzBuzz" if (n % 3 == 0) && (n % 5 == 0) | |
return "Fizz" if n % 3 == 0 | |
return "Buzz" if n % 5 == 0 | |
end | |
fizz, buzz, fizzbuzz = [], [], [] |
This file contains 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
# Given: | |
# 5 songs of the following lengths in seconds | |
# 223,215,378,324,254 | |
# Goals: | |
# Assign the length set to variables | |
# Calculate the Total Length of the Playlists | |
# Express the Length in Minutes | |
# Average Song Length in Minutes |
This file contains 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
# Raymond Gan | |
# Given this List of Songs, Construct Arrays by Artist and Album | |
# Hint: Make use of the split() String Method | |
# http://www.ruby-doc.org/core-1.9.3/String.html#method-i-split | |
# Simple Example of Data Parsing | |
songs = [ | |
"The Magnetic Fields - 69 Love Songs - Parades Go By", | |
"The Magnetic Fields - Get Lost - Smoke and Mirrors", |
This file contains 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
# You're hosting a conference and need to print badges for the speakers. Each badge should say: # "Hello, my name is _____." | |
# | |
# Write a method that will create and return this message, given a person's name. | |
def badge(name) | |
"Hello, my name is #{name}" | |
end | |
# Now the list of speakers is finalized, and you can send the list of badges to the printer. Remember that you'll need to give this list to the printer, so it should be accessible outside of the method. |
This file contains 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
# Write a method that returns whether a given letter is a vowel, using if and elsif | |
def is_vowel?(v) | |
if v == 'a' | |
true | |
elsif v == 'e' | |
true | |
elsif v == 'i' | |
true | |
elsif v == 'o' |
This file contains 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
def tweetsub(tweet) | |
tsub = {'to' => '2', 'two' => '2', 'too' => '2', 'for' => '4', | |
'four' => '4', 'be' => 'b', 'you' => 'u', 'at' => '@', 'and' => '&'} | |
tsub.keys.each do |key| | |
tweet.gsub!(key) {tsub[key]} | |
end | |
tweet | |
end | |
tweets = ["Hey guys, can anyone teach me how to be cool? I really want to be the best at everything, you know what I mean? Tweeting is super fun you guys!!!!", |
This file contains 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
# Read about the yield keyword and ruby blocks. | |
# http://allaboutruby.wordpress.com/2006/01/20/ruby-blocks-101/ | |
# http://ruby.about.com/od/beginningruby/a/Block-Parameters-And-Yielding.htm | |
# http://blog.codahale.com/2005/11/24/a-ruby-howto-writing-a-method-that-uses-code-blocks/ | |
# http://www.robertsosinski.com/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/ | |
# Now that you know how the yield method works, try to write your | |
# own version of the each method without using the each method | |
# provided by ruby. As in, try to build my_each using only the |
OlderNewer