by vegardhanssen | Jun 27, 2015 | Coding, Node Modules, Node.js
Since my regexp test on parsing a string was a success, I created a #nodejs module for parsing strings. And the funny part, I scrapped the regexp 🙂 It now supports multiple keys and multiple values. So you can do something like this: var res = ps.parse('"foo...
by vegardhanssen | Jun 24, 2015 | Coding, Node.js
Got a little challenge parsing strings like: Little brown="and yellow" fox=1 jumps over=lazy dog I wanted to split it into an array with key/value pairs, so the result would be: var res = [ [ 'Little', undefined ], [ 'brown', 'and yellow' ], [ 'fox', '1' ],...
by vegardhanssen | Jun 18, 2015 | Coding, Node.js
I was coding a scheduler and needed a sorted array of the schedules, so I started to investigate the speed of different sorting variants I could use. I created a little program (https://gist.github.com/flogvit/c9df93ab37ca4dbd2d7f) to test 4 different variants. For...
by vegardhanssen | May 15, 2015 | Coding, IntelliJ, Node.js
Writing correctly formatted code isn’t easy to do all the time. So what do you do when you have eg written your json files like: { "test": "testing" , "bla": "blabla" , "yo": "yo to you"} and want it to...
by vegardhanssen | May 13, 2015 | Coding, Node.js
When you code, it’s often you come up with an idea or shortcoming of your function. It’s easy to code on and think you can remember it later. You don’t, trust me. So what do you do when you’re in an editor like IntelliJ? Well, you add a TODO:...
by vegardhanssen | May 7, 2015 | Coding, Node.js
Sometimes you need to open a random port on your node server. You can of course try a random one to see if it fails, but a npm module makes this easy: npm install portfinder var pf = require('portfinder'); var http = require('http'); // If you want to change the first...
Recent Comments