Skip to main content

13 posts tagged with "JavaScript"

View All Tags

· 2 min read
Matej Jelluš

Container should be able to perform only a very limited set of operations and it is highly recommended to use different user from root. To achieve this both docker file and kubernetes config must be changed.

· 8 min read
Matej Jelluš

Write simple Node.js backend using TypeScript, Express and Terminus and run it in Digital Ocean Kubernetes cluster. In the end you will have application which is running in multiple replications and has access to environment variable passed to the application by Kubernetes secret.

· 3 min read
Matej Jelluš

On couple of my projects, I started using GitHub Actions. I also wanted to use it for pentest-tool-lite, where I want to run TypeScript lint after each push and publish it to npm after release is created. I had some problems which I recently solved, so I am sharing my solution.

· One min read
Matej Jelluš

Collection of JavaScript examples when it behaves...weird? Funny?

· 3 min read
Matej Jelluš

The first thing you read about setState - it is asynchronous. I understand it but still did not realize a couple of things.

· 2 min read
Matej Jelluš

I am working on React app with couple of other developers. And you know it, you need this component, that functionality, etc. so you google it, install the package and the work is done. Is it ok to work like this? Do you even know what exactly you added to your project and do you really need it?

· 3 min read
Matej Jelluš

You are creating an application that shows data to the user - doesn't matter if he is searching for some specific thing or he is only listing everything you have. What happens if the server responds with empty array? Or with error? Will your application show only empty space or an error message?

· 8 min read
Matej Jelluš

This is about the basic usage of Sequelize ORM – how to create migrations, models, seeders and how to get the data from the database. Everything is explained on an example project, which you can find on GitHub.

· 5 min read
Matej Jelluš

Last year, the Infinite House of Pancakes introduced a new kind of pancake. It has a happy face made of chocolate chips on one side (the “happy side”), and nothing on the other side (the “blank side”).

You are the head cook on duty. The pancakes are cooked in a single row over a hot surface. As part of its infinite efforts to maximize efficiency, the House has recently given you an oversized pancake flipper that flips exactly K consecutive pancakes. That is, in that range of K pancakes, it changes every happy-side pancake to a blank-side pancake, and vice versa; it does not change the left-to-right order of those pancakes.

You cannot flip fewer than K pancakes at a time with the flipper, even at the ends of the row (since there are raised borders on both sides of the cooking surface). For example, you can flip the first K pancakes, but not the first K – 1 pancakes.

Your apprentice cook, who is still learning the job, just used the old-fashioned single-pancake flipper to flip some individual pancakes and then ran to the restroom with it, right before the time when customers come to visit the kitchen. You only have the oversized pancake flipper left, and you need to use it quickly to leave all the cooking pancakes happy side up, so that the customers leave feeling happy with their visit.

Given the current state of the pancakes, calculate the minimum number of uses of the oversized pancake flipper needed to leave all pancakes happy side up, or state that there is no way to do it.

· 10 min read
Matej Jelluš

I needed to create a simple server, that would have one “public” route /login and other routes are available only for users with valid JWT token.

That means, the user is allowed to log into the system and then get any data from it. If he is not logged in and he tries to get some data, he only get an error message and 401 ( Unauthorized ) status code will be returned.