Posts tagged "JavaScript"

Published: February 03 2024

JavaScript - Add Business Days to Date (exclude Holidays & Weekends)

The below code sample shows how to add business days to a date, excluding weekends and public holidays in any specified country and state/region.
Published: July 21 2023

Vanilla JS - HTML Encode in JavaScript

HTML encoding simply replaces HTML special characters like angle brackets with HTML entities so they can be displayed as plain text in a web page.
Published: July 07 2023

Vanilla JS - Slugify a String in JavaScript

A slug is typically all lower case, separated by dashes (hyphens) instead of spaces and doesn't contain any special characters.
Published: June 06 2023

Add Google AdSense to a Single Page App - React, Angular, Vue, Next etc...

I recently integrated Google AdSense into my AngularJS blog and this is how I got it working.
Published: April 13 2023

Next.js 13 Middleware for Authentication and Error Handling on API Routes

This is a quick post to show how to add authentication and error handling middleware to all API routes of a Next.js 13 application.
Published: January 06 2023

JavaScript - Add Event Listener to Multiple Elements in Vanilla JS

This is a super quick post to show how to add an event listener to multiple HTML elements in pure JavaScript.
Published: January 04 2023

Vanilla JS + CSS - Modal Popup (Dialog) Tutorial with Example

This is a quick post to show how easy it is to implement modal popups in pure HTML, CSS and JavaScript.
Published: December 16 2022

JavaScript - Sort an Array of Objects by Property in Vanilla JS

This is a super quick post to show how to sort an array of objects by property value in JavaScript (or TypeScript).
Published: December 06 2022

JavaScript - Initialize Array with Conditional Values or Objects in Vanilla JS

This is a super quick post to show how to initialize an array with conditional values in JavaScript (or TypeScript).
Published: October 15 2021

Vanilla JS - 7 ways to convert a string to a number in JavaScript

Some quick examples of how to convert a string to a number in JavaScript
Published: October 02 2021

Vanilla JS - Create an array with a range of numbers in a JavaScript

Some quick examples of how to generate a range of numbers in an array in JavaScript.
Published: September 14 2021

Vanilla JS - Get the max prop value from an object array in JavaScript

A quick example of how to get the maximum value of a property in an array of objects in JavaScript
Published: August 23 2021

Next.js API - Global Error Handler Example & Tutorial

This is a quick post to show how to implement a global exception handler in a Next.js API.
Published: August 20 2021

Next.js API - Add Middleware to API Routes Example & Tutorial

This is a quick post to show how to add middleware to the request pipeline of a Next.js API so it supports similar functionality to ExpressJS.
Published: July 22 2020

Node.js + Express API - Request Schema Validation with Joi

This is a quick example of how to validate HTTP request data using the joi schema validation library in a Node.js + Express API.
Published: July 20 2020

Node.js - Send Emails via SMTP with Nodemailer

This is a quick example of how to send an email in Node.js using the nodemailer email sending module.
Published: July 20 2020

Node.js - Hash and Verify Passwords with Bcrypt

This is a quick example of how to hash and verify passwords in Node.js using the bcryptjs password hashing library which is a pure JavaScript implementation of the bcrypt password hashing function.
Published: April 22 2020
Last updated: July 06 2020

React Boilerplate - Email Sign Up with Verification, Authentication & Forgot Password

How to build a boilerplate authentication system in React including email sign up & verification, authentication & role based authorization, forgot password & reset password functionality, view & update my profile section, and admin only section for managing all user accounts.
Published: March 10 2020

React + Fetch - Fake Backend Example for Backendless Development

An example of backendless development with React and the Fetch API, includes "pass through" to real backend for unmocked URLs.
Published: August 21 2019

Vue.js - Simple Pagination Example

A simple example of how to implement client-side pagination in Vue.js.
Published: August 12 2019

Vue.js + Node - Server Side Pagination Tutorial & Example

A simple example of how to implement server-side pagination in Vue.js with a Node.js backend API.
Published: July 18 2019

React + Node - Server Side Pagination Tutorial & Example

A simple example of how to implement server-side pagination in React with a Node.js backend API.
Published: June 28 2019

Angular 8 + Node - Server Side Pagination Tutorial & Example

A simple example of how to implement server-side pagination in Angular 8 with a Node.js backend API.
Published: November 28 2018
Last updated: July 02 2020

Node.js - Role Based Authorization Tutorial with Example API

How to build an API with role based authorization / access control in Node.js & JavaScript. Includes example client apps built with Angular, React and Vue.
Published: September 24 2018
Last updated: September 10 2020

NodeJS - Basic Authentication Tutorial with Example API

How to implement Basic HTTP Authentication in Node.js with JavaScript. Includes example client apps built with React, Angular & Vue.
Published: August 07 2018

JavaScript - Pure Pagination Logic in Vanilla JS / TypeScript

Pure pagination logic written in JavaScript and available on npm
Published: August 06 2018
Last updated: April 14 2023

Node.js + Express 4 - JWT Authentication Tutorial with Example API

How to implement JWT authentication in Node.js with Express.js. Includes example client apps built with React, Angular, Vue & Blazor.
Published: June 14 2018
Last updated: July 02 2020

NodeJS + MongoDB - Simple API for Authentication, Registration and User Management

A clean and simple custom NodeJS API for Login, Registration and User Management. Includes example client apps built with React, Angular & Vue, and instructions on testing with Postman and deploying to AWS and Heroku.
Published: May 23 2018

Node - Get Public Key From Private Key with JavaScript

How to get the public key from a private key using JavaScript running on Node. Useful for AWS Key Pairs.
Published: July 19 2016

Plunker - Embed Only Preview Pane

How to embed a plunk showing only the preview pane, plus other display options.
Published: February 09 2016
Last updated: July 29 2021

CSS3 - Sticky Header on Scroll Example

How to add an animated sticky header to a website using almost pure CSS with just a touch of javascript.
Published: January 31 2016

AngularJS - Pagination Example with Logic like Google

Google style pagination logic in AngularJS and JavaScript.
Published: November 07 2015

AngularJS - Google Analytics with the UI Router

This is a quick post to show how to setup Google Analytics page/route tracking in an Angular application that uses the UI Router.
Published: May 26 2014

AngularJS Basic HTTP Authentication Example

An example of how to setup a simple login page with HTTP Basic Authentication using AngularJS, and also keep the user logged in after the page is refreshed.
Published: April 18 2014

Post a simple string value from AngularJS to .NET Web API

How to post a simple string parameter in the body of an HTTP request from AngularJS to ASP.NET Web API
Published: March 25 2014

AngularJS - A Better Way to Implement a Base Controller

The simplest way to setup controller inheritance in AngularJS.
Published: February 15 2014

AngularJS - Reverse Geocoding Directive

This is a little custom AngularJS directive that converts GPS coordinates (latitude/longitude) into an address, otherwise known as reverse geocoding, using the Google Maps API.
Published: May 08 2012

Add HTML5 placeholder support to older browsers

This is a handy javascript function that I use on a lot of my sites to ensure that the html5 placeholder attribute is supported by older browsers.
Published: December 16 2011

jQuery Searchable DropDown - fixes for IE9 bug and dynamically added items

I recently tried out the jQuery Searchable DropDown (v1.0.7) from http://jsearchdropdown.sourceforge.net/ and it worked perfectly except for 2 things:
Published: November 18 2011

Validate date dropdown lists with JavaScript / jQuery

A simple javascript function for validating a date that's input using 3 dropdown lists
Supported by