Skip to content

Instantly share code, notes, and snippets.

View reganstarr's full-sized avatar

Regan Starr reganstarr

View GitHub Profile
test from gist
[{"added_at": "2018-08-20T20:52:46Z", "added_by": {"external_urls": {"spotify": "https://open.spotify.com/user/reganstarr"}, "href": "https://api.spotify.com/v1/users/reganstarr", "id": "reganstarr", "type": "user", "uri": "spotify:user:reganstarr"}, "is_local": false, "primary_color": null, "track": {"album": {"album_type": "single", "artists": [{"external_urls": {"spotify": "https://open.spotify.com/artist/2hnzQ6eCFkxUIPsVcsdj8A"}, "href": "https://api.spotify.com/v1/artists/2hnzQ6eCFkxUIPsVcsdj8A", "id": "2hnzQ6eCFkxUIPsVcsdj8A", "name": "The Georgia Satellites", "type": "artist", "uri": "spotify:artist:2hnzQ6eCFkxUIPsVcsdj8A"}], "available_markets": [], "external_urls": {"spotify": "https://open.spotify.com/album/2V1agf5NiLNSziJTRSTDcS"}, "href": "https://api.spotify.com/v1/albums/2V1agf5NiLNSziJTRSTDcS", "id": "2V1agf5NiLNSziJTRSTDcS", "images": [{"height": 640, "url": "https://i.scdn.co/image/ab67616d0000b27308cfc8aa508532a191371ced", "width": 640}, {"height": 300, "url": "https://i.scdn.co/image/ab6761
#screenshot of how to set this up: https://zapier.cachefly.net/storage/photos/75c29b38cf502d96472b8ac42daf44fc.png
list_of_things = input['comma_separated_string'].split(',')
for item in list_of_things:
item = item.strip()
requests.get(input['webhook_url'] + '?output=' + item)
output = {};
var emailArray = ['[email protected]', '[email protected]', '[email protected]'];
var array = [];
emailArray.forEach(function(email){
array.push({"email": email});
});
output = {output: JSON.stringify(array)};
function apiCallFunction(){
var apiUrl = '';
fetch(apiUrl, {
method: 'GET'
})
.then(function(res) {
return res.json();
})
function xmlToJson(xml) {
var obj = {};
if (xml.nodeType == 1) {
if (xml.attributes.length > 0) {
obj["@attributes"] = {};
for (var j = 0; j < xml.attributes.length; j++) {
var attribute = xml.attributes.item(j);
obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
}
}
var mediumIntegrationToken = "REPLACE_WITH_YOUR_MEDIUM_INTEGRATION_TOKEN";
// That's it. No need to edit anything else below.
// split the comma-separated tags string into an array then remove any whitespace
/*
This code assumes that you have included a "freshbooksTimeEntryObject" somewhere in a previous Zap step. You can see the format of a "freshbooksTimeEntryObject" below.
freshbooksTimeEntryObject = {
"project_id": "25479",
"task_id": "302086",
"staff_id": "1",
"hours": "4",
"notes": "This is a note",
"date": "2016-01-31"
// This code requires that you set the ID of the tweet that you want to Like as an input variable called "tweet_id". Learn more at https://zapier.com/help/code/#data-variables
// INSTUCTIONS FOR SETTING THESE REQUIRED VARIABLES: After you create a new app at https://apps.twitter.com/, click on the name of the app to open it. Then, select the "Keys and Access Tokens" tab.
var twitterApplicationConsumerKey = ''; // Located in the "Application Settings" section
var twitterApplicationConsumerSecret = ''; // Located in the "Application Settings" section
var twitterApplicationAccessToken = ''; // Located in the "Your Access Token" section
var twitterApplicationAccessTokenSecret = ''; // Located in the "Your Access Token" section
function sha1 (str) {
// discuss at: http://phpjs.org/functions/sha1/
// original by: Webtoolkit.info (http://www.webtoolkit.info/)
// improved by: Michael White (http://getsprink.com)
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// input by: Brett Zamir (http://brett-zamir.me)
// example 1: sha1('Kevin van Zonneveld');
// returns 1: '54916d2e62f65b3afa6e192e6a601cdbe5cb5897'
var rotate_left = function (n, s) {