Skip to content

Instantly share code, notes, and snippets.

View trepichio's full-sized avatar
🧠
Talk is cheap. Show me the code!

João Trepichio trepichio

🧠
Talk is cheap. Show me the code!
View GitHub Profile
@trepichio
trepichio / adaptive.md
Last active December 27, 2023 18:50
SOMOS

Payload da exchange 'plurall::adaptative.indexer.assessment':

Assessement [{ "student_id": "1234 "event_id": "999" "event_name": " "abilities": [{ "ability_code": "MT_5E2.2", "content_code": "ACGTEFIMA5_OBEFIMA78_CN1EFIMA219_CN2EFIMA143",

@trepichio
trepichio / transfer_partial_git.md
Last active October 14, 2023 08:07
Transfer a partial history from a git branch to a new repository

Transfer a partial history from a Git Branch to a new Repository

Steps to reproduce:

  1. In your current repository, create a new orphan branch, containing the contents of the first commit you want to copy:

      $ git checkout --orphan -b tmpbranch <hash_of_first_commit>
      $ git commit -a -m 'first commit'
  2. Cherry-pick the rest of the commits you want:

@trepichio
trepichio / isValidCPF.js
Created May 14, 2021 07:42
CPF Validation
export const isValidCPF = (cpf) => {
if (typeof cpf !== "string") return false
cpf = cpf.replace(/[\s.-]*/igm, '')
if (cpf.length !== 11 || !Array.from(cpf).filter(e => e !== cpf[0]).length) {
return false
}
var soma = 0
var resto
@trepichio
trepichio / TypedBuilder.ts
Last active May 15, 2022 04:25
Typescript
type Definition = {
vals: number[];
};
type ErrorBrand<Err extends string> = Readonly<{
[k in Err]: void;
}>;
// Entry point for our builder. Unlike the value builder
// pattern example, we don't need a definition value storing the set of
@trepichio
trepichio / js_one_liner_snippets.js
Last active February 22, 2022 23:43
JS One liners
/* If-else functional */
export const conditionally = (config) => (props) => {
return config.if(props) ?
config.then(props) : config.else(props);
};
/* Try-catch functional */
export function tryCatch({
tryer,
catcher
@trepichio
trepichio / add_port_plugin_management.md
Last active January 21, 2022 19:44
Fix rabbitmq worker

Add plugin management port in rabbitmq.conf file

management.tcp.port = 15672

if plugin is not enabled, enable it adding the following file enabled_plugins in data/rabbitmq/etc/ with content:

[rabbitmq_management].
@trepichio
trepichio / pushBranchToNewRepo.md
Last active January 21, 2022 03:40
Pushes a branch to its own GitHub repository

Push a Git Branch to a NEW repository

cd to the old repo directory and then

$ git push https://github.com/trepichio/<newRepository>.git +theBranchIwant:master
@trepichio
trepichio / add_proj_folders.sh
Last active November 13, 2021 01:18
Addtional Vue Project folders
#copy and paste or edit and run
cd src
mkdir common
mkdir common/components common/mixins common/directives
mkdir layouts
mkdir middlewares
mkdir plugins
mkdir services
@trepichio
trepichio / converthtaccess2netilify.sh
Last active November 13, 2021 01:15
Convert htaccess to Netlify redirects
#Convert htaccess to netlify _redirects
grep DirectoryIndex htaccess | awk -F' ' '{print "/", "/"$2, 200}' > _redirects
grep RewriteRule htaccess | grep -v 'robots'| awk -F' ' '{print $2, $3, 200}' | sed -e 's/\^/\//g' | sed -e 's/\$//g' >> _redirects
@trepichio
trepichio / flexbox_layouts.md
Last active October 18, 2021 03:19
Flexbox layouts