Skip to content

Instantly share code, notes, and snippets.

Avatar

Simeon Vincent dotproto

View GitHub Profile
@dotproto
dotproto / LICENSE
Last active Jul 16, 2020
MV3 webRequest demo. To view the console, you may need to manually open devtools for the service worker. On Chrome, visit chrome://serviceworker-internals and search for the service worker registered to `chrome-extension://<extension-id>/` where extension-id is the ID of your extension.
View LICENSE
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,
@dotproto
dotproto / background.js
Created Feb 26, 2020
Simple Chrome Extension messaging demo modeled after the TCP/IP handshake (SYN, SYN-ACK, ACK)
View background.js
// 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) {
@dotproto
dotproto / LICENSE
Created Nov 15, 2019
Minimal working Manifest V3 extension.
View LICENSE
Copyright 2019 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,
@dotproto
dotproto / yt-translation.js
Created Oct 4, 2019
Open transcription suggestion for current YT video
View yt-translation.js
javascript:(function(){
var log = (...a) => console.log(...a);
const url = new URL(document.location.href);
if (url.hostname.endsWith('youtube.com')) {
const id = url.searchParams.get('v');
window.location = `https://www.youtube.com/timedtext_video?v=${id}`;
}
})()
@dotproto
dotproto / LICENSE
Created Jun 13, 2019
Simple extension that injects a script before the page loads
View LICENSE
Copyright 2019 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,
@dotproto
dotproto / index.css
Created Jul 10, 2018 — forked from stereokai/index.css
Trigonometry in CSS
View index.css
//----------------------------------*\
// 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.
@dotproto
dotproto / merge.js
Last active Apr 26, 2018
Merge async iterators
View merge.js
(async function() {
console.clear();
class Deferred {
constructor() {
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}
View getPushIdTimestamp.js
var getPushIdTimestamp = (function getPushIdTimestamp() {
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
return function getTimestampFromId(id) {
var time = 0;
var data = id.substr(0, 8);
for (var i = 0; i < 8; i++) {
time = time * 64 + PUSH_CHARS.indexOf(data[i]);
}
View typeface_advice.md

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.

Books

  1. [How to create typefaces: from sketch to screen][book1]
  2. [Counterpunch][book2]
  3. [Designing Type][book3] by Karen Cheng
  4. [While You're Reading][book4] by Gerard Unger
  5. [Essential Type: An Illustrated Guide to Understand and Using Fonts][book5] by Tony Seddon
  6. [Lettering for Reproduction][boo6] by David Gates
@dotproto
dotproto / default-params.js
Created Nov 22, 2017
Short collection of thoughts on a couple different approaches for default "options" values in a function
View default-params.js
// Static defaults
function fn({a = 1, b = 2} = {}) {
return `${a}, ${b}`
}
fn() // 1, 2
fn({b: 'beta'}) // 1, beta
/**
You can’t perform that action at this time.