Cover image for What Did You Learn This Week --May 1?

What Did You Learn This Week --May 1?

waylonwalker profile image Waylon Walker ・1 min read

this-week-i-learned (13 Part Series)

1) What Did you Learn this week --March 6? 2) What Did you Learn this week --March 13? 3 ... 11 3) What Did you Learn this week --March 20? 4) What Did You Learn This Week --March 27? 5) What Did You Learn This Week --April 3? 6) What Did You Learn This Week --April 10? 7) What Did You Learn This Week --April 17? 8) What Did You Learn This Week --April 24? 9) What Did You Learn This Week --May 1? 10) What Did You Learn This Week --May 8? 11) What Did You Learn This Week --May 15? 12) What Did You Learn This Week --May 22? 13) What Did You Learn This Week --May 29?


markdown guide

This week I learned something about noise generation to create something like this

I learned and implemented quad tree instead of spatial hashing but I still don't know what algorithm has the best performance.

I learned about canvas and retina/HiDPI screen, not from zero but I improved my knowledge.

I created other cool feature for particles, not really new things learned, but at least it was the first time for me to do these things


how come the colliding one is all white here but when edit on copepen it has colors


The issue should be fine now, thanks for reporting

ah, I actually like the all-white versions since that lets you see all the particles and collisions without being distracted by color change.

hee hee... and then this is the all-white version: codepen.io/winterheat/pen/RwWjxxR
screen saver: codepen.io/winterheat/pen/qBOVpoB
would be nice to have a background image but can't see it, but the bubbles can let you see through.

If you want to explore almost all features you can checkout this collection: codepen.io/collection/DPOage

I keep it updated, about the background mask the feature was already done: codepen.io/matteobruni/pen/yLNvqxG


There’s a known issue with the canvas blurred, the feature is still under development, about infection timers and the pause on blur feature


This is so reminiscent of the coding train


This week I learned the power of getattr in python. I am using an API that returns an object that is not subscriptable. Attributes are accessed with .thing for instance. Its really nice that it tab completes, but it makes it really hard to loop through and access 10 items. I learned that you can get to them dynamically with getattr.

The backend library essentially looks like this.

class CantGet:
    def __init__(self, items):

It gets instansiated with a dictionary.

cg = CantGet(
    'sales': range(10),
    'production': range(10),
    'inventory': range(10)

You can ask for individual items by dot notation, and tab completion works.

>>> cg.sales

but it's not subscriptable

>>> cg['sales']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'CantGet' object is not subscriptable

So how do you dynamically access it by a string? The answer is getattr!

>>> getattr(cg, 'sales')

Python is such a wonderful and hackable language


This week I learned about how to create a simple react app which will fetch & show data from an API.
Also learned about deploying a react app to netlify.

Here's the result - covid-19-indian-tracker.netlify.app/


Vue slot can be used for multiple layouts.

SQLite PRAGMA functions generate a table, that can be selected.