Skip to content

Instantly share code, notes, and snippets.

@jaburns
jaburns / Main.hs
Last active August 29, 2015 14:16
SDL Pixel Pushing comparison
module Main (
main
) where
import Control.Monad.State
import Control.Monad.Reader
import Data.Word
import Foreign
import Graphics.UI.SDL
@jaburns
jaburns / gist:31f0dfa1af8656de3759
Created February 18, 2015 00:13
Sound detector
'use strict';
var playerModes = require('../../game/player').modes;
/**
* This module exports a single function that checks a game state and
* its latest diff for game sound triggers and plays the appropriate
* sounds on the provided AudioPlayer object.
*/
@jaburns
jaburns / index.html
Created February 6, 2015 23:45
Laggy socket.io hello world
<!DOCTYPE html>
<html>
<style>
body { background: #fff; }
#paper { background: #ccc; }
</style>
<body>
<canvas id="paper" width="800" height="600"></canvas>
</body>
<script src="/socket.io/socket.io.js"></script>
@jaburns
jaburns / game-physics-conversion.md
Last active August 29, 2015 14:14
Game "physics" constants conversion rules

Game "physics" constants conversion rules

Converting from dt=A to dt=B

Per-frame scale values (i.e. vx *= Z)
Z_new = Z ^ (B/A)
Acceleration values (i.e. vx += Z)
Z_new = Z * (B/A)^2
@jaburns
jaburns / import-spritesheet.jsfl
Created November 26, 2014 19:18
JSON Spritesheet Import JSFL
/**
* Json Frame Array Sprite Sheet Importer
*
* Creates a new MovieClip in the library, then for each frame in the imported spritesheet
* animation this script will create a bitmap-filled shape on the timeline of the newly-created
* movieclip.
*/
var LIBRARY_FOLDER = 'imported-sprites';
var dom = fl.getDocumentDOM ();
@jaburns
jaburns / gfm-render.sh
Last active August 27, 2023 16:02
Bash script to render github flavoured markdown to HTML
#!/usr/bin/env bash
data="$(
cat "$1" \
| sed 's/"/\\"/g' \
| sed ':a;N;$!ba;s/\n/\\n/g' \
)"
if [[ -z "$2" ]]; then
context=''