Skip to content

Instantly share code, notes, and snippets.

View chrishunt's full-sized avatar
🏕️
Adventuring

Chris Hunt chrishunt

🏕️
Adventuring
View GitHub Profile
@chrishunt
chrishunt / basket.rb
Created February 16, 2012 17:35
attr_reader amend
class Basket
attr_reader :contents
def initialize
@contents = []
end
end
@chrishunt
chrishunt / array.rb
Created February 22, 2012 17:46
Array.fetch
class Array
def [](index)
fetch(index)
end
end
@chrishunt
chrishunt / .sh
Created February 24, 2012 05:49
Git branch tracking
git for-each-ref --format='%(refname:short) <- %(upstream:short)' refs/heads
@chrishunt
chrishunt / output
Created February 24, 2012 17:56
each vs inject vs map
Running 100000 iterations...
each: 6.872149
inject: 6.868875
map: 0.093785
@chrishunt
chrishunt / let_spec.rb
Created March 6, 2012 00:54
RSpec Let
describe 'rspec' do
let(:sentance) { 'hello' }
it "returns 'hello'" do
sentance.should == 'hello'
end
@chrishunt
chrishunt / ruby_on_clojure.md
Created August 4, 2012 04:39
Ruby on Clojure

Ruby on Clojure

Note: Remove example deps from the local mvn cache so they need to be installed for the demo

$ rm -r ~/.m2/repository/{com/steelcity, jruby}

First, create your amazing Ruby library that you'd like to use in Clojure. We must require 'java' and we must specify a java package because the default package cannot be imported into our Clojure project.

@chrishunt
chrishunt / paleo.markdown
Created August 11, 2012 19:20
Eating Paleo

Eating Paleo

What Is Paleo?

  • Many plants are inedible, in their raw state contain toxins
  • 10,000 years ago discovered that cooking these foods makes them edible
    • Wheat, corn, barley, rice, sorghum, millet, oats, potatoes
  • Enabled us to more easily transport and store food
  • Allowed us to specialize in other fields since we didn't need to hunt, gather
  • Grains, Beans, Potatoes (GBP) have several things in common
@chrishunt
chrishunt / sleep_sort.rb
Created August 18, 2012 16:56
Sleep Sort
def sleep_sort(*nums)
sorted = []
nums.map do |n|
Thread.new { sleep n; sorted << n }
end.map(&:join)
sorted
end
@chrishunt
chrishunt / podcasts.md
Last active March 20, 2023 14:22
Podcast List
@chrishunt
chrishunt / employee.rb
Created October 13, 2012 17:50
Relations in Ruby
require 'relations'
class Employee
extend Relations
belongs_to :manager
end