View measure_features_run_time.rb
require 'benchmark'
timings = {}
measure_feature = -> feature_path {
time = Benchmark.measure {
puts "Benchmarking feature #{feature_path}."
cmd = `cucumber --format json -r features '#{feature_path}'`
}
View capybara cheat sheet
=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')
View mkvit.rb
# _ _ _
# | | (_)| |
# _ __ ___ | | ____ __ ______ _ | |_
# | '_ ` _ \ | |/ /\ \ / /|______|| || __|
# | | | | | || < \ V / | || |_
# |_| |_| |_||_|\_\ \_/ |_| \__|
#
# Simple script to convert your old video files to H.264 mantaining their quality
#
# Usage:
View branching.md

Examples

I'm working on a feature in ticket 59:

git co -b feature/59/add-filtering

I'm working on a bug:

git co -b bug/101/template-error

View neat_ruby_debug.rb
# The classics
class Foo
def bar; end
def self.baz; end
end
Foo.instance_method(:bar).source_location
Foo.method(:baz).source_location
# A tad more
View ElCapitan.applescript
-- Disable Time Machine Local Backups
sudo tmutil disablelocal
-- Disable Automatic Spell Checker
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
-- Disable animations when opening and closing windows.
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
-- Disable animations when opening a Quick Look window.
defaults write -g QLPanelAnimationDuration -float 0
-- Accelerated playback when adjusting the window size (Cocoa applications).
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
View half_half.rb
run_with_tco = ARGV.include?('-TCO')
# Force the ruby interpreter to use TCO
RubyVM::InstructionSequence.compile_option = {
tailcall_optimization: true,
trace_instruction: false
} if run_with_tco
puts 'To infinity and beyond!' if run_with_tco
View ban_the_banning.rb
# Definition of banning something
# to_ban = 'To prohibit (an action) or forbid the use of (something)'
EVERYTHING = -> (existing_bans) { def existing_bans.include?(obj); true; end }
@bans = []
ban_something = -> (how_to_ban) { how_to_ban.call(@bans) }
# Some simple tests