RSS Amplifier

Blog

Adam Bard writes about making websites on Adam Bard, Handsome Web Developer

Recent content in Adam Bard writes about making websites on Adam Bard, Handsome Web Developer

adambard.comRSS feed ↗94 posts

Latest posts

One month with Github Copilot

I’ve been trialling Github Copilot for some weeks now, and so far I’ve been very impressed. It’s clear to me that this and similar tools will become a permanent part of many programmers’ toolkits (at least until the AI gets so clever that it obviates our jobs completely).

Transitioning Later for Reddit from Docker Machines to Digital Ocean Kubernetes

I recently completed a migration from my old docker-machine-based infrastructure (so 2016!) to Digital Ocean’s hosted kubernetes service . The bulk of the work was completed in a single evening. It went almost seamlessly, but not so seamlessly that I wasn’t able to learn a few things. The goal of this writeup is not to serve as comprehensive documentation, but hopefully you’ll…

Getting a handle on Reduce

Although traditional algol-inspired languages remain dominant, over the past decade or so, functional programming techniques utilizing immutable data structures have seen widespread adoption in a variety of domains. From React and friends on the frontend to Map-Reduce and the vast ecosystem of thus-inspired data warehousing systems that power some of the world’s largest software…

Programatically Liquidating my Steam Inventory

I don’t know about you, but every so often my Steam Inventory gets a bit out of control. I have no use for Don’t Starve trading cards, but it’s not really worth my time to individually sell each item for a few cents. However, what is worth my time, apparently, is creating a script to do it for me. This turned out to be quite a winding road, which I’ve documented here.

One-box stream processing with CSP

If you’re like me (that is, employed by an ad tech company), stream processing is usually associated with frameworks like Storm , Flink , Spark Streaming , and other such solutions. However, a lot of real-life software can be described as stream processing – data comes in one end, is transformed or aggregated, and goes somewhere else. Many of these workloads don’t justify the…

Running a Side Business as a Programmer: The story of Later for Reddit

For the past 5 years, I’ve run a website called Later for Reddit. For the past 2 years, it’s actually been making money. Here’s how that happened. I used to spend a lot of time on Reddit (insert Mitch Hedberg joke here). I also used to spend a lot of time writing side projects, often late into the night. One problem I frequently had at the intersection of those two hobbies was…

Javascript FP design pattern: Binding functions

Ok, ok, monads have been done. They’ve even been done by me before . But, functional programming is still popular, monads are still very useful for programming in an FP style, and people are entering the field every day. So here’s another attempt at an approachable introduction to usefully apply this pattern to everyday coding problems.

Bucklescript vs Elm vs Typescript: Typed Javascript showdown!

You, a web developer, have probably heard of Typescript , may have heard of Elm , and you might even have heard of Bucklescript / ReasonML as well. Each of these represents a compiles-to-javascript language with strong type support, but each has some different opinions, philosophies, and features. In this article I’ll walk you through the features of each of these options and compare their…

OCaml for the impatient

Ocaml is a rad language with some regrettably underdocumented parts. Or, perhaps, overdocumented – since OCaml attracts people who are interested in rigorous correctness, what documentation exists tends to be rigorous and correct, and also tedious. This guide will be none of those. Let’s go!

Best Practices for Javascript Library Versioning

I spend most of my time on this blog talking about Clojure, but IRL I work on a lot of projects written in a lot of languages. Lately, much of my time has been spent writing and maintaining React-based frontends in Javascript. As far as I can tell, no language has solved the problem of dependency management. Some libraries are better than others, but upgrading dependencies is always an…

Domain modelling with clojure.spec

Clojure.spec is, among other things, Clojure’s official answer to tools like Typed Clojure and Plumatic’s Schema . It represents an attempt to apply some validation to data and functions, without compromising Clojure’s dynamism and data-is-data philosophy. In this post, I’ll be working through a sample program by first outlining and modelling it with the help of…

What programming language should I learn? (2017 edition)

I occasionally find someone asking this question in my inbox. I’ve learned that for every person that bothers there are a bunch more with the same question, so I thought I’d take a break from relentlessly plugging my side hustle Later for Reddit to answer it publicly.

On Advice (featuring just one piece of it)

I’m perfectly comfortable making wild assertions about which programming technique is better than which other one, but when it comes to handing out general life or career advice, I’m a lot stingier than your average blogger 1. Even if I was wildly successful (I’m not), it’s so difficult to tell, even in retrospect, the difference between the stuff that actually mattered and…

Basic site monitoring with Riemann

Riemann is a general-purpose event processing system, but its most typical application is as a place to send and generate metrics about applications. I recently set up a Riemann server for my personal projects, and I feel like my devops game is stepped up by 1000%. Or, at very least, I feel like I know know about it as soon as one of my sites goes down.

What’s in a namespace?

Every well-behaved clojure source file starts with a namespace declaration. The ns macro, as we all know, is responsible for declaring the namespace to which the definitions in the rest of the file belong, and generally also includes some requirements and imports and whatnot. But today (at Clojure/West, shoutout!) Stuart Sierra made a passing reference to the internals of ns during his talk that…

Write and deploy your own self-hosted Readability clone

Readability.org is a handy tool, but it also suffers from being useful, popular and free – the service is (understandably) often down, or slow. If you’re a heavy Readability user, it might interest you to know that there exist many software libraries that attempt to recreate Readability’s main function – pulling the main body of text out of a page laden with ads and other…

Composible Architecture: A real-world example.

I am the primary maintainer of a significant REST API written using Flask-Restful . Flask-Restful is a pretty full-featured library for creating REST frameworks with Flask. It features everything you need to manage routing to class-based resources, a library for marshalling objects to JSON format, and reqparse, an argparse-inspired library for writing input parsers.

React.js in the small

I’m a big fan of accessible technologies. I get suspicious whenever I encounter a framework or library that is “not worth it for a small project,” because that is a coded statement that means either “It has a broad scope of features that a small project won’t take advantage of,” or “it trades off simplicity or user experience for performance or other…

The Web is (finally) a mature platform

I started my career as a “web developer” circa 2007. I’d dabbled before with Javascript while making sites in HTML/CSS as early as middle school, but that was my first real job as a real software developer. Back in those days, LAMP (Linux/Apache/MySQL/PHP) was about the only sensible way to build a web application. You could use Java servlets, of course, or build applications…

Clojure SQL Migration Libaries

It is generally recommended, if you’re developing an application that uses a database, that you manage changes to the schema of said database using some sort of migration system or another. Luckily, several intrepid developers in the clojure community have stepped up with their own solutions to this problem – all of which end up being very similar indeed. Read on for an overview of…

Plotting Reddit post frequencies with d3

This week I added a better graph to Later (for Reddit) ’s post timing analysis page . Previously, the most common time and the most common day were plotted on separate bar charts. However, I noticed that I got called out on this in this article on Medium , which offered a pretty sensible alternative that I wasted no time in ripping off wholesale. I still have the bar graphs in, but I also…

Failjure: Exception-free error handling for Clojure

I’ve written before about handling errors in Clojure without using exceptions, by making use of ad-hoc monads. In that post, I also referenced Andrew Brehaut’s error monad implementation. Since then, I’ve written a number of projects that use similar handling, and I thought the time had come to wrap it up in a library, which I’m calling Failjure .

Clojurescript Boot Live-Reload Weasel Vim-Fireplace Piggieback

My long-standing complaint about Clojurescript is that it’s a pain to get running. People who prefer Leiningen seem to have gotten a handle on this with figwheel ; however, those of us who have jumped on the Boot train (it’s newer and therefore better!) still have to do some assembly to get the live-reloading auto-compiling repl setup that’s become the standard for Clojurescript…

Deploying a Clojure web app with Pallet

Pallet is a Clojure DevOps platform/library designed to automate blah blah blah. We all know what these things are supposed to do, the question is how they do it, and Pallet takes the agreeable tack of just being a Clojure library that you can run in a repl and do devops stuff.

Clojure SQL library showdown

When it comes to database access, I’ve become less particular over the years as I’ve gotten more and more comfortable with SQL. These days I’m happier to write the SQL to get just the thing I want, than wrestle with an ORM to produce the same thing. Nevertheless, there’s something to be said for abstractions over SQL, and they seem to have lasting popularity. In this post,…

Password Authentication/Authorization for Clojure

In my previous post , I gave a quick overview of how the Buddy auth library for Clojure. Today, I’ll give a more fleshed-out example of how to use it to add session-based password authentication to an app.

Clojure auth with buddy

A while back, I wrote about using Friend to handle auth in Clojure. I neglected to mention (or look at, in particular) the other auth framework making waves in the Clojure community, aptly named Buddy . Buddy is, well, another authentication/authorization framework. It also contains some lower-level crypto utilities, but the main use right now seems to be handling auth for web applications in…

Using Letsencrypt with Nginx

Letsencrypt.org has just entered its public beta period. This means that you can get ssl certificates really easily and for free. Letsencrypt’s certificates are up to modern specs and fully accepted by all browsers, so you no longer have any excuse not to have SSL on all your domains. This post will hold your hand through the process of moving your Nginx site from http to https.

Introducing Unpythonic

A short post to say that I’ve just launched a new project called Unpythonic . It’s a collection of articles introducing various concepts and techniques for functional programming in Python.

Writing Friendlier Clojure

I love the Clojure language, but I don’t think there’s any use pretending that the combination of expressiveness, power, and repl-driven development can result in some staggeringly dense code. Everyone that writes Clojure is guilty of this at one time or another; you start with the core of your function, evaluate it, wrap it a bit, eval again, and before you know it you have a…

React.js for incremental text games

I have a small weakness for silly text games like Candy Box and A Dark Room , and most recently Kittens Game (“a Dark Souls of incremental gaming”). The common feature of these games is that, for the most part, the UI is just numbers on a web page, and you perform certain actions to increase those numbers to purchase upgrades that further your ability to increase the numbers. One of…

Ripping off Circular.io in Clojure

Circular.io is a clone of Buffer, or at least the Buffer of about 5 years ago. Back then, all buffer did was let you schedule posts to Twitter, to be sent at regular intervals throughout the day. It was on HN about 3 years back, and has been running since then. And people really use it! They’ve done a great job with their little app, and the fact that it’s open-source means that for…

Easy custom auth in Clojure with Friend

I’ve used friend to provide auth in my projects a few times, and considered it many more before resorting to my own hand-rolled business. Most of the reason for this is that is just seems so complicated . Workflows? Credentials? I just want to check a password and stash a user object in the session, end of story. After I did some investigating, though, it turns out that you can usefully…

Throwing together a weekend project with boot-clj

This weekend I made http://worldclassifiedlist.com on a whim. Past experience suggests that I’m not likely to derive any value from the site itself, so before it’s completely forgotten, overlooked by an indifferent world and relegated to an unnoticed screenshot on my portfolio page, I thought I might wring a few ideas out of the making-of.

Building a graph-powered suggestion engine for redditlater with Loom

Besides the post scheduling, the main reason people come to http://www.redditlater.com/ is the subreddit analysis feature. This lets folks enter in a subreddit and tells them when the best time to post on a given subreddit is. Little do they know, it tells me about them, too.

My first time using boot over leiningen

When boot first appeared in my usual rotation of clojure news, I must confess that I didn’t really see what the fuss was about. It seemed like someone had taken leiningen and broken out all its parts into functions, which you could then use to get your dependencies, build your project, and so forth. Don’t you see! Leiningen is just a build tool, but boot could be anything. It could…

My favorite old webdev tools

The way we make websites has changed a lot since I started doing it, and it’s important to keep up-to-date on new tools and techniques. That said, I’ve been noticing that I’ve not spent as much time churning through new frameworks and whatnot as I used to – in fact, I’ve picked out a few tools that I’ve been using for years.

Interfacing Frege and Ring

Frege is a strongly-typed functional language for the JVM. Its goal is to mirror Haskell as closely as is possible on the platform, and as far as I can tell it does a pretty decent job. It seems performant enough, and more importantly grants access to a Haskell-esque type system. This makes it a pretty good complement to Clojure for those problems where a strong typing system is important. The…

Implementing multimethods in Python

In Clojure (and many other languages), a multimethod is an implementation of multiple dispatch as an alternative to single dispatch. Traditionally, if you define several methods with the same name on different classes, the type/class of the first argument (in Python, self , in many other languages implicit) is used to pick which method to call. This is called “single dispatch” because…

Functional vs Object-oriented approaches to validation

Functional programming is often described in terms of its contrast with object-oriented programs; that is, you write functions that act on data instead of objects that wrap data and use methods to act on themselves. Functional programming wonks (like me) will tell you that writing code this way is generally better than OO, but I don’t want to do that (right now). However, in this post,…

Back from Clojure Part 1: Python

One of my favorite genres of article to write are the ones that involve refactoring some code to make it more functional, and (hopefully) improve it on the way. With that in mind, I’ve decided to embark on a tour of some of the things users of other popular dynamic languages can take away from the ideas behind Clojure, even if they never use it themselves. Today, I’ll be taking an old…

My life as a homeless transient.

I hate the term “Digital Nomad”. Whenever I see it in the context of an article or blog post, it reeks of pretension and better-than-thou-ness – which, I rush to point out, is not a vibe I ever get from actually talking to fellow travellers in person. Usually, when I meet someone who asks about my lifestyle, I just laugh and say I’m homeless but employed. Whatever you want…

Clojure is still not for geniuses

The inspiration for the article I wrote last week entitled Clojure is not for geniuses was inspired by Tommy Hall’s talk at Euroclojure 2014 , wherein he made an offhand joke about preferring Clojure for its minimal syntax, as he possesses a small brain (both his blog and his head suggest this assertion is false). I had intended to bring this up with the original article, but got sidetracked…

Clojure is not for geniuses

It’s a common attitude that functional languages with immutable collection semantics, such as Clojure, are for a) pretentious language geeks, or b) actual genius programmers. I’m in no position to defend against point a) given the body of my writing on this blog, so today I’d like to write an article about point b).

What language should you learn?

I travel a lot these days. I’d call myself a “digital nomad” as a shorthand, if there was any way to say it without sounding impossibly smug. Let’s just say I’m homeless but employed and my wife and I live in AirBnbs. One of the challenges of moving around so much is dealing with language barriers. For the most part, even in places where English isn’t widely…

A clojure cup retrospective

Update: Voting is live! Vote for my app at https://clojurecup.com/#/apps/booker , then check out some more deserving entries at https://clojurecup.com/#/apps and vote for them too! I’ve just spent about 30 hours this weekend coding up Booker , my entry to the 2014 Clojure Cup, in which I participated as a one-man team. It was pretty exhausting, and the app doesn’t do quite as much as I…

Compojure apps, in the style of Sinatra

Clojure has an approachability problem. In part, this is due to the relatively unusual syntax, but that can’t get all the credit. When it comes to building server-side web applications, a major sticking point is the “lack of frameworks” problem, and more to the point, the common Clojurian’s response: “Clojure users prefer to assemble their own stack from small,…

Deploying a Clojure web app to a VPS

So you wrote an app. Great! Next step is to put it somewhere where people can use it. This tutorial will walk you through the process of deploying your app.

Using Kotlin from your Clojure projects

Problem: You need to extends some Java interface or class to use some Java API, and for some reason Clojure’s java interop tools are too unwieldy to do it cleanly.

A url shortener service in 35 lines of Clojure

I saw this post by Grasswire today, and I couldn’t resist the urge to throw down a Fizz-Buzz-pocalypse . So, here’s my implementation in Clojure, along with a list of ways that Clojure clearly wins. (That last sentence was to be read tongue-in-cheek, Scala is a good language too. Besties!).