Endomondo vs Strava

During riding a bike, running or other activities you probably register them – to get know your own records, to know route, or just to count kilometers, because people like numbers :) The easiest way is to use phone (because each of us have one) and one of many possible applications. The most common choice is probably Endomondo, but this is not the only possible choice. Strava is also noteworthy and I would like to compare both applications in this post, show their advantages and disadvantages, which I have observed over few years. In the beggining we can say, Strava is an application that was created primarily for fans of two wheels.

Continue reading “Endomondo vs Strava”

Phantom.js – use custom fonts in HTML to PDF convert

Very short, but I think, may help a lot of people… Last time I spent a lot of time on the big issue with Phantom.js in Node app. Very common task: application should generate PDF files from input HTML code. Nothing difficult, yes? Yep, and it worked fine on my Node app… But one day, client said, that we should change font in document. Simple, we can just use font-face in input HTML styles, right? In theory, yes. Phantom.js and Node packages to use this library to convert HTML to PDF can use custom fonts and also other external assets like images.

With very popular html-pdf package we can use external, full link to assets, use absolute path to our local directory with files (using file:/// prefix) or specify base path in rendering options, and then use relative (to this base path) paths in our styles. And… it works fine. It also worked fine with custom fonts on my project. But only on local machine where I use MacOS. After deploying app to Debin, Ubuntu Server or CentOS server, PDFs are broken – with no selected text, but all pages are “images”, with many broken characters and very big results file (it isn’t strange if we have images, instead of text in PDF). Custom fonts have been used correctly, but PDF was broken, why?

It’s library and Phantom.js issue, but solution is very, very simple. We must install our custom fonts locally on production machine and do not attach them in CSS – just use as existing font-family! It’s because Phantom is external script and it can use system-wide fonts. Where should we place our files? There are directories. If you have issues with custom fonts and non-selectable text, just copy fonts to:

/usr/share/fonts
/usr/local/share/fonts/

JavaScript – this keyword usage and binding

JavaScript is very elastic and popular language, but many things may be “strange” if we used soemthing else before. One of important things is that we create a lot of functions, callbacks and everything is asynchronous (if we don’t change this). Other important matter is “this” keyword – may be very unintuitive if we try to use it in similar way to other languages. But this keyword is very powerful and we can simplify our code using this keyword. See few examples in this post.

Continue reading “JavaScript – this keyword usage and binding”

Tubeless on road – Schwalbe Pro One review

Last winter I wrote post about Schwalbe X-One tubeless tyres – fantastic cyclocross tires which I used in tubeless. After that, I decided to try tubeless also on road. Because why not? I read a lot of articles, opinions and reviews of tubeless in road bike and want to check this. There are a lot of potential advantages, but what about disadvantages? Let’s start with Schwalbe Pro One tubeless road tires mini-review.

Continue reading “Tubeless on road – Schwalbe Pro One review”

Integrate jQuery with Vue.js

I work with many JavaScript libraries and few frameworks. Sometimes I must “merge” several scripts – not always is simple. One example is Vue.js and jQuery on the same site. It may be strange, because Vue modify and make interface reactivity, and jQuery can also modify DOM. But… in few situations I must do it – because Vue “doesn’t know” data, doesn’t know what and how modify – it can only prepare information for jQuery. Also, it isn’t problem, if we separate both things – jQuery should never touch elements from Vue. Ok, let’s start.

Continue reading “Integrate jQuery with Vue.js”