- Start a Sinatra server on port 4000
- GET / to that server triggers a
git pull
and mod_rails restart - Hit port 4000 locally after pushing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User Sean Farley <[email protected]> | |
# Date 1382624667 -28800 | |
# Thu Oct 24 22:24:27 2013 +0800 | |
# Node ID dd6d51b7e12be5fab94a8779e890c5558e4d4001 | |
# Parent 86a3bc5c8ff689a291e86950a3d8fd327f42b870 | |
partial import | |
wiggled scp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# giftube – Generates an animated gif from a YouTube url. | |
# | |
# Usage: | |
# | |
# giftube [youtube url] [minute:second] [duration] | |
# | |
# ex. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
# url dsl -- the ultimate url dsl! | |
# | |
# You just can't beat this: | |
# | |
# $ irb -r url_dsl | |
# >> include URLDSL | |
# => Object | |
# >> http://github.com/defunkt.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# test/spec/mini 5 | |
# http://gist.github.com/307649 | |
# [email protected] | |
# | |
def context(*args, &block) | |
return super unless (name = args.first) && block | |
require 'test/unit' | |
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do | |
def self.test(name, &block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# collect information about a running process | |
# ruby debug.rb <pid> | |
begin | |
raise ArgumentError unless pid = ARGV[0] | |
pid = pid.to_i | |
raise ArgumentError unless pid > 0 | |
Process.kill(0,pid) | |
rescue TypeError, ArgumentError | |
raise 'pid required' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'curb' | |
require "net/http" | |
require 'benchmark' | |
# http://0.0.0.0:8080 | |
# | |
# class HomeController < ApplicationController | |
# def index | |
# sleep 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a useful little pattern for working with gems without | |
# explicitly requiring rubygems in your code. | |
# | |
# The approach taken is to require a library and catch any LoadError | |
# that might get thrown. In the rescue clause we require rubygems. | |
# | |
# The require method is nice in that it will return true if the code | |
# was loaded, and it returns false if the code was _already_ loaded. | |
# If the require of rubygems returns true, we will retry our original | |
# require. It will either succeed this time (since we now have rubygems |
NewerOlder