This file contains 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
// How to ensure that our animation loop ends on component unount | |
componentDidMount() { | |
this.startLoop(); | |
} | |
componentWillUnmount() { | |
this.stopLoop(); | |
} |
This file contains 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
cd .. | |
start cmd.exe @cmd /k "grunt serve" | |
start cmd.exe @cmd /k |
This file contains 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
// i know, i know, browser sniffing :( | |
// adaptation of http://stackoverflow.com/questions/8348139/detect-ios-version-less-than-5-with-javascript | |
Modernizr.addTest('ios6', function() { | |
var ios6 = false, | |
v, ver = false; | |
if (/iP(hone|od|ad)/.test(navigator.platform)) { | |
v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/), | |
ver = parseInt(v[1], 10), |
This file contains 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
(function($, functionName) { | |
'use strict'; | |
// debouncing function from John Hann | |
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ | |
var debounce = function(cb, threshold, execAsap) { | |
var timeout; | |
return function debounced() { | |
var obj = this, |
This file contains 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
// Register multi-tasks | |
grunt.registerMultiTask( 'conditional', 'Conditional tasks', function() { | |
switch ( this.target ) { | |
case 'case1': | |
grunt.task.run( this.data.tasks ); | |
break; | |
case 'case2': | |
grunt.task.run( this.data.tasks ); | |
break; | |
case 'case3': |
This file contains 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
/*-----------------------------------------------------------------------------------*/ | |
/* Replace image src values | |
/*-----------------------------------------------------------------------------------*/ | |
if (!function_exists('ic_replace_image_src')) { | |
function ic_replace_image_src($img = null) { | |
$live = 'mysite.com.au '; | |
if ($_SERVER['HTTP_HOST'] == $live) { | |
return; | |
} else { |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
// set thing | |
TweenMax.set('#SC1T4W', {clip: 'rect(0px, 0px, 40px, 0px)', alpha: 0}); | |
//animate thing | |
TweenMax.to('#SC1T4W', 0.3, {clip: 'rect(0px, 774px, 40px, 0px)', delay: 0.1}); // expands to the right | |
TweenMax.to('#SC1T4W', 0.3, {clip: 'rect(0px 774px 40px 774px)', delay: 0.4}); // contracts to left | |
// reset thing | |
TweenMax.set('#SC1T4W', {clip: 'rect(0px, 0px, 40px, 0px)', alpha: 0}); |