autocmd BufWritePre * :%s/\s\+$//e
(add-hook 'before-save-hook 'delete-trailing-whitespace)
| #! /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 |
| # 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 |
| # [] - 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 |
| #!/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 |
| require 'rubygems' | |
| require 'haml' | |
| require 'effigy' | |
| require 'effigy/core_ext/hash' | |
| template = Haml::Engine.new(%{%html | |
| %head | |
| %title | |
| %body | |
| %h1 |
| 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 |
| # 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 |