Friendly “time since” counter with vanilla JavaScript
A small vanilla JS snippet that takes a date and prints a human-readable summary like "7 days" or "about 1 year 5…
Quick bites of code from a South Wales-based AI/dev workbench — JS & Node helpers, PHP patterns, WordPress fixes, CSS tricks, AI and automation snippets. No filler, no monster tutorials, no lifestyle intro. Just the bit you came for, plus the two lines of context you need to use it.
A small vanilla JS snippet that takes a date and prints a human-readable summary like "7 days" or "about 1 year 5…
Are you looking to have data on your users country they're visiting from, IP (or more)? Then the below solution will allow…
Using gulp to help organise and control your project assets is a great tool, but trying to set up the config each…
Wordpress handily provides a RSS feed, usually at /feed/ This is accessible externally so it's easy to use this data on external…
A common URL structure or format is to include unique identifying numbers at the end of the URL. This used to be…
If you're a pretty techy web dev worth your salt you'll love playing with new technologies. That may have led you down…
One of the most basic dynamic text areas on a website is the ubiquitous copyright year in a footer of a website.…
Working with dates is a hugely common feature of systems. The problem as humans is we don't have a universally agreed upon…
A very common feature of sites is a subtle design change to the website menu to indicate the current page the user…
Updating and inserting large sets of data into a database (mySQL etc) can be very tedious when the data is linked explicitly…
By default the PHP function strtotime() will take most date formats, and convert them to a Unix/Epoch timestamp. However, as versatile as…
As well as PHP being a very easy code to use language on the web, PHP and localhost can be a great…
A very common feature of forms is the dropdown box, commonly using a range of years as the options. Writing and maintaining…
Have you ever had a folder of images with completely random file names and just wished they were all in a clean…
This is a very easy way of getting a progress bar or similar element to transition from one state/width to another once…
Editors Note: You will first need to purchase/install an SSL certificate and configure it with your server/hosting before any of the following…
Google maps embeds are a very popular feature on most websites, especially on pages such as 'Contact Us' etc. However one very…
Ever needed to update all links from HTTP to HTTPS in your database? This query allows just that, simply change table_name_here, the…
This SASS function provides an easy way to apply styles to all of the 6 standardised HTML headings (h1,h2,h3,h4,h5,h6). This is mainly…
Expanding on my previous Javascript countdown timer, I've got an easy count up from date counter using pure JavaScript here for you!…
Making it evident which page the user is on in relation to the menu is a very common technique, however, there are…
Many times you will want to temporarily put your site into a locked down and/or maintenance mode. This can be for a…
Have you ever wanted a web page to act like a directory? Eg, have /about, but want it to seem as though…
Demo: 1 2 3 Click Clicking the above click box, you will notice the first element and third element get a red…
Javascript is a key way to help users validate forms and inputs, ensuring they can only enter data that is valid. A…
More often than not you'll be using a CMS for your website, this CMS will control all traffic through set files usually…
If you ever change your website URL/Domain, you will want to 301 your old address so that links remain intact that people…
I've created this simple bit of PHP to specify a directory, and then list the files grouped by folder on screen. You…
Justified text is a very popular type of text formatting, most commonly seen in text-based books/novels. It's a very easy technique to…
The web has a wonderful ability to be dynamic, this is the way it should be. We don't need to rely on…
Basic Example - Counting down to Jan 5th, 2028 15:00:00 00days00hours00minutes00seconds This code byte provides a very simple way of producing a…
This Code Byte provides a really nice way to fade in an object/image/text just as it's brought into the view of the…
cURL can be used to grab data, information, or even a whole webpage from a designated URL. This can be very useful…
This Code Byte provides a very simple & cheeky/lazy way of creating filters to query certain post types/fields and sort them. Within…
Looking to have an incrementing list or numbered :nth-child's in your CSS, but don't want to type it out manually? Using a…
Here's a simple way to show a facebook page's current number of likes, it combines JSON and PHP, very simple! Can be…
Often you may want to change all text between certain tags within Sublime Text, remove all types of certain tags, or change…
As a Wordpress admin/blogger, you will no doubt spend a lot of time browsing throughout your own site. If you are using…
Ever found yourself fiddling around in Sublime Text, only to have the cursor change to an underscore ( _ ) and no…