Home » JavaScript (page 35)


Playing with concurrency and performance in Java and Node.js

Imagine a simple market where buyers and sellers interested in the same product come together to trade. For each product in the market, buyers interested in the product could form an orderly queue, sorted on a “first come, first serve” basis. Each buyer could then approach the cheapest seller and trade, purchasing as much of the product from the seller ...

Read More »

Batten Down Those Node Dependency Hatches

Dependency management is oftentimes a mundane subject. And it’s not much of a subject at all if you don’t depend on rapidly changing libraries. Of course, you might not always realize you’re depending on a rapidly changing library – especially, if you happen to take a rather liberal approach of depending on snapshots or latest versions, as I often do. ...

Read More »

How the JavaScript heatmap implementation works?

A heatmap is a powerful way to visualise data. Given a matrix of data each value is represented by a color. The implementation of the heatmap algorithm is expensive in computation terms: for each grid’s pixel you need to compute its colour from a set of known values. As you can thing, it is not feasible to be implement it on the ...

Read More »

JavaScript String Split Example

When building or maintaining an interactive website, it may happen that the input you get from the user can be correct in meaning, but written as a long string separated by special characters such as commas or semicolons. In these cases, JavaScript string split functions come to the rescue. You can split the long string into small ones and save ...

Read More »

Learning Angular: Unit Testing watch expressions

Today I wanted to write a unit test for a watch expression on my controller. What seemed quite obvious initially, turned out to be quite nasty. Anyway, thx to a nice community member on the Angular IRC, I was able to quickly resolve the issue. So, here’s the story.   This article is part of my “Learning NG” series, presenting ...

Read More »

Promises you can trust

JavaScript Promises provide a strong programming model for the future of JavaScript development. So here I’m playing with promises. First I need a bit of a package.json file:           Now I can write my first test (test/promises_test.js): Notice that the “it” function takes a “done” function parameter to ensure that the test waits until the promise ...

Read More »

JavaScript String Contains Example

Usually, programming languages have a special preprocessed function to find a substring of a string. But what happens when you language of choice doesn’t have one? Well the answer to that is: You make one! How exactly do you write such function in JavaScript, we are going to show you below. Does a ready made function exist? It does! If ...

Read More »

Avoid test code duplication in Jasmine tests

Test code has to be treated like production code. Obviously we cannot charge the customer for it, it’s something that helps us developers to make sure we keep our codebase healthy, which ultimately is the responsibility we have towards our customers. Thus we need to apply the same best practices principles as we do for our production code, where, code ...

Read More »

Watch file changes and propagate errors with Gulp

Gulp fever infected me. Streaming model is very interesting and modern. After initial excitement, I started to experience first pitfalls. This is understandable for such young project. I am going to describe my problem with watching file changes and propagating errors. Error in Gulp by default breaks the pipe, terminates the build/test and whole Gulp process with some error code. ...

Read More »

Want to take your WEB dev skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • PHP Programming Cookbook
  • jQuery Programming Cookbook
  • Bootstrap Programming Cookbook
  • Building WEB Apps with Node.js
  • CSS Programming Cookbook
  • HTML5 Programming Cookbook
  • AngularJS Programming Cookbook