Skip to content

Instantly share code, notes, and snippets.


Chamnap Chhorn chamnap

View GitHub Profile
aermolaev / kill-frozen-passenger-instances
Created Dec 4, 2010
Inspecting Phusion Passenger's status and killing frozen apps
View kill-frozen-passenger-instances
#!/usr/bin/ruby -w
# for passenger 3.0
# cron
# */15 * * * * root /root/bin/kill-frozen-passenger-instances
require 'rubygems'
require 'net/http'
require 'uri'
yuki24 / gist:1187574
Created Sep 1, 2011 — forked from travis/gist:1084767
testing facebook connect with capybara and rspec
View gist:1187574
require 'mogli'
module FacebookIntegrationHelpers
shared_context "with unconnected facebook user" do
let(:fb_user) { create_test_user(installed: false) }
after { fb_user.destroy }
def app_client, AppConfig.facebook.app_id)
cstrahan /
Created Apr 11, 2012 — forked from wm/
TMUX Pairing

SSH setup for remote pairing

If Animal and Fozzie wanted to pair on Animals machine and they both have access to then they could use the following setup

  • Animal will have the following in ~/.ssh/config
Host tunnel_from_muppets
  RemoteForward 1235 localhost:22
jshaw / FacebookPageTabResizeiFrame.html
Created Jul 26, 2012
Resize the Facebook iFrame Tab Page with resizing content and different page heights on page loads.
View FacebookPageTabResizeiFrame.html
<!DOCTYPE html>
<html lang="en" style="overflow: hidden">
<body style="overflow:hidden">
<!-- You need to include jquery & FBSDK-->
<div id="fb-root"></div>
window.fbAsyncInit = function() {
ryanb / spec_helper.rb
Created Sep 12, 2011
Use RSpec tags to add behavior around specs.
View spec_helper.rb
# Add this to your spec_helper.rb
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.around(:each, :vcr) do |example|
name = example.metadata[:full_description].downcase.gsub(/\W+/, "_").split("_", 2).join("/")
VCR.use_cassette(name, :record => :new_episodes) do
ryanb / spec_helper.rb
Created Sep 12, 2011
Focus on specific specs in RSpec
View spec_helper.rb
# add this to your spec helper
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
# and then use the :focus tag in your specs
it "does something awesome", :focus do
Mic92 / index.html
Last active Dec 15, 2015
Zeroclipboard css styling for twitter bootstrap
View index.html
<button id="copy" class="btn">Copy</button>
View mongoid_observers.rb
module MyObservers
module Document
module ClassMethods
def observers= (*observers)
def declared_observers
@declared_observers ||= []
ryanb / tasks_controller_refactoring.rb
Created Nov 9, 2012
Variation of RubyTapas episode "021 Domain Model Events" without using callbacks
View tasks_controller_refactoring.rb
class TasksController < ApplicationController
def update
tracker =
if @task.update_attributes(params[:task]), socket_id).push_changes, current_user).deliver_email
# success response
# failure respond
mrrooijen / deploy.rb
Created Jun 26, 2011
Capistrano with Foreman Capfile
View deploy.rb
# encoding: utf-8
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :application, "hirefireapp"
set :repository, ""
set :branch, "develop"
set :rvm_ruby_string, "1.9.2"