Skip to content

Instantly share code, notes, and snippets.

View cassiano-gists's full-sized avatar

cassiano-gists

View GitHub Profile
@cassiano-gists
cassiano-gists / gist:4706235
Created February 4, 2013 11:31
CSS: SASS: @media for responsive design using REM units
/* http://techtime.getharvest.com/blog/in-defense-of-rem-units */
html
font-size: 16px
@media screen and (min-width: 1600px) // Large Monitors
font-size: 18px
@media screen and (min-width: 1400px) // Small Laptops
font-size: 14px
@media screen and (min-width: 1100px) // Tablet Landscape
@cassiano-gists
cassiano-gists / gist:4281176
Created December 13, 2012 23:43
CSS: Prevent long urls and text from breaking layouts
// Prevent long urls and text from breaking layouts
// [originally from perishablepress.com](http://perishablepress.com/press/2010/06/01/wrapping-content/)
@mixin force-wrap {
white-space: pre; // CSS 2.0
white-space: pre-wrap; // CSS 2.1
white-space: pre-line; // CSS 3.0
white-space: -pre-wrap; // Opera 4-6
white-space: -o-pre-wrap; // Opera 7
white-space: -moz-pre-wrap; // Mozilla
white-space: -hp-pre-wrap; // HP Printers
@cassiano-gists
cassiano-gists / gist:4141411
Created November 24, 2012 21:11
JS: jQuery PubSub
(function($){
var o = $( {} );
$.each({
on: 'subscribe',
trigger: 'publish',
off: 'unsubscripbe'
}, function( key, api ) {
$[api] = function() {
o[key].apply( o, arguments );
@cassiano-gists
cassiano-gists / gist:4141404
Created November 24, 2012 21:08
JS: PubSub Paul Irish
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind.
// Hat tip Paul Irish
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
// Usage
$(document.body).on( 'click', function() {