Skip to content

Instantly share code, notes, and snippets.

@teohm
teohm / gist:1001626
Created June 1, 2011 01:35
Using RABL in Rails JSON Web API
# tryrabl/app/views/users/base.rabl
attributes :id, :username, :email, :display_name
@teohm
teohm / default.rb
Created July 18, 2011 01:44
rails_stack/recipes/default.rb
node.set['rvm']['default_ruby'] = 'ruby-1.9.2-p290'
require_recipe 'rvm'
node.set[:rvm_passenger][:rvm_ruby] = 'ruby-1.9.2-p290'
require_reciept 'rvm_passenger::nginx'
@teohm
teohm / gist:1833177
Created February 15, 2012 04:23 — forked from JoshMcKin/gist:801101
Nginx conf for thin clusters with shared ssl and redirect to ssl
user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@teohm
teohm / gist:1849497
Created February 17, 2012 01:16
Install MacVim (built with ruby) properly on Mac OSX
rvm system
brew install macvim --override-system-vim
rvm default
@teohm
teohm / demo.rb
Created May 9, 2012 08:51
Capistrano - basic setup
#config/deploy/demo.rb
# DEMO-specific deployment configuration
# please put general deployment config in config/deploy.rb
puts "****demo"
@teohm
teohm / gist:2656926
Created May 11, 2012 01:24
Practicing Ruby TOC
Volume 1 is more like normal book contents
Issue 1.1: Ruby's method lookup path, Part 1
Issue 1.2: Ruby's method lookup path, Part 2
Issue 1.3: Writing Configurable Applications, Part 1
Issue 1.4: Writing Configurable Applications, Part 2
Issue 1.5: Testing Anti-patterns; Testing Private Methods
Issue 1.6: Meditations on Bad and Good Code, Part 1
Issue 1.7: Meditations on Bad and Good Code, Part 2
Issue 1.8: Uses for Modules, Part 1
@teohm
teohm / deploy.rb
Created May 22, 2012 15:05
Capistrano deploy.rb for busy Rails developer
require 'capistrano_colors'
# App Info
# ========
#set :application, "set your application name here"
set :application, "learndeploy"
# Code Repo
# =========
#set :repository, "set your repository location here"
@teohm
teohm / gist:3149075
Created July 20, 2012 06:37 — forked from igrigorik/gist:3148848
Convert any YouTube video into an audio file you can listen to on the go...
# Convert any YouTube video into an audio file you can listen to on the go, using:
# http://rg3.github.com/youtube-dl/
{ ~ } > brew install ffmpeg
{ ~ } > brew install ffprobe
{ ~ } > wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl
{ ~ } > chmod u+x youtube-dl
# Pick which video format you want to download.. (use any YT video link)
@teohm
teohm / template
Created July 26, 2012 22:49
Rails templates & customer builder
# test
puts source_paths
## need a get_template to load template from remote URL
get 'https://raw.github.com/gist/3185065/builder', 'config/deploy.rb'
#!/bin/sh
~/Applications/UniversalIndentGUI/indenters/uncrustify -l OC -q -c ~/Applications/UniversalIndentGUI/config/uncrustify_obj_c.cfg