Byte-Sized Tech Tips Round-Up: Week 2

Steve Martinelli - Oct 22 '20 - - Dev Community

Using a Dictionary -- in Bash?!

From

There's already tons of literature on this topic but it's something I learned this week. The reason why I'm doing this will come in another post ;)

Note, you'll need bash 4.0 or newer for this to work.

#!/usr/bin/env bash

declare -A dict

dict=(["fruit"]="apple" ["meat"]="chicken" ["dairy"]="cheese")

for i in "${!dict[@]}"
do
    echo "$i"="${dict[$i]}"
done
Enter fullscreen mode Exit fullscreen mode

Running it prints:

$ ./main.sh 
dairy=cheese
fruit=apple
meat=chicken
Enter fullscreen mode Exit fullscreen mode

Clean up your git changes

From


Git - the tool you never stop learning about. How have I just learned to clean up a bunch of changes in one go?!

git checkout .
Enter fullscreen mode Exit fullscreen mode

And here I was doing git restore foo.bar ... all that time wasted! Thanks JJ Asghar!

Docusaurus

From


This week I got my hands dirty setting up a new site for our Bee Travels project. It uses GitHub pages and is available here.

I've created static sites with GitHub pages before but this time was different because we decided to use Docusaurus which was open sourced by Facebook, see the Docusaurus Git Repo.

I was blown away by just how simple it was to set up and how many things were included out of the box. We were even able to embed a running instance of our application too!

Embedded application
Alt Text

Instructions & Docs
Alt Text

Check out the Bee Travels GitHub Pages Repo for how we configured Docusaurus.

Skype a Scientist

From Nigel

Volunteering and mentoring is essential to growing your career at any company. IBM emphasizes these types of activities. I recently signed up to participate with Skype a Scientist where professionals in STEM fields are connected with schools to present to students.

Yesterday was my first session. I spoke with students from Emerson Elementary School in California. I told them about supercomputers and showed them a few single board computers. They most wanted to know about Minecraft :)

Below are a few of the questions they asked:

  • What kind of a scientist are you?
  • Give us examples of experiments that you do.
  • Do you create video games?
  • Are you always on the computer?

If you're even a little bit interested I would encourage you to sign up as it was a very rewarding experience.

Managing your Node.js versions

From

My FAVORITE tool for managing the various Node.js versions I have installed for different projects is Node Version Manager (nvm). It’s super simple to install and to use.

Pro-Tip: I recommend using Terminal and not iTerm since iTerm will not hold onto nvm and you’ll have to continuously re-install it.

Check out the following tutorial to quickly install and start using nvm! I’ve included the following code snippets as well. Voila!

# Install using curl
curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh -o install_nvm.sh

# run the install script with bash
bash install_nvm.sh

# confirm that your profile is updated *
export NVM_DIR="$HOME/.nvm"
# load nvm *
  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# load nvm bash_completion *
  [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" 

# restart your terminal
source ~/.bash_profile

# verify it worked // should return 'nvm'
command -v nvm

# Using brew, install Node Version Manager (nvm)
brew install nvm

# run the command for next steps to finish the install
brew info nvm
Enter fullscreen mode Exit fullscreen mode

IBM Developer Cloud Native Summit

From


For a longer version of this entry check out Max's blog post

Julia Nash and Upkar Lidder hosted a half-day livestream that focused on Cloud Native technologies this Tuesday.

Alt Text

In case you missed the live event you can watch the replay on Crowdcast.io.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .