markoshust's blog

Wed, 10/25/2017 - 13:35

Migrate large amounts of data in Laravel with Artisan Console and Chunk

Submitted by markoshust Wed, 10/25/2017 - 13:35

I've recently had to create a script to migrate a large amount of data post-deployment. This presented a couple issues; one being that the script needed to be performant, another being that since it took at least a few minutes to run on a couple hundred thousand rows, I needed to display the status of the script for devops so it didn't appear to be hungup or failed.


Wed, 09/13/2017 - 11:59

Enable Bootstrap 4 in Laravel 5.5

Submitted by markoshust Wed, 09/13/2017 - 11:59

Laravel 5.5 just recently got released, and ships with the current stable version of Bootstrap, which is version 3. However, Bootstrap 4 recently hit beta, and should now be solid enough to start development with, especially for new Laravel projects that are just now getting started.

Bootstrap 4 can be easily enabled following these steps. First, remove the Laravel-supplied version of bootstrap-sass from npm:

npm uninstall --save-dev bootstrap-sass


Fri, 08/25/2017 - 16:21

PHP 7's null coalesce operator usage with Objects and Arrays

Submitted by markoshust Fri, 08/25/2017 - 16:21

PHP 7 introduced the null coalesce operator. Basically, it's syntactical sugar and shorthand when checking for the existence of a variable and then falling back to some value.

For example, this small script outputs bar, because $foo is not yet defined.

echo $foo ?? 'bar';

It's the same thing as writing the following, just much more readable and succinct:


Thu, 03/02/2017 - 09:15

Making Docker for Mac Faster with the Overlay2 Filesystem

Submitted by markoshust Thu, 03/02/2017 - 09:15

By default, Docker for Mac ships with the default filesystem being aufs. This is a fairly antiquated filesystem and is quite slow if you deal with lots of files and filesystem reads and writes. You can see the results of a filesystem benchmark to compare.

The easiest task to do to get better filesystem performance in Docker is to switch to the overlay2 filesystem. This achieves better performance by optimizing how layers are created and managed.


Tue, 08/23/2016 - 12:04

The JavaScripter's Guide to Rational Development

Submitted by markoshust Tue, 08/23/2016 - 12:04

JavaScript Fatigue is a real thing, and there must be rules & processes in place to help prevent it from happening to you. These are my thoughts.

Learn, don't apply

Learn new libraries, npm packages, and development methodologies, but don't apply them to your current projects until best practices are formed. This might take some time, hence the next rule...


Sun, 08/14/2016 - 05:08

Create and deploy a NodeJS Express app with Docker

Submitted by markoshust Sun, 08/14/2016 - 05:08

I'll show you a stupid fast and simple way to create an express app with NodeJS, then deploy it with Docker. All you need is a simple text editor.

Install NodeJS & Docker

Install node with n:

npm i -g n
n latest

Install Docker by pulling out the appropriate build from https://docs.docker.com/engine/installation/.

App setup

Let's now get our express app setup. Create a new directory and initialize your package.json file:


Fri, 08/12/2016 - 10:32

Creating a better reactive ReactJS JavaScript architecture

Submitted by markoshust Fri, 08/12/2016 - 10:32

After working through a few ReactJS JavaScript projects based in Meteor, what the ecosystem lacks is a really good architecture that will grow with you. Not only should it be adaptable and somewhat future-proof in a space that seems to be ever-changing at a rapid pace, but it lacks having an established organizational paradigm present, specifically when dealing with reactive, single-page applications.


Thu, 06/02/2016 - 13:58

Creating a multi-page form using MobX with Meteor & React

Submitted by markoshust Thu, 06/02/2016 - 13:58

Mobx is a really simple state manager that can be used really nicely with React, when you don't need the complexity of a Redux implementation.

Using Mobx is pretty straight-forward, however their getting started documentation uses stage-0 class properties, which are currently not supported with Meteor 1.3. The simple fix is to use ES6 formatting.


Mon, 02/01/2016 - 12:58

Creating a Custom Production Docker Image for Meteor 1.3

Submitted by markoshust Mon, 02/01/2016 - 12:58

Meteor 1.3 introduces custom package.json support, which allows you to use custom NPM packages within your Meteor app. This is great, because up to Meteor 1.2 you needed to use oddly formatted "NPM wrapper" packages.

This setup does include a slightly different build process though, as we need to install these custom NPM packages within our production Meteor app.