Skip to content

Instantly share code, notes, and snippets.

View caged's full-sized avatar
🎸

Justin Palmer caged

🎸
View GitHub Profile
WITH
bad_geometries AS (SELECT
(a.p_geom).path[1] AS path,
(a.p_geom).geom
FROM
(
SELECT
st_dump(shape) AS p_geom
FROM
us_district_court_jurisdictions
@caged
caged / keybase.md
Created January 11, 2019 03:40
keybase.md

Keybase proof

I hereby claim:

  • I am caged on github.
  • I am caged (https://keybase.io/caged) on keybase.
  • I have a public key ASBSVYNed5hAUR9evtZAZiOmAKi0Mg40LlXoSEWlX2e0hAo

To claim this, I am signing this object:

class A extends Component {
handleSomeEvent = (value: string) => {
/* do stuff */
}
render() {
return <B onSubmit={this.handleSomeEvent} />
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@caged
caged / machine-learning-deploy.md
Created June 1, 2017 02:19
Resources for deploying machine learning models to production systems.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test simple</title>
<script type="text/javascript">
'use strict';
var top = 1;
</script>
</head>
ndjson-join 'true' <(cat oregon.json) <(shp2json -n data/shp/arc_reference/ned_1arcsec_g.shp) \
| ndjson-filter -r jsts 'function(d) { var r = new jsts.io.GeoJSONReader(), g1 = r.read(d[0].geometry), g2 = r.read(d[1].geometry); return !g1.intersection(g2).isEmpty() }.call(this, d)' \
| ndjson-map 'd[1]'
#!/usr/bin/env ruby
require 'csv'
coach_years=CSV.read('coaches2.csv')[1..-1]
stints = coach_years.sort_by(&:reverse).each_with_object([]) do |coach_year, coach_stints|
season, coach = coach_year
start_year = season.split('-')[0].to_i
end_year = start_year + 1
@caged
caged / coaches.csv
Last active May 7, 2016 05:11
Using Ruby, sort each coach by consecutive season tenures. Some seasons have two coaches which implies that the coach was fired/removed mid-season. The result should be something like [[name, start_season, end_season], [name, start_season, end_season]] where the order is by ascending start_season.
season coach
1994-95 Bill Blair
1995-96 Bill Blair
1990-91 Bill Musselman
1989-90 Bill Musselman
2006-07 Dwane Casey
2005-06 Dwane Casey
1999-00 Flip Saunders
2014-15 Flip Saunders
2004-05 Flip Saunders
@caged
caged / postgres-ordered-sets.md
Last active April 5, 2016 03:13
Examples of ordered set aggregates in Postgres

Examples of ordered set aggregates in Postgres.

SELECT round(avg(pie)::numeric, 2),
       percentile_cont(array[0.25, 0.5, 0.75, 0.95]) WITHIN GROUP (ORDER BY pie) AS percentiles
FROM player_stats_advanced
WHERE permode = 'pergame';

round | percentiles