Skip to content

Instantly share code, notes, and snippets.

(function (exports) {
var shortCodeRegex = /\{\{\s*(.+?)\}\}/g,
hasWhitespaceRegex = /\s+/;
/**
* @param {string} input - Parsed string
* @param {object} [context] - context object defining shortcodes
* @param {object} [callContext] - call context for any functions called within any shortcode replacement
*
* Supported Inputs:
@mrlannigan
mrlannigan / ListBucket.js
Created February 25, 2015 19:07
ListBucket
'use strict';
function ListBucket(size) {
this.array = [];
this.position = 0;
this.size = size;
this.length = 0;
}
ListBucket.prototype.toArray = function () {
var timer;
timer = setTimeout(function () {console.log('first timer'); timeoutRun()}, 1000);
timer = setTimeout(function () {console.log('second timer'); timeoutRun()}, 1000);
clearTimeout(timer);
function timeoutRun() {
console.log('Timed out!');
}
// home value activation
(function () {
try {
var data = getApp().listing.data;
if (data.isHomeValue == true) {
activate();
}
} catch (e) {
@mrlannigan
mrlannigan / agent-example.js
Created December 17, 2014 05:16
example governor-agent
var GovernorAgent = require('governor-agent'),
agent = new GovernorAgent({some: 'connection settings to governor'});
agent.consume('jobname', {some: 'options'}, function (job) {
// do work
return APromise();
});
@mrlannigan
mrlannigan / gist:11bf30bd57253f822ee0
Created December 5, 2014 13:18
peer dependencies hate me
λ tmp $ ls -al node_modules
ls: node_modules: No such file or directory
λ tmp $ npm install hapi@8.0.0-rc8
hapi@8.0.0-rc8 node_modules/hapi
├── cryptiles@2.0.4
├── peekaboo@1.0.0
├── ammo@1.0.0
├── accept@1.0.0
├── topo@1.0.2
var Hapi = require('hapi');
var server = new Hapi.Server(3000);
var fs = require('fs');
server.route({
method: 'GET',
path: '/',
handler: function (request, reply) {
var stream = fs.createReadStream('./test.js');
<VirtualHost *:80>
DocumentRoot c:\wamp\www\Portal\HomesCom
ServerName ebbersj.homes.com
Include C:\wamp\www\Portal\serverConfig\rewrites\portal.conf
setEnv ENVIRONMENT_LEVEL development
setEnv DEVELOPER ebbersj
</VirtualHost>
@mrlannigan
mrlannigan / gitRemote.sh
Created May 30, 2014 17:14
Allow you to operate on git remotes on multiple remote systems.
#!/bin/bash
# call as if calling "git remote"
#
# ./gitRemote.sh add someuser git@github.com:someuser/repo.git
# ./gitRemote.sh remove someuser
ACTION=${@}
USERNAME=myuser
function bind (scope, func) {
return function () {
func.apply(scope, arguments);
};
}
function A() {
this.console.log('hello A, I\'m logging my output via my this because it is bound to the global context');
}