Edd Mann Developer

Simplify Git commit fixes using fixup and auto-squash

Throughout a project I will typically make commits that could be categorised as fixes to previous commits. To help highlight such commits I would follow the pattern of starting the message with ‘fix: …’, making the final rebase step (before merging into master) easier. However, as time passed locating which ‘fix-commits’ related to other previous commits became harder to determine.

Implementing Streams in PHP

Typically, when we think about a list of elements we assume there is both a start and finite end. In this example the list has been precomputed and stored for subsequent traversal and transformation. If instead, we replaced the finite ending with a promise to return the next element in the sequence, we would have the architecture to provide infinite lists.

Cons Lists and Folds in PHP

Cons cells are used to (cons)truct a data object which represents an ordered pair. The elements in this pair can be identified as ‘car’ and ‘cdr’ accordingly. Using this simple representation we are able to not only hold ordered pairs, but also create more complex data-structures, such as a List.

The Internals of Git

I have been using Git for the past couple of years and remember how long it took me to get my head around the work-flow. Throughout the past couple of months, thanks to a couple of well timed findings, I have gained an interest into how Git works internally. In this post I hope to explain how Git uses well-designed, composed low-level commands to create the high-level actions we are familiar with using on a day-to-day basis.

Reversing a Unicode String in PHP using UTF-16BE/LE

Last week I was bit by the Unicode encoding issue when trying to naively manipulate a user’s input using PHP’s built-in string functions. PHP simply assumes that all characters are a single byte (octet) and the provided functions use this assumption when processing a string. In this article I will not be going into depth on the subject of Unicode representations, I feel this topic deserves it’s own series of articles. However, you should be aware that in ‘Western Europe’ we commonly only use the basic ASCII character-set (consisting of 7 bytes). This makes the transition to the popular ‘UTF-8’ Unicode representation almost seamless, as the two map one-to-one. I wish to however, discuss how to reverse a Unicode string (UTF-8) using a combination of endianness magic and the ‘strrev’ function.