Skip to content

Instantly share code, notes, and snippets.

View tsechingho's full-sized avatar

Tse-Ching Ho tsechingho

View GitHub Profile
@nysalor
nysalor / staging.rb
Created March 8, 2012 09:36
capistrano multistage deploy_to(fixed)
set(:deploy_to) { "/var/www/#{application}-#{rails_env}" }
set(:releases_path) { File.join(deploy_to, version_dir) }
set(:shared_path) { File.join(deploy_to, shared_dir) }
set(:current_path) { File.join(deploy_to, current_dir) }
set(:release_path) { File.join(releases_path, release_name) }
# unicornを使っているなら以下も
set(:unicorn_config) { "#{current_path}/config/unicorn.rb" }
set(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" }
@ches
ches / comments_controller_spec.rb
Created February 8, 2012 00:36
RESTful controller spec examples
# This uses more real data and less mocking and stubbing for more direct and obvious code.
# It's probably easier to follow for people new to testing.
require 'spec_helper'
describe Notes::CommentsController do
let!(:commenter) { User.make! }
let!(:note) { Note.make! }
let(:comment) do
note.comments << Comment.make
@fernandoacorreia
fernandoacorreia / h5bp-twitter-bootstrap
Created February 2, 2012 00:31 — forked from mklabs/bootstrap-plugins.txt
h5bp + twitter bootstrap integration
#!/usr/bin/env bash
src=$PWD
ant_build_script_remote=https://github.com/h5bp/ant-build-script.git
h5bp_remote=git://github.com/h5bp/html5-boilerplate.git
bootstrap_remote=git://github.com/twitter/bootstrap.git
ant_build_script_branch=master
h5bp_branch=master
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@bigfive
bigfive / 20120118012543_create_site_configuration.rb
Created January 20, 2012 02:01
Ruby on Rails. Key value table for site configuration integrated with Active admin and formtastic forms
# db/migrations/20120118012543_create_site_configuration.rb
class CreateSiteConfigurations < ActiveRecord::Migration
def change
create_table :site_configurations do |t|
t.string :key
t.text :value
t.string :form_type
t.string :form_collection_command
@xdite
xdite / gist:1599619
Created January 12, 2012 09:47
Debian DRBD + MySQL + HeartBeat
@seyhunak
seyhunak / simple_form.rb
Created December 14, 2011 23:17
Using simple_form and integrating Twitter Bootstrap
1. Use latest build
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
2. Create an initializer
# /config/initializers/simple_form.rb
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a complete input.
# You can remove any component from the wrapper, change the order or even
@josevalim
josevalim / 1_README.md
Created December 13, 2011 09:30
FSSM based FileWatcher for Rails

Rails 3.2 ships with a simple FileWatcher that only reloads your app if any of the files changed.

Besides, it also provides a mechanism to hook up your own file watcher mechanism, so we can use tools like FSSM that hooks into Mac OS X fsevents. This is an example on how to hook your own mechanism (you need Rails master, soon to be Rails 3.2):

  1. Copy the 2_file_watcher.rb file below to lib/file_watcher.rb

  2. Add the following inside your Application in config/application.rb

if Rails.env.development?

@johnthethird
johnthethird / server.log
Created December 3, 2011 03:37
Torquebox error: (LoadError) library `fcntl' could not be loaded: java.lang.NullPointerException
## SOLUTION
I was able to get past the error by putting this line at the top of config/application.rb
require 'fcntl'
##
torquebox-2.0.0.beta1
$ uname -a
Darwin JohnsAir.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
@jesteracer
jesteracer / mongoid-cheatsheet.md
Created November 16, 2011 21:04 — forked from icebreaker/mongoid-cheatsheet.md
Mongoid cheat sheet