Pinned Tweet
I finally figured out how to get those pesky semicolons and curly braces out of my Java code
My PR to @chesscom where it randomly gives you 400 puzzle points then takes them away was accepted
Linter said not to nest ternaries so I mixed in if statements:
const onHideButton = type => {
if (hideButton === null) {
return sudo ? onParentHideButton(type)
: !sudo ? true : undefined
} else {
return hideButton ? undefined
: onParentHideButton(type)
}
I write a script called "d" to deploy to prod, then realized I could golf the one character name down to zero! I have since mapped the F3 key to deploy to production. Very satisfying code golfing, plus it cuts our time to launch deployments by 50%
Someone copied an existing method of mine and removed the curly braces to reduce the line count
The Dutch government was forced to release the source code of their DigiD digital authentication iOS app. It is written in C#.
github.com/MinBZK/woo-beslui…
I'm getting better at software reuse. I had an old concurrent program whose purpose I forgot, so I repurposed it as a random string function
Enjoying these React Hooks. Been working on my
usePython
hook for the last three years. About 60% done so it should be ready in late 2023
Tired: __ to "hide" props in Python
Wired:
class Thing:
def __init__(self, desc):
Thing.__str__ = lambda s: desc
t = Thing("works")
print(t) # => yes, prints "works"
Fortunately the JavaScript floor operator ~~ is idempotent so you can repeat it often to make those important type conversions easy to find at a glance
console.log(~~~~~~~~~~~~~~~~(100/7))
Before you look at my code, it is both clean and not clean at the same time
Just kidding, you don't need to look
Writing `def draw() ...` then `g.draw = draw` felt redundant and wasted a line of code so I fixed it
g.draw = lambda: \
g.background("skyblue") and \
g.fill("yellow") and \
g.ellipse(g.width, 0, g.height / 2)
JS has null for positively no data, but undefined can mean either i-dont-know-maybe OR i-know-but-none-of-your-business. In my code I keep undefined for the former but for the latter I use
const undephined = {}
It's perfect bc with knowledge it isn't nullish







