Switch between multiple versions of Node with Homebrew

# install LATEST stable version of node
$ brew install node

# install OLD version of node
$ brew install node@8

# check version of installed node
$ node -v
v10.4.1

# unlink LATEST version of node
$ brew unlink node

# link OLD version of node
$ brew link node@8

# update bash profile to point to OLD version
$ echo 'export PATH="/usr/local/opt/node@8/bin:$PATH"' >> ~/.bash_profile

# open a new terminal window and verify version
$ node -v
v8.16.1

References
https://discourse.brew.sh/t/managing-brews-node-versions/2395

How to Git Rebase!

$ git checkout feature/myfeature
$ git rebase origin/master
...
<resolved conflicts>
...
$ git rebase --continue, git rebase --continue, …
$ git push -f origin feature/myfeature

As the referenced StackOverflow discussion describes:

“When performing a merge, ours refers to the branch you're merging into, and theirs refers to the branch you are merging from. So if you are trying to resolve conflicts in the middle of a merge:

  • Use ours to accept changes from the branch we are currently on

  • use theirs to accept changes from the branch we are merging into.

When rebasing, ours and theirs are inverted. Rebases pick files into a "detached" HEAD branch. The target is that HEAD branch, and merge-from is the original branch before rebase. That makes:

  • ours the anonymous one the rebase is constructing, and

  • theirs the one being rebased;

Resolve conflicts using THEIRS when re-basing

So, suppose you’ve just checked out branch “feature/myfeature“, then kicked off the rebase “$ git rebase origin/master“, and merge conflict [ CONFLICT (content): Merge conflict in themes/themex/dist/css/main.css ] are raised, and you wish to have those changes introduced in “feature/myfeature“ override what’s in master branch, then you’d want to resolve conflicts using theirs. This is because when you’re merging “feature/myfeature“ into master, then you’re switched into the master branch and changes are replayed on top of that branch, and hence the theirs will now be referring to “feature/myfeature“.

I.e., rebasing replays the current branch's commits (one at a time) on top of the branch that we intend to rebase with.“

References

Add Dock Spacer on Mac

  1. Start Terminal.

  2. Run command to create spacer:
    defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'

  3. Reload Dock:
    killall Dock

  4. Run the following commands below.

  5. Close, re-open and re-run commands in step 1 in Terminal to add extra spacers.

SilverStripe 4 Vagrant Setup Instructions — Mac

# install homebrew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

### INSTALL PREREQUISITES

# instal vagrant
$ brew install vagrant-completion

# install composer
$ brew install composer

# install node
$ brew install node

# install yarn
$ brew install yarn

# install virtualbox
$ brew cask install virtualbox

### CLONE REPO

# create directory
$ mkdir ~/Sites/newsite

# clone repo (and optionally switch to desired branch)
$ cd ~/Sites/newsite
$ git clone https://yourusername@bitbucket.org/newsite/newsite.git .
$ git checkout RESOURCE-REFACTOR

# copy .env.example to .env
$ cp .env.example .env

# setup vm
$ cd ~/Sites/newsite
$ vagrant up

# ssh into vagrant box
$ vagrant ssh

# switch php version and verify version
$ sudo php-switch 7.1
$ php -v

# install php dependencies
$ composer install

# exit vm
$ ctrl + d

# install and build js dependencies
$ cd ~/Sites/newsite
$ yarn install

# rebuild project
http://192.168.123.123/dev/build?flush=1



Configure IIS to serve SVG and JSON files

This post describes how you can configure IIS to serve .svg and .json files.

  1. Start IIS Manager.

  2. Select your http://localhost connection from the Connections panel.

  3. Select MIME Types configuration.

  4. Click Add … from the Actions panel.

  5. Enter details as follows:
    File name extension: .svg
    MIME Type description: image/svg+xml

  6. Repeat the process for JSON file type.
    File name extension: .json
    MIME Type description: application/json

Webpack Setup

This post describes how to get Webpack up and running, starting with a clean empty project. In addition we’ll explore how to get basic minification, linting and installation of other must have modules to get you started. For more in depth understanding, I recommend you follow the official Webpack starter guide.

Read More