Skip to content

Instantly share code, notes, and snippets.

/* https://go.tacodewolff.nl/minify */
enScroll=!1,enFdl=!1,extCurrent=void 0,filename=void 0,targetText=void 0,splitOrigin=void 0;const lStor=localStorage,sStor=sessionStorage,doc=document,docEl=document.documentElement,docBody=document.body,docLoc=document.location,w=window,s=screen,nav=navigator||{},extensions=["pdf","xls","xlsx","doc","docx","txt","rtf","csv","exe","key","pps","ppt","pptx","7z","pkg","rar","gz","zip","avi","mov","mp4","mpe","mpeg","wmv","mid","midi","mp3","wav","wma"];function a(e,t,n,o){const j="G-XXXXXXXXXX",r=()=>Math.floor(Math.random()*1e9)+1,c=()=>Math.floor(Date.now()/1e3),F=()=>(sStor._p||(sStor._p=r()),sStor._p),E=()=>r()+"."+c(),_=()=>(lStor.cid_v4||(lStor.cid_v4=E()),lStor.cid_v4),m=lStor.getItem("cid_v4"),v=()=>m?void 0:enScroll==!0?void 0:"1",p=()=>(sStor.sid||(sStor.sid=c()),sStor.sid),O=()=>{if(!sStor._ss)return sStor._ss="1",sStor._ss;if(sStor.getItem("_ss")=="1")return void 0},a="1",g=()=>{if(sStor.sct)if(enScroll==!0)return sStor.sct;else x=+sStor.getItem("sct")+ +a,sSto
@MidSpike
MidSpike / readme.md
Last active February 5, 2024 18:09
CVE-2022-23812 | RIAEvangelist/node-ipc is malware / protest-ware

My Stripe Tax Story

I've been debating for weeks whether or not I was going to write any of this down. I'm a dad with two kids and a house to take care of and a business to run. Adding story-telling like this to my plate is exhausting.

Until yesterday, I had decided to forget about the whole thing, until I received the email that broke the camels back, as it were.

The best way I can describe why I'm writing this email is for the same reason why you might spend two hours dealing with an uncooperative mobile phone carrier to get them to remove that $5 charge on your bill that shouldn't be there. Some combination of the feeling of frustration and injustice that really pushes my proverbial buttons.

In this particular case, the "$5 charge on my phone bill" turned out to be literally hundreds of recurring subscription invoices that Stripe disabled collection for because, apparently, those subscriptions required "location inputs".

Generally speaking, I don't blog much anymore, and the last thing I wa

@tkrotoff
tkrotoff / ReactNative-vs-Flutter.md
Last active February 27, 2024 15:40
React Native vs Flutter
@markerikson
markerikson / AppErrorFallback.tsx
Created July 1, 2021 13:43
Next.js ErrorBoundary example
import React from 'react';
import Jumbotron from 'react-bootstrap/Jumbotron';
import Alert from 'react-bootstrap/Alert';
import Button from 'react-bootstrap/Button';
import { FallbackProps } from 'react-error-boundary';
interface AEFProps extends FallbackProps {
@tannerlinsley
tannerlinsley / useBroadcastLeader.ts
Created June 4, 2021 14:37
A React Hook to determine if a tab of your application is the "leader" using BroadcastChannel and leader election
import { BroadcastChannel, createLeaderElection } from 'broadcast-channel'
import React from 'react'
const channels = {}
export function useBroadcastLeader(id = 'default') {
const [isBroadcastLeader, setIsBroadcastLeader] = React.useState(false)
React.useEffect(() => {
if (!channels[id]) {
@Dan-Q
Dan-Q / get-twitter-avatar.js
Created June 2, 2021 08:33
Uses Puppeteer to get the current URL of any user's Twitter avatar by screen-scraping, for times when you're just too lazy to get some OAuth tokens and implement the Twitter API v2. Pass twitter usernames as command-line arguments.
/* Copyright (c) 2021 Dan Q; released under the MIT License. */
const Puppeteer = require('puppeteer');
getAvatar = async (twitterUsername) => {
const browser = await Puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
const page = await browser.newPage();
await page.goto(`https://twitter.com/${twitterUsername}`);
await page.waitForSelector('a[href$="/photo"] img[src]');
const url = await page.evaluate(()=>document.querySelector('a[href$="/photo"] img').src);
@istarkov
istarkov / esbuild.js
Created May 22, 2021 13:38
esbuild node app setup for latest stable node > 14.16.0
// same as `yarn esbuild index.ts src/**/*.ts --platform=node --format=esm --tsconfig=./tsconfig.json --outdir=dist --watch`
// but with respawn server on change
import esbuild from 'esbuild';
import fg from 'fast-glob';
import { spawn } from 'child_process';
const entryPoints = await fg(['index.ts', 'src/**/*.ts']);
const dev = process.env.NODE_ENV !== 'production';
@karlhorky
karlhorky / .readme.md
Last active May 8, 2021 11:41
Use new `node:` prefix on Repl.it with Node v12

node: schema prefixes on repl.it

If you want to use the node: prefixes for builtin modules on repl.it, then (as of May 2021) you need to do a few things:

  1. In .replit, add the [packager] section with the ignoredPackages configuration seen in the example file below. This will disable the automatic installation on repl.it of these packages.
  2. In .replit, change the start script to yarn start
  3. In package.json, add a scripts section with the start script as seen in the example file below. This will transpile away the node: prefixes for the older Node v12 version using @upleveled/babel-plugin-remove-node-prefix.
  4. Run yarn add --dev @babel/core @babel/node @upleveled/babel-plugin-remove-node-prefix

Example repl here: https://replit.com/@karlhorky/node-prefix-babel-demo#index.js

@karlhorky
karlhorky / try-catch.ts
Last active October 19, 2022 23:43
Try-catch helper for promises and async/await
export default async function tryCatch<Data>(
promise: Promise<Data>,
): Promise<{ error: Error } | { data: Data }> {
try {
return { data: await promise };
} catch (error) {
return { error };
}
}