Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
hughfdjackson / GLnJSGFx
Created April 18, 2012 13:26 — forked from anonymous/GLnJSGFx
a guest on Apr 18th, 2012 - pastebin.com/GLnJSGFx
The JSON:
{"markers": [
{"title":"Varisia", "lat":74.37118, "lng":-49.61677, "type":"region", "info":"Varisia (region): Bibbity <strong>Boo!</strong>"}
]
}
function loadMarkers(url) {
$.getJSON(url, function(data) {
$.each(data, function(index, entry) {
console.log(index);
@hughfdjackson
hughfdjackson / 9m4ZyX9k
Created April 14, 2012 16:01 — forked from anonymous/9m4ZyX9k
a guest on Apr 14th, 2012 - pastebin.com/9m4ZyX9k
// Create our test array.
var arr = [ "one", "one", "one" ]
var foo = function(){
var curr = 0
, bar = function(){
console.log(arr[curr])
curr += 1
if ( curr < arr.length ) setTimeout(bar, 3000)
}
@hughfdjackson
hughfdjackson / NooB 001
Created March 19, 2012 17:23 — forked from anonymous/NooB 001
litle problem
function Obiekt(z,y,t) {
this.start = setInterval(this.ruch.bind(this), 5000)
this.ruch = function() {
.....
window.addEventListener("load", function(){
var player = {};
var america = {};
player.hp = 100;
player.money = 50000;
player.inventorySpace = 100;
player.location = america;
player.inventory = {weed:0, cocaine:0, pharms:0, lsd:0, mushrooms:0, meth:0, peyote:0, nitrous:0, heroin:0, growSupplies:0, chemSupplies:0, fuel:0, medpack:0, explosives:0};
player.cellPhone = 0;
player.IDs = {};
@hughfdjackson
hughfdjackson / gist:1973918
Created March 4, 2012 17:07 — forked from anonymous/gist:1973805
a guest on Mar 4th, 2012 - pastebin.com/6QbMfUBX
function Agent() {}
Agent.prototype.configuration = function() {
// something
};
Agent.prototype.alarms = function() {
// something
};
void function(root){
function georender(can, obj){
renderFunctions[obj.type](can,obj);
}
var renderFunctions = georender.fn = {
// handle actual rendering here
point: function(can, obj){},
@hughfdjackson
hughfdjackson / gist:1872344
Created February 20, 2012 23:45 — forked from anonymous/gist:1872338
a guest on Feb 20th, 2012 - pastebin.com/Q1gx6QB8
function generateBlob(keyName, encodedData) {
//Append the file format prefix:
var saveString = "EMULATOR_DATA";
var consoleID = "GameBoy";
//Figure out the length:
var totalLength = (saveString.length + 4 + (1 + consoleID.length)) + ((1 + keyName.length) + (4 + encodedData.length));
//Append the total length in bytes:
saveString += to_little_endian_dword(totalLength);
//Append the console ID text's length:
saveString += to_byte(consoleID.length);
@hughfdjackson
hughfdjackson / gist:1775237
Created February 8, 2012 23:04 — forked from anonymous/gist:1775221
TheWarden - pastebin.com/3bv12LsW
function selectStoreValues(fromElementID,toElementID)
{
var fileToTableObj = document.getElementById('ImportexportFilesSelected');
var fileToTable = fileToTableObj.options[fileToTableObj.selectedIndex].value;
var txtSelectedValuesObj = document.getElementById(toElementID);
var selectedArray = new Array();
var selObj = document.getElementById(fromElementID);
var i;
var count = 0;
for (i=0; i<selObj.options.length; i++)
@hughfdjackson
hughfdjackson / gist:1703648
Created January 30, 2012 09:59 — forked from anonymous/gist:1703623
sendoushi - pastebin.com/JzGNVwCB
void function(){
var InstM=jQuery('#InstitutionalM');
var SolutM=jQuery('#SolutionsM');
var DevM=jQuery('#DevelopersM');
InstM.subname=jQuery('#InstitutionalSM');
SolutM.subname=jQuery('#SolutionsSM');
DevM.subname=jQuery('#DevelopersSM');
var AllSubMenu=jQuery('#InstitutionalM,#SolutionsM,#DevelopersM');
@hughfdjackson
hughfdjackson / gist:1700354
Created January 29, 2012 19:51 — forked from anonymous/gist:1700322
sgflt - pastebin.com/drsKKm4n
What I want: Load a number of images and fire a callback once all are loaded. The image objects of all images need to be available, this is *not* just for caching.
Example use:
var loader = new ImageLoader();
var img1 = loader.addImage('someurl');
var img2 = loader.addImage('anotherurl');
loader.beginLoading(function() {
/* do something with the loaded images img1 and img2, which are Image objects
});