Skip to content

Instantly share code, notes, and snippets.

View usefulthink's full-sized avatar

Martin Schuhfuss usefulthink

  • Hamburg / Germany
  • 08:33 (UTC +02:00)
View GitHub Profile
@usefulthink
usefulthink / generated.css
Created June 13, 2012 12:16
generates style-rules for a percentual 940px grid
.row { margin-left: -2.12766%; }
/* [1] – px: 60 pct: 6.38298% */
.span1 { width: 6.38298%; margin-left: 2.12766%; }
/* [2] – px: 140 pct: 14.89362% */
.span2 { width: 14.89362%; margin-left: 2.12766%; }
.span2 .span1 { width: 42.85714%; margin-left: 14.28571%; } /* 60px */
/* [3] – px: 220 pct: 23.40426% */
@usefulthink
usefulthink / gist:2944695
Created June 17, 2012 14:29
vendor-prefix detection via immediate function
// inspired by Lea Verou's vendor-prefix detection: http://goo.gl/vl9mh
var VENDOR_PREFIX=(function () {
var r = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,
s = document.getElementsByTagName('script')[0].style;
for(var p in s) { if(r.test(p)) { return p.match(r)[0]; } }
if('WebkitOpacity' in s) return 'Webkit';
if('KhtmlOpacity' in s) return 'Khtml';
@usefulthink
usefulthink / gist:3035048
Created July 2, 2012 19:12
lazy-loading for arbitrary images (based on jQuery 1.7)
(function($, window) {
var $win = $(window),
$doc = $(document),
winHeight = $(window).height(),
preloadGroups = {},
preloadGroupHeight = 200;
$win.on({
load: function() {
export PATH=/Users/martins/bin:/opt/local/libexec/gnubin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:$PATH
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
export PATH=/Users/martins/bin:/opt/local/libexec/gnubin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:$PATH
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.takeoff();
client.config('general:navdata_demo', 'TRUE');
client.on('navdata', console.log);
client
.after(8000, function() {
this.clockwise(0.5);
@usefulthink
usefulthink / dabblet.css
Created October 27, 2012 14:54
content-box shadows part I
/**
* content-box shadows part I
*/
body {
background-color: #666; }
.container {
width: 80%; height: 800px;
border-radius: 50px;
overflow: hidden;
@usefulthink
usefulthink / dabblet.css
Created October 27, 2012 15:15
content-box shadows part I
/**
* content-box shadows part I
*/
body {
background-color: #666; }
.container {
width: 80%; height: 800px;
border-radius: 50px;
overflow: hidden;
@usefulthink
usefulthink / dabblet.css
Created October 27, 2012 15:16
content-box shadows part II
/**
* content-box shadows part II
*/
body {
background-color: #666; }
.container {
width: 80%; height: 800px;
border-radius: 20px;
box-shadow: 0 0 20px 0 black;
@usefulthink
usefulthink / dabblet.css
Created October 27, 2012 21:50
content-box shadows part II
/**
* content-box shadows part II
*/
body {
background-color: #666; }
.container {
width: 80%; height: 800px;
border-radius: 20px;
box-shadow: 0 0 20px 0 black;