Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  How to handle ES6 modules in NodeJS

In modern JavaScript, there are two types of modules: ES6 module and CommonJS module used by NodeJS. These two types of module are not compatible. Many people would wonder how to load ES6 modules in their NodeJS project. This post will show how this can be done.DifferenceThe syntax of the module being loaded is different. CommonJS modules are loaded with require() and exported with module.exports. ES6 modules are loaded and exported using import and export respectively.Merchanismwise require() is doing sequential loading, other statements must wait for this statement to complete before executi...

4,303 0       COMMONJS ES6 NODEJS


  Format JSON data on Ubuntu

JSON now becomes a very popular data format because of its simplicity and light-weight. Nowadays many RESTful APIs will offer a choice of exchanging JSON data between the server and client. Sometimes the data may not be formatted and it cannot be easily read by human beings. It's frequently desired that the unformatted JSON data should be formatted before read.Today we will show a few ways to format JSON data on Ubuntu. Assume we have a json file test.json with below content.{ "title": "Test", "description": "Sample description" }The normal cat command will output below content.postman@postman...

25,603 1       UBUNTU LINUX RUBY PYTHON NODEJS PERL JSON JQ YAJL


  Why does LinkedIn migrate to NodeJS from Ruby?

Node.js, the server-side JavaScript-based software platform used to build scalable network applications, has been all the rage among many developers for the past couple of years. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. Because of these advantages, there are many websites are migrating to Node.js.One of them is LinkedIn.LinkedIn was initially built on Ruby which contained 60K lines of code, later in 2011, LinkedIn started to rebuild their core mobile servi...

15,826 0       RUBY LINKEDIN NODEJS


  Generate first N prime numbers

Recently I am taking an online course named "Startup Engineering" on coursera. There is one assignment which is to use NodeJS to write a program to generate the first 100 prime numbers. This may be very easy for many people. Here I just want to share with you the code to generate not only the first 100 prime numbers. but also any number of prime numbers.Below is the code snippet://Helper class to generate prime numbersvar PrimeProcessor=(function(){ var primeArray=[]; function _isPrime(num){ if(num<=1){ throw new Error("Number cannot be sm...

11,758 5       JAVASCRIPT ALGORITHM NODEJS PRIME NUMBER COURSERA


  How One Missing `var` Ruined our Launch

Well, that was a veritable shitstorm (sorry for the language).  Long story short, MelonCard was featured today on TechCrunch (along with other500Startups companies, also on VentureBeat, Forbes, …) and everything broke all at once.  Every. little. thing.  We had rolled out a huge change to MelonCard over the last few days to make our site a seamless “everything just updates” look-good / feel-good product using NodeJS long-polling with a slick KnockoutJS dynamic jQuery Templates front end.  We did our du...

7,445 2       JAVASCRIPT JQUERY NODEJS VARIABLE SCOPE GLOBAL