Docker Compose and Node.js Projects

  docker, docker-compose, node.js
Docker Compose makes managing local development environments a breeze. On the Systems Team we use it for all of our projects. Setting up Python apps is pretty easy, but if you want to set up a Node.js app, then there’s one small thing you’ll need to do differently. In a Python app, you can mount the files from your project root into a working directory, using the volumes element of the docker-compose.

Dijkstra's Algorithm

  theory
As we all know, algorithms are sexy. But one of the sexiest algorithms is Dijkstra’s; a shortest-path-finding algorithm whose moniker is derived from one of the godfathers of Computer Science, Edsger Wybe Dijkstra. Dijkstra was a Dutch theoretical physicist, mathematician, programmer, and all-around baller. If you don’t know his work you should look it up and then come talk to me about it and we can squee together. Anyway. Dijkstra’s algorithm comes in a couple of flavors but the original one, and the one I will focus on, is used to find the shortest path between nodes in a graph.

Python Context Managers

  python
Context managers, first introduced in Python 2.5 using the with statement, provide a reusable way to execute some code before and after another block of code. This approach reduces annoying boilerplate when doing things like accessing a file or database cursor, and it’s really easy to create your own. Before we dive into that, consider the following examples. Would you rather write this? with open('/path/to/file.txt', 'r') as f: print(f.read()) …or this?

RXSwift Table Views

  swift, reactive
UITableViews in iOS are used fairly often. Common examples are the Mail and Messages apps. They allow for displaying series of data with easy scrolling, selection and some auxiliary options (swipe to delete, reorder, etc). While they are used often, they require a little bit of “configuration” to display any data. Assuming we have a table view such as: let tableView = UITableView(frame: CGRectMake(0, 0, 320, 640), style: UITableViewStyle.Plain) tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cellIdentifier") At this point tableView knows what cell class to render but does not know what data to display yet.

Go Goose

  go
Last week I recreated the Vivy API in Go. Everything was pretty straightforward, however, I did spend some time exploring different options for managing my database migrations. I ended up using Goose, a database migration tool where one can manage their database’s evolution by creating incremental SQL (or Go) scripts. I was very impressed with how easy it was to setup and use, and now I will walk you though my experience.

Vertical Centering with CSS - Part 3

  css
Last time we vertically centered some block-level elements. Fonts are the final frontier. Specifically, @font-face webfonts included via CSS3. Should you opt to include and use, say, Brandon Grotesque, you may notice this phenomenon: These are all vertically centered using a line-height set to 20px, the same height as their container. The Windows example passes with no complaints, but the rest… yeesh. The effect is mostly invisible if you’re just looking at a paragraph of text, but it’s a real problem when you’re trying to center text in buttons, inputs, or navigation.

Vertical Centering with CSS - Part 2

  css
Last time we vertically centered some inline and inline-block elements. This time, the ubiquitous block. The method we’ll be using assumes either a container with a defined height, or a fluid container with some amount of static content inside it that will ensure it’s always taller than (or equal in height to) the element we’re looking to center inside it. The centered element will be absolutely positioned, so this is just a long way of saying: make sure your container doesn’t collapse.

Vertical Centering with CSS - Part 1

  css
Centering things horizontally in CSS has never been rocket science. Throw text-align: center on something inline, margin: 0 auto on something block, maybe even invoke a <center> tag if you’re living in 1997. Getting something to center vertically, though, is a whole different can of worms. Sure, you could go down the road that starts with “set your element to display: table-cell”, but we’ve got more dignity than that. The most basic vertical centering task is a single line of text in a fixed-height container.

Algorithms Analysis - Big O Notation

  theory
The goal of algorithm analysis is to measure the complexity of algorithms and classify them based on their speed and space efficiency. This categorization allows us to easily find the algorithm that best suits our program’s needs. Algorithm analysis is done based on its input size. In order to determine how an algorithm performs, we analyze increases in time and space complexity as the input grows arbitrarily large. The most famous Big O notations to denote the running time are:

Drone 0.3 vs 0.4: Config - Part 3

  drone
This is the third and final installment covering differences between Drone v0.3 and v0.4. Today we will take a look at the new plugin system. Plugins are Docker containers that attach to a build and perform custom tasks. At runtime they receive a JSON payload from Drone with information about the build, workspace, repo, and any configuration options declared the .drone.yml. The following is an example config block for the drone-docker plugin.