Skip to content

Instantly share code, notes, and snippets.

@thomasgwatson
thomasgwatson / index.html
Last active December 27, 2015 10:09 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
def find_deviation(v, d)
max_dev = 0
iterations = v.length - d + 1
index = 0
iterations.times do
sub = v[index...index+d]
sub_max_dev = sub.max - sub.min
max_dev = sub_max_dev if sub_max_dev > max_dev
index +=1
end
@thomasgwatson
thomasgwatson / README.md
Last active September 9, 2015 02:28
Sha-banga-bang

hello markdown

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasgwatson
thomasgwatson / CA_zip_topo_1e5.json
Last active November 13, 2015 20:50
Raster & Vector II + topo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasgwatson
thomasgwatson / README.md
Created January 29, 2016 05:22
Driver License Suspensions II

Driver License Suspensions II

The visualization shows driver license suspensions in California per zip code due to "failure to pay" or "failure to appear". The viz is using the Mapbox GL API, which provides high performance rendering of complex geo features (which in this case includes over 1600 high resolution zip code boundaries).

The viz is based on the Mapbox GL API and examples by Anand Thakker here, and here, and Bobby Sudekum here.

The viz is also using the D3 and Topojson libraries.

Four data files are used by the script: a) driver license suspension data (CSV), b) zip code meta data (CSV), c) California county boundaries (Topojson) and d) Zip code boundaries (Topojson).

See the viz in action here, and [f

@thomasgwatson
thomasgwatson / README.md
Created February 1, 2016 23:25
Mapbox GL Synced Dual Maps

Mapbox GL Synced Dual Maps

The visualization demonstrates how to syncronize the state of two side-by-side Mapbox GL based maps. As the user interacts with one of the two maps, the state of the map (center position, zoom level, pitch and bearing) is dynamically copied to the second map (and vice versa). The code also demonstrates how to prevent call stack overflow due to recursive event handler triggering when the map state is updated.

The dataset is based on driver license suspensions from California DMV and East Bay Community Law Center. See prior visualization here

forked from boeric's block: Mapbox GL Synced Dual Maps

@thomasgwatson
thomasgwatson / README.md
Created February 4, 2016 02:55
Mapbox GL Synced Dual Maps

Mapbox GL Synced Dual Maps

The visualization demonstrates how to syncronize the state of two side-by-side Mapbox GL based maps. As the user interacts with one of the two maps, the state of the map (center position, zoom level, pitch and bearing) is dynamically copied to the second map (and vice versa). The code also demonstrates how to prevent call stack overflow due to recursive event handler triggering when the map state is updated.

The dataset is based on driver license suspensions from California DMV and East Bay Community Law Center. See prior visualization here

See the script in action at bl.ocks.org/boeric here, and fullscreen here

forked from boeric's block: Mapbox GL Synced Dual Maps