HomeProjects
 
  
🔍

Conditional GitHub action based on commit message

October 13, 2021

It's really annoying having a certain build/deployment GitHub action run on every push.

You can use this to run it based on the commit message's content:

name: Publish
on:
push:
branches:
- master
jobs:
publish:
if: "contains(github.event.head_commit.message, '[build]')"

Feel free to change the '[build]' part with whatever string you want.

You can also put a ! at the beginning to invert the logic (Run the action on commit messages that DON'T contain a certain string)

Browser frame budget

July 25, 2021

A refresh rate of 60 FPS is typical for any device these days. This means that in the timeframe of 1 second, the browser has to draw 1 frame on the screen, which in turn means that each frame has a time budget of 16.6ms (1 second / 60 frames = 16.66ms). Drawing this frame in 16.6ms includes:

  • Executing JS
  • Calculating styles
  • Calculating layout
  • Painting pixels on layers
  • Compositing those layers

Since all of these tasks run in a single thread, when they take more than ~10ms (not 16ms, because there is also other work being done by the browser), frames start to drop. Drop enough frames and visually perceptible lagginess starts to occur.

Sources: Rendering Performance by Paul Lewis

2020

Arrays passed to template literals get coerced to strings

December 4, 2020

Nice little thing I learned today: When you pass an Array as a value to a template literal, it gets implicitly coerced into a String. Behind the scenes String.prototype.concat is used, as stated in the ECMA-262 specification document.

const fruits = ['apples', 'oranges'];
console.log(`${fruits}`); // 'apples,oranges'

 

© 2024. Made with ♡ by me :)