Exposing Environment Variables to Jekyll

I’ve previously written about Jekyll’s built-in support for JEKYLL_ENV, which you can use to influence your page’s build process based on the environment you are building for (staging, production, …). You can think about JEKYLL_ENV (referenced as jekyll.environment from Liquid templates) as analogous to RACK_ENV or RAILS_ENV.

This is well and good, but it doesn’t help you much if you want access to other environment variables in your templates. To accomplish this, you have to write a small Jekyll plugin to read the environment variables from Ruby’s ENV constant and expose them to your page’s site.config.

By Christoph Schiessl on Jekyll and Ruby

Definition of Base64

Base64 is a simple encoding scheme used to represent arbitrary data with US-ASCII-compatible strings. It can be used to encode text as well as binary data. The alphabet of an encoded string has exactly 2^6 + 1 = 65 characters, where the first 64 characters represent the actual values and the last one (=) is used for padding when needed. Each of the 2^6 = 64 value characters represents 6 bits of the original data.

By Christoph Schiessl on Software

UNIQUE Constraints in PostgreSQL are not Transactional

I’ve recently encountered an unexpected “problem” with UNIQUE constraints in PostgreSQL. I’m stunned that I never noticed this before, since I’ve been working with PostgreSQL for many years. Either way, I guess I’m not the only one who doesn’t know about it. So, here it is …

By Christoph Schiessl on PostgresSQL

Orphaned Branches in Git

You have to be aware of Git’s internal data structure, before you can understand what orphaned branches are and how to use them. So, let’s start by examining this data structure. Surprisingly, this is easier than it sounds. In fact, there are only two “rules” you have to know about.

By Christoph Schiessl on Git and Workflow

Z Shell Tip: Edit Current Command Line with Vim

Editing long command lines in a shell is very slow and boring. Wouldn’t it be cool, if you could utilize the full power of Vim (or your editor of choice) instead? Well, it is not only possible, it is also incredibly easy to set-up …

By Christoph Schiessl on Software and Workflow

Joke: A Manager, an Engineer, and a Developer …

… are riding in a car. They come to a hill and their brakes fail. After careening down the hill and finally coming to a stop they get out to decide what to do.

By Christoph Schiessl on Misc and Software

Customizing Vim with Environment Variables

Last week, I’ve discovered by accident, that Vim exposes environment variables to all scripts it executes (including your .vimrc). Knowing that, opens up entirely new possibilities for plugins and smarter .vimrcs.

By Christoph Schiessl on Vim and Workflow

Custom Infix Operators in Haskell

Custom infix operators are a common occurrence in Haskell. Apart from built-in operators (such as + and *), there are many libraries exposing custom operators. For instance, Data.Monoid defines the infix operator <> as an alias for mappend.

To understand how these operators work or to create your own, you have to consider two things: Precedence and associativity. Both of these properties are necessary for unambiguous parsing of expressions later on.

By Christoph Schiessl on Haskell and Functional Programming

Environments in Jekyll (aka JEKYLL_ENV)

Jekyll is an excellent tool to generate simple websites and blogs. Its documentation summarizes it as follows: “Jekyll is a simple, blog-aware, static site generator.”

By Christoph Schiessl on Jekyll and Ruby

Smarter Synchronization of your PostgreSQL Development and Production DBs

I like to keep my Ruby on Rails projects’ development databases in sync with their production counterparts. Firstly, this allows me to reproduce almost all production-bugs locally. Secondly, having the complete production database available locally is very helpful for testing new migrations.

By Christoph Schiessl on PostgreSQL, Ruby on Rails, and Workflow

Implementing Ruby’s Array#flatten in Haskell

Ruby’s Array#flatten is on occasion a very handy method. It reduces n-dimensional arrays to 1-dimensional arrays, containing all the elements of the top-level-array and its sub-arrays. Therefore, it is said to be “flattening” the n-dimensional array.

By Christoph Schiessl on Haskell, Functional Programming, and Ruby

Automated Testing with Haskell’s QuickCheck

QuickCheck is one of the libraries, that makes Haskell awesome. Conventionally, testing boils down to writing a number of separate test-cases to express different assertions about a particular piece of code. Testing like that is possible in Haskell (with HUnit), but QuickCheck’s approach is much more subtle …

By Christoph Schiessl on Haskell and Functional Programming

Multithreading in the MRI Ruby Interpreter

Multithreading in Ruby is still not widespread within the community, even though concurrency yields huge benefits for certain kinds of programs. This is especially true in server environments. For instance, using multithreaded HTTP servers increases a server’s throughput and reduces its memory footprint.

Now, there’s a lot confusion surrounding Ruby’s multithreading capabilities. Especially, with regards to all the changes between 1.8 and 1.9. So, let’s be absolutely clear: MRI Ruby does in fact support native threads. Prior to 1.9, only green threads used to be supported. Since Ruby 1.9 this isn’t true anymore: Nowadays, Ruby supports real OS-level threads.

By Christoph Schiessl on Ruby

Defining the Cloud

There’s no consent among experts on what “the Cloud” actually is.

By Christoph Schiessl on Business and Software

A Quick Check for Pending Migrations Before Running your Test Suite

As Rails developers, we are constantly switching between writing application code & tests and running our tests. While this is a great workflow, it sometimes leads to problems. Namely, if we change our database schema, but forget to migrate the DB before re-running the test suite.

By Christoph Schiessl on Ruby, Rails, and Testing

Sass @extend Performance Bottleneck

Suffering from long Sass compilation times? Avoiding @extend may solve the problem.

By Christoph Schiessl on Ruby and Sass

Generating Random Numbers According to a Continuous Probability Distribution with PostgreSQL

When working with statistics, generating pseudo-random samples that are distributed according to a given probability distribution is a frequent requirement. For me, being able to generate these numbers directly with SQL would be very convenient (and might also improve performance). In this post, I’m taking a look at some of the most important continuous probability distributions …

By Christoph Schiessl on PostgreSQL

Benchmark: Single-Column Indexes vs. Compound Indexes

I’ve known about compound indexes for many years but never really thought about them in detail. That doesn’t mean, I’ve never used them – quite on the contrary. At some point in the past I’ve made up some assumptions about when to use them and when to avoid them. However, until now I’ve never taken the time to put my assumptions to the test.

By Christoph Schiessl on PostgreSQL

Organizing Java Command-Line Utilities with the Command Pattern

I’m currently working on a command-line utility written in Java to encapsulate a WSDL web service. As you might expect, the web service is exposing a variety of operations with pre-defined parameters to be called. My tool should make these operations accessible to the user, through an easy-to-use command-line interface. Since the web service I’m working with is composed of dozens of operations, I started looking for a design pattern to help me organize my code and discovered the Command Pattern.

By Christoph Schiessl on Java and Pattern

Simplicity Isn’t Simple

Everybody is talking about simplicity and its promise of leading us to create great products. The underlying assumption here is, that simpler products are more accessible to everyone: the customers, the users, and last but not least the developers themselves. Therefore, simple products are supposed to be easier to sell, a lot easier to use, and easier to maintain.

By Christoph Schiessl on Business and Software

Carl Sagan: We are one species.

An extraterrestrial visitor examining the differences among human societies would find those differences trivial …

By Christoph Schiessl on Misc

Software Start-Ups without Technical Co-Founders

Software start-ups are everywhere. Every single day, you can read about dozens of new and ambitious start-ups in the news. There are many special websites to report about start-ups and other topics that entrepreneurs and developers might be interested in – yes, I’m looking at you HackerNews.

By Christoph Schiessl on Business

Customers and Users Are Not The Same

A few weeks ago, I discovered a fatal flaw in my thinking about customers, users and consequently about business in general. To fix that flaw, I had to re-evaluate the feature set of my products as well as my entire approach to communicating with (potential) customers.

By Christoph Schiessl on Business