Web Tools #490 - Math.random(), CSS Tools, Git/CLI, Uncats

Web Tools Weekly
WEB VERSION
Tools for Web Developers

Issue #490 • December 8, 2022

Advertisement
Use Full Power of MySQL with All-in-one IDE
dbForge Studio for MySQL is a full-fledged IDE for database development, management and administration. An intuitive interface and robust functionality let you streamline all database routines on MySQL and MariaDB and get rid of errors.

Download a 30-day Free Trial
dbForge Studio

If you're doing math calculations in JavaScript, I'm sure you know that there are some quirks to be aware of. Probably one of the most commonly-used math-related JavaScript methods is Math.random(). This comes in handy in a number of circumstances. Many functions have been written that utilizes this basic method, so I'll just go over a few things about it.

First of all, as you might know, Math.random() doesn't return a genuine random number but a pseudo-random number. Also, it returns a random number between 0 and 1. So by itself it's somewhat useless. It almost always has to be used as part of a larger function. But that's ok, because it serves as a building block. JavaScript doesn't need anything more than this.

console.log(Math.random()); // 0.1269400630808044

The other significant thing to note is that the 0 (lower bound) is inclusive, whereas the 1 (upper bound) is exclusive. This means the random number could be exactly zero but it will never be exactly 1. Of course, both are extremely unlikely to be selected.

Probably the most common snippet that uses Math.random() is one that gets a random integer between two numbers, inclusive. You can do this using something like the following:

function RandomInteger (min, max) {
  return Math.floor(Math.random() * (max - min + 1) + min);
}

console.log(RandomInteger(1, 20));

Try it on CodePen

As you can see, the above function assumes you want all decimal results to round down to the nearest integer. MDN's article has a slightly different version of this snippet, which initially forces the min value to round up and the max value to round down. This is a bit strange to me, so I prefer the above snippet, which always rounds down and does so after the number is obtained.

One final thing about Math.random() is a quote from the MDN article warning against certain uses:

"Math.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead."

Good warning, especially now as we see more and more apps requiring higher levels of security.

Now on to this week's tools!

 

CSS and HTML Tools

Use Full Power of MySQL with All-in-one IDE
dbForge Studio for MySQL is a full-fledged IDE for database development, management and administration. An intuitive interface and robust functionality let you streamline all database routines on MySQL and MariaDB and get rid of errors.     SPONSORED  

fontaine
A utility that provides an automatic font fallback, calculated based on font metrics, to help minimize cumulative layout shift (CLS).

Invisible Characters
50+ ready-to-copy-and-paste "invisible" characters (like the zero-width space), along with their Unicode code point values.

Metatags API
A dead-simple API to retrieve the title, description, and social image meta tags for a URL, completely free and open-source.

Pokémon Cards Holographic Effect in CSS
A collection of advanced CSS styles to create realistic-looking effects for the faces of Pokémon cards.

Wordmark
Enter a word or phrase and this tool will display the text using all the fonts currently installed on your computer (with permission for downloaded fonts).

Randoma11y
Online tool that generates a random, but fully accessible color combination for background color and foreground text color.

Randoma11y

Media Chrome
A set of custom elements (web components) for making audio and video player controls that look great in your website or app.

CSS Clothoid Corners
Online tool that generates CSS using the clip-path property, to give elements a more fun rounded corners look (similar to iOS app rounded corners).

uiGradients
A gallery of beautiful color gradients for inspiration. You can filter by color selection then copy individual colors or the full CSS.

Chroma
Browser extension that provides a set of color tools including an eyedropper, color picker, and palette generator.
 

Git, GitHub, and CLI Tools

The Faster Results Digital Journal
Backed by insight from the world's top institutions of learning, the Faster Results Digital Journal is packed with practical tips, inspiration and the proven structure you need to soar to new heights in your personal and professional life.   SPONSORED  

GPT3 Powered CLI
Get answers for CLI commands from GPT3 right from your terminal.

llama
A terminal-based file manager with fuzzy search, written in Go, that serves as a simpler and faster replacement for standard terminal file navigation.

aerc
An email client that runs in your terminal that's highly efficient and extensible.

gitlapp
A native iOS client for GitLab that helps you with project management, tackling issues, and staying on top of your TODOs with notifications — across different instances of GitLab.

Configure AWS Credentials
A GtiHub action to configure AWS credential environment variables for use in other GitHub Actions.

DVC
An open-source version control system for machine learning projects, built to make ML models shareable and reproducible and designed to handle large files, data sets, machine learning models, and metrics,. as well as code.

DVC

Directory Serve
A CLI library for sending and receiving files from your Android and iOS devices.

UNGH
A simplified, cached, and anonymous layer that allows you to have unlimited access to GitHub API.

Terrateam
A CI/CD platform that enables your entire team to make Terraform changes with GitHub pull requests. The free plan is pretty decent.

Schnell Console
A terminal for Windows, Mac, and Linux that also offers a browser extension for running commands from web searches and a VS Code extension to run files in the app.
 

The Uncategorizables

The Faster Results Digital Journal
Backed by insight from the world's top institutions of learning, the Faster Results Digital Journal is packed with practical tips, inspiration and the proven structure you need to soar to new heights in your personal and professional life.   SPONSORED  

ChatGPT-bot
Run your own GPTChat Telegram bot, with a single command. So you can take part in the latest crazy like all the cool kids.

Pixelfed
An ad-free and privacy-friendly open-source and decentralized photo sharing social media platform.

DuckDuckGo for Mac
A fast, privacy-friendly browser for Mac, from the makers of the privacy-friendly search engine.

Macpine
Create and manage lightweight Alpine VMs on macOS with seamless port forwarding, automatic file sharing, and more.

Flow
A browser-based, open-source EPUB reader with features like search, custom typography, highlights and annotations, share via link, cloud storage, and more.

Podman Desktop
An open source graphical tool enabling you to seamlessly work with containers and Kubernetes from your local environment.

Podman Desktop

devenv
Build, share, and run your local development environments with a single command, without containers.

Chartbrick
Create charts using your databases from Notion or Airtable. Visualize your data as insightful charts and embed them in Notion pages or anywhere else.

ILLA Cloud
A robust, open-source, low-code platform that integrates with any data source, for developers to build internal tools in minutes.

FrankenPHP
One of the few PHP tools I've shared, A modern PHP app server, written in Go, built on top of the popular Caddy web server.

Python Sandbox
And how about a Python tool? Things are getting wild. This is a JSFiddle-like environment for Python scripts.
 

Commercial Apps and Classifieds

These are commercial apps, affiliate links, PPC ads, and paid classifieds. Submit yours!
Tailscan – Build, design, and debug Tailwind projects visually inside your browser.
axeptio – Platform and service for a cookie consent popup that users will enjoy seeing.
Babbel – A language learning platform trusted by over 10 million subscribers worldwide.    AD
Noom – A science-based approach to weight loss, used successfully by millions.    AD
ApyHub – Powerful yet simple-to-use APIs that provide standard data and essential functionalities.
Analyzati – A multi-featured and privacy-focused alternative to Google Analytics.
Sip – A color picker for Mac that allows you to collect, organize, and edit colors.

A Tweet for Thought

To be fair, writing code isn't the same as writing content, but this meme on plagiarism is kind of funny.
 
A Tweet for Thought
 

Send Me Your Tools!

Made something? Send links via Direct Message on Twitter @WebToolsWeekly (details here). No tutorials or articles, please. If you have any suggestions for improvement or corrections, feel free to reply to this email.
 

Before I Go...

If you're into, or want to better at photography, you might want to check out GuruShots, where you can do daily photo challenges on the way to becoming a photo expert.

Thanks to everyone for subscribing and reading!

Keep tooling,
Louis
@WebToolsWeekly
PayPal.me/WebToolsWeekly

Older messages

Web Tools #489 - Array.values(), Media Tools, React, Git/CLI

Thursday, December 1, 2022

Web Tools Weekly WEB VERSION Issue #489 • December 1, 2022 Advertisement The Future Of Tech, Delivered Today. Join over 450K people by reading Emerging Tech Brew, the 3-times-a-week email delivering

Web Tools #488 - copyWithin(), JS Utilities, Databases, Uncats

Thursday, November 24, 2022

Web Tools Weekly WEB VERSION Issue #488 • November 24, 2022 Advertisement Hey Devs, Meet TelemetryHub! TelemetryHub is an observability tool that collects all your complex telemetry data into a single

Web Tools #487 - Autocomplete, CSS Tools, Build Tools, Uncats

Thursday, November 17, 2022

Web Tools Weekly WEB VERSION Issue #487 • November 17, 2022 Advertisement Turn Heads on Video with mmhmm Put yourself on screen with your slides. Move around for emphasis. Works with Zoom, Meet, and

Web Tools #486 - Future CSS, Frameworks, Media, React

Thursday, November 10, 2022

Web Tools Weekly WEB VERSION Issue #486 • November 10, 2022 Advertisement Get Early Access to TelemetryHub! TelemetryHub is an observability tool that collects all your complex telemetry data into a

Web Tools #485 - CSS Tools, Build Tools, React Native

Thursday, November 3, 2022

Web Tools Weekly WEB VERSION Issue #485 • November 3, 2022 Advertisement Stop Leaving Your // Todos for Dead 💀 Height's Code to Task feature automatically turns your // todo code comments into

You Might Also Like

Import AI 399: 1,000 samples to make a reasoning model; DeepSeek proliferation; Apple's self-driving car simulator

Friday, February 14, 2025

What came before the golem? ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Defining Your Paranoia Level: Navigating Change Without the Overkill

Friday, February 14, 2025

We've all been there: trying to learn something new, only to find our old habits holding us back. We discussed today how our gut feelings about solving problems can sometimes be our own worst enemy

5 ways AI can help with taxes 🪄

Friday, February 14, 2025

Remotely control an iPhone; 💸 50+ early Presidents' Day deals -- ZDNET ZDNET Tech Today - US February 10, 2025 5 ways AI can help you with your taxes (and what not to use it for) 5 ways AI can help

Recurring Automations + Secret Updates

Friday, February 14, 2025

Smarter automations, better templates, and hidden updates to explore 👀 ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

The First Provable AI-Proof Game: Introducing Butterfly Wings 4

Friday, February 14, 2025

Top Tech Content sent at Noon! Boost Your Article on HackerNoon for $159.99! Read this email in your browser How are you, @newsletterest1? undefined The Market Today #01 Instagram (Meta) 714.52 -0.32%

GCP Newsletter #437

Friday, February 14, 2025

Welcome to issue #437 February 10th, 2025 News BigQuery Cloud Marketplace Official Blog Partners BigQuery datasets now available on Google Cloud Marketplace - Google Cloud Marketplace now offers

Charted | The 1%'s Share of U.S. Wealth Over Time (1989-2024) 💰

Friday, February 14, 2025

Discover how the share of US wealth held by the top 1% has evolved from 1989 to 2024 in this infographic. View Online | Subscribe | Download Our App Download our app to see thousands of new charts from

The Great Social Media Diaspora & Tapestry is here

Friday, February 14, 2025

Apple introduces new app called 'Apple Invites', The Iconfactory launches Tapestry, beyond the traditional portfolio, and more in this week's issue of Creativerly. Creativerly The Great

Daily Coding Problem: Problem #1689 [Medium]

Friday, February 14, 2025

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Google. Given a linked list, sort it in O(n log n) time and constant space. For example,

📧 Stop Conflating CQRS and MediatR

Friday, February 14, 2025

​ Stop Conflating CQRS and MediatR Read on: m​y website / Read time: 4 minutes The .NET Weekly is brought to you by: Step right up to the Generative AI Use Cases Repository! See how MongoDB powers your