Skip to content

Instantly share code, notes, and snippets.

View jackwanders's full-sized avatar

Jack Anderson jackwanders

  • Truebill
  • Silver Spring, MD
View GitHub Profile
@jackwanders
jackwanders / get-azer-pkg-statuses.js
Created March 23, 2016 14:03
Script used to determine current publish status of azer's packages. Done out of curiosity as to who is claiming the free'd up npm package names.
'use strict';
let _ = require('lodash');
let Promise = require('bluebird');
let request = Promise.promisify(require('request'));
let pkg_list = 'https://gist.githubusercontent.com/azer/db27417ee84b5f34a6ea/raw/50ab7ef26dbde2d4ea52318a3590af78b2a21162/gistfile1.txt';
let registry = 'http://registry.npmjs.org/';
function processPkgs(pkgs) {
let data = {
maintainerCounts: [],
@jackwanders
jackwanders / azer-package-status.json
Last active March 23, 2016 15:53
A list of all of azer's packages, group by those currently unpublished and those that have been republished. Published packages are grouped by maintainer(s) and sorted by last publish time. Also included is a count of how many packages have been published by each maintainer. Script used to generate this data can be found at https://gist.github.c…
{
"maintainerCounts": [
{
"maintainer": "nj48",
"count": 230
},
{
"maintainer": "kazmer",
"count": 8
},
@jackwanders
jackwanders / PropAddr.js
Last active August 29, 2015 14:05
A proof of concept method for creating multiple levels of hierarchy within an object in one shot, regardless of whether they already exist
/**
* PropAddr
*/
var PropAddr = function(obj) {
var props = [],
i;
if(arguments.length === 2) {
props = arguments[1].split('.');
} else {
props = Array.prototype.slice.call(arguments, 1);
/*global define*/
/**
* Backbone.Maid - Someone's gotta clean up after your mess
*
* An attempt to write a(n admittedly opinionated) version
* of Backbone.View that better manages sub-views
*
*/
@jackwanders
jackwanders / Backbone.Promise.js
Last active December 31, 2015 23:49
Backbone Collection with a built-in fetch promise
/*global define*/
/**
* Backbone.Promise - You'll tell me when you're ready, won't you?
*
* Let's create a collection that immediately fetches itself upon
* instantiation, and provide a promise for the completion of said fetch.
*
* Why? Because why not?
*
@jackwanders
jackwanders / Backbone fetch plugin for require
Last active December 31, 2015 15:48
A simple require plugin to allow us to require a pre-fetched instance of a backbone model or collection
define({
load: function(name, req, onLoad, config) {
'use strict';
if(config.isBuild) { onLoad(null); } // prevent errors w/ synchronous optimizer
else {
req([name], function(BackboneClass) {
var obj = new BackboneClass();
obj.fetch({
success: function(instance) {