Skip to content

Instantly share code, notes, and snippets.

View gertig's full-sized avatar

Andrew Gertig gertig

View GitHub Profile
require 'rake/clean'
HAML = FileList['**/*.haml']
LESS = FileList['**/*.less']
COFFEE = FileList['**/*.coffee']
HTML = HAML.ext('html')
CSS = LESS.ext('css')
JS = COFFEE.ext('js')
@gertig
gertig / node-and-npm-easy-install.sh
Created March 15, 2011 12:28
Install Node and npm on Mac OS X in a few simple steps. This is based on a gist by isaacs
#Execute all of these commands starting at your root. you can type: cd ~ to make sure you are there
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bash_profile # Mac OS X runs .bash_profile not .bashrc each time a new terminal window is opened.
. ~/.bash_profile
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # this takes a couple of minutes
Host heroku.com
HostName heroku.com
User git
IdentityFile ~/.ssh/heroku.identity
IdentitiesOnly yes
@gertig
gertig / devise_invitable_add_to_users.rb
Created March 27, 2011 15:07
devise_invitable migration file if adding to existing Model
class DeviseInvitableAddToUsers < ActiveRecord::Migration
def self.up
change_table :users do |t|
t.string :invitation_token, :limit => 60
t.datetime :invitation_sent_at
t.index :invitation_token
t.integer :invitation_limit
t.integer :invited_by_id
t.string :invited_by_type
end
@gertig
gertig / Gemfile
Created March 27, 2011 15:34
To use devise_invitable "invitation_limit" add these to your Gemfile
gem 'devise', '~> 1.2.0'
gem 'devise_invitable', '~> 0.4.rc5'
class InvitationsController < Devise::InvitationsController
include Devise::Controllers::InternalHelpers #not sure if this is necessary
# POST /resource/invitation
def create
#Assuming the user_id of the gifted user is = 1
if current_user.id == 1
current_user.increment!(:invitation_limit)
www:
requirements:
- faye
- jade
@gertig
gertig / css_transform_rotate.css
Created April 12, 2011 15:10
Rotate a div with CSS by adding a class to it.
/* Compass .scss for rotating the div when the class of .open is added to it and rotating back when it is removed */
#direction_arrow {
position: absolute;
right: 5px;
top: 135px;
cursor: pointer;
z-index: 999999;
-webkit-transition: all 0.1s linear;
&.open {
@gertig
gertig / app.js
Created April 27, 2011 15:13
Learning Backbone
//Trying to put it all in one file then break it out later.
// Load the application once the DOM is ready
$(function(){
////////////////////////////////////////////////////////
// Dog Model
////////////////////////////////////////////////////////
window.Dog = Backbone.Model.extend({
@gertig
gertig / index.html.erb
Created April 27, 2011 15:16
Learning Backbone - index.html.erb file
<h1>All Dogs</h1>
<div id="dogsapp">
<div id="dogs">
<table id="dog-table">
<tr>
<th>Name</th>
<th>Color</th>
<th>Age</th>
</tr>