Php

Parsing strings with Go

Parsing strings would arguably be one of the more basic operations that one can do in any language. Sometimes, this may mean comma separated values from an user input on a web page, it may mean parsing application arguments from os.Args, or parse some line based input like lines from an IRC chat, Slack, Discord or some other chat system for a bot.

Read more

Testing PHP code using Docker

Setting up a testing environment can be a rewarding pursuit - if you do your testing before you deploy code, your tests can signal errors and stop you from deploying a critical mistake to production. Testing requires various software, depending on your development process. One of the most common php testing frameworks is phpunit. Let’s see how we can set up a Docker driven test environment.

Read more

Premature optimization

In my many years as a software developer, this is one phrase which I have heard over and over: "Don't optimize your software prematurely." I have no idea where the phrase came from. I know that most software is shit because people don't know any better. And generalities like this encourage people to write bad software. I will try to list a few things that I think make up a good developer culture.
Read more

PHP Comparisons

If there is something every developer (not just PHP) should know, it's when to use a strict equality operator. Interestingly enough, using empty() in PHP has exact behavior as checking loose equality with `== false`. This whole thing was inspired (and partially ripped off of) the JavaScript Equality Table. The design caught my eye, more than anything. I'm kinda wishing most if not all languages would have this kind of basic reference.
Read more

API Backpressure

It's days like this where I love my job. I'm implementing back pressure for API calls that communicate to an external service. Depending on how overloaded the external service is, my API interface adapts to use caching more extensively, or to use a service friendly request retry strategy, minimizing impact on infrastructure and possibly even resolving problems when they occur. This is done by keeping track of a lot of data - timeouts, error responses, request duration, ratios between failed and successful requests,.
Read more