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 'openssl' | |
require 'net/http' | |
require 'net/https' | |
username = ARGV.shift | |
client = Net::HTTP.new('numbers.reed.edu', 5889) | |
client.use_ssl = true | |
response = client.get("/accounts/#{username}.xml") | |
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 'benchmark' | |
require 'open3' | |
iters = (ARGV.shift || 100).to_i | |
start = Time.now | |
def report_iters(bm, scm, iters) | |
bm.report("#{scm} via system(): ") do | |
iters.times do | |
system("cd t/#{scm} && #{scm} log >/dev/null") |
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
iper:jruby-rack lennon$ jruby -S rake | |
(in /Users/lennon/Work/jruby-rack) | |
Note: src/main/java/org/jruby/rack/servlet/ServletRackEnvironment.java uses or overrides a deprecated API. | |
Note: Recompile with -Xlint:deprecation for details. | |
Note: src/main/java/org/jruby/rack/jms/DefaultQueueManager.java uses unchecked or unsafe operations. | |
Note: Recompile with -Xlint:unchecked for details. | |
cp -r src/spec/ruby/merb/gems/gems/merb-core-0.9.7/lib/merb-core target/test-classes | |
cp -r src/spec/ruby/merb/gems/gems/merb-core-0.9.7/lib/merb-core.rb target/test-classes | |
cp -r src/main/ruby/cgi target/classes | |
cp -r src/main/ruby/jruby target/classes |
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
om.danga.MemCached.SockIOPool Sun Feb 22 14:57:47 PST 2009 - ++++ failed to close SockIO obj from deadPool | |
com.danga.MemCached.SockIOPool Sun Feb 22 14:57:47 PST 2009 - ++++ socket or its streams already null in trueClose call | |
java.io.IOException: ++++ socket or its streams already null in trueClose call | |
at com.danga.MemCached.SockIOPool$SockIO.trueClose(SockIOPool.java:1704) | |
at com.danga.MemCached.SockIOPool.selfMaint(SockIOPool.java:1432) | |
at com.danga.MemCached.SockIOPool$MaintThread.run(SockIOPool.java:1497) |
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 | |
DEFAULT_COMMITS = 25 | |
USAGE_MESSAGE = "usage: #{File.basename(__FILE__)} <repo_type> <repo_path> [<num_commits>(#{DEFAULT_COMMITS})]" | |
def die(msg, code=1) | |
STDERR.puts(msg) | |
exit code | |
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
# monkeypatch the Hpricot::Doc class to support the has_tag? protocol used by RSpec | |
# when testing Rails response objects | |
class Hpricot::Doc | |
def has_tag?(selector, options={}) | |
elem = self / selector | |
return false if elem.nil? | |
if options[:text] | |
return false if elem.find {|e| e.inner_text =~ /#{options[:text]}/ }.nil? | |
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
viper:~ lennon$ irb | |
>> require 'liquid' | |
=> true | |
>> require 'memcache' | |
=> true | |
>> template = Liquid::Template.parse('<h1>Hello, {{name}}</h1>') | |
=> #<Liquid::Template:0x12c3d18 @root=#<Liquid::Document:0x12c3ca0 @nodelist=["<h1>Hello, ", #<Liquid::Variable:0x12c38e0 @markup="name", @filters=[], @name="name">, "</h1>"]>> | |
>> mc = MemCache.new('localhost:11211') | |
=> MemCache: 1 servers, 1 buckets, ns: nil, ro: false | |
>> mc.set('template', template) |
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
diff -r 872a57531db6 -r ca3ef96c4b72 forest.py | |
--- a/forest.py Tue Feb 03 22:05:11 2009 +0100 | |
+++ b/forest.py Fri May 15 17:56:18 2009 -0700 | |
@@ -55,7 +55,7 @@ | |
import re | |
import shutil | |
-from mercurial import cmdutil, commands, error, hg, hgweb, node, util | |
+from mercurial import cmdutil, commands, hg, hgweb, node, util, repo | |
from mercurial import localrepo, sshrepo, sshserver, httprepo, statichttprepo |
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
// attach onclick handler to each link with a 'data-method' attribute | |
// that will cause it to emulate a request using that HTTP verb | |
$("a[@data-method=*]").each(function(anchor) { | |
target_url = anchor.attr('href') | |
http_method = anchor.attr('data-method').toString().toUpperCase() | |
if (http_method != 'POST' && http_method != 'DELETE') | |
return; | |
anchor.click(function() { | |
if (confirm("Are you sure?")) { |
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
class FunctionWrapperNode(Node): | |
""" | |
This is an abstract base class designed to make it easy to expose | |
arbitrary Python functions as Django template tags. Subclasses | |
should implement the '_process' method, which will be passed positional | |
and keyword arguments parsed from the template tag body. | |
Tags will accept arguments as folows: | |
{% tag_name arg1 arg2 kwarg1=val1 kwarg2=val2 ... %} |
OlderNewer