Detect device's OS in JavaScript

There comes a scenario when you might want to check which operating system the device is running. For instance, when you want to set device-specific download links. For windows, .exe file, for macOS, .dmg file and so on.

» Read More

Strict typing vs. Weak typing in PHP

With PHP 5, the core team had introduced type declarations (also known as type-hinting) that allow functions to require that parameters are of a certain type at call time. If the given value is of the incorrect type, then an error is generated: in PHP 5, this will be a recoverable fatal error, while PHP 7 will throw a TypeError exception.

» Read More

Validating Laravel requests using rule objects

Laravel comes with a multitude of ways to validate request parameters. For instance, you could use Illuminate\Http\Request’s validate method where you can specify all the fields that you would want to get validated inside controller’s action. You can do it like so.

» Read More

Detecting if device is online or offline using plain JavaScript

There might be cases where you would like to check if the device on which the website is loading is connected to the internet or not. For instance, this can be used to show the user the message if their device is offline or to disable some functionality of the application if the device is offline.

» Read More


Follow me on Twitter @amit_merchant