Skip to content

Instantly share code, notes, and snippets.

View gabrielrufino's full-sized avatar

Gabriel Rufino gabrielrufino

View GitHub Profile
@gabrielrufino
gabrielrufino / delete-branches-by-pattern.sh
Created July 16, 2024 15:27
Delete branches by pattern
git branch --list 'o*' | xargs -r git branch -d
@gabrielrufino
gabrielrufino / clone-github.sh
Last active May 6, 2024 22:01
Clone all repositories from some owner using GitHub CLI
OWNER=gabrielrufino
gh repo list $OWNER --limit 4000 --no-archived | while read -r repo _; do
gh repo clone "$repo" "$repo"
done
@gabrielrufino
gabrielrufino / map-filter-reduce.js
Last active August 21, 2020 22:06
My implementation of Map, Filter and Reduce <3
Array.prototype.map = function (callback) {
const result = []
for (let i = 0; i < this.length; i++) {
result.push(callback(this[i], i, this))
}
return result
}
@gabrielrufino
gabrielrufino / example.js
Last active January 20, 2020 17:51
Shuffle the elements of an array
const shuffle = require('./shuffle')
const example = [1, 2, 3]
const shuffled = shuffle(example)
/*
shuffled can be any of these:
- [1, 2, 3]
- [1, 3, 2]
@gabrielrufino
gabrielrufino / data.json
Last active September 21, 2019 18:28
KNN with tensorflow
[
{
"x": 1,
"y": 1,
"label": "A"
},
{
"x": 1,
"y": 2,
"label": "A"
@gabrielrufino
gabrielrufino / nodemailer04.js
Created June 27, 2018 17:07
Nodemailer: O pombo-correio do Node.js
const nodemailer = require('nodemailer') // Importa o módulo principal
const transporter = nodemailer.createTransport({ // Configura os parâmetros de conexão com servidor.
host: 'smtp.umbler.com',
port: 547,
secure: false,
auth: {
user: '[email protected]',
pass: 'ex3mpl0'
}
@gabrielrufino
gabrielrufino / nodemailer03.js
Last active June 27, 2018 14:39
Nodemailer: O pombo-correio do Node.js
const nodemailer = require('nodemailer') // Importa o módulo principal
const transporter = nodemailer.createTransport({ // Configura os parâmetros de conexão com servidor.
host: 'smtp.umbler.com',
port: 547,
secure: false,
auth: {
user: '[email protected]',
pass: 'ex3mpl0'
}
@gabrielrufino
gabrielrufino / nodemailer02.js
Created June 27, 2018 14:04
Nodemailer: O pombo-correio do Node.js
const nodemailer = require('nodemailer') // Importa o módulo principal
const transporter = nodemailer.createTransport({ // Configura os parâmetros de conexão com servidor.
host: 'smtp.umbler.com',
port: 547,
secure: false,
auth: {
user: '[email protected]',
pass: 'ex3mpl0'
}
@gabrielrufino
gabrielrufino / middlewares.js
Last active April 26, 2018 04:36
Middleware/Pipeline pattern
const generator = () => {
const middlewares = []
const use = (fn) => middlewares.push(fn)
const runMiddleware = index => {
if (index < middlewares.length) {
middlewares[index](() => runMiddleware(index + 1))
}
}