Skip to content

Instantly share code, notes, and snippets.

View BonsaiDen's full-sized avatar

Ivo Worms BonsaiDen

View GitHub Profile
@BonsaiDen
BonsaiDen / bison.js
Created January 13, 2012 14:00
Some fixes
/**
* Copyright (c) 2009-2011 Ivo Wetzel.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@BonsaiDen
BonsaiDen / bisonperf.js
Created January 13, 2012 15:58
more bison
var BISON = require('../lib/bison');
function time(callback) {
var cur = start = Date.now(),
count = 0, d;
while(Date.now() < start + 333) {
d = callback();
count++;
@BonsaiDen
BonsaiDen / doc.md
Created January 13, 2012 16:21
BiSON doc

The Format

BiSON uses a bit stream in order to achieve maximum possible compression of the different data types, the format is described below.

Each token is prepended by a 3 bit field that determines its type, there are 7 different types:

  • 0: Either a Boolean or null, a 2 bit field with the following values follows:

    • 0 = false
@BonsaiDen
BonsaiDen / Twist.js
Created January 23, 2012 16:15
More enhancements for low fps situations
/**
* Copyright (c) 2011 Ivo Wetzel.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@BonsaiDen
BonsaiDen / Class.js
Created February 1, 2012 23:30
Crazy stuff... still needs a way to get rid of Members and make it work via closure to keep encapsulation
/**
* Copyright (c) 2012 Ivo Wetzel.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@BonsaiDen
BonsaiDen / class.js
Created February 2, 2012 23:38
Class in 394 bytes (minified).
/**
* Copyright (c) 2012 Ivo Wetzel.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@BonsaiDen
BonsaiDen / tokens.json
Created February 9, 2012 19:49
Stuffs
[{
"type": "comment.multi",
"value": "/**\n * Copyright (c) 2011 Ivo Wetzel.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n *
@BonsaiDen
BonsaiDen / tokenizer.js
Created February 9, 2012 19:51
Tokenizer
/**
* Copyright (c) 2012 Ivo Wetzel.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@BonsaiDen
BonsaiDen / tokenize.js
Created February 12, 2012 21:15
Small, simple, JS tokenizer in JS.
/**
* Simple JavaScript tokenizer (not a full parser!!!)
*
* Portions taken from Narcissus by Brendan Eich <[email protected]>.
*/
/*jshint evil: true, regexdash: false, regexp: false */
var KEYWORDS = [
'break',
@BonsaiDen
BonsaiDen / Twist.js
Created February 29, 2012 05:57
Update twist thing
/**
* Copyright (c) 2012 Ivo Wetzel.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*