Skip to content

Instantly share code, notes, and snippets.

Avatar

Sam Selikoff samselikoff

View GitHub Profile
@bycoffe
bycoffe / README.md
Created Jun 26, 2013
Town/county map using d3 and TopoJSON
View README.md

This is a demonstration of how to create a combination town/county map from a shapefile using TopoJSON and d3.js.

It includes a simplified version of the code used for the Massachusetts special Senate election results on The Huffington Post.

Get the data

Download a shapefile of Massachusetts towns from the state's GIS site:

wget http://wsgw.mass.gov/data/gispub/shape/census2000/towns/census2000towns_poly.exe
View push-mirage-db-into-store.js
// tests/helpers/push-mirage-db-into-store.js
import { registerAsyncHelper } from '@ember/test';
import { run } from '@ember/runloop';
let pushMirageDbIntoStore = function(server, store) {
let tables = Object.keys(server.schema);
tables.forEach(table => {
if (server.schema[table].all) {
let all = server.schema[table].all();
View generator_scss.rb
#
# Jekyll Generator for SCSS
#
# (File paths in this description relative to jekyll project root directory)
# Place this file in ./_plugins
# Place .scss files in ./_scss
# Compiles .scss files in ./_scss to .css files in whatever directory you indicated in your config
# Config file placed in ./_sass/config.rb
#
View ember.coffee
# Ember defines function() {}.property() as a shortcut
# for making computed properties
name: (->
@get('firstName') + " " + @get('lastName')
).property('firstName', 'lastName')
# It is a shortcut to wrapping the function inside
# Em.computed. However, using the "long way" is
# actually a bit nicer in coffeescript due to not
# requiring the parentheses