/blog notes

portfolio & contact info

SEMVER

semver Semantic versioning is way to specify software features and compatibility with a three part version number. There are specifications for each of the three numbers, as set out by semver.org. These images are from a presentation I did at Galvanize.

official rules:

semver

alternative way to remember:

semver

example timeline

as software is developed / fixed / improved, the version numbers is incremented. when you npm init, your package will default to version v1.0.0. An alternative is to start at v0.1.0, which is considered to be in development (v0.x.x).

semver

package.json

npm parses the version number. A tilde~ before the version number will allow increments of the FIX version, but not to the BREAKING or FEATURE versions. A caretβŒƒ will allow increments of both the FIX and FEATURE versions*. This more liberal behavior will allow backwards-compatible features to be added.

npm --save some-package will add the current version of some-package to your package.json appended with a caretβŒƒ.

semver

*dev mode

When in development (v0.x.x), a caretβŒƒ will behave like a tilde~, so it will not increment the FEATURE version number. This is because, "Anything may change at any time." More info here

semver

SEMVER summary

Please note that these versioning rules are not necessarily followed by any particular piece of software being developed. For example, AngularJS allows breaking changes in a new FEARTURE version.

BREAKING FEATURE FIX

my slides

Keyboard Shortcuts

These are potentially useful and time-saving shortcuts that I've found and am in the process of learning. Shortcuts with a πŸ‘ are my most used.

keyboard

mac keyboard symbols

β‡₯ tab ⌘ command
⇧ shift ⎡ space
βŒƒ control ⌫ delete
βŒ₯ option / alt ↩ return
↑ ↓ ← β†’ arrow keys

osx

βŒƒ ↑↓←→ window switching
⇧ ⌘ 3 print screen
⇧ ⌘ 4 print selection
⌘ ⎡ spotlight search
⌘ βŒƒ ⎡ emoji πŸ˜„
⌘ G find next
⌘ , preferences
fn ⌫ delete forward πŸ‘
fn ↑↓ page up / down
⇧ ⌘ Z redo
⌘ ↑↓ cursor to doc start / end
⌘ ←→ cursor to line start / end
⇧βŒ₯ ↑↓ selection to para start / end
⇧βŒ₯ ←→ selection to word start / end
βŒƒ ⌘ F toggle fullscreen

terminal

pwd print working dir
cd dir/subdir to subdir
cd .. to parent dir
cd ../.. to parent of parent dir
cd / to top of boot volume
cd ~ to home dir /Users/jon
cd - to previous dir
ls list files
tree -L 3 dir tree to 3 levels
mv old new rename old to new
mv file ~/dir move file into dir
mv old ~/dir/new move & rename
rm file delete file
rm -R dir delete dir & contents
man ls open ls manual
cat file concatenate & print file
touch file create file or timestamp
echo β€˜str’ > file (over)write str to the file
echo β€˜str’ >> file append str to the file
!! rerun last command
β‡₯ autocomplete πŸ‘
β‡₯ β‡₯ autocomplete options
↑ enter prev command
⌘ K clear terminal
βŒƒ A to line start
βŒƒ E to line end
βŒƒ W remove word
βŒƒ U clear line

sublime

⌘ ⇧ P command palette
⌘ X cut line (if no selection)
⌘ ↩ insert line after
⌘ ⇧ ↩ insert line before
⌘ L select line, next line
⌘ D select word, next word πŸ”΄
βŒƒ ⌘ G get/edit all selection instances πŸ”΄
βŒƒ M jump to closing/opening ( ) πŸ”΄
βŒƒ ⇧ M select ( ) contents πŸ”΄
βŒƒ A go to line start
βŒƒ E go to line end
⌘ K K delete to end of line
⌘ K ⌫ delete to start of line
⌘ ][ indent / unindent
⌘ ⇧ D duplicate line πŸ‘
⌘ J join line below
⌘ / comment / uncomment line
⌘ βŒ₯ / block comment / uncomment
⌘ Y redo / repeat last
⌘ ⇧ V paste with indent πŸ”΄
βŒƒ ⇧ K delete line πŸ”΄
⌘ 1 jump to tab 1
⌘ ⇧ ][ switch tabs
βŒƒ β‡₯ cycle recent tabs
⌘ βŒ₯ (1-5) split view cols
⌘ βŒ₯ ⇧ (2,3) split view rows πŸ‘
⌘ ⇧ L split selection by line
⌘ βŒƒ ↑↓ move line up / down
βŒƒ T transpose chars

chrome

⌘ βŒ₯ J open console
⌘ click open link in background tab πŸ‘
⌘ ↩ open typed URL in background
⌘ L select URL
βŒ₯ ←→ next / previous address term
⌘ βŒ₯ B bookmark manager
⌘ βŒ₯ ←→ switch tabs
⇧ ⌫ go forward
⌘ E use selection for find
⌘ D add bookmark
fn ⇧ ⌫ delete site from autocomplete
⌘ ⇧ R hard page refresh

macdown

⇧ ⌘ H toggle preview pane πŸ”΅

collaboration workflows for git & github

intro

These are notes about using git and github hosted repos as a collaborative tool. They were written while working on nearmeow.

From the git repo readme:

Git - the stupid content tracker

"git" can mean anything, depending on your mood.

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of "get" may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • "global information tracker": you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • "goddamn idiotic truckload of sh*t": when it breaks

list of resources from github

official git user manual

solution to attempted branch switching resulting in a detached HEAD state.


steps taken in the example repo

  1. created new repo (on github)
  2. wrote and committed readme.md and .env files (on github)
  3. cloned (locally)
  4. edited readme.md and wrote to a new js file (locally)
  5. added and commited changes (locally)
  6. branched (on github)
  7. edited readme.md and wrote to a new js file in master (on github)
  8. committed changes to the branch (on github)
  9. git fetch --all to fetch all remote branches
  10. optional git branch -a to see full list of branches
  11. git branch --track firstBranch origin/firstBranch to make new branch and set it to track the corresponding remote branch
  12. optional git checkout firstBranch to switch to that branch
  13. optional git diff or git difftool
  14. git config merge.conflictstyle diff3 to set the default style of merging
  15. from master, merge firstBranch
  16. optional git merge --abort to abandon attempted merge, otherwise add, commit, push

about the git index aka staging area

  • git status shows differences between working directory, index and most recent commit
  • git ls-files shows files in the index

diff tools

merge tools

general links

started 2016-12-14

Notes on Node.js

summary of the Global Objects Node.js v5.4.1 Documentation

Class:Buffer function

{ [Function: Buffer]
  poolSize: 8192,
  isBuffer: [Function: isBuffer],
  compare: [Function: compare],
  isEncoding: [Function],
  concat: [Function],
  byteLength: [Function: byteLength] }
  • function, used to handle binary data
  • TCP streams and file system
  • more info
  • usually use 'utf8' to convert into string object

__dirname string

'/Users/jon/GalvanizeProjects/unit2'

  • dir of this js file
  • local to each module

__filename string

'/Users/jon/GalvanizeProjects/unit2/nodeModules.js'

  • absolute file path
  • local to each module

console object

  • used to pring stdout, stderr

global object

  • unlike browsers, the top-level scope is not the global scope

module object

  • reference to current module
  • module.exports defines what is available from require()
  • lots more
Module {
  id: '.',
  exports: {},
  parent: null,
  filename: '/Users/jon/GalvanizeProjects/unit2/nodeModules.js',
  loaded: false,
  children: [],
  paths: 
   [ '/Users/jon/GalvanizeProjects/unit2/node_modules',
     '/Users/jon/GalvanizeProjects/node_modules',
     '/Users/jon/node_modules',
     '/Users/node_modules',
     '/node_modules' ] }

exports a reference to module.exports

  • local to each module

process object

  • global object
  • instance of EventEmitter
  • lots more
  • process.argv is an array of the command line arguments

require() function

  • to require modules
  • local to each module

setInterval(cb,ms) function

  • run cb repeatedly every ms milliseconds (at minimum)

clearInterval(t) function

  • stop a setInterval() timer, preventing callback execution
  • t is the intervalID
  • timers are global

setTimeout(cb,ms) function

  • run cb after at least ms milliseconds

clearTimeout(t) function

  • stop a setTimeout() timer, preventing callback execution