Skip to content

Instantly share code, notes, and snippets.

var Application = {
faye: null,
init: function(){
Map.init();
Application.init_faye();
},
init_faye: function(){
RestClient.post 'http://localhost:9292/faye', :message => {:channel => "/markers_ip", :data => {"lat" => 52.0, "lng" => 2.0, :ip => "0.0.0.0" } }.to_json
RestClient.post 'http://localhost:9292/faye', :message => {:channel => "/markers_address", :data => { "address" => "N15 3PR London" } }.to_json
Mummy.define {{
:left => /\w{3,10}/.gen,
:right => /\w{3,10}/.gen
}}
Mummy.define(:custom) {{
:center => /\w{3,10}/.gen
}}
mummy = Mummy.generate(:custom, :mumble => true)
@JakubOboza
JakubOboza / spinup.sh
Created August 10, 2011 20:47
MongoDB ReplicaSet
#!/bin/bash
# My single node ReplicaSet quick test script
mkdir -p /tmp/rs1
mkdir -p /tmp/rs2
mongod --rest --replSet myset &
mongod --rest --replSet myset --dbpath /tmp/rs1 --port 30000 &
mongod --rest --replSet myset --dbpath /tmp/rs2 --port 40000 &
@JakubOboza
JakubOboza / rque.rb
Created August 13, 2011 14:53
Redis Que
require 'redis'
class RQue
attr_reader :name, :connection
def initialize(name)
@name = name
@connection = Redis.new
end
@JakubOboza
JakubOboza / run.sh
Created August 13, 2011 16:02
MongoDB Sample MapReduce in a file with usage
#!/bin/bash
mongo localhost:27017/data_gatherer test.js
@JakubOboza
JakubOboza / build-mongo.zsh
Created August 25, 2011 21:27
MongoDB build from source
#!/bin/zsh
# my personal everyday mongodb build script
# clean
scons --clean
# pull new changes
git pull
# build into prefixed directory
@JakubOboza
JakubOboza / before_after.js
Created August 29, 2011 21:17
before filter for js functions
function sample(a, b){
return console.log(a + b);
}
function argless(){
console.log("Argless lol");
}
function before(foo, filter, args){
return function(){
@JakubOboza
JakubOboza / ab.txt
Created October 2, 2011 13:21
How Fat is libevent ;)
14:08 kuba@MacBook-Jakub-Oboza:~% ab -c 10 -n 15000 http://127.0.0.1:8081/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1500 requests
Completed 3000 requests
Completed 4500 requests
Completed 6000 requests