Skip to content

Instantly share code, notes, and snippets.

Jonathan Kemp jonkemp

Block or report user

Report or block jonkemp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jonkemp
jonkemp / .editorconfig
Last active Apr 11, 2017
gulp-jquery-t3 sample project
View .editorconfig
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
View bookmarklets.html
<!-- switch to htts if available -->
<a href="javascript:(function(){if(location.protocol!='https:'){location.href='https:'+window.location.href.substring(window.location.protocol.length);}})();">HTTPS Switcher</a>
@jonkemp
jonkemp / OSX-junos_pulse_listenToMe.sh
Created Mar 8, 2016 — forked from Andrewpk/OSX-junos_pulse_listenToMe.sh
wtf juniper. Anyone else find it irritating that junos pulse services and pulse tray must always running in OS X regardless of whether or not you're currently connected? Yeah, me too. I added the following as aliases to my shell to fix this problem. Be sure to change your /Library/LaunchAgents/net.juniper.pulsetray.plist file to reflect the `Kee…
View OSX-junos_pulse_listenToMe.sh
#################################################################################
# start and stop the vpn from the command line from now on with these two commands
# or rename the aliases as you see fit.
#################################################################################
alias startvpn="sudo launchctl load -w /Library/LaunchDaemons/net.juniper.AccessService.plist; open -a '/Applications/Junos Pulse.app/Contents/Plugins/JamUI/PulseTray.app/Contents/MacOS/PulseTray'"
alias quitvpn="osascript -e 'tell application \"PulseTray.app\" to quit';sudo launchctl unload -w /Library/LaunchDaemons/net.juniper.AccessService.plist"
@jonkemp
jonkemp / dev_server.md
Last active Jan 8, 2016
Starting a development server
View dev_server.md

Start a dev server to preview your work using Python, Ruby or Node.js

Requirements

Mac OS: Ruby and Python are pre-installed. Install Node.js.

Windows: First install Ruby, Python or Node.js

Ruby

@jonkemp
jonkemp / templateManager.js
Last active Jun 8, 2016
Load and cache external templates with jQuery and Underscore. Returns a promise. Useful for JavaScript MVC frameworks, such as Backbone.js.
View templateManager.js
/* global $, _ */
var TemplateManager = {};
(function () {
'use strict';
var cache = {};
TemplateManager.template = function (path) {
@jonkemp
jonkemp / README.md
Last active Aug 29, 2015
Bootstrap 'Digg-Style' Pagination template for Backbone
View README.md
@jonkemp
jonkemp / diffObjKeys.js
Created Mar 4, 2014
Compare 2 objects based on their keys: WIP
View diffObjKeys.js
var _ = _ || {};
_.contains = function (obj, target) {
if (obj == null) return false;
if (Array.prototype.indexOf && obj.indexOf === Array.prototype.indexOf) return obj.indexOf(target) != -1;
return obj.some(function(value) {
return value === target;
});
};
@jonkemp
jonkemp / reverseIt.js
Last active Aug 29, 2015
Reverse a string using JavaScript.
View reverseIt.js
function reverseIt(str) {
return str.split('').reverse().join('');
}
@jonkemp
jonkemp / formatDate.js
Last active Aug 29, 2015
Take a date string and return it in a certain format.
View formatDate.js
function pad(num) {
return (num < 10 ? '0' : '') + num;
}
function formatDateMonthDayYear(date) {
if (date) {
date = new Date(date);
} else {
date = new Date();
}
View babySteps.js
var args = process.argv.slice(2);
var total = 0;
for (var i = 0, len = args.length; i < len; i++) {
total += Number(args[i]);
}
console.log(total);
You can’t perform that action at this time.