Skip to content

Instantly share code, notes, and snippets.

View mark's full-sized avatar
💭
Smoove

Mark Josef mark

💭
Smoove
View GitHub Profile
@mark
mark / bowling.rb
Last active December 19, 2015 23:29
A shameless Ruby ripoff of @zobar's Scala Bowling kata solution
require_relative 'streamer'
class Bowling
attr_reader :score
class GameTooShort < StandardError; end
class GameTooLong < StandardError; end
class SpareTooEarly < StandardError; end
class StrikeTooLate < StandardError; end
1.9.3p194 :001 > class MyClass
1.9.3p194 :002?> protected
1.9.3p194 :003?> def foo; puts "foo"; end
1.9.3p194 :004?> end
=> nil
1.9.3p194 :005 >
1.9.3p194 :006 > class YourClass < MyClass
1.9.3p194 :007?> def call_stuff
1.9.3p194 :008?> foo
1.9.3p194 :009?> YourClass.new.foo
1.9.3p194 :039 > class MyClass
1.9.3p194 :040?> def foo; puts "foo"; end
1.9.3p194 :041?> end
=> nil
1.9.3p194 :042 > class MyClass
1.9.3p194 :043?> private
1.9.3p194 :044?> def bar; puts "bar"; end
1.9.3p194 :045?> end
=> nil
1.9.3p194 :046 > class YourClass < MyClass
@mark
mark / gist:3906904
Created October 17, 2012 17:32
Hash fun
1.9.2p318 :001 > h = { :foo => :bar, :baz => :quux }
=> {:foo=>:bar, :baz=>:quux}
1.9.2p318 :003 > h::foo
=> :bar
1.9.2p318 :004 > h::baz
=> :quux
module TableBuilderHelper
def column(options = {}, &block)
@table ||= TableBuilderHelper::TableBuilder.new(self)
@table.add_column(options, block)
end
def row_dom_id(&block)
@table ||= TableBuilderHelper::TableBuilder.new(self)
@mark
mark / gist:3146535
Created July 19, 2012 20:25
Letter triplets
$ cat /usr/share/dict/words | grep -e '\(.\)\1\1'
bossship
demigoddessship
goddessship
headmistressship
patronessship
wallless
whenceeer
@mark
mark / database.yml
Created July 16, 2012 15:03
Team Player Super Duper CAS
development_postgres: &postgres
adapter: postgresql
encoding: unicode
database: team_player_development
username:
password:
development:
<<: *postgres
@mark
mark / gist:2512455
Created April 27, 2012 20:03
Go Right
Castlevania IV
Super Metroid
Kirby SNES (not sure)
Adventure Island
Castlevania 1
Ducktales
Super Ghouls and Ghosts
Castlevania Symphony of the Night
Castlevania Dawn of Sorrow
Aladdin
@mark
mark / development.log.sql
Created April 27, 2012 14:23
Marginalia with line # output
RightsHandler Load (0.5ms) SELECT * FROM "rights_handlers" WHERE ("rights_handlers"."id" = 2) /* /Users/mark/Development/Work/AMS/cpi2/app/helpers/title_helper.rb:143:in `link_for_edit' -- application:rails,controller:students,action:show */
@mark
mark / C style comment blocks
Created April 5, 2012 19:04
Textmate snippets
/*${1/./*/g}**
* ${1/./ /g} *
* ${1:Comment Goes Here} *
* ${1/./ /g} *
**${1/./*/g}*/
$0