Skip to content

Instantly share code, notes, and snippets.

View JoshuaCaputo's full-sized avatar
🥕
JS

Joshua Caputo JoshuaCaputo

🥕
JS
View GitHub Profile
@JoshuaCaputo
JoshuaCaputo / AWS_S3_File_Upload.js
Last active June 29, 2018 05:58 — forked from homam/AWS_S3_File_Upload.js
How to upload files to AWS S3 with NodeJS SDK
var AWS = require("aws-sdk");
var fs = require('fs');
s3 = new AWS.S3();
// For dev purposes only
AWS.config.update({ accessKeyId: '...', secretAccessKey: '...' });
// Read in the file, convert it to base64, store to S3
fs.readFile('del.txt', function (err, data) {
if (err) { throw err; }
@JoshuaCaputo
JoshuaCaputo / angle-between-points.js
Last active July 11, 2018 06:54 — forked from conorbuck/angle-between-points.js
JavaScript: Find the angle between two points
var angleBetweenPoints = function(p1, p2, rad){ // vector2, vector2, bool
if (!p1 || !p2){
return false;
}
// format angle in radians
var angleRadians = Math.atan2(p2.y - p1.y, p2.x - p1.x);
// format angle in degrees
var angleDegrees = angleRadians * 180 / Math.PI;
// return formatted angle