Skip to content

Instantly share code, notes, and snippets.

View kylessnell's full-sized avatar

Kyle Snell kylessnell

View GitHub Profile
@kylessnell
kylessnell / keybase.md
Created December 4, 2017 16:52
keybase.md

Keybase proof

I hereby claim:

  • I am kylessnell on github.
  • I am kylessnell (https://keybase.io/kylessnell) on keybase.
  • I have a public key ASD0YE02sCMQ7FcI7uB4diAs7JBw_9CXDvbxIkariDbQ7go

To claim this, I am signing this object:

class Foo
include Mongoid::Document
include Mongoid::Timestamps
has_many :bars
has_many :bazs
before_validation do
puts "FOO VALIDATION"
end
end
# Write a script that determines if a given number is prime
def prime_number?(num)
(2..Math.sqrt(num)).each do |n|
return false if num % n == 0
end
true
end
# Follow up: Modify the script to factor a given number into a list of constituent primes.
def constituent_primes(n)
#Fakeweb
cl_url = 'http://sfbay.craigslist.org/search/sssquery=1999+toyota+tundra&srchType=A&minAsk=500&maxAsk=9000&hasPic=1'
FakeWeb.register_uri(:get, "#{cl_url}", :response => "response_from_cl_search.html")
#Nokogiri
#get entire page as Nokogiri object
def parse_results(url)
describe 'binatry_search' do
let(:test_array_1) { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }
let(:test_array_2) { (1..100).to_a }
let(:test_object_1) { 3 }
let(:test_object_2) { 10 }
let(:test_object_3) { 39 }
let(:test_object_4) { 97 }
it 'is defined' do
@kylessnell
kylessnell / fix_rvm_osx_lion
Created October 3, 2012 03:16
How to change your compiler to install versions of Ruby prior to 1.9.3 on OSX Lion
Step 1: brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
Step 2: brew install apple-gcc42
Step 3: CC=/usr/local/bin/gcc-4.2 rvm install 1.8.7
# Put your answers here!
Kyles-MacBook-Pro:~ kylessnell$ rvm list
rvm rubies
ruby-1.8.7-p370 [ i686 ]
ruby-1.9.2-p320 [ x86_64 ]
=* ruby-1.9.3-p194 [ x86_64 ]