Skip to content

Instantly share code, notes, and snippets.

@JoniWeiss
Created October 7, 2016 05:56
Show Gist options
  • Save JoniWeiss/e5a4044c9610edc8a0f2c4878539e5fd to your computer and use it in GitHub Desktop.
Save JoniWeiss/e5a4044c9610edc8a0f2c4878539e5fd to your computer and use it in GitHub Desktop.
Mac Command Line for Web Devs

Mac Command Line for Web Devs

Handy Tools

  • mdn-search.
    • Quick tool for search in Mozilla Developer Network from command line, built with nodejs by Nicolás Arias (ezakto):

    • Usage:

    mdn   [options]   [command]   <query>
  • Dash for macOS.

    • Dash is an API Documentation Browser and Code Snippet Manager.
    • Dash stores snippets of code and instantly searches offline documentation sets for 150+ APIs.
    • You can even generate your own docsets or request docsets to be included.
    • See Function below for a CLI function to work with Dash.
  • Atom Snippets.

    • Replace tag/element expansion with your customized one (Ex.: html).
    • Add the following to your snippets file to replace functionality of html autocomplete to include viewport tag:
'.text.html, .atom/language-html':
   'HTML':
      'prefix': 'html'
      'body': '<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<meta charset="utf-8">\n\t\t<meta name="viewport" content="width=device-width, initial-scale=1">\n\t\t<title>$1</title>\n\t</head>\n\t<body>\n\t\t$2\n\t</body>\n</html>'

Command-Line Tools:

  • Open current directory in MacOS Finder
    open -a Finder ./
  • Create a bash alias called “f”:
    alias f='open -a Finder ./'
  • Open Dash app from command line:
    open -a Dash
  • Open Dash app from command line and search for ‘flex’ in CSS documentation:
    open dash://css:flex
  • Open MDN in Chrome browser:
    mdn open
  • Open MDN in Chrome browser and search for ‘flex’ in CSS documentation:
    mdn -o -t css flex

Bash Aliases & Functions

  • Alias for ls -l command:
    alias lsl=‘ls -l’
  • A fancier ls -l command (try it!):
    alias ll='ls -FGlAhp'
  • Clear terminal display (without affecting history):
    alias c='clear'
  • Create a bash function called “dash” as a CLI for Dash macOS app:
function dash() {
    open "dash://$*"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment