Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Focusing

Dimitri DO BAIRRO rimiti

🚀
Focusing
View GitHub Profile
@rimiti
rimiti / README.md
Created Jul 27, 2018
Sending JSON object into form data field with request
View README.md

Sending JSON object into form data field with request

How to run it?

npm i request -S
@rimiti
rimiti / upload-to-s3-steam.js
Created Nov 20, 2018
NodeJS - Upload local (file) image to AWS S3 from stream with public access.
View upload-to-s3-steam.js
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 Jan 14, 2019
cdn-coming-soon.min.js
@rimiti
rimiti / index.js
Created Apr 23, 2019
Loop: running promises in sequential.
View index.js
/**
* @description Runs getUser() in sequential.
* @return {Promise<void>}
*/
async function example() {
for (let i = 0; i < 10; i++) {
await getUser();
}
}
View index.html
<!--<!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 / index.js
Last active Aug 20, 2019
Sending an email with Mandrill
View index.js
const nodemailer = require("nodemailer");
const mandrillTransport = require('nodemailer-mandrill-transport');
const smtpTransport = nodemailer.createTransport(mandrillTransport({
auth: {
apiKey : 'your-token'
}
}));
const mailData = {
@rimiti
rimiti / example.js
Created Oct 1, 2019
Javascript: Creating a custom javascript error
View example.js
export class RequestError extends Error {
constructor(message, meta = {}) {
super();
this.message = message;
this.meta = meta;
}
}
@rimiti
rimiti / sentry.js
Created Oct 1, 2019
Example to capture a Sentry exception
View sentry.js
const Sentry = require('@sentry/node');
Sentry.init({ dsn: process.env.SENTRY_DSN, environment: 'staging' });
Sentry.captureException(new Error('Test from local'));
@rimiti
rimiti / 🙈❤️.png
Last active Oct 25, 2019
Raccoon﹠Monkey lover ❤️
@rimiti
rimiti / NPM_PUBLISH.md
Created Dec 26, 2019
To check what it will be publish on npm before publishing
View NPM_PUBLISH.md

To check what it will be publish on npm before publishing:

npm pack && tar -xvzf *.tgz && rm -rf package *.tgz
You can’t perform that action at this time.