Skip to content

Instantly share code, notes, and snippets.

title source
Creating Perfect Font Fallbacks in CSS

When using web fonts, it's often recommended that you set the font-display property to swap in your @font-face rulesets to prevent the so-called flash of invisible text (FOIT): the momentary flicker that occurs when text is set in a typeface that has not yet been downloaded by the browser. With font-display: swap, the browser will first render your text using the fallback typeface you specified in the font-family property:

body {
@hachesilva
hachesilva / mac-change-notch-whitespace.md
Created June 27, 2024 00:27
Built-in workaround for applications hiding under the MacBook Pro notch

Source: https://flaky.build/built-in-workaround-for-applications-hiding-under-the-macbook-pro-notch

# Change the whitespace settings value, value from 0 to 6
defaults -currentHost write -globalDomain NSStatusItemSelectionPadding -int 6
defaults -currentHost write -globalDomain NSStatusItemSpacing -int 6

# Revert to the original values
defaults -currentHost delete -globalDomain NSStatusItemSelectionPadding
defaults -currentHost delete -globalDomain NSStatusItemSpacing
@hachesilva
hachesilva / frontend-dev-handbook-2024.md
Last active June 15, 2024 04:38
The Front End Developer/Engineer Handbook 2024
@hachesilva
hachesilva / emailregex.js
Created November 22, 2023 14:47
Email regex validation - https://emailregex.com
const emailregex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
@hachesilva
hachesilva / .htaccess
Created September 16, 2023 01:31
Automatically serve files with UTF-8 encoding on Apache server
# Source: https://nicolasbouliane.com/blog/force-apache-serve-utf-8-default-htaccess
# Serve all text files as unicode
AddDefaultCharset utf-8
# Set encoding on individual file types
AddCharset utf-8 .html .css .js .php
@hachesilva
hachesilva / typescale.scss
Created June 21, 2023 21:43
Typography scales, sass version
// Source: https://typescale.com/
// Typography scales
$minor_second: 1.067;
$major_second: 1.125;
$minor_third: 1.200;
$major_third: 1.250;
$perfect_fourth: 1.333;
$augmented_fourth: 1.414;
$perfect_fifth: 1.500;
@hachesilva
hachesilva / settings.jsonc
Created June 12, 2023 19:00 — forked from hyperupcall/settings.jsonc
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{

Automating Daily Reports, because fuck it, really...

Each day at our company, developers are required to document their activities, painstakingly jotting down their daily work and future plans. A monotonous chore that I just really dislike.

So now, there's a scribe for that :

auto-dr-

Code

@hachesilva
hachesilva / system-colors.css
Created March 24, 2023 14:54
Dark-light color schemes using System default colors
/*
Source: https://blog.jim-nielsen.com/2021/css-system-colors/
*/
/* Set global color scheme without setting a background */
:root {
color-scheme: light dark;
}
/* Use system colors for dropdowns */
@hachesilva
hachesilva / update-alternatives.sh
Created March 3, 2023 21:52
Select python version using update-alternatives
sudo update-alternatives --config python3