Skip to content

Instantly share code, notes, and snippets.

Ryan Clark rclark

  • Mapbox
  • Tucson, AZ
Block or report user

Report or block rclark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

You're going to start up a Linux EC2, set up its firewall rules, and connect to it.

  • If you're not doing production work always try and use the sandbox account, so log into sandbox account.

  • The first thing you need is an AMI, which is like a snapshot that is the starting point for your machine. Go to to find ubuntu AMIs. These are like from-scratch instances that are kept up-to-date with security patches. If you search for 14.04 that'll be the latest stable ubuntu release, then you're looking for one that's in the right region (generally that's us-east-1), the right architecture (usually amd64) and the right instance type (usually that's instance-store). Copy the

  • Clicking on one of the ami-12345 links will pop you over to the AWS EC2 console and start you down the road of creating the instance.

  • First you'll have to choose an instance type. You'll want the smallest (i.e. cheapest) one th

rclark / TileLayer.Bing.js
Created Mar 11, 2012 — forked from pagameba/TileLayer.Bing.js
Leaflet Bing layer
View TileLayer.Bing.js
L.TileLayer.Bing = L.TileLayer.extend({
supportedTypes: ['Road', 'Aerial', 'AerialWithLabels'],
attributionTemplate: '<span style="display:inline-block">' +
'<a target="_blank" href="">' +
'<img src="{logo}" /></a><br><span>{copyrights}' +
'<a style="white-space: nowrap" target="_blank" '+
'href="">' +
'Terms of Use</a></span></span>',
rclark /
Created Dec 14, 2012
Convert Jade files to JavaScript functions
fs = require 'fs'
pathutil = require 'path'
jade = require 'jade'
parseFiles = (dirname) ->
filenames = fs.readdirSync dirname
for file in filenames
continue if file.slice(0,1) is '.'
path = pathutil.join dirname, file
stats = fs.statSync pathutil.join dirname, path
rclark /
Created Dec 21, 2012
Watch a directory of Jade files and write them out to JavaScript functions.
watch = require 'watch'
fs = require 'fs'
pathutil = require 'path'
jade = require 'jade'
watchDir = process.argv[2] || '.'
outFile = process.argv[3] || './templates.js'
namespace = process.argv[4] || 'Templates'
isJadeFile = (fileOrDir) ->
root = @
L.GeoJSON.d3 = L.GeoJSON.extend
initialize: (geojson, options) ->
@geojson = geojson # This needs to be a FeatureCollection
# unlike L.GeoJSON layer, this won't work unless GeoJSON is passed up-front
# Make sure there's an options object
options = options or {}
rclark / index.html
Last active Dec 18, 2015
TopoJSON was made for geologic maps.
View index.html
<!DOCTYPE html>
<html lang="en" style="height:100%; width:100%; padding:0; margin:0;">
<link rel="stylesheet" href="">
<body style="height:100%; width:100%; padding:0; margin:0;">
<div id="map" style="height:100%; width:100%; padding:0; margin:0;"></div>
<script src=""></script>
<script src=""></script>
<script src="style.js"></script>
rclark / L.TileLayer.GeoJSON.js
Last active Dec 18, 2015
Leaflet + Github-hosted vector-tiles
View L.TileLayer.GeoJSON.js
/* If you haven't included JSTS, it'll still work, but won't try and merge features
* across tile boundaries. You DO have to include:
* jQuery
var jsts = jsts || null;
L.Cache = L.GeoJSON.extend({
mergeData: function mergeData(geojson) {
rclark /
Last active Dec 19, 2015
CKAN + CSW code
from sqlalchemy import Column, Table, String, Text, Integer, types, ForeignKey
from sqlalchemy.orm import relationship
from ckan import model
from ckan.model import meta, Package
from shapely.geometry import asShape
import json
import logging
rclark /
Created Jul 16, 2013
Layer generation action
def publish(context, data_dict):
# Gather inputs
resource_id = data_dict.get("resource_id", None)
layer_name = data_dict.get("layer_name", resource_id)
username = context.get("user", None)
package_id = data_dict.get("package_id", None)
lat_field = data_dict.get("col_latitude", None)
lng_field = data_dict.get("col_longitude", None)
# Check that you have everything you need
rclark /
Created Jul 17, 2013
Little action testing example
from ckanext.ngds.tests.ngds_test_case import NgdsTestCase
class MyActionTestCase(NgdsTestCase):
def test_gobbledee_action(self):
# Generate your POST body
post_body = {
"turkeys": 12,
"gobbles": ["gobble", "gobble"]
You can’t perform that action at this time.