Skip to content

Instantly share code, notes, and snippets.


Jake Rutter jrutter

View GitHub Profile
tomoyukiinoue / 00_prepare
Created Oct 14, 2012
Install Rails 3.2.8 for Mac OS X Mountain Lion (10.8.2)
View 00_prepare
1. Install Xcode 4.5.1 from AppStore.
1. Install Command Line Tools via Xcode preferences.
victorb / app.js
Created Sep 24, 2013
Easy AngularJS Directive for Google Places Autocomplete
View app.js
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
stuwilli / gist:9580481
Created Mar 16, 2014
How to Floor, Round, Ceiling in JSTL/EL
View gist:9580481
Floor(N) -> ${N-(N%1)}
Ceiling(N) -> ${N+(1-(N%1))%1}
Round(N) -> ${N+((N%1>0.5)?(1-(N%1))%1:-(N%1))}
pmeenan / user-timing-rum.js
Last active Jun 16, 2020
Support routine for adding W3C user timing events to a site. Includes some basic polyfill support for browsers that don't support user timing or navigation timing (though the start time for non-navigation timing support could be improved with IE < 9 to use IE's custom start event).
View user-timing-rum.js
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
jeffjohnson9046 / percent-filter.js
Last active Sep 4, 2020
Format percentages in AngularJS
View percent-filter.js
// In app.js or main.js or whatever:
// var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']);
// This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17).
myApp.filter('percentage', ['$filter', function ($filter) {
return function (input, decimals) {
return $filter('number')(input * 100, decimals) + '%';
aaronksaunders / app.js
Created May 20, 2012
Appcelerator Titanium Yelp API v2.0 Integration
View app.js
// Aaron K. Saunders
// @aaronksaunders
// SEE for jsOAuth.js
steinbring / StoreFormValuesInLocalStorage-Part1.html
Created Nov 18, 2012
How to use localStorage and sessionStorage to make form values persistant
View StoreFormValuesInLocalStorage-Part1.html
<!DOCTYPE html>
<html lang="en-US">
<meta charset="windows-1252">
<title>Keep webform data persistent</title>
<!-- jQuery CDN -->
<script src=""></script>
<style type="text/css">
/*Float the form labels to the left and allow them 40% of the width of the form*/
afeld / gist:4952991
Last active Dec 27, 2020
good APIs for mashups
View gist:4952991

This list has been superseded by Public APIs. Check there for APIs with Auth: No, HTTPS and CORS Yes.

List of data APIs that require no server-side auth or private credentials, and are thus good for small browser-only JS projects.

robertknight /
Last active Feb 8, 2021
Minimal Webpack DllPlugin example

Compile with:

webpack --config vendor.webpack.config.js
webpack --config app.webpack.config.js

Use with the following index.html

DiegoSalazar / validate_credit_card.js
Last active Feb 16, 2021
Luhn algorithm in Javascript. Check valid credit card numbers
View validate_credit_card.js
// Takes a credit card string value and returns true on valid number
function valid_credit_card(value) {
// Accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
let nCheck = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {