CSS :out-of-range

One aspect of web development I’ve always loathed was working with forms. Form elements have been traditionally difficult to style due to OS and browser differences, and validation can be a nightmare. Luckily the native HTML APIs added methods for improving the form validation situation. With input[type=number] elements, you can add min and max attributes. Those attributes are great but the browser doesn’t display distinct error styles if those numbers are out of range. Luckily we have :out-of-range: /* matches when number is not within min and max */ input[type=number]:out-of-range { border-color: red; } Thanks to CSS :out-of-range, developers can style input elements based... more →
Posted in: JavaScript

Monitor Events and Function Calls via Console

Despite having worked on the very complex Firefox for a number of years, I’ll always love plain old console.log debugging. Logging can provide an audit trail as events happen and text you can share with others. Did you know that chrome provides monitorEvents and monitor so that you can get a log each time an event occurs or function is called? Monitor Events Pass an element and a series of events to monitorEvents to get a console log when the event happens: // Monitor any clicks within the window monitorEvents(window, 'click') // Monitor for keyup and keydown events on the body monitorEvents(document.body, ['keyup', 'keydown']) You can pass an array of events to listen for multiple... more →
Posted in: JavaScript

Investigating IndexedDB Wrapper Libraries – Part Three

Welcome to the third and final (for now) entry into my series looking at wrapper libraries for working with IndexedDB. I began this series earlier this month demonstrating a simple Contacts database implemented with IndexedDB. In the second entry, I demonstrated how the Dexie library made working with IndexedDB much simpler. Today I’m going to look at my last "planned" entry (I may revisit this again if I find more) in this series – using DPP, or Deep Persistent Proxy Objects for JavaScript. Raymond Camden… more →
Posted in: JavaScript

Adding Social Share Links in Eleventy

One common feature of content sites (including this one), is links/buttons/etc to share a piece of content on social media. Typically this is Twitter, but many sites will include ways to share links on Facebook, LinkedIn, and more. A reader asked me a few days ago about how this could be done in Eleventy and I thought I’d share a quick example. Raymond Camden… more →
Posted in: JavaScript

git Force Push

Rebasing is a frequent task for anyone using git. We sometimes use rebasing to branch our code from the last changes or even just to drop commits from a branch. Oftentimes when trying to push after a rebase, you’ll see something like the following: hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. Commonly developers will use the --force or -f flags during a push to force pushing code changes: git push origin my-branch --force # or git push origin my-branch -f I was recently... more →
Posted in: JavaScript

Specify Node Versions with .nvmrc

I’ve heavily promoted nvm, a Node.js version manager, over the years. Having a tool to manage multiple versions of a language interpreter has been so useful, especially due to the complexity of Node.js package management. One tip I like to give new developers is adding a .nvmrc file to their repositories. The file contents is just a simple string representing the version of Node.js the project requires: v16 A project with this .nvmrc is specifying that Node.js v16 should be used. Any developer could then run nvm use to download, install, and switch to that version. A nvm install call would then install dependencies in line with that version. The post Specify Node Versions with .nvmrc... more →
Posted in: JavaScript

Building a Web-Based Badge Scanner

I’m at a conference now working a booth (well, at least when I started writing this), and I really didn’t realize how much I enjoyed this part of the job. While I’ve attended a few conferences post COVID (err, well, "post" may be too strong of a word), this is the first booth I’ve worked at in years. One of the first things I did when I arrived was check and see how we were going to get contacts via badge scanning. Not surprisingly, the conference organizers suggested a native app. Me being me – I immediately thought of how the app’s features could be accomplished via the web. There’s nothing wrong with the... more →
Posted in: JavaScript

How to Migrate from Lunr to Algolia – a Technical Guide

Search is an incredibly important aspect of any site hosting even a small amount ofcontent. How quickly your site can provide search results and how well your resultsmatch the user’s intent is critical. There are multiple search options available fordevelopers, and so sometimes in the pursuit of speed and relevance, a site will migratefrom one service to another. In this article, I’m going to present a use case for why a sitemay move from a self-hosted solution like Lunr to a server-based solution like Algolia. I want to stress that this is not meant to be an attack on Lunr, but more where it would beappropriate for a site and what the benefits... more →
Posted in: JavaScript
1 46 47 48 49 50 104