Skip to content

Instantly share code, notes, and snippets.

Jake Rutter jrutter

View GitHub Profile
@victorb
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: {}
};
@tomoyukiinoue
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.
@jeffcogswell
jeffcogswell / q_example.js
Last active Nov 27, 2018
Here's another chaining example on using q.js. This doesn't have any error handling, as I just want to demonstrate the chaining concept. Please read the comments carefully, as I start out with a non-q example, to show the order of flow. Please post comments if there's anything that isn't clear and I'll try to revise it as needed.
View q_example.js
// Q sample by Jeff Cogswell
/*===========
We want to call these three functions in sequence, one after the other:
First we want to call one, which initiates an ajax call. Once that
ajax call is complete, we want to call two. Once two's ajax call is
complete, we want to call three.
BUT, we don't want to just call our three functions in sequence, as this quick
@betamax
betamax / generate-docs.sh
Created Jun 19, 2015
A script that we use at Lateral to generate our documentation
View generate-docs.sh
#!/bin/sh
# Which md files to compile
declare -a arr=("hybrid-recommender" "text-matching" "pre-populated-recommenders")
# Now loop through the above array
for i in "${arr[@]}"
do
# Where to store the documentation
@aaronksaunders
aaronksaunders / app_snippet_1.js
Last active Aug 25, 2017
Utilizing the Queue Library from Async.js for downloading multiple assets with Appcelerator Titanium
View app_snippet_1.js
//
// 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) {
@eric1234
eric1234 / image-defer.js
Last active Jul 10, 2017
Deferred image loading
View image-defer.js
var ImageDefer = Class.create({
initialize: function(placeholder) {
this.placeholder = $(placeholder);
this.placeholder.update('Loading image...');
if(ImageDefer.page_loaded) {
this.preload();
} else {
Event.observe(window, 'load', (function() {this.preload()}).bind(this));
}
@martinnormark
martinnormark / hapijs-routes.js
Created Mar 26, 2016
Load routes from separate files with hapi.js
View hapijs-routes.js
module.exports = [
{ method: 'GET', path: '/users', handler: function () {} },
{ method: 'GET', path: '/users/{id}', handler: function () {} }
];
---
var cart = require('./cart');
var user = require('./user');
@christian-bromann
christian-bromann / webdriver.js
Last active Dec 30, 2015
Use Webdriverjs with Sauce Labs (example)
View webdriver.js
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',
@mrosati84
mrosati84 / toggleClass.html
Created Oct 2, 2013
Simple toggleClass implemented in AngularJS
View toggleClass.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.is-active {
color: red;
}
</style>
@dawsontoth
dawsontoth / Geolocation.js
Created Feb 9, 2011
Constantly Updating Geolocation in Appcelerator Titanium
View Geolocation.js
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.distanceFilter = 0;
var win = Ti.UI.createWindow({backgroundColor: '#fff'});
var label = Ti.UI.createLabel();
win.add(label);
win.open();
function reportPosition(e) {
if (!e.success || e.error) {
You can’t perform that action at this time.