Skip to content

Instantly share code, notes, and snippets.

View leandro's full-sized avatar
🏠
Working from home

Leandro Camargo leandro

🏠
Working from home
View GitHub Profile
@leandro
leandro / debug.rb
Created October 14, 2009 13:58 — forked from tmm1/debug.rb
# 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
@leandro
leandro / carbon.md
Created November 6, 2009 02:01 — forked from defunkt/carbon.md

Vim

autocmd BufWritePre * :%s/\s\+$//e

Emacs

(add-hook 'before-save-hook 'delete-trailing-whitespace)

Textmate

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)
twitter
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
@leandro
leandro / super.rb
Created December 29, 2009 21:57 — forked from lifo/super.rb
# [] - 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
@leandro
leandro / gemspec
Created May 13, 2010 17:47 — forked from defunkt/gemspec
#!/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