February 20, 2016

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 added a 7x24 color-coded grid plot, allowing for a more accurate view of exactly when the most popular posts were posted.

Read more »

January 11, 2016

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 development.

Like many problems in the Clojure universe, this is less a problem of technology and more a problem of approachable documentation. With just a little bit of configuration and some understanding, you too can assemble that perfect Clojurescript dev setup using Boot.

Read more »

January 4, 2016

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.

Read more »

December 28, 2015

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, I’ll compare a few popular SQL DSLs for Clojure, and contrast them all with their mutual pappy, clojure.

Read more »

December 15, 2015

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 Ring. I had heard good things about how Buddy works, so I decided to give it a try, and now you get to hear about that.

Read more »

December 4, 2015

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.

Read more »

October 19, 2015

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.

Read more »

October 1, 2015

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 lopsided, deeply nested, organically-grown stalagmite of a program.

Read more »

July 12, 2015

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 the great things about this style of game is that the barrier to entry is very low (which is probably why there are approximately a brazilian of these things around), and the games in the genre are differentiated almost solely by the quality of their mechanics (without silly things like “art” to get in the way). You, the reader, might even be interested in dipping your toe in the world of incremental games. If you want to add one to the pile, I recommend you use React to do it.

Read more »

June 15, 2015

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 the purposes of this post, we can steal their frontend and just install a new backend.

Read more »

June 10, 2015

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 deploy friend for even very simple workflows, if you understand how it works.

Read more »

June 5, 2015

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 even be a build tool!

Read more »

April 9, 2015

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.

Read more »

December 21, 2014

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 downside to Frege is that, even though documentation exists (and is actually quite expansive given the language’s limited adoption), it’s still hard to find straightforward how-tos by googling. So here’s some much-needed frege-related blogspam to fill out those results.

Read more »

December 11, 2014

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 the decision of which method to call is left up to the inferred type of a single argument.

Multimethods take the approach of leaving the dispatch up to the user; you can dispatch on any value at all. You just need to supply a function that returns the value on which you wish to dispatch, and a method for each possible value. For certain cases, this is a lot more flexible than single dispatch.

Read more »

December 7, 2014

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, I’m not here to argue either side. Today, I’m just going to demonstrate a few equivalent approaches to the same problem: validating data.

Read more »