Skip to content

Instantly share code, notes, and snippets.

View NotWoods's full-sized avatar

Tiger Oakes NotWoods

View GitHub Profile
@NotWoods
NotWoods / split.js
Last active December 1, 2022 04:10
Node.js - Break up a stream and reassemble it so that each line is a chunk.
const stream = require("stream");
/** Simplified version of split() on npm. */
const split = new stream.Transform({
/**
* @param {Buffer | string} chunk is the data from the Readable Stream.
* @param {string} encoding is the file encoding, but isn't used here.
* @param {() => void} next is a callback function called when you finish working
* with this chunk.
*/
/**
* Creates a promise that can be resolved from the outside.
* @property {function} resolve - resolves the promise
* @property {function} reject - rejects the promise
*/
class Deferred extends Promise {
constructor() {
var _resolve, _reject;
super((resolve, reject) => {
_resolve = resolve;
@NotWoods
NotWoods / fetch-helper.js
Created March 6, 2019 01:21
fetch(): reject when response status is not ok
/**
* Check for any HTTP errors, and throw if one is encountered.
* Use as a callback for `fetch` to seamlessly add HTTP error checking to your code.
* @param {Response} response
* @example
* fetch('https://example.com')
* .then(checkForHttpErrors)
* .then(res => res.json())
* .catch(err => { /* process network error or HTTP error */ });
*/
org.chromium.twa.svgomg E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.chromium.twa.svgomg, PID: 17501
java.lang.IllegalStateException: mSession is null in launchWhenSessionEstablished
at android.support.customtabs.trusted.TwaLauncher.launchWhenSessionEstablished(TwaLauncher.java:176)
at android.support.customtabs.trusted.TwaLauncher.lambda$launchTwa$0(TwaLauncher.java:158)
at android.support.customtabs.trusted.-$$Lambda$TwaLauncher$0c_zkUHgDllmcAlOM3gechJInp0.run(Unknown Source:8)
at android.support.customtabs.trusted.TwaLauncher$TwaCustomTabsServiceConnection.onCustomTabsServiceConnected(TwaLauncher.java:226)
at android.support.customtabs.CustomTabsServiceConnection.onServiceConnected(CustomTabsServiceConnection.java:44)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1741)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1773)
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<!--
This first group contains the line, and the image mask used to hide the end of it.
-->
<group>
<clip-path android:pathData="M 18.8 2.8 C 19.8 1.8 21.1 3.3 20.2 4.2 L 3.4 21 L 2 19.6 L 18.8 2.8 Z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<!--
This first group contains the line, and the image mask used to hide the end of it.
-->
<group>
<clip-path android:pathData="M 18.8 2.8 C 19.8 1.8 21.1 3.3 20.2 4.2 L 3.4 21 L 2 19.6 L 18.8 2.8 Z"/>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="fillColor"
android:duration="500"
android:valueFrom="#20123A"
android:valueTo="#CCCCCC"
android:valueType="colorType" />
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="fillColor"
android:duration="500"
android:valueFrom="#CCCCCC"
android:valueTo="#20123A"
android:valueType="colorType" />
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="pathData"
android:duration="500"
android:valueFrom="M 0 0 L 0 24 L 24 24 L 24 0 L 0 0 Z M 21 2 L 23 4 L 23 4 L 21 2 L 21 2 Z"
android:valueTo="M 0 0 L 0 24 L 24 24 L 24 0 L 0 0 Z M 21 2 L 23 4 L 6 21 L 4 19 L 21 2 Z"
android:valueType="pathType" />
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:propertyName="pathData"
android:duration="500"
android:valueFrom="M 20 1.6 L 21.4 3 L 21.9 2.5 C 20.9 3.5 19.5 2 20.5 1.1 L 20 1.6 Z"
android:valueTo="M 20 1.6 L 21.4 3 L 5.2 19.2 C 4.2 20.2 2.8 18.8 3.8 17.8 L 20 1.6 Z"
android:valueType="pathType" />
<objectAnimator
android:propertyName="fillColor"
android:duration="500"