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…
All posts by theptrk
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…
Weather reports from your terminal with curl
What is curl? curl is a program that is included in your Mac OSX distribution used for transferring data from or to a server. It uses many supported protocols (HTTP, HTTPS, FTP, SMTP and more). Do you have curl? Find the location of the curl program (executable) with $ which curl. This will return /usr/bin/curl if…
Github Pages tutorial and exploration!
What is Github Pages Github allows free and easy hosting for users to create an html page to represent users, organization and projects. All you have to do is upload your files through version control (git) and Github will serve your html, css and js – all static assets*. How do you create a github…
When should you build your own ecommerce site vs using shopify?
Never. Really not ever if you need to ask this question. If you are building a new shopping experience, you likely aren’t really asking this question. If you simply want to sell stuff online, do not go build a front end, payment system, taxation system, inventory management, temporary sales management, email collection, analytics, reviews, tags,…
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
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…