Skip to content

Instantly share code, notes, and snippets.

@bmcbride
bmcbride / fulcrum-selectize.js
Created Jul 8, 2021
Selectize Fulcrum editor visibility & requirement rule select controls
View fulcrum-selectize.js
$('head').append('<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.13.3/js/standalone/selectize.min.js"></script>');
$('head').append('<link href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.13.3/css/selectize.bootstrap3.min.css" type="text/css" rel="stylesheet" />');
$('.visibility-conditional-modal').on('shown.bs.modal', selectizeIt);
$('.required-conditional-modal').on('shown.bs.modal', selectizeIt);
function selectizeIt() {
$('.condition-field').selectize({
sortField: 'text',
dropdownParent:'body'
});
$('.selectize-dropdown').css('z-index', 9999);
View example-data-event.js
storage = STORAGE();
ON('load-record', function (event) {
if (storage.getItem("turf")) {
eval(JSON.parse(storage.getItem("turf")));
turf = module.exports;
} else {
REQUEST({url: 'https://gist.githubusercontent.com/bmcbride/568bb31c073af412f35db3a558cc246a/raw/b9d0c3265fffec8119151c647cb74be7f349beb3/turf.js'}, function(error, response, body) {
if (error) {
ALERT('Error with request: ' + INSPECT(error));
@bmcbride
bmcbride / Code.gs
Created Mar 28, 2018
Google Apps Script for exporting CSV files from the Fulcrum Query API to a Drive folder
View Code.gs
/**
Title: Google Apps Script for exporting CSV files from the Fulcrum Query API to a Drive folder
Notes: Be sure to manually run the exportData() function at least once to authorize the script. Set a timed trigger to automate exports.
Author: Bryan R. McBride
**/
var fulcrumToken = "abcdefghijklmnopqrstuvwxyz";
var fulcrumFormName = "My App";
var filesFolder = "1_NGfsxszanv2evVJgfKMXxmU54SZ92FW";
@bmcbride
bmcbride / Code.gs
Last active Apr 1, 2022
Google Apps Script for importing CSV files from Drive into Fulcrum
View Code.gs
/**
Title: Google Apps Script for importing CSV files from Drive into Fulcrum
Notes: Be sure to manually run the getFiles() function at least once to authorize the script. Set a timed trigger to automate imports.
Author: Bryan R. McBride
--CSV file format--
latitude,longitude,name,color
27.770787,-82.638039,Building 1,red
**/
var fulcrumToken = "abcdefghijklmnopqrstuvwxyz";
@bmcbride
bmcbride / apbp_karner_barrens.geojson
Created Sep 16, 2017
Albany Pine Bush Preserve - Karner Barrens Trails
View apbp_karner_barrens.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmcbride
bmcbride / osgb.js
Created Jan 18, 2017
Fulcrum Data Event to convert WGS84 coordinates to Ordnance Survey Great Britain (OSGB) / British National Grid (BNG).
View osgb.js
/**
* GeoTools javascript coordinate transformations
* http://files.dixo.net/geotools.html
*
* This file copyright (c)2005 Paul Dixon (paul@elphin.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@bmcbride
bmcbride / gdal_geotiff_to_mbtiles.txt
Created Dec 15, 2016
GDAL commands to convert GeoTiff image to MBTiles. Requires GDAL 2.1+.
View gdal_geotiff_to_mbtiles.txt
gdal_translate image.tif image.mbtiles -of MBTILES
gdaladdo image.mbtiles 2 4 8
@bmcbride
bmcbride / fulcrum_fetch_shapefile.sh
Created Sep 21, 2016
Bash script for fetching GeoJSON data from Fulcrum and converting to shapefile via ogr2ogr
View fulcrum_fetch_shapefile.sh
#!/bin/bash
curl "https://web.fulcrumapp.com/shares/{token}.geojson" > records.geojson
ogr2ogr -f "ESRI Shapefile" records.shp records.geojson
@bmcbride
bmcbride / thumbnail.sql
Last active Aug 22, 2016
Get a direct link to the thumbnail of the first image in a photo field with Fulcrum data shares. Useful for pulling an image into a CartoDB image header info window.
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
@bmcbride
bmcbride / google-form-to-github-issue.md
Last active Aug 2, 2022
Create a new GitHub Issue from a Google Form submission
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.