what is curl?

curl is tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, POP3 etc) What can I do with curl? You can get the weather: $ curl https://wttr.in You can download hacker news $ curl https://news.ycombinator.com/ You can read a file from Github $ curl https://raw.githubusercontent.com/facebook/react/master/README.md You can even…

curl express hello world

The official express.js hello world example may crash on certain deployments that rely on a certain PORT. Make sure you use the PORT set on process.env if it is set. const PORT = process.env.PORT || 3000 Complete example (code): const express = require(‘express’) const app = express() const PORT = process.env.PORT || 3000 app.get(‘/’, (req, res) =>…

What if we build a knowledge map?

What is a core unit of knowledge? Can you map out a graph of competence based on individual nodes of ability? What does it take to implement a merge sort? Unit: Have a computer Unit: install a programming language Unit: download a text editor Unit: know how to type … etc, etc, This can possibly…

did.txt file

Goal: create an insanely simple “did” file accessible by terminal Time flies by when you’re learning how to code. Its super important to take a second every once in a while to simple write down what you did during the past mental sprint. Writing down what you learned solidifies the knowledge. Cue the did.txt file…

Set up your programming environment

*wip Must have for your Mac Get homebrew – no longer drag an icon to install Homebrew – “the missing package manager for macOS” will make it so much easier to download, upgrade and maintain your packages. It will install packages super transparently in /usr/local/Cellar/* and symlink commands to /bin. Must have for node.js nvm a…

vim settings: tabs, spaces, indents

Basics tabstop – amount to indent when using <Tab> shiftwidth – amount to indent when using ‘>’ or ‘<‘ expandtab – always insert spaces at the amount of tabstop set tabstop=4 set shiftwidth=4 set expandtab   How to change tab size based on filetype setting it inline make sure there are no spaces between the…

How to detect if a user is online

How to detect if a user is online

Many browsers have implemented events “online” and “offline”; in addition to this, browsers also expose the navigator.onLine property that will return “online” or “offline” How many browsers is many? caniuse says every major browser (Chrome, Firefox, Safair, IE11…) except Opera mini has this functionality (as of July 4th 2018). How can I check the online status? > navigator.onLine…