Categories
Development

100-day GitHub streak

Exactly 100 days ago I planned to do one contribution to GitHub for at least 100 days. While it was not always easy to create a contribution due to travelling, I’m glad I made it! I just accomplished my 100-day GitHub streak!

100-day GitHub streak
Categories
Development WordPress.org

I’m now a Bug Gardener πŸ‘¨β€πŸŒΎ

Two days ago, Sergey informed me that he added me as a Bug Gardener πŸ‘¨β€πŸŒΎ. I can now assign owners to issues, resolve them, close them, etc. That’s how the interface looks that I can no access in Trac:

Categories
Development

Move .git to the parent directory

During development, we follow a specific file and folder structure. It’s common that things change during development. And in some cases, it’s necessary to move .git to the parent directory. This post shows how to achieve that.

Categories
Development

Fix Jetpack related posts in WordPress 5.3

Earlier today, WordPress 5.3 got release. Unfortunately, this seems to have affected Jetpacks related posts. Instead of centred, the related posts were suddenly left aligned. I went ahead and added the following code to my site, which not only centred the related posts but also made that container wider. This is the CSS code I’ve added to my site:

Categories
Development Theme WordPress.org

Exclude node_modules and vendor from theme check plugin

While I created countless themes, I’m currently creating my first theme for the WordPress.org theme repo. To ensure a smooth reviewing process, I’m using the plugin Theme Check as mentioned in the theme review handbook.

After adding both composer and npm to my theme, I ended up with an Fatal error: Allowed memory size of 536870912 bytes exhausted error. Investigating this issue brought me to:

I found the solution to my specific issue in:

Thus, I went ahead, opened the main.php in the root folder of the plugin and replaced

with

While this might not be the best solution to solve this issue, it allows me to analyse my theme.

Categories
Development

Adjust GROUP_CONCAT() maximum length

I’m currently working on a redesign of a site of a good friend. He’s a professional photographer from Amsterdam and I built his first site in 2011. Back then, I build his site with nexCMS, my very own CMS, which was based on the Zend Framework. Throughout the years, my friend created almost 4000+ posts and uploaded 13.000+ images.

Categories
Development

Optimize images using using WP-CLI

While working on my sister’s site, I noticed that every image was available in 10 different formats caused by 19 different images size definitions.

I do have to say that my sister is a professional photographer who keeps blogging regularly since 2012. Throughout the years she uploaded 6000+ images. Due to the various images sizes the upload folder of her site used 10 GB storage.

To save storage, I’ve analyzed which of the defined images sizes are actually used and which one can be replaced and removed. In the first step, I set the height and width of the obsolete images to zero pixels by adding the following snippet to my functions.php:

In the next step, I deleted the obsolete images sizes one by one using the following WP-CLI calls:

While I could have skipped this step, I wanted to work on one image size at a time to be able to measure the impact of the change. After the first round of optimization the images sizes looked like this:

After checking the site to verify that no images are missing I then removed all obsolete image definitions by replacing the previous snippet with the following one:

After the second round of optimization the images sizes looked like this:

In a final step, I regenerated all images by running the following WP-CLI statement:

While it’s not much, I was able to save 300 MB of space on the server. I assume that while I’ve deleted many images, I might have also created a few variations of images that haven’t existed yet. This is the final result.

Categories
Development

Running an SQL Injection

Just stumbled upon this fantastic video of Mike Pound who explains how SQL injections work and what risk they cause.

Please note that running SQL injections on other’s sites is considered a crime! Don’t be a jerk and only experiment with SQL injections on own (local) sites!

Categories
Development

JavaScript30 – Day 19

In today’s lesson, I learned how to pipe webcam input and manipulate the stream on the fly. In comparison to the other lessons, this lesson required the use of npm. The final code can be found onΒ Day 19 – Webcam Fun.

Resources:

Categories
Development Education

30 Days of Node.js – Day 16

Compressing files plays a very important role when transferring huge amounts of data via the internet. In today’s lesson, I’ve learned how to compress and decompress text files. The code snippets can be found onΒ https://github.com/nielslange/30-days-of-node-js/tree/master/Day%2016%20-%20Zlib%20Module.

References: