This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
Sete Atitudes para Hackear a Indústria de Software | |
By Klaus Wuestefeld | |
1) Torne-se excelente. | |
Seja realmente bom em alguma coisa. Não fique só choramingando ou | |
querendo progredir às custas dos outros. Não pense q pq vc sentou 4 | |
anos numa faculdade ouvindo um professor falar sobre software q vc | |
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo |
require 'rubygems' | |
require 'mongo' | |
module MongoPubSub | |
QUEUES_COLLECTION = 'queues' | |
class EndSubscriptionException < Exception; end | |
class Publisher | |
def initialize(queue_name, mongo_connection) | |
# Initialize queue collection as a capped collection | |
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name) |
#base | |
First = lambda {|a, b| a} | |
Last = lambda {|a, b| b} | |
#conditional | |
True = First | |
False = Last | |
Not = lambda {|boolean| boolean[False, True]} | |
And = lambda {|boolean_a, boolean_b| boolean_a[boolean_b, False]} | |
Or = lambda {|boolean_a, boolean_b| boolean_a[True, boolean_b]} |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
require 'strong_parameters' | |
class ActiveRecord::Base | |
include ActiveModel::ForbiddenAttributesProtection | |
end | |
class ActionController::Base | |
# Use this with CanCan's load_resource to permit a set of params before | |
# it tries to build or update a resource with them. |
You probably don't want Google crawling your development staging app. Here's how to fix that.
$ mv public/robots.txt config/robots.production.txt
$ cp config/robots.production.txt config/robots.development.txt
Now edit config/routes.rb
to add a route for /robots.txt
, and add the controller code.
Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.
Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.
First you will need to get an OAuth Token from GitHub using your own username and "note"
Clínica geral: | |
Marcus Thuma. Kant Praxis | |
Centro para medicina interna | |
Cardiologia, Gastroenterologia, Clínica Geral | |
Kurfürstendamm 42 | |
10719 Berlim | |
Tel: (030) 88 71 44 60 | |
Fax: (030) 88 71 44 619 | |
E-mail: [email protected] |
You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.