Skip to content

Instantly share code, notes, and snippets.

View gabrielrufino's full-sized avatar
🐞
Probably fixing a bug

Gabriel Rufino gabrielrufino

🐞
Probably fixing a bug
View GitHub Profile
@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"
import Reactotron from 'reactotron-react-native'
const host = '192.168.0.105'
console.tron = Reactotron
.configure({ host })
.useReactNative()
.connect()
@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: 'exemplo@gabrielrufino.com',
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: 'exemplo@gabrielrufino.com',
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: 'exemplo@gabrielrufino.com',
pass: 'ex3mpl0'
}
@gabrielrufino
gabrielrufino / nodemailer01.js
Last active June 27, 2018 14:03
Nodemailer: O pombo-correio do Node.js
const nodemailer = require('nodemailer') // Importa o módulo principal
@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))
}
}