Skip to content

Instantly share code, notes, and snippets.

View adriancmiranda's full-sized avatar
🌱
Today, what did you do for you tomorrow?

Adrian Miranda adriancmiranda

🌱
Today, what did you do for you tomorrow?
View GitHub Profile
@adriancmiranda
adriancmiranda / gist:7fc391f1eef498346baf48f2dc2cce19
Created September 10, 2024 20:17 — forked from samnang/gist:1759336
Install Bash version 4 on MacOS X
# Install Bash 4 using homebrew
brew install bash
# Or build it from source...
curl -O http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar xzf bash-4.2.tar.gz
cd bash-4.2
./configure --prefix=/usr/local/bin && make && sudo make install
# Add the new shell to the list of legit shells
#!/bin/bash
# Useful bash functions. This is sourced by the environment file.
# These are available to scripts, but you shouldn't use them in scripts if you
# want them to be portable.
# Usage: pathremove /path/to/bin [PATH]
# Eg, to remove ~/bin from $PATH
# pathremove ~/bin PATH
function pathremove {
local IFS=':'
# Source: https://gist.github.com/vfarcic/02bbfaf6cf8f5b03f4267b50f3f3233b
#########################################################
# How To Create A "Proper" CLI With Shell And Charm Gum #
# https://youtu.be/U8zCHA-9VLA #
#########################################################
# Additional Info:
# - Charm Gum: https://github.com/charmbracelet/gum
@adriancmiranda
adriancmiranda / email_validator_regex.sh
Created August 29, 2024 19:05 — forked from guessi/email_validator_regex.sh
Simple Email Validator in Bash
#!/usr/bin/env bash
#
# RFC standard of the email address could be found in rfc5322, rfc6854, etc.
#
# however, it is hard to escape all the special characters in the bash
# so, in this script, it will only check for the address syntax only
# having some valid/invalid inputs to test its result
#
# please be noted that, it is not design to detect mailbox deliverability
@adriancmiranda
adriancmiranda / nvim-events.md
Created July 10, 2024 02:09 — forked from dtr2300/nvim-events.md
Overview of Nvim Events

Nvim Events

Nvim recognizes the following events. Names are case-insensitive.

BufAdd
Just after creating a new buffer which is
added to the buffer list, or adding a buffer
@adriancmiranda
adriancmiranda / debounce.ts
Created December 22, 2023 20:47 — forked from ca0v/debounce.ts
Typescript Debounce
// ts 3.6x
function debounce<T extends Function>(cb: T, wait = 20) {
let h = 0;
let callable = (...args: any) => {
clearTimeout(h);
h = setTimeout(() => cb(...args), wait);
};
return <T>(<any>callable);
}
@adriancmiranda
adriancmiranda / tsconfig-all.js
Created December 17, 2023 18:51 — forked from er-ant/tsconfig-all.js
tsconfig.json with comments and explanations
{
// Config for IDE to reload
"compileOnSave": true,
"exclude": [
// Specifies an array of filenames or patterns that should be skipped when resolving include.
// Default:
// ["node_modules", "bower_components", "jspm_packages"], plus the value of outDir if one is specified.
"**/*.spec.ts",
"node_modules"
],
@adriancmiranda
adriancmiranda / .__init.md
Created January 28, 2023 23:51 — forked from rickyalmeidadev/.__init.md
vite + react + @swc/jest
yarn create vite
@adriancmiranda
adriancmiranda / vitals.js
Created January 27, 2023 18:25 — forked from daliborgogic/vitals.js
[POC] Sending Vite.js Core Web Vitals to Google Analytics
const transformer = options => ({
apply: 'post',
transform({ code, isBuild }) {
if (!isBuild) return code
return code.replace('</body>', `<script defer type="module">
const KEY = 'ga:user'
const UID = (localStorage[KEY] = localStorage[KEY] || Math.random() + '.' + Math.random())
const onError = err => console.error('[vite vitals] ', err)
const onDebug = (label, payload) => console.log(label, payload)
@adriancmiranda
adriancmiranda / .gitlab-ci.yml
Created December 16, 2022 23:10 — forked from superjose/.gitlab-ci.yml
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.