Skip to content

Instantly share code, notes, and snippets.

Joel Kemp mrjoelkemp

Block or report user

Report or block mrjoelkemp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mrjoelkemp / go-defer.js
Last active Dec 22, 2017
Go-style defer without dependency injection
View go-defer.js
var deferrable = function (cb) {
function getFunctionBody(code) {
var functionDef = code.match(/\{(.|[\r\n])+\}/);
// Strip body of all useless chars
return functionDef[0].replace(/\{|\}/g, '')
// Grab the entire defer() block
mrjoelkemp / parseFunctionArguments.js
Created Sep 11, 2013
For every function on a given object, set up the function to auto-parse stringified arguments. Use case: In Flash to Javascript communication, this avoids the need to manually parse for every JS api endpoint.
View parseFunctionArguments.js
function parseFunctionArguments (obj) {
for (var method in obj) {
if (obj.hasOwnProperty(method) && typeof obj[method] === 'function') {
(function (method) {
var func = obj[method];
obj[method] = function () {
// Try to convert each string arg into an object literal
var converted = [], function (v) {
if (typeof v === 'string') {
You can’t perform that action at this time.