Skip to content

Instantly share code, notes, and snippets.

mymodule {
@at-root {
.#{&}-header { ... }
.#{&}-footer { ... }
.#{&}-body {
a { ... }
span { ... }
p { ... }
}
}
@jasoncartwright
jasoncartwright / gist:3608074
Created September 3, 2012 09:22
Retina image swap-out for Google-hosted images
if (window.devicePixelRatio > 1) {
img_re = new RegExp(/=(s|w)(\d*)(\-c)?$/)
$("img").each(function(id, el){
img_src = $(el).attr("src")
if (img_re.test(img_src)) {
img_size = parseInt(img_src.match(img_re)[2])
dimension = img_src.match(img_re)[1]
new_img_size = img_size*2
new_src = img_src.replace(img_re,"=" + dimension + new_img_size)
$(el).attr("src",new_src)
@necolas
necolas / .htaccess
Created April 9, 2012 22:19
Simple, quick way to concatenate, minify, and version static files in a Wordpress theme
# Filename-based cache busting
# taken from https://github.com/h5bp/html5-boilerplate/
# This rewrites file names of the form `name.123456.js` to `name.js`
# so that the browser doesn't use the cached version when you have
# updated (but not manually renamed) the file.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
@efedorenko
efedorenko / gist:2028193
Created March 13, 2012 11:22
Function for alpha blending
// Turns out this function already exists in Sass: mix(fg, bg, %) (http://d.pr/mGqa)
// Alpha blending
@function blend($bg, $fg) {
$r: red($fg) * alpha($fg) + red($bg) * (1 - alpha($fg));
$g: green($fg) * alpha($fg) + green($bg) * (1 - alpha($fg));
$b: blue($fg) * alpha($fg) + blue($bg) * (1 - alpha($fg));