Skip to content

Instantly share code, notes, and snippets.

View jashkenas's full-sized avatar

Jeremy Ashkenas jashkenas

View GitHub Profile
<object
type="application/x-java-applet"
code="org.jruby.JRubyApplet"
codebase="."
style="margin: 0; padding: 0;"
width="600" height="500">
<param name="archive" value="gravity.rb,ruby-processing/app.rb,ruby-processing/exporters/applet_exporter.rb,ruby-processing/exporters/application_exporter.rb,ruby-processing/exporters/base_exporter.rb,ruby-processing/exporters/creator.rb,ruby-processing/helpers/numeric.rb,ruby-processing/helpers/string.rb,ruby-processing/runner.rb,ruby-processing/runners/base.rb,ruby-processing/runners/live.rb,ruby-processing/runners/run.rb,ruby-processing/runners/watch.rb,ruby-processing.rb,core/core.jar,core/jruby-complete.jar" />
<param name="jruby.eval" value="ARGV[0] = 'gravity.rb'; require 'ruby-processing/runners/run.rb'" />
<param name="image" value="images/ruby.jpg" />
(function() {
var cache = {};
this.tmpl = function tmpl(str, data) {
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
cache[str] = cache[str] ||
tmpl(document.getElementById(str).innerHTML) :
// Here is a proposal for minimalist JavaScript classes, humbly offered.
// There are (at least) two different directions in which classes can be steered.
// If we go for a wholly new semantics and implementation, then fancier classical
// inheritance can be supported with parallel prototype chains for true inheritance
// of properties at both the class and instance level.
// If however, we keep current JavaScript prototype semantics, and add a form that
// can desugar to ES3, things must necessarily stay simpler. This is the direction
// I'm assuming here.
var request = require('request');
var _ = require('underscore');
var url = "http://forecast.weather.gov/product.php?site=NWS&issuedby=OKX&product=PNS&format=txt&version=1&glossary=0";
var header = "********************STORM TOTAL SNOWFALL********************";
var footer = "**********************24 HOUR SNOWFALL**********************";
request(url, function(err, resp, body) {
if (err) throw err;
var removeOldReports = true;
var removeSocialMedia = true;
var request = require('request');
var _ = require('underscore');
var xml2js = require('xml2js').parseString;
var fs = require('fs');
var moment = require('moment');
function ScrapeKML(cb) {
@jashkenas
jashkenas / index.html
Last active February 24, 2024 14:56
Ned's Synaesthesia
<link href='http://fonts.googleapis.com/css?family=Chewy' rel='stylesheet' type='text/css'>
<style>
body {
background: #c6c6c6;
}
.synesthesia {
max-width: 720px;
margin: 40px auto 0;
}
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
@jashkenas
jashkenas / fixiekill
Last active February 24, 2024 14:54
Fixie Kill: A Bookmarklet
javascript:for(var a=document.querySelectorAll("*"),i=0,e;e=a[i];i++)"fixed"==getComputedStyle(e).position&&(e.style.position="static")
@jashkenas
jashkenas / blackmarble.jpg
Last active February 24, 2024 14:54
Night Sky Image
blackmarble.jpg
@jashkenas
jashkenas / semantic-pedantic.md
Last active November 29, 2023 14:49
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