More and more sites offer the ability to log in with Facebook, Twitter, or
Github, which can be quite convenient, as it means fewer passwords to keep track
of. Adding this kind of capability to a Ring based app is easier than you might
think, using the ring-oauth2
library. In this episode we’ll demonstrate how to
implement a “Sign in with Google” button. The process is very similar for other
providers.
A small macro with a lot of power! We start with a quick recap of Clojure’s looping constructs, and then go over the various features and use cases of for
, backed by examples taken directly from popular open source projects.
The Interceptor pattern was originally introduced by Pedestal, but has since been adopted by several other projects in the Clojure world. It’s an extremely useful design tools to be familiar with, and while they may seem a bit strange at first, Interceptors are suprisingly straightforward.
This episode introduces the interceptor concept, including the context map, queue, and stack. Clojure’s persistent queues are explored, and to round off we look at how interceptors deal with error handling.
With the basics of multimethods out of the way it’s time to look at some of the
more advanced uses. This episodes explores in depth Clojure’s keyword hierarchy
features, some little known aspects of the isa?
and type
functions, and
closes off with some examples that demonstrate the flexibility Clojure provides
when modeling data and behavior.
Clojure provides polymorphism through protocols and multimethods. Protocols were covered in depth in episode 24. This episode provides a brief recap, then looks at multimethod basics. If you are already familiar with multimethods then you might want to skip to the second part, which covers some of lesser known aspects.