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
@j2labs
j2labs / gist:a870015f4cb00dca0510
Last active August 29, 2015 14:10
sudoku.rb
#!/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],
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@chhhris
chhhris / live-emails-dev-mode.rb
Last active January 4, 2016 20:49
Sending live emails in development mode
# now with Mandrill
# with SENDGRID
# sending emails to your email while in development mode.
# mail_interceptor.rb
if Rails.env.development?
message.to = 'your@email.com'
@maxjacobson
maxjacobson / moby_dick.rb
Last active December 19, 2015 07:19
hast thou seen the whale?
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
@linyiru
linyiru / redis_helper.rb
Created February 14, 2012 10:58 — forked from wxmn/redis_helper.rb
How to Build a Fast News Feed in Redis and Rails
module RedisHelper
# decode Redis value back to Ruby object
def self.decode(json)
self.new(ActiveSupport::JSON.decode(json)["#{self.name.downcase}"])
end
# encode Ruby object for Redis
def encoded
self.updated_at = nil
self.to_json
@wxmn
wxmn / redis_helper.rb
Created March 31, 2011 13:23
How to Build a Fast News Feed in Redis and Rails
module RedisHelper
# decode Redis value back to Ruby object
def self.decode(json)
self.new(ActiveSupport::JSON.decode(json)["#{self.name.downcase}"])
end
# encode Ruby object for Redis
def encoded
self.updated_at = nil
self.to_json
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
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')