I hereby claim:
- I am eliascodes on github.
- I am eliascodes (https://keybase.io/eliascodes) on keybase.
- I have a public key ASB8zjqKLY2kRS8JzVH29wxgMVHBIhwrc5QW_yqVr0K9mAo
To claim this, I am signing this object:
#!/usr/bin/env bash | |
function ggi { | |
domain="https://raw.githubusercontent.com" | |
path="/github/gitignore/master/${1^}.gitignore" | |
file=$(curl ${domain}${path}) | |
target=$(pwd)/.gitignore | |
touch ${target} | |
echo "$file" > ${target} |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env zsh | |
## Manual | |
# install Firefox, Chrome, VLC, 1password, Wunderlist, SourceTree, Spectacle | |
# Atom, iTerm2, Dash, Pocket, LittleFlocker, LittleSnitch, Keybase | |
## Auto | |
echo "##### install brew #####\n" | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
#### | |
#### oh-my-zsh setup | |
#### | |
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/elias/.oh-my-zsh |
var accountSid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // Your Account SID from www.twilio.com/console | |
var authToken = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'; // Your Auth Token from www.twilio.com/console | |
var client = require('twilio')(accountSid, authToken); | |
const fs = require('fs'); | |
const path = require('path'); | |
const axios = require('axios'); | |
const async = require('async'); | |
var tasks = []; | |
const BASE_URL = 'https://api.twilio.com/'; |
I want a function to pipe together a series of promise returning functions. However, I also want to specify an undo function for each piped function. If any function returns a rejected promise, the undo function corresponding to that step should be called.
I'm free to let my undo function return a resolved promise, which indicates a recovery and continues down the pipe, or a rejected promise, which results in breaking the promise chain and skipping to the catch
statement (if any).
Based on this SO answer, this is the form of the solution if you know how many steps you have:
steps[1]
.then(
(...args) => steps[2](...args).then(null, undos[2]),
function insert(val, i, xs) { | |
return xs.slice(0, i).concat(val).concat(xs.slice(i)); | |
} | |
function validateURL(url) { | |
return !url.match('codepen'); | |
} | |
function fetch(url) { | |
var response = UrlFetchApp.fetch(url); |