Skip to content

Instantly share code, notes, and snippets.

View andersonbosa's full-sized avatar
🥑

Anderson Bosa andersonbosa

🥑
View GitHub Profile
@andersonbosa
andersonbosa / sample-vscode-debug-nodemong-launch.json
Created September 20, 2023 00:11
sample VSCode file `launch.json` showing how to use nodemon in vscode debugging
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "nodemon: express",
"type": "node",
"console": "integratedTerminal",
// ==UserScript==
// @name CSS Injector
// @namespace Violentmonkey Scripts
// @match https://gist.github.com/*
// @grant none
// @version 1.0
// @author @t4inha <https://github.com/andersonbosa>
// @description 9/14/2023, 8:08:29 AM
// ==/UserScript==

2023-08-30_review arquitetura limpa sobre Custos da falta de pensar arquitetura de software.md

shell-script-parameters.md

Below is a Markdown table listing some of the commonly used parameter expansion operators in POSIX-compliant shell scripting:

Operator Description
${parameter:-word} Use default value if parameter is unset or null.
${parameter:=word} Assign default value to parameter if it is unset or null.
${parameter:?word} Display an error message if parameter is unset or null.
${parameter:+word} Use word if parameter is set and non-null.
// ==UserScript==
// @name sidekiq upgrader
// @match http://localhost:3000/background_jobs/*
// @author https://github.com/andersonbosa < @t4inha >
// ==/UserScript==
function addPollParamToURL() {
const urlObject = new URL(window.location.href);
const searchParams = urlObject.searchParams;
#!/usr/bin/env bash
docker run -d -p 5000:5000--entrypoint htpasswd registry:2 -Bbn myuser mypassword > auth/htpasswd
package main
import (
"fmt"
"time"
)
func helloFromGoroutine() {
fmt.Println("Hello from Goroutine")
}
@andersonbosa
andersonbosa / date_to_relative.rb
Created June 6, 2023 19:02
Converts a given date to a relative format, indicating how long ago or in the future it occurred.
##
# Converts a given date to a relative format.
#
# @param date [Time] The date to be converted.
# @return [String] The date in relative format.
# Returns a string representing the relative format of the given date.
# If the date is within the last 24 hours, "today" is returned.
# If the date is exactly one day ago, "yesterday" is returned.
# If the date is between 2 to 6 days ago, the number of days is returned in the format "{N} days ago".
# If the date is 7 days ago or more, the number of weeks is returned in the format "{N} weeks ago".