Skip to content

Instantly share code, notes, and snippets.

@incompl
incompl / gist:2925304
Created June 13, 2012 17:08 — forked from buhrmi/gist:1344659
Sublime Text 2 Git Annotation Colors
<dict>
<key>name</key>
<string>Git Modified Line</string>
<key>scope</key>
<string>git.changes.x</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#212340</string>
</dict>
<head>
...
<!-- source files for development -->
<!-- <script src="src/setup.js"></script> -->
<!-- <script src="src/player.js"></script> -->
<!-- <script src="src/enemy.js"></script> -->
<!-- <script src="src/bullet.js"></script> -->
<!-- <script src="src/explosion.js"></script> -->
<!-- concatenated / minified source for production -->
var state = [{
id: 0,
transform: {
position: {
x: 15.290663048624992,
y: 2.0000000004989023,
z: -24.90756910131313
},
rotation: {
x: 0.32514392007855847,
var char = new Int8Array( 1 );
// uchar now shares the same ArrayBuffer as char.
var uchar = new Uint8Array( char.buffer );
char.buffer === uchar.buffer; // true
char[0] = -1;
uchar[0] === 255; // true, same data interpreted differently
var arr = new Float64Array([15.290663048624992]);
// Compact the state.
var slimmerState = new Float64Array([
0,
15.290663048624992,
2.0000000004989023,
-24.90756910131313,
0.32514392007855847,
-0.8798439564294107,
0.32514392007855847,
0.12015604357058937,
var encodeUint8 = (function() {
var arr = new Uint8Array( 1 );
return function( number ) {
// If we assume that the number passed in
// valid, we can just use it directly.
// return String.fromCharCode( number );
arr[0] = number;
return String.fromCharCode( arr[0] );
};
}());
// Shared code
var MsgType = {
"game start": String.fromCharCode(0),
"update state": String.fromCharCode(1),
"private message": String.fromCharCode(2)
};
var MsgTypeLookup = [
"game start",
"update state",
var msg = JSON.stringify( state );
var getUTF8Size = function( str ) {
var sizeInBytes = str.split('')
.map(function( ch ) {
return ch.charCodeAt(0);
}).map(function( uchar ) {
// The reason for this is explained later in
// the section “An Aside on Text Encodings”
return uchar < 128 ? 1 : 2;
var slimState = [[
0,
15.290663048624992,
2.0000000004989023,
-24.90756910131313,
0.32514392007855847,
-0.8798439564294107,
0.32514392007855847,
0.12015604357058937
], [
@incompl
incompl / index.html
Created October 25, 2012 00:07
flexbox.incompl.com
<!doctype html>
<html>
<head>
<title>vertical centering 4 lyfe</title>
<link href='http://fonts.googleapis.com/css?family=Handlee' rel='stylesheet' type='text/css'>
<style>
html {
height: 100%;
}