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.configure do |config| | |
# Use color in STDOUT | |
config.color_enabled = true | |
# Use color not only in STDOUT but also in pagers and files | |
config.tty = true | |
# Use the specified formatter | |
config.formatter = :progress # :progress, :html, :textmate | |
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
require 'json' | |
require 'rest_client' | |
reddit_hash = JSON.parse(RestClient.get('http://reddit.com/.json')) | |
html_reddit = "<html><head></head><body><ul>" | |
reddit_hash["data"]["children"].each do |post| | |
next if post["data"]["over_18"] == true |
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 'pry' | |
class Array | |
def version_sort | |
array = self.sort_by do |file| | |
file.gsub(/[a-z].ext/) {|x| x.ord } | |
end | |
array.sort_by do |item| | |
item.scan(/\d+|[a-z]*/).collect do |el| |
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 'pry' | |
class Anagram | |
attr_reader :word | |
def initialize(word) | |
@word = word | |
end | |
def match(array=%w(hello world zombies pants)) |
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 Array | |
def my_each | |
i = 0 | |
while i < self.length | |
yield(self[i]) | |
i+=1 | |
end | |
self | |
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
require 'pry' | |
require 'nokogiri' | |
require 'open-uri' | |
require_relative './student_scrape' | |
class Student | |
attr_accessor :name, :twitter, :linkedin, :facebook, :website | |
@@students = [] | |
def initialize(name, twitter, linkedin, facebook, website) |
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
# Build a Jukebox | |
require 'pry' | |
songs = [ | |
"The Phoenix - 1901", | |
"Tokyo Police Club - Wait Up", | |
"Sufjan Stevens - Too Much", | |
"The Naked and the Famous - Young Blood", | |
"(Far From) Home - Tiga", |
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 'pry' | |
class SecretHandshake | |
attr_accessor :binary | |
def initialize(binary) | |
@binary = binary | |
end | |
def commands |
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
# Scraping Most Voted Hackernews | |
require 'pry' | |
require 'nokogiri' | |
require 'open-uri' | |
# Get all the Posts on Hackernews | |
# student_profile = Nokogiri::HTML(open('http://students.flatironschool.com/students/greg_eng.html')) | |
student_index_page = Nokogiri::HTML(open('http://students.flatironschool.com')) |
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
######################## | |
# NYC PIGEON ORGANIZER # | |
######################## | |
# Start with the following collected data on NYC pigeons. | |
require 'pry' | |
pigeon_data = { | |
:color => { | |
:purple => ["Theo", "Peter Jr.", "Lucky"], |
NewerOlder