This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" parses a JSON document on stdin, and prints to stdout the portion of the document | |
referenced by the Python getter substring given as the first argument. | |
This implementation uses eval(), so use with care! No warranty implied. | |
For example | |
$ curl 'http://api.duckduckgo.com/?q=ramen&format=json' 2> /dev/null | ~/bin/extract_data.py '["RelatedTopics"][0]["Text"]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" provides latest_uw_data(), a generator which yields dictionary records of current | |
weather obs from UW ATG """ | |
from datetime import datetime,timedelta | |
from urllib import request | |
def latest_uw_data(): | |
url = "http://www.atmos.washington.edu/cgi-bin/latest_uw.cgi?data" | |
with request.urlopen(url) as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class Foo(): | |
data = (random.randint(0, 1000) for x in range(10)) | |
last = None | |
def __iter__(self): | |
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
GOAT = 0 | |
CAR = 1 | |
TRIALS = 10**4 | |
def run_trial(switch=False): | |
choice = random.randint(0,2) | |
doors = [GOAT, GOAT, CAR] | |
random.shuffle(doors) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link href='https://fonts.googleapis.com/css?family=Press+Start+2P' rel='stylesheet' type='text/css'> | |
<title>brown</title> | |
<style type="text/css"> | |
html, body { | |
height: 100%; | |
background-color: brown; | |
margin: 0px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
d3.geo.project = function(object, projection) { | |
var stream = projection.stream; | |
if (!stream) throw new Error("not yet supported"); | |
return (object && d3_geo_projectObjectType.hasOwnProperty(object.type) ? d3_geo_projectObjectType[object.type] : d3_geo_projectGeometry)(object, stream); | |
}; | |
function d3_geo_projectFeature(object, stream) { | |
return { | |
type: "Feature", | |
id: object.id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../chart-js/chart-js.html"> | |
<link rel="import" href="../cool-clock/cool-clock.html"> | |
<link rel="import" href="../core-input/core-input.html"> | |
<link rel="import" href="../paper-radio-button/paper-radio-button.html"> | |
<link rel="import" href="../paper-radio-group/paper-radio-group.html"> | |
<link rel="import" href="../google-map/google-map.html"> | |
<polymer-element name="my-element"> | |
<template> |
NewerOlder