This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Slab = require 'Slab' -- idiomatic GUI: https://github.com/flamendless/Slab | |
-- default love.run from https://love2d.org/wiki/love.run with various callbacks wrapped in xpcall() | |
function love.run() | |
if love.load then love.load(love.arg.parseGameArguments(arg), arg) end | |
-- We don't want the first frame's dt to include time taken by love.load. | |
if love.timer then love.timer.step() end | |
local dt = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Matthew Johnson on 5/28/16. | |
// Copyright © 2016 Anandabits LLC. All rights reserved. | |
// | |
// This is a minimalist implementation of a responder chain in pure Swift. | |
// | |
// It is not intended to demonstrate the best way to | |
// implement event processing in Swift. | |
// | |
// The intent is to show how little code is necessary to acheive behavior | |
// similar to Cocoa's responder chain in pure Swift. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def views | |
{:some-view SomeView | |
:another-view AnotherView}) | |
(def factories | |
(map om/factory (vals views))) | |
(defui Router | |
static om/Ident | |
(ident [this {:keys [route]}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn animate-value | |
[start-val end-val duration] | |
(let [decrement? (< end-val start-val) | |
transmit-chan (chan) | |
cancel-chan (chan) | |
animation-interval 40 ;40 ms interval - 25fps | |
steps (/ duration animation-interval) | |
full-range (- start-val end-val) | |
per-step (util/abs (/ full-range steps)) | |
state (atom start-val) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
; A simple CBV syntactic reduction machine for the lamda-calculus. | |
; + numbers | |
; <exp> ::= <var> | |
; | <num> | |
; | (λ (<var>) <exp>) | |
; | (+ <exp> <exp>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OSX for Hackers (Mavericks/Yosemite) | |
# | |
# Source: https://gist.github.com/brandonb927/3195465 | |
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Ask for the administrator password upfront |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Set colorscheme to solarized | |
colorscheme solarized | |
" Change the Solarized background to dark or light depending upon the time of | |
" day (5 refers to 5AM and 17 to 5PM). Change the background only if it is not | |
" already set to the value we want. | |
function! SetSolarizedBackground() | |
if strftime("%H") >= 5 && strftime("%H") < 17 | |
if &background != 'light' | |
set background=light |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |