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 'net/ssh/buffered_io' | |
require 'socket' | |
client = TCPSocket.new("localhost", 1234) | |
client.extend(Net::SSH::BufferedIo) | |
loop do | |
readers, writers = IO.select([client], [client], nil, 1) | |
next if readers.nil? | |
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 trivial HTTP proxy server, intended for use as a troubleshooting tool | |
# ONLY (not for real, actual, production use). I wrote this because I couldn't find | |
# a simple HTTP proxy that I could use to test HTTP proxy support in Net::SSH. | |
# | |
# This code is in the public domain, so do with it what you will! | |
require 'socket' | |
port = ARGV.shift || 8080 | |
address = ARGV.shift || "127.0.0.1" |
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
# Generates a series of substitution cipher puzzles. The messages to | |
# "encrypt" are take from a text file passed on the command-line, | |
# where each message is on one line. | |
# | |
# The output is a PDF, "codes.pdf". | |
# | |
# This was written for my 7 year-old, who loves doing substitution | |
# ciphers. | |
require 'prawn' |
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 | |
# ------------------------------------------------------------------------ | |
# bundle.rb | |
# author: Jamis Buck <[email protected]> | |
# usage: ruby bundle.rb <config.yml> | |
# | |
# Takes a configuration file in YAML format and writes a single ruby script | |
# that includes all the dependencies you specify. For example: | |
# |
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
AWESOME PEAR PIE | |
---------------- | |
Ingredients: | |
Crust: | |
* Your favorite 9" double crust pastry recipe (I use the one in the Better | |
Homes and Gardens cook book) |
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
" Lets you quickly find translation strings. Position your cursor over a translation | |
" key, type '<leader>rt' (whatever your leader character is configured to be, usually | |
" backslash, but I have mine set to comma) and the screen will split to show the | |
" corresponding translation string in config/locales/en.yml. | |
" | |
" Right now, this only supports en.yml, and does not search any other locations. | |
" Also, error handling is abysmal. :) But it does what I need. If you hack it up | |
" and make it better, let me know! | |
" MatchPatternAtCursor lifted (and renamed) from rails.vim, thanks tpope! :) |
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
EASY MARSHMALLOWS | |
----------------- | |
Marshmallows are perhaps one of the simplest confections you can make. They only | |
require a handful of ingredients, a batch can be thrown together in 10-15 minutes | |
(plus *cough* 3 hours for them to set), and you can flavor them however you like. | |
(You haven't LIVED until you've had coconut marshmallows!) | |
Hardware needed: |
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
<form action="https://launchpad.37signals.com/authenticate" method="post"> | |
<input name="product" value="YOUR-PRODUCT" type="hidden" /> | |
<input name="subdomain" value="YOUR-SUBDOMAIN" type="hidden" /> | |
<p>Username<br /> | |
<input name="username" id="username" type="text" /></p> | |
<p>Password<br /> | |
<input name="password" id="password" type="password" /></p> |
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
# The Fractal Geometry of Recursive Arrays | |
a = [] | |
a << a << :b | |
p a | |
p a[0] | |
p a[0][0] | |
# ad infinitum... |
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
// An Unobtrusive Javascript (UJS) driver based on explicit behavior definitions. Just | |
// put a "data-behaviors" attribute on your view elements, and then assign callbacks | |
// for those named behaviors via Behaviors.add. | |
var Behaviors = { | |
add: function(trigger, behavior, handler) { | |
document.observe(trigger, function(event) { | |
var element = event.findElement("*[data-behaviors~=" + behavior + "]"); | |
if (element) handler(element, event); | |
}); |
OlderNewer