This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare namespace Telegram { | |
interface EventHandlers { | |
[eventType: string]: Function[]; | |
} | |
interface InitParams { | |
tgWebAppData?: string; | |
tgWebAppThemeParams?: string; | |
tgWebAppVersion?: string; | |
tgWebAppPlatform?: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// one of possible signals implementations | |
const USED_SIGNALS: Set<Signal> = new Set(); | |
const RELATED_WATCHERS: WeakMap<Computed, Set<Watcher>> = new WeakMap(); | |
const COMPUTED_SIGNALS: WeakMap<Signal, Set<Computed>> = new WeakMap(); | |
class Signal { | |
value: any; | |
get() { | |
USED_SIGNALS.add(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]>; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Square = { | |
x: number; | |
width: number; | |
} | |
const squares: Square[] = [ | |
{ | |
x: 0, | |
width: 10, | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
NewerOlder