Category snippets

Iterating Arguments in JavaScript

A correct way to iterate arguments in JavaScript. This is a short snippet that most of you are aware of, but it is nice to note it because if you don’t know it you will get into problems like me, a year ago. We all do development in one of the browsers, and then we […]

JavaScript Simple and Elegant Function Chaining

A very simple Array prototype that chains functions listed in it via function outputs. This is not an object function chaining. It just connects or pipes function outputs to the next function in the array.  It is a short and simple snippet, that eliminates a lot of brackets and improves readability and encourages small (max […]

JavaScript deterministic object stringify

For some time I needed to use objects as a hash table (associative array) key in JavaScript, and for all that time I skillfully evaded to wrap my head around it. JavaScript objects (hash tables/associative arrays) are unordered data sets which means that the property (key) order isn’t guaranteed. I believed that for(var i in […]

JavaScript using objects as keys

If you ever wondered how associative arrays work or way are they called hashes in Ruby? The answer is hash tables, and if you look into the wikipedia article, you can understand how they work and how simple they are. I will try to be quick and concise in the explanation: Introduction to Hash Tables […]

Dynamic module import in Python

Every now and then I was working in Python I needed to dynamically import some modules cause I like declarative style and importing and using only modules that I really need depending on the configuration while executing the program.  Dynamical module loading helps better granularization of code by breaking a big script into topic related […]

JavaScript Map class

Java like Map class for JavaScript, a wrapper arround JavaScript’s native key value hash tree storage inside objects. If you are familiar with Java Map this shouldn’t be news to you. The idea is this: enable the key value storage with some additional functionality, speed up iteration, and harvest the speed of native hash table […]

JavaScript object comparison

Function for deep comparison of object instances and arrays in JavaScript. It compares all data types except functions, because functions are not data, nor they should contain it. All functions should be unique, two same functions don’t make sense and/or use. This article covers the detailed explanation of an approach to solve the deep object […]