Skip to content

Instantly share code, notes, and snippets.

View colemanm's full-sized avatar

Coleman McCormick colemanm

View GitHub Profile
@daviddarnes
daviddarnes / gulpfile.js
Last active June 10, 2023 01:17
Import your Ghost posts into a Jekyll project using Gulp
const File = require('vinyl');
const gulp = require("gulp");
const Handlebars = require('handlebars');
const streamArray = require('stream-array');
const ghostContentAPI = require("@tryghost/content-api");
const api = new ghostContentAPI({
url: 'https://demo.ghost.io',
key: '22444f78447824223cefc48062',
version: "v4"
const fs = require('fs');
const d3 = require('d3-dsv');
const path = require('path');
const yaml = require('js-yaml');
const toMarkdown = require('to-markdown');
d3.csvParse(
fs.readFileSync('./goodreads_library_export.csv', 'utf8')
).filter(row => {
return row['Exclusive Shelf'] !== 'to-read';
@sskylar
sskylar / tags.html
Last active January 26, 2021 13:40
Sort Jekyll tags by popularity (number of posts)
<ul>
{% capture tags %}
{% for tag in site.tags %}
<li data-sort="{{ site.posts.size | minus: tag[1].size | prepend: '0000' | slice: -4, 4 }}">
<a href="/{{ site.tag_page_dir }}/{{ tag[0] | slugify: 'pretty' }}">{{ tag[0] }} <span>{{ tag[1].size }}</span></a>
</li>
{% endfor %}
{% endcapture %}
{{ tags | split:'</li>' | sort | join:'</li>' }}
</ul>
@jsanz
jsanz / README.md
Last active May 17, 2018 13:53
Geocode with Mapzen search and Google Spreadsheets

How to set up a quick geocoding system on google spreadsheets.

  1. Create a new spreadsheet
  2. Open the Scripts editor and paste the script attached
  3. Use on your spreadsheet this new formula
=searchMapzen(place_cell,mapzen_api_key)

@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.
@chbrown
chbrown / _upgrade-pg9.4-to-pg9.5.md
Last active October 7, 2021 13:57
Upgrade PostgreSQL 9.4 to 9.5 on Mac OS X with Homebrew

First, check your current config (example output in homebrew.mxcl.postgresql.plist.xml lower down in this gist):

cat ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Most importantly, note the -D /usr/local/var/postgres argument.

Second, shut down your current PostgreSQL.

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
@bmcbride
bmcbride / README.md
Last active August 29, 2015 14:04
Post-processing scripts for generating OpenTrails compliant Trailheads CSV & GeoJOSN files from the Fulcrum OpenTrails Trailhead App- http://fulcrumapp.com/apps/opentrails-trailheads

Data exported out of the Fulcrum OpenTrails Trailhead App requires some post processing in order to generate the proper files, per the OpenTrails trailheads.geojson specification. Simply export as Shapefile and execute the following GDAL/OGR commands:

ogr2ogr -f "SQLite" opentrails-trailheads.sqlite -nln "trailheads" -a_srs "EPSG:4326" opentrails_trailheads.shp
ogr2ogr -update -f "SQLite" opentrails-trailheads.sqlite -nln "osm_tags" opentrails_trailheads_osm_tags.dbf
@bmcbride
bmcbride / datashare-proxy.php
Last active March 15, 2018 16:24
A simple proxy script for filtering out data fields and masking the URL of Fulcrum data shares. Specify ?format=csv to return CSV instead of default GeoJSON.
<?php
# Fields to be removed (optional)
$remove = ['fulcrum_id','created_by','updated_by','assigned_to'];
# Fulcrum data share ID
$shareID = 'your-share-id';
# Format- 'geojson' or 'csv'
if (isset($_GET['format'])) {
$format = $_GET['format'];
} else {
$format = 'geojson';
@bmcbride
bmcbride / fulcrum-photo-viewer.php
Last active August 29, 2015 14:01
A simple script for viewing a contact page of photos, based on a column of comma delimited photo ID's as fetched from Fulcrum. Simply prepend 'http://someurl.com/fulcrum-photo-viewer.php?photos=' to your list of photo ID's.
<?php
$fulcrum_api_key = 'your-fulcrum-api-key-goes-here';
if (!isset($_GET['photos']) && !isset($_GET['photo'])){
print 'photo or photos parameter required!';
}
if (isset($_GET['photos'])) {
$photos = explode(',', $_GET['photos']);
@bmcbride
bmcbride / geojson-length.py
Created March 31, 2014 20:41
Calculate the length of a GeoJSON linestring using the Python GDAL/OGR API
from osgeo import ogr
from osgeo import osr
source = osr.SpatialReference()
source.ImportFromEPSG(4326)
target = osr.SpatialReference()
target.ImportFromEPSG(3857)
transform = osr.CoordinateTransformation(source, target)