Skip to content

Instantly share code, notes, and snippets.

@floz
floz / _mobile_mixins.styl
Created April 29, 2014 15:26
Mobiles mixins for stylus
baseImg = "../img/"
img( url )
background transparent url( baseImg + url ) no-repeat
imgImportant( url )
background transparent url( baseImg + url ) !important
imgRepeat( url )
background transparent url( baseImg + url )
@floz
floz / Grid.js
Created October 17, 2013 22:58
JS - Grid.js
Grid = ( function Grid() {
var _itemSize = 156,
_$content = null, _w = 0, _h = 0, _spacing,
_cellWidthPercent = 0.0, _totalWidth = 0, _cellWidth = 0, _spacingPercent = 0.5;
function Grid( $content, w, h, spacing ) {
_$content = $content;
_w = w;
_h = h;
@floz
floz / gist:6390251
Created August 30, 2013 14:09
Facebook - Share button with custom data
<a href="#" onclick="
window.open(
'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent('http://urlofthepage.com/share/'),
'facebook-share-dialog',
'width=626,height=436');
return false;" target="_blank"> Share </a>
<html>
<head>
<title></title>
@floz
floz / get-sprite.scss
Last active December 21, 2015 22:59
SASS - Mixin spritesheet
// http://compass-style.org/reference/compass/helpers/sprites/
@mixin get-sprite($map, $sprite, $repeat: no-repeat, $height: true, $width: true){
//http://compass-style.org/reference/compass/helpers/sprites/#sprite-file
$sprite-image: sprite-file($map, $sprite);
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-url
$sprite-map: sprite-url($map);
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-position
@floz
floz / RequestAnimationFrame.coffee
Created August 8, 2013 11:07
CoffeeScript - RequestAnimationFrame
do ->
w = window
for vendor in ['ms', 'moz', 'webkit', 'o']
break if w.requestAnimationFrame
w.requestAnimationFrame = w["#{vendor}RequestAnimationFrame"]
w.cancelAnimationFrame = (w["#{vendor}CancelAnimationFrame"] or
w["#{vendor}CancelRequestAnimationFrame"])
# deal with the case where rAF is built in but cAF is not.
if w.requestAnimationFrame
@floz
floz / requestAnimationFrame.js
Last active December 20, 2015 19:29
JS - requestAnimationFrame
(function() {
var lastTime = 0;
var vendors = ['webkit', 'moz'];
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)