Skip to content

Instantly share code, notes, and snippets.

@bmcbride
bmcbride / google-form-to-github-issue.md
Last active April 5, 2024 15:47
Create a new GitHub Issue from a Google Form submission

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.
@bmcbride
bmcbride / thumbnail.sql
Last active August 22, 2016 21:43
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.
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 / fulcrum_fetch_shapefile.sh
Created September 21, 2016 18:09
Bash script for fetching GeoJSON data from Fulcrum and converting to shapefile via ogr2ogr
#!/bin/bash
curl "https://web.fulcrumapp.com/shares/{token}.geojson" > records.geojson
ogr2ogr -f "ESRI Shapefile" records.shp records.geojson
@bmcbride
bmcbride / gdal_geotiff_to_mbtiles.txt
Created December 15, 2016 16:10
GDAL commands to convert GeoTiff image to MBTiles. Requires GDAL 2.1+.
gdal_translate image.tif image.mbtiles -of MBTILES
gdaladdo image.mbtiles 2 4 8
@bmcbride
bmcbride / osgb.js
Created January 18, 2017 16:37
Fulcrum Data Event to convert WGS84 coordinates to Ordnance Survey Great Britain (OSGB) / British National Grid (BNG).
/**
* 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 / apbp_karner_barrens.geojson
Created September 16, 2017 06:22
Albany Pine Bush Preserve - Karner Barrens Trails
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmcbride
bmcbride / Code.gs
Last active November 22, 2022 14:15
Google Apps Script for importing CSV files from Drive into Fulcrum
/**
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 / Code.gs
Created March 28, 2018 17:46
Google Apps Script for exporting CSV files from the Fulcrum Query API to a Drive folder
/**
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 / example-data-event.js
Last active March 12, 2020 11:31
Turf.js v5.1.6
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 / fulcrum-selectize.js
Created July 8, 2021 21:03
Selectize Fulcrum editor visibility & requirement rule select controls
$('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);