Skip to content

Instantly share code, notes, and snippets.

@veltman
veltman / gist:4519251
Last active Dec 11, 2015
Individual events
View gist:4519251
[
{
"beat": "local",
"event": "weather",
"description": "Boston's current temperature of 51° F is higher than this day's previous record of 49° F set on January 12, 1970.",
"url": "http:\/\/www.wunderground.com\/weather-forecast\/US\/MA\/Boston.html",
"importance": 1,
"timestamp": "2013-01-12T18:37:06-05:00"
},
{
View gist:4519311
{
"local": {
"beat": "local",
"name": "Local",
"description": "Local news for Boston.",
"icon": "local.png",
"triggers": [
{
"name": "hotspot",
"description": "Local restaurants and shops receiving a sudden increase of attention.",
@veltman
veltman / Printable Markdown
Last active Aug 24, 2020
Bookmarklet to create a printable version of a Markdown file on GitHub. Create a bookmark in your toolbar with this code as the URL, then click the bookmark while viewing a Markdown document (like a README) on GitHub to strip away the rest of the page for a clean, printable version. Or, if what I just said sounded scary, visit this page: http://…
View Printable Markdown
javascript:(function(){ document.body.innerHTML = document.getElementById("readme").getElementsByTagName("article")[0].outerHTML; })();
@veltman
veltman / gist:5952642
Created Jul 8, 2013
Changing the stroke-linecap of a polyline in leaflet
View gist:5952642
testPolyline = new L.Polyline(
[[34.03900467904445,-118.55810165405272],
[34.13766755862196,-118.50643157958984],
[34.15187463170986,-118.36292266845702],
[34.168635904722734,-118.3292770385742],
[34.16196020316907,-118.25923919677734]]);
testPolyline.addTo(map);
//Left-click makes it flat
@veltman
veltman / gist:6186441
Last active Dec 20, 2015
Bookmarklet, when executed on a google search results page it will cycle through everything in search_terms[] and record the suggestions to a big JSON object. After it cycles through all the terms, it will replace the document HTML with the stringified JSON. Minify it before using it.
View gist:6186441
(function(){
//get jQuery
if (window.jQuery === undefined) {
var done = false;
var script = document.createElement("script");
script.src = "http:////ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js";
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
done = true;
View gist:6369472
-Step 1: basic HTML skeleton for a full-screen map
-Step 2: initialize a map
-Step 3: add a tile layer
-Step 4: Add a marker
-Step 5: Add a line
-Step 6: Add a polygon
-Step 7: Styling: add a polygon with different styling
-Step 8: Click/hover
-On click, re-center map
-On hover, change styling of polygon
@veltman
veltman / gist:6475297
Created Sep 7, 2013
JavaScript function for stitching two arrays with overlapping ends into a single array (e.g. [1,2,3] and [3,4,5] into [1,2,3,4,5]).
View gist:6475297
function stitch(s1,s2) {
var l1 = s1.length;
var l2 = s2.length;
if (!l1) return s2;
if (!l2) return s1;
if (s2[0] == s1[l1-1]) return s1.concat(s2.slice(1));
if (s1[0] == s2[l2-1]) return s2.concat(s1.slice(1));
View gist:6681784
repeat
tell application "System Events" to start current screen saver
delay 60
tell application "System Events" to key code 59
delay 1
end repeat
View gist:7029964
from bs4 import BeautifulSoup
import requests
url = "http://www.google.com/"
text = requests.get(url).text
page = BeautifulSoup(text)
for link in page.find_all("a"):
@veltman
veltman / index.html
Last active Jan 1, 2018
For creating an approval matrix/magic quadrant viz in d3.
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.grid {
stroke-width: 0.5px;
stroke: steelblue;
fill: none;
opacity: 0.5;
}