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,
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
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
@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."
@jasoares
jasoares / minitest_spec_expectations.md
Created March 14, 2012 19:49 — forked from ordinaryzelig/minitest_spec_expectations.md
How to write MiniTest::Spec expectations

I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").

Understanding MiniTest::Expectations

Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):

# minitest/spec.rb

module MiniTest::Expectations
@jasoares
jasoares / Command line
Created March 14, 2012 21:58 — forked from txus/Command line
Test Framework Benchmark
$ gem install minitest rspec
$ time ruby rspec.rb && time ruby minispec.rb && time ruby minitest.rb
................
Finished in 0.01554 seconds
16 examples, 0 failures
ruby rspec.rb 0.21s user 0.08s system 99% cpu 0.290 total
-------------------------------
@jasoares
jasoares / .tmux.conf
Created April 13, 2012 19:37 — forked from josephj/.tmux.conf
My .tmux.conf
# General configuration.
# $ tmux show-options -g
set -g base-index 1
set -g display-time 5000
set -g repeat-time 1000
set -g status-keys vi
set -g status-utf8 on
set -g status-bg black
set -g status-fg white
set -g status-justify left
@jasoares
jasoares / rspec-syntax-cheat-sheet.rb
Created April 28, 2012 18:35 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")