Skip to content

Posts from the ‘Gatsbyjs Practice’ Category

How I Prepared To Get A Badass Code Review On My Dotenv Variables

January 13th, 2021

olavea

A cat talking on the phone

My 13 Step Badass Code Review Method For Junior Devs

  1. I invite Tom Erik to choose 1 of 2 times for a code review
  2. I prepare
  3. I remind Tom Erik «code review 10:30» on SMS
  4. I call Tom Erik on the telephone
  5. I listen up!
  6. I takes notes
  7. I ship my website in SMS link
  8. I show my code in a shared screen link, using https://whereby.com/
  9. I explain to Tom Erik what I did with dotenv 😺
  10. I say “Tell me what to do”
  11. I do EVERYTHING Tom Erik suggest I do, right NOW 🔨
  12. I say “Thank you” with feeling ❤️
  13. I make SketchNotes from my Tom Erik notes, Right now for 90 minutes.

2. I Prepare By Practicing

«Help I need dotenv?» I said. «What’s up?» Tom Erik said.
And as Merlin said: «Code review badassery favours the prepared junior dev.»

The other day I called up Tom Erik and asked him to review my code. The way I had prepared was according to my father’s rule of thumb about asking for chores to be done on his traditional Norwegian wooden sail ship with a crew of girls and boys, where I spent a few weeks every summer growing up. My father was the captain and owner of the ship and he said to all of us:

«Look. See what needs doing, do the work, then ask me to check your work. Don’t ask me what shall I do now? Don’t ask me how do I do this? On my ship you learn from doing, not from listening.»

So in preparation I try coding and re-coding on the problem I have decided to solve. I spread this out over several days, because daily practice works best for me. I focus on practicing the steps again and again, so that when Tom Erik asked me to do a thing in the code review, it was easier for me to understand what to do. And then I did what he asked me, I  «live coded» Tom Eriks ideas. For example in the code review Tom Erik asks me to:

«Try pasting the key right into gatsby-config.»

«Ok.» I say and do it right then and there.

A cat talking on the phone
Because I was prepared «Ok, I’ll try that NOW!»

9. I explain to Tom Erik what I did with dotenv 😺

bleh bleh

10. I say “Tell me what to do”

11. I do EVERYTHING Tom Erik suggest I do, right NOW 🔨

mkl
bleh

12. I say “Thank you” with feeling ❤️

13. I make SketchNotes from my Tom Erik notes, Right now for 90 minutes.

You see them here as images 😺👍

Do you have a story about a code review? Badassed or not I want to hear your story, so please send me an email at

ola 🐘 olavea.com

Six Benefits I Got From Making My Switch Statement Playfuller

December 20th, 2020

olavea

While I was working on the new «welcome thingy» for new customers in our GatsbyJS app, I asked myself:

«Self, how do I make my switch statement playfuller?»

Because to better remember new JavaScript things I learn, I try to practice in a playfuller way every day 😺.

But before I tell you The Long Story I will jump straight to the benefits to my family and our indie hacked GatsbyJS app from using this excellent tip from the great and powerful Josh W. Comeau. 

Six Benefits For My Family From Making My Switch Statement Playfuller

  1. I got to draw parrots 🦜 and
  2. I got to ask Lillian (5.5 🦄 ) to colour those parrots with her new colouring pens. Why parrots? Look further below 🔽 in the The Long Story.
  3. It saved me programming work. Less code = less bugs 🐛 🦋🐌 🐜 🐝 🦗 🕷️ 🕸️ at least for me 😺
  4. It saved my boss programming work. 😺
  5. The final switch statement made my variable safe from bleeding outside of her snug little case. Better safe than sorry, as my father Captain Vea said.
  6. (Coming soon. This blog-post is still just a draft.)

Send Me YOUR Playfuller Practice Tip

I always look for one more way to practice playfuller, mail me your tip for playfuller programming practice ola 🐘 olavea.com

Ok, let’s go! I are now entering the start of The Long Story.

A long time ago, on a bridge
far, far away ….

DevOla took his first sip of dark coffee and opened issue #182 in the pow-app repo on github. Then he opened the Welcome.js file in VS Code and after ONE look he played with this idea:

I will make my switch statement 🦄 unicorny better by wrapping each case with {}

I will make my switch statement unicorny 🦄 better by wrapping each case with {} or squgglies as Josh W. Comeau calls them. But where I come from we say squigglies are hungry twin parrots squaking  «Mine! Mine!» like the gulls in Nemo. 🐠

Hungry Twin Parrots = squigglies as @JoshWComeau calls {}

Ola function in Gatsbyjs plugin to Use Async Await

August 4th, 2018

olavea

I am helping on a Gatsbyjs plugin to pull in for example a photo from instagram with the instagram oembed api. I am working on a function.

Refactor fetchOembedProviders and fetchOembed to use async / await

Remove the use of .then() and use async/await instead on the fetchOembedProviders and fetchOembed functions in the helper.js file.

How To Use Async Await in a function?

To Use ‘await’ I need to mark the function with ‘async’ so that inside that function I can ‘await’ values. Says Wes Bes, at least that is what I am hearing from Wes Bos video 69 on es6 (buy the Wes Bos es6 video course here for $139)

 

I did not know where in the function to put the ‘async’ so I just tried out a couple of things. Here is one thing I tried, to wrap the function in an ‘ola’ function and let that ‘ola’ function be ‘async’. Then inside that ‘ola’ function I can ‘await’ values.

 

Gatsbyjs plugin

What if I wrap the function in an ‘ola’ function to Use Async Await?
If so:

  • where does the ‘async’ go?
  • where does the ‘await’ go?