Skip to content

Instantly share code, notes, and snippets.

View koenbok's full-sized avatar

Koen Bok koenbok

View GitHub Profile
@koenbok
koenbok / gist:3683371
Created September 9, 2012 08:51
For..mat
User
id
name
Thread
id
Message
id
thread_id
#!/usr/bin/env coffee
http = require("http")
url = require("url")
path = require("path")
fs = require("fs")
# cluster = require("cluster")
port = process.argv[2] or 8888
@koenbok
koenbok / gist:4470148
Created January 6, 2013 20:57
Bounce every view!
// Bounce every view that you click on
View.Views.map(function(view) {
view.on("click", function(e) {
e.stopPropagation()
view.animateStop()
view.scale = 0.5
def preBuild(site):
from django.conf import settings
if "typogrify" not in settings.INSTALLED_APPS:
settings.INSTALLED_APPS.append("typogrify")
@koenbok
koenbok / bitcoin-wallet-features
Created August 9, 2013 11:30
Coinbase (or any other online bitcoin wallet) feature requests
- A graph of your wallet net worth over time
- An unrealized gains table listing your bitcoin buy prices and the current worth
- Reserve "buckets" in your wallet that can only be touched with a special code
- 3rd party access codes that can only access specific buckets in your wallet
@koenbok
koenbok / framer-canvas.js
Created October 16, 2013 18:25
Framer Canvas Example
var myCanvasView = new View({
x:100, y:100,
width:200, height:200
})
// Add a nice background color so we see it
myCanvasView.style.backgroundColor = "rgba(255,0,0,.5)"
// This is the tricky bit, we create a canvas element (so we have a reference to it) and insert it into the view
myView = new View x:50, y:100, width:150, height:150
myView.style.backgroundColor = "red"
myView.html = "HELLO"
draggable = new ui.Draggable myView
myView.on Events.DragStart, -> console.log "myView", Events.DragStart
myView.on Events.DragMove, -> console.log "myView", Events.DragMove
myView.on Events.DragEnd, -> console.log "myView", Events.DragEnd
endScrollMomentum = function(event) {
var animation, constant1, constant2, totalVelocity, touchEvent, velocity;
touchEvent = Events.sanitize(event);
constant1 = 1000;
constant2 = 0;
velocity = dragger.calculateVelocity();
@koenbok
koenbok / retina.js
Created November 12, 2013 11:37
Simple Retina Script
// To make images retina, add a class "2x" to the img element
// and add a <image-name>@2x.png image. Assumes jquery is loaded.
function isRetina() {
var mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
(min--moz-device-pixel-ratio: 1.5),\
(-o-min-device-pixel-ratio: 3/2),\
(min-resolution: 1.5dppx)";
if (window.devicePixelRatio > 1)
@koenbok
koenbok / Framer Talk
Created November 14, 2013 12:50
Basis for Framer lessons.
What is Framer
Prototyping toolkit.
---
Why did I make Framer
Because prototyping is important.