Check if an element is visible in the viewport using JavaScript
Learn how to check if an element is visible in the browser's viewport, using this simple technique.
Finding ways to improve and optimize your code takes a lot of time, research and energy. Level up your coding skills one step at a time with this collection of quick tips and tricks.
Learn how to check if an element is visible in the browser's viewport, using this simple technique.
Strings in JavaScript can be escaped in various ways. But how do you prevent a string from being escaped? Here's a handy trick for that.
Ever wanted to create your own jquery-like query selector shorthand? Here's how!
Learn how to generate a random hexadecimal color code with a few lines of JavaScript.
Learn how to swap the values of two variables in JavaScript using a single line of ES6 code.
Learn two ways to format a string in Python with this quick tip.
Learn how to make your CSS transitions feel perfect when users interact with elements on the page with this simple tip.
You might have heard that line-height
should be unitless, but do you know why?
Did you set up a lot of Git aliases and forgot what they are? List them all with this command.
Learn how to quickly and easily reset your local master
branch to match the one on the remote.
Calculate the date of n
days ago from today or the date of n
days from now.
Calculate the coordinates of the current scroll position in the browser window using JavaScript.
Learn how to easily convert any string to a URL-friendly slug, using regular expressions.
Implement responsive typography with the CSS clamp() function.
You can use a CSS pseudo-class selector to style all links in a page, without worrying if they have been visited or not.
Is your Git repository getting bloated? Optimize it by garbage collecting loose objects.
Discover how to improve your website's performance by implementing lazy loading for images using a native HTML attribute.
Easily convert between a JavaScript Date object and a Unix timestamp.
Implement Python's divmod()
built-in function in one line of JavaScript.
Here's a quick and easy way to select the currently focused DOM element in JavaScript.
Learn how to eliminate the annoyance of copying dollar signs ($) along with terminal commands from the web with a simple bash alias.
Nesting elements with rounded borders can look very wrong if not done correctly. Here's a quick tip on how to do it right.
Effortlessly create upstream branches on push by enabling a simple git config setting.
Learn how to retrieve the first or last n
elements in a JavaScript array with a single line of code.