- 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
require 'web' | |
urls = { | |
'/', 'index', | |
'/users', 'users', | |
'/user/(\d+)', 'user', | |
'/users/new', 'new_user', | |
'/user/(\d+)/edit', 'edit_user' | |
} | |
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
# Monitor HTTP requests being made from your machine with a one-liner.. | |
# Replace "en1" below with your network interface's name (usually en0 or en1) | |
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*" | |
# OR.. to be able to use as "httpdump" from anywhere, drop this into ~/.bash_profile: | |
# (again replace "en1" with correct network interface name) | |
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"" | |
# All the above tested only on OS X. |
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
# Bash snippet to open new shells in most recently visited dir. | |
# Useful if you want to open a new terminal tab at the present | |
# tab's location. | |
# | |
# Put this in your .bashrc or whatever. | |
pathed_cd () { | |
if [ "$1" == "" ]; then | |
cd | |
else |
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
from twisted.words.protocols.jabber import client, jid | |
from twisted.words.xish import domish, xmlstream | |
from twisted.application import internet, service | |
# Python bindings for Growl come with the SDK: | |
# http://growl.info/downloads_developers.php | |
from Growl import GrowlNotifier, Image | |
JID = 'test@example.com' | |
PASSWORD = 'secret' |
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 'digest/sha1' | |
class String | |
def hash | |
Digest::SHA1.hexdigest self | |
end | |
def bit | |
"%0160b" % to_i(16) | |
end |
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
# Subject: Re: Newbie to Sinatra looking for example | |
# From: Ryan Tomayko <r@tomayko.com> | |
# To: sinatrarb@googlegroups.com | |
# Content-Type: text/plain; charset=UTF-8 | |
# | |
# > Alright, so I'm pretty new to both Sinatra and web applications, and I | |
# > was wondering if someone could write up a quick example use of | |
# > Sinatra. Basically I want to see how Sinatra handles <form>s in one | |
# > view, and then shows the input on a different view. | |
# > |
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/local/bin/macruby | |
framework 'Cocoa' | |
framework 'WebKit' | |
class VirtualBrowser | |
attr_reader :view, :file_name | |
def initialize | |
NSApplication.sharedApplication.delegate = self | |
@view = WebView.alloc.initWithFrame([0, 0, 1024, 768]) |
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
# for usage: ruby timecard.rb --help | |
require 'rubygems' | |
require 'optparse' | |
# This requires the 'cyberfox-gchart' gem (0.5.4), as the standard | |
# gchart gem is woefully broken for this kind of graph. Broken to the | |
# point that it's an inherent design choice that doesn't work well for | |
# this kind of chart. I'm sure that the cyberfox-gchart gem won't |
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
# for usage: ruby timecard.rb --help | |
require 'rubygems' | |
require 'optparse' | |
# This requires the 'cyberfox-gchart' gem (0.5.4), as the standard | |
# gchart gem is woefully broken for this kind of graph. Broken to the | |
# point that it's an inherent design choice that doesn't work well for | |
# this kind of chart. I'm sure that the cyberfox-gchart gem won't |
OlderNewer