Skip to content

Instantly share code, notes, and snippets.

View kalisjoshua's full-sized avatar

Joshua T Kalis kalisjoshua

View GitHub Profile
@kalisjoshua
kalisjoshua / jquery.pubsub.js
Created January 8, 2012 03:00 — forked from bentruyman/jquery-pubsub.js
Simple Pub/Sub Implementation for jQuery
/*
jQuery pub/sub plugin by Peter Higgins ([email protected])
Loosely based on Dojo publish/subscribe API, limited in scope. Rewritten blindly.
Original is (c) Dojo Foundation 2004-2010. Released under either AFL or new BSD, see:
http://dojofoundation.org/license for more information.
*/
(function($) {
var topics = {};
@kalisjoshua
kalisjoshua / grunt.js
Created August 3, 2012 17:53
Working w/ Grunt
/*jshint strict:false*/
/*global module*/
module.exports = function(grunt) {
grunt.registerHelper("wrapp", function (src, argList, args) {
return ";(function (%1) {\n%2\n}(%3));"
.replace("%1", argList || "")
.replace("%3", args || "")
.replace("%2", src);
});
@kalisjoshua
kalisjoshua / dirToJSON.js
Created September 14, 2012 00:05
Directory as JSON object
var fs = require("fs");
var tree = function(dir, done) {
var results = {
"path": dir
,"children": []
};
fs.readdir(dir, function(err, list) {
if (err) { return done(err); }
var pending = list.length;
@kalisjoshua
kalisjoshua / usercam.js
Created November 21, 2012 20:14
Usercam Bookmarklet (getUserMedia Video PIP)
(function (nav, win, doc) {
"use strict";
var lib = "usercam"
, anchor = [true, true] // === top, left
, pending
, pip;
nav.getUserMedia =
(nav.getUserMedia || nav.webkitGetUserMedia || nav.mozGetUserMedia || nav.msGetUserMedia);
@kalisjoshua
kalisjoshua / para_soft.md
Created November 26, 2012 21:54
Markdown soft break paragraph example

The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord, when I lay My vengeance upon thee. <--- end of first paragraph - soft break --> Now that we know who you are, I know who I am. I'm not a mistake! It all makes sense! In a comic, you know how you can tell who the arch-villain's going to be? He's the exact opposite of the hero. And most times they're friends, like you and me! I should've known way back when... You know why, David? Because of the

@kalisjoshua
kalisjoshua / .gitconfig
Last active December 16, 2015 18:59
My current .gitconfig.
[user]
name = Joshua T Kalis
email = [email protected]
[alias]
lg = log --graph --pretty=format:'%C(red)%h%C(reset) -%C(yellow)%d%C(reset) %s %C(green)(%cr) %C(blue)<%an>%C(reset)' --abbrev-commit --date=relative
oldest-ancestor = !zsh -c 'diff -u <(git rev-list --first-parent \"${1:-master}\") <(git rev-list --first-parent \"${2:-HEAD}\") | sed -ne \"s/^ //p\" | head -1' -
[core]
excludesfile = /Users/jkalis/.gitignore_global
[color]
branch = auto
@kalisjoshua
kalisjoshua / gist:5774480
Created June 13, 2013 15:10
git config global
user]
name = Joshua T Kalis
email = [email protected]
[alias]
lg = log --graph --pretty=format:'%C(red)%h%C(reset) -%C(yellow)%d%C(reset) %s %C(green)(%cr) %C(blue)<%an>%C(reset)' --abbrev-commit --date=relative
oldest-ancestor = !zsh -c 'diff -u <(git rev-list --first-parent \"${1:-master}\") <(git rev-list --first-parent \"${2:-HEAD}\") | sed -ne \"s/^ //p\" | head -1' -
webstart = instaweb --httpd=webrick
webstop = instaweb --httpd=webrick --stop
[core]
excludesfile = /Users/jkalis/.gitignore_global
@kalisjoshua
kalisjoshua / euler6.js
Created July 8, 2013 20:40
Project Euler #6 Code Golf
/*
The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first
/*jshint laxcomma:true*/
var APICraft = (function APICraft_API_closure (baseURL) {
return function (endpoint) {
return baseURL + endpoint;
};
}('http://api.api-craft.org/conferences/detroit2013/'));
$.fn.ready(function ($) {
var DAYNAMES
, DAYNAMESLONG
// This F# dojo is directly inspired by the
// Digit Recognizer competition from Kaggle.com:
// http://www.kaggle.com/c/digit-recognizer
// The datasets below are simply shorter versions of
// the training dataset from Kaggle.
// The goal of the dojo will be to
// create a classifier that uses training data
// to recognize hand-written digits, and
// evaluate the quality of our classifier