Skip to content

Instantly share code, notes, and snippets.

View koenbok's full-sized avatar

Koen Bok koenbok

View GitHub Profile
class TextView extends View
constructor: (args) ->
super
@text = args?.text or ""
@define "text",
get: -> @html
set: (value) ->
@html = value
title: Hello There!
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ title }}</title>
</head>
<body>
@koenbok
koenbok / watch.py
Created March 18, 2014 10:32
Simple watch script for macfsevents (great for nose tests)
import os
import sys
import time
from fsevents import Stream, Observer
if __name__ == '__main__':
if (len(sys.argv)) < 2:
sys.exit("No command found")
@koenbok
koenbok / sign.py
Created May 14, 2014 13:26
Mac Desktop Code Sign Script
#!/usr/bin/env python
import os
import sys
import shutil
import subprocess
if len(sys.argv) < 3:
sys.exit("Usage: python sign.py <identity> <myApp.app>")
@koenbok
koenbok / qc-framer.js
Created May 14, 2014 15:04
QC Spring Value Converter
var QcValueConverter = {
tensionFromQcValue: function(qcValue) {
return (qcValue - 30.0) * 3.62 + 194.0;
},
qcValueFromTension: function(tension) {
return (tension - 194.0) / 3.62 + 30.0;
},
frictionFromQcValue: function(qcValue) {
@koenbok
koenbok / version.py
Created May 21, 2014 08:59
Add to build steps > run script in xcode
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
import subprocess
import plistlib
def gitVersion(gitPath):
@koenbok
koenbok / gist:bc2025785c79ef5c4d8a
Created May 30, 2014 13:59
Learn Coffee Script

Learn CoffeeScript in an afternoon. Or use it as a cheat sheet.

########################################################################

Part 1: Variables

A variable is a way to store something under a name. It's pretty simple:

myVariable = 1

From this point on the variable myVariable contains 1. You can change this at any point just by assigning a new value. If you ask the value of a variable before it has one (defined) it returns a special value 'undefined'.

start = function() {
all my framer code
}
preloadImages = ["a.png", "b.png"];
preloadImagesCount = 0; // How many images were loaded
preloadImages.map(function(image) {
var imageLayer = new Layer({image:image})
imageLayer.on("load", function() {
dyld: Library not loaded: /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebKitLegacy.framework/Versions/A/WebKitLegacy
Referenced from: /Users/koen/Library/Developer/Xcode/DerivedData/WebKit2Test-fgcplsncyhanehdbbopclkwmdgjb/Build/Products/Debug/WebKit2Test.app/Contents/MacOS/WebKit2Test
Reason: image not found
rows = 30
cols = 30
gutter = 16
width = 50
height = 50
for rowIndex in [0..rows-1]
for colIndex in [0..cols-1]