Skip to content

Instantly share code, notes, and snippets.

View metakeule's full-sized avatar
💭
I may be slow to respond.

metakeule metakeule

💭
I may be slow to respond.
  • Asunción / Paraguay
View GitHub Profile
@metakeule
metakeule / mapreduce.js
Created July 17, 2012 03:06 — forked from madhums/mapreduce.js
mapreduce using mongodb and mongoose
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/db_name');
// map function
var map = function(){
emit(this.field_to_group_by, {
other_fields: this.other_fields
// list other fields like above to select them
})
}
@metakeule
metakeule / test.js
Created June 18, 2012 11:01 — forked from youurayy/test.js
Testing overloadability of native Object members
var ps = [
'__defineGetter__', '__defineSetter__', 'valueOf',
'__lookupGetter__', '__lookupSetter__',
'constructor', 'hasOwnProperty',
'isPrototypeOf', 'propertyIsEnumerable',
'toLocaleString', 'toString' ];
var o = {};
for(var i = 0; i < ps.length; i++)
@metakeule
metakeule / gist:2803223
Created May 27, 2012 10:32
clone an heroku app on a linux machine
# install git
# setup your global git config
# then generate a public key with ssh-keygen
# setup and install your ruby and gems
gem install foreman
gem install heroku
heroku login
heroku keys:add
git clone git@heroku.com:your-app.git
@metakeule
metakeule / observer.md
Created May 10, 2012 13:24 — forked from lloyd/observer.md
BrowserID Observer API

BrowserID "Observer" API

The BrowserID JavaScript API can be used by web pages to implement BrowserID authentication. Implementing BrowserID support consists of:

  1. registering callback functions that will be invoked when the user logs in or out via navigator.id.watch()
  2. invoking navigator.id.request() when the user clicks a login button on your site.
  3. invoking navigator.id.logout() when the user clicks a logout button on your site.
@metakeule
metakeule / monitrc
Created March 14, 2012 13:21
node app as daemon with nvm, upstart and monit
# /etc/monit/monitrc (excerpt)
check process node-app with pidfile /var/run/node-app.pid
start program = "/sbin/start node-app" with timeout 5 seconds
stop program = "/sbin/stop node-app"
if failed port 3000 protocol HTTP
request /
with timeout 3 seconds
then restart
if cpu > 80% for 10 cycles then restart
@metakeule
metakeule / Vagrantfile
Created March 13, 2012 17:57
Vagrant configuration
##################################
### Custom additions from Krux
##################################
### Extensive documentation here:
### http://vagrantup.com/docs/vagrantfile.html
require 'etc'
owner = ENV['KRUX_MY_USERNAME'] || Etc.getlogin
hosts = {
@metakeule
metakeule / gist:2020946
Created March 12, 2012 09:41
install nvm and node.js on ubuntu
sudo apt-get install build-essential libssl-dev curl git-core
git clone git://github.com/creationix/nvm.git ~/.nvm
echo "\n. ~/.nvm/nvm.sh" >> .bashrc
bash
nvm install v0.6.11
nvm alias default 0.6
@metakeule
metakeule / sublime_wrapper.sh
Created February 29, 2012 10:55
here a simple wrapper script to start sublime text 2 and include environment variables under ubuntu
#!/bin/bash
# make it executable and symlink /usr/bin/subl to it
# don't source .bashrc since it won't work (I guess it makes sure it's only source once in the system)
source /home/yourname/.bash_env # put your env variables into this file and source it in .bashrc too, if you need them somewhere else
exec "$(dirname "$(readlink -f "$0")")/sublime_text";