Skip to content

Instantly share code, notes, and snippets.

View olivernn's full-sized avatar

Oliver Nightingale olivernn

View GitHub Profile
@olivernn
olivernn / gist:9919281
Created April 1, 2014 17:47
npm install log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/0.8.20/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'lunr' ]
2 info using npm@1.2.11
3 info using node@v0.8.20
4 verbose read json /Users/olivernightingale/package.json
5 verbose read json /Users/olivernightingale/node_modules/lunr/package.json
6 verbose read json /Users/olivernightingale/package.json
@olivernn
olivernn / gist:9919662
Created April 1, 2014 18:07
more npm debug logs.
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/0.8.20/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'publish',
1 verbose cli '--force' ]
2 info using npm@1.2.11
3 info using node@v0.8.20
4 warn using --force I sure hope you know what you are doing.
5 verbose publish [ '.' ]
6 verbose read json /Users/olivernightingale/code/lunr.js/package.json
@olivernn
olivernn / package.json
Created April 1, 2014 18:10
lunr package.json
{
"name": "lunr",
"description": "Simple full-text search in your browser.",
"version": "0.5.0",
"author": "Oliver Nightingale",
"keywords": ["search"],
"homepage": "http://lunrjs.com",
"bugs": "http://github.com/olivernn/lunr.js/issues",
"main": "lunr.js",
"license": "MIT",
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/0.8.20/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'lunr' ]
2 info using npm@1.2.11
3 info using node@v0.8.20
4 verbose read json /Users/olivernightingale/package.json
5 verbose read json /Users/olivernightingale/node_modules/lunr/package.json
6 verbose read json /Users/olivernightingale/package.json
@olivernn
olivernn / README.md
Last active August 29, 2015 14:00
Paginated results

I think response and collection are the two classes where the bulk of the stuff is happenening, the importer is just an example of the external api. Actually looking back at this I think it could definitly be improved but I guess its an example of how to do it.

I recently did something similar, this time it was streaming a file from s3, but yielding the file line by line. The AWS SDK just gives you the s3 object chunk by chunk as its read from the socket, so I had to buffer and then yield as many lines as possible from each chunk. I returned an enumerator to do this rather than mixing in enumerable, I can't really share this code though, which is a shame cos I thought it was a nice implementation at the time.

Oliver-Nightingales-MacBook-Pro:capybara-envjs olivernightingale$ rake
(in /Users/olivernightingale/code/capybara-envjs)
warning: couldn't activate the debugging plugin, skipping
warning: couldn't activate the doofus plugin, skipping
warning: couldn't activate the git plugin, skipping
/Library/Ruby/Gems/1.8/gems/rspec-1.2.9/lib/spec/example/example_group_methods.rb:274:in `include_shared_example_group': Shared Example Group 'has_select' can not be found (RuntimeError)
from /Library/Ruby/Gems/1.8/gems/rspec-1.2.9/lib/spec/example/example_group_methods.rb:66:in `it_should_behave_like'
from /Library/Ruby/Gems/1.8/gems/rspec-1.2.9/lib/spec/example/example_group_methods.rb:65:in `each'
from /Library/Ruby/Gems/1.8/gems/rspec-1.2.9/lib/spec/example/example_group_methods.rb:65:in `it_should_behave_like'
from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/spec/session_spec.rb:58
require 'rubygems'
require 'rack'
require 'snippets'
require 'mongo'
require 'rackjson'
use Rack::JSON::Resource, :collections => [:notes], :db => Mongo::Connection.new.db("notes")
run lambda { |env| [404, {'Content-Length' => '9', 'Content-Type' => 'text/plain'}, "Not Found"] }
@olivernn
olivernn / pbcopy.plist
Created September 17, 2015 19:22
pbcopy plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>localhost.pbcopy</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/pbcopy</string>
</array>
Post('post', {}, {
validatesPresenceOf: ['title', 'body'],
validatesLengthOf: [{attr: 'title', min: 20}, { attr: 'body', max: 2000 }]
})
@olivernn
olivernn / user.js
Created December 1, 2010 12:38
User with validation on presence of name
var User = Model('user', {
// class methods
validates: {
presenceOf: ['name']
}
}, {
// instance methods
})
o = new User ({name: "oliver"})