nikhil.io

one hundred and twenty-five things tagged “programming

Plurals in Python

>>> n = 0 >>> print "%d item%s" % (n, "s"[n==1:]) 0 items >>> n = 1 >>> print "%d item%s" % (n, "s"[n==1:]) 1 item >>> n = 2 >>> print "%d item%s" % (n, "s"[n==1:]) 2 items # If you might want to print negative items, add abs to the test: >&g…

The Universal Estimation Table

Estimate Actual Time Very Easy 1 Hour Easy 2 Hours Quite Easy 4 Hours Looks Quite Easy 6 Hours Average 8 Hours Looks Average 12 Hours No Clue 16 Hours Seems Complex 24 Hours Complex 30 Hours Very Complex 40 Hours Can Take Some Time 48 Hours Fuck 60 Hours Yeah Looks Pre…

On a Program’s Scope

“Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.” Coined by Jamie Zawinski (who called it the “Law of Software Envelopment”) to express his belief that all truly useful programs experience pressure to evolve into toolki…

The Chrome Dino

Here’s a fairly recent (Dec 2018) interview with the creators of chrome://dino. It was called Project Bolan (which I had to look up), had 270M games played every month1, with most users coming “from markets with unreliable or expensive mobile data, like India, Brazil, Mexico, or Indonesia” and took…

Naughty Letter Frequencies in English

Here’s a community-maintained "List of Dirty, Naughty, Obscene, and Otherwise Bad Words" across various languages on Github. I was curious about a naïve frequency distribution of consonants across the English-language corpus (NSFW, obviously) and wrote a small script. Here are the results:…

Disposable Software

The software industry is currently going through the “disposable plastic” crisis the physical world went through in the mid-20th century (and is still paying down the debt for). You can run software from 1980 or 2005 on a modern desktop without too much hassle, but anything between there and 2-3 ye…

On Good Commit Messages

On the developer side, what I hope people are doing is trying to make, not just good code, but these days we’ve been very good about having explanations for the code. So commit messages to me are almost as important as the code change itself. Sometimes the code change is so obvious that no message…

On De-Duplication

I’ve usually heard this phenomenon called “incidental duplication”, and it’s something I find myself teaching junior engineers about quite often. There are a lot of situations where 3-5 lines of many methods follow basically the same pattern, and it can be aggravating to look at. “Don’t repeat you…

Process and Tooling

I thought using loops was cheating, so I programmed my own using samples. I then thought using samples was cheating, so I recorded real drums. I then thought that programming it was cheating, so I learned to play drums for real. I then thought using bought drums was cheating, so I learned to make m…

Dank Typefaces

Was looking try something other than my beloved Operator Mono and came across Dank Mono which claims to be a “rather special coding font.” I love it. Looks like the cooler twin of Inconsolata. I remain quite tickled by how many of my co-workers find the italic variants of monospaced fonts ‘disturbin…

Data, Data, Data

Linus Torvalds on git I’d also like to point out that unlike every single horror I’ve ever witnessed when looking closer at SCM products, git actually has a simple design, with stable and reasonably well-documented data structures. In fact, I’m a huge proponent of designing your code around the dat…

Simpler Gmail

Michael Leggett, lead designer of Gmail from 2008-2012 “It’s like Lucky Charms got spewed all over the screen,” he says to me, as he scrolls through his inbox. It’s true. Folders, contacts, Google apps like Docs and Drive–and at least half a dozen notifications–all clutter Gmail at any given moment…

The Korn Shell

Good talk by Siteshwar Vashisht at FOSDEM 2019 on maintaining the Korn shell and old codebases in general. I came by his work while reading up on the fish shell. Featured this nugget He talks about how they removed dead/inapplicable code and micro-optimizations, refactored a lot of legacy code, imp…

Data, Data, Data

Vicki Boykis’ excellent article on every aspect of ‘Data Science’ I can think of: a little history, employment prospects, skills, education, and continuous learning. It would appear that more than half the job, at least, is wrangling (replicating, cleaning, imputing, transferring, understanding, aug…

JavaScript Delenda Est

Back in the second century BC, Cato the Elder ended his speeches with the phrase ‘Carthago delenda est,’ which is to say, ‘Carthage must be destroyed.’ It didn’t matter what the ostensible topic of the speech was: above all, Carthage must be destroyed. My opinion towards JavaScript is much like Cat…

Alan Kay on OOP

OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I’m not aware of them. – Dr. Alan Kay on the Meaning of “Obje…

Node Modules

For a single project I made the mistake of working on in my Dropbox folder: Wonder what the downsides are to hardlinking by default. And, fundamentally, why creating an amazing, Python-like standard library is such an intractable problem in the first place. […]  core-js is also utils library, qui…

Literary Clock

Made a “Literary Clock” inspired by Jaap Meijer’s repurposing of an old Kindle. Might not be a bad use for an old iPad. Reminds me that I need to get Mark Formanek’s Standard Time onto a Raspberry Pi at some point. Update 08/24/18 There’s an app (of course)…