Skip to content

Instantly share code, notes, and snippets.

@ganglio
ganglio / gist:3129282
Created July 17, 2012 13:05 — forked from icodeforlove/gist:868532
querySelectorAll for anything less than IE8
// IE7 support for querySelectorAll in 274 bytes. Supports multiple / grouped selectors and the attribute selector with a "for" attribute. http://www.codecouch.com/
(function(d,s){d=document,s=d.createStyleSheet();d.querySelectorAll=function(r,c,i,j,a){a=d.all,c=[],r=r.replace(/\[for\b/gi,'[htmlFor').split(',');for(i=r.length;i--;){s.addRule(r[i],'k:v');for(j=a.length;j--;)a[j].currentStyle.k&&c.push(a[j]);s.removeRule(0)}return c}})()
@ganglio
ganglio / noise.svg
Created July 30, 2012 18:47 — forked from LeaVerou/dabblet.css
SVG: fractalNoise (Warning: Might be slow!)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ganglio
ganglio / gist:3437768
Created August 23, 2012 15:31
SCSS: Media Queries
// Using em for media queries 1em=16px
$break-small: 30em;
$break-large: 64em;
$debug: FALSE;
@mixin respond-to($media) {
@if $media == handhelds {
@media all and (max-width: $break-small) {
@if $debug == TRUE {
html, body {background-color: #ff0000;}
@ganglio
ganglio / gist:3499029
Created August 28, 2012 15:20
SCSS: CandyCane Mixin
@mixin cane($size) {
@include background-image(
linear-gradient(-45deg, rgba(255, 255, 255, .5) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .5) 50%, rgba(255, 255, 255, .5) 75%, transparent 75%, transparent),
linear-gradient(top,transparent 0,rgba(200,200,200,0.3) 25%,rgba(255,255,255,0.5) 50%,rgba(200,200,200,0.3) 75%,transparent 100%)
);
@include background-size($size $size);
}
@ganglio
ganglio / gist:3499039
Created August 28, 2012 15:21
SCSS: Background Stripes Mixin
@mixin stripes($color, $darken:3%,$pixelratio:1) {
@include background-image(linear-gradient(left,$color 0px,$color 2px * $pixelratio,darken($color,$darken) 2px * $pixelratio,darken($color,$darken) 7px * $pixelratio));
@include background-size(7px * $pixelratio 20px);
}
@ganglio
ganglio / gist:3504602
Created August 28, 2012 21:40
SCSS: Noise+LinearGradient Mixin
@mixin noise($color1,$color2:$color1) {
@include background-image(
url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KPGRlZnM+DQo8ZmlsdGVyIGlkPSJub2lzZSI+DQoJPGZlVHVyYnVsZW5jZSB0eXBlPSJmcmFjdGFsTm9pc2UiIGJhc2VGcmVxdWVuY3k9Ii43IiAvPg0KCTxmZUNvbXBvbmVudFRyYW5zZmVyPg0KCQk8ZmVGdW5jUiB0eXBlPSJsaW5lYXIiIHNsb3BlPSIyIiBpbnRlcmNlcHQ9Ii0uNSIvPg0KCQk8ZmVGdW5jRyB0eXBlPSJsaW5lYXIiIHNsb3BlPSIyIiBpbnRlcmNlcHQ9Ii0uNSIvPg0KCQk8ZmVGdW5jQiB0eXBlPSJsaW5lYXIiIHNsb3BlPSIyIiBpbnRlcmNlcHQ9Ii0uNSIvPg0KCTwvZmVDb21wb25lbnRUcmFuc2Zlcj4NCgk8ZmVDb2xvck1hdHJpeCB0eXBlPSJzYXR1cmF0ZSIgdmFsdWVzPSIwIi8+DQoJPGZlQ29tcG9uZW50VHJhbnNmZXI+DQoJCTxmZUZ1bmNBIHR5cGU9InRhYmxlIiB0YWJsZVZhbHVlcz0iMCAuMyIvPg0KCTwvZmVDb21wb25lbnRUcmFuc2Zlcj4NCjwvZmlsdGVyPg0KPC9kZWZzPg0KPHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsdGVyPSJ1cmwoI25vaXNlKSIgIC8+DQo8L3N2Zz4='),
linear-gradient(top,$color1,$color2)
);
}
@ganglio
ganglio / gist:3613852
Created September 3, 2012 21:50
iTunes Festival Apply Script
<?php
$email="robertotorella";
for ($i=3; $i<100; /*8192;*/ $i++) {
$bin=strrev(str_pad(decbin($i), 13,'0',STR_PAD_LEFT));
$apply_address=addDot($email,$bin);
$st=time();
echo "Applying $apply_address ($i)\n";
$res = apply($apply_address)?"Successfully":"Not successfully";
@ganglio
ganglio / gist:3635646
Created September 5, 2012 12:02 — forked from grammaticof/gist:3635239
JS - Mobile redirect
function mobile_redirect() {
var path = window.location.pathname;
if (path != null) {
window.location = 'http://host' + path
} else {
window.location = 'http://host/'
}
}
function setCookie(c_name, value, expiredays) {
var exdate = new Date();
@ganglio
ganglio / gist:3638373
Created September 5, 2012 15:25
SCSS: Tassels Mixin
@mixin tassels($color:#ffffff,$size:20px) {
position: relative;
&:before {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: $size;
background-size: $size $size*2;
@ganglio
ganglio / config.rb
Last active October 10, 2015 16:07
Compass: single folder configuration file
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "/"
fonts_dir = "/"
sass_dir = "/"
images_dir = "/"
javascripts_dir = "/"