Photo by Ferenc Almasi on Unsplash

All code explained below is available on my GitHub here

The problem

In this scenario your client wants some JSON representation modified from some integer to a string. A common example might be the sample response below:

In the above example, gendercan either be a 0for female, 1for male and 2for non-binary. This data would’ve been fetched from some backend DB as a record where genderis configured to be an integer value.

The client would also like to reformat the value of occupationto be slugged and lowercased. e.g. “Frontend Developer” → “frontend-developer”

Unfortunately, the clients DB is already populated with hundreds…


An effort to make my life a bit more easy

This isn’t my terminal, it’s just a picture of it.

To be honest, this will not be impressive to a lot of developers out there. But for me it was an acomplishment and a moment of learning as a developer that consistently feels slow to catch up, not to mention often intimidated & needed a way to ease his own imposter syndrome. For now anyway.

Before I explain, let me show you my old work flow

The old but sort of simple way


And making it look more appealing than a boring list of repositories

Photo by Yancy Min on Unsplash

Did you know that if you create a Github repository with your username you can unlock a secret? Go on, give it a try! You’ll be pleasently surprised with this alert


Discord & Python 3.x programming

Photo by Michael Dziedzic on Unsplash

Backstory

At the time of this writing, it has been 7 months since the COVID19 pandemic had taken over the world. Making it harder for me & my group of friends to meet with each other. And then one day, one of us decided to put us all together in a Discord channel so we can still hang out virtually.

Discord lets you install bots like Pancake to do other stuff like loading songs from YouTube & playing it on voice channel everyone listening.

And then one day I thought “why waste such an opportunity?” I immediately got to work. At…


Looping through endpoints isn’t bad thing …. or is it?

(Disclaimer: Since I use Python 3 & Django on a daily basis i’ll be using snippets from them as examples.)

Since last year up until now i’ve been struggling with a concept of DRY coding. In a nutshell, “Do not repeat yourself”. So if you can find stuff that’s pretty repetitive, then chances are you ought to automate this to a single source. This way when specification changes you can reduce having to do multiple changes.

And this is great for production code. And probably okay for test code right?

Nope.

Well, theoretically (i thought) yes. We just don’t want to…

Full-Stack Engineer, at one time also officially labelled “Professional Badass”.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store