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! s:join(cmd) | |
if exists(':SplitjoinJoin') && !v:count | |
let tick = b:changedtick | |
SplitjoinJoin | |
if tick == b:changedtick | |
execute 'normal! '.a:cmd | |
endif | |
else | |
execute 'normal! '.v:count.a:cmd | |
endif |
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
# Add config/overrides/*.yml to .gitignore | |
# and this near the top of application.rb | |
%w(defaults overrides).each do |type| | |
path = File.expand_path("../#{type}/#{Rails.env}.yml", __FILE__) | |
ENV.update(YAML.load_file(path)) if File.exist?(path) | |
end | |
# For things that are sensitive or developer dependent: | |
# config/overrides/{development,test}.yml | |
# For everything else: |
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
Sprockets::Helpers::RailsHelper::AssetPaths.class_eval do | |
class MissingAssetError < StandardError; end | |
def digest_for_with_presence_check(logical_path) | |
unless asset_environment[logical_path] | |
raise MissingAssetError.new("#{logical_path} doesn't exist") | |
end | |
digest_for_without_presence_check(logical_path) | |
end | |
alias_method_chain :digest_for, :presence_check |
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
targets=( ${${(f)"$(_call_program targets $words[1] -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} ) |
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
ids = (1..1_000_000).to_a; nil | |
x = rand(1_000_000) | |
Benchmark.realtime do | |
the_set = ids.to_set | |
1000.times do | |
the_set.include?(x) | |
end | |
end | |
# => 0.7543990612030029 |
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
+__rvm_parse_args:727> [[ -n 4.3.10 ]] | |
+__rvm_parse_args:750> [[ -z '' && -n '' ]] | |
+__rvm_parse_args:752> [[ 0 -eq 1 || -n '' ]] | |
+__rvm_parse_args:20> [[ -n use ]] | |
+__rvm_parse_args:22> rvm_token=use | |
+__rvm_parse_args:24> (( 1 > 0 )) | |
+__rvm_parse_args:26> next_token=1.9.3-preview1@unknown | |
+__rvm_parse_args:27> shift | |
+__rvm_parse_args:32> case use ([[:alnum:]]*|@*) | |
+__rvm_parse_args:36> case use (use) |
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
# ~/.rvm/hooks/after_cd | |
local dir="$PWD" | |
while [ "$(dirname "$dir")" != "$dir" ]; do | |
if [ -f "$dir/.rbenv-version" ]; then | |
rvm use "$(cat "$dir/.rbenv-version")" | |
break | |
fi | |
dir="$(dirname "$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
%fieldset.account_info | |
- ["First Name","Last Name","Email","Choose Password"].each do |n| | |
%dl.half | |
%dt | |
%label{:class => cycle("required", "", "required", "required")}=n | |
%dd | |
%input(type="text") |
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 UploadsController < ApplicationController | |
def show | |
headers['Cache-Control'] = 'public; max-age=600' | |
send_file Rails.root.join("tmp/uploads/#{params[:path]}"), :disposition => 'inline' | |
end | |
end |