09 Oct 2015 »
Return a function so you don't repeat yourself

When designing a web client api the functions can end up looking similar. Everything boils down to the request execution. Each api function is just a bit different based on the exact http-method, api end point, or parameters. Removing this duplication might not be straightforward. A recent code review request had this situation. The author ended up writing a macro to extract the repetition.

01 Jun 2015 »
How does serving html, css, and javascript fit in a clojure web app?

When developing a clojure web app there are often static pieces that need to be served. Javascript and CSS are one example. Static html, such as a security or about page, is another. The java ecosystem’s term for these are resources. By using resource functions they can be packaged and deployed in a jar file.

18 May 2015 »
Reloaded a protocol and "No implementation of method"?

While protocols provide a nice way to program to interfaces, they do have some unfortunate interactions with repl driven development. It’s annoying to be working along, reload a file, and then BOOM.

14 May 2015 »
Using component for dependency injection in clojure web apps

Dependency injection with component is great, but how do I hook it up in a clojure ring app?

06 May 2015 »
Finding functions with the clojure cheatsheet

When moving between languages built-in functions always end up with different names. In ruby the reject method will remove functions from a list using a predicate. It has the same name in underscore. In haskell it is called deleteBy. Do you know what it is called in clojure?

03 May 2015 »
Test sending emails with protocols

How do you test your system when it needs to send an email?

22 Apr 2015 »
Streaming responses using ring

Use streaming responses in ring to send data as soon as a small portion is ready

07 Apr 2014 »
Saturday remote pairing

It was a temporary call for pairing

15 Oct 2013 »
CSRF protection in ring

There are several security attacks that frameworks like Rails try to guard against. In clojure, the choice of using several small libraries instead of a framework means we have to work to protect ourselves. This post will cover how to protect against CSRF attacks.

14 Oct 2013 »
Using jetty for testing clojure web apps

I’m a big fan of functional tests that work at the level of a user of an application. While working on web applications in clojure, I’ve even written kerodon, a library to keep cookies around between ring requests to make writing them easier. However, there are times when a running a server is useful.

25 Jan 2013 »
Ring Tests with Peridot; humanized with Kerodon (Video)

I gave a lightening talk about peridot and kerodon at Clojure/conj 2012. I’m the first speaker in Clojure/conj 2012 - Lightning Talks. Unfortunatly embedding not allowed.

13 Sep 2012 »
Solving version conflicts with lein-pedantic

A couple months ago I wrote do not use version ranges in project.clj. While this helps reduce confusion about what version of dependencies a project will use, it does not eliminate all sources of confusion.

06 Sep 2012 »
Breaking lazybot out of clojail

lazybot uses clojail to restrict some actions, and I was curious if there were holes to shell access.

01 Sep 2012 »
Using friend in clojars

In the ruby web world there is a great set of libraries for authentication in warden and devise. Earlier this year, Chas Emerick released friend, which is a similar library for clojure. When I first started contributing to clojars, it was using custom authentication and authorization functions. After friend was released I was able to remove most of this code.

31 Jul 2012 »
Do not use version ranges in project.clj

Build tools like lein and maven make it very easy to use libraries in clojure. Just go to clojars or central and find the one you want. However, there are several situations where dependency resolution does not go as planned. A lot of these are a result of using version ranges for a dependency.