How to Reverse an Animated GIF / / No Comments Modifying visual media via code has always been a fascination of mine. Probably because I’m not a designer and I tend to stick to what I’m good at. One visual effect I love is seeing video reversed — it provides a sometimes hilarious perspective on a given event. Take this reversed water effect for example: To reverse an animated GIF or video, you can use the ImageMagick library: convert water-forward.gif -coalesce -reverse -quiet -layers OptimizePlus -loop 0 water-reversed.gif If you’re interested in media engineering, check out my previous ImageMagick tutorials. These awesome media libraries are as close to an artist I will ever get! The post How to Reverse an... more → Posted in: JavaScript Tagged with: Animated, Reverse
Related Content by Day of Year in Eleventy / / No Comments Ok, chalk this up to something that is probably useful to one out of ten of my readers, but the idea’s been bouncing around my brain for a few months now and I finally took the time to build it out. Imagine a content site that’s been around for a while, for example, this blog (twenty years next February). It may be interesting to tie articles to content written in the past, specifically, on the same day in previous years. This requires a site with years of content and enough content such that there would actually be a decent chance of that happening, but I could see newspaper sites or other news organizations being able to meet that criteria. For... more → Posted in: JavaScript Tagged with: Content, Eleventy, Related, year
Testing the Netlify Cache Plugin with Eleventy / / No Comments For months now I’ve been meaning to check out, and try, the Netlify Caching plugin. This plugin lets you cache resources between builds saving you time when doing builds. I didn’t doubt it worked, but I needed to give it a try myself to see it in action. To test it out, I used Eleventy, but note that you can use any static site generator with the plugin. (It just won’t be as cool.) Raymond Camden… more → Posted in: JavaScript Tagged with: cache, Eleventy, Netlify, plugin, Testing
How to Flatten git Commits / / No Comments One of my least favorite tasks as a software engineer is resolving merge conflicts. A simple rebase is a frequent occurrence but the rare massive conflict is inevitable when many engineers work in a single codebase. One thing that helps me deal with large rebases with many merge conflicts is flattening a branch’s commits before fixing merge conflicts. Let’s have a look at how to flatten those commits before resolving those conflicts! My typical command for rebasing off of the main branch is: # While on the feature branch... git rebase -i master To flatten commits before the rebase, which can make resolving merge conflicts easier, you can slightly modify the original command: ... more → Posted in: JavaScript Tagged with: Commits, Flatten
Building a Quiz with Eleventy and Eleventy Serverless / / No Comments A few days ago, I was thinking about what a "quiz" would look like in Eleventy. I put that in quotes because there’s a lot of different ways you can think of quizzes and how they’re built. For my demo, I set my list of features to the following: Raymond Camden… more → Posted in: JavaScript Tagged with: building, Eleventy, Quiz, Serverless
Immediately Executing setInterval with JavaScript / / No Comments Employing setInterval for condition polling has really been useful over the years. Whether polling on the client or server sides, being reactive to specific conditions helps to improve user experience. One task I recently needed to complete required that my setInterval immediately execute and then continue executing. The conventional and best way to immediately call a function at the beginning of a setInterval is to actually call the function before the initial setInterval` is called: myFunction(); setInterval(myFunction, 1000); // Every second If you truly want to isolate the function call to the setInterval, you can use this trick of self-executing function that returns itself: // Use... more → Posted in: JavaScript Tagged with: Executing, Immediately, JavaScript, setInterval
Integrate Your Netlify Builds with Tidbyt and Pipedream / / No Comments A few months ago I randomly came across a Facebook app for a little device that looked completely unnecessary yet also completely cool: Tidbyt. The Tidbyt is a little hardware LED device that shows different pieces of data, for example, sunrise and sunset: Raymond Camden… more → Posted in: JavaScript Tagged with: builds, Integrate, Netlify, Pipedream, Tidbyt
Image Upload Preview in Alpine.js / / No Comments So as I’ve said a few times now, I’m on kind of a trend here on rebuilding previous demos in either vanilla (i.e. no framework) JavaScript or my new favorite framework, Alpine.js. In that vein, I’ve got an update to a post I first wrote nearly a decade ago, "Adding a file display list to a multi-file upload HTML control". I followed that up with a Vue version here: "Vue Quick Shot – Image Upload Previews". The idea was to enhance a form that asks for image uploads by adding a simple preview of the image. This helps as it lets the user be sure they’ve selected the right file. Raymond Camden… more → Posted in: JavaScript Tagged with: Alpine.js, Image, Preview, upload