Skip to content

Instantly share code, notes, and snippets.

View alykat's full-sized avatar

Alyson Hurt alykat

View GitHub Profile
@newsroomdev
newsroomdev / iowa-2020-pagespeeds.md
Last active March 4, 2020 02:52
Iowa 2020 Caucus Results Pagespeed Comparison

Iowa 2020 Caucus Results Pagespeed Comparison

It’s election season again y’all! That means a ton of engineers at news orgs are spending sleepless nights building different reader experiences with various tech stacks. In years past I’ve informally compared all the different approaches because I find it educational. One big reason, the faster your page is, the easier it is for folks to enjoy it regardless of their internet connection speeds.

Methodology

Links were gathered via Twitter, primarily using a thread by Tiff Fehr. Basic criteria are the page has to feature updating vote and/or delegate counts. Scores were tallied after running PageSpeed Insights at least three times to establish an average. Additionally, AMP pages were used over non-AMP page versions with the main assumption being that readers are coming to the page on mobile either via social media or after searching for election results. I was also really curious to see how AMP performed when it came to interacti

@thomaswilburn
thomaswilburn / index.js
Created October 25, 2019 20:30
source-un-map
var http = require("http");
var https = require("https");
var { SourceMapConsumer } = require("source-map");
var fs = require("fs").promises;
var path = require("path");
var fetch = function(address) {
return new Promise(function(ok, fail) {
var parsed = new URL(address);
var remote = parsed.protocol == "http:" ? http : https;

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
# Sometimes yosemite crashes with a gunicorn server up
# and when it comes back up there is a python process blocking port 8000
# kill that process with this function
# http://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac
function killport() {
lsof -i TCP:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9
}
@onyxfish
onyxfish / README.md
Last active January 2, 2023 14:37
Google Spreadsheets script to generate slugs from a range of cells

This script for Google Spreadsheets allows you to generate slugs for your data such as might be used for creating unique urls.

Use it like this!

# A B C
1 a b slug
2 foo baz bing =slugify(A2:B4)
3 bar BAZ
4 FOO baz-bing
@ashaw
ashaw / sankey.js
Last active August 29, 2015 13:56
var Sankey = function(opts) {
this.opts = opts;
this.el = $("#" + this.opts.el);
this.graphsReady = 0;
this.graphWidth = this.el.width();
};
Sankey.prototype.initPaper = function() {
this.paper = Raphael(document.getElementById(this.opts.el));
};
@mbostock
mbostock / README.md
Last active June 7, 2023 18:33
Underscore’s Equivalents in D3

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
@cjdd3b
cjdd3b / gist:1714081
Created February 1, 2012 00:05
Super PAC IDs from OpenSecrets
name|id
1911 United|C00508200
50 State Strategy|C00502633
9-9-9 FUND|C00504241
Accountability 2010|C00489641
AFL-CIO Workers' Voices PAC|C00484287
Alaskans Standing Together|C00489385
America for the People|C00497081
America Get Up|C00494278
America Votes Action Fund|C00492520
@ussjoin
ussjoin / gist:709152
Created November 21, 2010 21:00
Ham Radio Visualization
import processing.opengl.*;
HashMap<String, String> date = new HashMap<String, String>();
HashMap<String, String> license = new HashMap<String, String>();
HashMap<String, Integer> zip = new HashMap<String, Integer>();
float[][] ziplookup = new float[100000][2];
int[] zipbucket = new int[100000];
void setup()
{