Skip to content

Instantly share code, notes, and snippets.

@Jared314
Jared314 / gist:1928789
Created February 28, 2012 02:34
Z-Type Game Clojure.Core Custom Dictionary
//Run this while at the main menu
ig.game.registerTarget=function(letter,ent){if(this.targets[letter]===undefined)this.targets[letter]=[];this.targets[letter].push(ent);};
ig.game.unregisterTarget=function(letter,ent){(this.targets[letter]||[]).erase(ent);};
window.removeEventListener('keydown',ig.game.keydown.bind(ig.game));
ig.game.keydown=function (event){if(event.target.type=='text'||event.ctrlKey||event.altKey||this.mode!=ZType.MODE.GAME||this.menu){return true;}var c=event.which;if(c==189)c=45;if(event.shiftKey&&c==191)c=63;if(event.shiftKey&&c==56)c=42;if(event.shiftKey&&c==49)c=33;if(c==187)c=61;if(!((c>64&&c<91)||(c>96&&c<123)||(c==45||c==33||c==63||c==42||c==61))||c==16){return true;} event.stopPropagation();event.preventDefault();var letter=String.fromCharCode(c).toLowerCase();if(!this.currentTarget){var potentialTargets=this.targets[letter];var nearestDistance=-1;var nearestTarget=null;for(var i=0;i<potentialTargets.length;i++){var distance=this.player.distanceTo(potentialTargets[i]);if(distance<n
@Jared314
Jared314 / gist:1918865
Created February 26, 2012 20:36
Z-Type Game Backbone.js Custom Dictionary
//Run this while at the main menu
WORDS={2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[],11:[],12:[]};
var w = 'at el id on add cid get has off set url make save sort sync clear clone fetch model parse pluck reset route start unset create escape extend length models remove render router routes setdom tojson changed destroy emulate history isvalid library trigger urlroot defaults delegate getbycid navigate previous validate attributes collection comparator haschanged initialize noconflict setelement undelegate constructor idattribute'
.toLowerCase().split(' ');
for (var i = w.length - 1; i >= 0; i--) { if(w[i].length < 13 && w[i].length > 1) WORDS[w[i].length].push(w[i]); }
@Jared314
Jared314 / gist:1443201
Created December 7, 2011 15:23
Parslet Transform Mod
require 'parslet'
class Parslet::Transform
def transform_elt(elt, context) # :nodoc:
rules.each do |pattern, block|
if bindings=pattern.match(elt, context)
# Produces transformed value
return call_on_match({:node => elt}.merge(bindings), block)
end
end
@Jared314
Jared314 / build-core64.sh
Last active June 11, 2022 13:08
Remaster Tiny Core Linux Core for x64
#!/bin/sh
# Ubuntu 12.04
# sudo apt-get -y install p7zip-full genisoimage
wget http://www.tinycorelinux.net/4.x/x86/release/Core-current.iso
wget http://www.tinycorelinux.net/4.x/x86/release/distribution_files/core64.gz
wget http://www.tinycorelinux.net/4.x/x86/release/distribution_files/vmlinuz64
# extract files
7z x Core-current.iso -ocore-current