Skip to content

Instantly share code, notes, and snippets.

@zh
zh / gist:2832946
Created May 30, 2012 02:22 — forked from jasoncodes/gist:1223731
Installing Ruby 1.9.3 with rbenv
brew install rbenv
brew install ruby-build
brew install --HEAD https://raw.github.com/jasoncodes/homebrew/rbenv-vars/Library/Formula/rbenv-vars.rb # https://github.com/mxcl/homebrew/pull/7891
brew install readline
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile
exec $SHELL -i # reload the shell
CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.3-p194
rbenv global 1.9.3-p194
gem install bundler rbenv-rehash git-up hitch gem-browse gem-ctags cheat awesome_print pry
gem ctags
@zh
zh / Gemfile
Created May 15, 2012 05:12 — forked from mbleigh/Gemfile
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'handlebars_assets'
gem 'coffee-script'
@zh
zh / application
Created March 14, 2012 05:06
Sprockets without Rails
ROOT
assets/
javascripts/
application.js
biz.js.coffee
bar.js.coffee
stylesheets/
application.css
baz.css.scss
foo.css.scss
@zh
zh / froth.rb
Created February 23, 2012 14:12 — forked from jimweirich/froth.rb
Stupid Simple Forth System in Ruby
# Example Usage: ruby froth.rb ": sq dup * ; 2 sq ."
class Froth
attr_reader :storage
attr_accessor :trace
WordDefinition = Struct.new(:name, :xt, :immediate)
class WordDefinition
def immediate?
immediate
@zh
zh / awesome-nginx.conf
Created February 17, 2012 08:16 — forked from vjt/awesome-nginx.conf
*AWESOME* nginx configuration for Ruby/Rack web applications
#
# mmm m m mmm mmm mmm mmmmm mmm
# " # "m m m" #" # # " #" "# # # # #" #
# m"""# #m#m# #"""" """m # # # # # #""""
# "mm"# # # "#mm" "mmm" "#m#" # # # "#mm"
#
# nginx configuration For Ruby/Rack web applications
#
# Cooked up with style, care and a bit of *secret*
# nerdy spice. :-)
@zh
zh / installation.sh
Created February 15, 2012 08:08 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
@zh
zh / puncher.rb
Created February 7, 2012 04:45 — forked from rawsyntax/puncher.rb
begin
require 'fsevent'
rescue LoadError
require 'rubygems'
require 'fsevent'
end
class Puncher < FSEvent
def initialize(command, files)
@zh
zh / almost-sinatra.rb
Created February 1, 2012 07:54 — forked from udzura/almost-sinatra.rb
expanding almost-sinatra.rb
%w(rack tilt backports).map do |lib|
require lib
end
%w(INT TERM).map do |sig|
trap(sig){ $r.stop }
end
Sinatra = Module.new {
extend Rack
a = (Application = Builder.new)
project :test => :rspec, :orm => :activerecord, :script => :jquery, :renderer => :erb
# admin interface
generate :admin
rake "ar:create ar:migrate"
rake :seed
git :init
git :add, "."
git :commit, "initial commit - admin interface"
project :test => :rspec, :orm => :mongoid
generate :model, "account username:string password:string"
generate :model, "post title:string body:string"
generate :controller, "posts get:index get:new post:new"
generate :migration, "AddEmailToAccount email:string"
generate :controller, "accounts get:index"
git :init
git :add, "."
git :commit, "initial commit"