Introduction to Asynchronous Programming in Clojure

I’ve been writing about my favorite language, Clojure, for a while now. I’ve also been gauging your interest in Clojure and, if you’re reading this, I think you’re ready to take this relationship to the next level. Let’s talk about asynchronous code in Clojure. Getting Started If you want to follow along with the code examples, start a new project. I’m going to be using Leinengen and we’re going to name this app “warehouse”. lein new app warehouse Let’s open warehouse/src/warehouse/core.clj and modify it so it looks like this: (ns warehouse.core (:gen-class) (:require [clojure.core.async :as async :refer [>! <! >!!...

Using JSON Web Tokens with Clojure

Authentication is easy. Good authentication is difficult. We’re at a point in the world where our users expect to be able to sign up for your service or app, and receive a more personalized experience. If you can’t validate who the user is, you can’t achieve this. In the past, people have leveraged sessions, cookies, sending the user’s email and password on each request (please don’t ever do this), and many other techniques to validate that a user is who they say they are. A lot of these techniques worked relatively well for the time, but they all have their...

Understanding Clojure Macros

Learning Clojure has been one of the most thought-provoking experiences of my life. Coming from a predominantly OOP background, it’s safe to say that it’s always been a bit of a challenge. Macro’s specifically, were a challenge that was hard for me to grasp, and I know cause a lot of pain points to new Clojuristas. To first understand a Macro, we must understand what a function does. What is a function? For the sake of this example – A function is a named procedure that tells a computer to do something (realistically, it’s a mapping between values that undergo...

Building RESTful APIs with Ginger, H2, and Java 8

Recently, I started writing a few RESTful services in Java Spark. I found a few recurring themes and decided to extract them out into a layer ontop of Spark to make it even easier to build a RESTful service from the ground up. This project is called Ginger and I’ll show you how to create a RESTful service using the Ginger framework. If you get stuck, the completed source code can be found here. Things to know Ginger is built heavily ontop of Spark. As of recently, Spark only runs on Java 1.8+, therefore Ginger also runs on Java 1.8+....

Intro to Reflection in Java

Recently, I began exploring an interesting idea I had – creating a RESTful framework built on top of Spark. Now, Spark is naturally restful, but I basically want the user to be able to define an object, flag it as a resource, and compile their code. They should then have GET, POST, PUT, and DELETE verbs available on that object. Sounds relatively trivial right? There are actually several ways to do this, but the simplest way (once I was able to wrap my head around it) involves metaprogramming, and specifically reflection. These can be naturally scary words, but it’s important...

A Brief Comparison of FlowRouter and Iron:Router for Meteor.js

Recently, I was updating an open source package that I maintain – a project structure scaffolding tool. While updating the template I use for my Meteor apps, I realized my tool was still catering towards Iron:Router. For those unaware, Iron:Router has a history of being the Router for Meteor apps. When I first used it, however, it felt like it was lacking in some ways. After using it on about several Meteor apps now, I’ve adjusted my design to conform to Iron:Router and it works extremely well, but recently KadiraHQ created their own Router – FlowRouter – and oh, is...

I’m Giving Up On Business

I like to consider myself as an idea-guy. I have ideas all the time, and I consistently try to validate them before trying them. One thing I’ve noticed, however, is I hardly do any of these ideas. Why? Because I’m bored as hell with the idea after I’ve talked to hundreds of customers, after I’ve gotten a 5% response rate on the hundreds of emails I hand wrote (or typed), and after I’ve let an idea sit in my brain and wilt for weeks. Yes, I get bored. I recently signed up to give a talk at the Kansas City...