Category: Javascript

CSS in Svelte

CSS in Svelte

Svelte is a front-end framework for web development, you can find more about it here. This post is about using CSS in Svelte. CSS in Svelte Components CSS styles specified in Svelte components are scoped to the component itself, meaning they don’t affect anything outside the component. Svelte compiler achieves this by making appropriate changes…

Read More Read More

Svelte – a kind of UI Framework

Svelte – a kind of UI Framework

Svelte is a front-end framework for web development like React, Vue and Angular. In a short time, Svelte has become very popular as you can see from ‘State of JS’ survey or the stars on it’s GitHub repo. Single Page Application (SPA) These UI Frameworks enable us to create single-page applications where most of the…

Read More Read More

Add linting to NodeJs and TypeScript project

Add linting to NodeJs and TypeScript project

We are going to install TypeScript ESLint for finding potential problems with our code. Most online tutorials talk about using TSLint for TypeScript, but it is deprecated now in favour of ESLint. Let’s start by installing ESLint. To configure the linter, we need to create a config called .eslintrc.js in the root directory. Let’s create…

Read More Read More

Setup Nodejs + Typescript development environment

Setup Nodejs + Typescript development environment

Here is the summary: Install Nodejs Initialize Javascript project Convert to Typescript Install ts-node Prerequisite You would need a code editor installed on your system. I personally recommend Visual Studio Code as it has amazing support for Typescript. Install Nodejs Nodejs can be downloaded and installed from here. It will also include NPM (node package…

Read More Read More

Calculate Modular Exponentiation (PowerMod) in Javascript (a^p % n)

Calculate Modular Exponentiation (PowerMod) in Javascript (a^p % n)

Computing PowerMod is required for implementing public-key cryptography as it is used to encrypt and decrypt data. Calculating it by regular arithmetic (i.e. calculating pth power of a) doesn’t work with large numbers used for encryption. That’s where PowerMod helps, it calculates the result by keeping the numbers significantly small and within range of the integer data type.…

Read More Read More