Skip to content
View fulcrum-report-rename.sh
#!/bin/bash
INPUT=fire_hydrants.csv
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read -a csv_line
do
mv ${csv_line[0]}.pdf ${csv_line[8]}-${csv_line[0]}.pdf
done < $INPUT
View fulcrum-download-videos.py
import sys
import urllib2
from fulcrum import Fulcrum
api_key = raw_input('api_key:')
form_id = raw_input('form_id:')
if api_key == '' or api_key == 'your_api_key' or form_id == '' or form_id == 'your_form_id':
sys.exit('api_key and form_id are required!')
View find-in-json.js
//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
{
"classification_set": {
"name": "Agricultural Products",
"description": "A list of common agricultural products",
"items": [
{
"label": "cereals",
"value": "cereals",
"child_classifications": [
{
View fulcrum_email_webhook.gs
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
import os
import urllib
import urllib2
import base64
import json
import sys
import argparse
try:
import requests
except ImportError:
View fulcrum-basic-webhook.php
<?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
#!/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
<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
// 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);
Something went wrong with that request. Please try again.