Skip to content

Instantly share code, notes, and snippets.

hz serve --serve-static ./ --allow-unauthenticated yes --allow-anonymous yes --permissions no
@BrianRosamilia
BrianRosamilia / index.js
Last active April 19, 2016 18:12
Simple Require / Mocking in JS
require('app-module-path').addPath(__dirname);
let mockery = require('mockery');
let fsMock = {
stat: function (path, cb) {
console.log('mocked fs.stat');
}
};
mockery.registerMock('fs', fsMock);
mockery.enable({ useCleanCache: true }); //toggle this line to actually run stat
::Be sure 27017, 389 are forwarded inside Vagrantfile
::vagrant init williamyeh/ubuntu-trusty64-docker
vagrant up
vagrant ssh -- 'docker run --restart=always -d -p 27017:27017 mongo:3.0'
vagrant ssh -- 'docker run --restart=always -d -p 389:389 -e SLAPD_PASSWORD=mysecretpassword -e SLAPD_DOMAIN=ldap.example.org dinkel/openldap'
@BrianRosamilia
BrianRosamilia / gist:25f710ac820eb4a3c413
Created March 23, 2016 01:42
Base Vagrant Ubuntu Desktop
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@BrianRosamilia
BrianRosamilia / gist:d14b2a2c1a620431edf0
Created March 21, 2016 23:26
Measure Process Runtime Powershell
Measure-Command {npm run browserifyScripts}
@BrianRosamilia
BrianRosamilia / gist:4887343e8b5948c3a3df
Last active February 10, 2016 21:12
Run local apps from Chrome
--allow-file-access-from-files --enable-file-cookies --disable-web-security
@BrianRosamilia
BrianRosamilia / gist:6694a0ff6c6d97643f35
Created January 12, 2016 18:32
Find non-HTTPS login pages using google
http login -https
//The future is now!
global.compiler = require('htmlbars/dist/cjs/htmlbars-compiler.js');
global.DOMHelper = require('htmlbars/dist/cjs/dom-helper.js');
global.hooks = require('htmlbars/dist/cjs/htmlbars-runtime.js').hooks;
global.render = require('htmlbars/dist/cjs/htmlbars-runtime.js').render;
var templateSpec = compiler.compileSpec('<p>hi {{name}}</p>', {});
var template = compiler.template(templateSpec);
var env = { dom: new DOMHelper(), hooks: hooks, helpers: {} };
@BrianRosamilia
BrianRosamilia / gist:5441481a1a8758907e80
Last active August 29, 2015 14:25
JS Boilerplate for accessing long property chains
Object.prototype.getChainedProperty = function(str) {
var t = str.split('.');
var value = this;
for(x = 0; x < t.length; x++){
if(value[t[x]] === undefined){
return undefined;
}
value = value[t[x]];
}