Skip to content

Instantly share code, notes, and snippets.

@tsl3su
tsl3su / index.html
Last active August 29, 2015 14:04
World Choropleth
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg {
background-color: rgb(15, 15, 15);
}
.graticule {
fill: none;
stroke: #777;
stroke-opacity: .5;
@s2t2
s2t2 / text_reader.rb
Created April 12, 2015 03:46
reads text from a public github repository
require 'github_api'
github = Github.new
dir = github.repos.contents.get :user => 's2t2', :repo => 'text', :path => '/'
files = dir.map{|f|
github.repos.contents.get :user => 's2t2', :repo => 'text', :path => f.path.to_s
}
@bryanwb
bryanwb / sendmail-basic-chef
Created October 16, 2011 06:04
Basic sendmail configuration
package 'sendmail' do
action :install
end
service 'sendmail' do
action [ :enable,:start ]
end
template "/etc/mail/sendmail.cf" do
source "sendmail.cf.erb"
@chrisbloom7
chrisbloom7 / preload_sti_models.rb
Created January 31, 2012 22:17
Setting up STI subclass routes programmatically
if Rails.env.development?
# Make sure we preload the parent and children class in development
# since classes aren't pre-cached. Otherwise we get an error when
# accessing a child class before we access the parent.
%w[kase coaching_kase training_kase alpha_kase].each do |c|
require_dependency File.join("app","models","#{c}.rb")
end
end
@phudgins
phudgins / cleanout-rvm.sh
Created April 10, 2012 12:35
Remove RVM if rvm implode doesn't work
#!/bin/bash
/usr/bin/sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm
/usr/bin/sudo /usr/sbin/groupdel rvm
/bin/echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete or comment out if this was a Per-User installation."
@milkbread
milkbread / D3_mapping_basics-testmap.html
Created June 27, 2013 20:45
HTML: D3 Mapping Basics - example for the tutorial on digital-geography
<!DOCTYPE html>
<html>
<head>
<title>Testmap</title>
<meta charset="utf-8" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
@import url(http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.css);
</style>
@jehiah
jehiah / activity_snapshot.sh
Created January 7, 2013 18:43
A cron job script to capture computer activity every 30 seconds
#!/bin/sh
# computer activity data collection for http://jehiah.cz/one-two/
# by Jehiah Czebotar
FILE="activity_log/`date +%Y%m%d`.log"
function log_activity()
{
local UTC=`date "+%s,%Z"`
local IDLE=$((`/usr/sbin/ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000 ))
@alecrajeev
alecrajeev / README.md
Last active March 26, 2016 08:30
United States Congressional Districts Hexagons

U.S. Congressional Districts as Hexagons.

Background

The purpose of this map as detailed on Daily Kos is to represent the congressional districts in the United States accurately. Currently it is difficult to show the districts because some such as those in New York City are very small, while others like Montana are the size of an entire state. Previosly the maps needed to be zoomable to see the districts containing cities. Other represntations such as cartograms warped the country's shape. This map attempts to fix that by giving each congressional district equal area i.e. five regular hexagons.

According to the original Daily Kos article, the map was built by Daniel Donner.

Porting the Map

I did not design the map. This project's purpose is to port the map to a more useable format. I ported the map t

@kosamari
kosamari / index.html
Last active March 27, 2016 03:23
D3.js Hanabi
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<meta charset="utf-8">
<style>
body {
background: #222;
color:#fff;
font-family: "Helvetica Neue", Helvetica, sans-serif;
@alecrajeev
alecrajeev / README.md
Last active June 8, 2016 19:52
Democratic Primary 2016

Democratic Primary 2016 by CD

Background

The purpose of this map as detailed on Daily Kos is to represent the congressional districts in the United States accurately. Currently it is difficult to show the districts because some such as those in New York City are very small, while others like Montana are the size of an entire state. Previosly the maps needed to be zoomable to see the districts containing cities. Other represntations such as cartograms warped the country's shape. This map attempts to fix that by giving each congressional district equal area i.e. five regular hexagons.

The map was built by Daniel Donner.

I ported the map using d3 to make it easier to use.

The raw data on the race comes from The Green Papers, but I adapted it slightly to my use in [google s