-
Improve pg-promise stack traces
Reading Time: < 1 minute When you execute a query with error, we get a pg-promise internal module-specific stack trace. That’s not really helpful, right? What we want is to know which of our methods executed a query that failed To do that we just tell pg-promise that uses bluebird as a promise lib const… Read more
-
Test Driven Development (TDD) in a nutshell
Reading Time: 2 minutes Every project has somewhere in the src folder a file called utils.js, Utils.java, utils.py, etc. A couple of days ago I was looking for a way to generate a random float number between two integer numbers. Utils.xx was a good place to put a function called getRandomNumberBetween(min,max). In my case I… Read more
-
Compress a file in Node.js
Reading Time: < 1 minute Compress a file in Node.js without extra dependencies. const zlib = require('zlib'); const fs = require('fs'); /** * * @param filePath the absolute path to the will to zip * @return {Promise<string>} the full absolute path to the zip file */ function zip(filePath) { return new Promise((resolve, reject) => {… Read more
-
Load stylesheets in background to increase page speed
Reading Time: < 1 minute With only two simple steps your pages will load faster, and the most important: using only native JavaScript The trick will be to use a default tag in rel attribute and modify it once the page loads Step 1 Include your stylesheets this way <link id="stylesCss" as="style" rel="preload" href='/stylesheets/style.css' />… Read more
-
How to configure http auth basic in Node js and Express
Reading Time: 2 minutes Let’s build a small site in Node.js using Express that will have one protected page We are going to use express generator to generate some scaffolding. If you didn’t install it just type this command to install it globally but if you already know all this stuff you might skip this… Read more
-
Migrate sforce.connection.query to Lightning equivalent
Reading Time: 2 minutes As you probably know, Javascript buttons are not supported in Lightning Experience (LEX). In particular, you can’t use REQUIRESCRIPT. Read more
Hello, Javaniceday!
Reading Time: < 1 minute