Worm with Glasses

Coding • DevOps • Personal

Oct 26, 2017

🔗 Delete Your Code

Ruairidh Wynne-McHardy writes:

We are all attached to the things that we create. From our relationships, to our work, to trivial things like the way we decorate our home — we don’t like to destroy things that we have put effort into.

That’s why it’s even more important to delete your code.

Never be afraid to throw away code that’s not working when the requirements change. You know more about the reguirements now than you did when you first wrote the code. Be brave.

Delete Your Code

Oct 26, 2017

🔗 12 Most Common Writing Mistakes You Want to Avoid at All Costs

Entrepreneur has a list of their tweleve most common writing mistakes. These mistakes are targetted to business style writing:

  1. You use industry buzzwords that are hackneyed and phony.
  2. You assume the reader knows the acronyms or identity of the people you mention.
  3. You overuse CAPS and punctuation.
  4. You compose overly complicated, overly abstract or flowery writing.
  5. You mix single objects with plural pronouns or single subjects with plural verbs.
  6. You make one of these common mix-ups. (i.e., between/among, less/fewer, then/than, etc.)
  7. You make vague claims.
  8. You slip into slang.
  9. You use unprofessional-looking font.
  10. You make frequent and immature spelling mistakes.
  11. You use quotes incorrectly.
  12. You start a sentence with a numeral.
12 Most Common Writing Mistakes You Want to Avoid at All Costs

Oct 26, 2017

Oct 18, 2017

🔗 Efficient pagination of a table with 100M records

This Chapter is focused on efficient scanning a large table using pagination with offset on the primary key. This is also known as keyset pagination.

Efficient pagination of a table with 100M records

The key insight is to use the primary key as the offset to avoid missing records (if they’re deleted between invocations) and to increase performance by using a RANGE join type, which is much faster (constant time.)

Simplified algorithm:

  1. We get PAGE_SIZE number of records from the table. Starting offset value is 0.
  2. Use the max returned value for the primary key (i.e., user_id) in the batch as the offset for the next page.
  3. Get the next batch from the records which have the primary key (i.e., user_id) value higher than current offset.

For example:

SELECT user_id, external_id, name, metadata, date_created
FROM users
WHERE user_id > 51 234 123 --- value of user_id for 50 000 000th record
ORDER BY user_id ASC
LIMIT 10 000;

Sep 4, 2017

How to be Miserable

One very sad red ping-pong ball.

Back in May, CGP Grey posted a video based on Randy J. Paterson’s book How to Be Miserable: 40 Strategies You Already Use .

After watching the video, I had to read the book. Both Rosey and I finished it in one night. Within his 40 lessons, we each found a least a few that applied to us.

The book is structured as a series of 40 “lessons” on how to be miserable. Of course we’re not trying to be miserable, but following these lessons tend to make one miserable. To be happy, do the opposite!

Mr. Paterson’s lessons are:

  1. Avoid All Exercise
  2. Eat What You’re Told
  3. Don’t Waste Your Life in Bed
  4. Live Better Through Chemistry
  5. Maximize Your Screen Time
  6. If You Want It, Buy It
  7. Can’t Afford It? Get It Anyway!
  8. Give 100 Percent to Your Work
  9. Be Well Informed
  10. Set Vapid Goals
  11. Rehearse the Regrettable Past
  12. Blame Inward, Give Credit Outward
  13. Practice the “Three Bad Things” Exercise
  14. Construct Future Hells
  15. Value Hope Over Action
  16. Become a Toxic Optimist
  17. Filter for the Negative
  18. Cultivate Your Presence—Elsewhere
  19. Insist on Perfection
  20. Work Endlessly on Your Self-Esteem
  21. Become an Island Unto Yourself
  22. Give Them What They Want
  23. Measure Up and Measure Down
  24. Play to Win
  25. Hold High Expectations of Others
  26. Drop Your Boundaries
  27. Bond With People’s Potential, Not Their Reality
  28. Demand Loyalty
  29. React to Their Motives, Not Their Messages
  30. Cultivate and Treasure Toxic Relationships
  31. Keep Your Eye on the Small Picture
  32. Let Your Impulses Be Your Guide
  33. Look Out for Number One
  34. Duty First, Life Later
  35. Live the Unlived Lives of Others
  36. Stay in Your Zone of Comfort
  37. Avoid Solitude
  38. Choose Fashion Over Style
  39. Pursue Happiness Relentlessly
  40. Improve Yourself

I’d highly recommend watching Grey’s video and then reading the book. It will change how you view yourself.

Sep 3, 2017

🔗 Yes, That Web Project Should Be a PWA

a PWA is a website with special powers. The term “app” in the “Progressive Web App” is not indicative of the sort of content or experience users should expect with a PWA. You shouldn’t get hung up on it; “Progressive Web App” is a marketing term. PWAs have the ability to connect with the operating system (and, thereby, its users) on a deeper level through installation and APIs offering capabilities like notifications, access to the address book, and more. Not all of these APIs require installation for access, but some do. It may help to think about a PWA as being a website++.

Yes, That Web Project Should Be a PWA

Sep 3, 2017

🔗 How to launch a company when investors ain’t writing checks

All we talk about in tech is unicorns, when we should be talking about zebras. Unlike unicorns, zebras are REAL. Zebra companies are black and white — they are profitable and socially conscious. They band together in groups to protect one another. They seek to share resources instead of hoarding them. And they are more concerned about user success than user acquisition.

How to launch a company when investors ain’t writing checks

Sep 1, 2017

Sep 1, 2017

Sep 1, 2017

🔗 One of the fathers of modern computing used this 6-step process to solve any problem

And if this is the case for some of the simplest human activities, it’s far more true for the most complex ones — writing symphonies and novels, developing new technologies, inventing new scientific paradigms. Geniuses are rarely the best teachers, the best critics, or the best explainers. So it’s rare to come across a genius’s account of “how genius works.”

But such accounts do exist, and we were lucky enough to unearth one near the end of our research into the life of Claude Shannon (1916-2001), the intellectual architect of the information age.

One of the fathers of modern computing used this 6-step process to solve any problem