(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// funciona somente com v3.1.6, essa estrategia de end/continue | |
// era um backdoor para fazer recursao em types, recursao funcionava somente com interfaces | |
// antigamente pela resolucao de tipos ser lazyness e nao acabar fazendo o compiler cair | |
// potencialmente em um looping infinito na resolucao do tipo, por causa disto tem validacao | |
// no compiler agora e codigos nesse estilo sao barrados pelo compiler | |
type Init<T extends any[], TTail extends any[] = TailArray<T>> = CastArray<{ | |
[K in keyof TTail]: T[keyof T & K]; | |
}> |
ZigZag-Encoding | |
--------------- | |
Maps negative values to positive values while going back and | |
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...) | |
(i >> bitlength-1) ^ (i << 1) | |
with "i" being the number to be encoded, "^" being | |
XOR-operation and ">>" would be arithemtic shifting-operation |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.