Skip to content

Instantly share code, notes, and snippets.

@dhcole
dhcole / index.html
Last active December 16, 2015 03:19
Layout for CSS-only slide-out mobile menu.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<meta name="viewport" content="initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<title></title>
<style>
body {
margin: 0;
}
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name=$inputline
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url=$inputline
@dhcole
dhcole / script.js
Created March 25, 2013 18:49
Make links on page bookmarkable
// loop through the node list to get the innerHTML from each node
// copy that as the id for the node
var addId = function(list){
for (i = 0; i < list.length; i++) {
element = list[i];
sectionCopy = element.innerHTML.toLowerCase().replace(/ /g, '-').replace(/([^0-9a-z-])/g,''); //substitute space with dash
element.id = sectionCopy;
}
};

DESCRIPTION

@dhcole
dhcole / couchdb-ec2-install.sh
Created December 6, 2012 02:19 — forked from msmith/couchdb-ec2-install.sh
Set up CouchDB on EC2
#!/bin/bash
#
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
#
# Must be run with root privileges
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5)
#
export BUILD_DIR="$PWD"
@dhcole
dhcole / form.js
Created November 3, 2012 19:31
Submit data from html form to Google Doc Spreadsheet. Uses Bootstrap components for auto-complete region list and date selection.
$(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
@dhcole
dhcole / index.html
Created August 9, 2012 22:02 — forked from mojodna/index.html
D3 + ModestMaps
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#map {
width: 1000px;
height: 600px;
}
path {

###2

We’re going to start with some basic code. All I’ve done is set up the HTML structure of the page. For this example, I will use [JQuery][], [JQuery BBQ][], [Leaflet][], and the [MapBox API][].

Gist: https://gist.github.com/2853889

###3 Gist: https://gist.github.com/2853899

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>foursquare :: Explore Sample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript" id="jquery"></script>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>foursquare :: Explore Sample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript" id="jquery"></script>