Pitch prediction with AI in JavaScript

crysfel Uncategorized

One of my favorite things to do is learning new things all the time, a couple of years ago I decided to lear how to play the violin! It's being a long journey that I've enjoyed so far. One of the problems beginners have when learning to play the violin, is the fact that you never know if you are playing the right note, the violin doesn't have any kind of mark that you can use as a reference to position your fingers and play the right note. It'd be really nice if you can get instant feedback on Continue reading

How to use Notion as your CMS for your blog in Next.JS

crysfel Programming

I started using Notion a couple of years ago (in 2021) to manage my YouTube content. I really liked the product and the simple way it allows me to organize my ideas, scripts, personal journal, etc. So, I decided to use it for my personal blog as well. One of the challenges was to display Notion information on my website. Fortunately, Notion has a Rest API that provides access to all your content. In this tutorial, I'll show you all the necessary steps in case you want to do the same. I worked Continue reading

Jest: How to mock a single hook from a module

crysfel Programming

Today I needed to write a test for a component that uses a hook from our common library, but at the same time I needed to use other components in the test. Initially I mocked the whole module and got all previous tests to fail, the issue was that I mocked everything and no other component was working as expected. Here's the code I wanted to test. import { Text, File, useToast } from '@my-library/ui'; import axios from 'axios'; export default function Uploader({ userId ) { const showToast = Continue reading

How to test redirections and history state with Jest

crysfel Programming

Testing redirections in jest using react router is not a straight forward process, specially when using hooks. In this tutorial I'm going to show you how to test a redirect, in addition we are going to test the state in the history. The code we will be testing is a button, when clicked we will redirect the user to a new page using react router, but we are also going to set some data into the history state. import React from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; Continue reading

Recovering your android keystore lost file

crysfel Programming

I've been maintaining a React Native app for several years now, I don't update it very often because it's really just a side project I have. A few years ago I released an Android version, at the time I generated the keystore file and put it in a secure location, but to be honest I don't remember where I stored. If you are in a similar situation, don't panic! Is quite simple to recover it, actually... you need to create a new one and submit a request to get it updated on the Google Play store. Continue reading

How to enable HTTPS on Webpack Dev Server

crysfel Programming

One of the most popular feature requests of the Music App is to support memberships using Stripe. A few days ago I decided to work on this new feature, however, I found a few challenges along the way. First of all, if we want to use Stripe we need to run our application over HTTPS, otherwise the JavaScript SDK doesn't run properly. In production that's quite easy to accomplish, in fact, the demo version, as well as the community I run using this software, are both running over HTTPS. But when Continue reading

The number of method references in a .dex file cannot exceed 64K

crysfel Programming

I've been maintaining a React Native app for several years now, I'm really happy with my stack as I can quickly add new features and iterate for Android an iOS. However, a few days ago I migrated to Sentry as my third-party service to keep track of crashes and errors in the app. Everything went well on iOS after installation, however, on Android, I started getting errors when trying to build the app. D8: Cannot fit requested classes in a single dex file (# fields: 67142 > Continue reading

Translating your product into multiple languages

crysfel Programming

Presenting your product to different audiences in different languages is very challenging. Over the years I've tried different approaches, but the one problem in common for all those approaches is the maintenance of the translations, is just impossible to keep track of all the changes over time. In this post, I will explain the different attempts to solve this problem and will show you what has worked for me. Loading JSON files on demand The first and most popular approach when it comes to Continue reading

Creating a hero header with a fixed image

crysfel Design

In this tutorial I'm going to show you how to create a Hero header with a fixed image as the background and an overlay gradient on top. The image will have cover the whole screen with some text and a call to action in the middle. As always, we are going to use tailwind for this! You can take a look at the final result here: See the Pen Fixed Hero Header by Crysfel (@crysfel) on CodePen. Defining the markup The first thing we are going to do is to define the markup for the header, as a rule of Continue reading

Downloading images with nodejs

crysfel Programming

A couple of weeks ago Facebook sent me an email informing me that all profile images will not be accessible anymore unless there's a token on every request. Given that I'm no longer supporting Facebook login, but still many of my users are using their Facebook profile image, I decided to pull all those images into my own server before facebook implements the new requirements. After a few hours of googling how to download images/binaries on NodeJS, and only finding old/deprecated implementations Continue reading