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
| katz_deli = [] | |
| def take_a_number(queue, name) | |
| count = (queue.count + 1) | |
| queue << "#{count}. #{name} " | |
| puts "The line is currently: " | |
| line(queue) | |
| 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
| ######################## | |
| # NYC PIGEON ORGANIZER # | |
| ######################## | |
| require 'pry' | |
| # Start with the following collected data on NYC pigeons. | |
| pigeon_data = { | |
| :color => { | |
| :purple => ["Theo", "Peter Jr.", "Lucky"], | |
| :grey => ["Theo", "Peter Jr.", "Ms .K"], |
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
| require 'json' | |
| require 'rest-client' | |
| require 'pry' | |
| @html_reddit = " " |
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
| require 'pry' | |
| tweet1 = "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!!!!" | |
| tweet2 = "OMG you guys, you won't believe how sweet my kitten is. My kitten is like super cuddly and too cute to be believed right?", "I'm running out of example tweets for you guys, which is weird, because I'm a writer and this is just writing and I tweet all day. For real, you guys. For real." | |
| tweet3 = "GUISEEEEE this is so fun! I'm tweeting for you guys and this tweet is SOOOO long it's gonna be way more than you would think twitter can handle, so shorten it up you know what I mean? I just can never tell how long to keep typing!" | |
| @substitute = {"to" => "2","too" => "2","two" => "2","for" => "4","four" => "4","be" => "b","you" => "u","at" => "@","and" => "&"} |
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
| # Download this file: | |
| # https://gist.github.com/scottcreynolds/ac1b5c8d96de0c91bf7c/download | |
| # Run it from your terminal with: | |
| # ruby ruby_phone_format.rb | |
| # (Just make sure you are in the right directory) | |
| # ====================================== | |
| # Ignore All This Code | |
| # ====================================== |
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
| require 'pry' | |
| class School | |
| attr_accessor :roster, :school | |
| @@schools = [] | |
| def initialize(school) | |
| @school = school | |
| @roster = {} |
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
| def my_each(array) | |
| i = 0 | |
| while i < array.length | |
| yield(array[i]) | |
| i+=1 | |
| end | |
| array | |
| 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
| class Array | |
| def version_sort | |
| self.sort_by do |file| | |
| file.scan(/\d+|[a-z]*/).map {|e1| e1.to_i} | |
| end | |
| end | |
| end | |
| filenames = [ | |
| "foo-1.10.2.ext", | |
| "foo-1.11.ext", |
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
| class Dog | |
| attr_accessor :name, :food, :breed | |
| def bark | |
| "Woof!" | |
| end | |
| def self.bark | |
| "Awoo!" | |
| 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
| class Song | |
| attr_accessor :title, :artist | |
| def serialize | |
| file_name = self.title.gsub(" ", "_").downcase | |
| File.open("#{file_name}.txt", "w+") do |f| | |
| f << "#{self.artist.name} - #{self.title}" | |
| end | |
| end | |