Skip to content

Instantly share code, notes, and snippets.

View rsp's full-sized avatar

Rafał Pocztarski rsp

View GitHub Profile

Gzipped benchmarks for HTML Minifier

Note: this is a temporary solution for anyone who would like to see statistics of minification+gzipping vs. just gzipping the HTML before the gzipped stats are properly integrated into the main benchmark.

How to run the benchmarks from https://github.com/rsp/html-minifier/tree/gzip-benchmark

Clone the repo:

git clone https://github.com/rsp/html-minifier.git
@rsp
rsp / sha-filesystem.md
Last active August 29, 2015 14:11
SHA filesystem idea

I want a filesystem that doesn't use c/m/atime. It would use SHA-1 (or other) hash to identify data.

Possible ways to do it:

  • hash the entire file (probably not practical unless it could use partial/incremental computations)
  • hash every block and then hash the list of hashes
  • ...

Programs like Make instead of relying on the mtime would have to keep track of which hashes the sources had for any given target and if the hashes on disk are different then rebuild but at that point no hashes would need to be computed because they would be stored in the file system.

@rsp
rsp / save-for-posterity.md
Last active August 29, 2015 14:17
Save for Posterity Bookmarklet
@rsp
rsp / package.json
Last active January 21, 2016 11:12 — forked from coryhouse/package.json
Example of pre and post scripts in package.json
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"help-list": "echo It lists all json files",
"list": "ls *.json",
"help-time": "echo It prints current time in UTC",
"time": "date -uIs",
"help-numbers": "echo It prints numbers from 1 to 10",
@rsp
rsp / package.json
Created January 21, 2016 10:57
A proposed convention for npm scripts descriptions
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"list?": "echo It lists all json files",
"list": "ls *.json",
"time?": "echo It prints current time in UTC",
"time": "date -uIs",
"numbers?": "echo It prints numbers from 1 to 10",
@rsp
rsp / Reducing-JavaScript-to-Absurdity.md
Last active March 15, 2016 15:12
Reducing JavaScript to Absurdity

Reductio ad absurdum

@rsp
rsp / git-change-url
Created March 16, 2016 17:18 — forked from sankalp-khare/git-change-url
Changes the git url type from https to ssh or vice versa
#!/usr/bin/env bash
# Utility to change the connection method for a git repo.
# === Colour Definitions ===
red='\e[0;31m'
green='\e[0;32m'
purple='\e[0;35m'
orange='\e[0;33m'
# No Color, i.e. turn off color
@rsp
rsp / statuses.md
Created April 21, 2017 08:51 — forked from vkostyukov/statuses.md
HTTP status codes used by world-famous APIs
API Status Codes
[Twitter][tw] 200, 304, 400, 401, 403, 404, 406, 410, 420, 422, 429, 500, 502, 503, 504
[Stripe][stripe] 200, 400, 401, 402, 404, 429, 500, 502, 503, 504
[Github][gh] 200, 400, 422, 301, 302, 304, 307, 401, 403
[Pagerduty][pd] 200, 201, 204, 400, 401, 403, 404, 408, 500
[NewRelic Plugins][nr] 200, 400, 403, 404, 405, 413, 500, 502, 503, 503
[Etsy][etsy] 200, 201, 400, 403, 404, 500, 503
[Dropbox][db] 200, 400, 401, 403, 404, 405, 429, 503, 507
@rsp
rsp / languagewars-churchnumerals-es6.js
Created November 6, 2017 04:28
Language Wars - Church numerals - ES6 JavaScript
const suc = a => b => c => b(a(b)(c));
const add = a => b => c => d => a(c)(b(c)(d));
const mul = a => b => c => a(b(c));
const exp = a => b => b(a);
const pre = a => b => c => a(d => e => e(d(b)))(f => c)(g => g);
const sub = a => b => b(pre)(a);
const ntc = n => n > 0 ? a => b => a(ntc(n - 1)(a)(b)) : a => b => b;
const ctn = a => a(x => x + 1)(0);
@rsp
rsp / languagewars-churchnumerals-js.js
Created November 6, 2017 04:30
Language Wars - Church numerals - legacy JavaScript
var suc = function (a) {
return function (b) {
return function (c) {
return b(a(b)(c));
};
};
};
var add = function (a) {
return function (b) {
return function (c) {