Skip to content

Instantly share code, notes, and snippets.

View jrutter's full-sized avatar

Jake Rutter jrutter

View GitHub Profile
@christian-bromann
christian-bromann / webdriver.js
Last active December 30, 2015 21:10
Use Webdriverjs with Sauce Labs (example)
var webdriverjs = require('../index'),
client = webdriverjs.remote({
desiredCapabilities: {
browserName: 'chrome',
version: '27',
platform: 'XP',
tags: ['examples'],
name: 'This is an example test'
},
host: 'ondemand.saucelabs.com',
@aaronksaunders
aaronksaunders / app_snippet_1.js
Last active August 25, 2017 03:10
Utilizing the Queue Library from Async.js for downloading multiple assets with Appcelerator Titanium
//
// https://github.com/caolan/async
//
var async = require('async');
// this function will be called for each array element
function process(_url, _processCallback) {
// download the file
get_file(_url, function(_resp) {
@pmeenan
pmeenan / user-timing-rum.js
Last active January 18, 2024 23:46
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).
// 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
@chrislkeller
chrislkeller / import_json_appsscript.js
Last active March 25, 2024 19:45
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@afeld
afeld / gist:4952991
Last active February 8, 2022 03:13
good APIs for mashups

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.

@steinbring
steinbring / StoreFormValuesInLocalStorage-Part1.html
Created November 18, 2012 01:35
How to use localStorage and sessionStorage to make form values persistant
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="windows-1252">
<title>Keep webform data persistent</title>
<!-- jQuery CDN -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style type="text/css">
/*Float the form labels to the left and allow them 40% of the width of the form*/
@DiegoSalazar
DiegoSalazar / validate_credit_card.js
Last active April 24, 2024 12:51
Luhn algorithm in Javascript. Check valid credit card numbers
// 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--) {
@tomoyukiinoue
tomoyukiinoue / 00_prepare
Created October 14, 2012 04:08
Install Rails 3.2.8 for Mac OS X Mountain Lion (10.8.2)
1. Install Xcode 4.5.1 from AppStore.
1. Install Command Line Tools via Xcode preferences.
@aaronksaunders
aaronksaunders / app.js
Created May 20, 2012 21:28
Appcelerator Titanium Yelp API v2.0 Integration
//
// Aaron K. Saunders
//
// http://www.clearlyinnovative.com
// http://blog.clearlyinnovative.com
// @aaronksaunders
//
// SEE http://bytespider.github.com/jsOAuth/ for jsOAuth.js
//
Ti.include("jsOAuth.js");
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",