Skip to content

Instantly share code, notes, and snippets.

View koenbok's full-sized avatar

Koen Bok koenbok

View GitHub Profile
var match = window.location.pathname.match(/([^/]+)\/([^/]+)\/commit\/([0-9a-f]{40,40})$/);
if (match == null)
console.log("Could not parse window name");
var user = match[1];
var repo = match[2];
var commit = match[3];
$.get("http://github.com/api/v2/json/commits/show/" + user + "/" + repo + "/" + commit, null, function(data) {
var filenames = data.commit.modified.map(function(x) { return x.filename })
import sys
import os
import filecmp
import subprocess
assert len(sys.argv) == 3, 'Usage: <script> path1 path2'
def run(command):
subprocess.call([command], shell=True)
/*
AppCast Dowloader (c) 2010 Sofa BV (Koen Bok)
Description:
Returns the url for the latest version in an AppCast url.
Requirements:
jQuery > 1.4
@koenbok
koenbok / backbone.html
Created November 25, 2010 00:29
Backbone Experiment
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" charset="utf-8" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://documentcloud.github.com/underscore/underscore.js"></script>
<script type="text/javascript" charset="utf-8" src="http://documentcloud.github.com/backbone/backbone.js"></script>
# -*- encoding: utf-8 -*-
constants = {}
constants['weightunits'] = {
'KG': 'Kilogram',
'LB': 'Pound'
}
constants['continents'] = {
@koenbok
koenbok / Android Review
Created March 29, 2011 09:05
Reviewing a Nexus S by a guy who is used to an iPhone 4
PLUS
- You never have to attach it to the computer, not even for software upgrades
- Call quality and reception is sometimes better then my iPhone
- The dashboard or home is really nice with widgets and shortcuts (like wifi settings)
- Regular mini USB cable, although iPod cables are pretty common now too
- I don't really feel like I miss any apps, and most standard apps are done very nicely
- Some stuff is really smart like having a 2 second delay for locking after the screen dims down
- Most of the time it feels pretty fast
- I feel like I have more insight in the device (which is good because I'm geeky)
var api = new FB.Messages();
api.login("koenbok", "password", function(result) {})
api.threads.fetch({limit: 100, tags: ["inbox", "unread"]}, function(results) {}) // list with threads
api.threads.count({limit: 100, tags: ["inbox", "unread"]}, function(results) {}) // thread count
api.messages.fetch({thread:thread.id}, function(results) {}) // all messages for thread
api.messages.put({thread:thread.id, parent:message.id ...}, function(results) {}) // send a new message
@koenbok
koenbok / uilayer-bug.html
Created November 12, 2011 00:30
UILayer Bug
<html lang="en">
<head>
<script type="text/javascript" src="http://movelang.org/move-0.4.5-rt.js"></script>
<script type="text/javascript" src="http://rsms.me/uilayer/uilayer.js"></script>
</head>
<body>
<script type="text/javascript">
var UILayer = Move.require("UILayer");
UILayer.debug = true;
@koenbok
koenbok / friendfeed.sql
Created May 24, 2012 06:20
Key Value a la FriendFeed
-- http://backchannel.org/blog/friendfeed-schemaless-mysql
DROP TABLE IF EXISTS person;
DROP TABLE IF EXISTS person_index_name;
DROP TABLE IF EXISTS person_index_age;
CREATE TABLE person (
key CHAR(32) NOT NULL,
val TEXT,
PRIMARY KEY (key)
@koenbok
koenbok / Cactus Performance
Created August 24, 2012 06:38
Cactus multithreaded results
16 Threads: 6.05s user 4.08s system 131% cpu 7.687 total
2 Threads: 4.89s user 2.25s system 122% cpu 5.822 total
1 Thread: 3.36s user 0.65s system 99% cpu 4.035 total