Skip to content

Instantly share code, notes, and snippets.

View jfirebaugh's full-sized avatar

John Firebaugh jfirebaugh

View GitHub Profile
# Generate +n+ resamples (with replacement) from +sample+, computing each
# estimate from +estimators+ over each resample. +estimators+ is an array
# of arity 1 procs, where the argument is a +Statsample::Vector+. Returns
# an array of length +estimators.length+, where each element is an array
# of length +n+ containing the computed resample estimates.
#
# Example:
#
# a = (1..100).collect { rand(100) }.to_scale
# rs = Statsample::Resample.resample(a, 10, [:mean.to_proc, :sd.to_proc])
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.js"></script>
<script type="text/javascript">
$('button').live('click', function () {
$.ajax({url: '/', error: function() { alert('error!'); }});
return false;
})
</script>
diff --git a/spec/model/plugins_spec.rb b/spec/model/plugins_spec.rb
index 28d26c1..aa0f33f 100644
--- a/spec/model/plugins_spec.rb
+++ b/spec/model/plugins_spec.rb
@@ -194,15 +194,15 @@ describe Sequel::Model, ".plugin" do
m = Module.new do
dm = Module.new do
def a; 1; end
- def b; 2; end
+ def b?; true; end
var faithful = [
79, 54, 74, 62, 85, 55, 88, 85, 51, 85, 54, 84, 78, 47, 83, 52, 62, 84, 52, 79, 51, 47, 78, 69, 74, 83, 55, 76, 78, 79, 73, 77, 66, 80, 74, 52, 48, 80, 59, 90, 80, 58, 84, 58, 73, 83, 64, 53,
82, 59, 75, 90, 54, 80, 54, 83, 71, 64, 77, 81, 59, 84, 48, 82, 60, 92, 78, 78, 65, 73, 82, 56, 79, 71, 62, 76, 60, 78, 76, 83, 75, 82, 70, 65, 73, 88, 76, 80, 48, 86, 60, 90, 50, 78, 63, 72,
84, 75, 51, 82, 62, 88, 49, 83, 81, 47, 84, 52, 86, 81, 75, 59, 89, 79, 59, 81, 50, 85, 59, 87, 53, 69, 77, 56, 88, 81, 45, 82, 55, 90, 45, 83, 56, 89, 46, 82, 51, 86, 53, 79, 81, 60, 82, 77,
76, 59, 80, 49, 96, 53, 77, 77, 65, 81, 71, 70, 81, 93, 53, 89, 45, 86, 58, 78, 66, 76, 63, 88, 52, 93, 49, 57, 77, 68, 81, 81, 73, 50, 85, 74, 55, 77, 83, 83, 51, 78, 84, 46, 83, 55, 81, 57,
76, 84, 77, 81, 87, 77, 51, 78, 60, 82, 91, 53, 78, 46, 77, 84, 49, 83, 71, 80, 49, 75, 64, 76, 53, 94, 55, 76, 50, 82, 54, 75, 78, 79, 78, 78, 70, 79, 70, 54, 86, 50, 90, 54, 54, 77, 79, 64,
75, 47, 86, 63, 85, 82, 57, 82, 67,
class ResponseTimer
def call(env, &block)
now = Time.now
@app.call(env, &block)
$stderr.puts({'X-Response-Took' => (Time.now - now)})
end
end
class FakeRack
def serve(application)
From 9af3823ff8ca10ab1c604628ec7f8601e43c9367 Mon Sep 17 00:00:00 2001
From: John Firebaugh <[email protected]>
Date: Wed, 13 Apr 2011 19:54:38 -0700
Subject: [PATCH] Add associated columns later to avoid eager loading callback needing to reselect them.
---
lib/sequel/model/associations.rb | 11 ++++++-----
spec/model/eager_loading_spec.rb | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
From 059997e739d20007bd47fa20d871fadf65bea3da Mon Sep 17 00:00:00 2001
From: John Firebaugh <[email protected]>
Date: Fri, 29 Apr 2011 17:16:54 -0700
Subject: [PATCH] Fix #27254, compare full canonical path of breakpoint positions.
---
src/org/jruby/debug/DebugEventHook.java | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/org/jruby/debug/DebugEventHook.java b/src/org/jruby/debug/DebugEventHook.java
Rehearsal -----------------------------------------------------------------
CGI.escape 0.850000 0.000000 0.850000 ( 0.857414)
URI.encode_www_form_component 0.660000 0.000000 0.660000 ( 0.655699)
-------------------------------------------------------- total: 1.510000sec
user system total real
CGI.escape 0.830000 0.010000 0.840000 ( 0.828300)
URI.encode_www_form_component 0.660000 0.000000 0.660000 ( 0.657125)
require 'java'
require 'benchmark'
require 'rubygems'
require 'json/common'
require 'json/ext/parser'
def foo
Benchmark.measure {
sc = org.jruby.embed.ScriptingContainer.new(org.jruby.embed.LocalContextScope::THREADSAFE)
sc.runScriptlet("require 'rubygems'")
@jfirebaugh
jfirebaugh / memleak.rb
Created May 16, 2011 18:04 — forked from munkyboy/memleak.rb
script that shows memleak in jruby on certain windows platforms
require 'java'
require 'benchmark'
def foo
Benchmark.measure {
sc = org.jruby.embed.ScriptingContainer.new(org.jruby.embed.LocalContextScope::SINGLETHREAD, org.jruby.embed.LocalVariableBehavior::TRANSIENT)
sc.runScriptlet("require 'win32api'")
sc.runScriptlet("SHGetFolderPath = Win32API.new 'shell32', 'SHGetFolderPath', 'LLLLP', 'L'")
sc.terminate
sc = nil