Decorators in JavaScript 🖌️

When it comes to decorating, I’m about as useful as a flashlight in broad daylight 🔦! Play Sorry, your browser doesn't support embedded videos. (() = { const autoplay = "autoplay" === 'autoplay'; const loop = "loop" === 'loop'; const playbackRate = parseFloat("1") || 1; const replayButtonText = "Replay"; const videoId = "video-1"; const video = document.getElementById(videoId); const videoControls = document.getElementById("video-controls-1"); const playButton = document.getElementById("play-1"); const videoWorks = !...

September 21, 2023 · 4 min · Phil Static Badge

Visual Testing With Cypress

Setting the Scene 🖼️ It’s Friday evening, the sun is shining 🌞, you’ve just deployed the latest UI changes to production. Just as you’re about to put those feet up and order that takeaway… Those shrieking voices coming from all angles 😨; " The website isn't loading! " " The screen is completely blank!! " " We can't see anything!! " Clearly, something is amiss here. Let’s check the build…...

June 27, 2021 · 8 min · Phil Static Badge

Web scraping to create an api in 5 minutes!

Disclaimer Web scraping is a grey area - be sure to research the legality of the source you intend to scrape! Setup ⚙️ Prerequisite Presuming you have Node.js installed let’s jump right in and create the endpoint! (If you don’t head over to https://nodejs.org/en/) 5 Minutes is ambitious so let’s get moving! Setting up our server Fire up a terminal and type the code below to get a default package....

March 5, 2021 · 3 min · Phil Static Badge

My most used features in ES2020

Overview 📄 With ES2020 being finalised there have been some great new additions. I wanted to take a look at two of my most used ES2020 features and what makes them great. So let’s jump right in! Nullish Coalescing ❔❔ Nullish coalescing is a logical operator that will return its right-hand statement when the left is null or undefined. Think logical || but explicitly for null or undefined values. Consider the code below using the logical ||...

April 12, 2020 · 2 min · Phil Static Badge

Drag and drop in Angular

Overview 📄 Dragging and dropping has never been easier! Lets make use of the Component Development Kit (CDK) along with Angular 7+ to make some draggable divs in less than a minute! CDK setup ⚙️ Make sure you are on at least V7 of Angular. You can check this by running ng version from your chosen CLI (if you have the Angular CLI installed globally). Start by creating a new project....

February 1, 2019 · 1 min · Phil Static Badge

Use of the :host selector

The :host selector can be used to target custom components from within a css environment. Let’s have a look! 👁️‍🗨️ Given you have a custom component such as; <album></album> In your css you may want to style the album element from within it’s inline stylesheet. This is where the :host selector comes in handy. Consider the below usage to add 10 pixels of margin to the album element. :host { margin: 10px; }

January 9, 2019 · 1 min · Phil Static Badge

ng add

Overview 📄 The Angular CLI recently introduced a new command in version 6.0.0, ng add. At a glance, it looks like an alternative to npm install but let us take a look and see how the two approaches differ. Deeper look at ng add 👁️‍🗨️ In short, ng add will use your package manager to download the specified dependency, just as you would using npm install. Once downloaded the CLI will call an installation script which usually contains instructions on how to configure the project with the new dependency....

January 5, 2019 · 1 min · Phil Static Badge