Skip to content

Instantly share code, notes, and snippets.

@zaim
zaim / index.js
Last active August 20, 2016 14:51
module.exports = function runHook (hook) {
const firebase = require('firebase')
hook.res.setHeader('Content-Type', 'application/json')
hook.res.end(JSON.stringify({
version: firebase.SDK_VERSION
}))
}
@zaim
zaim / allcaps.js
Last active August 29, 2015 14:13
Trying out 6to5 - got AssertionError
function allcaps (words) {
// trying out fat arrows
return words.map(w => w.toUpperCase());
}
module.exports = allcaps;
@zaim
zaim / README.md
Last active January 2, 2016 00:09
Guide to running Docker on OS X

Guide to running Docker on OS X

If you're in a hurry

Use docker-osx:

  • Easy to use.
  • But still under heavy development.
  • So need to periodically check for updates and redownload their docker script to get any sweet new features.
@zaim
zaim / README.md
Last active February 15, 2016 15:27
Thunkify Rethinkdb

rethunkdb

Thunkify rethinkdb

To be used with co and/or koa.

So that we can do something like:

var r = require('rethunkdb') // not a typo, might use other name if too close :)
@zaim
zaim / Gruntfile.js
Created March 5, 2013 13:09
Grunt task to copy bower components to a static/public web directory. Organises based on file extension. Uses the "bower" cli, so no need to install the entire bower module.
module.exports = function (grunt) {
var path = require('path');
grunt.initConfig({
pkg : grunt.file.readJSON('package.json')
, bower : {
all : {
dest : 'static'
[
"acap", "acap kali", "adakala", "adakalanya", "adalah", "adapun", "adoi",
"aduh", "aduhai", "agak", "agaknya", "agar", "ah", "ahai", "ahem", "ai",
"aja", "akan", "alah", "alahai", "alamak", "alhasil", "alkisah", "amat",
"amboi", "andai", "andai kata", "aneka", "antara", "apa", "apabila",
"apakala", "apalagi", "arkian", "atau", "au", "auh", "ayuh", "ayuhai",
"bagai", "bagaimana", "bagaimanapun", "bagi", "bahawa", "bahawasanya",
"bahkan", "banyak", "barangkali", "beberapa", "belum", "benar", "berapa",
"betul", "bila", "bilamana", "boleh", "boleh jadi", "buat", "bukan",
"celaka", "cis", "dalam", "dan", "dapat", "dari", "darihal", "daripada",
@zaim
zaim / .bash_aliases
Created June 4, 2011 15:00
My .bash_aliases
function p {
if [ -z "$1" ]; then
echo "Syntax: p NAME"
echo " cd to first project matching NAME"
else
match=$(find ~/projects -type d -name "$1" | line)
if [ -n "$match" ]; then
cd $match
fi
fi
#!/usr/bin/env python
import optparse
import os
import sys
import unittest
test_path = os.path.abspath(os.path.dirname(__file__))
app_path = os.path.abspath(os.path.join(test_path, '..'))
sdk_path = os.environ.get('APP_ENGINE_SDK_PATH')
@zaim
zaim / stats.py
Created July 8, 2009 05:14
Parses a playlist and prints some stats about songs played
#!/usr/bin/python
"Parses a playlist and prints some stats about songs played"
import datetime
import optfunc # https://github.com/simonw/optfunc/tree
import os
import re
import sys
from operator import itemgetter
@zaim
zaim / updater.py
Created July 8, 2009 05:05
Grabs the current song title and artist name playing on hitz.fm and save it in a playlist log file
#!/usr/bin/python
"Grabs the current song title and artist name playing on hitz.fm and save it in a playlist log file"
import os
import re
import sys
import time
import urllib2
from email import utils