Skip to content

Instantly share code, notes, and snippets.

@mbjordan
mbjordan / broncos-blue.txt
Last active October 13, 2015 06:37
Broncos Web Colors
#001F52
@mbjordan
mbjordan / no-class.js
Created December 6, 2012 17:10
no-class.js
var MyLib = {
vars: {
var1: 'value1',
var2: 'value2'
},
func1: function () {
return this.vars.var1;
},
func2: function () {
alert("This is func2");
@mbjordan
mbjordan / sprint-tests.js
Last active December 18, 2015 15:49
SPrint.js - s[tring]print
// ------------ Tests
var s0,
s1;
// Ordered Array mode
s0 = sprint("This is %s %s call, using an %s in order", "a", "function", "array");
@mbjordan
mbjordan / read-hash.js
Created July 17, 2013 22:13
Simply read the hash both on page load and for every hash change.
window.onhashchange = doChange;
window.onload = doChange;
function doChange() {
var _hash = window.location.hash.replace("#!", "");
console.log(_hash);
}
function listOrArray(Arr) {
var List = Array.prototype.slice.call(arguments, 1),
i;
// If `List` is not empty, assume there are more module objects sent as List Arguments
if (List.length > 0) {
List.unshift(Arr);
Arr = List;
} else {
// No List args in sight, treat the first arg `Arr` as an array and loop through it.
@mbjordan
mbjordan / slugify.js
Created August 28, 2013 21:59
Create a URL-friendly string on multiple string, as a list. Returns an Array.
var Return;
function slugify(){
var O = Array.prototype.slice.call(arguments),
t = [],
x = 0,
i;
for (i in O){
if (O.hasOwnProperty(i) && typeof O[i] === "string"){
@mbjordan
mbjordan / partial.js
Last active September 26, 2015 21:01
function partial(fn) { // `fn` is the original function
// `args_a` are the arguments (barring `fn`) of the first call.
var args_a = Array.prototype.slice.call(arguments, 1);
// Now, we return a new function, with the first set of arguments already applied.
return function partialApplicator() {
// `args_b` are the arguments applied at the second call
var args_b = Array.prototype.slice.call(arguments);
// Now, concatenate both Arrays and apply them to the original function