This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "digest" | |
require "rack" | |
# This class encapsulates a unit of work done for a particular tenant, connected to that tenant's database. | |
# ActiveRecord makes it _very_ hard to do in a simple manner and clever stuff is required, but it is knowable. | |
# | |
# What this class provides is a "misuse" of the database "roles" of ActiveRecord to have a role per tenant. | |
# If all the tenants are predefined, it can be done roughly so: | |
# | |
# ActiveRecord::Base.legacy_connection_handling = false if ActiveRecord::Base.respond_to?(:legacy_connection_handling) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reads EPSG:2393 (KKJ / Finland Uniform Coordinate System) coordinates with optional color and draws them as dots on a SVG map. | |
# Depends on: | |
# GeoJSON data from https://gist.github.com/mikkohei13/0acf09633a1635b5363d47c5603fd789 | |
# Sample data from https://gist.github.com/mikkohei13/d03316b75393a1718be5232986e0e2eb | |
import re | |
import json | |
def extract_polygons_from_geojson(file_path): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
class FirebasePush | |
PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz' | |
def initialize | |
@prev_ts = 0 | |
@rand_chars = Array.new(12) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
import urllib2 | |
try: | |
# Base url for the TNRS match_names API | |
url = 'http://api.opentreeoflife.org/v2/tnrs/match_names' | |
# Encode data value to be looked up as an array of names: | |
data = '{"names": ["'+value+'"]}' | |
print "Looking up: " + data | |
# Set HTTP headers: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>Edit point location (with georeferencing)</title> | |
<style type="text/css"> | |
body { | |
margin: 0; | |
padding: 40px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (c) 2012 Heath Anderson | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE O |