Skip to content

Instantly share code, notes, and snippets.

View maxbeatty's full-sized avatar

Max Beatty maxbeatty

View GitHub Profile
@maxbeatty
maxbeatty / Gemfile
Created July 9, 2013 21:52 — forked from sr/Gemfile
source "http://rubygems.org"
gem "janky", "~>0.9"
gem "pg"
gem "thin"
@maxbeatty
maxbeatty / gist:5778738
Created June 14, 2013 01:16
dumb promises
$.get "/path", (data) =>
if data.length > 0
items = []
done = 0
for d in data
done++
require ["#{d.file}.html"], (tpl) ->
@maxbeatty
maxbeatty / site-links.css
Created October 14, 2012 21:54
Site Links from Lea Verou
@maxbeatty
maxbeatty / markup.html
Created August 3, 2012 17:38 — forked from kylebragger/markup.html
Using pseudo content instead of empty span for gradient
<div id=conference-call>
<div class="datetime">
<span>Sept</span>
<span>25</span>
<span>11:30 <strong>AM</strong></span>
</div>
</div>
@maxbeatty
maxbeatty / fiddle.html
Created July 27, 2012 18:16
Sample Mustache templates
<div id="mustacheContainer"></div>​
@maxbeatty
maxbeatty / is_us_aws.php
Created June 7, 2012 21:58
Is this URL from a US based AWS?
function in_ip_range($lower, $upper, $target) {
// is the target IP in the given lower and upper bounds of a range?
// if lower = 4.4.4.4 and upper is 8.8.8.8 and target is 6.6.6.6 => yes
return (ip2long($lower) <= ip2long($target) && ip2long($upper) >= ip2long($target));
}
function is_us_based_aws($url) {
$h = parse_url($url, PHP_URL_HOST);
$ip = gethostbyname($h);
$ranges = array(
@maxbeatty
maxbeatty / ex.css
Created May 31, 2012 21:09
line comment escaping for glob import
/* line 186, sprites/icons/**/*.png */
// original
@import "mgmt/sprites/icons/*.png";
$icons: sprite-map("mgmt/sprites/icons/*.png");
.test {
background: transparent $icons no-repeat 0 0;
}
// my test
$cc: sprite-map("sprites/icons/credit-cards/*.png")
// original
@import "mgmt/sprites/icons/*.png";
$icons: sprite-map("mgmt/sprites/icons/*.png");
.test {
background: transparent $icons no-repeat 0 0;
}
// my test
@maxbeatty
maxbeatty / gist:2002553
Created March 8, 2012 18:33
Focus first input, respect browser back with keyboard
$('input:visible:first').focus().keydown(function(e) {
if (e.keyCode === 8 && !this.value) {
history.back();
}
});