Skip to content

Instantly share code, notes, and snippets.

View gosuri's full-sized avatar

Greg Osuri gosuri

View GitHub Profile
@gosuri
gosuri / nginx-unicorn.md
Created February 3, 2012 22:36
nginx with unicorn

nginx with unicorn (On Ubunty Lenny)

Nginx Installation

sudo apt-get install nginx
@gosuri
gosuri / move_to_rds.rb
Created January 20, 2012 08:13 — forked from guenter/move_to_rds.rb
A quick and dirty script to move a database into Amazon RDS (or any other database). Can transfer part of the data beforehand.
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
@gosuri
gosuri / base62.rb
Created January 15, 2012 20:40
Base 62 in Ruby
module Base62
SIXTYTWO = ('0'..'9').to_a + ('a'..'z').to_a + ('A'..'Z').to_a
def encode( numeric )
raise ArgumentError unless Numeric === numeric
return '0' if numeric == 0
s = ''
while numeric > 0
s << Base62::SIXTYTWO[numeric.modulo(62)]
numeric /= 62
# May not be the best approach
# Issues with Proxies limititing headers
# Headers could be cached
# Not sure of having JSON
class ApplicationController < ActionController::Base
after_filter :flash_to_headers
def flash_to_headers
@gosuri
gosuri / config_loader.rb
Created January 7, 2012 00:03
Config Loader For Rails
CONFIG = HashWithIndifferentAccess.new(YAML::load(ERB.new(IO.read(File.join(Rails.root, 'config', 'config.yml'))).result)[Rails.env])
@gosuri
gosuri / lipsum.md
Created November 23, 2011 06:03
Hipster Lipsum

Artisanal filler text for your project.

Beard fixie carles, letterpress thundercats yr aesthetic organic locavore. Craft beer tofu scenester shoreditch before they sold out. Trust fund viral helvetica organic brooklyn. Iphone mcsweeney's banh mi, salvia freegan vice tattooed organic cred whatever art party retro etsy fixie vegan. Photo booth 3 wolf moon dreamcatcher cred hoodie butcher. Brunch mcsweeney's beard helvetica, brooklyn viral put a bird on it 3 wolf moon you probably haven't heard of them whatever fanny pack VHS gluten-free. Cosby sweater irony +1 photo booth synth tumblr you probably haven't heard of them 3 wolf moon.

+1 leggings put a bird on it, stumptown portland brunch master cleanse mixtape brooklyn artisan VHS. Before they sold out skateboard banh mi viral american apparel keytar cliche. Art party chambray single-origin coffee cardigan carles. Marfa 3 wolf moon wolf, biodiesel Austin farm-to-table master cleanse freegan cardigan you probably haven't h

source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'jquery-rails'
gem 'sqlite3'
gem 'pg'
gem 'ejs'
gem 'devise'
gem 'paperclip'
@gosuri
gosuri / missing-drawer-plugin.sh
Created August 15, 2011 23:50
Missing Drawer Plugin install
#!/bin/sh
curl -L https://github.com/downloads/jezdez/textmate-missingdrawer/MissingDrawer-0.4.0.tmplugin.zip | tar -xf - && open MissingDrawer.tmplugin
@gosuri
gosuri / text-mate-full-screen.sh
Created August 15, 2011 20:59
text-mate-full-screen.sh
#!/bin/sh
# Install EGO TextMateFullScreen Plugin for TextMate
# Usage : bash <(curl -s https://raw.github.com/gist/1147847/2a312eb2ebf91c3eb04cc15328dc5fa1f064b199/text-mate-full-screen.sh)
git clone https://github.com/enormego/EGOTextMateFullScreen.git /tmp/EGOTextMateFullScreen
/usr/bin/xcodebuild -project /tmp/EGOTextMateFullScreen/EGOTextMateFullScreen.xcodeproj -target EGOTextMateFullScreen
open /tmp/EGOTextMateFullScreen/build/Release/EGOTextMateFullScreen.tmplugin