This file contains hidden or 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
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 |
This file contains hidden or 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
#!/bin/sh | |
#define you database user: | |
USR="root" | |
#define your database password: | |
PWD="" | |
formatt () { | |
LINES=$1 | |
FLINE=$(echo "$LINES"|head -1) |
This file contains hidden or 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
# basic example on how to create module methods not accessible for classes are including it | |
module Foo | |
class << self | |
def show_me | |
puts 'Foo' | |
end | |
end | |
end |
This file contains hidden or 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
require 'rubygems' | |
require 'haml' | |
require 'effigy' | |
require 'effigy/core_ext/hash' | |
template = Haml::Engine.new(%{%html | |
%head | |
%title | |
%body | |
%h1 |
This file contains hidden or 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
# forget all that funky code I wrote before; all you have to type is this shit below; it will do the trick; | |
diff -Naur dir-A dir-B > out.patch |
This file contains hidden or 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
#!/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 |
This file contains hidden or 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
# [] - 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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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 NilClass | |
def > value | |
false | |
end | |
def <=> value | |
return 0 if value.nil? | |
end | |
alias_method :<, :> |
This file contains hidden or 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
# this should exist natively | |
# extending strftime for syntatic sugar sake | |
class Time | |
def % str | |
strftime(str) | |
end | |
end | |
# usage |