Skip to content

Instantly share code, notes, and snippets.

View marianposaceanu's full-sized avatar

Posăceanu Marian marianposaceanu

View GitHub Profile
require 'benchmark'
timings = {}
measure_feature = -> feature_path {
time = Benchmark.measure {
puts "Benchmarking feature #{feature_path}."
cmd = `cucumber --format json -r features '#{feature_path}'`
}
@marianposaceanu
marianposaceanu / capybara cheat sheet
Created August 29, 2016 12:55 — forked from zhengjia/capybara cheat sheet
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')
@marianposaceanu
marianposaceanu / octopus.rest.md
Last active June 10, 2016 12:05
octopus.rest - state of the art REST client

@marianposaceanu
marianposaceanu / mkvit.rb
Last active May 19, 2016 10:45
Convert videos to H.264 mkv easily (using ffmpeg)
# _ _ _
# | | (_)| |
# _ __ ___ | | ____ __ ______ _ | |_
# | '_ ` _ \ | |/ /\ \ / /|______|| || __|
# | | | | | || < \ V / | || |_
# |_| |_| |_||_|\_\ \_/ |_| \__|
#
# Simple script to convert your old video files to H.264 mantaining their quality
#
# Usage:
@marianposaceanu
marianposaceanu / branching.md
Last active April 14, 2016 09:54
Git: naming branches

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

# 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
@marianposaceanu
marianposaceanu / ElCapitan.applescript
Created February 17, 2016 00:35 — forked from nrollr/ElCapitan.applescript
Performance improvements for El Capitan
-- 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
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
# 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