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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
class Group | |
module Error | |
class Standard < StandardError; end | |
class AlreadyAMember < Standard; end | |
class NotPermittedToJoin < Standard; end | |
end | |
def join user | |
raise Error::NotPermittedToJoin unless self.permitted?(user) | |
raise Error::AlreadyAMember if self.member?(user) |
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
puts "I grew up understanding that Wu-Tang Is Forever, never to be imitated or duplicated. This is simply an example of using gsub & regular expressions." |
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 alias | |
# kinda colorful transformations using gsub & regexp | |
@chorus.gsub(/(wu(-|\s)tang\sclan)/i, | |
@name).gsub(/motherfucking slums/i, | |
@switchup).gsub(/fuck/i, | |
@aka).gsub(/busted/i, "trusted") | |
end |
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
# This method numbers the array of Hip-Hop Elements as expressed by Kool D.J. Herc and Afrikka Bambatta. | |
# Note, this does not include the 9 Refinitions established by KRS-One. Also, big love to Pebblee Poo. | |
elements = ["Breaking", "Mc'ing", "Graffiti Art", "DJ'ing", "Knowledge"] | |
def hip_hop_culture(elements) | |
elements.map.with_index(1) { |elements, idx| puts "#{idx}. #{elements}"} | |
# with_index(offset = 0) {|(*args), idx| ... } | |
end |
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
"Slang Expressions" != "Regular Expressions" | |
"Regular Expressions" != ["Bam!", "Aw, man!"] | |
#Give thanks for the Brolic Scholars, those Honorary Sociolinguistic Prodigies. | |
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
# require 'net/http' | |
require_relative "./key.rb" | |
require 'rest-client' | |
# require 'pry' | |
nytimes_today_json = RestClient.get("http://api.nytimes.com/svc/search/v2/articlesearch.json?callback=svc_search_v2_articlesearch&q=love&begin_date=20150811&end_date=20150811&hl=true&api-key=#{NYT}") | |
today_parsed = JSON.parse(nytimes_today_json) | |
# nytimes_20140811_json = RestClient.get("http://api.nytimes.com/svc/search/v2/articlesearch.json?callback=svc_search_v2_articlesearch&q=love&begin_date=20140811&end_date=20150811&hl=true&api-key=$NYT") | |
# 20140811_parsed = JSON.parse(nytimes_20140811_json) |
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
# aretha_spec.rb | |
require_relative 'aretha.rb' #connect test to code | |
aretha = Aretha.new | |
RSpec.describe Aretha do | |
describe "#done_you_wrong!" do | |
it "ain't gonna do you wrong while you're gone" do | |
expect(aretha.done_you_wrong!).not_to be_truthy | |
end |
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
$ gem install rspec |
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
rspec --help |
OlderNewer