Building a Generic RSS Parser Service with Cloudflare Workers

About once every three months I’ll write a quick JavaScript demo and attempt to fetch someone’s RSS feed… and then remember that the vast majority of RSS feeds don’t specify a CORS header to allow remote scripts to load them. I know this – and yet I still tend to forget. I thought it would be kind of fun to build a serverless API via Cloudflare Workers to handle loading, parsing, and returning a RSS feed with CORS allowed. I figured this would be pretty easy, but I ran into a snag right away. Workers and NPM Modules # Cloudflare Workers is Node.js compatible… with some issues. Cloudflare has a documentation page on it addressing what you may run into, and for... more →
Posted in: JavaScript

How to Get the Current Branch Name with git

Most developers spoil themselves with fun command line utilities to make their work easier and more efficient. One such command line helper allows developers to always show the git branch in the command line. How can you get the current branch? With this handy snippet: git branch --show-current It’s great to keep this snippet around for any automation you may create moving forward! The post How to Get the Current Branch Name with git appeared first on David Walsh Blog. David Walsh Blog… more →
Posted in: JavaScript

Using Cloudflare’s AI Workers to Add Translations to PDFs

Late last month, Cloudflare announced new AI features in their (already quite stellar)Workers platform. I’ve been a big fan of their serverless feature (see my earlier posts) so I was quite excited to give this a try myself. Before I begin, I’ll repeat what the Cloudflare folks said in their announcement: "Usage is not currently recommended for production apps". So with that in mind, remember that what I’m sharing today may change in the future. The Demo # Before I get into the code, let me share what I’ve built. Now, at the time I wrote this, Cloudflare’s AI stuff was still in beta and there is no cost yet for using the features. This is, obviously, going... more →
Posted in: JavaScript

AutoSave with VSCode

Visual Studio Code has taken the crown of most used text editor, at least in JavaScript spheres. VSCode is fast, feature-filled, and supports thousands of plugins to boost productivity. Developers can also tweak hundreds of settings to enrich functionality. One such feature is the autoSave feature. A few months ago I changed my editor setup to autosave code as I type. Every app works that way, code editors should too. I recently had to disable it briefly. Feels so backwards to explicitly press Save via cmd+s. Here is how you can change VS Code to auto save: pic.twitter.com/qmjUBXNX35 — Christoph Nakazawa (@cpojer) October 18, 2023 To autoSave files with VS Code, you can add the... more →
Posted in: JavaScript

Using Google PaLM to Gather Sentiment Analysis on a Forum

I’ve really been enjoying working with Google’s PaLM 2 AI API and this week I used it to build a pretty interesting demo I think. What if we could use the generative AI features of PaLM to determine the ‘sentiment’ or general health of a forum? I was able to do so and I think the results are pretty interesting. I’ll remind my readers I’m still fairly new to this, so please reach out if you’ve got suggestions on how to do this better, or found any big mistakes in my implementation. Ok, let’s get started! Sentiment Analysis # In my first post on Google’s PaLM API, I talked about how their "MakerSuite" was a really cool web-based UI... more →
Posted in: JavaScript

Texting Email Summaries using Google PaLM AI and Twilio

Yesterday I shared my initial impressions of working with Google’s PaLM 2 AI API. If you didn’t read that article, the tldr is that it’s incredibly easy to work with and I was able to get some Node.js code running in minutes. Exactly the kind of experience you want new developers to have with your product. Based on how easy it was to do that, I thought about building a real prototype of how the service could be used. What It Does # My simple prototype is based on the idea of handling an influx of emails. Imagine a support address or other important email address used for a company. If there is a lot of email coming in, or if the emails that do come in are critically important,... more →
Posted in: JavaScript

Automating Mastodon Postings with ColdFusion

I’ve had a lot of fun building Mastodon bots (see my list of super-important business critical bots as an example), typically using the Pipedream platform, and more recently, Cloudflare Workers. The Mastodon API is kinda stupid easy and with "The Other Network" going to hell in a handbasket, I don’t see myself building bots anywhere else. Just yesterday I came home from the Adobe ColdFusion Summit and I thought it would be fun to see how easy it would be to build a Mastodon bot in ColdFusion. Here’s what I was able to do in roughly ten minutes. First, don’t forget that to add automation to a Mastodon account, you need to go into your preferences, select the "Development"... more →
Posted in: JavaScript

Sum an Array of Numbers with JavaScript

It’s rare that I’m disappointed by the JavaScript language not having a function that I need. One such case was summing an array of numbers — I was expecting Math.sum or a likewise, baked in API. Fear not — summing an array of numbers is easy using Array.prototype.reduce! const numbers = [1, 2, 3, 4]; const sum = numbers.reduce((a, b) =a + b, 0); The 0 represents the starting value while with a and b, one represents the running total with the other representing the value to be added. You’ll also note that using reduce prevents side effects! I’d still prefer something like Math.sum(...numbers) but a simple reduce will do! The post Sum an Array of Numbers... more →
Posted in: JavaScript
1 16 17 18 19 20 87