This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Var & Function Syntax // WIP | |
var someName; // a variable on the local scope | |
someName; // a variable on the global scope | |
window.someName; // a production friendly variable on the global scope | |
// note: when making a reference to any var with a specific namespace, | |
// make sure you specify it in the call | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php | |
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if (input.val() === input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var someFn = function() { | |
$('<style></style>').appendTo($(document.body)).remove(); // force safari redraw | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var yourFunction = function(id) { | |
var _somePath, | |
_img, | |
conditionA = !! (window.someGlobalVar === 5), // if you need internal ternary conditions (path switching for example) | |
conditionB = !! (window.someGlobalVar === 10), | |
conditionC = !! (window.someGlobalVar === 15); | |
switch (id) { | |
case 'some-id-name-1': | |
// do something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('body').on('touchstart click', $staticSection, function(e) { | |
var $target = $(e.target); | |
if(!$target.closest($someSection).length) { | |
// do something... ex: $someSection.removeClass('open'); | |
} | |
}); | |
// conditional example | |
$('body').on('touchstart click', $staticSection, function(e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ImageMagick - Convert SVG to PNG w/ transparency | |
// | |
// - open terminal | |
// | |
// - confirm you have imagemagick installed | |
// --- type: convert -v | |
// | |
// - cd to folder | |
// | |
// - single file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Modernizr.load([{ | |
load: [ | |
'//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js' | |
], | |
complete: function() { | |
if (!window.jQuery) { | |
console.log('## CDN Failed - Loading local version of jQuery.'); | |
Modernizr.load('/js/jquery.min.js'); | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timer = setTimeout(function() { | |
// code stuffs | |
clearTimeout(timer); | |
}, 500); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## First Run: | |
----------------------- | |
/// Add Project Dependencies | |
Homebrew | |
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" | |
Success? |