Skip to content

Instantly share code, notes, and snippets.

View rimiti's full-sized avatar
🚀
Focusing

Dimitri DO BAIRRO rimiti

🚀
Focusing
View GitHub Profile
@rimiti
rimiti / sentry.js
Created October 1, 2019 14:26
Example to capture a Sentry exception
const Sentry = require('@sentry/node');
Sentry.init({ dsn: process.env.SENTRY_DSN, environment: 'staging' });
Sentry.captureException(new Error('Test from local'));
@rimiti
rimiti / index.js
Last active August 20, 2019 08:28
Sending an email with Mandrill
const nodemailer = require("nodemailer");
const mandrillTransport = require('nodemailer-mandrill-transport');
const smtpTransport = nodemailer.createTransport(mandrillTransport({
auth: {
apiKey : 'your-token'
}
}));
const mailData = {
@rimiti
rimiti / index.html
Created August 13, 2019 13:54
zendesk-app
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">-->
<!--<html xmlns="http://www.w3.org/1999/xhtml">-->
<!--<head>-->
<!-- <title>Test Layout</title>-->
<!-- <style type="text/css">-->
<!-- body, html-->
<!-- {-->
<!-- margin: 0; padding: 0; height: 100%; overflow: hidden;-->
<!-- }-->
@rimiti
rimiti / 🙈❤️.png
Last active July 26, 2023 11:52
Raccoon﹠Monkey lover ❤️
🙈❤️.png
@rimiti
rimiti / index.js
Created April 23, 2019 15:55
Loop: running promises in sequential.
/**
* @description Runs getUser() in sequential.
* @return {Promise<void>}
*/
async function example() {
for (let i = 0; i < 10; i++) {
await getUser();
}
}
@rimiti
rimiti / README.md
Created December 29, 2018 13:29
Benchmark: Template string array stringified VS join() ?

Array stringified VS join(), who win ?

Template string (ES6)

function test() {
let array = ["email","groups_access_member_info","publish_to_groups","user_age_range","user_birthday","user_events","user_friends","user_gender","user_hometown","user_likes","user_link","user_location","user_photos","user_posts","user_tagged_places","user_videos"];

return `${array}`;
}
@rimiti
rimiti / upload-to-s3-steam.js
Created November 20, 2018 10:28
NodeJS - Upload local (file) image to AWS S3 from stream with public access.
const AWS = require('aws-sdk');
const fs = require('fs');
AWS.config.update({ accessKeyId: 'ACCESSKEYID', secretAccessKey: 'SECRETACCESSKEY', region: 'eu-west-3'});
const fileStream = fs.createReadStream('/path/to/your/image.png');
fileStream.on('error', function (err) {
if (err) { throw err; }
});
@rimiti
rimiti / bg.jpg
Last active January 14, 2019 14:31
cdn-coming-soon.min.js
bg.jpg
@rimiti
rimiti / README.md
Created July 27, 2018 08:33
Sending JSON object into form data field with request

Sending JSON object into form data field with request

How to run it?

npm i request -S
@rimiti
rimiti / installations.sh
Last active July 5, 2018 08:26
Install kubernetes on Debian 9 (online.net)
#!/bin/sh
# Install common and docker
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
apt-get update && apt-get install -y docker-ce=$(apt-cache madison docker-ce | grep 17.03 | head -1 | awk '{print $3}')
# Install kubelet, kubeadm kubectl