Fine-grained control of randomly entering and exiting things in D3.js, for impeccable object constancy. Adapted from an example co-authored with Mike Bostock.
This file contains hidden or 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
| { | |
| "name": "netflix-category-scraper", | |
| "version": "0.0.0", | |
| "description": "Collect all categories from Netflix", | |
| "dependencies": { | |
| "cheerio": "*", | |
| "sqlite3": "*", | |
| "request": "*" | |
| }, | |
| "author": { |
This file contains hidden or 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
| --PART 2 | |
| -- a. | |
| SELECT * FROM tornados | |
| SELECT cartodb_id FROM tornados | |
| -- b. | |
| SELECT * FROM tornados LIMIT 1 | |
| SELECT * FROM tornados LIMIT 1 OFFSET 1 | |
| SELECT * FROM tornados ORDER BY damage DESC LIMIT 10 | |
| -- c. | |
| SELECT * FROM tornados WHERE cartodb_id < 30 |
This file contains hidden or 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
| # SRID is the projection's EPSG code. To find yours, open up the prj file in a text editor and search for that name at http://spatialreference.org/ | |
| # The schema is probably already named `public` and the database name is perhaps your username. | |
| # To list your schemas use `\dn` after running `psql`. | |
| # To get info about your current database connnection use `\conninfo`. | |
| # In SQL, get the database name with `select current_database() ;` | |
| # The -D flag will use the postgres dump format, which will be much faster than single row inserts. if any single row fails, | |
| # which is also good to know — instead of not knowing if you insert row by row | |
| # shp2pgsql -I -D -s <SRID> <PATH/TO/SHAPEFILE> <SCHEMA>.<DBTABLE> | psql -d <DATABASE> |
This file contains hidden or 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
| $ pgsql2shp -f <path to output shapefile> -h <hostname> -u <username> -P <password> databasename "<query>" | |
| $ pgsql2shp -f ca_hex_2000_ided.shp -h localhost -u mike mike "SELECT ca_hex_2000_ided.geom, ca_hex_2000_ided.hex_id FROM ca_hex_2000_ided, bounder WHERE ST_Intersects(ca_hex_2000_ided.geom, bounder.geom) " |
This file contains hidden or 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
| /* | |
| Usage: | |
| When generating a page: | |
| var abTest = new AbTest('your-test-slug'); | |
| if (abTest.variation == 0) | |
| $('#thediv').addClass('red'); | |
| else if (abTest.variation == 1) |
This file contains hidden or 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
| #0cf - Hot blue | |
| #fc0 - Hot orange | |
| #0fc - Hot sea green | |
| #f0c - Hot pink | |
| #f0a - Hot pink two | |
| #01df3a - Hot green | |
| #f3f0df - The Beige | |
| #F76464 - Coral |
The series hover interactivity uses the technique from lgrammel seen here: http://bl.ocks.org/1963983
It isn't necessarily a tooltip, but data is displayed by inverting the x-axis value into a date, and mapping the date to the corresponding data value for the series.
This file contains hidden or 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 requests | |
| import tweepy | |
| import time | |
| import oauth2 | |
| import re | |
| from urllib import quote | |
| # THIS IS WHAT YOU CUSTOMIZE # | |
| # terms | |
| LIST = "members-of-congress" |
This file contains hidden or 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
| /* | |
| Crayola crayon colors | |
| Compiled by @LATdatadesk | |
| Source: http://en.wikipedia.org/wiki/List_of_Crayola_crayon_colors | |
| */ | |
| // Standard colors | |
| @almond: #EFDECD; | |
| @antique_brass: #CD9575; |