Joe Johnson say2joe

View js-snippets.js
1 2
// Return absolute path without domain or protocol:
path = location.href.replace(/(.+\w\/)(.+)/,"/$2");
View Gruntfile.js
1 2 3 4 5 6 7 8 9 10
// Generated on 2013-09-24 using generator-webapp 0.4.1
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
 
// # Globbing
// for performance reasons we're only matching one level down:
View css-hacks-inputs.css
1 2
/* Eliminate glow on input fields when focused */
input:focus { outline: none; }
View object.debug.js
1 2 3 4 5 6 7 8 9 10
/**
* Debug any JavaScript Object by inserting this code into your main JavaScript file.
* After initiating debugging on an object (ex. myObj.debug();), your console will
* log the name of a [named] function and its execution time. This helps when tracing
* the stack method calls with many objects and method calls.
* Note: this most likely only works for WebKit-based browsers supporting fn.name.
**/
 
Object.prototype.debug = function() {
var objDebugger = function(cb) {
View jsla.presentation.html
1 2 3 4 5 6 7 8 9 10
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta name="description" content="JS.LA - JavaScript Made Simple: Object Orientation" />
<title>JS.la Presents JavaScript Made Simple: Obect Orientation</title>
<style>
h4 pre {
border: 1px solid #ccc;
View ytIframe.js
1 2 3 4 5 6 7 8 9 10
/*! Reference: https://developers.google.com/youtube/iframe_api_reference/ */
/**
* Based on my original (admittedly) "rush" implementation. I
* will be refactoring this code in a module, based on use-cases driven by business
* reqs once they're more solidified. enableYouTubeAPI is
* invoked via a Backbone View's render method after page load (used on LPs).
*/
var MyNamespace = {
MySubModule: {
enableYouTubeAPI: function() {
View switch.regexp.js
1 2 3 4 5 6 7 8 9 10
switch (true) {
case (/Chrome/).test(navigator.userAgent):
console.log("You're using Chrome.");
break;
case (/MSIE/).test(navigator.userAgent):
console.log("Unfortunately, you're using Internet Explorer");
break;
default:
console.log("You're using a different kinda browser.");
}
View enside.js
1 2 3 4 5 6 7 8 9 10
define(['rit','util/router','navIndicator'], function(RIT,Router) {
var $ = RIT.$, _ = RIT._, B = RIT.Backbone, Events = RIT.Events, self;
 
/**
* iEnside (/w enside.html) supports legacy Toyota connect and technology pages.
* Example uses include (URLs in browser's location / address bar, not iframe):
* http://local.rit.toyota.com/entune/enside.html#!/entune/learning-center/new-index.html
* http://local.rit.toyota.com/entune/enside.html#!phones (uses urls property object)
* http://local.rit.toyota.com/entune/enside.html (uses default route, "defRoute")
* @type {Router}
View snipLoader.js
1 2 3 4 5 6 7 8 9 10
// Sets the html of an element with "Loading ..." and continues to print a dot up to 20 times.
// If the element is ready to be updated with actual content, simply clearIterval($el[0].interval);
// Requires: jQuery v1.4+
$el.html(function(i,html){
this.intcount = 0;
this.interval = ($.proxy(function(el){
return setInterval(function(){
if (++el.intcount < 20) el.innerHTML += '.';
else clearInterval(el.interval);
}, 500);
View jQuery.fn.formData.js
1 2 3 4 5 6 7 8 9 10
/**
* Extend jQuery with additional functionality to be used throughout app.
*/
$.fn.extend({
/** formData:
* Most form submissions will require special formatting different from
* a normal get request (a=val1,val2&b=val3 vs. a=val1&a=val2&b=val3).
* Sample use: $.getJSON(url,$("myFormElement").formData(),callback);.
* @return {String} Serialized form data appropriate for GET requests.
* @author Joe Johnson
Something went wrong with that request. Please try again.