Skip to content

Instantly share code, notes, and snippets.

View timrwood's full-sized avatar

Tim Wood timrwood

View GitHub Profile
@timrwood
timrwood / formatted diff.js
Created June 22, 2012 15:58
Formatted diff
function pad(input) {
if (input < 10) {
return '0' + input;
}
return input;
}
moment.duration.fn.formatCountdown = function() {
var output = [
pad(this.years()),
@timrwood
timrwood / dabblet.css
Created June 26, 2012 01:11
Scrolling shadows by @kizmarh and @LeaVerou
/**
* Scrolling shadows by @kizmarh and @leaverou
* Only works in browsers supporting background-attachment: local; & CSS gradients
* Degrades gracefully
*/
html {
background: white;
font: 120% sans-serif;
}
@timrwood
timrwood / dabblet.css
Created June 26, 2012 01:17
Scrolling shadows by @kizmarh and @LeaVerou
/**
* Scrolling shadows by @kizmarh and @leaverou
* Only works in browsers supporting background-attachment: local; & CSS gradients
* Degrades gracefully
*/
html {
background: white;
font: 120% sans-serif;
}
@timrwood
timrwood / dabblet.css
Created June 26, 2012 04:33
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
{
"bold_folder_labels": true,
"highlight_modified_tabs": true,
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"draw_white_space": "all",
"font_options":
[
"no_bold",
"no_round",
"subpixel_antialias"
@timrwood
timrwood / sync.js
Created October 15, 2012 16:20
Syncing local clock with server time
var clientNow = moment(),
serverNow;
$.ajax('/gettime', function (resp) {
serverNow = moment(resp);
});
function syncedMoment(i, f) {
return moment(i, f).subtract('milliseconds', clientNow - serverNow);
}
@timrwood
timrwood / problem-solved.txt
Created October 17, 2012 17:55
Folder Structure
/base
/header
_header.scss
/footer
_footer.scss
/modules
_my-module.scss
/mixins
_new-mixin.scss
/sections
@timrwood
timrwood / superstatic.js
Created October 24, 2012 21:59
Static Soup
(function(){
"use strict";
var a = {
super : "super",
static : "static"
}
var b = {
"super" : "super",
"static" : "static"
@timrwood
timrwood / bookmark.js
Created October 29, 2012 19:27
Omniture Tracking
javascript:void(window.open("","dp_debugger","width=600,height=600,location=0,menubar=0, status=1,toolbar=0,resizable=1,scrollbars=1").document.write("<script id=dbg src='http://www.digitalpulse.omniture.com/dp/debugger.js'></script>"));
@timrwood
timrwood / args.js
Created November 5, 2012 22:27
Changing args
function changeArgs (args) {
args[0] = 'hello';
args[1] = "is it me you're looking";
args[2] = 4;
}
function lionel(a, b, c) {
console.log(a, b, c);
changeArgs(arguments);
console.log(a, b, c);