Skip to content

Instantly share code, notes, and snippets.

View thisiskylierose's full-sized avatar

Kylie Rose thisiskylierose

  • Berlin
  • 14:04 (UTC +02:00)
View GitHub Profile
@thisiskylierose
thisiskylierose / requestAnimationFrame.js
Created February 23, 2018 23:41 — forked from jacob-beltran/requestAnimationFrame.js
React Performance: requestAnimationFrame Example
// How to ensure that our animation loop ends on component unount
componentDidMount() {
this.startLoop();
}
componentWillUnmount() {
this.stopLoop();
}
cd ..
start cmd.exe @cmd /k "grunt serve"
start cmd.exe @cmd /k
// 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),
@thisiskylierose
thisiskylierose / gist:16756b9021bad5e484df
Last active January 15, 2019 23:42
jquery.smartresize.js
(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,
// 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':
@thisiskylierose
thisiskylierose / gist:331c154f89e7ae0ca56e
Last active August 29, 2015 13:59
Wordpress functions to run image replace for timthumb
/*-----------------------------------------------------------------------------------*/
/* 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 {
@thisiskylierose
thisiskylierose / 0_reuse_code.js
Created February 4, 2014 15:56
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// 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});