Skip to content

Instantly share code, notes, and snippets.

View kristoferbaxter's full-sized avatar
🐩

Kristofer Baxter kristoferbaxter

🐩
View GitHub Profile
@kristoferbaxter
kristoferbaxter / hwinfo
Created January 29, 2020 18:31
Elementary OS Machine
cpu:
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4400 MHz
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4400 MHz
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4400 MHz
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4400 MHz
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4400 MHz
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4400 MHz
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4400 MHz
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4400 MHz
keyboard:
@kristoferbaxter
kristoferbaxter / output.js
Created November 19, 2019 23:31
Post Closure Parse
'use strict';
let xa = {en:"English", ja:"\u65e5\u672c\u8a9e Japanese BETA", ru:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439 Russian BETA", "ru-RU":"\u0420\u0443\u0441\u0441\u043a\u0438\u0439 Russian BETA", "en-AU":"English (Australia)", "en-CA":"English (Canada)", "en-IE":"English (Ireland)", "en-IN":"English (India)", "en-NZ":"English (New Zealand)", "en-PH":"English (Philippines)", "en-ZA":"English (South Africa)", "en-GB":"English (UK)", "en-US":"English (US)"};
"en-AU en-CA en-IE en-IN en-NZ en-PH en-ZA en-GB en-US ja ru-RU".split(" ").reduce((g, q) => {
g[q] = xa[q];
return g;
}, {});
var ya = "object" == typeof self && self && self.Object === Object && self, F = "object" == typeof global && global && global.Object === Object && global || ya || Function("return this")(), L = F.Symbol, za = Object.prototype, hasOwnProperty = za.hasOwnProperty, Aa = za.toString, U = L ? L.toStringTag : void 0, Ba = Object.prototype.toString, Xa = L ? L.toStringTag : void 0;
function Ya(g) {
var q = typeof g;
return
@kristoferbaxter
kristoferbaxter / input.js
Created November 19, 2019 22:47
IIFE "Variable declared more than once" Example
var app = (function () {
'use strict';
function noop() { }
function run(fn) {
return fn();
}
function blank_object() {
return Object.create(null);
}
@kristoferbaxter
kristoferbaxter / package.json
Created April 4, 2019 02:22
Rollup + Module CSS + TypeScript
{
"name": "thing",
"version": "0.0.1",
"description": "Thing",
"main": "dist/media/base.js",
"author": "Kristofer Baxter",
"license": "Apache-2.0",
"scripts": {
"clean": "rimraf dist/*",
"type-css": "tcm src -s",
import React from "react";
import { Location } from "@reach/router";
let scrollPositions = {};
class ManageScrollImpl extends React.Component {
componentWillUnmount() {
scrollPositions[this.props.location.key] = window.scrollY;
}
This file has been truncated, but you can view the full file.
[{"pid":1001,"tid":775,"ts":152949272212,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":25,"tdur":24,"tts":4864053251},
{"pid":1001,"tid":775,"ts":152949272262,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":9,"tdur":7,"tts":4864053301},
{"pid":1001,"tid":775,"ts":152949272292,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":9,"tdur":8,"tts":4864053330},
{"pid":1001,"tid":775,"ts":152949272322,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":9,"tdur":7,"tts":4864053361},
{"pid":1001,"tid":775,"ts":152949272351,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"
This file has been truncated, but you can view the full file.
[{"pid":1001,"tid":775,"ts":152805843143,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":36,"tdur":34,"tts":4860132086},
{"pid":1001,"tid":775,"ts":152805843206,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":8,"tdur":8,"tts":4860132148},
{"pid":1001,"tid":775,"ts":152805843233,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":7,"tdur":7,"tts":4860132174},
{"pid":1001,"tid":775,"ts":152805843260,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":10,"tdur":10,"tts":4860132202},
{"pid":1001,"tid":775,"ts":152805843294,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func"
export class MyComponent extends React.Component {
componentWillMount() {
const styleid = 'MyComponentStyles'
if (document.head.querySelector(`#${styleid}`) !== null) {
const styles = document.createElement('style');
styles.id = styleid;
styles.append('[foo]{ color: blue; }');
document.head.appendChild(styles);
}
}

Differential builds per browser

application.js

Compression Chrome Safari Edge Firefox Fallback
None 22,445 (56.0%) 23,123 26,003 22,103 51,106
Zopfli (i25) 8,282 (50.6%) 8,538 9,296 8,191 16,766
Brotli (q11) 7,640 (54.4%) 7,573

application.css

@kristoferbaxter
kristoferbaxter / gist:1091672
Created July 19, 2011 08:06
Multikey Caching Proposal
A modest multikey caching proposal.
Allow the page to set valid hosts which share the same cache entry for resources. A request to foo.bar/baz is also cached for foo2.bar/baz.
Limitations to multikey caching: Only urls from the same root domain can be used. A request to the browser to specify foo.bar/baz is the same as www.google.com/baz would not be allowed. In this example, www.google.com/baz and www2.google.com/baz would work.
Format consists of a few pieces.
1. Meta tag in markup defining what Wildcard pattern to iterate over. This can be a comma separated list, or include a regular expression.
2. Each request from the browser in a multikey request includes a specific header stating the host pattern of the document including this asset.
3. Responses much have the exact key match as the host document.