Simple solution for image slider
In this tutorial, I am going to show you how to build an image slider which is simple and doesn't require much coding but powerful enough for your website. Here is what we are building:
Working With Date object In Javascript
Working with Date is not always straightforward, sometimes it may overwhelm developers, even seasoned ones. In this article, I will share my experience that will help you to deal with Date in Javascript.
OnWheel Event Fired Twice In React Gesture Library
When using onwheel events in [@use-gesture/react](https://github.com/pmndrs/use-gesture) library, I was surprised because the event always fired twice even that I just moved the wheel once.
Use PrismJS with Remark to hightlight code
When I first tried to adopt PrismJS to hightlight code examples for my websites, I spent a lot of time to investigate why it didn't work for me. And that was so paintful for adopting just a small of code...😞
Use Flake8 and Black to lint and format Python code.
Regularly, writing code is meant to be read by other programmers, that’s why making our code easy to read and easy to follow along are necessary especially when we are in a team.
Typescript checks null/undefined
I wrote a function that returned string value and possibly null value, but Typescript only recognized the string value and ignored the null value.
Typescript is fantastic or annoying
Typescript is a great tool to help Javascript developers create clean, robust and stable code. However, I found it annoying sometimes, especially when I needed my jobs done fast, but didn't know how to fix TypeError. And that gave me a feeling like I have just headed myself into wall-bricks but didn't break through it 😎
Turn off browser's auto-scrolling behavior
Automatically restoring the last scrolling position usually offers great users' experiences while users navigate out of a page by clicking on a link on that page and later on they come back to the previous page. Browsers, by default, memorize the last position on the page where users left off and automatically jump to that position so that users don’t have to scroll back and forth to find it.
Some notes in Javascript
Here is a collection of some notes those I think Javacript developers should know about, in order to make their Javascript code more precise.
Python Dictionary Notes
Dictionaries are the most common data structures in Python. They are playing critical roles in Python code. Actually, Python is really built on dictionaries. As Python Developers, you should know them clearly and use them efficiently for your better code. In this post, I will summarize all knowledge about Python dictionaries, and you can overview them or use them as glue for your next research.
Invalid Hook Call Error
"Invalid hook call. Hook can only be called inside of the body of a function component". That was what warning message I got back and then an error showed up which was’t hint any clue.
Install Jetbrains Mono fonts on Ubuntu
Another font option for programmers is Jetbrains Mono. For me, compared to other mono fonts, Jetbrains Mono is clearer and pleasing to the eye. Here are instructions to install it on Ubuntu.
Hydration failed - React Encoder Error
Sometimes, it’s quite annoying to encounter a hydration failed error in ReactJS but the error is not obvious to figure out. Here are my experiences about how I fixed that error in my web application written by NextJS/ReactJS.
Avoid Screen Flicker When Dark Mode Is On
Storing user’s dark-mode preference in browsers and updating stylesheet/css accordingly wherever users change the preference seems to be the easiest way to support dark-mode on the sites, but actually that implementation will introduce an issue - the screen flicker - which may annoy users sometimes. So, in this post, I will show you how I fix the screen flicker issue for my website.
Auto-reset variables
In Javascript, is there a way to get variables automatically reseted to undefined value after being read once?