Code with Hugo

Node.js and JavaScript Guides

  • Home
  • Books
  • Node
  • Testing
  • JavaScript
  • More...
  • Search
  • About
  • Gear & Setup
Subscribe
#jest #testing #javascript #node

What is Jest and why should I use it?

Jest is a delightful JavaScript Testing Framework with a focus on simplicity. jestjs.io Jest is a batteries-included framework. Due to its fully-featured nature and large surface area, we can compare it to test runners (Mocha), assertion libraries (Chai, ShouldJS, power-assert, ...

  • Hugo Di Francesco
    Author
7 min read
#golang #go

Concurrent/Parallel HTTP Requests in Go

A common source of high latency in all types of applications (scripts, HTTP servers, CLI tools), is to run HTTP requests in sequence that could be run in parallel. We’ll be looking at how to achieve this in Go. Examples for concurrency in the Go ecosystem tend to be more ab ...

  • Hugo Di Francesco
    Author
10 min read
#markdown

Markdown escape backticks in inline code and fenced code blocks

When writing technical documentation, blog posts or conducting code reviews, it can be useful to render backticks in Markdown inline code, code blocks or fenced code blocks. Since backticks are part of the Markdown syntax for inline code and code fences, this post looks at how to ...

  • Hugo Di Francesco
    Author
2 min read
#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:test #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
4 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
← Next Posts Page 2 of 14  Previous Posts →

Interested in Alpine.js?

Power up your debugging with the Alpine.js Devtools Extension for Chrome and Firefox. Trusted by over 15,000 developers (rated 4.5 ⭐️).

Install Now close
Code with Hugo
Latest Posts Github