Skip to content

Instantly share code, notes, and snippets.

@devdoomari3
devdoomari3 / InTeResTing.txt
Created February 18, 2020 11:17
interesting Typescript stuffs
https://stackoverflow.com/questions/57016728/is-there-a-way-to-define-type-for-array-with-unique-items-in-typescript
( https://www.typescriptlang.org/play/#code/MYewdgzgLgBFCuAHANgUwPIDMAyBLKqATgIbIQBcMA2gIwA0MATA4wLowC819TLrA3AFgAUKEiwEKDJgBy4PARJlKVMPAC2AIyIM1WnTD3bC7LrRZ8ho8NBjFCJAJ5YFRUhRgAKGjAA+TAEoqU24LJgERMVt7Jyw5MFclDyMiYM5Q3nCrEShHRFQYAEkwADdSXAATAB4AFQA+dIBRBxBCGAAyGABvGAB9XqJCVoBZVAgIYgBzVEoamABfDsNUEqJs4Vz8mABBCABVMFwAR3hUbYdiRyqRGB2YVAAPAjAKiBgAJVRiCvBkR3OnFViGBHHU6DcYAAhe5PVAvN6fb6-f4XK7A0EiBpcLoQqiFGC4MAwADWqEcIEwO1YlHgYGJYBAAHciY9nq9uhDblQAFIEomk8mUyHUmC81lw9n4gD8y1WbUokJ57HF8J2ePYMtp9KZRMoYBWRAh81UGmMrE5MBlxTKyEqVSo23VDAARLg3oRUPliAQKs7WHULZRHYVzcJ5utNgUZDEmcRNGhOBD-NBCITJknDKbDcJbv5NCAQGhgRmQJoAFaoYBQDNqZDIDO0iqoTCE1AVDMQRxaQvrKKwYj7Q4nM6o9LXHMwGQwtlvaMtRlxtDgifbacSt5pfyIn5gP4Ay5VGQNTq7A7HU77q7bBjbAPCOqeCHEIMiAKcBrEXs2WAgYmXdIDmew6Xp45iZAAzKwAT8DAAD0sEwL+lyRN+hggFA6B-o4AGDueI5OKBPDMOE0FwQhgytAAhCI8G3HR9EMYxTEMQAfrcLE0QhKRtG6aH9uMuCTGAi4FFAIBFKU5TVFQxGuu6npfD6foNP4jbNq27bCJxMAAMLbAAao02w1AAy
@devdoomari3
devdoomari3 / gist:eb3036a93dbaffe34fc3a70cc44bf07b
Last active March 5, 2020 02:32
intellij-rust set up stuff
solution for https://github.com/intellij-rust/intellij-rust/issues/4817:
--> https://github.com/intellij-rust/intellij-rust/issues/3628
@devdoomari3
devdoomari3 / check_keys_match.ts
Created July 17, 2020 07:00
typescript type-level example: check keys match
import { Equals } from 'typelevel-ts';
export const __KEYS_MATCH_OK_STRING = 'Keys Match!'
export type isMatch<TType> = TType extends 'T' ?
typeof __KEYS_MATCH_OK_STRING : never;
export type RequireSameKeys<
A extends object,
B extends object
> = {
@devdoomari3
devdoomari3 / readme.md
Last active August 27, 2020 09:46
On Code Complexity, Types, and Protobuf

https://blog.codacy.com/an-in-depth-explanation-of-code-complexity/

I think a lot of people don't know these simple things:

  1. key to reducing source-code complexity = reducing number of possible cases
  • reduce number of cases to think about
  • reduce number of 'what-can-go-wrong?' scenarios
  1. number-of-cases are usually multiplicative between function-calls