Skip to content

Instantly share code, notes, and snippets.

View ginader's full-sized avatar

Dirk Ginader ginader

View GitHub Profile
@drublic
drublic / rem-fallback.less
Last active March 28, 2020 23:57
Fallback rem-mixin in Sass and LESS
@main-font-size: 16px;
.x-rem (@property, @value) {
// This is a workaround, inspired by https://github.com/borodean/less-properties
@px-fallback: @value * @main-font-size;
-: ~`(function () { return ';@{property}: @{px-fallback}'; }())`;
-: ~`(function () { return ';@{property}: @{value}rem'; }())`;
}
@cwerner1
cwerner1 / _retina-sprite.sass
Created November 14, 2012 10:30
Retina Sprite
@import "compass/utilities/sprites/base"
@import "compass/css3/inline-block"
@import "compass/css3/background-size"
@mixin retina-sprite($folder)
$sprites: sprite-map("#{$folder}/*.png")
// Generates a sprite containing every icon in the supplied folder.
$sprites-2x: sprite-map("#{$folder}@2x/*.png")
// Generates a second sprite containing every icon @2x resolution.
@benknight
benknight / gist:4047491
Created November 9, 2012 18:51
Alfred Shell Script Extension for opening an SSH tunnel via BrowserStack's Java command line tool to test multiple internal hosts.
#!/bin/bash
# BrowserStack SSH Tunnel Setup
# Find your key by logging into BrowserStack and finding your command line tunnel setup info
KEY=YOUR_KEY_HERE
# Add your internal hosts here
INTERNAL_HOSTS=( dev alpha beta whatever whocares )
for host in ${INTERNAL_HOSTS[@]} ; do
@snipe
snipe / headers-in-bed
Created November 1, 2012 03:23
HTTP Error codes as fortune cookies
100 Continue (in bed)
101 Switching Protocols (in bed)
102 Processing (in bed)
200 OK (in bed)
201 Created (in bed)
202 Accepted (in bed)
203 Non-Authoritative Information (in bed)
204 No Content (in bed)
205 Reset Content (in bed)
206 Partial Content (in bed)
@czottmann
czottmann / amazon.co.uk.js
Created October 31, 2012 13:15
dotjs script, amazon.co.uk: add Euro prices to all price tags
/*jshint asi: false, bitwise: false, boss: false, curly: true, debug: false,
eqeqeq: true, eqnull: false, evil: false, forin: false, immed: true,
laxbreak: true, newcap: true, noarg: true, noempty: false, nonew: false,
nomen: false, onevar: true, passfail: false, plusplus: false, regexp: false,
undef: true, sub: true, strict: false, white: false, browser: true,
devel: true */
/*globals define: false, window: false, jQuery: false */
var scripts = [],
@include handhelds {
table.responsive {
width: 100%;
thead {
display: none;
}
tr {
display: block;
}
td, th {
@evilmarty
evilmarty / README.md
Created October 25, 2012 07:39
Sass vendor helper mixins

If like me you find it frustrating to define the same vendor prefixes over and over again. Sure, you might create mixins that help reduce the amount of repetitiveness but when your mixins file becomes a library (or not) you see so many lines of near-identical code and wonder if there is an easier way.

Say you have this (all-too familiar) mixin:

@mixin border-radius($radius) {
  -webkit-border-radius: $radius;
  -moz-border-radius: $radius;
  -ms-border-radius: $radius;
 -o-border-radius: $radius;
@cbetta
cbetta / case.sh
Created October 17, 2012 17:02
How to change the case of a filename in Git
git mv readme.md readme.md.temp
git mv readme.md.temp README.md
@domenic
domenic / promises.md
Last active April 1, 2025 01:54
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
//
// Sass rotation mixin for IE6+
//
@mixin ms-rotate($degrees) {
@if (not unitless($degrees)) { $degrees: $degrees / 1deg }
$deg2rad: pi() * 2 / 360;
$radians: $degrees * $deg2rad;
$costheta: cos($radians);
$sintheta: sin($radians);