Skip to content

Instantly share code, notes, and snippets.

View koenbok's full-sized avatar

Koen Bok koenbok

View GitHub Profile
{EventEmitter} = require "./EventEmitter"
###
top, right, bottom, left, centerX, centerY, center
###
calculateFrame = (layer, rules) ->
val = (rule) =>
value = rules[rule]
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 / 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]
@koenbok
koenbok / policy.json
Last active August 29, 2015 14:04
AWS Cactus User Policy
{
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": "s3:*",
@koenbok
koenbok / server.command
Created August 2, 2014 11:48
Web Server for Framer
#!/usr/bin/env python
"""
Copyright (c) 2014 Koen Bok / Podium BV / framerjs.com
Small web server script that you can drop in and run from every Framer Studio
project to serve it to the browser over http. This is great if you want to avoid
same origin policy errors in the browser, but also nice to preview it on another
device connected to the same network.