Skip to content

Instantly share code, notes, and snippets.

View chhhris's full-sized avatar
🚁
Working From Helicopter

Christopher Lake chhhris

🚁
Working From Helicopter
View GitHub Profile
@chhhris
chhhris / sort_by_note_date
Created July 31, 2014 17:37
sort_by note date
@session.deals.all(stage: :incoming).sort_by do |deal|
(deal.notes.all.present? && deal.notes.all.last[:updated_at]) ||
deal[:updated_at]
end
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
#!/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],
@chhhris
chhhris / capybara cheat sheet
Created October 27, 2015 15:49 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=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')
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
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"
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"
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,
# 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
# 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"