Skip to content

Instantly share code, notes, and snippets.

" flog wrappers
function! FlogFile()
let current = fnamemodify(expand("%"), ':p')
call FlogAnalyze(current)
endfunction
function! FlogAll()
call FlogAnalyze('app lib -g')
endfunction
function! ReloadAllBuffers()
set noconfirm
:bufdo e!
set confirm
endfunction
def self.default(options = {})
# Guess.
if ENV.include?("PHP_FCGI_CHILDREN")
# We already speak FastCGI
options.delete :File
options.delete :Port
Rack::Handler::FastCGI
elsif ENV.include?("REQUEST_METHOD")
Rack::Handler::CGI
#!/usr/bin/env bash
echo "Gem path: $GEM_PATH"
echo "Gem home: $GEM_HOME"
echo "Ruby version: $(ruby -v)"
echo ""
if ! `gem list rake -iq`
then
gem install --no-ri --no-rdoc bundler
else
@radamant
radamant / gist:702914
Created November 17, 2010 02:58
a-ha!
redis> lrange test-index-list 0 -1
1. "4"
2. "3"
3. "2"
4. "1"
redis> set test-index-index:4 100
OK
redis> set test-index-index:4 100
OK
redis> set test-index-index:3 500

Development

Guidelines

Underscores, spaces, tabs, dashes

ruby

def tabs_or_spaces

@radamant
radamant / pouch.rb
Created October 20, 2010 19:42
simple command that runs `mkdir -p new/path/; touch /new/path/file`
#!/usr/bin/env ruby
path = ARGV[0]
dir = File.dirname(path)
`mkdir -p #{File.dirname(path)}; touch #{path}`
var numbers = [1,2,3,4];
var numObject = {
1: 1,
2: 2,
3: 3,
4: 4
}
var funcs = [];
var rules = {"email-address":{minlength:10}}
// or var validations = { rules: {...}, messages: {...} }
for(fieldName in rules){
var element = $('input[name="' + fieldName + '"]');
var fieldRules = rules[fieldName]
for(ruleName in fieldRules){
var rule = {};
rule[ruleName] = fieldRules[ruleName];
#!/usr/bin/env ruby
def run(cmd)
puts ">> #{cmd}"
puts `#{cmd}`
end
branch = ARGV[0]
remote = branch.split("/")[0]
name = branch.split("/")[1]