Rowanto Luo

Just another blog. or log.

Tag: javascript

  1. JavaScript, beware of filling an array with empty array.

    I love JavaScript, however very often, it doesn't love me back. const dataBuffers = new Array(4); dataBuffers.fill([]); for (let i = 0; i < 4; i += 1) { dataBuffers[i].push(7); } console.log(JSON.stringify(dataBuffers)); // guess what is the answer? If you guess the answer would be [[7],[7]…

    javascript, array, empty array, fill array with empty array

  2. Add automatic code or syntax highlighting in your ghost blog

    Recently, I switched to the Ghost blogging platform. I must say that it's actually quite nice. Well, it's still young, and some stuff needs to be taken care of. You need to use "forever" or an init.d script and monitoring to make sure it will stay running. You have…

    javascript, ghost, highlightjs

  3. Why your cancel button submit the html form

    One of the mistake which I see often during development on the frontend side is the cancel button, which actually submits the form when clicked. Saw it once, wait a while, saw it again, wait a while, saw it again, and the loop continues. Some people doesn't even realize. So…

    javascript, angular

  4. How to Solve Grunt Imagemin GLIBC_2.14 Not Found Problem

    So one day, out of the blue, my grunt build job started failing in jenkins. I was quite confused why. Because it was working fine if I did it from my dev machine. I have a PC, a personal laptop, a work laptop, and two home servers (which are just…

    javascript, grunt, glibc, optipng, imagemin

  5. AngularJs and VideoJs problem: Video only loaded on hard refresh, not on switching page

    So I was working on a private project with angular js and video js, and I am loading videojs dynamically after I got the source of the video, and there's this very interesting problem where videojs will only be loaded only if you hard-refresh the page (f5-button). If you navigate…

    programming, javascript, angular