Skip to content

Instantly share code, notes, and snippets.

@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@mikhailov
mikhailov / installation.sh
Created November 23, 2010 15:18
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
var sys = require("sys");
var http = require("http");
// http://search.twitter.com/search.json?q=
// http://search.twitter.com/search.json?q=%s&since_id=%s
var twitter_search = http.createClient(80, "search.twitter.com");
var since_id=0;
var timeo=2000;
var sys = require("sys");
var http = require("http");
var connections=[];
function update() {
if (connections.length) {
connections.forEach(function(c) {
sys.puts(JSON.stringify(c));
c.sendBody('oi\n');