Skip to content

Instantly share code, notes, and snippets.

View scvnathan's full-sized avatar
💣

Nathan Schneirov scvnathan

💣
  • Minneapolis, Minnesota
View GitHub Profile
@scvnathan
scvnathan / usePermission.ts
Last active September 1, 2021 16:08
TS 4.4 compatible usePermission
import { useEffect, useState } from 'react';
import { noop, off, on } from './misc/util';
type PermissionDesc =
| PermissionDescriptor
| ExperimentalDevicePermissionDescriptor
| ExperimentalMidiPermissionDescriptor
| ExperimentalPushPermissionDescriptor;
interface ExtendedExperimentalPermissions extends Permissions {
@scvnathan
scvnathan / prettier-plus
Created June 27, 2017 22:31
a little prettier wrapper to allow for custom execution, mainly for ignoring certain file types. I wrote this initially so i can use it with my IDE which in injects the current file as a param
const path = require("path");
const childProcess = require("child_process");
const prettierArgs = Array.from(process.argv).slice(2);
const valid = [".jsx", ".js"];
if (valid.includes(path.extname(prettierArgs[prettierArgs.length - 1]))) {
let prettierLocation = "";
//default locations for locally installed prettier
if (["darwin", "linux"].includes(require("os").platform())) {