Skip to content

Instantly share code, notes, and snippets.

View santospatrick's full-sized avatar
👽
Javascripting

Patrick Santos Bitonti Teixeira santospatrick

👽
Javascripting
View GitHub Profile
@santospatrick
santospatrick / run.md
Last active October 6, 2024 19:55
Generate JWT RS256 Public / Private keys on MacOS
# generate private key
openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048

# public (based on private key)
openssl rsa -pubout -in private_key.pem -out public_key.pem

Convert to base64 to be used in env variables

@santospatrick
santospatrick / axios-random-delay.js
Created August 22, 2024 18:21
Axios random delay in local development HTTP calls
import axios from 'axios'
export const api = axios.create({
baseURL: "http://localhost:3333",
withCredentials: true,
})
if (env.VITE_ENABLE_API_DELAY) {
api.interceptors.request.use(async (config) => {
await new Promise((resolve) =>
@santospatrick
santospatrick / heroku_env_to_dotenv.md
Created August 22, 2024 17:36
Get Heroku environment variables from a Project into a .env file
chmod +x heroku_env_to_dotenv.sh
./heroku_env_to_dotenv.sh
@santospatrick
santospatrick / set-heroku-env-variables-from-env.md
Last active August 22, 2024 18:18
Set heroku env variables from .env file
chmod +x set_heroku_env.sh
./set_heroku_env.sh
@santospatrick
santospatrick / firebase-indexes-import.md
Created May 6, 2024 14:54
Firebase export / import database indexes

this will select staging and export indexes

firebase use default
firebase firestore:indexes > firestore.indexes.json

then we need to import them in production, so we don't need to create all of them manually (could be 20+ and it takes some time)

firebase use production
firebase deploy --only firestore:indexes
@santospatrick
santospatrick / Nework_throttling_profiles.md
Created May 26, 2023 01:58 — forked from theodorosploumis/Nework_throttling_profiles.md
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
{"name":"Udemy Profile","settings":"{\"settings\":\"{\\n // Window\\n \\\"window.zoomLevel\\\": 1,\\n\\n // Editor\\n \\\"editor.cursorBlinking\\\": \\\"solid\\\",\\n \\\"editor.fontSize\\\": 14,\\n \\\"editor.minimap.enabled\\\": false,\\n \\\"editor.codeActionsOnSave\\\": {\\n \\\"source.fixAll.eslint\\\": true,\\n },\\n \\\"editor.detectIndentation\\\": true,\\n \\n // Workbench\\n \\\"workbench.editor.enablePreviewFromQuickOpen\\\": false,\\n \\\"workbench.editor.enablePreview\\\": false,\\n \\\"workbench.colorTheme\\\": \\\"Dracula\\\",\\n \\\"workbench.iconTheme\\\": \\\"material-icon-theme\\\",\\n\\n // Git Project Manager\\n \\\"gitProjectManager.openInNewWindow\\\": true,\\n \\\"gitProjectManager.checkRemoteOrigin\\\": false,\\n \\\"gitProjectManager.maxDepthRecursion\\\": 1,\\n \\\"gitProjectManager.baseProjectsFolders\\\": [\\n \\\"~/Developer\\\"\\n ],\\n \\\"gitProjectManager.ignoredFolders\\\": [\\n \\\"node_m
{"name":"Patrick's Profile","settings":"{\"settings\":\"{\\n // Workbench\\n \\\"workbench.startupEditor\\\": \\\"none\\\",\\n \\\"workbench.colorTheme\\\": \\\"Dracula\\\",\\n \\\"workbench.iconTheme\\\": \\\"material-icon-theme\\\",\\n \\\"workbench.editor.enablePreviewFromQuickOpen\\\": false,\\n \\\"workbench.editor.enablePreview\\\": false,\\n \\\"workbench.colorCustomizations\\\": {\\n \\\"statusBar.debuggingBackground\\\": \\\"#45C8FE\\\"\\n },\\n\\n // Editor\\n \\\"editor.cursorBlinking\\\": \\\"solid\\\",\\n \\\"editor.minimap.enabled\\\": false,\\n \\\"editor.wordWrap\\\": \\\"on\\\",\\n \\\"editor.rulers\\\": [\\n 120\\n ],\\n \\\"editor.fontSize\\\": 14,\\n \\\"editor.detectIndentation\\\": true,\\n \\\"editor.acceptSuggestionOnCommitCharacter\\\": false,\\n \\\"editor.codeActionsOnSave\\\": {\\n \\\"source.fixAll.eslint\\\": true,\\n },\\n \\\"editor.quickSuggestionsDelay\\\": 100,\\n \\\"editor.accessibilitySupp
@santospatrick
santospatrick / exercises.tsx
Last active July 30, 2022 16:00
Typescript exercises based in real world examples
// ===================
// Typescript Exercises
// ===================
// Utility types: https://www.typescriptlang.org/docs/handbook/utility-types.html
// Reference: https://pokeapi.co/api/v2/pokemon?limit=10
type Pokemon = unknown
const bulbasaur: unknown = {
name: 'bulbasaur',
// .hyper.js
// See https://hyper.is#cfg for all currently supported options.
// After installing hyper, run the following:
// hyper i hyper-dracula hypercwd hyper-active-tab
module.exports = {
config: {
fontSize: 18,
fontFamily: '"Meslo LG M for Powerline", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
fontWeight: 'normal',