Skip to content

Instantly share code, notes, and snippets.

void Main()
{
var bob_banana = new person(){name = "bob banana", age = 5,friends = new List<string>(){"bobo", "bilbo", "brandon"} };
var tim_truffle = new person(){name = "tim truffle", age = 300, friends = new List<string>(){"tom", "trudy", "trouble"} };
var clyde_carrot = new person(){name = "clyde carrot", age = 30, friends = new List<string>(){"clog", "clod", "clop"} };
var people = new List<person>(){bob_banana, tim_truffle, clyde_carrot};
var info = people
.Where (p => p.age > 20)
@dshook
dshook / GeoJSON-Import.cs
Last active August 29, 2015 14:06
GeoJSON Import
void Main()
{
var path = "C:\\new-path\simp.js";
int counter = 0;
int commaCount = 0;
string line;
var newgeos = new List<Zipcode_geojson>();
// Read the file and display it line by line.
@dshook
dshook / ZipCodeGeoJSON.cs
Last active August 29, 2015 14:06
ZipCodeGeoJSON Model
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Dapper;
using System.Data.SqlClient;
using System.Web.Helpers;
namespace Models
{
@dshook
dshook / zipcode_geojson.sql
Created September 24, 2014 03:35
zipcode geojson table
CREATE TABLE dbo.zipcode_geojson
(
zip NVARCHAR (5) NOT NULL
, geoJSON VARCHAR (max) NOT NULL
, latitude DECIMAL (18, 10) NOT NULL
, longitude DECIMAL (18, 10) NOT NULL
, point GEOGRAPHY NULL
, CONSTRAINT PK_zipcode_geojson PRIMARY KEY (zip)
)
@dshook
dshook / zipcode_demographics.sql
Created September 24, 2014 03:35
zipcode_demographics table
CREATE TABLE dbo.zipcode_demographics(
zip VARCHAR (5) NOT NULL
, population INT NOT NULL
, race_pct_white DECIMAL (4, 1) NOT NULL
, race_pct_black DECIMAL (4, 1) NOT NULL
, race_pct_asian DECIMAL (4, 1) NOT NULL
, race_pct_native DECIMAL (4, 1) NOT NULL
, race_pct_other DECIMAL (4, 1) NOT NULL
, sex_pct_male DECIMAL (4, 1) NOT NULL
, sex_pct_female DECIMAL (4, 1) NOT NULL
@dshook
dshook / map.css
Created September 24, 2014 03:55
leaflet map css
<style type="text/css">
div.map-container{
position: relative;
min-height: 100%;
height: 100%;
margin: 0 0 -30px 0; /* the bottom margin is the negative value of the footer's height */
}
#map{
width: 100%;
@dshook
dshook / map-includes.html
Last active August 29, 2015 14:06
map includes
<script src="/assets/js/underscore.min.js"></script>
<script src="/assets/js/d3/d3.v3.js"></script>
<script src="/assets/js/leaflet/leaflet.js"></script>
<script src="/assets/js/leaflet/leaflet.label.js"></script>
<script src="/assets/js/leaflet/numeral.js"></script>
<script src="/assets/js/map.js"></script>
@dshook
dshook / map.js
Last active August 29, 2015 14:06
Leaflet map javascript
var map = null;
var zipLayer = null;
var resultStats = {
min: 0,
max: 0,
mean: 0,
variance: 0,
deviation: 0
};
@dshook
dshook / map-dropdown.html
Created September 24, 2014 04:33
map dropdown
<select id="map-color">
<option value="rev">Revenue</option>
<option value="revPerPop">Revenue / Population</option>
<option value="popPerRev">Population / Revenue</option>
<option value="medInc">Median Household Income</option>
<option value="medIncPerRev">Median Income / Revenue</option>
<option value="totMoney">Median Income * Population</option>
</select>
@dshook
dshook / ListToDataTable.cs
Created October 8, 2014 17:43
ListToDataTable
public static class ListToDataTable
{
public static JsDataTable ConvertListToJsDataTable<T>(List<T> items)
{
JsDataTable dataTable = new JsDataTable();
//Get all the properties for the headers
PropertyInfo[] Props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
//create empty header
var header = new List<JsDataTableRow>() { new JsDataTableRow(){ cells = new List<JsDataTableCell>() } };