Skip to content

Instantly share code, notes, and snippets.

.nav {
z-index: 2;
position: fixed;
top: 0;
right: 0;
transform: rotate(90deg) translate(100%,100%);
transform-origin: 100% 100%;
}
var i = 0;
for( i; i <= 100; i++) {
var buffer = '';
if ( i % 3 === 0) {
buffer = 'fizz';
if ( i % 5 === 0) {
buffer += ' buzz';

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@LarryAnomie
LarryAnomie / gist:7787353
Created December 4, 2013 13:23
print_r equivalent in js
//php print_r equalivalent
//http://scriptnode.com/article/javascript-print_r-or-var_dump-equivalent/
function print_r(x, max, sep, l) {
l = l || 0;
max = max || 10;
sep = sep || ' ';
if (l > max) {
return "[WARNING: Too much recursion]\n";
@LarryAnomie
LarryAnomie / gist:7021683
Last active December 25, 2015 18:39
conditionally load JQuery 2 for new browsers
<script>
// set a global version var for cache busting
var CITY_VERSION = "%globals_snippet_77381%.";
yepnope([
{
test: 'querySelector' in document && 'localStorage' in window && 'addEventListener' in window,
yep: {
"jQuery2" : '//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.min.js'
},
@LarryAnomie
LarryAnomie / gist:7004306
Created October 16, 2013 08:12
Fallback for browsers that don't understand placeholder attribute using Modernizr.input test
// fallback for browsers that don't understand placeholder attribute
if (!Modernizr.input.placeholder) {
$("[placeholder]").focus(function() {
var input = $(this);
if (input.val() === input.attr("placeholder")) {
input.val("");
input.removeClass("placeholder");
}
}).blur(function() {
@LarryAnomie
LarryAnomie / gist:6991223
Created October 15, 2013 12:59
Read a page's GET URL variables and return them as an associative array.
/**
* Read a page's GET URL variables and return them as an associative array.
*/
getUrlVars = function() {
var vars = [],
hash,
i = 0,
hashes = window.location.href.slice(window.location.href.indexOf("?") + 1).split("&");
@LarryAnomie
LarryAnomie / gist:6991202
Created October 15, 2013 12:58
simple fn to test if a number is even
/**
* returns true if a number is even
* @param {Number} value
* @return {Boolean}
*/
isEven = function(value) {
if (value % 2 === 0) {
return true;
} else {
@LarryAnomie
LarryAnomie / gist:6980669
Last active December 25, 2015 12:59
Delay the firing of the window resize event
waitForFinalEvent = (function () {
var timers = {};
return function (callback, ms, uniqueId) {
if (!uniqueId) {
uniqueId = "Don't call this twice without a uniqueId";
}
if (timers[uniqueId]) {
clearTimeout (timers[uniqueId]);
}
timers[uniqueId] = setTimeout(callback, ms);