Skip to content

Instantly share code, notes, and snippets.

View stevoland's full-sized avatar

Stephen J. Collings stevoland

View GitHub Profile
@madrobby
madrobby / gist:4161897
Created November 28, 2012 15:16
Retina screen media query
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 144dpi),
(min-resolution: 1.5dppx) {
/* Retina rules! */
}
@madrobby
madrobby / gist:3733875
Created September 16, 2012 19:09
Fade out elements on WebKit and Firefox
<style>
.fade-right {
-webkit-mask-image: -webkit-gradient(linear, left top, right top, from(rgba(0,0,0,1)), color-stop(0.75, rgba(0,0,0,1)), to(rgba(0,0,0,0)));
mask: url(#fade_right_svg_mask);
}
#mask_demo {
background: #d0d0d0;
height: 100px;
width: 500px;
padding: 10px;
@cowboy
cowboy / filterify.js
Created July 2, 2012 20:41
JavaScript: practical partial application, like creating a function that can be passed to Array#filter or the like.
/*
* Function#filterify
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Licensed under the MIT license.
* http://benalman.com/about/license/
*/
Function.prototype.filterify = (function() {
// IIFE gives us a place for storing local vars...
@adamloving
adamloving / watcher.js
Created October 13, 2011 20:43
Node.js CoffeeScript, Jade, and Stylus compiler (watches filesystem for changes)
var OUTPUT_JS_FILENAME = '../media/partner/js/widgets.js'
var OUTPUT_CSS_FILENAME = '../media/partner/css/widgets.css'
var OUTPUT_HTML_PATH = 'templates'
var fs = require('fs')
var jade = require('jade')
var stylus = require('stylus');
var cs = require('coffee-script');
var watch = require('watch');
// Add orientation body class.
window.addEventListener("DOMContentLoaded", function(){
var cls = ["landscape", "portrait"];
var clsRe = new RegExp("(" + cls.join("|") + ")");
var event = "onorientationchange" in window ? "orientationchange" : "resize";
document.body.className += " " + getClass();
window.addEventListener(event, function(){
var className = document.body.className;
document.body.className = className ? className.replace(clsRe, getClass()) : getClass();