Skip to content
View thumbnail.sql
SELECT *, CASE WHEN photos != '' THEN left(photos_url, position('/view' in photos_url)) || split_part(photos, ',', 1) || '/thumbnail.jpg' ELSE photos END AS thumbnail FROM my_fulcrum_table
View google-form-to-github-issue.md

Wiring up a Google Form to GitHub is not that difficult with a little bit of Apps Script automation. All you need is a Google account, a GitHub account, and a web browser...

Set up your GitHub Personal Access Token

Personal access tokens provide an easy way to interact with the GitHub API without having to mess with OAuth. If you don't already have a personal access token with repo or public_repo access, visit your GitHub settings page and generate a new token.

Be sure to copy your token some place safe and keep it secure. Once generated, you will not be able to view or copy the token again.

Set up the Form & Spreadsheet

  1. Create a Google Form.
View polygon_insert.sql
-- Create a function withn the security set to Definer so that it can insert
CREATE OR REPLACE FUNCTION AXH_NewMinneapolis(integer, geometry) RETURNS integer
AS 'INSERT INTO minneapolis (parent_id, the_geom) (SELECT id, geom FROM (SELECT $1 id,$2 geom) a WHERE ST_NPoints(geom) < 100) RETURNING cartodb_id;'
LANGUAGE SQL
SECURITY DEFINER
RETURNS NULL ON NULL INPUT;
--Grant access to the public user
GRANT EXECUTE ON FUNCTION AXH_NewMinneapolis(integer, geometry) TO publicuser;
View fulcrum-topojson.js
/*
Copyright (c) 2012, Michael Bostock
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
View fulcrum-turf.js
/*
javascript.util is a port of selected parts of java.util to JavaScript which
main purpose is to ease porting Java code to JavaScript.
The MIT License (MIT)
Copyright (C) 2011-2014 by The Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
View move.bat
move /Y ad0c334e-b57f-471f-89f1-2ca17988b74c.jpg photos-a
move /Y 88e60f5c-15e9-4d68-8e79-4b659f66157b.jpg photos-a
move /Y 4da2cd00-d3a7-4468-997e-042303dc7137.jpg photos-a
move /Y bc0edbe2-45b0-4ad5-9b35-a8c3e623634d.jpg photos-a
move /Y 9fa41b28-24c8-4f8f-abf5-08604a043d13.jpg photos-a
move /Y e28c7d9c-06af-43bc-8f8c-1862f0bc6642.jpg photos-a
move /Y 95360e82-f6a5-46ce-b33d-58a8f571fe11.jpg photos-b
move /Y cb39737a-a3ed-4240-91ff-d967c8151ab9.jpg photos-b
move /Y 2be31a26-a482-4802-81e9-478e5cc676e9.jpg photos-b
move /Y 4b4aeba8-7d78-4a41-9c61-b5bd60a484b2.jpg photos-b
View fulcrum-data-share-cartodb-webhook.js
function doPost(e){
return handleResponse(e);
}
function handleResponse(e) {
var jsonString = e.postData.getDataAsString();
var payload = JSON.parse(jsonString);
var formId = "my-form-id";
var shareToken = "my-data-share-token";
var cartodbTable = "my-cartodb-table";
View fulcrum-update-records-from-csv.py
import csv
from fulcrum import Fulcrum
from fulcrum.exceptions import NotFoundException
api_key = 'your-api-key'
form_id = 'your-form-id'
fulcrum = Fulcrum(key=api_key)
updates = csv.reader(open('record-updates.csv'), delimiter=',')
# skip header
View fulcrum_mysql_webhook.php
<?php
/**
* Title: Fulcrum Webhook for syncing data shares to MySQL database
* Notes: Requires PHP with PDO & allow_url_fopen enabled
* Author: Bryan R. McBride
* Source: https://gist.github.com/bmcbride/44afdc10ee943b4e7b92
*/
# Fulcrum app information
$formID = 'your-fulcrum-form-id';
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
Something went wrong with that request. Please try again.