Skip to content

Instantly share code, notes, and snippets.

View Stanley's full-sized avatar

Stanisław Wasiutyński Stanley

View GitHub Profile
@Stanley
Stanley / zsh.log
Created July 26, 2011 09:40
Rvm + JRuby issues
~> rvm -v
rvm 1.6.30 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
~> echo $JRUBY_OPTS
--1.9 --ng
~> java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
@Stanley
Stanley / dw.json
Created March 25, 2011 20:43
Pigeons config files
{
"code": "dw",
"stops": ["jakdojade", "fQ"],
"server": "http://www.um.wroc.pl",
"home": "/rozklady/linie/index.html",
"get": {
"lines": [".sz a[href$=html]"],
"timetables": ["a[href*=_]"],
"line": "[class^=linia_]",
"stop": [".wariant > thead td[colspan]", ":(.+)»"],
TypeError: Bad argument.
at Buffer.toString (buffer.js:263:26)
at Object.readFileSync (fs.js:126:33)
at Object..js (module.js:292:44)
at Module.load (module.js:219:31)
at Function._load (module.js:186:10)
at require (module.js:231:19)
at getDefaultParser (/home/github/jsdom/lib/jsdom/browser/index.js:175:23)
at Object.browserAugmentation (/home/github/jsdom/lib/jsdom/browser/index.js:199:33)
at Object.jsdom (/home/github/jsdom/lib/jsdom.js:33:25)
var http = require('http'),
couchdb = http.createClient(5984, 'localhost'),
uuid = require('node-uuid');
var id = uuid().replace(/-/g, '');
var request = couchdb.request('PUT', '/test/'+id +'?batch=ok', {
"host": "localhost",
"Content-Type": "multipart/related;boundary=\"frontier\""
});
var http = require('http');
var couchdb = http.createClient(5984, 'localhost');
// PUT method works correctly
// var request = couchdb.request('PUT', '/test/test', {
// POST returns 415: {"error":"bad_content_type","reason":"Content-Type must be application/json"}
var request = couchdb.request('POST', '/test', {
"host": "localhost",
"Content-Type": "multipart/related;boundary=\"frontier\""
});
curl -X PUT localhost:5984/test &&
curl -X PUT localhost:5984/test/_design/demo -d @view.json &&
curl -X PUT localhost:5984/test/1 -d '{"foo": "foo"}' &&
curl localhost:5984/test/_design/demo/_view/two
// Author: Stanisław Wasiutyński
// Date: 14.07.2010
(function($){
$.fn.big_preview = function(img_url, opts) {
var defaults = {
on_wait: "Please wait...",
show_all: true,
show_all_label: "Click to fit image to screen",
require 'em-proxy'
Proxy.start(:host => "127.0.0.1", :port => 8080) do |conn|
@start = Time.now
@data = Hash.new("")
conn.server :prod, :host => "db.wasiutynski.net", :port => 80 # production, will render resposne
conn.server :test, :host => "127.0.0.1", :port => 5984 # testing, internal only
conn.on_data do |data|
@Stanley
Stanley / couch_foo.rb
Created April 26, 2010 19:38
Sample ruby CouchDB libraries
# CRUD
CouchFoo::Base.set_database(:host => "http://localhost:5984", :database => "krug")
class Address < CouchFoo::Base
property :number, Integer
property :street, String
property :postcode
end