Skip to content

Instantly share code, notes, and snippets.

@darren131
darren131 / sprite.less
Created April 18, 2012 01:37
Sprite LESS Snippet. Someone else has probably done this already, but I thought I'd share it nevertheless.
@spritePath: '../images/sprite.png';
.sprite(@url: @spritePath, @xpos: 0, @ypos: 0) {
background-image: url(@url);
background-repeat: none;
background-position: @xpos @ypos;
}
@darren131
darren131 / arrows.less
Created May 30, 2012 00:25
CSS only arrows in LESS
// HOW TO USE
//
// @direction: up;
// .class {
// .arrow(@direction, #c00, 20px);
// }
//
.arrow(up, @color, @size) {
width: 0;
@darren131
darren131 / gist:2926558
Created June 13, 2012 21:18 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@darren131
darren131 / gist:2926833
Created June 13, 2012 22:20
CSS: Image Replacement
.ir {
font: 0/0 a;
text-shadow: none;
color: transparent;
}
@darren131
darren131 / gist:2962766
Created June 20, 2012 22:57
JavaScript: Closure
(function( $ ){
// set up global variables
var ObjectName;
// Navigation object
ObjectName = {
method: function() {
},
@darren131
darren131 / gist:3030083
Created July 1, 2012 23:51
The power of the ampersand
.product {
h1 {
color: #c00;
}
.image {
float: left;
}
<link rel="stylesheet/less" href="/path/to/style.less">
<script src="/path/to/less.js"></script>
var gistPrefix = 'http://gist.github.com/',
// Cache document.write so that it can be restored once all Gists have been
// embedded.
cachedWrite = document.write,
body = jQuery('body'),
// Map each p.gist to an object that contains the paragraph to be replaced
// and the Gist's identifier.
gists = jQuery('p.gist').map(function(n, p) {
p = jQuery(p);
gem install sass
mv style.css style.scss
sass --watch style.scss:style.css
@darren131
darren131 / gist:3051385
Created July 5, 2012 04:33
style.scss
// variables and mixins
@import "variables";
@import "mixins";
// Reset
@import "reset";
// Page structure, etc
@import "scaffolding";
@import "grid";