Improving the scalability of a JavaScript app

Image for post
Image for post
Photo from Redux-Saga.

Many of you who are reading this probably have some experience with using Redux Thunk, know what it does, and are perhaps thinking of switching to Redux-Saga.

Just for a quick refresher, let’s consult Redux Thunk’s docs:

“With a plain basic Redux store, you can only do simple synchronous updates by dispatching an action. Middleware extends the store’s abilities and lets you write async logic that interacts with the store.

Redux Thunk middleware allows you to write action creators that return a function instead of an action. …


Image for post
Image for post

This article is dedicated to all of you JavaScript programmers out there. To learn a new language can be quite daunting and time consuming, but talking from first-hand experience, learning TypeScript coming from a JavaScript background is as easy as learning how to add bigger numbers when you already know how to add small numbers. Yes, TypeScript is not a completely different language as I once thought myself (the reason why I keep procrastinating to learn it…), but it’s really just JavaScript with added features to make the language more powerful, cleaner, and easier to maintain in the long run.

So What is TypeScript?

As its name suggests, TypeScript introduces types. Specifically, it introduces type assertions that you would not normally have in JavaScript and a bunch of other stuff including interfaces, enums, and generics. Now you might be wondering then why is JavaScript still so popular if TypeScript is that much better? Well, all that TypeScript code you write will actually end up getting compiled as plain JavaScript. That’s right: anything you write in TypeScript can essentially be written in JavaScript, but the result in JavaScript will obviously be more verbose. …


Image for post
Image for post

So I decided to build a desktop time tracker using arbtt, the automatic, rule-based time tracker to start collecting some statistics about myself and how I spend my time.

The motivation behind this project was actually me simply wanting to use this cool Recharts library but realized that collecting insightful data about myself became the bigger reason. Because of this, I’m thinking of expanding this project in the future to log my web activities as well and perhaps make a separate article for it, but for now, it’s just desktop programs.

Without further ado, let’s get started.

Installing arbtt

First, we’ll need to install arbtt. arbtt provides an easy way for you to collect data on time spent on your desktop and should automatically run in the background after installation. …


Understanding the internals of recommendation engines

PyTorch logo
PyTorch logo
Photo from Pytorch.

Why a Recommendation Engine?

As a developer who barely knows anything about ML (machine learning), I find building a recommendation engine one of the easiest projects to get started with ML. It is practical and not that difficult to understand for beginners with no machine learning background to jump right into.

Getting Started

Before we get started with the actual implementation, I’ll briefly go over some concepts that you might find helpful to build a recommendation engine.

There are essentially three types of algorithms that your recommendation engine could use when recommending an item to a user:

1. Demographic filtering

This type of filtering looks at the general trends and popularity of an item based on users with similar demographics. This means that users with similar demographics are recommended the same items and personalized recommendations are very limited. …


Getting started with using Redux and Redux Thunk in your React app

Image for post
Image for post

As your react application gets larger, it gets harder and harder to keep track and maintain your states. This is where Redux can come in to help; it is a state management library that provides you with a central state (called the store), eliminating the need to pass props between components.

A quick run through of how Redux works:

  1. Create the store
  2. Passing in a reducer as an argument
  3. Reducer update states accordingly based on the type of actions that are dispatched

If you don’t already know what Redux is, I’ll recommend you to first read my other article on Redux here. …


A step-by-step guide to getting started with web scraping in Python

Image for post
Image for post
Photo by Carlos Muza on Unsplash

Prerequisites

Although this guide will use mostly basic Python and HTML, because they are very beginner-friendly languages that resembles English, there is really no need to know anything about these languages. However, for the final part, you do need to understand basic CSS, and if you don’t, feel free to skip it. Anyways, without further ado, let’s started!

What is Web Scraping?

Just like how it sounds, web scraping is a method of extracting data from a website, where the scraped data would then be saved into a tabular (spreadsheet) format, often for further work to be done on it. …


A step-by-step guide

Image for post
Image for post
Photo by the author.

What Is Tkinter?

Tkinter is a built-in Python GUI framework that is lightweight and easy to start with. It is also cross-platform, which means the same Python code will work on Windows, macOS, and Linux. However, the styling of the application is somewhat limited and it is definitely not the most beautiful GUI framework to work with.

Regardless, it is a great choice for building simple projects where functionality trumps aesthetics.

Creating GUIs Using Tkinter

Import Tkinter

To use the Tkinter library, it is as simple as running one line of code:

from tkinter import *

Create our main class

We define a new class called Application that inherits the Tk class from the Tkinter library. Next, we initialize a constructor for our class with our chosen layout manager. …


Getting started with mobile development

Image for post
Image for post
Photo from Future Mind.

In my experience, going from native Android development to React Native has simply been a pleasure. Although there is generally less flexibility, development is much faster and cleaner in my opinion, and I just love it. So without further ado, let’s get started.

What Is React Native?

React Native is a library that works with the React library to render out native components to an iOS or Android device. Therefore, you will need some knowledge of React to dive into React Native.

Why React Native?

The biggest advantage lies in cross-platform development. With React Native, you have a single codebase that can be built for both iOS and Android devices. For most companies, this saves a lot of time and money, as native mobile development requires two different codebases and two different teams — native iOS development being done in Swift and native Android development being done in Java/Kotlin. Especially if you’re a developer who knows JavaScript but not Swift, Java, or Kotlin, it makes sense to simply use React Native to develop a mobile app because of faster shipping time (i.e. …


Find the Levenshtein distance between two words

Image for post
Image for post
Photo by Nuno Antunes on Unsplash.

It’s sad to say, but this series is finally coming to an end. I decided to end it because I don’t want to drag it on for too long and also because I think seven is a great number to end with. Lucky seven, you know?

OK, so for today’s problem, we’ll be looking at computing the Levenshtein distance (aka edit distance) between two words.

“The Levenshtein distance (a.k.a. edit distance) between two words is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other.” — Wikipedia

The Problem

Note: This problem comes from LeetCode. …


Find the maximum profit you can make from a given list of jobs

Image for post
Image for post

Today’s problem is challenging — a classic problem you may have seen in your algorithms courses. For those of you who’ve already seen it, this will serve as a great comprehensive review. If it’s new to you, take your time to digest it all.

Let’s take a look at the problem.

We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i].

You’re given the startTime, endTime and profit arrays. …

Steffy Lo

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store