autocmd BufWritePre * :%s/\s\+$//e
(add-hook 'before-save-hook 'delete-trailing-whitespace)
# collect information about a running process | |
# ruby debug.rb <pid> | |
begin | |
raise ArgumentError unless pid = ARGV[0] | |
pid = pid.to_i | |
Process.kill(0,pid) | |
rescue TypeError, ArgumentError | |
raise 'pid required' | |
rescue Errno::ESRCH |
dns - http://freedns.ws | |
google apps - http://google.com/a | |
yola, pra criar o site - http://www.yola.com/ | |
logonerds, logos por $50 - http://www.logonerds.com/ | |
wuffo, forms builder - http://wufoo.com/ | |
analytics, pra monitorar - http://www.google.com/analytics/ | |
blog (tumblr) | |
adwords |
require 'rubygems' | |
require 'haml' | |
require 'effigy' | |
require 'effigy/core_ext/hash' | |
template = Haml::Engine.new(%{%html | |
%head | |
%title | |
%body | |
%h1 |
#!/bin/bash | |
# run with: curl -s http://gist.github.com/265272.txt | bash | |
set -e | |
localdir=$HOME/.mongodb | |
datadir=$localdir/data | |
conf=$localdir/mongod.conf | |
agent=$HOME/Library/LaunchAgents/org.mongodb.mongod.plist | |
brew install mongodb |
# [] - Eqauls to | |
# ^ - Not equals to | |
# =~ - LIKE | |
# >, >=, <, <= works as expected | |
# | |
# Examples : | |
# | |
# Item.where(:colour['Red'], :quanity > 10, :price <= 200) | |
# Post.where(:comments_count >= 1, :taggings_count < 5) | |
# User.where(:country ^ 'US') # Non american users |
# Reincarnation for classes | |
class Class | |
def reincarnate | |
buried = Object.__send__(:remove_const, self.name) | |
Object.const_set(self.name, Class.new(buried)) | |
end | |
end | |
class Abc |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
#!/usr/bin/env ruby | |
# Usage: gemspec [-s] GEMNAME | |
# | |
# Prints a basic gemspec for GEMNAME based on your git-config info. | |
# If -s is passed, saves it as a GEMNAME.gemspec in the current | |
# directory. Otherwise prints to standard output. | |
# | |
# Once you check this gemspec into your project, releasing a new gem | |
# is dead simple: | |
# |
#!/bin/sh | |
# Usage: unicorn_github | |
# Script used to start unicorn in GitHub staging and production environments. | |
# This is called primarily by god. | |
set -e | |
# configure GC settings | |
export RUBY_HEAP_MIN_SLOTS=800000 | |
export RUBY_HEAP_FREE_MIN=100000 | |
export RUBY_HEAP_SLOTS_INCREMENT=300000 |