This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| if Rails.version == '2.3.8' && Gem.available?('mongrel', Gem::Requirement.new('~>1.1.5')) && self.class.const_defined?(:Mongrel) | |
| # Pulled right from latest rack. Old looked like this in 1.1.0 version. | |
| # | |
| # def [](k) | |
| # super(@names[k] ||= @names[k.downcase]) | |
| # end | |
| # | |
| module Rack |
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| ################## | |
| # Original issue # | |
| ################## | |
| [11:05] > bundle exec rake spec | |
| (in [snip]) | |
| /Users/max/.rvm/rubies/jruby-1.5.3/bin/jruby -S bundle exec rspec [snip] | |
| /Users/max/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError) | |
| from /Users/max/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems.rb:211:in `activate' |
| require 'rubygems' | |
| require 'rack' | |
| class Object | |
| def webapp | |
| class << self | |
| define_method :call do |env| | |
| func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
| [200, {}, send(func, *attrs)] | |
| end |
| def m(*args) | |
| print "Args to m: ", args.inspect, " Result: " | |
| 120 | |
| end | |
| n = 6 | |
| o = 2 | |
| # Imagine using a language where whitespace is significant? Pah! | |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| # add this to your spec helper | |
| RSpec.configure do |config| | |
| config.treat_symbols_as_metadata_keys_with_true_values = true | |
| config.filter_run :focus => true | |
| config.run_all_when_everything_filtered = true | |
| end | |
| # and then use the :focus tag in your specs | |
| it "does something awesome", :focus do |
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html
| require 'rmagick' | |
| include Magick | |
| shredded = ImageList.new "TokyoPanoramaShredded.png" # the original source | |
| ROWS = shredded.rows # number of lines of pixes | |
| working = [] # a working array of images | |
| def strip_width | |
| 32 | |
| end |