Skip to content

Instantly share code, notes, and snippets.

View jasoares's full-sized avatar

João Soares jasoares

View GitHub Profile
CREATE TABLE `user` (
`twitter_id` int(10) unsigned NOT NULL,
`created_at` timestamp NOT NULL default '0000-00-00 00:00:00',
`name` varchar(80) NOT NULL,
`screen_name` varchar(30) NOT NULL,
`location` varchar(120) default NULL,
`description` varchar(640) default NULL,
`profile_image_url` varchar(400) NOT NULL,
`url` varchar(100) default NULL,
@jasoares
jasoares / ruby_32_vs_64_bits.sh
Created January 26, 2012 22:17
Quick command to check ruby environment for 32 bits vs 64 bits
ruby -e 'puts "#{1.size * 8} bits"'
@jasoares
jasoares / twitter_model_notes.txt
Created January 31, 2012 22:24
Twitter notes on model validation
twitter model validation and notes
username: max length 15
real name: max length 20 (first + last)
required field on new account creation(by this order):
real name
email
password
username
task :deploy => ['deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
task :migrations => [:push, :off, :migrate, :restart, :on, :tag]
task :rollback => [:off, :push_previous, :restart, :on]
task :push do
puts 'Deploying site to Heroku ...'
puts `git push heroku`
end
@jasoares
jasoares / curl_http_methods.sh
Created February 8, 2012 00:42
Curl HTTP PUT REST JSON - Update record
curl -i -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"score":{"comment":"Changed"}}' http://localhost:3000/scores/908005739.json
pt:
errors:
messages:
not_found: "não encontrado"
already_confirmed: "já foi confirmado"
not_locked: "não foi bloequeado"
devise:
failure:
unauthenticated: 'Para continuar, deve fazer login ou registrar-se.'
@jasoares
jasoares / gist:1946889
Created March 1, 2012 02:53
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@jasoares
jasoares / comparison.rb
Created March 5, 2012 16:48 — forked from andruby/comparison.rb
ruby comparison benchmark
require 'benchmark'
def is_it_true?
true
end
CONSTANT = 1
BenchTimes = 1_000_000
Benchmark.bm(20) do |bm|
directory "tmp"
file "tmp/hello.tmp" => "tmp" do
sh "echo 'Hello' > 'tmp/hello.tmp'"
end
task :default => 'morning:turn_off_alarm'
namespace :morning do
desc "Turn off alarm."