Skip to content

Instantly share code, notes, and snippets.

Avatar
🎸

Justin Palmer caged

🎸
View GitHub Profile
View fix-jurisdictions.sql
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
View 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:

View flow-no.js
class A extends Component {
handleSomeEvent = (value: string) => {
/* do stuff */
}
render() {
return <B onSubmit={this.handleSomeEvent} />
}
}
View places.topo.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test simple</title>
<script type="text/javascript">
'use strict';
var top = 1;
</script>
</head>
View feature-intersection.sh
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]'
View coaches.rb
#!/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
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.
View coaches.csv
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 Apr 5, 2016
Examples of ordered set aggregates in Postgres
View postgres-ordered-sets.md

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