Skip to content

Instantly share code, notes, and snippets.

View kayluhb's full-sized avatar

Caleb Brown kayluhb

View GitHub Profile
@kayluhb
kayluhb / README
Last active August 31, 2017 23:59 — forked from joelambert/README
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
function a() {}
function b(x, y) {}
a.length -> 0
b.length -> 2
@kayluhb
kayluhb / css
Created September 28, 2011 16:27
/* Overlay */
#overlay { background:#000; cursor:pointer; display:none; height:100%; left:0; position:fixed; top:0; width:100%; z-index:9999; }
#overlay-content { background:#182335; display:none; height:560px; left:50%; margin-left:-325px; overflow:scroll-y; padding:20px; position:fixed; top:200px; width:610px; z-index:9999; }
#overlay-content section { background:#fff; height:100%; position:relative; }
#overlay-content .close { color:#fff; font-size:11px; text-transform:uppercase; position:absolute; right:0; top:-18px; }
@kayluhb
kayluhb / eggnog.js
Created October 24, 2011 14:33
eggnog code
var eggYolks = 12,
lbsSugar = 1,
cupsRum = 2,
cupsBourbon = 2,
quartsWhippingCream = 2,
eggWhites = 12,
nutmeg = "sprinkle";
var eggNog = [eggYolks, lbsSugar, cupsRum,
cupsBourbon, quartsWhippingCream,
@kayluhb
kayluhb / gist:1368120
Created November 15, 2011 19:54
CSS3 Gradients Rule!
.button-gray { display:inline-block; font-size:13px; height:17px; line-height:17px; padding:0 5px; text-transform:uppercase;
background:#7d8085; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzdkODA4NSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMzNzM2M2EiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background:-moz-linear-gradient(top, #7d8085 0%, #37363a 100%); /* FF3.6+ */
background:-webkit-gradient(linear, left t
@kayluhb
kayluhb / gist:1405432
Created November 29, 2011 16:35
Throttle
// example: throttle(app.onScroll, 150)
function throttle(fn, delay) {
var timer = null;
return function() {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function() {
fn.apply(context, args);
}, delay);
@kayluhb
kayluhb / gist:1430645
Created December 4, 2011 16:47
c# egg nog
using Measurements;
var eggYolks = 12;
var lbsSugar = 1;
var cupsRum = 2;
var cupsBourbon = 2;
var quartsWhippingCream = 2;
var eggWhites = 12;
var nutmeg = Measurements.SPRINKLE;
@kayluhb
kayluhb / gist:1469415
Created December 12, 2011 22:22
the events calendar
<span class="nav-previous"><?php tribe_previous_event_link('<span class="meta-nav">&lsaquo;</span> Previous');?></span>
<span class="nav-next"><?php tribe_next_event_link('Next <span class="meta-nav">&rsaquo;</span>');?></span>
@kayluhb
kayluhb / gist:1479176
Created December 14, 2011 23:56
kettle
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="kettle" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="529" height="387" >
<g>
<defs>
<rect id="SVGID_1_" width="529" height="387"/>
</defs>
<clipPath id="SVGID_2_">
@kayluhb
kayluhb / gist:1479180
Created December 14, 2011 23:58
canvas
var canvas = document.getElementById('kettle'),
ctx = canvas[0].getContext('2d');
ctx.save();
ctx.beginPath();
ctx.moveTo(0.0, 0.0);
ctx.lineTo(155.6, 0.0);
ctx.bezierCurveTo(155.6, 0.0, 155.3, 62.1, 155.3, 80.7);
ctx.lineTo(155.3, 244.2);
ctx.bezierCurveTo(155.3, 294.2, 198.5, 319.9, 276.3, 319.9);