This file contains hidden or 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 'rubygems' | |
require 'json' | |
require 'open-uri' | |
scores = JSON.parse(open('http://spreadsheets.google.com/feeds/list/pVNrsh7EqwD6HkFTmS3v9aw/od6/public/values?alt=json').read); nil | |
# scores['feed']['entry'].length | |
newscores = {} | |
scores['feed']['entry'].each do |e| |
This file contains hidden or 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
--- | |
development: &defaults | |
:url: http://0.0.0.0:5984/gathering | |
production: &production | |
<<: *defaults | |
:url: http://0.0.0.0:5984/gathering |
This file contains hidden or 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
// cargo culted bits from here: http://dev.jquery.com/ticket/3342 | |
// Usage: | |
// $.xdom.post('http://example.com/post-to-here',{"foo":"bar"}); | |
// Sends a POST to http://example.com/post-to-here with content foo=bar | |
(function($) { | |
$.xdom = $.xdom || {}; | |
function now(){ |
This file contains hidden or 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
$ab -n 10000 -c 10 http://127.0.0.1:5984/blogdb/_view/couchdb-example-blog/recent?key=%222008-11-03T17:49:47Z%22 | |
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Copyright 2006 The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 127.0.0.1 (be patient) | |
Completed 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests |
This file contains hidden or 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
$ab -n 10000 -c 10 http://127.0.0.1:5984/blogdb/657a25a45525ee93eb8a0aaae7e637dfThis is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Copyright 2006 The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 127.0.0.1 (be patient) | |
Completed 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests | |
Completed 5000 requests |
This file contains hidden or 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
/** | |
* Support for generating SHA-1 of a stream. | |
* | |
* Based on http://pajhome.org.uk/crypt/md5/sha1.js. | |
*/ | |
function naked_sha1_head() { | |
var w = Array(80); | |
var a = 1732584193; | |
var b = -271733879; |
This file contains hidden or 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 'rubygems' | |
require 'couchrest' | |
# this is the CouchDB where all the old databases are | |
OLD_HOST = "http://127.0.0.1:5984" | |
# this is the CouchDB we want to copy to | |
NEW_HOST = "http://127.0.0.1:5985" | |
old_couch = CouchRest.new(OLD_HOST) |
This file contains hidden or 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
#!/bin/bash | |
# usage: time benchbulk.sh dbname | |
# it takes about 30 seconds to run on my old MacBook | |
BULKSIZE=1000 | |
DOCSIZE=100 | |
INSERTS=10 | |
ROUNDS=10 | |
DBURL="http://localhost:5984/$1" |
This file contains hidden or 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 'lib/yajl/http_stream' | |
require 'uri' | |
uri = URI.parse('http://jchrisa.net/toast/_changes') | |
Yajl::HttpStream.get(uri) do |hash| | |
# will take a few seconds, since the response is a single ~4MB JSON string | |
# if the response was a bunch of individual JSON strings, this would be fired | |
# for every string parsed off the stream, as they were parsed | |
puts hash.inspect | |
end |
This file contains hidden or 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
// Copyright J. Chris Anderson 2007 | |
// Retain this notice. | |
// Released under the LGPL 2.1 | |
// http://creativecommons.org/licenses/LGPL/2.1/ | |
XSPF = { | |
XMLfromString: function(string) { | |
if (window.ActiveXObject) { | |
var doc = new ActiveXObject("Microsoft.XMLDOM"); | |
doc.async = "false"; |