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
function! g:FocusAndDispatchTestLine() | |
execute "Focus test-unit-runner %:" . line(".") . " -p" | |
execute "Dispatch" | |
endfunction | |
function! g:FocusAndDispatchTestFile() | |
execute "Focus test-unit-runner % -p" | |
execute "Dispatch" | |
endfunction |
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
VCR.configure do |config| | |
config.cassette_library_dir = "test/fixtures/cassettes" | |
config.hook_into :webmock | |
config.default_cassette_options = { | |
record: :once | |
} | |
config.before_record do |i| | |
if i.response.headers["Content-Type"].any? { |h| h =~ /json/ } | |
# Try to pretty format json body, rescue and proceed if it's not possible | |
i.response.body.replace JSON.pretty_generate(JSON.parse(i.response.body)) rescue nil |
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
" Vim compiler file | |
" Language: RSpec | |
" Maintainer: Tim Pope <[email protected]> | |
" URL: https://github.com/vim-ruby/vim-ruby | |
" Release Coordinator: Doug Kearns <[email protected]> | |
if exists("current_compiler") | |
finish | |
endif | |
let current_compiler = "rspec" |
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
#!/bin/bash | |
ROUTES_CACHE_FILE="tmp/routes_cache.txt" | |
if [ "$1" == "clear" ]; then | |
if [ "$2" != "--yes" ]; then | |
echo -n "Removing ${ROUTES_CACHE_FILE}: are you sure? [yn] " | |
read yes | |
if [ "$yes" != "y" ]; then | |
echo "Didn't get 'y'. Bailing..." |
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 theStuff = ["foo", "bar", "baz"] | |
-- in foldl............................................. vvv is first, vvv is second... | |
let wtffoldl = foldl iterator "" theStuff where iterator concatedStuffs stuff = concatedStuffs ++ stuff | |
-- ...but in foldr.......................................vvv and vvv are reversed. | |
let wtffoldr = foldr iterator [] theStuff where iterator stuff concatedStuffs = stuff ++ concatedStuffs |
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
class Activation | |
def initialize(user, activation_token) | |
@user, @activation_token = user, activation_token | |
end | |
def activate | |
if @user.activation_token == hash_token(@activation_token) | |
@user.update_attributes!({ | |
activated_at: Time.now, | |
locked_at: nil, |
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
class Activation | |
# ...initialization... | |
def activate | |
if @user.activation_token == hash_token(@activation_token) | |
@user.update_attributes!({ | |
activated_at: Time.now, | |
locked_at: nil, | |
activation_token: nil | |
}) |
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
class Activation | |
# ...initialization... | |
def activate | |
if user.activation_token == hash_token(activation_token) | |
user.update_attributes!({ | |
activated_at: Time.now, | |
locked_at: nil, | |
activation_token: nil | |
}) |
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
class Activation < Struct.new(:user, :activation_token) | |
def activate | |
if user.activation_token == hash_token(activation_token) | |
user.update_attributes!({ | |
activated_at: Time.now, | |
locked_at: nil, | |
activation_token: nil | |
}) | |
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
def array_reverse(array) | |
return array if array.empty? | |
[array.pop] + array_reverse(array) | |
end |