Skip to content

Instantly share code, notes, and snippets.

View wookiehangover's full-sized avatar
💭
just setting up my gthb...

Sam Breed wookiehangover

💭
just setting up my gthb...
View GitHub Profile
before_filter :find_user, :only => [:show, :edit, :update, :destroy]
def find_user
id = params[:id] == 'current' ? current_user.id : params[:id]
@user = User.find(id)
end
// and in your application controller
def current_user
@wookiehangover
wookiehangover / build.sh
Created March 18, 2012 19:25
node dev w/ mongo
#!/bin/sh
# OpDemand build script for Puppet-managed servers
# This script runs as "root" on first boot
# typically invoked by OpDemand orchestration
# set locale for calls that require encoding
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
17:23:16 web.1 | Started POST "/share" for 127.0.0.1 at Fri Mar 30 17:23:14 -0600 2012
17:23:16 web.1 | Processing by SharingController#create as JSON
17:23:16 web.1 | Parameters: {"title"=>"quickleft's Profile", "url"=>"http://chnl.io/H0frw5", "facebook"=>"false", "message"=>"quickleft's Profile http://chnl.io/H0frw5 via @CHNLapp", "email"=>"false", "twitter"=>"true", "sharing"=>{"title"=>"quickleft's Profile", "url"=>"http://chnl.io/H0frw5", "action"=>"create", "facebook"=>"false", "controller"=>"sharing", "message"=>"quickleft's Profile http://chnl.io/H0frw5 via @CHNLapp", "email"=>"false", "twitter"=>"true"}}
17:23:16 web.1 | User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
17:23:16 web.1 | Plugin::Twitter::Authentication Load (0.6ms) SELECT "authentications".* FROM "authentications" WHERE "authentications"."type" IN ('Plugin::Twitter::Authentication') AND "authentications"."user_id" = 2 LIMIT 1
17:23:16 web.1 | ### EXCEPTIO
@wookiehangover
wookiehangover / gist:2346172
Created April 9, 2012 19:55
lighting agency gems
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (2.3.8)
actionpack (2.3.8)
activemodel (3.0.0)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (3.0.0, 2.3.8)
acts-as-taggable-on (2.0.6)
@wookiehangover
wookiehangover / gist:2378003
Created April 13, 2012 16:11
Reports/Modules CRUD

Reports CRUD

{

  project_id: 1234,

  title: "Foobar",

  description: "...",
@wookiehangover
wookiehangover / redis-install.sh
Created April 15, 2012 01:38
Redis Install Script
#!/bin/bash
# Install Redis
echo 'Install Redis'
cd /tmp
mkdir redis && cd redis
wget http://redis.googlecode.com/files/redis-2.4.10.tar.gz
tar -zxf redis-2.4.10.tar.gz
cd redis-2.4.10
make && make install
<form>
<div class="form-row">
<label for="red">Red</label>
<input type="range" name="red" min="0" max="255"/>
</div>
<div class="form-row">
<label for="green">Green</label>
<input type="range" name="green" min="0" max="255"/>
</div>
<div class="form-row">
test = function(){ xhr = new XMLHttpRequest(); xhr.open('POST', '/api/redis/add'); xhr.send("result=%7B%22photos%22%3A%5B%7B%22typeName%22%3A%22Other%22%2C%22type%22%3A%22google+profile%22%2C%22typeId%22%3A%22other%22%2C%22url%22%3A%22http%3A%2F%2Fwww.google.com%2Fs2%2Fphotos%2Fpublic%2FAIbEiAIAAABDCMiD-f7r6tuAByILdmNhcmRfcGhvdG8qKDQzOGVhNTZhYTI2ZGRiZGQ5YzM1NWMyYTgyMTNlNDQ4OTM0ODUyYTEwARMny2VLMw0tcTf-bLNdwxvbUs8G%22%7D%2C%7B%22typeName%22%3A%22Gravatar%22%2C%22isPrimary%22%3Atrue%2C%22type%22%3A%22gravatar%22%2C%22typeId%22%3A%22gravatar%22%2C%22url%22%3A%22http%3A%2F%2F2.gravatar.com%2Favatar%2Fe1a68abab30952d69ae262b367dc9a54%22%7D%5D%2C%22contactInfo%22%3A%7B%22familyName%22%3A%22AbiEzzi%22%2C%22givenName%22%3A%22Mike%22%2C%22fullName%22%3A%22Mike+AbiEzzi%22%2C%22websites%22%3A%5B%7B%22url%22%3A%22http%3A%2F%2Fwww.google.com%2Freader%2Fshared%2Fmjezzi%22%7D%5D%7D%2C%22status%22%3A200%2C%22demographics%22%3A%7B%22gender%22%3A%22male%22%7D%2C%22socialProfiles%22%3A%5B%7B%22typeName%22%3A%22Google+Profile%22%
@wookiehangover
wookiehangover / gist:2866166
Created June 4, 2012 03:30
alternate dominode filestream implementation
(function(){
var stream = require('stream');
var util = require('util');
function FileStream( files, type ){
if( !(this instanceof FileStream) ){
throw new Error("FileStream is a constructor. Try using `new`");
}
@wookiehangover
wookiehangover / gist:2984062
Created June 24, 2012 17:14
hardcore.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Foreground Color</key>
<dict>
<key>Red Component</key>
<real>0.627450980392157</real>
<key>Blue Component</key>
<real>0.627450980392157</real>