To run:
npx jscodeshift ./src -t ./shifter.ts --extensions=tsx --parser=tsx -p
Not covered cases:
import capitalize from '@mui/utils/capitalize’;
// @ts-check | |
// https://codepen.io/lifeart/pen/abMzEZm?editors=0110 | |
// https://github.com/glimmerjs/glimmer-vm/issues/1540 | |
/* | |
This is a proof of concept for a new approach to reactive programming. | |
It's related to Glimmer-VM's `@tracked` system, but without invalidation step. | |
We explicitly update DOM only when it's needed and only if tags are changed. | |
*/ | |
let rowId = 1; |
var classes = {}; | |
var cnt = 1; | |
function hashForClass(rawClassName) { | |
const className = rawClassName.trim(); | |
if (className in classes) { | |
classes[className].cnt++; | |
return classes[className].index; | |
} else { | |
classes[className] = { |
class Bar { | |
doSomething() { | |
console.log('do something'); | |
} | |
name: string; | |
} | |
type PromisifyProps<T> = { | |
[P in keyof T]: T[P] extends (...args: infer A) => infer R ? (...args: A) => Promise<R> : Promise<T[P]>; | |
}; |
type Square = { | |
x: number; | |
width: number; | |
} | |
const squares: Square[] = [ | |
{ | |
x: 0, | |
width: 10, | |
}, | |
{ |
// inspired by https://github.com/simplabs/ember-simple-auth/blob/master/packages/ember-simple-auth/addon/authenticators/oauth2-password-grant.js | |
import { LOGOUT_503_MESSAGE } from '@auth/messages'; | |
/* | |
Idea is to have Authentication hub (HUB) | |
HUB could have multiple providers, our own provider is oauth2.0 | |
Provider responsible for: |
// https://raw.githubusercontent.com/phoboslab/qoi/master/qoi.h | |
class QoiRGBA { | |
constructor(r = 0, g = 0, b = 0, a = 255) { | |
this.r = r; | |
this.g = g; | |
this.b = b; | |
this.a = a; | |
} | |
} |
const ts = require('typescript'); | |
const fs = require('fs'); | |
const path = require('path'); | |
function getFileInfo(file, start) { | |
const { fileName } = file; | |
const { line, character } = file.getLineAndCharacterOfPosition(start); | |
return { fileName, line: line + 1, character: character + 1 }; | |
} |
type JsonData = { | |
meta: Meta; | |
parameters: Parameter[]; | |
}[]; | |
interface Meta { | |
type: string; // The dictionary is a Polygon. | |
classId: number; // Class ID (one of the class IDs in “classes.json”). If the instance has an undefined class, the value should be -1 (classId": -1) | |
className?: string; // Class name. If the instance has an undefined class, the key should not be in the JSON. | |
createdBy?: User; // Information about the user who created the Polygon. |
// ref https://twitter.com/underoot/status/1633430089802084352?s=52&t=0yc3BUdFiWnN-uQfrkt3xw | |
(async () = { | |
const port = 12345; // N port | |
const browser = await chromium. connectOverCDP(`http://localhost:${port}`); | |
const defaultContext = browser. contexts()[0]; | |
const page await defaultContext.newPage(); | |
// Do something with page | |
}); |
To run:
npx jscodeshift ./src -t ./shifter.ts --extensions=tsx --parser=tsx -p
Not covered cases:
import capitalize from '@mui/utils/capitalize’;