vpalos.com // milk, cookies, segfaults…

Category Archives: Dynamic scripting

Universal getter for plain JS objects.

by Valeriu Paloş on April 15, 2013

Many times in JavaScript we have to reach deep into objects to access fields that could possibly not be there at all; for example let’s assume I have a JS object called options into which I’ve just read an entire JSON configuration file. Trying to access a field like options.application.cache.enable directly will potentially fail (e.g. […]

Quickly filtering large lists of texts.

by Valeriu Paloş on December 19, 2012

Recently, I had to make a mock-up of a filtering function (something I need for a project I work on) so I can show-case it around. And since this mock-up seems to impress some people, I decided to share this function with everybody so others may enjoy the “loot” :). Briefing The function (i.e. filter()) […]

JS classes for the masses.

by Valeriu Paloş on December 1, 2012

Following on an older post of mine, I decided to write a new article about an(other) implementation of OOP Classes in JavaScript. This is something that brings a lot of value from very few lines of code and I want to share it with everyone and see how it can be improved. First let’s see […]

Lua-TTyrant: a TokyoTyrant binding for Lua.

by Valeriu Paloş on February 19, 2012

Some time ago I started a small project to implement a C-to-Lua binding of the TokyoTyrant library, called “lua-ttyrant“. A few days ago, while working with a script that was actually using it, I decided to polish it up, finish it and eventually submit it to be included in the LuaRocks repositories. Given the fact […]

A simple(r) approach for class-based OOP in JavaScript.

by Valeriu Paloş on June 18, 2011

Like others before me, I found JavaScript’s prototype-based OOP support – while very powerful – quite cumbersome in some situations where I needed a certain structure or hierarchy of objects, situations in which one quickly comes to the conclusion that the best answer would be the concept of a Class. However, while I am well […]

Command-line option parser in JavaScript.

by Valeriu Paloş on May 20, 2011

Here’s a small but very effective command-line option parser written in JavaScript (uses NodeJs). You can get the up-to-date source code at http://gist.github.com/982499. I wrote this because I needed it for a project and I did not think it was worth it to install some npm package just for this. The comment should explain most […]

Case study: fixed number of iterations with LPeg

by Valeriu Paloş on September 1, 2010

Words seem to fail to describe just how awesome LPeg is. Designed as a Lua implementation of the PEG concept, it is a true programming gem! Please, if you dont’t know what it is, take some time to familiarize yourself with it! It’s not the easiest thing to grasp, but you will not regret it! […]