Skip to content

Instantly share code, notes, and snippets.


Simeon Vincent dotproto

View GitHub Profile
dotproto / async_playground.js
Created Nov 15, 2017
An async iteration experiment. I was thinking about RxJS-like observables.
View async_playground.js
function clickPromise(el) {
// Create pointers for proimse chain methods
let _resolve = null
let _reject = null
const p = new Promise((resolve, reject) => {
// Cache the promise chain methods for future use
_resolve = resolve
_reject = reject
dotproto / scratchpad.js
Last active Sep 21, 2017
Simple in-browser scratch pad with bookmark-based "saving." To use, copy and paste the this gist into your URL bar. Once loaded, you can save by dragging the link in the top left corner onto your bookmarks bar.
View scratchpad.js
<!-- See -->
<a id="link" title="Drag this link onto your bookmark bar to save!">save scratchpad</a>
<div id="editor" contenteditable>Type something here!<div>To save, drag the link in the top right onto your bookmark bar.</div></div>
:root {
--line-height: 1.5em;
* {
dotproto / silver.js
Created Sep 7, 2017
Reflect + some customizations
View silver.js
export default var Silver = Object.create(Reflect, {
// ownEntries has a similar API to Object.entries, but it uses the same
// enumeration logic as Reflect.keys
ownEntries: {
writable: true,
enumerable: false,
configurable: true,
value: function(obj) {
return Reflect.ownKeys(obj).map(key => [key, obj[key]]);
dotproto /
Last active Aug 26, 2017
Stuff I should look into.

Project ideas

  • 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
dotproto / defaults.js
Created Jul 10, 2017
Ways of handling parameter defaults in JS
View defaults.js
I was just reading through Eric Elliott's ["10 Tips for Better Redux Architecture"]( and found myself a little thrown by some of his sample code. Rather than justshrug it off, I took a few minutes to break down the pros/cons of his appoach and a couple other implimentations I was kicking around.
// Eric's original implimentation
const createChat_v1 = ({
id = 0,
msg = '',
user = 'Anonymous',
timeStamp = 1472322852680
View hash-utils.js
// 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 = [] => val.toString(16).padStart(2, '0'));
return hex.join('').substring(0, length);
var randomHash = (length = 32) => {
return hex = [] Uint8Array(Math.ceil(length / 2)))).map(val => val.toString(16).padStart(2, '0')).join('').substring(0, length);
dotproto / linked-list.js
Last active Jun 6, 2017
Linked List implementation that behaves like a stack (last in, first out)
View linked-list.js
const VOID = Symbol('VOID');
class LinkedItem {
constructor(value) {
this.value = value; = null;
class LinkedList {
dotproto / demo.js
Created Mar 15, 2017
Observable -> BehaviorSubject
View demo.js
// Open to run this code
var timer = new Rx.Observable((obs) => {
var counter = 0;
var int = setInterval(() =>, 1000);
return () => {
View setup.js
// 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",
dotproto / class-to-element.js
Created Feb 8, 2017
Hlper that attempts to convert a custom element class' name into a valid custom element name.
View class-to-element.js
// PCENChar comes from the Custom Element spec
// PCEN = Potential Custom Element Name
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) {
You can’t perform that action at this time.