Skip to content

Instantly share code, notes, and snippets.

View maxbeatty's full-sized avatar

Max Beatty maxbeatty

View GitHub Profile
@maxbeatty
maxbeatty / select_country_by_continent.html
Created September 30, 2011 23:21
HTML Select Country by Continent
<label for="addressCountry">Country</label>
<select name="addressCountry">
<option></option>
<optgroup label="North America">
<option value="US">United States</option>
<option value="UM">United States Minor Outlying Islands</option>
<option value="CA">Canada</option>
<option value="MX">Mexico</option>
<option value="AI">Anguilla</option>
<option value="AG">Antigua and Barbuda</option>
@maxbeatty
maxbeatty / gist:2002383
Created March 8, 2012 18:02
Poor Markup
<div class="full960 padding20 overflowHidden left">
<h2 class="white text38 textAlignCenter">Ready. Set. Protect.</h2>
<div class="clear padding10"></div>
<div class="col640 left gray_ContentBox">
<div class="box_top">
<div class="clear"></div>
<div class="box_cap"></div>
</div>
<div class="box_body">
@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();
}
});
// original
@import "mgmt/sprites/icons/*.png";
$icons: sprite-map("mgmt/sprites/icons/*.png");
.test {
background: transparent $icons no-repeat 0 0;
}
// my test
// 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")
@maxbeatty
maxbeatty / ex.css
Created May 31, 2012 21:09
line comment escaping for glob import
/* line 186, sprites/icons/**/*.png */
@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 / fiddle.html
Created July 27, 2012 18:16
Sample Mustache templates
<div id="mustacheContainer"></div>​
@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 / site-links.css
Created October 14, 2012 21:54
Site Links from Lea Verou