Skip to content

Instantly share code, notes, and snippets.

//Initialize the map
var map = L.map('map',{center: [37.18,-121.72], zoom: 12, drawControl: true, minZoom: 10,maxZoom: 18});
//terrain, terrain-lines, toner-lite, toner, watercolor
L.tileLayer(
'https://mts1.google.com/vt/lyrs=m@231165345&hl=en&src=app&x={x}&y={y}&z={z}&apistyle=s.t%3A2%7Cp.s%3A-100%7Cp.v%3Aoff%2Cp.s%3A-100%7Cp.l%3A14%2Cs.t%3A49%7Cp.v%3Asimplified%7Cp.l%3A15%2Cs.t%3A4%7Cp.v%3Aoff%2Cs.t%3A6%7Cp.l%3A-8&style=47,37%7Csmartmaps',
{
subdomains: 'abcd'
}).addTo(map);
import requests
import re
from bs4 import BeautifulSoup
contents = requests.get("http://www.nhl.com/scores/htmlreports/20022003/PL020413.HTM").text
soup = BeautifulSoup(contents)
table = soup.find("pre").text
import requests
import re
from bs4 import BeautifulSoup
contents = requests.get("http://www.nhl.com/scores/htmlreports/20022003/PL020413.HTM").text
def NotEmpty(str):
return not re.match("^\s*$",str)
def SplitOnColumns(unsplit,positions):
@veltman
veltman / gist:8945792
Created February 11, 2014 22:41
Get all PDF links on a page
Array.prototype.slice.call(document.getElementsByTagName("a"), 0 ).filter(function(d){ return d.href.match(/[.]pdf$/i);}).map(function(d){ return d.href.match(/^https?:/i) ? d.href : (window.location.href.match(/\/^/) ? window.location.href+d.href : window.location.href.split("/").slice(0,-1).join("/")+"/"+d.href ); }).join("\n");
@veltman
veltman / gist:8945915
Created February 11, 2014 22:48
Get all PDFs on a page (bookmarklet)
javascript:(function(){ document.getElementsByTagName("body")[0].innerHTML = Array.prototype.slice.call(document.getElementsByTagName("a"), 0 ).filter(function(d){ return d.href.match(/[.]pdf$/i);}).map(function(d){ return d.href.match(/^https?:/i) ? d.href : (window.location.href.match(/\/^/) ? window.location.href+d.href : window.location.href.split("/").slice(0,-1).join("/")+"/"+d.href ); }).join("\n<br/>"); }());
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
font: 14px sans-serif;
}
path {
year,value
1990,88
1991,52
1992,2
1993,16
1994,72
1995,3
1996,29
1997,57
1998,80
@veltman
veltman / gist:9500853
Last active August 29, 2015 13:57
Bad.js for @brittanystoroz, circa 2008
function showTooltip(value) {
tooltip.remove().clear();
//fill info box
tooltip.push(r.text(550,371,value.country+" - "+sports[value.sportId].name).attr({"font-family": "myriad-pro", "font-weight": 700, "font-size": 12, fill: "#222", "text-anchor": "start"}));
tooltip.push(r.text(522,390,value.name).attr({"font-family": "myriad-pro", "font-weight": 700, "font-size": 20, fill: "#222", "text-anchor": "start"}));
tooltip.push(r.text(567,414,"Weight").attr({"font-family": "myriad-pro", "font-size": 14, fill: "#222", "text-anchor": "middle"}));
tooltip.push(r.text(657,414,"Height").attr({"font-family": "myriad-pro", "font-size": 14, fill: "#222", "text-anchor": "middle"}));
tooltip.push(r.text(747,414,"Age").attr({"font-family": "myriad-pro", "font-size": 14, fill: "#222", "text-anchor": "middle"}));
tooltip.push(r.text(567,434,value.weightText).attr({"font-family": "myriad-pro", "font-size": 24, fill: "#444", "text-anchor": "middle"}));
@veltman
veltman / gist:9500952
Last active August 29, 2015 13:57
Bad.js for @brittanystoroz, circa 2008
function sndReq() {
chosen = false;
document.getElementById("choices").style.display = "none";
document.getElementById("words_left").style.display = "none";
document.getElementById("words_middle").style.display = "none";
document.getElementById("words_right").style.display = "none";
document.getElementById("playagain").style.display = "none";
document.getElementById("playagain").innerHTML = '&nbsp;';
@veltman
veltman / gist:9500968
Last active August 29, 2015 13:57
Bad.js for @brittanystoroz, circa 2007
function fixDate(fieldname,datestr) {
//Make lowercase
newdatestr = datestr.toLowerCase();
//trim first
newdatestr = newdatestr.replace(/^\s+|\s+$/g,'');
//If it was just whitespace, don't run the function
if (!newdatestr.length) {
return;
}