Code with Hugo

Node.js and JavaScript Guides

  • Home
  • Books
  • Jest
  • Alpine.js
  • JavaScript
  • Node
  • More...
  • Search
  • About
  • Gear & Setup
Subscribe
#git #cli

git diff by word

The default diffing algorithm for git diff is by lines. There are scenarios where it’s more interesting to diff by word, for example: long lines. In that case it’s useful to use --word-diff=color. ...

  • Hugo Di Francesco
    Author
1 min read
#git #github #cli #vscode

git/GitHub CLI set editor to vim or VSCode

The GitHub CLI (gh binary), defaults to nano as its editor. Developers may want to set it to vim or VSCode to keep it in line with the git CLI’s behaviour. ...

  • Hugo Di Francesco
    Author
2 min read
#node #testing #javascript

Node.js Native Test Runner

If anyone missed it, Node.js 18 includes a test runner/test definition module (node --test and node:test respectively). node:test exports a test function and you can run the Node CLI with a --test flag which does some basic search/matching for test files. Full Documentation: node ...

  • Hugo Di Francesco
    Author
3 min read
#alpinejs #javascript

Tips for real-world Alpine.js

Alpine Day 2021 Talk: tackling Alpine FAQs, common issues & web patterns with Alpine.js ...

  • Hugo Di Francesco
    Author
6 min read
#javascript #react #node

Why doesn't React.useEffect run on React server-side renders (SSR)?

Why doesn’t React.useEffect run during a server-side render (SSR) for example when using it inside a Next.js application? The obvious spots in the docs for information like this are the React docs on useEffect and the React docs on string/static rendering neither of which m ...

  • Hugo Di Francesco
    Author
3 min read
#cypress #testing #javascript

Cypress Scroll Position Assertions

This post goes through approaches to asserting on the scroll position. First we’ll see how to assert that we’re at the top of the page. Next we’ll look at 2 approaches to assert that we’ve scrolled to an element. The examples for this post are available at ...

  • Hugo Di Francesco
    Author
4 min read
#javascript #typescript

What is the "?." JavaScript/TypeScript operator

In JavaScript and TypeScript, the “?.” operator is called optional chaining. It works in a similar fashion to the . (chaining) operator, except that it short-circuits instead of causing an error when a value is null or undefined. That means const obj = {}; console.log ...

  • Hugo Di Francesco
    Author
2 min read
#cli

Convert images to data URLs at the command line (Mac OS)

Converting images to data URLs using the Mac OS command line is a fun demonstration of the command line’s capabilities. To convert an image file to a data URL, we can use the following shell function: function img-data() { TYPE=$(file --mime-type -b $1) ENC=$(base64 $1) ech ...

  • Hugo Di Francesco
    Author
3 min read
#php

The Future of PHP: Is It a Dead Programming Language?

There’s an opinion that PHP is dead today, but is this true? Should we believe in this or only people who don’t like PHP are sharing this news? Why do people hate PHP? Let’s take a closer look at PHP and try to predict its future. ...

  • Hugo Di Francesco
    Author
4 min read
#beginner

Tips For Students Choosing Their First Programming Language

More and more colleges offer their students the opportunity to try their hand in coding. With technologies continuing making massive inroads people’s our everyday lives, such professions as a computer programmer, web developer, software engineer, mobile app developer, and o ...

  • Hugo Di Francesco
    Author
5 min read
Page 1 of 13  Previous Posts →

Get The Jest Handbook (100 pages)

Take your JavaScript testing to the next level by learning the ins and outs of Jest, the top JavaScript testing library.

Find out more close
Code with Hugo
Latest Posts Twitter Github Medium