View consensus.ts
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
import { Sleep } from "sleep"; | |
import IORedis from "ioredis"; | |
import pino from "pino"; | |
import { | |
LEADERSHIP_EVENTS, | |
LeadershipMetrics, | |
} from "libs/metrics/leadership"; | |
const leadershipKey = "leader"; |
View index.ts
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
describe('finally', () => { | |
it('1', () => { | |
const ttt = () => { | |
try { | |
return true | |
} finally { | |
// eslint-disable-next-line no-unsafe-finally | |
return false | |
} | |
} |
View gist:616eb8915d1c2b9bb74a56342cf3dbac
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
// #1 | |
class User { | |
public id: string | |
public password: string | |
public emails: Email[] | |
public deletedAt: Date | null | |
} | |
class Email { |
View typed-errors.ts
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
export const INTERNAL_ERROR_TYPE = "internal_error"; | |
export const INTERNAL_ERROR = { | |
type: INTERNAL_ERROR_TYPE, | |
message: "Internal error", | |
}; | |
export const CRITICAL_ERROR = { | |
type: "critical_error", | |
message: "Critical error", | |
}; |
View esModuleInterop.js
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 __importDefault = (this && this.__importDefault) || function (mod) { | |
return (mod && mod.__esModule) ? mod : { "default": mod }; | |
}; |
View index.ts
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 returnError = async <R>(callback: (...args: any) => Promise<R>): Promise<[R] | [undefined, Error]> => { | |
try { | |
return await callback() | |
} catch (e) { | |
return e | |
} | |
} | |
const [result, err] = returnError( | |
() => api.call(/* ... */) |
View index.ts
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 config = { | |
entities: [], | |
driverOptions: { | |
connection: { | |
ssl: { | |
require: true, | |
rejectUnauthorized: false, | |
}, | |
}, | |
}, |
View gist:d63e642c3d61c5bd2fadd76a63329e10
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
interface TNode { | |
value: number | |
left?: TNode | |
right?: TNode | |
} | |
export interface Tree { | |
root: TNode | |
} |
View gist:2e8acd77306ba4fade41321f70e176a8
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
Пример кода для блока, где 3 человечка, а разделитель только справа от второго | |
```javascript | |
var blocks = [ | |
{ | |
"text": "...", | |
"persons": [ | |
{ | |
"separatorFromRight": false | |
}, |
View gist:d0235f45fe09feabd67376cb856adb81
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
[Nov 29 15:58:52.874] Exception 28 @ 0x4027639e, vaddr 0x00000000 | |
[Nov 29 15:58:52.877] A0: 0x40276228 A1: 0x3ffffa40 A2: 0x3fff033c A3: 0x00000000 | |
[Nov 29 15:58:52.883] A4: 0x00000001 A5: 0x00000000 A6: 0x00000000 A7: 0x00000001 | |
[Nov 29 15:58:52.888] A8: 0x3fff0338 A9: 0x00000007 A10: 0x3fff0398 A11: 0x00000007 | |
[Nov 29 15:58:52.894] A12: 0x3ffee3a4 A13: 0x00000076 A14: 0x000000d0 A15: 0x40200010 | |
[Nov 29 15:58:52.899] | |
[Nov 29 15:58:52.899] (exc SP: 0x3ffff8a0) | |
[Nov 29 15:58:52.902] | |
[Nov 29 15:58:52.902] --- BEGIN CORE DUMP --- | |
[Nov 29 15:58:52.905] {"arch": "ESP8266", |
NewerOlder