Skip to content

Instantly share code, notes, and snippets.

@antibland
antibland / Google Map Loader
Last active August 29, 2015 14:20
Helpful utility function to load a Google Map with a marker
function loadMap(id, lat, lng, title) {
var mapDiv = document.getElementById(id),
latlng = new google.maps.LatLng(lat, lng),
mapOptions = {
zoom: 16,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
},
marker;
@antibland
antibland / gist:2ad830b9ec62c9eb8e88
Created March 10, 2015 05:47
Contextually assign your event listeners.
var supportsTouch = function() {
return 'ontouchstart' in document.documentElement;
},
event_type = supportsTouch() ? "touchstart" : "click",
some_element = document.getElementById("some-element");
some_element.addEventListener(event_type, someFunction, false);
@antibland
antibland / map_get_with_default
Created December 15, 2014 04:29
SASS 3.3 map-get() with default fallback
// Let's say I have some default styles for a form
$form_defaults: (
background-color: white,
max-width: 18.5em,
padding: 1em
);
// And then a call to my form mixin with a few custom override arguments.
// Notice that I'm not overriding max-width here
form {