Skip to content

Instantly share code, notes, and snippets.

View wmandrews's full-sized avatar

Wilson Andrews wmandrews

View GitHub Profile
@mbostock
mbostock / .block
Last active January 14, 2023 04:21
Screen Recording to GIF
license: gpl-3.0
@jashkenas
jashkenas / semantic-pedantic.md
Last active June 27, 2024 19:00
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@jeremyjbowers
jeremyjbowers / sweet_corn_cheesecake.md
Last active July 23, 2016 15:55
Sweet Corn Cheesecake

Sweet Corn Cheesecake

Crust

  • 4 ounces ritz crackers, crushed
  • 1/4 teaspoon coarse salt
  • 1/3 cup sugar
  • 4 tablespoons unsalted butter, melted

Custard

  • 1 pint of heavy cream
  • 3/4 cups of freeze-dried corn, powdered
@tmcw
tmcw / json.md
Created August 15, 2013 20:27
Why JSONP is a terrible idea and I will never use it again

Moral Concerns

JSONP is not actually JSON with padding, it's Javascript code that's executed. JSON is not a real subset of Javascript and the way it is not is important to us: via UTFGrid, we are all UTF-8 masters.

JSONP is not safe: it's Javascript that's executed. It's trivial to XSS with JSONP, because JSONP is XSS. Just have a call like mapbox.load('foo.tilejson', …) and if foo.tilejson gets replaced with destroyYoursite(), it gets run. Compare to JSON.parse, which is, on purpose, not eval.

Practical Concerns

JSONP is questionable in terms of performance. To be fast, you want to have the same callback all the time so that you can cache the response. But this leads to a page like

@bsudekum
bsudekum / index.html
Last active November 19, 2018 06:33
Neighborhood Map with Combined Raster and Vector Data
<!--Example for: http://mapbox.com//blog/vector-tile-sandwich/-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<html>
<head>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.css' rel='stylesheet' />
@yurivictor
yurivictor / emojis
Last active December 10, 2015 06:18
Skype emojis
(flag:ad)(flag:ae)(flag:af)(flag:ag)
(flag:ai)(flag:al)(flag:am)(flag:an)(flag:ao)
(flag:aq)(flag:ar)(flag:as)(flag:at)(flag:au)
(flag:aw)(flag:az)(flag:ba)(flag:bb)(flag:bd)
(flag:be)(flag:bf)(flag:bg)(flag:bh)(flag:bi)
(flag:bj)(flag:bm)(flag:bn)(flag:bo)(flag:br)
(flag:bs)(flag:bt)(flag:bv)(flag:bw)(flag:by)
(flag:bz)(flag:ca)(flag:cc)(flag:cd)(flag:cf)
(flag:cg)(flag:ch)(flag:ci)(flag:ck)(flag:cl)
(flag:cu)(flag:cv)(flag:cx)(flag:cy)(flag:cz)
@yurivictor
yurivictor / css-best-practices.md
Created August 20, 2012 22:09
CSS best practices for The Washington Post

CSS best practices

Do

  • Use Eric Meyer's CSS override
  • Use clearfloat instead of clear:both, when applicable
  • Use core html over divs whenever possible (h2, p, li, ol, time)
  • Add a top level ID to every kind of page (#race-page, #candidate-page)
  • Use IDs for elements that are unique to every page in the site
  • Use hyphens for IDs and classes, no camelCase or underscores. (Improves readability)
@jeremyjbowers
jeremyjbowers / awesome.js
Created October 31, 2011 14:29 — forked from drinks/awesome.js
Better AutoAwesome
var loveit = function(){var e,el,interval=Math.random()*60000;e = new jQuery.Event("click");e.pageX=1;e.pageY=1;el = jQuery('.record_pile:last').nextAll('a').eq(2);turntable.lastMotionTime=new Date().getTime();el.hover().trigger(e);setTimeout(loveit, interval);};loveit();
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@malsup
malsup / jsonp
Created March 20, 2009 02:58
$.getJSONP
// fn to handle jsonp with timeouts and errors
// hat tip to Ricardo Tomasi for the timeout logic
$.getJSONP = function(s) {
s.dataType = 'jsonp';
$.ajax(s);
// figure out what the callback fn is
var $script = $(document.getElementsByTagName('head')[0].firstChild);
var url = $script.attr('src') || '';
var cb = (url.match(/callback=(\w+)/)||[])[1];