Skip to content

Instantly share code, notes, and snippets.

View atomize's full-sized avatar
🎹
♩♩

Berti atomize

🎹
♩♩
View GitHub Profile
@atomize
atomize / README.MD
Created May 9, 2018 20:04 — forked from KaraAJC/README.MD
ReadMe Template

Title

Description

Add a one-sentence description of this project. and a link to the live demo.

Features

  • completed feature: What this feature does
  • pending feature: What this feature does

ScreenShots

@atomize
atomize / mapOrderES6.js
Last active May 21, 2018 22:20 — forked from ecarter/mapOrder.js
Order an array of objects based on another array order ES6
/*
Sort array of objects based on another array
Original function:
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];
if (order.indexOf(A) > order.indexOf(B)) {
return 1;
} else {
@atomize
atomize / index.js
Created July 7, 2018 01:24 — forked from yandzee/index.js
Code retry with promises
// Author: Renat Tuktarov ([email protected])
const retry = function(fn, prev) {
return new Promise((current, reject) => {
const resolve = _ => (prev && prev()) || current();
fn(resolve, delay => {
setTimeout(_ => {
retry(fn, resolve);
}, delay);
@atomize
atomize / promise_map.js
Created August 17, 2018 21:30 — forked from tokland/promise_map.js
Execute an array of promises sequentially and collect the result
function promiseMap(xs, f) {
const reducer = (ysAcc$, x) =>
ysAcc$.then(ysAcc => f(x).then(y => ysAcc.push(y) && ysAcc));
return xs.reduce(reducer, Promise.resolve([]));
}
/* Example */
const axios = require('axios');
@atomize
atomize / s3.sh
Created October 18, 2018 19:58 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@atomize
atomize / onchange.sh
Created October 18, 2018 22:25 — forked from senko/onchange.sh
Watch current directory and execute a command if anything in it changes
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <[email protected]>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
package main
import (
"bufio"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"regexp"
@atomize
atomize / Append CSV to Sheet.py
Last active September 27, 2024 12:55 — forked from david-pettifor-nd/Append CSV to Sheet.py
Google Drive/Sheets API
# open the CSV file
csv_file = open(CSV_LOCATION, 'r')
csv_reader = csv.reader(csv_file)
values = []
for row in csv_reader:
values.append(row)
body = {
'values': values
@atomize
atomize / README.md
Created November 10, 2018 22:54 — forked from dciccale/README.md
Tiny Cross-browser DOM ready function in 111 bytes of JavaScript

DOM Ready

Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.

@atomize
atomize / convert id_rsa to pem
Last active November 30, 2018 14:55 — forked from mingfang/convert id_rsa to pem
Convert id_rsa to pem file
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
chmod 0600 id_rsa.pem