Simple JSON:API plugin for Nuxt.js

Hi all, So far I am keeping myself on track to work a bit every weekend on my side projects. That being said, I am a big fan on JSON:API and in my search for streamlining the consumption on the front-end I’ve finally settled on a nifty JSON:API client called Devour. It has the right amount of magic to make it worthwile and not be over the top ‘magical’. For that, I’ve made a small nuxt....

11 August, 2019 · 2 min · 370 words · Alexandru Bucur

How to Stop requestAnimationFrame in Vuejs / Javascript

TLDR: 1 2 let id = window.requestAnimationFrame(fancyFunctionHere) window.cancelAnimationFrame(id); Now for the longer version. Technically in Vue.js you might have components/mixins that use window.requestAnimationFrame. Since the fancyFunctionHere is used as a callback, everytime you call window.requestAnimationFrame you are going to get a new id that you should use on the destroy method to stop it. Unfortunately this is not imediately clear on MDN so hopefully my documentation edit with the comment in the code example goes trough....

20 July, 2019 · 1 min · 131 words · Alexandru Bucur

Static / Fixed filenames for generated vue-cli builds

As you may know, the release of vue-cli 3 is getting close (currently at RC3 status). I really like the streamlined way of starting projects and having a good baseline for development (especially when trying to setup a good starting point in house, that has documentation and it’s actively developed). However the default setup isn’t friendly with legacy projects because vue-cli implicitly adds a hash to the generated filenames. That’s great if you’re starting a new project/SPA because it’s like a built in cache buster but doesn’t help if you’re trying to integrate it with your favourite c#/php/python/ruby etc application....

04 July, 2018 · 2 min · 277 words · Alexandru Bucur

Quick and easy way of counting UTF-8 characters in Javascript

Reading the following tutorial regarding a VueJS component that displays the character count for a textarea got me thinking. You see, the problem is that when Javascript was first created it didn’t had proper UTF-8 support. Javascript’s internal encoding is UCS-2 or UTF-16 depending the articles you find on the internet. (actually there’s an awesome article from 2012 that explains this in detail ) . What does that mean you say ?...

18 June, 2018 · 2 min · 225 words · Alexandru Bucur

Quick hack for using google translate (or other services) in Nuxt/Vue.js

Hey guys, here’s a quick way of making google translate play nice using setInterval. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 export default { mounted: function() { this.$nextTick(() => { this.googleTranslateInit(); }); }, methods: { googleTranslateInit: function() { let checkIfGoogleLoaded = setInterval(() => { if (google.translate.TranslateElement !...

26 May, 2018 · 1 min · 145 words · Alexandru Bucur