Skip to content

Instantly share code, notes, and snippets.

javascript:(function(){for(var n=document.getElementsByTagName("p"),e=0;e<n.length;e++){for(var t=n[e].innerHTML.split(" "),g=[],r=0;r<t.length;r++)g.push("<strong>"+t[r].substring(0,3)+"</strong>"+t[r].substring(3));document.getElementsByTagName("p")[e].innerHTML=g.join(" ")}})();
@quandyfactory
quandyfactory / insult.py
Created December 17, 2009 18:12
Generates an Elizabethan insult.
#!/usr/bin/env python
__version__ = '0.2'
__releasedate__ = '2009-12-23'
__author__ = 'Ryan McGreal <ryan@quandyfactory.com>'
__homepage__ = 'http://quandyfactory.com/insult'
__repository__ = 'http://gist.github.com/258915'
__copyright__ = 'Copyright (C) 2009 by Ryan McGreal. Licenced under GPL version 2. http://www.gnu.org/licenses/gpl-2.0.html'
def generate_insult():
@quandyfactory
quandyfactory / get_sobi_data.py
Last active October 23, 2019 15:34
Fetch SoBi Rides Data
#!/usr/bin/env python
# coding: utf-8
"""
This script downloads your Social Bicycles (SoBi) routes data from the SoBi web
API and saves it as a JSON file. It uses HTTP basic authentication with your SoBi
username (your email address) and password.
The function that requests route data executes recursively, incrementing the page
parameter with each subsequent request, until there are no more results.
@quandyfactory
quandyfactory / Blocked By Judi
Last active November 19, 2018 12:07
Twitter accounts that have been #blockedbyjudi
angleonfire63 - https://twitter.com/angleonfire63/status/1062541726232047617
@brookscappadoci - https://twitter.com/brookscappadoci/status/1057443095959216129
@brundle_fly - https://twitter.com/brundle_fly/status/1062750998400303104
@craig_burley - https://twitter.com/craig_burley/status/1062679892003831808
@Crazy4Waldorf - https://twitter.com/Crazy4Waldorf/status/1063074479600009218
@d3talk - https://twitter.com/d3talk/status/1062757700185083904
@dogfacedon - https://twitter.com/dogfacedon/status/1063065543618584576
@donhanzel - https://twitter.com/donhanzel/status/1063069742871859200
@ericgillis - https://twitter.com/ericgillis/status/1063276271872954368
@ian_reynolds - https://twitter.com/ian_reynolds/status/1063058485540196359

Answers to LRT Questions from Twitter

Q: How many trains?

A: I haven't seen definitive fleet numbers but it will be enough vehicles to provide 5-6 minute headways.

Q: Where do you store the extra units Where do you service the units How much will servicing cost?

A: Light Rail Vehicles (LRVs) will be stored and serviced in a maintenance facility build in the vicinity of Longwood Road and Frid Street. The maintenance facility will connect to the main LRT line via a spur line running along Longwood Road to Main Street. Incidentally, this means the LRT construction will include the cost to replace the Hwy 403 overpass on Longwood Road, which is 60 years old and due for replacement.

# -*- coding: utf8 -*-
from HTMLParser import HTMLParser
import os
import requests
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
#!/usr/bin/env python
from xml.dom.minidom import parseString
from xml.dom.minidom import parse
import os
segments = (
# West of Cannon Cycle Track
{
'block': 'Dundurn to Kinnell (West of Cycle Track)',
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.0" creator="ExpertGPS 1.1 - http://www.topografix.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<time>2016-08-03T17:07:58-04:00</time>
<bounds minlat="43.25955166666667" minlon="-79.88774166666667" maxlat="43.26784333333333" maxlon="-79.87228166666667"/>
<trk>
<trkseg>
<trkpt lat="43.260035" lon="-79.87297">
</trkpt>
<trkpt lat="43.25955166666667" lon="-79.87294166666666">
</trkpt>
def get_comments(article_id):
"""Returns the comments for an article"""
# fetch comments from database
query = sql.text("""
select c.comment_id, c.parent_id, c.article_id, c.username,
c.date_posted, c.comment,
sum(v.vote) as comment_score
from comments c
left join comment_votes v
Starting trip ea03f66647c2cba026cf18b123924e1b
Point (43.2533483333, -79.86947) is not inside a segment
Point (43.2534083333, -79.8695166667) is not inside a segment
Point (43.2534466667, -79.8695466667) is not inside a segment
Point (43.253605, -79.8698516667) is not inside a segment
Point (43.2536316667, -79.8700233333) is not inside a segment
Point (43.2537033333, -79.8702633333) is not inside a segment
Point (43.25405, -79.8701383333) is not inside a segment
Point (43.2542383333, -79.8700533333) is not inside a segment
Point (43.25445, -79.86996) is not inside a segment