This example shows how to use the d3.hexbin plugin for hexagonal binning on a map with the d3.geo.albersUsa
projection. Approximately 3,000 locations of Walmart stores are shown. These are binned into hexagons, and the hexagon area encodes the number of stores that fall into each bin. Color encodes the median age of Walmart stores in that area, with the oldest stores in black and the youngest stores in blue. Inspired by earlier work by Zachary Forest Johnson.
export PGPORT ?= 4488 | |
PG_PATH ?= $(shell if test -d /usr/lib/postgresql/9.1; then echo /usr/lib/postgresql/9.1; else echo /usr/lib/postgresql/8.4; fi) | |
PG_DIR = ${PWD}/instance/var | |
PG_DATA = ${PG_DIR}/data | |
PG_RUN = ${PG_DIR}/run | |
PG_LOG = ${PG_DIR}/log | |
PG_SOCKET = ${PG_RUN}/.s.PGSQL.${PGPORT} | |
PGPARAMS = -D ${PG_DATA} -o "-F -c unix_socket_directory=${PG_RUN} -c custom_variable_classes='busy' -c busy.active_user=0" -l ${PG_LOG}/pg.log | |
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts, | |
that detects and handles AJAXed content. | |
Usage example: | |
waitForKeyElements ( | |
"div.comments" | |
, commentCallbackFunction | |
); |
# Copyright (C) 2013 Wesley Baugh | |
"""Tools for text classification. | |
Extracted from the [infer](https://github.com/bwbaugh/infer) library. | |
""" | |
from __future__ import division | |
import math | |
from collections import defaultdict, namedtuple, Counter | |
from fractions import Fraction |
#first attempt at implementing horizon plots in ggplot2 | |
#pleased with result but code sloppy and inflexible | |
#as always very open to improvements and forks | |
require(ggplot2) | |
require(reshape2) | |
require(quantmod) | |
require(PerformanceAnalytics) | |
require(xtsExtra) |
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.