Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile
Uncle Bob's Nibling

@thedirtycoder

Founder, Object Dementor

ID: 1447364456

calendar_today21-05-2013 21:59:38

777 Tweet

2,2K Takipçi

0 Takip Edilen

Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile Photo

In my latest Lua game, I store player info in a table only at Fibonacci indices t = {[0]=pA, [1]=pB, [2]=pC, [3]=pD, [5]=pE, [8]=pF, [13]=pG} so I have lots of extra storage for temp variables and game context (which grows exponentially w/ the number of players so I got this)

Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile Photo

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

Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile Photo

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)

Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile Photo

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))

Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile Photo

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"

Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile Photo

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

Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile Photo

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

Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile Photo

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%

Uncle Bob's Nibling (@thedirtycoder) 's Twitter Profile Photo

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) }