Elwin's Blog

an activist who likes to think

Tag: Javascript

front cover

Use Strapi & Next.js to bootstrap your blog site with high volume on free tier

Posted on

As a front end Web developer who likes to code, I think it's reasonable to start my own blog to document what I learned on web development, and there are multiple options to choose from when building a blog site, they are all viable options, I'll start from the one require no coding skills, all the way up to the one that needs the most coding skill :

Continue reading
front cover

Common mistakes regarding React rendering behavior

Posted on

As a react developer who builds a web app that can handle more than 50 WebSocket events that will be merged into state per second while keeping it 60 FPS, I spend a lot of times on tuning the performance on my web apps, and recently, when I was doing code review on a junior developer, I noticed some mistakes that will harm the performance of the web apps

Continue reading
front cover

The Fundamental Of Coding Interview Question part 1 (Javascript)

Posted on

Arrays and Strings

  • if the order is not important, then the hash table might be a good candidate to reduce the time complexity.
  • be familiar with all the methods for arrays and strings.

Linked Lists

  • How to implement a Linked List structure?
  • How to delete a node from a single Linked List?
  • How to reverse a Linked List?
  • The runner and dummy head
Continue reading
front cover

The Fundamental Of Coding Interview Question part 2 (Javascript)

Posted on

Bit Manipulation

  • Negative Numbers: 3 => 011, -3 => flip 011 => 100 => 101 => prepend the first bit => 1101
  • << && >>> Logical Shift => move every bit to the left/right, the firt/last bit will be cut off, then append/prepend the bits with 0
  • Arithmetic Right Shift => shift values to the right but fill in the new bits with the value of the sign bit

  • get ith bit =>
Continue reading
front cover

The Fundamental Of Coding Interview Question part 3 (Javascript)

Posted on

Recusrion and Dynamic Programming(DP)

Ways to approach:

  • Bottom-up: Starting from the simplest case, then build a solution that on top of the previous one.
  • Top-Down: The reverse of Bottom-up, less intuitive, but sometimes useful.
  • Half-Half: They are usually seen on the bitwise operation and binary tree operation.

DP & memoization:

  • Using recursion alone sometimes is...
Continue reading
front cover

The Fundamental Of Coding Interview Question part 4 (Javascript)

Posted on

System Design and Scalability

this section is more related to the back-end than the front-end, but it's good to know from a broader view:

  • Communication: it's more important in the system design than dealing with a specific coding algorithm question. because most of the time, a lot of details won't be covered in the problem description, so the candidate should ...
Continue reading
front cover

The fast track on learning the coding algorithms

Posted on

When starting my career as a software engineer, I felt overwhelmed by the algorithms, I didn't even know what is Big O. Knowing it will take lots of time to learn it, I try to avoid it.

After spending a year to get myself familiar with Javascript, I know that it's the foundation of computer science, not specific to any programming language, which means once I learned the concept, I don't have to

Continue reading
front cover

Implement a MinHeap in Javascript

Posted on

It's useful when looking for a subset with certain quality in a stream, like Kth largest Element or Kth smallest Element.

The keypoint is understand how to get the parent index when bubble up, and left child index and right child index when trickle down, below is the implementation with comments:

Continue reading
front cover

Notes on using Typescript: with design pattern

Posted on

I have been using Typescript for some time, but still feels something absent on learning it, then I notice that beyond the basic syntax, I'm not familiar with the design pattern of Typescript. Sure, It's not actually a language, but since it's so widely used in my work, I feel that I should invest more time in learning the advanced usage of it.

I'll start from the definition...

Continue reading
front cover

Less common algorithm: Cycle Sort

Posted on

Cycle Sort can be used to handle special case input, which is consecutive integers, it's a decrease and conquers approach:

The name came from how it approaches the inputs: starting from the leftmost spot and figuring out which number goes there, then recursive call on the remaining elements, which looks like a cycle.

Continue reading
front cover

OWASP Top 10 security risk on 2021 for front-end

Posted on

The complete list of the description and prevention of each security vulnerability can be found here.

Now let's look at each one more closely:

A01:Broken Access Control

Common ones include the following:

CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
CWE-201: Insertion of Sensitive Information Into Sent Data

Continue reading
front cover

The modern static analysis tools for Javascript

Posted on

I've done on setting up a boilerplate project with 4 statistic analysis tools for React framework(using create-react-app), you can find it out here.

The tools included in the project are:

  1. Eslint (mainly used to check code errors)
  2. Prettier (a code formatter with little configuration rules )
  3. Stylelint (checking on style...
Continue reading