// Map all your event names with their handlers
type CustomEmitterEvents = {
eventA: (payload: number) => void
eventB: (payload: string) => void
eventC: (arg: boolean, msg: string) => void
}
// Interface of your sublcass, matches the EventEmitter method signatures
This file contains hidden or 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 uniqueFilter = (value: T, index: number, source: T[]): bolean => { | |
| return source.indexOf(value) === index | |
| } | |
| // Example | |
| const sourceArr = [1, 2, 3, 3, 4, 4, 4, 5] | |
| const uniqueArr = sourceArr.filter(uniqueFilter) // [1, 2, 3, 4, 5] |
This file contains hidden or 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 UserStruct = { | |
| 'prefix:name': string | |
| 'prefix:age': number | |
| lastName: string | |
| } | |
| type RemovePrefix<T> = T extends `prefix:${infer U}` ? U : T | |
| type RemovePrefixFromStruct<T> = { | |
| [K in keyof T as RemovePrefix<K>]: T[K] |
// Case with 3 objects
const abc = (p1, p2, map = { a:0, c:1, b:2 }) => {
return ['DRAW', 'P1', 'P2'][(map[p1] - map[p2] + 3) % 3]
}// Case with 4 objects
const abcd = (p1, p2, map = { a:0, d:1, c:2, b:3 }) => {
return ['DRAW', 'P1', 'P2'][(map[p1] - map[p2]) % 2 && (4 - ((map[p1] - map[p2] + 4) % 4)) % 3 + 1]There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket
You may use the same computer for work and personal development and need to separate your work.
When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.
You may have different projects you're working on where you would like to segregate your access.
This file contains hidden or 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
| <template> | |
| <form> | |
| <input | |
| v-for((val, key) in model) | |
| :key="key" | |
| :value="val" | |
| @input="model = ({ [key]: $event })" | |
| > | |
| </form> | |
| </template> |
This file contains hidden or 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
| @function prefix($property, $prefixes: (webkit moz o ms)) { | |
| $vendor-prefixed-properties: transform background-clip background-size; | |
| $result: (); | |
| @each $prefix in $prefixes { | |
| @if index($vendor-prefixed-properties, $property) { | |
| $property: -#{$prefix}-#{$property} | |
| } | |
| $result: append($result, $property); | |
| } | |
| @return $result; |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
This file contains hidden or 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
| ------------------------------------------------------------------------ | |
| Basic | |
| ------------------------------------------------------------------------ | |
| git init | |
| инициализирует git в текущем каталоге (не забыть в консоле перейти в текущий каталог!!!) | |
| git status | |
| Показывает текущий статус измененных файлов проекта (кто в stage, кто нет) |