Skip to content

Instantly share code, notes, and snippets.

View JBreit's full-sized avatar

Jason Breitigan JBreit

  • Inner Mind Co.
  • Lancaster, PA
View GitHub Profile
@JBreit
JBreit / Gruntfile.js
Created May 10, 2017 03:07 — forked from eliotfowler/Gruntfile.js
Sample Gruntfile
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Define the configuration for all the tasks
grunt.initConfig({
@JBreit
JBreit / urlobject.js
Created May 16, 2016 02:07 — forked from aymanfarhat/urlobject.js
JS utility function that: - Breaks down url to an object with accessible properties: protocol, parameters object, host, hash, etc... - Converts url parameters to key/value pairs - Convert parameter numeric values to their base types instead of strings - Store multiple values of a parameter in an array - Unescape parameter values
function urlObject(options) {
"use strict";
/*global window, document*/
var url_search_arr,
option_key,
i,
urlObj,
get_param,
key,
@JBreit
JBreit / node-curry.js
Created April 1, 2016 17:22 — forked from fernandezpablo85/node-curry.js
Explanation of the curry function for node.js
function curriedReadFile(path) {
var _done, _error, _result;
var callback = function(error, result) {
_done = true,
_error = error,
_result = result;
};
fs.readFile(path, function(e, r) {
Handlebars.registerHelper('slugify', function(title) {
return title.toLowerCase()
.replace(/ /g,'-')
.replace(/[^\w-]+/g,'');
});
/**
Code copyright Dustin Diaz and Ross Harmes, Pro JavaScript Design Patterns.
**/
// Constructor.
var Interface = function (name, methods) {
if (arguments.length != 2) {
throw new Error("Interface constructor called with " + arguments.length + "arguments, but expected exactly 2.");
}
this.name = name;
@JBreit
JBreit / browser.md
Created November 29, 2015 01:47 — forked from defunctzombie/browser.md
browser field spec for package.json

The browser field is provided by a module author as a hint to javascript bundlers or component tools when preparing modules for client side use.

terms

Below are common terms used in the rest of the document

server

This is a non-dom based javascript execution environment. It usually only contains the base javascript language spec libraries and objects along with modules to communicate with OS features (available through commonjs require).

client

@JBreit
JBreit / jquery-pubsub.js
Created November 23, 2015 02:50 — forked from bentruyman/jquery-pubsub.js
Simple Pub/Sub Implementation for jQuery
/*
* Simple Pub/Sub Implementation for jQuery
*
* Inspired by work from Peter Higgins (https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js)
*
* This is about the simplest way to write a pubsub JavaScript implementation for use with jQuery.
*/
(function( $ ) {
// Cache of all topics
@JBreit
JBreit / sql-mongo_comparison.md
Last active September 16, 2015 01:09 — forked from aponxi/sql-mongo_comparison.md
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

@JBreit
JBreit / gauge.js
Last active August 29, 2015 14:21 — forked from tomerd/gauge.js
function Gauge(placeholderName, configuration)
{
this.placeholderName = placeholderName;
var self = this; // for internal d3 functions
this.configure = function(configuration)
{
this.config = configuration;
#!/bin/sh
[ $# -eq 0 ] && { echo "Usage: ${0} version-string" ; exit 1; }
VERSION=${1}
PREFIX="/usr/local"
SRC_CWD="${PREFIX}/src"
SRC_DIR="${SRC_CWD}/node"
SRC_GIT="git://github.com/joyent/node.git"