Skip to content

Instantly share code, notes, and snippets.

View amasad's full-sized avatar
🎱
balling

Amjad Masad amasad

🎱
balling
View GitHub Profile
Editor.prototype.setMode = function (language) {
var mode = MODES[language].mode;
this.editor.getSession().setMode(mode);
};
// This is fine.
new Worker('/path/to/script.js');
// Error: SECURITY_ERR: DOM Exception 18
new Worker('http://someotherdomain.com/path/to/script.js');
WorkerClient = ace.require('ace/worker/worker_client').WorkerClient;
WorkerClient.prototype.$guessBasePath = function () {
var loc = window.location;
return loc.protocol + '//' + loc.host + '/assets/ace/';
};
function bf (code) {
var codeSize = code.length;
var i = 0, ip = 0, cp = 0, dp = 0, m = {};
var loopIn = {}, loopOut = {};
var tmp = [];
for ( var cp = 0; cp < codeSize ; cp++ )
if ( code[cp] == '[' )
tmp.push(cp);
else
function bf (code) {
var codeSize = code.length;
var ip = 0, cp = 0, dp = 0, m = {};
var loopIn = {}
, loopOut = {}
, tmp = [];
for (cp = 0; cp < codeSize ; cp++)
if (code[cp] == '[') tmp.push(cp);
function bf (code) {
var codeSize = code.length;
var cp = 0, dp = 0, m = {};
var loopIn = {}
, loopOut = {}
, tmp = [];
for (cp = 0; cp < codeSize ; cp++)
if (code[cp] == '[') tmp.push(cp);
function bf (code) {
task.spawn(function () {
var codeSize = code.length;
var i = 0, cp = 0, dp = 0, m = {};
var loopIn = {}, loopOut = {};
var tmp = [];
for ( var cp = 0; cp < codeSize ; cp++ )
if ( code[cp] == '[' )
tmp.push(cp);
gapi, ___jsl, osapi, shindig, gadgets, iframer, iframes, ToolbarApi, IframeBase, Iframe, IframeProxy, IframeWindow, __gapi_jstiming__,googleapisv0, csrf_token, csrf_param
@amasad
amasad / router.js
Last active December 10, 2015 07:28
A quick and dirty yet powerful JS router.
// requires underscore.js for `_.clone`, although come to think about it could be done without it.
// The router module.
var router = (function () {
// Get the location array and filter out empty strings.
var path = window.location.pathname.split('/').filter(Boolean)
// The param arg stack.
, arg_stack = [];
@amasad
amasad / adam.js
Last active December 10, 2015 12:08 — forked from petermichaux/adam.js
var adam = Proxy.create({
get: function (rec, message) {
var firstname = "Adam";
var lastname = "of Eden";
switch (message) {
case "getName":
return firstname + " " + lastname;
default:
throw "unknown message " + message;
}