Skip to content

Instantly share code, notes, and snippets.

View BonsaiDen's full-sized avatar

Ivo Worms BonsaiDen

View GitHub Profile
{
"predef": [ "-Promise" ],
// JShint
"passfail" : false, // if the scan should stop on first error
// Tolerate features
"eqnull" : false, // if == null comparisons should be tolerated
"sub" : true, // if all forms of subscript notation are tolerated
"asi" : false, // if automatic semicolon insertion should be tolerated
@BonsaiDen
BonsaiDen / substrat2.js
Created March 6, 2015 16:58
Ideas for Substrat 2
// Disable compress and concat filters, this turns them into forwarders
sub.disable('compress').disabled('concat');
// filter takes but keeps, reduced takes and removes
var libs = sub.reduce(/lib\/.*\.js$/).compress().concat(),
config = sub.reduce('js/global.js').compile(sub.mustache()),
app = config.merge(sub.reduce([
@BonsaiDen
BonsaiDen / racer.vim
Last active September 9, 2015 16:11
Patched racer.vim
" Vim plugin for Racer
" (by Phil Dawes)
"
" 1. Edit the variables below (or override in .vimrc)
" 2. copy this file into .vim/plugin/
" 3. - now in insert mode do 'C-x C-o' to autocomplete the thing at the cursor
" - in normal mode do 'gd' to go to definition
"
" (This plugin is best used with the 'hidden' option enabled so that switching buffers doesn't force you to save)
@BonsaiDen
BonsaiDen / round.js
Created October 25, 2010 12:08
Math.round faster, like 40% or something
function round(data) {
if (data < 0) {
var l = (data + 1 | 0) - data;
return (l >= 1.0 && l <= 1.5) ? data | 0 : data - 1 | 0;
}
var l = data | 0;
return data - l >= 0.5 ? data + 1 | 0 : l;
}
@BonsaiDen
BonsaiDen / Generic 2D Map Engine
Created November 18, 2010 15:25
A design template for a generic Map Engine
Map(width, height)
<MapLayer> layers
<int[]> layerOffsets
int width
int height
.addLayer(mapLayer, layerID)
.removeLayer(layerID)
.raiseLayer(layerID)

[Node.js][1] is an event based, asynchronous I/O framework that runs on top of Google's [V8 JavaScript engine][2].

Node.js - or just Node as it's commonly called - is used for developing applications that make heavy use of the ability to run [JavaScript][3] both on the client, as well as on server side and therefore benefit from the re-usability of code and the lack of context switching.

It's also possible to use majored JavaScript frameworks like [YUI][4] and [jQuery][5] for server side DOM manipulation.

To ease the development of complex JavaScript further, Node.js supports the [CommonJS][6] standard that allows for modularized development and the distribution of software in packages via the [Node Package Manager][7].

Applications that can be written using Node.js include (but are not limited to):

@BonsaiDen
BonsaiDen / KittenFoo
Created December 9, 2010 09:14
foo.js
foo
@BonsaiDen
BonsaiDen / vimrc.vim
Created January 4, 2011 17:30
My .vimrc
" Basics
set t_Co=256
colorscheme symfony
set guifont=Monospace\ 8
set number
let g:superTabDefaultCompletionType = "context"
" Filetype stuff
filetype on
@BonsaiDen
BonsaiDen / vim256toGUI.py
Created May 10, 2011 19:29
Small python script converting a 256 colorscheme to a GUI one
import sys
# Color list taken from https://gist.github.com/719710
COLORS = [ # color look-up table
# Primary 3-bit (8 colors). Unique representation!
('00', '000000'),
('01', '800000'),
('02', '008000'),
@BonsaiDen
BonsaiDen / ???.js
Created July 12, 2011 20:45
952 bytes
function lf(a){for(var b,c,d,e,f=[],g=[],h={},i=/([^\\]|^)(\{([^\{\}]+[^\\\}]|[^\{\\\}]|)\})/g,j,k,l=0,m=function(a,b){a=g[a<0?l+a:a];if(d=a[2])for(e=0;e<d.length;e++)b=b&&b[d[e]];f[a[0]]=b;return n},n={at:m,map:function(a){c=a.length;if(+c===c)for(b=0;b<c;)m(b,a[b++]);else for(b in a)n[b]&&n[b](a[b]);return n},each:function(a){for(b=0;b<l;)d=g[b++],f[d[0]]=a(b,d[1],d[2]);return n},toString:function(){return f.join("")}};;){f.push.call(f,a.substring(i.lastIndex,(j=i.exec(a))?j.index+!!j[1]:a=k).replace(/\\(\{|\})/g,"$1"),j?j[2]:k);if(!j)return n;if(/\.|\[/.test(e=j=j[3]))for(j=(c=/\.?([^\.\[]+)|\[(\d+|('|")(|.*?[^\\])\3)\]/g).exec(e)[1],b=[];d=c.exec(e);b.push(d[4]!=k?d[4]:d[2]!=k?+d[2]:d[1]));n[j]||(n[j]=function(a){return function(c){for(b=0;b<a.length;)m(a[b++],c);return n}}(h[j]=[]),n[j+"s"]=function(a){return function(f){for(b=0,d=a.length,c=f.length,e=c<d?c:d;b<e;)m(a[b],f[b++]);return n}}(h[j])),g.push([l*2+1,j,b]),h[j].push(l++)}}