Skip to content

Instantly share code, notes, and snippets.

Nathan Hessler nhessler

Block or report user

Report or block nhessler

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View game.ex
defmodule ElixirBaseball.Game do
def play_ball do
IO.puts inspect(play_inning([], 0, 0))
end
def play_inning(top_of_inning, _, _) when length(top_of_inning) < 9 do
bottom_of_inning = [get_inning | top_of_inning]
play_inning(bottom_of_inning,
total_score(bottom_of_inning, :home),
total_score(bottom_of_inning, :away))
@nhessler
nhessler / torc.rb
Created Dec 5, 2015 — forked from JoshCheek/torc.rb
Tail optimized recursive call w/ Nathan at Rubyconf
View torc.rb
$depth = 0
at_exit { p depth: $depth }
def record_depth
$depth = caller.length-1 if caller.length-1 > $depth
end
require 'binding_of_caller'
module Torc
def torc(*args)
@nhessler
nhessler / conway.rb
Last active Sep 21, 2015 — forked from abachman/conway.rb
An implementation of Conway's Game of Life in Ruby based on Sets
View conway.rb
# Conway's Game of Life
# 2015-09-18
# by
# Nathan Hessler https://twitter.com/spune
# Adam Bachman https://twitter.com/abachman
# at Ruby DCamp 2015 http://rubydcamp.org/
# awesome test library
def assert(value)
if !value
View rack_test_example.rb
require 'sinatra/base'
require 'minitest/autorun'
require 'minitest/spec'
require "rack/test"
require 'nokogiri'
class MyApp < Sinatra::Base
enable :inline_templates
get '/users/:id' do
View keybase.md

Keybase proof

I hereby claim:

  • I am nhessler on github.
  • I am nhessler (https://keybase.io/nhessler) on keybase.
  • I have a public key whose fingerprint is D0EE 20DF 35CD B2DD 86FF 3102 EEBB 7FA1 73C4 BA4D

To claim this, I am signing this object:

@nhessler
nhessler / lineage.rb
Created Jun 3, 2011
creating a lineage! is it too clever?
View lineage.rb
[grandpa, father, son,].inject(nil) do |parent, child|
child.parent = parent
child
end
You can’t perform that action at this time.