Subscribe to The infinite monkey theorem

Stay up to date! Get all the latest & greatest posts delivered straight to your inbox

The infinite monkey theorem

a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type any given text, such as the complete works committed to git

Adding a local library to a monorepo cover image
Typescript,  Node,  monorepo

Adding a local library to a monorepo

In this article we will be adding a shared local library to a monorepo.

Windscribe VPN on OpenWRT Linksys MR8300 cover image
OpenWRT,  OpenVPN,  Windscribe,  MR8300

Windscribe VPN on OpenWRT Linksys MR8300

In this article we will be setting up an OpenVPN client on OpenWrt.

Do not trust all certificates cover image
android

Do not trust all certificates

Trusting all certificates allows anybody to do a man in the middle attack

Dependency injection explained cover image
swift

Dependency injection explained

Why do we need to inject dependencies and some tools that help with it...

A useful extension of XCTestCase cover image
swift

A useful extension of XCTestCase

XCTest expectations are great but it is not easy to use them.

Should one always use weak self to avoid retain cycles? cover image
swift

Should one always use weak self to avoid retain cycles?

It has become pretty common among Swift experts to always use [weak self] inside of a closure to avoid retain cycles ...

Ghost: why this blog no longer runs on it cover image
ghost

Ghost: why this blog no longer runs on it

We started using Ghost when it was still in its very early stages ...

UIScrollView with AutoLayout, programmatically cover image
swift,  auto-layout

UIScrollView with AutoLayout, programmatically

It is fairly easy to use UIScrollView with the AutoLayout on iOS 12+ but only if one follows the following steps ...

Framework with C code cover image
swift,  ios,  xcode

Framework with C code

How to create a framework that uses C with Xcode

Symbolification in iOS applications cover image
ios,  xcode

Symbolification in iOS applications

Symbolification is the process of mapping machine addresses into the source code. The tricky part is that by default .DSYM file is only generated for release builds.

How to avoid memory leaks cover image
rx-swift,  swift,  ios

How to avoid memory leaks

RxSwift is a powerful framework and, as always, with power comes responsibility.

Setting height constraint for a view in a cell cover image
ios,  swift,  auto-layout

Setting height constraint for a view in a cell

We needed a collection view cell that contained an image view and a label.

UICollectionView: Self sizing cell with a UILabel on iOS 10 cover image
swift,  ios

UICollectionView: Self sizing cell with a UILabel on iOS 10

All we needed was a simple UICollectionView with just one cell that contained a label ...

Use of unresolved identifier 'Resources' cover image
rx-swift,  swift,  cocoa-pods

Use of unresolved identifier 'Resources'

RxSwift.Resources are being used to detect memory leaks during pre release tests. Solving Use of unresolved identifier 'Resources' error.

Sign and verify data cover image
openssl

Sign and verify data

RSA verification process is similar to RSA encryption/decryption process with one major difference.

How to choose minSdkVersion, targetSdkVersion, and compileSdkVersion cover image
android

How to choose minSdkVersion, targetSdkVersion, and compileSdkVersion

Picking your compilesdkversion, minsdkversion, targetsdkversion.

Cannot lock ref ... cover image
git

Cannot lock ref ...

git remote prune origin

Keeping git history clean cover image
git

Keeping git history clean

git rebase -i 95eeee3^

Unwanted padding in UICollectionView in iOS 10 cover image
swift,  ios,  auto-layout

Unwanted padding in UICollectionView in iOS 10

On iOS 10, a collection view embedded in a view has unexpected padding at the top.

Nodemailer 'Please log in via your web browser and then try again' error when using Gmail cover image
nodejs,  ghost

Nodemailer 'Please log in via your web browser and then try again' error when using Gmail

While browsing our Node.js site logs we have noticed the following error...

Terms of use: cheat sheet cover image
terms-of-use

Terms of use: cheat sheet

Lawyers are the worst. An example of terms of use...

UICollectionView terminating with uncaught exception of type NSException cover image
xcode,  ios,  swift

UICollectionView terminating with uncaught exception of type NSException

ne of our views that contains a UICollectionView started crashing once in a while...

Memory issues running Ghost with MySQL on tiny machines. cover image
mysql,  ghost,  ubuntu

Memory issues running Ghost with MySQL on tiny machines.

Unfortunately stabilizing MySQL on our tiny server was not simple and in fact the only thing that helped was a SWAP file.

Flatten and some of its strategies cover image
swift,  reactive-swift

Flatten and some of its strategies

The power of ReactiveSwift lies within its operators.!

Working with a playground cover image
swift,  reactive-swift,  reactive-cocoa,  ios

Working with a playground

According to the documentation, to use ReactiveSwift.playground the following steps must be performed...

A very important difference between a Signal and a SignalProducer cover image
reactive-swift,  reactive-cocoa,  swift

A very important difference between a Signal and a SignalProducer

A property in ReactiveSwift allows us to track its changes over time.

A simple optimization for UICollectionView (or UITableView) updates cover image
swift,  ios

A simple optimization for UICollectionView (or UITableView) updates

Collection view is highly optimized and works great out of the box.

Compiler Error when using Generics and nested functions, Command failed due to signal: Segmentation fault: 11 cover image
swift,  ios,  xcode

Compiler Error when using Generics and nested functions, Command failed due to signal: Segmentation fault: 11

The following code is causing a compiler crash when compiled with Swift 3 and Xcode 8...

Creating NSManagedObject subclasses from a model in Xcode 8 cover image
xcode,  swift,  ios

Creating NSManagedObject subclasses from a model in Xcode 8

In Xcode 8, it is no longer possible to create NSManagedObject subclasses...

Catching an exception in Swift using functions! cover image
swift

Catching an exception in Swift using functions!

Recently we had a need in a general way to catch calls that can throw an exception.

Debugging xxx was deallocated while key value observers were still registered with it cover image
swift,  xcode

Debugging xxx was deallocated while key value observers were still registered with it

Debugging errors that are a result of observers being added to an object and not removed from it can be hard.

Update Git to respect a newly added .gitignore cover image
git

Update Git to respect a newly added .gitignore

git rm -r --cached .

Importing a Shapefile into MongoDB using GeoJSON cover image
mongodb,  gis

Importing a Shapefile into MongoDB using GeoJSON

Shapefiles are technology from the past when desktops ruled supreme.

VIPER architecture cover image
swift,  architecture,  viper

VIPER architecture

Decouple, separate, disengage, or dissociate (something) from something else.

Debugging view constraints with Xcode 7 cover image
xcode,  objc,  swift,  auto-layout

Debugging view constraints with Xcode 7

A small button named 'Debug view hierarchy', displays current view hierarchy in 3D.

Using guard to test for an empty string cover image
swift

Using guard to test for an empty string

In Swift, we have a syntax candy called 'guard'..

Stack views vertically or horizontally on iOS 8 using AutoLayout cover image
ios,  auto-layout,  swift

Stack views vertically or horizontally on iOS 8 using AutoLayout

While starting iOS 9 we have UIStackView, it is a little bit tricky to stack views vertically or horizontally.

Positioning views relative to one another with auto-layout cover image
xcode,  auto-layout,  swift

Positioning views relative to one another with auto-layout

Positioning views relative to one another with auto-layout was fairly tricky until...

Cheat sheet cover image
swift

Cheat sheet

Just a bunch of short expressions in Swift.

Location block and rewriting URLs cover image
nginx

Location block and rewriting URLs

URI - the part of URL that comes after the domain (or IP/Port) name.

Renewing GoDaddy SSL certificate cover image
nginx,  ssl,  godaddy

Renewing GoDaddy SSL certificate

Renewing a certificate is not fun so it is better to use Let's Encrypt but if that is not an option...

pip IncompleteRead error after Ubuntu upgrade cover image
ubuntu,  python,  pip

pip IncompleteRead error after Ubuntu upgrade

After upgrading ubuntu pip started throwing the following error...

Adding an external library cover image
android-studio,  android,  library,  volley,  networking

Adding an external library

We needed to add Volley networking library into our project.

Cutting off songs early cover image
itunes

Cutting off songs early

We all understand the frustration users experience when software malfunctions...

mysql2 gem error after upgrading MySQL database cover image
ubuntu,  ror,  mysql

mysql2 gem error after upgrading MySQL database

After upgrading to MySQL 5.6 from 5.5 we started getting an error: Incorrect MySQL client library version!

Using environment variables under Nginx cover image
rails,  nginx,  passenger,  phusion

Using environment variables under Nginx

Rails is heavily using environment variables in its configuration files.

Minimum rights policy for S3 that works with CarrierWave cover image
ror,  s3,  carrier-wave

Minimum rights policy for S3 that works with CarrierWave

YAmazon S3 does not like dots in bucket names.

Installing Nginx with Phusion Passenger, RVM, and Ruby on Rails on Ubuntu cover image
rails,  rvm,  nginx,  ubuntu,  passenger,  ror

Installing Nginx with Phusion Passenger, RVM, and Ruby on Rails on Ubuntu

Digital Ocean has a great tutorial on how to install Nginx with Phusion Passenger, RVM, and RoR on Ubuntu.

NSURL URLWithString vs fileURLWithPath cover image
ios,  objc

NSURL URLWithString vs fileURLWithPath

A frequent mistake when playing a local video using [AVAudioPlayer initWithContentsOfURL:url] is to use URLWithString instead of fileURLWithPath.

fileExistsAtPath always returns NO (false) cover image
ios,  ios-8,  objc

fileExistsAtPath always returns NO (false)

Generating the path dynamically with NSSearchPathForDirectoriesInDomains.

Set application name depending on the build type cover image
ios,  xcode

Set application name depending on the build type

Having a different application name for release and development builds.

Send Apple Push Notifications with Python 2.7 cover image
python,  apn

Send Apple Push Notifications with Python 2.7

Yosemite has Python 2.7.6 built in but for many reasons (one of them is sudo) we prefer a clean up-to-date install.

Thunderbolt Display firmware Update 1.2 cover image
osx,  yosemite

Thunderbolt Display firmware Update 1.2

The update just failed every time I tried to install.

Upgrading Ghost to the latest version cover image
ghost

Upgrading Ghost to the latest version

Keeping Ghost installation up-to-date is important not only because of new features added but also because of all the security updates.

Updating Homebrew after OS upgrade cover image
osx,  yosemite

Updating Homebrew after OS upgrade

Unfortunatrly, Homebrew breaks after an upgrade to OS X Yosemite.

Supporting iPhone 6 & iPhone 6 plus resolutions cover image
ios,  ios-8

Supporting iPhone 6 & iPhone 6 plus resolutions

By default all the apps (even compiled with Xcode 6 and iOS 8) will run in a scaled mode on both iPhone 6 & iPhone 6 plus.

Remote notifications cover image
ios

Remote notifications

Push notifications on iOS 8.

Adding a tag cover image
git

Adding a tag

git tag -a prod-0.9.7 -m 'add analytics'

Checkout a file (just one file) from a specific commit (revision) cover image
git

Checkout a file (just one file) from a specific commit (revision)

git checkout 6c1d1862 AppConsumer/Curbsidr.xcodeproj/project.pbxproj

Compiling Facebook SDK with Xcode 6 cover image
xcode

Compiling Facebook SDK with Xcode 6

Compiling Facebook SDK with Xcode 6 is not yet an option.

Currency string from a number (double) cover image
objc

Currency string from a number (double)

Converting a decimal number to a currency string is simple with NSNumberFormatter.