Archives For Mike

Developer setup

January 7, 2020 — Leave a comment


  • Spectacle
  • VSCode
  • Bartender
  • Alfred
  • aText
  • Bear
  • Insomnia
  • iTerm
  • Karabiner
  • Sublime Text

I had set up a Ghost blog using their default Ghost CLI. The options I selected were having a domain, ssl, and using nginx.

In order to have forward to, I edited the default nginx file.

vi /etc/nginx/sites-enabled/

I added to the server-name alongside

server {
    listen 80;
    listen [::]:80;

    root /var/www/; # Used for SSL verification (

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        return 301$request_uri;

    location ~ /.well-known {
        allow all;

    client_max_body_size 50m;

The problem I had was an object with empty arrays in it. If I just checked if the Object is empty, I would’ve gotten a false, because there are arrays.

So we had to iterate through the object, and check if the length of the array is greater than 0. The some function will return true as soon as any key returns greater than 0.

let obj = {
    a: [],
    b: [],
    c: []
Object.keys(obj).some(key => obj[key].length !== 0)

In the network tab, you can add -method: OPTIONS in the filter field.
This will show you all methods outside of OPTIONS.

Software you need

In order to do this, I turned off the Caps Lock button by going to System Preferences -> Keyboard -> Modifier Keys… -> Caps Lock Key to No Action.

I opened Karabiner-Elements and changed my Caps Lock button to the f19 key under Simple Modifications.

I opened Alfred, clicked on keyboard shortcut, and press Caps Lock.
I mapped the Alfred clipboard to CapsLock + Spacebar, so I can have a clipboard manager that’s easy to open.

You should be all set.

P.S. You can also use this trick to open any other software for the Mac OSX.

Sequelize was giving me the following error even without any string based operators.

sequelize deprecated String based operators are now deprecated. 
Please use Symbol based operators for better security, read more at node_modules/sequelize/lib/sequelize.js:236:13

The warning is displayed if you don’t set operatorsAliases, and it absolutely should be displayed if operatorsAliases is not set to some mapping or is set to false.
You can set operatorAliases to false or import Sequelize OP into the Sequelize instantiation.

const Op = Sequelize.Op;
const sequelize = new Sequelize('test', 'test', 'pass1234', {
  host: '',
  dialect: 'mysql',
  operatorsAliases: Op, // use Sequelize.Op
  pool: {
    max: 5,
    min: 0,
    idle: 10000

My Apple Watch would pause in the middle of running and working out, even when I had locked it.

Pressing the crown and the side button while in a locked state will pause exercise mode.
The only way to fix this problem is by putting the watch higher on your wrist and fitting it tighter.

apple watch fitment

apple watch fitment

I was getting annoyed that my Emmet shortcuts were not working in Atom when I’m writing React/JSX files. None of the Emmet shorthands were expanding, until I found this bit of information.

Making Emmet shortcuts work for JSX files in Atom

  1. Open Atom menu -> Keymap…
  2. Add this line to the keymap file

    atom-text-editor[data-grammar=”source js jsx”]:not([mini])’: ‘tab’: ’emmet:expand-abbreviation-with-tab

This will expand .col-sm-8 to

<div className="col-sm-8"></div>


On Mac OSX, it would annoy me whenever I wanted to open a new Chrome browser on a 2nd workspace, and it would autoswitch to the first instance on the 1st workspace. We can disable it by desktop spaces auto-switching by entering a terminal command.

How to Disable Desktop Autoswitching

Open terminal and enter this command:

defaults write workspaces-auto-swoosh -bool NO

Then restart the Dock by entering this command in terminal:

killall Dock

Enable Desktop Autoswitching

Open terminal and enter these two commands:

 defaults write workspaces-auto-swoosh -bool YES
 killall Dock

Scale Value with Javascript

I was looking for a quick and easy way to get a scale value of a css -webkit-transform with javascript.

The html and css:

<div id="transformed"></div>

#transform {
    -webkit-transform: scale(.8);

First, we need to get the property value of -webkit-transform. I’ll use jQuery.

var div = $('#transform').css('transform');

The transform property will return matrix(0.8, 0, 0, 0.8, 0, 0).

To get the scale from the matrix, we will need to turn the matrix into individual values, then we can do math:
var values = div.split(‘(‘)[1];
values = values.split(‘)’)[0];
values = values.split(‘,’);

var a = values[0];
var b = values[1];

var scale = Math.sqrt(a*a + b*b);
console.log(scale) // .80