Skip to content

Instantly share code, notes, and snippets.

View dacheaux's full-sized avatar

Damjan Filipovic dacheaux

View GitHub Profile
@hmontazeri
hmontazeri / listAllObjectsFromS3Bucket.js
Last active April 2, 2024 03:00
get more than 1000 elements from s3 bucket (node.js)
const AWS = require('aws-sdk');
const s3 = new AWS.S3({
region: 'eu-central-1',
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
});
async function listAllObjectsFromS3Bucket(bucket, prefix) {
let isTruncated = true;
@calebgrove
calebgrove / stateToAbbr.js
Last active April 24, 2024 22:18
Convert state name to abbreviation in JavaScript. There's some better solutions in the comments, so scroll down!
// There's some better solutions in the comments, so scroll down and see how other folks have improved this!
// USAGE:
// abbrState('ny', 'name');
// --> 'New York'
// abbrState('New York', 'abbr');
// --> 'NY'
function abbrState(input, to){
@paullewis
paullewis / gist:1982121
Created March 5, 2012 23:44
Mergesort in JavaScript
/**
* An implementation for Mergesort. Less efficient
* than Quicksort. Again, you'd just use Array.sort
* but if you found yourself unable to use that
* there's always this option.
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {