Skip to content

Instantly share code, notes, and snippets.

View tors's full-sized avatar
:octocat:

Tors tors

:octocat:
  • Vim
View GitHub Profile
#!/bin/bash
#
# Find all the rails projects from this directory down and clear their log
# files to save some space.
#
base=`pwd`
for path in `find $base -type f -path '*/config/environment.rb'`
do
@tors
tors / example.conf
Created December 28, 2010 02:38 — forked from soffes/example.conf
server {
listen 80;
server_name example.com;
root /var/www/example.com/public;
#rails_env development;
passenger_enabled on;
charset utf-8;
}
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@tors
tors / .bashrc
Created February 22, 2011 01:44 — forked from julienXX/.bashrc
# Colors ----------------------------------------------------------
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
alias ls='ls -G' # OS-X SPECIFIC - the -G command in OS-X is for colors, in Linux it's no groups
#alias ls='ls --color=auto' # For linux, etc
//
// Backbone.Rails.js
//
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
//
// Load this file after backbone.js and before your application JS.
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
# http://antonio.ognio.com/2010/07/28/installing-redis-on-linux-and-mac-os-x/
wget http://redis.googlecode.com/files/redis-2.2.2.tar.gz
tar -xzvf redis-2.2.2.tar.gz
cd redis-2.2.2 && sudo make && sudo make install
Five binaries will be installed to /usr/local/bin, redis-server, redis-benchmark, redis-cli, redis-check-dump and redis-check-aof. You’ll have to manually copy the Redis configuration file to /etc like this:
sudo mkdir /etc/redis
sudo cp redis.conf /etc/redis/redis.conf
@tors
tors / backbone.rails.js
Created April 23, 2011 04:51 — forked from trydionel/backbone.rails.js
Makes Backbone.js play nicely with default Rails setup
//
// Backbone.Rails.js
//
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
//
// Load this file after backbone.js and before your application JS.
@tors
tors / stack.sh
Created May 1, 2011 07:02
Automated VPS Setup for Ubuntu 10.04 LTS (Lucid) - Rails with Nginx
#!/bin/bash
echo "Automated VPS Setup for Ubuntu 10.04 LTS (Lucid) - Rails with Nginx"
echo "chmod +x stack.sh"
echo "./stack.sh yourdomain.com"
echo "-------------------------------------------------------------------"
echo "Set Hostname"
echo "------------"
@tors
tors / Overlay.Mask.js
Created May 13, 2011 14:31 — forked from jiggliemon/Overlay.Mask.js
a simple Overlay class
if(!window.Overlay){
throw new Error('the Class "Overlay" doesn\'t appear to be present');
}
/*
* Overlay Mask
*/
(function($){
var Mask = {