Skip to content

Instantly share code, notes, and snippets.

View johnsonjo4531's full-sized avatar
🙂
👍🏻

John Johnson johnsonjo4531

🙂
👍🏻
View GitHub Profile
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@johnsonjo4531
johnsonjo4531 / index.html
Last active September 22, 2017 21:32
Chrome 63 Async Iteration inspector performance problem
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="script.js"></script>
<style>
body {
@johnsonjo4531
johnsonjo4531 / AsyncLock.js
Last active October 27, 2019 06:13
AsyncLock implementation
// https://codereview.stackexchange.com/questions/177935/asynclock-implementation-for-js
export function AsyncLock() {
const p = () => new Promise(next => (nextIter = next));
var nextIter,
next = p();
const nextP = () => {
const result = next;
next = result.then(() => p());
return result;
};
@johnsonjo4531
johnsonjo4531 / timeout.js
Created July 28, 2018 04:13
Useful promisified timeout with cancellation
module.exports.timeout = function timeout(ms, clear = () => {}) {
return new Promise((res, rej) => {
var t = setTimeout(res, ms);
clear(function cancel () {
clearTimeout(t);
rej("CANCELLED BY TIMEOUT");
});
});
};
@johnsonjo4531
johnsonjo4531 / assertSetsTest.ts
Last active April 20, 2019 00:24
Deno example of tests that should pass.
import { runTests, test } from "https://deno.land/std@v0.3.4/testing/mod.ts";
import {
assertNotEquals,
assertEquals,
equal
} from "https://deno.land/std@v0.3.4/testing/asserts.ts";
/**
* determines if the two sets are equal order shouldn't matter
*/
@johnsonjo4531
johnsonjo4531 / .editorconfig
Last active November 9, 2021 19:56
Tiny Testing Framework that allows async functions and test groups.
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
@johnsonjo4531
johnsonjo4531 / index.html
Last active September 4, 2019 02:56
Principles of e-commerce: Modern JavaScript Crash-Course
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Hello</title>
</head>
<body>
<h1>Hello HTML!</h1>
@johnsonjo4531
johnsonjo4531 / LICENSE
Last active September 11, 2019 02:49
Prefix and givenfiles in a certain directory
Copyright 2019 johnsonjo4531
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE
@johnsonjo4531
johnsonjo4531 / .dockerignore
Last active September 12, 2019 01:03
An example of a failed pkg run
node_modules
index*
!index.js
@johnsonjo4531
johnsonjo4531 / LICENSE
Last active December 21, 2019 21:30
Some GTOR functions
The MIT License (MIT)
Copyright (c) 2014 Kris Kowal, johnsonjo4531
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: