Skip to content

Instantly share code, notes, and snippets.

View joaopcm's full-sized avatar
👋

João Melo joaopcm

👋
View GitHub Profile
@joaopcm
joaopcm / next.config.js
Last active April 29, 2024 11:49
How to configure COOP/COEP headers in a Next.js app
/** @type {import('next').NextConfig} */
const nextConfig = {
// ...your other Next.js settings here...
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'Cross-Origin-Embedder-Policy',
@joaopcm
joaopcm / .gitconfig
Created January 30, 2024 02:10
Git aliases
[alias]
co = checkout
p = push
ec = config --global -e
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cob = checkout -b
cm = !git add -A && git commit -m
save = !git add -A && git commit -m 'SAVEPOINT'
wip = commit -am "WIP"
undo = reset HEAD~1 --mixed
alias g='git'
alias gm="git merge"
alias gmv='git mv'
alias grm='git rm'
alias gs='git status'
alias gss='git status -s'
alias gl='git pull'
alias gc='git clone'
alias ga='git add'
alias grh='git reset HEAD'
@joaopcm
joaopcm / useIIsomorphicLayoutEffect.js
Created January 4, 2023 16:22
useIIsomorphicLayoutEffect react hook
import { useEffect, useLayoutEffect } from 'react'
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect
export default useIsomorphicLayoutEffect
@joaopcm
joaopcm / get-cms_auth_token.sh
Created December 27, 2022 19:26
Raycast script to generate and copy to your clipboard a brand new authorization token to the CMS project
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Get CMS_auth_token
# @raycast.mode compact
# Optional parameters:
# @raycast.icon images/x-team.png
// Here you can find the list of errors
// https://github.com/hapijs/joi/blob/master/API.md#list-of-errors
const messages = {
'alternatives.all': 'O campo {#label} é inválido',
'alternatives.any': 'O campo {#label} é inválido',
'alternatives.match': 'O campo {#label} é inválido',
'alternatives.one': 'O campo {#label} é inválido',
'alternatives.types': 'O campo {#label} é inválido',
const filters = {
'24hrs': {
hours: 24,
extractKeys: [
'HOUR'
]
},
'48hrs': {
hours: 48,
extractKeys: [
LS_COLORS=$LS_COLORS:'ow=01;34:' ; export LS_COLORS
SPACESHIP_PROMPT_ORDER=(
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
exec_time # Execution time
line_sep # Line break
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',