RSSAmplifier

Blog

Joshua Davey

joshuadavey.comRSS feed ↗18 posts

Latest posts

Social Offboarding

Few people would dispute the importance of onboarding new members of a team. Getting to know the other people you’ll be working with is vital to becoming part of a team. This is often done a number of ways, but at the very least involves introductions and informal get-to-know-you icebreakers. Depending on the position, it can also involve training sessions, one-on-one conversations, happy…

Introducting clj-pgcopy

On a recent project, I was working on an ETL process, where the transform step happened in Clojure. After all of the data had been shaped the way we wanted, we imported the data into a Postgresql database. As with our typical pattern, we used the clojure.java.jdbc/insert-multi! function to insert rows in batches. But the performance for the database insertion wasn’t quite what we were hoping…

Single-Use Tokens in Datomic

Single-use tokens have a variety of security applications. Whether it’s a password-reset token, or capturing a financial transaction, there are times when something should happen exactly once, atomically. Once a token is used, it is invalidated. Doing things exactly once, atomically, is relatively straightforward in traditional ACID transactional databases: within a transaction, you find an…

Bulk imports with Datomic

This is a repost. You can find the original here I’ve been really happy with Datomic, but doing an initial bulk import wasn’t as familiar as SQL dump/restore. Here are some things that I’ve learned from doing several imports. Use core.async Link to heading The Datomic transactor handles concurrency by transacting datoms serially, but that doesn’t mean it isn’t fast!…

Boot + Middleman: The ClojureScript development environment of my dreams

This is a repost. You can find the original here I’m getting closer to the frontend development environment of my dreams. The combination of editor integration, live browser reload, and not having to manually run commands over and over is time-saving and a pleasure to work with. At Hashrocket, designers and developers work very closely together. Visual design and markup is handled by our…

Screencast: Clojure + vim basics

In this screencast I cover how to do basic evaluation and get Clojure documentation from within vim. I’m also including the transcript below. Vim is a powerful text editor. Clojure is a powerful programming language. While its been possible to edit Clojure code in vim for years, the toolchain has improved greatly over the past year. Today we’re going to see how we can integrate vim…

Using Datomic as a Graph Database

This is a repost. You can find the original here Datomic is a database that changes the way that you think about databases. It also happens to be effective at modeling graph data and was a great fit for performing graph traversal in a recent project I built. I started out building a six degress of Kevin Bacon project using Neo4j , a popular open-source graph database. It worked very well for…

Deferring constraints in PostgreSQL

This is a repost. You can find the original here Database constraints are essential to ensuring data integrity, and you should use them. Allowing them to be deferrable during transactions makes them even more convenient. A common scenario in which the database can help us is in a sortable list implementation. This post outlines the how and why of deferring database constraints, using a sortable…

has_one view

This is a repost. You can find the original here Sometimes, aggregating data can become overly complex in a normal ActiveRecord model. Because Rails works well with SQL views, we can create associations to SQL views that aggregate data for us, simplifying our models and potentially speeding up queries. Modeling an inbox Link to heading I’ve got an inbox. A cat inbox. For real. There are many…

Using Recursive SQL with ActiveRecord trees

This is a repost. You can find the original here tl;dr When you have an ActiveRecord tree structure, using the WITH syntax for recursive SQL can provide large performance boons, especially when a tree get several levels deep. In a previous post , I outlined a Cat Picture store application. As our store grows, more and more categories have to be created, and we end up with a tree of categories. How…

SQL Window Functions and You

This is a repost. You can find the original here Suppose you have a storefront application that sells pictures of cats. These cat pictures are categorized in meaningful ways. For example, there are LOLcats pictures and “Classic” cat pictures. Now, on the landing page of the store, you’d like to feature one picture from each category. It can’t be a random picture from each.…

Easier Atomic Commits

This is a repost. You can find the original here How do you keep your commits atomic easily? Let’s explore one possible approach. Problem Link to heading As a practitioner of good source control, you and your team have decided to make all of your git commits atomic within your projects. That is, every commit has a green test suite, and you prefer small, incremental commits to large,…

Simulate network latency for application testing

Sometimes it’s useful to test your web application for situations where internet connections are less than stellar. It turns out that Mac OS X has a builtin utility called ipfw than, among other things, can do just this. I first saw this technique from Joe Miller’s post on the subject. I packaged up the settings he mentioned into a little shell script: You can drop that somewhere in…

Add untracked files in git

I’ve often been annoyed that there’s no way to non-interactively add untracked files in git. Well, I finally whipped an alias to speed that process up: Just add it to your global git config file at ~/.gitconfig and enjoy.

Faster TDD feedback with tmux, tslime.vim, and turbux.vim

tl;dr Developing in a tmux session has sped up my TDD cycle considerably, especially with the help of tslime.vim and turbux.vim. I get immediate feedback in one pane, but never have to leave vim or lose context of what I’m working on to see the test result. Taking a cue from Xavier Shay’s excellent intro to tmux , I’ve been using tmux lately as my primary workspace. There are…

zsh completion for hitch

At hashrocket , we use hitch to manage our paired git authors, written by our own Rogelio Samour. Hitch works by setting the GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL environment variables. For the email itself, it joins the hitched author’s github usernames and a prefix with a “+”, creating email addresses of the form “ dev+jgdavey+therubymug@hashrocket.com ”. Using it is…

QR Codes in Ruby

QR codes seem to be everywhere these days. I’ve seen them in advertisements on the train, on the back of magazines, and, most recently, on someone’s wedding invitation. A lot of folks are using QR codes as a quick way to share URLs. But that’s not all that they are good for. We recently had a client that needed to authorize paper tickets, and a QR-encoded token turned out to be a…

VIM script to toggle do/end and brackets

This is still rough, but I’m finding it quite useful: I’ve converted this to a full-blown VIM plugin: https://github.com/jgdavey/vim-blockle