Skip to content

Instantly share code, notes, and snippets.

View jmwhittaker's full-sized avatar

James Whittaker jmwhittaker

View GitHub Profile
@jmwhittaker
jmwhittaker / markup
Created July 18, 2012 12:09
Vertical CSS3 centering with inline-block
<div class="block">
<div class="centered">Hello world</div>
</div>
@jmwhittaker
jmwhittaker / Globalgram_Arduino_Code.ino
Created August 25, 2012 15:09 — forked from andrewhaskin/Globalgram_Arduino_Code.ino
Arduino Code for a Rotary Switch and a Button used for Globalgram
// RotarySwitch.pde -- test out a rotary switch (not a rotary encoder)
// Tod E. Kurt, http://todbot.com/blog/
////4-position rotary switch
const int firstRotaryPin = 3;
const int lastRotaryPin = 7;
int button = 9; ////button input
int input1 = LOW;
@jmwhittaker
jmwhittaker / dabblet.css
Created September 6, 2012 09:44
The Media Object
/**
* The Media Object
*/
.media {margin:10px;}
.media, .bd {overflow:hidden; _overflow:visible; zoom:1;}
.media .img {float:left; margin-right: 10px;}
.media .img img{display:block;}
/* for element positioned on the right */
.media .imgExt{float:right; margin-left: 10px;}
@jmwhittaker
jmwhittaker / app.js
Created November 26, 2012 12:47
Something every Angular.js app should have
//mimic if statement for angular
//Schema: if(expression, 'foo', 'bar')
$scope['if'] = function(condition, a, b) {
return condition ? a : b;
};
//mimic switch case for angular
//Schema: switch(colorid, [[1,'red'], [2,'green'], [3, 'blue']], 'black')
$scope['switch'] = function (expression, cases, thedefault) {
for(var i = 0; i < cases.length; i++) {
@jmwhittaker
jmwhittaker / app.js
Last active November 26, 2021 16:15
Standard compliant stylesheet switcher for HTML5. Works on iOS5 and all modern browsers.
$(document).ready(function()
{
/* Check to see if we have saved a style already, a bit verbose but you get the drift! */
var theme = localStorage.getItem('style');
if (!theme) {
localStorage.setItem('style', 'light');
};
updateTheme();
// We all know how to use mixins, right?
@mixin kung {
background: green;
color: yellow;
}
@mixin foo {
background: orange;
color: red;
#!/bin/bash
#
# This script backups an OS X system to an external volume, effectively
# cloning it. It is based on [0], [1] and [2] for OS X and [3] and [4] for
# Linux. One could also use commercial tools like SuperDuper! or Carbon Copy
# Cloner. The latter website has an interesting list[5] on what files to
# exclude when cloning.
#
# Exclusions (from CCC[5]), see rsync_excludes_osx.txt
#
@jmwhittaker
jmwhittaker / dabblet.css
Last active December 18, 2015 07:48
The Media Object
/**
* The Media Object
*/
.media {margin:10px;}
.media, .bd {overflow:hidden; _overflow:visible; zoom:1;}
.media .img {float:left; margin-right: 10px;}
.media .img img{display:block;}
/* for element positioned on the right */
.media .imgExt{float:right; margin-left: 10px;}
.with-border {
border:1px solid #333;
}
.media-small {
width:145px;
height:97px;
background-position:50% 50%;
background-repeat:no-repeat;
display:block;
.with-border {
border:1px solid #333;
}
.media-small {
width:145px;
height:97px;
background-position:50% 50%;
background-repeat:no-repeat;
display:block;