Skip to content

Instantly share code, notes, and snippets.

@bdon
bdon / gitaliases
Created April 5, 2012 05:12
Git aliases I use often
[alias]
st = status
co = checkout
lg = log --graph --oneline --all --decorate
gap = add --patch --interactive
@bdon
bdon / gist:2886527
Created June 7, 2012 04:21
simple fulltext search with postgres + sequel
if params[:query].present?
# not doing :* prefix matching right now.
# Preprocess the string into what TSvector wants. spaces -> ?
# Then only letters, numbers, underscores and qmarks are left.
query = params[:query].gsub(/\s+/, '?').gsub(/[^\w\?]/, '')
@results = @results.select { [ts_headline('english', :text, to_tsquery('english', query), 'MaxFragments=2').as(headline), id, title, happened_at]}
@results = @results.filter("ts_text @@ to_tsquery('english', ?::text)", query)
end
@bdon
bdon / index.html
Created October 13, 2012 01:55
lombard
<!doctype html>
<html>
<head>
<script src="http://bdon.org/js/d3.v2.js"></script>
<script src="http://bdon.org/js/Three.js"></script>
</head>
<body>
<section>
<div id="chart">
</div>
@bdon
bdon / index.html
Last active December 11, 2015 14:58
<!DOCTYPE html>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<style type="text/css">
body {
font-family: "Helvetica";
font-size: 10px;
}
.brush .extent {
select * from editors order by count desc limit 10;
editor | count
------------------------+---------
Potlatch 2 | 2683251
Potlatch 1.4 (save en) | 284440
Potlatch 1.4 (save de) | 217631
FindvejBot 0.1 | 184708
Potlatch 1.0 | 178596
Redaction bot | 141704
Potlatch 1.2 | 125114
===================== FAILURES =====================
_____________________ test_web _____________________
def test_web():
resp = c.get('/')
> assert resp.status == '404'
E assert '200 OK' == '404'
E - 200 OK
E + 404
@bdon
bdon / flights.json
Last active December 19, 2015 11:29
Boeing 777 Descent Profiles, SFO
[{"points":[{"timestamp":"1372528063","latitude":"37.4892997742","longitude":"-122.088996887","groundspeed":"251","altitude":5900,"altitude_status":"-","update_type":"A","altitude_change":"D","until":-299,"accel":-20.0},{"timestamp":"1372528066","latitude":"37.4930992126","longitude":"-122.089996338","groundspeed":"250","altitude":5800,"altitude_status":"-","update_type":"A","altitude_change":"D","until":-296,"accel":-33.333333333333336},{"timestamp":"1372528072","latitude":"37.4996986389","longitude":"-122.093002319","groundspeed":"248","altitude":5600,"altitude_status":"-","update_type":"A","altitude_change":"D","until":-290,"accel":-33.333333333333336},{"timestamp":"1372528076","latitude":"37.5036010742","longitude":"-122.096000671","groundspeed":"247","altitude":5500,"altitude_status":"-","update_type":"A","altitude_change":"D","until":-286,"accel":-25.0},{"timestamp":"1372528083","latitude":"37.5093002319","longitude":"-122.102996826","groundspeed":"243","altitude":5300,"altitude_status":"-","update_type
@bdon
bdon / index.html
Last active December 22, 2015 18:29
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<style>
.guide {
stroke: black;
stroke-dasharray: 2, 2;
}
</style>
<div id="chart">

Keybase proof

I hereby claim:

  • I am bdon on github.
  • I am bdon (https://keybase.io/bdon) on keybase.
  • I have a public key whose fingerprint is D140 7385 A561 4467 5F8B 2FAC 5FD3 F7D8 BF67 2414

To claim this, I am signing this object:

@bdon
bdon / data.json
Last active October 23, 2019 22:41
[{"players":[["Durant","Kevin"],["Ibaka","Serge"],["Perkins","Kendrick"],["Sefolosha","Thabo"],["Westbrook","Russell"]],"stats":{"gp":76,"min":1307,"w":56,"l":20,"win_pct":0.737,"off_rating":109.3,"def_rating":97.0,"net_rating":12.3,"ast_pct":57.4,"ast_to":1.5,"ast_per_100":17.5,"off_reb_pct":26.9,"def_reb_pct":74.1,"reb_pct":52.5,"to_per_100":15.7,"efg_pct":52.7,"ts_pct":57.2,"pace":95.45,"pie":58.2},"team":"OKC"},{"players":[["George","Paul"],["Hibbert","Roy"],["Hill","George"],["Stephenson","Lance"],["West","David"]],"stats":{"gp":64,"min":1218,"w":37,"l":27,"win_pct":0.578,"off_rating":108.6,"def_rating":96.5,"net_rating":12.1,"ast_pct":60.1,"ast_to":1.81,"ast_per_100":18.5,"off_reb_pct":28.7,"def_reb_pct":76.0,"reb_pct":53.1,"to_per_100":14.1,"efg_pct":51.8,"ts_pct":55.1,"pace":91.94,"pie":57.9},"team":"IND"},{"players":[["Aldridge","LaMarcus"],["Batum","Nicolas"],["Hickson","J.J."],["Lillard","Damian"],["Matthews","Wesley"]],"stats":{"gp":57,"min":1078,"w":26,"l":31,"win_pct":0.456,"off_rating":103.8,"d