Tag: code

Far too many graphs about Eurovision

Did you know that a bunch of people had opinions about the Eurovision Song Contest 2023? Did you know that the Eurovision Song Contest happened this year? Are you aware that all the cool kids wrote blog posts about it months ago? Well, luke- warm on their heels, here's a post about the stats behind the voting, complete with shiny pretty interactive data visualisations that are fun to hover over.

Proc-gen crosswords from scratch

I like crosswords. After doing enough of them, however, I decided to try to make my own. And given I want to make my own, why not ridiculously over-engineer the whole process with a procedural generation mechanism in ruby?

This is currently a work in progress, but this blog post will at least show you through the start of the crossword building process as it exists right now, and may allow me to springboard off of it onto more complex posts in the future.

Revamping 1klb comments part four: submitting comments

Over the last few posts on this blog(1 2 3) I’ve been introducing my system for collating, storing, and displaying comments on my static site blog using Javascript + HTML for the front-end and FaunaDB for the backend. We’ve gone through the basic outline of the system, set up the database, and talked about how we can fetch and display comments. In this post, I’ll show how you can easily build a comment submission form in HTML, and create a solid, secure comment submission system with server-side functions.

A basic comment form

It’s pretty easy to build a basic comment submission form in html:

Revamping 1klb comments part three: displaying comments

In the previous two posts on this subject I showed off the big picture overview of how this whole system was going to work, and showed you how I set up my database in Fauna to deal with those comments. Assuming that all went according to plan, let’s explore how we actually go from bits in a database, to, yknow, comments on the website.

Two ways of talking to Fauna

I’ve mentioned previously that there’s two ways of talking to the Fauna database:

Revamping 1klb comments part two: the database

We’re building a commenting system for a static site blog! Or at least, I’m taking you on a guided tour of my blog commenting system.

In my last blog post I outlined how the commenting system of the blog works, at least at the big picture level. In this post, I’ll go through how we set up the database.

Revamping 1klb comments part one: an overview

A little while back I created a commenting system for this blog. The blog itself is served via a static site generator (specifically nanoc served on netlify), so a commenting system isn’t as simple as putting an html form in the page and hooking it up to a database on the server. Instead, I ended up using a hybrid of netlify’s forms, the web-based database system Fauna DB, and some javascript.

But the issue was that this system didn’t really work that well. Comments got lost in the churn, I got notified kind of poorly, and it was all a bit messy. So a month or so back I completely revamped the commenting system, cutting out the middle-man (in this case Netlify forms), adding some moderation features, improving notifications, and generally making it run smoother.

The end product takes a bit more effort to put into production, but I think it’s worth showing off. In this first post, I’ll do a big picture overview of the whole system.

JAMStack comments (for free) with Netlify and Fauna

Note: This commenting system is now out of date. To find a more up-to-date discussion on the commenting system this blog uses, check out the series of posts starting here.

This site used to have comments through Disqus. But Disqus was a huge third-party javascript drain and resource hog, and I ditched it.

Sublime Text basic plugins

The hard drive on my laptop recently ate itself, and while I was able to recover most of my important data through the magic of regular backup, I did lose a few files. Among them: my directory of custom SublimeText plugins. It’d been a good while since I had to make a Sublime Text plugin, so this was a good refresher course.

While I’ve built a few plugins over the course of time, the two main ones I miss were:

Dugong - kind of ugly mindmapping in javascript

For a (currently undisclosed) project, I decided that it would be a great idea to have some sort of markdown-to-mindmap converter. This is actually a bit of a misnomer - what I wanted was something that would take plaintext, in a format as simple and memorable as markdown, and turn it into a graphical mind map, probably in svg. I’ve been hacking greasemonkey scripts at work, and with that comes at least a base level of competence with javascript: the perfect language for converting a div to an svg, on the fly, in your browser.

The result is dugong. It’s a pretty simple library - no-frills, nice and small, with no dependencies on external libraries. Just download, plug into your webpage, and watch it convert lists to mind maps in front of your very eyes.

Advanced Gnuplot: sizing particles

I’ve previously discussed Gnuplot on this blog, discussing why it’s excellent and demonstrating how to make a semi-decent simple graph using the package. You can learn a lot from Gnuplot by playing with sample graphs and reading the documentation, but I thought I could show off some of the more complex graphs I’ve made over the past year or so, and how I went about crafting them.

The setup

In this post I’ll cover a somewhat complex particle sizing graph I ended up producing for a recent paper1. In the paper we were determining the size of a batch of elliptical nanoparticles, which we could image using scanning electron microscopy (SEM). SEM produces an image of the material at high resolution, in greyscale:

  • 1
  • 2
  • ...
  • 5