Luka Vidaković

Luka Vidaković @apisurfer

About: Software eng. with a decade of experience.

Location:
Croatia, Zagreb
Joined:
Sep 25, 2019

Luka Vidaković
articles - 23 total

JS Date constructor timezone oddity

new Date('YYYY-MM-DD') might not do what you think it does For a long time, I only did...

Learn More 0 0Jan 11 '24

Measure time with a higher order utility function

I consider closures and higher order functions to be one of the most powerful language features, if n...

Learn More 8 4Mar 2 '20

takeLatest Promise util function

On frontend, you may have a piece of code that fires network requests very quickly, based on user int...

Learn More 5 0Dec 9 '19

Cancelable Promise util

I found myself using this code and some derivatives time and time again so I decided to share. It's n...

Learn More 8 0Nov 29 '19

Handling custom error types in Express.js

In 2 previous posts we explained how to create a custom error type and created a few custom HTTP erro...

Learn More 27 1Nov 27 '19

From custom error types to a custom error subtype

Previously we defined our most basic custom error class that extends the Javascript's Error prototype...

Learn More 9 0Nov 26 '19

Custom error types in Node.js

Custom error types in node can provide a clearer picture of a failure. Relying on generic errors ofte...

Learn More 20 2Nov 25 '19

Communicating with an iframe — postMessage bare bones example

I keep forgetting how communication between a main window and an iframe works because I don't use it...

Learn More 22 1Nov 25 '19

Exponential backoff logic for a code scheduler

We have our scheduler factory from a previous post: function createScheduler({ callback, time, call...

Learn More 10 0Nov 23 '19

Timeout mechanism using Promise.race

So we have a scheduler factory function. Simple mechanism that runs code periodically. Here is the co...

Learn More 10 0Nov 22 '19

Implementing scheduler's stop mechanism

In previous post, we untangled our pause and loop mechanisms but the main flaw of not being able to s...

Learn More 2 0Nov 21 '19

Improving our periodic code scheduler

Previously, we constructed a pretty simple and naive system that periodically runs a function. Not gr...

Learn More 7 0Nov 20 '19

Run code periodically using Promises

Previous post describes an implementation of a one-liner pause mechanism using a Promise. Here it is...

Learn More 6 1Nov 20 '19

One-line pause function in plain Javascript

This is first post in series, explaining how to build a plain javascript code scheduler. Schedulers a...

Learn More 6 1Nov 19 '19

Async without await

Some developers get annoyed by async functions that don't use await functionality. There are even lin...

Learn More 12 4Nov 19 '19

Shortwire the async/await's catch

Handling exceptions in the async/await functions can become really bothersome. You can have multiple...

Learn More 9 0Nov 18 '19

Public, cross-domain accessible APIs?

Do you know of any useful public APIs with CORS headers set to allow access from other domains? I'm c...

Learn More 2 0Nov 12 '19

CORS mechanism in short

tl;dr To allow cross-domain requests: server needs to respond with correct HTTP headers...

Learn More 6 0Nov 10 '19

Javascript ghosts

This posts follows the one about call stack obfuscation. It’s just a proof of concept to further cove...

Learn More 7 0Nov 7 '19

Escaping the call stack

Let’s look at one way to cover the tracks within injected javascript code. It exploits asynchronous j...

Learn More 8 0Nov 7 '19

Promise.resolve() everything

Ever had a block of code that, based on a condition can fetch data asynchronosuly or synchronously? I...

Learn More 8 2Nov 7 '19

Canvas and data integrity

If you ever decide to do bitwise operations and do “bit-precise” data storing inside canvas image dat...

Learn More 4 0Nov 7 '19

Relative color luminance

C/P-ing this from my older blog posts. This one is from 2014. since I was a junior dev pretty much. N...

Learn More 6 1Nov 7 '19