Skip to content

Instantly share code, notes, and snippets.

View joshcarr's full-sized avatar
👁️
Seeing

Josh Carr joshcarr

👁️
Seeing
View GitHub Profile
@joshcarr
joshcarr / gist:9139097
Created February 21, 2014 17:40
Regex for finding HTML tags with content
(?:<tag>)([\s\S]+?)(?:</tag>)
/*!
* JavaScript - loadGoogleMaps( version, apiKey, language, sensor )
*
* - Load Google Maps API using jQuery Deferred.
* Useful if you want to only load the Google Maps API on-demand.
* - Requires jQuery 1.5
*
* UPDATES by Gavin Foley
* - Tidied JS & made it JSLint compliant
* - Updated script request to Google Maps API to be protocol relative
@joshcarr
joshcarr / form.js
Created April 17, 2014 07:11 — forked from dhcole/form.js
$(function(){
var formUrl = '/* ex: https://docs.google.com/a/developmentseed.org/spreadsheet/formResponse?formkey=... */';
// Set up map
var m = mapbox.map('map').addLayer(mapbox.layer().id(' /* mapbox-account.id */ '));
// Set up map ui features with point selector
var ui = mapbox.ui().map(m).auto().pointselector(function(d) {
// Remove all points except the most recent
@joshcarr
joshcarr / index.html
Last active August 29, 2015 14:00 — forked from stepheneb/index.html
D3 Example: zoom, pan, and axis rescale
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>One Graph</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<script type="text/javascript" src="simple-graph.js"></script>
<style type="text/css">
body { font: 13px sans-serif; }
rect { fill: #fff; }
These character sets are not exhaustive, but merely a quick reference for common characters.
Quotation
‘ &#8216; \2018 Open single quotation mark
’ &#8217; \2019 Closed single quotation mark / Apostrophe
“ &#8220; \201C Open double quotation mark
” &#8221; \201D Closed double quotation mark
' &#39; \0027 Typewriter single quotation mark
" &#34; \0022 Typewriter double quotation mark
′ &#8242; \2032 Prime (Feet / Minutes)
GENERATED_FILES = \
unemployment.tsv
.PHONY: all clean
all: $(GENERATED_FILES)
clean:
rm -rf -- $(GENERATED_FILES)
@joshcarr
joshcarr / hacks.scss
Created May 30, 2014 21:34
Ask DN : Whats your favourite CSS hack / quick fix?
// Ask DN : Whats your favourite CSS hack / quick fix?
// https://news.layervault.com/stories/24631-ask-dn--whats-your-favourite-css-hack--quick-fix
/* Helps you do skeletal prototyping without worrying about colour or content */
*{outline:1px solid rgba(255,0,85,0.2)}
/* CLEARFIX!!! based on http://www.yuiblog.com/blog/2010/09/27/clearfix-reloaded-overflowhidden-demystified/ */
.cf:before,
.cf:after {
content: ".";
@joshcarr
joshcarr / clone.js
Created June 3, 2014 19:07
clone js objects
// from this answer: http://stackoverflow.com/a/18843630
function clone(obj) {
// Handle the 3 simple types, and null or undefined
if (null == obj || "object" != typeof obj) return obj;
// Handle Date
if (obj instanceof Date) {
var copy = new Date();
copy.setTime(obj.getTime());