This is an attempt at a slightly D3-ish way of drawing a dot density map on a canvas element. In short, each polygon is drawn (invisibly) with a unique color, then random points are thrown at polygon bounding boxes and the pixel color is used for a point-in-polygon test. This example draws one dot for every 2 people in central Boston census blocks, for a total of approximately 132,000 dots.
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
<html> | |
<head> | |
<title>A Leaflet map!</title> | |
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" /> | |
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> | |
<script src="leaflet.heat.js"></script> | |
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<style> | |
#map{ height: 100% } | |
</style> |
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
// Customized styles for select boxes using the Chosen jQuery plugin | |
// forked from Bootstrap-themed version at https://gist.github.com/koenpunt/6424137 | |
// This one uses your variables from bootstrap-sass | |
// by thecristen, at https://gist.github.com/thecristen/e71ed5391fbdc6d63dc3 (no license go nuts) | |
// TODO: This only covers single select | |
select.form-control + .chosen-container.chosen-container-single .chosen-single { | |
@include box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075)); | |
@include transition(border-color ease-in-out .15s, box-shadow ease-in-out .15s); | |
display: block; |
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
#put in lib/tasks/fixtures.rake | |
namespace :db do | |
namespace :fixtures do | |
desc 'Create YAML test fixtures from data in an existing database. | |
Defaults to development database. Set RAILS_ENV to override.' | |
task :dump => :environment do | |
sql = "SELECT * FROM %s" | |
skip_tables = ["schema_migrations"] | |
ActiveRecord::Base.establish_connection(:development) | |
(ActiveRecord::Base.connection.tables - skip_tables).each do |table_name| |
This is forked from bycoffe!!! Please see there for more instruction.
I am going to modify this to show cool (but made up) data.