Skip to content

Instantly share code, notes, and snippets.

View wearethefoos's full-sized avatar

Wouter de Vos wearethefoos

View GitHub Profile
@wearethefoos
wearethefoos / commands.sh
Last active December 17, 2015 07:09
Install Ruby 2.0, Nginx, Postgres, Passenger, NodeJS, ElasticSearch on Ubuntu 12.10
# Install Ruby 2.0
apt-get -y update
apt-get -y -m install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev libxslt1-dev libxml2-dev libcurl4-openssl-dev libffi-dev libgdbm-dev libncurses5-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/ruby-2.1.0.tar.gz
tar xzvf ruby-2.1.0.tar.gz
cd ruby-2.1.0/
./configure --prefix=/usr/local
make
@vindia
vindia / routes.rb
Created April 11, 2012 08:07
Namespaced routing for subdomains in Rails
Rails::Application.routes.draw do
constraints :subdomain => 'admin' do
namespace(:admin, :path => '/') do
resources :books
end
end
end
@vindia
vindia / sticky-footer.html
Created November 14, 2011 15:09
A very simple sticky footer
@timblair
timblair / caveatPatchor.js
Created February 15, 2011 10:27 — forked from protocool/caveatPatchor.js
Sample caveatPatchor.js file for use in Propane 1.1.2 and above: pulls avatars from Gravatar
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
@wearethefoos
wearethefoos / CakePHP: Access SessionComponent from everywhere
Created February 11, 2011 17:43
A question a lot of people seem to ask about the CakePHP Session Component is how to access it from e.g. a Model. There are quite a few suggestions to be found on Google, but none of them strike me as very elegant. I came up with this one, and it works fr
App::import('Core', 'Controller');
App::import('Component', 'Session');
$Controller = new Controller();
$Session = new SessionComponent();
$Session->startup($Controller);
$Session->read('Auth.User');