Skip to content

Instantly share code, notes, and snippets.

View argyleink's full-sized avatar
💀
calc(dev*design)

Adam Argyle argyleink

💀
calc(dev*design)
View GitHub Profile
@argyleink
argyleink / vendorPrefix.js
Created April 22, 2013 21:35
Require.js ready vendor prefix extractor
vendor.prefix = (function () {
'use strict';
var styles = window.getComputedStyle(document.documentElement, '')
, pre = (Array.prototype.slice
.call(styles)
.join('')
.match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o'])
)[1]
, dom = ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1];
@argyleink
argyleink / rAF.polyfill.js
Created April 22, 2013 21:34
Require ready Request Animation Frame shim
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame =
window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
@argyleink
argyleink / jsModule
Last active December 16, 2015 10:58
Favorite JavaScript Module Pattern
app.module = (function(){
'use strict';
function publicFunction() {
}
function privateFunction() {
}
function inferInputModel() {
if (window.navigator.msPointerEnabled) {
return 'pointer';
} else if (window.ontouchstart !== undefined) {
return 'touch';
} else {
return 'unknown';
}
}
@argyleink
argyleink / hole.js
Created March 4, 2013 21:30
My js robot
var Robot = function(robot) {};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(20);
robot.rotateCannon(10);
};
Robot.prototype.onWallCollision = function(ev) {
@argyleink
argyleink / dabblet.css
Created February 25, 2013 23:45
Flexbox sandbox for destroying
/**
* Flexbox sandbox for destroying
*/
.flexbox {
display:flex;
}
.flex1 {
flex:1;
}
@argyleink
argyleink / dabblet.css
Created February 25, 2013 19:23
Infinite Animation Example
/**
* Infinite Animation Example
*/
div {
width:100px; height:100px;
background-color:red;
position:absolute;
animation: in_and_out 1s ease-in-out infinite;
@argyleink
argyleink / dabblet.css
Created February 20, 2013 03:11
Layouts - 3 flexbox
/**
* Layouts - 3 flexbox
*/
body {
color:white;
margin:0;
}
.flex {
display:flex;
@argyleink
argyleink / dabblet.css
Created February 20, 2013 03:10
Layouts - 3 flexbox
/**
* Layouts - 3 flexbox
*/
body {
color:white;
margin:0;
}
.flex {
display:flex;
@argyleink
argyleink / dabblet.css
Created February 20, 2013 03:09
Layouts - 3 flexbox
/**
* Layouts - 3 flexbox
*/
body {
color:white;
margin:0;
}
.flex {
display:flex;