{{ message }}

Instantly share code, notes, and snippets.

😃

# Jonathan Thornton jonblatho

😃
Last active Mar 30, 2021
Calculates the population of ZIP Code Tabulation Areas (ZCTAs) which intersect with Howell County, MO
View zcta-block.py
 import shapefile from shapely.geometry import shape def __shapely_polygon__(s): return shape(s.shape.__geo_interface__) # Read Missouri census block shapefile block_file = shapefile.Reader("block/tabblock2010_29_pophu.shp") # Obtained from https://www.census.gov/geographies/mapping-files/2010/geo/tiger-data.html # Read ZIP code tabulation area shapefile
Created Feb 18, 2020
View circle_overlap_area.py
 # Calculates the overlap area between two circles of radii r1 and r2 with # center points d apart. def circle_overlap_area(r1, r2, d): try: # Expression from http://mathworld.wolfram.com/Circle-CircleIntersection.html return r2**2 * acos((d**2+r2**2-r1**2)/(2*d*r2))+r1**2*acos((d**2-r2**2+r1**2)/(2*d*r1)) - 1/2*sqrt((-d+r2+r1)*(d+r2-r1)*(d-r2+r1)*(d+r2+r1)) except: # A few possible cases if there's a math domain error... if r1 == r2 and d == 0: # Identical circle radii and center points
Last active Jun 24, 2019
View UIStackView+attachToScrollView.swift
 extension UIStackView { /** Fills the given scroll view with this stack view. This method automatically creates and activates constraints and adds the stack view to the scroll view. - parameter scrollView: The scroll view into which this stack view should be inserted. */ internal func attachToScrollView(_ scrollView: UIScrollView) { // Add this stack view to the given UIScrollView scrollView.addSubview(self)
Created Jun 28, 2018 — forked from jjacobson93/minimal-swift.Dockerfile
View minimal-swift.Dockerfile
 FROM swift:4 WORKDIR /build COPY Sources ./Sources COPY Package.swift . RUN swift package resolve RUN swift build COPY pkg-swift-deps.sh /usr/bin/pkg-swift-deps
Last active Feb 17, 2021
Some Swift code to determine whether a point is inside a polygon.
View PointInPolygon.swift
 /// Contains the coordinates of a point in a 2D Cartesian coordinate system. public struct Point: Hashable { /// The x-coordinate of the point. public var x: Double /// The y-coordinate of the point. public var y: Double } extension Array where Element == Point { /// Returns only the unique points in the array.
Last active Jan 5, 2018
View asos-filter.py
 import sys import re import fileinput # This script takes a list of air temperatures extracted from historical METARs # obtained from https://mesonet.agron.iastate.edu/request/download.phtml. # # Use it in the command line with something along the lines of # \$ python2.7 asos-filter.py asos-1997.csv # where the parameter is the text file you want to filter through. It only
Last active Dec 22, 2017
View HomeTableViewController.swift
Last active Jun 10, 2019
An easy way to get a pretty name for an iOS device model.
View ModelName.swift
 import UIKit extension UIDevice { /// A "pretty" device name for the machine identifier. /// /// Current for devices supporting iOS 9 and later and tvOS 9 and later, as of WWDC 2019. var modelName: String { var machineString = String() var systemInfo = utsname()
Created Jul 28, 2016
View keybase.md

### Keybase proof

I hereby claim:

• I am jonblatho on github.
• I am jonblatho (https://keybase.io/jonblatho) on keybase.
• I have a public key whose fingerprint is 6917 A05E 6986 965B C18B E13E 027C D5CD BAFF 8E89

To claim this, I am signing this object: