Skip to content

Instantly share code, notes, and snippets.

View clhenrick's full-sized avatar

Chris Henrick clhenrick

View GitHub Profile
@clhenrick
clhenrick / 421a_exempt_stabilzed.sql
Created August 27, 2015 14:23
421a_exempt_stabilzed
select sum(pluto_apts) apts_421a_in_pluto,
sum (registered_stabilized_apts) apts_421a_registered_stabilized
from exempt_stabilized;
apts_421a_in_pluto | apts_421a_registered_stabilized
--------------------+---------------------------------
79018 | 51312
/* find all properties with 421a or rent stabilization */
SELECT *
@clhenrick
clhenrick / index.html
Last active August 29, 2015 13:57
Triggering openPopup() with an AnimatedMarker in Leaflet
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<script src="http://rawgithub.com/openplans/Leaflet.AnimatedMarker/master/src/AnimatedMarker.js"></script>
<script src="http://rawgithub.com/makinacorpus/Leaflet.GeometryUtil/master/dist/leaflet.geometryutil.js"></script>

Git Flow

I keep meeting people who struggle to wrap their heads around the proper way to use Git + Github. This snippet is designed to explain Vincent Driessen's git branching model, at least as well as I understand it. Speacial thanks to Stephen Koch for being the true master here.

This tutorial is for Linux or OSX. Feel free to use Cygwin or write a fork for windows.

A way to think about Git and Github.

<snippet>
<content><![CDATA[<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>${1:Project Name}</title>
@clhenrick
clhenrick / index.html
Last active August 29, 2015 14:02
Example showing how to load layers in Cartodb and turn them on / off.
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>CartoDB.JS Demo</title>
<meta name="description" content="">
@clhenrick
clhenrick / odyssey-scroll-example
Created June 12, 2014 00:32
An Odyssey JS scroll example
```
-title: "The voyage of the Beagle"
-author: "@clhenrick"
```
#The Voyage of the HMS Beagle
```
- center: [50.343, -4.143]
- zoom: 2
```
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@clhenrick
clhenrick / cbd_data-table_tracker
Last active August 29, 2015 14:03
template markdown table
##### CartoDB Table Name
| Coverage | Geometry Type | Source | Original Source URL | Date Created | Date Modified | Modified By | Meta Data Wiki |
|--------------------|---------------|--------|---------------------|--------------|---------------|-------------|----------------|
| | | | | | | | |
| | | | | | | | |
@clhenrick
clhenrick / global_province_synonym_queries
Last active August 29, 2015 14:04
split column into rows
-- split the name_alt column into new rows using `|` as a delimiter and insert into global_province_synonyms table as new rows
-- to do: do a `IS NOT null` check?
-- note: you have to escape the | character as it is reserved in Postgres
INSERT INTO global_province_synonyms (name, rank, woe_id, country_iso3)
SELECT
regexp_split_to_table(global_province_polygons.name_alt, E'\\|' ) AS name,
1, woe_id, iso3
FROM
global_province_polygons
@clhenrick
clhenrick / index.html
Last active August 29, 2015 14:04
mfa bootcamp day 2 demo code
<!DOCTYPE html>
<!-- the root tag, everything must go in here -->
<html>
<!-- meta information about our page as well as external links and styles -->
<head>
<!-- specify the character encoding of our page -->
<meta charset="utf-8">