Skip to content

Instantly share code, notes, and snippets.

Avatar

Dion Almaer dalmaer

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am dalmaer on github.
  • I am dalmaer (https://keybase.io/dalmaer) on keybase.
  • I have a public key whose fingerprint is 0C48 9C88 E848 8F41 F5B3 9150 EB15 FC08 4107 119D

To claim this, I am signing this object:

@dalmaer
dalmaer / x
Created Mar 25, 2009
Super-primitive Bespin integration
View x
CmdUtils.CreateCommand({
name: "bespin",
icon: "https://bespin.mozilla.com/favicon.ico",
homepage: "http://bespin.mozilla.com/",
author: {name: "Atul Varma", email: "avarma@mozilla.com",
homepage: "http://www.toolness.com"},
license: "MIT",
description: "Super-primitive Bespin integration.",
help: "You can run any Bespin command-line command via Ubiquity; just make sure you're on a tab with the Bespin editor when you use the command.",
takes: {"command": /.*/},
View indexeddb-sample.js
var db = indexedDB.open('books', 'Book store', false);
if (db.version !== '1.0') {
var olddb = indexedDB.open('books', 'Book store');
olddb.createObjectStore('books', 'isbn');
olddb.createIndex('BookAuthor', 'books', 'author', false);
olddb.setVersion("1.0");
}
// db.version === "1.0";
var index = db.openIndex('BookAuthor');
var matching = index.get('fred');
View indexeddb-objectstore.js
var store = db.openObjectStore('Contact');
var lincoln = {name: 'Lincoln', number: '7012'};
var contact = store.put(lincoln);
// contact.id === 1
var contact = store.get(1);
// contact.name === 'Lincoln'
View sample-hummingbird-track.js
try {
Gilt.Hummingbird.track( {"pageName":"login","server":"www.gilt.com","channel":"login","pageType":null,"prop1":null,"eVar1":null,"prop2":null,"eVar2":null,"prop3":null,"eVar3":null,"prop4":"login page","eVar4":null,"prop5":null,"eVar5":null,"prop6":null,"eVar6":null,"prop7":null,"eVar7":null,"prop8":null,"eVar8":null,"prop9":null,"eVar9":null,"prop10":null,"eVar10":null,"prop11":null,"eVar11":null,"prop12":null,"eVar12":null,"prop13":null,"eVar13":null,"prop14":null,"eVar14":null,"prop15":null,"eVar15":null,"prop16":null,"eVar16":null,"prop17":null,"eVar17":null,"prop18":null,"eVar18":null,"prop19":null,"eVar19":null,"prop20":null,"eVar20":null,"campaign":null,"state":null,"zip":null,"events":"","products":"","purchaseID":null,"trackingServer":"stat.gilt.com","trackingServerSecure":"sstat.gilt.com"} );
} catch(e) {}
});
View hummingbird-tracker-clientapi.js
HummingbirdTracker = {};
HummingbirdTracker.track = function(env) {
delete env.trackingServer;
delete env.trackingServerSecure;
env.u = document.location.href;
env.bw = window.innerWidth;
env.bh = window.innerHeight;
env.guid = document.cookie.match(/guid=([^\_]*)_([^;]*)/)[2];
env.gen = document.cookie.match(/gender=([^;]*);/)[1];
env.uid = document.cookie.match(/user_id=([^\_]*)_([^;]*)/)[2];
@dalmaer
dalmaer / coffee2js
Created Apr 6, 2011
Someone wanted a script that converts javascript to coffeescript. easy! ;)
View coffee2js
#!/usr/bin/env perl
print "`";
while (<>) {
print;
}
print "`";
View qrcodesample.js
// draw a URL that the reader can pick up and launch a browser say
// basic library
draw_qrcode("http://functionsource.com/");
// jQuery plugin
jquery('#insertit').qrcode("http://functionsource.com/");
View zombie.sample.js
var zombie = require("zombie");
var assert = require("assert");
// Load the page from localhost
zombie.visit("http://localhost:3000/", function (err, browser, status) {
// Fill email, password and submit form
browser.
fill("email", "zombie@underworld.dead").
fill("password", "eat-the-living").
View callercalleefun.js
// the code of the "foo" function
// never changes, but the "this" value
// differs in every activation
function foo() {
alert(this);
}
// caller activates "foo" (callee) and
// provides "this" for the callee