This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
sql = 'look "quotes," a \backslash, and #{:interpolation}' | |
puts instance_eval(%("#{sql.gsub(/[\\"]/,'\\\\\\&')}")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: test | |
Scenario: test | |
When I run the suite | |
Then the method should be callable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Kernel | |
def blank_context(*args, &block) | |
ivars = args.extract_options! | |
args.push(/^__/) | |
klass = Class.new do | |
instance_methods.each do |m| | |
undef_method(m) unless args.any? { |pattern| m =~ pattern } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hcd() { | |
cd "$HASHROCKET_DIR/$1" | |
} | |
if [ -n "$BASH_VERSION" ]; then | |
_hcd() | |
{ | |
local cur projects | |
[ -r "$HASHROCKET_DIR" ] || return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:ack = "ack -H" | |
function! s:ack(cmd,args) | |
let grepprg_bak = &grepprg | |
try | |
let &grepprg = g:ack | |
silent execute a:cmd . ' ' . a:args | |
finally | |
let &grepprg = grepprg_bak | |
endtry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" hashrocket.vim | |
" vim:set ft=vim et tw=78 sw=2: | |
if $HASHROCKET_DIR == '' && expand('<sfile>') =~# '/ops/hashrocket\.vim$' | |
let $HASHROCKET_DIR = expand('<sfile>')[0 : -20] | |
endif | |
if $HASHROCKET_DIR == '' && filereadable(expand('~/.bashrc')) | |
let $HASHROCKET_DIR = expand(matchstr("\n".join(readfile(expand('~/.bashrc')),"\n")."\n",'\n\%(export\)\=\s*HASHROCKET_DIR="\=\zs.\{-\}\ze"\=\n')) | |
endif | |
if $HASHROCKET_DIR == '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable Webrat's Selenium mode if one or more scenarios is tagged @selenium | |
Webrat.configure do |config| | |
config.mode = :rails | |
ObjectSpace.each_object(Cucumber::Ast::Features) do |features| | |
config.mode = :selenium if features.tag_count('selenium').nonzero? | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 | |
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^(.*) in the "([^\"]*)" section$/ do |action, title| | |
within "//*[(h1|h2|h3|h4|h5|h6|legend|caption)/descendant-or-self::*[contains(text(), '#{title}')]]" do | |
When action | |
end | |
end | |
When /^(.*) in the "([^\"]*)" row$/ do |action, title| | |
within "//*[(th|td)/descendant-or-self::*[contains(text(), '#{title}')]]" do | |
When action | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mask _;_[6..-5]='*'.*_.size-10;_;end |
OlderNewer