String startsWith() function in JavaScript

JavaScript
String startsWith() implementation for JavaScript. JavaScript has until now no String startsWith() implementation. The following polyfill implements this function - if it is not yet implemented by another library or script. [crayon-5a377efc0c68c007743486/] See also: String endsWith() function in JavaScript
Read More

String endsWith() function in JavaScript

JavaScript
String endsWith() implementation for JavaScript. JavaScript has until now no String endsWith() implementation. The following polyfill implements this function - if it is not yet implemented by another library or script. [crayon-5a377efc0cf59875402862/] See also: String startsWith() function in JavaScript
Read More

How to get all files in a folder in NodeJS

JavaScript, nodejs
This snippet shows how to get all files in a folder in NodeJS: You can use this snippet to get all files from the specified folder - non recursively [crayon-5a377efc0d491991943834/] Note that we ignore directories in line 9. Usage: [crayon-5a377efc0d49c897439277/] If you want to get all files from a folder recursively, you can use this snippet: [crayon-5a377efc0d4a1344694952/] Note that we recursively call the getFiles method for sub directories in line 9. Usage: [crayon-5a377efc0d4a8587505947/]
Read More

How to create a new Sinopia user

JavaScript, Web
This tutorial will show you how to create a new Sinopia user. In a previous tutorial we saw how to setup a private NMP repository with Sinopia. Now we will see how to create a new Sinopia user in that private repository. You can easily create a user both on the server and on the client by issuing this command: [crayon-5a377efc0e263954174497/] Change the host and port appropriately. On the next prompt: specify the name and the password (twice). Next you can specify an email address to be used for notifications. Press enter to complete the user registration. You can find the list of users and their hashed passwords in the htpasswd file which is located in the root folder of the Sinopia installation. The newly created user cannot publish to…
Read More

How to setup a private NPM repository with Sinopia

JavaScript, Web
This tutorial shows you how to setup a private NPM repository server with Sinopia in 4 easy steps. [caption id="attachment_629" align="alignnone" width="274"] sinopia on NPM[/caption] Sinopia is a private/caching NPM repository server. It allows you to have a local NPM registry with zero configuration. 1. Installation and Initial Configuration of Sinopia on a server Make sure you have nodejs installed on your server. On your server create a folder called sinopia. Open a shell in this folder and type [crayon-5a377efc0efbb746175345/] From this new directory, start Sinopia to build the initial configuration file. On initial startup in an empty directory, the output will resemble the following: [crayon-5a377efc0efc7108315438/] Note that the server is running and you should be able to access it at http://localhost:4873. Unless you want to use this Sinopia server…
Read More

Watch any member of an object or a list.

AngularJS, JavaScript, Web
If you watch a list or an object with the objectEquality parameter not set, then the $watch callback function won’t be triggered if the object is only updated partially. [crayon-5a377efc0ff51422880269/] Setting the objectEquality parameter to true will trigger the $watch callback function on modification of any member. [crayon-5a377efc0ff5d811903218/] Using this the objectEquality parameter has performance impact, so use carefully.
Read More