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
@session.deals.all(stage: :incoming).sort_by do |deal| | |
(deal.notes.all.present? && deal.notes.all.last[:updated_at]) || | |
deal[:updated_at] | |
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 'nokogiri' | |
require 'open-uri' | |
url = "http://www.gutenberg.org/files/2701/2701-h/2701-h.htm" | |
doc = Nokogiri::HTML(open(url)) | |
words = doc.text.downcase | |
.gsub(/[^\w\s]/,'') # remove non word or space characters | |
.gsub(/\n/,' ') # remove new lines | |
.gsub(/\s+/,' ') # normalize spaces (only one space ever) | |
.split("chapter one").first # remove preamble |
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
#!/usr/bin/env ruby | |
class Solver | |
B = " " | |
attr_reader :sudoku_board | |
def initialize | |
@sudoku_board = [[B, 4, B, B, B, 5, B, 1, B], | |
[B, B, B, B, 1, B, 6, B, 9], | |
[6, B, 1, 9, 3, B, B, B, 4], |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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: Chris Lake | |
Github Username: Chhhris | |
Blog Url (if you don't already have a blog it will be githubusername.github.io): http://chhhris.tumblr.com/ | |
Tagline: Hacker in Residence | |
Profile Picture (something normal, a headshot, of a good reusable size that can be easily cropped): http://bit.ly/132Fv5q | |
Treehouse Account: teamtreehouse.com/chhhris | |
CoderWall Account: https://coderwall.com/chhhris | |
CodeSchool Account: http://www.codeschool.com/users/chhhris | |
Favorite Websites: Evernote.com, Instapaper.com, AVC.com | |
Previous Work Experience: Product Manager & VP Strategy, Unigo.com; Analyst, McKinsey & Company Investment Office |
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
round flat object = "Plate" | |
long silver object = "Knife" | |
sharp pointy end of Knife = "Knife-Blade" | |
round thick end of Knife, opposite Knife-Blade = "Knife-Handle" | |
clear round glass jar with red goo insde = "Jelly" | |
clear round plastic jar with brown mush inside = "Peanut-Butter" | |
soft rectangular brown object = "Loaf-of-Bread" | |
alien = "You" | |
appendage at end of alien's arm = "Hand" |
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
round flat object = "Plate" | |
long silver object = "Knife" | |
sharp pointy end of Knife = "Knife-Blade" | |
round thick end of Knife, opposite Knife-Blade = "Knife-Handle" | |
clear round glass jar with red goo insde = "Jelly" | |
clear round plastic jar with brown mush inside = "Peanut-Butter" | |
soft rectangular brown object = "Loaf-of-Bread" | |
alien = "You" | |
appendage at end of alien's arm = "Hand" |
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
DROP TABLE IF EXISTS projects; | |
DROP TABLE IF EXISTS category; | |
DROP TABLE IF EXISTS users; | |
DROP TABLE IF EXISTS pledges; | |
CREATE TABLE projects ( | |
id int, | |
user_id int, | |
category_id int, | |
title text, |
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 an expression that returns true by using == | |
2 == 1 + 1 | |
# write an expression that returns false using == | |
2 == 1 + 3 | |
# write an expression that returns true using != | |
1 != 2 |
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
# assignment.rb | |
# FizzBuzz - The Programmer's Stairway to Heaven | |
# Define the fizzbuzz method to do the following: 10pts | |
# Use the modulo % method (divisible by) | |
# 2 % 2 #=> true | |
# 1 % 2 #=> false | |
# If a number is divisible by 3, puts "Fizz". | |
# If a number is divisible by 5, puts "Buzz". | |
# If a number is divisible by 3 and 5, puts "FizzBuzz" |
OlderNewer