Get environmental variables in NextJs

NextJS has a built-in support for environmental variables. This is how they do it

import { loadEnvConfig } from '@next/env';
const { API_URL } = loadEnvConfig('./', true).combinedEnv

This is useful for when you need to manually access what’s in those .env.* files.


how long does it take to port ATT prepaid number to google voice

It takes exactly 24 hours. It’s so precise, it’s mostly likely a timed job that google runs at the exact 24 hours mark.


Canon MG7520 scanner bricked after Mac OS X Catalina upgrade

I have a Canon MG7520 printer scanner. After upgrading to Mac OS X Catalina, I can no longer find the scanner. Apparently Apple stopped supporting the driver so now my scanner is bricked.

To use it, I had to download a Windows VM from the Microsoft website. I run my VM in Bridge Network mode, connect to the printer scanner and use it that way.



Travis Credit Union terrible UI design

I’ve clicked on the back button EVERY SINGLE time without fail.
Whoever built and QA this is incompetent.


How to restore database in a mssql docker container using .bak

Start the container and attach the local folder to the docker container

docker run -v /Users/mac/data:/sqldata -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>' -p 1433:1433 -d microsoft/mssql-server-linux:latest

Run the restore database command

sqlcmd -S localhost,1433 -U SA -P '<YourStrong!Passw0rd>' -Q "USE [master] RESTORE DATABASE [mydatabase] FROM DISK = N'/sqldata/MyBackup.bak' WITH FILE = 1, MOVE 'MyBackup' TO '/var/opt/mssql/data/MyBackup.mdf', MOVE 'MyBackup_log' TO '/var/opt/mssql/data/MyBackup_log.ldf', NOUNLOAD, REPLACE, STATS = 1"

The WITH MOVE is important


Godaddy managed wordpress upload http error

To fix this, log in using sFTP.

Then go to /wp-content/uploads/

Then delete the folder for the month you wanted to upload.

This is a 403 Forbidden error. I am guessing somewhere along the line, the permission of the folder gets screwed up so you can’t upload anything into the folder. Deleting it and allowing wordpress to create it again fixed the issue.


How to hang pictures straight on drywall

Of all the things my wife asks me to do around the house, the thing I hate most is hanging pictures. I am a perfectionist, so when I hang pictures, it has to be straight. I also hate putting more holes than I have to in the drywall.

It used to take me over an hour to hang a picture, because I have to take a ton of measurements, and do all sorts of stuff to the drywall to make the picture hang straight and secured. I really hate drywall and all the fastening hardware they make for it. None of them work well. One little tug and you will rip them right out of the wall. They are also a pain in the butt to work with. You have to hammer a lot of them in, but they are made of cheap plastic, so the moment you take a hammer to them, they smash into bits. I can’t count the number of unnecessary holes I’ve created because of bad drywall anchors.

But, today I discovered a technique that works really well and is super fast.

Here are the tools you need

  1. A laser leveler – Like this one: Bosch GLL 30 – It will help you draw a straight line on your wall, making it much easier to take measurements
  2. These monkey hooks
  3. A standard level – to make any offset from your laser line

Here are the steps you take

  1. Shine the laser line where the frame should be hung, specifically on where the hooks will be.
  2. Use your standard level to make sure everything is leveled, or measure any offset you need to measure and mark the spot
  3. Push those monkey hooks into the wall

That’s it. You’re done. No need for any other tools. No screw driver, no cleaning up drywall dust, no marking reference points or checking if everything is leveled. So simple. Can’t believe it took me so long to figure this out.


How to use SheetJS XLSX with Angular 4 Typescript in the browser

It took me a while to figure this out, so I’ll share my code here.

You will need the `file-saver` and `xlsx` npm packages.

There are two important parts:

1. Make sure you specify the `meta` section in systemjs or else it won’t load `XLSX.utils`

2. Use the correct `XLSX.write` parameters, otherwise you will get `nodebuffer is not supported by this browser`


heroku npm install not updating because of cache

Wasted a frustrating hour trying to figure out why `npm install` and `npm install foobar` would not update my package.

Finally found this:

Their caching is very rigid. Even if `npm install` runs and it tells you the package is updated, it won’t update. The cache will just replace itself. Even deleting the entire node_modules directory via `heroku run bash` did not work

heroku config:set NODE_MODULES_CACHE=false
$ git commit -am ‘disable node_modules cache’ –allow-empty
$ git push heroku master

Running the above finally did the trick.


How to run angular 4 karma tests on circleci

Here is what I had to add to my circle.yml

version: 6.10.1

- npm run-script test:once

1) Setting node version is important on CircleCI otherwise you’ll get a bunch of peer dependencies errors.
2) Karma is set up to run tests continuously, which is not good on CircleCI.