NodeJS How to determine or check for current OS (Operating System)

There are two ways of doing it,

First using the native OS module,

Check out the API function available for OS module here

https://nodejs.org/dist/latest-v5.x/docs/api/os.html#os_os_platform 

Basically, all you have to do is to call platform() function from the OS class. Here is how its done

Check if its windows operating system,

os.platform()

Returns the operating system platform. Possible values are,'darwin' 'freebsd''linux''sunos' or.'win32'

A bit detailed code version with some other methods from my Windows 10 machine

Second, using the process’s platform property,

os.platform() basically returns the values of process.platform property

Above logic can be rewritten as

I hope this helps

Jas

PHP check if search engine bot

How do you check if your website is being crawled by a bot or spider, or in case you want to expose a certain section or sections of your website to the search engines which otherwise would be hidden from them as they are protected … [Continue reading]

Ionic 2+ How to access parent navController

There could potentially be scenarios when you will have something like this [crayon-5a31a6f15aebe940419029/] Each of ion-nav components have their own NavController, when you try to push or pop a view, depending on the inheritance level of your … [Continue reading]

PHP: Check if Start of each word in a sentence is uppercase or any part of a word is UPPERCASE

When working with strings, occasionally we would want to check if any part of a word is uppercase or start of a word is an uppercase letter. This post provide a generic function that can be extended to match your needs. For this post I will use … [Continue reading]

How to convert a string to equivalent integer value based on ASCII codes in Javascript

Hi Guys, Here is a quick tip if you would like to convert a string into a sum of ASCII codes for all characters Function you can use For ES5: [crayon-5a31a6f15bcbe652796403/] We can do equivalent in ES6 … [Continue reading]

Hunspell with PHP on Windows – Part 1

Ok so I hear you saying, how the hell can I use Hunspell and PHP with Windows, Now the way I am going to show you isn't the only way but is a much simpler way without compiling and using binaries. What is Hunspell? Well I can re-write what's … [Continue reading]

PHP Start of the day and End of the day for a timezone Util functions

This is a quick post where I am sharing a couple of functions to calculate start of a given day and end of the day for a given timezone Start of the day [crayon-5a31a6f15cfe6635645202/] End of the … [Continue reading]

[Solved] bootbox.js show ajax html data inside the dialog

Hi Guys Just a quick one here if you are using a library called bootbox.js in your project. This library does not make ajax request automatically if you wish to load some data from your server to show within your dialog window. Instead, you can do … [Continue reading]

Project Data Sources: re-sync required – Upgrading to PhpStorm 10.0.2

Hey Guys, While I upgraded to PHPStorm 10.0.2 and restarted it, I got this message at the top right corner of this IDE Project Data Sources: re-sync required Unsupported format version 2.2 - (2.4 expected) While that got me puzzled for a … [Continue reading]

How to get Pinterest Numeric Board ID

Get Pinterest Numerci board ID

Hi Guys, It used to be easy to get Pinterest board ID before, but for some reason they have buried that sort of information within source, A while back I wrote something that wouldn't use the Pinterest official/unofficial API but parse the HTML … [Continue reading]