Skip to content

Instantly share code, notes, and snippets.

require 'linahi' # this is just my app, which seems to work ok
require 'sinatra/test/spec'
context 'Linahi' do
specify 'should list files when asked' do
get_it '/'
puts body
end
@sr
sr / post.js
Created October 30, 2008 00:05
function(doc) {
if ( doc.type == "collection" ) {
emit([doc._id, 0], doc);
} else if ( doc.type == "entry" ) {
emit([doc.collection, 1, doc.edited], doc);
}
}
19:57 <sha1> http://pastie.org/281547 .. why is this weird thing happenning?
19:58 <elliottcable> one-upped!
19:58 <elliottcable> Grr apeiros can you voice me on #Ruby-Pro just so I can change nicks without leaving it?
19:59 <_rane> #ruby-pro? is that were all the elitists dwell?
19:59 <_rane> where*
19:59 <elliottcable> _rane: Apperantly so.
19:59 <elliottcable> I'd think that'd be *any* Ruby channel, but meh.
20:00 <wmoxam> lol
20:00 <wmoxam> #ruby-pro
20:00 -!- dug [[email protected]] has quit [Read error: 110 (Connection timed out)]
@sr
sr / a.rb
Created September 2, 2008 20:31
class Hash
def stringify_keys!
keys.each do |key|
self[key.to_s] = delete(key)
end
self
end
def jsonify_necessary_values!
values.each do |key, value|
~ % ruby hash.rb
"foo"
nil
hash.rb:9:in `[]': PythonLike (PythonLike)
from hash.rb:14
module CouchRest
class Database
attr_accessor :name, :server
def initialize(server, database_name)
@name = database_name
@server = server
end
def documents(params=nil)
require 'rubygems'
require 'json'
require 'rest_client'
$:.unshift File.dirname(__FILE__) + '/couch_rest'
module CouchRest
autoload :Server, 'server'
autoload :Database, 'database'
autoload :Pager, 'pager'
CmdUtils.CreateCommand(
{
name: "ruby",
takes: {"function": noun_arb_text},
icon: "http://ruby-doc.org/favicon.ico",
homepage: "http://jackndempsey.blogspot.com",
author: {name: "Jack Dempsey", email: "[email protected]"},
license: "MPL,GPL",
description: "Search ruby functions documentation",
help: "Select a ruby function",
all: rdf html
rdf: card.n3
cwm.py card.n3 --rdf > card.rdf
html: head.html foot.html card.n3 foaf2html.n3
cat head.html > index.html
cwm.py card.n3 foaf2html.n3 --think --strings >> index.html
cat foot.html >> index.html
clean:
rm -f card.rdf
rm -f index.html
@sr
sr / app.rb
Created August 29, 2008 11:50
$rest = RestClient.new('http://foo.org')
get '/' do
$rest.put '/foo'
'hey'
end