Skip to content

Instantly share code, notes, and snippets.

View Jack-Works's full-sized avatar
🎆
魔法をかけて

Jack Works Jack-Works

🎆
魔法をかけて
View GitHub Profile
@Jack-Works
Jack-Works / bad part.jsx
Created November 13, 2023 07:39
prettier 3.1 feedback
//// Case 1
// before
len = len > 32 ? (len > 48 ? 66 : 48) : 32
// after
len =
len > 32 ?
len > 48 ?
66
: 48
@Jack-Works
Jack-Works / .vscode-launch.json
Last active April 30, 2023 17:49
Debug TypeScript
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests (currently opened test)",
"runtimeArgs": ["--nolazy"],
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
@Jack-Works
Jack-Works / 2018.js
Last active March 1, 2024 02:23
cRAzY eSnEXt (*all* proposals mixed in)
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A // https://github.com/tc39/proposal-pipeline-operator
|> do { // https://github.com/tc39/proposal-do-expressions
case(?) { // https://github.com/tc39/proposal-pattern-matching
when {val}: class {
@Jack-Works
Jack-Works / explain.md
Last active November 12, 2020 15:39
FAQ: Why TypeScript is correct? / Why TypeScript cannot express this?

Frequently asked TypeScript question

I think my code is correct! Why it is complaining type error to me?

How can I do something in TypeScript?

Case 1: Add function

function add(left: T, right: T): T {
@Jack-Works
Jack-Works / pause-on-exception.js
Last active June 7, 2020 05:07
Pause on exception, with catch, async version
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
async function err() {
await sleep(200)
// debugger: pause on uncaught exception
// should pause on this
throw new Error("wow")
}
function err2() {
@Jack-Works
Jack-Works / npm.detect.js
Last active March 24, 2022 03:18
npm-detect.js
// ==UserScript==
// @name NPM detect ESM TS sideEffects
// @namespace http://tampermonkey.net/
// @version 0.3
// @description
// @author Jack Works
// @match https://www.npmjs.com/*
// @grant GM_xmlhttpRequest
// @require https://unpkg.com/@holoflows/kit@0.6.0
// @connect unpkg.com

Keybase proof

I hereby claim:

  • I am jack-works on github.
  • I am jackworks (https://keybase.io/jackworks) on keybase.
  • I have a public key ASDid3LDQ_-Qiag1yi8FnATJA0_BoUSuC3VWiEw3jDvd1Ao

To claim this, I am signing this object: