Skip to content

Instantly share code, notes, and snippets.

(function($) {
////
//
// Depends on the amazing Ajax form plugin.
//
// Callback receives responseText and 'success' / 'error'
// based on response.
//
// i.e.:
// $('#someform').spamjax(function(text, status) {
##
# test/spec/mini
# chris@ozmm.org
#
def context(*args, &block)
return super unless (name = args.first) && block
require 'test/unit'
klass = Class.new(Test::Unit::TestCase) do
def self.specify(name, &block) define_method("test_#{name.gsub(/\W/,'_')}", &block) end
def self.xspecify(*args) end
Object.prototype.delegated = function(props) {
var f = function() { }
f.prototype = this
var r = new f()
for (var p in props)
if (props.hasOwnProperty(p))
r[p] = props[p]
return r
}
$ telnet localhost 1480
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
@defunkt
defunkt / jabber.rb
Created August 5, 2008 01:18 — forked from mojombo/jabber.rb
module Jabber
def self.read
size = $stdin.read(2).unpack("n").first
$stdin.read(size).split(':')
end
def self.write(success)
answer = success ? 1 : 0
token = [2, answer].pack("nn")
$stdout.write(token)
# by bryan helmkamp with slight modification by chris wanstrath
# from http://www.brynary.com/2008/8/3/our-git-deployment-workflow
module GitCommands
extend self
def diff_staging
`git fetch`
puts `git diff origin/production origin/staging`
end
wq
= Gistr
A simple tool to post gists to tumblr.
== The Problem
Tumblr does not have a way to post code snippets simply and the current solutions are lacking.
something
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
module URI
def self.parse_with_options(uri_str, opts = {})
parsed_uri = self.parse(uri_str)
sing = (class << parsed_uri; self end)
sing.send :define_method, :options do
opts
end
parsed_uri
end
end