- ✅/✔️: Correct. Use it when you want to assert something is factual. Use it with care, and be skeptical of yourself. It can also be used to say something is "done".
- ⬆️/🔼/☝️/👆: ×2/ditto. When you want to repeat whatever someone said, without actually repeating. Useful to emphasize/approve the content of a message, even if you disagree with the person that said it.
- 👍: Like. To show agreement or subjective approval, or to say that you simply like/support something. Can be used to say "got it", "thanks", and even "you're welcome".
- 💯: Definitely/definitively. When you absolutely couldn't agree more! Keep in mind this is still subjective. Don't use it for facts, unless paired with "✅".
- ❤️: Love!. Use it to show your fondness or appreciation for something/someone. I won't go into details about colors, as there's no consensus. Can be used to say "thank you!".
- 🗿: Based. Use it when someone is a giga-chad or said something [based](https://www.urbandictionary.com/define.php?term=ba
- Feature Name:
pattern_types - Start Date: (fill me in with today's date, YYYY-MM-DD)
- RFC PR: rust-lang/rfcs#0000
- Rust Issue: rust-lang/rust#0000
This RFC introduces pattern types, which are subtypes of matchable types that
are statically restricted to a subset of the variants of the original type.
Let's list here crates that enhance Rust as a language.
It not "batteries" like in stdx, but Rust-specific crates for workarounds for various missing features and experimental ideals from non-accepted/postponed RFCs, or just hacky tricks.
The list is supposed to contain (mostly) crates that are internal to Rust, not ones for making Rust deal with "external world" like other languages bindings, file formats, protocols and so on.
Primary focus should be on crates that are not easy to find by conventional means (e.g. no algorithm name, format or protocol to search for).
Note that quality of the listed crates may vary from proof-of-concept to stable-and-widely-used.
| import random | |
| import typing.List | |
| def thanos_sort(a: List[int]) -> List[int]: | |
| '''Removes half of the list until it's perfectly balanced, like all things should be.''' | |
| def _perfectly_balanced(a: List[int]) -> bool: | |
| like_all_things_should_be = True | |
| enum RecursionResult<C, R> { | |
| Continue(C), | |
| Return(R), | |
| } | |
| fn tail_recurse<C, R>(mut init: C, mut f: impl FnMut(C) -> RecursionResult<C, R>) -> R { | |
| loop { | |
| match f(init) { | |
| RecursionResult::Continue(c) => init = c, | |
| RecursionResult::Return(r) => return r, |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
- There are always 24 hours in a day.
- February is always 28 days long.
- Any 24-hour period will always begin and end in the same day (or week, or month).
| #!/bin/sh | |
| LANG=C | |
| compile() { | |
| # some preprocessing and basic optimizations | |
| code=$(printf %s "$1" | | |
| (tr -dc '\133\135<>,.+-'; echo) | # ksh's builtin tr doesn't like []<>,.+- | |
| sed -e :a -e 's/<>//g;s/><//g;s/+-//g;s/-+//g | |
| s/\[-]/z/g;s/zzz*/z/g;s/[+-]z/z/g;ta') |
| print(''.join([chr(x) for x in [int(x,16) for x in \ | |
| [str(hex(2 * 2 * 5 * 7 * 37 * 149 * 5417 * 148781 \ | |
| * 51939996061871)[i:(i+2)])\ | |
| for i in range(25)][2::2]]])) |
| /* The world's smallest Brainfuck interpreter in C, by Kang Seonghoon | |
| * http://j.mearie.org/post/1181041789/brainfuck-interpreter-in-2-lines-of-c */ | |
| s[99],*r=s,*d,c;main(a,b){char*v=1[d=b];for(;c=*v++%93;)for(b=c&2,b=c%7?a&&(c&17 | |
| ?c&1?(*r+=b-1):(r+=b-1):syscall(4-!b,b,r,1),0):v;b&&c|a**r;v=d)main(!c,&a);d=v;} |