- Project boilerplate that has all the basics set up including
- Set up CI - or at least provide instructions to make it as painless as possible
- Watch task for linter
- Watch task for unit tests
- Integration test
- Using headless Chrome to do screenshot diffing for CSS regressions
- Precommit hooks and/or CI hooks for prettier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// References | |
// | |
// - https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type | |
// - http://unicode.org/reports/tr15/#Norm_Forms | |
// - http://unicode.org/faq/normalization.html#7 (What is the difference is between W3C normalization and Unicode normalization?) | |
// - https://developer.mozilla.org/en-US/docs/Web/API/DOMParser | |
// | |
// Resources | |
// | |
// - http://stackoverflow.com/questions/8936984/uint8array-to-string-in-javascript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PCENChar comes from the Custom Element spec | |
// PCEN = Potential Custom Element Name | |
// https://www.w3.org/TR/custom-elements/#custom-elements-core-concepts | |
const PCEN_CHAR = /[-a-z._0-9\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u10000-\uEFFFF]/ | |
const VALID_PCEN = new RegExp(`^[a-z]${PCEN_CHAR.source}*-${PCEN_CHAR.source}*$`) | |
const CAPS = /([A-Z])/g | |
const INNER_CAPS = /((?!^|[a-z]))([A-Z])/g | |
function classNameToElementName(Class) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: I was going through various alternative forms when I realized I was spending too much time on this. | |
let data = { | |
"a": "alpha", | |
"b": "beta,", | |
"c": "gamma", | |
"d": "delta", | |
"e": "epsilon", | |
"g": "eta", | |
"h": "theta", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate a random hex string of the specified length | |
var randomHashReadable = function(length = 32) { | |
const hashLength = Math.ceil(length / 2); | |
const buffer = crypto.getRandomValues(new Uint8Array(hashLength)); | |
const hex = [].slice.call(buffer).map(val => val.toString(16).padStart(2, '0')); | |
return hex.join('').substring(0, length); | |
}; | |
var randomHash = (length = 32) => { | |
return hex = [].slice.call(crypto.getRandomValues(new Uint8Array(Math.ceil(length / 2)))).map(val => val.toString(16).padStart(2, '0')).join('').substring(0, length); |
On Dec 3, 2017 [I asked Marcin Wichary][request] for advice on "font design" and he suggested I check out [Zach Leatherman's thread][zach_thread] where he asked a very similar question.
- [How to create typefaces: from sketch to screen][book1]
- [Counterpunch][book2]
- [Designing Type][book3] by Karen Cheng
- [While You're Reading][book4] by Gerard Unger
- [Essential Type: An Illustrated Guide to Understand and Using Fonts][book5] by Tony Seddon
- [Lettering for Reproduction][boo6] by David Gates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async function() { | |
console.clear(); | |
class Deferred { | |
constructor() { | |
this.promise = new Promise((resolve, reject) => { | |
this.resolve = resolve; | |
this.reject = reject; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//----------------------------------*\ | |
// TRIGONOMETRY FUNCTIONS | |
//----------------------------------*/ | |
// # Trigonometry in CSS | |
// | |
// - Through Taylor/Maclaurin polynomial representation: http://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf | |
// - Useful if you don't want to use JS. | |
// - With CSS Variables. | |
// - `calc()` can't do power (x ^ y) so I used multiplication instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2020 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
// Start synchronizaiton on browser action click | |
chrome.browserAction.onClicked.addListener(function(tab) { | |
console.log('Handshake initiated: BG sending SYN'); | |
chrome.tabs.sendMessage(tab.id, { type: 'bg-syn' }); | |
}); | |
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright 2020 Google LLC | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
https://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, |