Skip to content

Instantly share code, notes, and snippets.

function add(a, b) {
console.log(a + b);
}
function diff(a, b) {
console.log(a - b);
}
function l(x, y) {
x();
y();
<!-- https://rawgit.com/luqmaan/8e74871571ea56c6dfb7/raw/a1c23d40fcbed88cd095c7fba61177c989c5d00f/reddit_down.html -->
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<head>
<title>reddit is down</title>
<style>
@font-face {
font-family: 'SilkscreenNormal';
src: url('http://www.reddit.com/static/down/slkscr-webfont.eot');
@luqmaan
luqmaan / active_trips_for_route.csv
Last active August 29, 2015 14:02
Find the active trips for a route using CapMetro's Austin GTFS data. Unfortunately the GTFS doesn't seem to have hour precision, so many shapes are returned for a route that changes shapes throughout the day, e.g. the MetroRail.
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 31 columns, instead of 21 in line 4.
shape_id,shapes_count,trip_id,route_id,trip_headsign,shape_id,shape_pt_lat,shape_pt_lon,shape_pt_sequence,shape_dist_traveled,route_id,service_id,trip_id,trip_headsign,trip_short_name,direction_id,block_id,shape_id,trip_type,bikes_allowed,wheelchair_accessible,service_id:1,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
31794,1223,1303263,550,SOUTHBOUND,31794,30.264702,-97.737972,1223,<null>,550,1133,1303263,SOUTHBOUND,<null>,0,550-30,31794,<null>,0,1,1133,1,1,1,1,0,0,0,2014-01-26,2014-06-07
31795,1223,1303278,550,SOUTHBOUND,31795,30.264702,-97.737972,1223,<null>,550,1133,1303278,SOUTHBOUND,<null>,0,550-03,31795,<null>,0,1,1133,1,1,1,1,0,0,0,2014-01-26,2014-06-07
31807,1223,1303388,550,NORTHBOUND,31807,30.586524,-97.85580299999999,1223,<null>,550,1133,1303388,NORTHBOUND,<null>,1,550-03,31807,<null>,0,1,1133,1,1,1,1,0,0,0,2014-01-26,2014-06-07
31808,1223,1303389,550,NORTHBOUND,31808,30.586524,-97.85580299999999,1223,<null>,550,1133,1303389,NORTHBOUND,<null>,1,550-70,31808,<null>,0,
@luqmaan
luqmaan / shitty_nearby_routes.sql
Created June 23, 2014 20:51
Get the routes nearby whole foods, note the location comparison part is total garbage
SELECT * FROM trips,
(
SELECT * FROM stop_times,
(
SELECT * FROM stops
WHERE stop_lat > 30.260650 AND stop_lat < 30.280650
AND stop_lon < -97.743562 AND stop_lon > -97.763562
) as nearby_stops
WHERE stop_times.stop_id = nearby_stops.stop_id
GROUP BY trip_id
@luqmaan
luqmaan / CapMetro_API_Wishlist.md
Last active February 13, 2018 04:22
CapMetro API Wishlist

Support CORS. Allow the API to be accessed through webapps without having to setup a proxy server in between.

Add documentation! Sneaking around the API and looking at the the trip planner code is not optimal.

Build an API the right way. Provide API keys so you can throttle requests and make sure things aren't getting slow.

More frequent polling of the bus locations. Right now it takes 30-90 seconds for bus locations to update. This sucks for users.

When will the 803 info be added to the GTFS database?

var nextInterval = 5000;
setInterval(function() {
var _ = '=',
s = '~',
_i = Math.random() * 30 + 10,
_s = Math.random() * 30;
while (_.length < _i) _ += _;
while (s.length < _s) s += s;
@luqmaan
luqmaan / capmetro-alert.md
Last active August 29, 2015 14:08
CapMetro Alert feed and Trimet Alert feed

CapMetro Alert

cat capmetro-alert.pb | protoc --decode=transit_realtime.Alert gtfs-realtime.proto
active_period {
  1: "1.0"
@luqmaan
luqmaan / capmetro-vehicleposition.md
Last active August 29, 2015 14:08
CapMetro vehicle position and Trimet vehicle position

CapMetro Vehicle Position

cat capmetro-VehLoc.pb | protoc --decode=transit_realtime.VehiclePosition gtfs-realtime.proto | pbcopy
warning:  Input message is missing required fields:  position.latitude, position.longitude
trip {
  trip_id: "1.0"
@luqmaan
luqmaan / all.md
Last active August 29, 2015 14:10
busta names
  1. Busta rides
  2. Busty
  3. Busty bottoms
  4. Bustulent
  5. Busted
  6. OneBustAway
  7. DowntownOrBust
  8. Bust line
  9. LocoPresto
  10. Wef
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.