Skip to content

Instantly share code, notes, and snippets.

View gist:8721937
<!DOCTYPE html>
<html lang="en">
<head>
<title>Face forward</title>
<style type="text/css">
body {
margin-top: 20px;
margin-left: 0px;
margin-right: 0px;
padding: 0px;
View gist:8746057
//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);
View gist:8921366
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
View gist:8921688
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 Feb 11, 2014
Get all PDF links on a page
View gist:8945792
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 Feb 11, 2014
Get all PDFs on a page (bookmarklet)
View gist:8945915
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/>"); }());
View gist:9382852
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
font: 14px sans-serif;
}
path {
View gist:9382861
year,value
1990,88
1991,52
1992,2
1993,16
1994,72
1995,3
1996,29
1997,57
1998,80
@veltman
veltman / gist:9500952
Last active Aug 29, 2015
Bad.js for @brittanystoroz, circa 2008
View gist:9500952
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 Aug 29, 2015
Bad.js for @brittanystoroz, circa 2007
View gist:9500968
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;
}