View find-in-json.js
1 2 3 4 5 6 7 8 9 10
//return an array of objects according to key, value, or key and value matching
function getObjects(obj, key, val) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
objects = objects.concat(getObjects(obj[i], key, val));
} else
//if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not)
if (i == key && obj[i] == val || i == key && val == '') { //
View fulcrum_classification_set_example.json
1 2 3 4 5 6 7 8 9 10
{
"classification_set": {
"name": "Agricultural Products",
"description": "A list of common agricultural products",
"items": [
{
"label": "cereals",
"value": "cereals",
"child_classifications": [
{
View fulcrum_email_webhook.gs
1 2 3 4 5 6 7 8 9 10
function doPost(e){
return handleResponse(e);
}
 
function handleResponse(e) {
var email = e.parameter.email;
var form = e.parameter.form;
var jsonString = e.postData.getDataAsString();
var payload = JSON.parse(jsonString);
var subject = "Fulcrum Webhook Payload";
View cartodb-utils.py
1 2 3 4 5 6 7 8 9 10
import os
import urllib
import urllib2
import base64
import json
import sys
import argparse
try:
import requests
except ImportError:
View fulcrum-basic-webhook.php
1 2 3 4 5 6 7 8 9 10
<?php
$form_id = 'your-fulcrum-form-id-goes-here';
$email = 'me@gmail.com';
$input = file_get_contents('php://input'); # POST data from webhook
//$input = file_get_contents('payload.json'); # local file for testing
$webhook = json_decode($input, true);
# Webhook data
$webhookID = $webhook['id'];
View pdfmaps-shapefile.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/bash
 
echo "File type (kmz or kml):"
read TYPE
echo "Enter the filename (without the .kmz or .kml extension) to process:"
read FILENAME
 
# Unzip KMZ file
if [[ $TYPE = "kmz" ]]; then
Unzip "$FILENAME.kmz"
View index.html
1 2 3 4 5 6 7 8 9 10
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1,width=device-width">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>Leaflet Fullscreen Iframe</title>
</head>
<body>
View fulcrum-email-notification.gs
1 2 3 4 5 6 7 8 9 10
// Special Apps Script function to process HTTP POST request
function doPost(e){
return handleResponse(e);
}
 
function handleResponse(e) {
// Parse JSON webhook payload
var jsonString = e.postData.getDataAsString();
var payload = JSON.parse(jsonString);
View deleteFromImgur.js
1 2 3 4 5 6 7 8 9 10
function deleteFromImgur() {
$.ajax({
url: "https://api.imgur.com/3/image/{id}",
type: "DELETE",
headers: {
"Authorization": "Client-ID YOUR-CLIEND-ID-GOES-HERE"
},
success: function(response) {
//console.log(response);
}
View Code.gs
1 2 3 4 5 6 7 8 9
// Create or open an existing Sheet and click Tools > Script editor and enter the code below
// 1. Enter sheet name where data is to be written below
var SHEET_NAME = "Sheet1";
// 2. Run > setup
// 3. Publish > Deploy as web app
// - enter Project Version name and click 'Save New Version'
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)
// 4. Copy the 'Current web app URL' and post this in your form/script action
// 5. Insert column names on your destination sheet matching the parameter names of the data you are passing in (exactly matching case)
Something went wrong with that request. Please try again.