Skip to content

Instantly share code, notes, and snippets.

@beaspider
beaspider / lazyload.js
Created December 6, 2012 15:41
lazy load js
// can be used for JSONP calls too
var loadScript = function(url, callback) {
var script = document.createElement('script');
script.setAttribute('src', url);
script.setAttribute("type","text/javascript");
script.setAttribute('async', true);
// wait for script to load
var onLoaded = function(script,callback) {
return function() {
// remove the script
@beaspider
beaspider / SFTP.js
Created December 7, 2012 17:22
SFTP utils
/**
* Get the SFTP binary based on OS
*/
var binary = function() {
var windows = require("os").type().match(/windows/i);
return windows ? "psftp" : "sftp";
}
/**
* Utility function to process SFTP commands
@beaspider
beaspider / patterns.js
Last active December 17, 2015 08:49
Common JS Patterns & Snippets
// standard closure / setup code
// either pass in browser standard objects
(function (win, doc) {
'use strict';
})(window, document);
// or just leave alone
(function(){
@beaspider
beaspider / vm-resize-hard-disk.md
Created September 3, 2016 14:31 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where: