Skip to content

Instantly share code, notes, and snippets.

Stephan Kämper s2k

View GitHub Profile
View adams-heroku-values.md

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@s2k
s2k / gist:5375367
Created Apr 12, 2013
A way to chain class methods
View gist:5375367
class X
def self.m1
puts "m1 called"
self
end
def self.m2
puts "m2 called"
self
end
end
@s2k
s2k / output_to_stdout
Created Mar 6, 2012
Watir and a defined constant CONFIG - a failing test case
View output_to_stdout
Loaded suite C:/temp/test_watir_config_constant
Started
F
Finished in 1.156279 seconds.
1) Failure:
test_defined_global_constant_CONFIG_does_not_prevent_creating_a_browser_object(TestConfigConstant) [C:/temp/test_watir_config_constant.rb:9]:
Exception raised:
<#<NoMethodError: undefined method `split' for nil:NilClass>>.
@s2k
s2k / gist:1984945
Created Mar 6, 2012
Requiring 'rbconfig' doesn't seem to create a constant CONFIG (Windows)
View gist:1984945
C:\>irb
irb(main):001:0> CONFIG
NameError: uninitialized constant Object::CONFIG
from (irb):1
from C:/Ruby192/bin/irb:12:in `<main>'
irb(main):002:0> require 'rbconfig'
=> true
irb(main):003:0> CONFIG
NameError: uninitialized constant Object::CONFIG
from (irb):3
@s2k
s2k / gist:1984737
Created Mar 6, 2012
Requiring 'rbconfig' doesn't seem to create a constant CONFIG
View gist:1984737
[5] ... ~ #ruby -e "puts CONFIG"
-e:1:in `<main>': uninitialized constant Object::CONFIG (NameError)
[6] ... ~ #ruby -e "puts require 'rbconfig'; puts CONFIG"
true
-e:1:in `<main>': uninitialized constant Object::CONFIG (NameError)
@s2k
s2k / gist:1978920
Created Mar 5, 2012
Watir (2.0.4) creates a constant CONFIG upon calling Browser.new
View gist:1978920
C:\>irb -r watir
irb(main):001:0> CONFIG
NameError: uninitialized constant Object::CONFIG
from (irb):1
from C:/Ruby192/bin/irb:12:in `<main>'
irb(main):002:0> Watir::Browser.new.close
=> nil
irb(main):003:0> CONFIG.keys
=> ["DESTDIR", "MAJOR", "MINOR", "TEENY", "PATCHLEVEL", "INSTALL", "EXEEXT", "prefix", "ruby_install_name", "RUBY_INSTALL_NAME", "RUBY_SO_NAME", "PACKAGE", "BUI
LTIN_TRANSSRCS", "MANTYPE", "NROFF", "vendorhdrdir", "sitehdrdir", "rubyhdrdir", "UNIVERSAL_INTS", "UNIVERSAL_ARCHNAMES", "configure_args", "vendordir", "sitedi
@s2k
s2k / cucumber_textmate_rails_error_message.txt
Created Nov 21, 2010
The TextMate error message displayed after using CMG-R on a feature file in a Rails project.
View cucumber_textmate_rails_error_message.txt
:29:in `require': no such file to load -- spec (LoadError) from
:29:in `require' from /Users/stephan/Library/Application Support/TextMate/Bundles/Cucumber.tmbundle/Support/lib/cucumber/mate.rb:23:in `' from
:29:in `require' from
:29:in `require' from /Users/stephan/Library/Application Support/TextMate/Bundles/Cucumber.tmbundle/Support/lib/cucumber/mate/feature_helper.rb:1:in `' from
:29:in `require' from
:29:in `require' from /tmp/cucumber-7380.rb:2:in `'
@s2k
s2k / list_stepdefinitions.rb
Created Nov 8, 2010
Find and list the Cucumber step definitions in a project
View list_stepdefinitions.rb
path = File.join( File.dirname( __FILE__), 'features', 'step_definitions', '**', '*.rb' )
Dir[ path ].each{ | sdf |
puts "In #{ sdf }:"
lines = File.read( sdf )
puts lines
puts "STEPS"
lines.scan( /^\s*(Given|When|Then|And|But)\s+(.+)\s+(do|\{)(\s+\|.+\|)?$/ ).map{ | m |
# pp match
puts "#{ m[0] }: #{ m[ 1 ] }"
You can’t perform that action at this time.