Skip to content

Instantly share code, notes, and snippets.

@mapsam
mapsam / index.html
Last active December 21, 2015 21:29
jQuery: prepend() and append()
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<style>
</style>
</head>
<body>
<button id="html-button" type="submit" value="HTML Tag Toggle">Add HTML Tags</button>
@mapsam
mapsam / README.md
Last active December 22, 2015 07:39
Google Maps API: Seattle Brunch

Top 50 brunch locations in the Seattle area. Locations from Urban Spoon

#
# Sam, for some weird reason the promise.done()
# function wasn't able to work for me now,
# I'll figure it out later...for now were are using
# .then for concurrent requests...let's chat about this
#
#
# this is a standalone example
# so just copy to a file and load into your browser
@mapsam
mapsam / charmstates.json
Last active December 28, 2015 22:39
Charmingly Inaccurate: States
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mapsam
mapsam / index.html
Last active December 29, 2015 05:29
Twenty Seventy
<!DOCTYPE html>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
.states {
fill: #6BA0B5;
stroke: #fff;
stroke-width:1px;
}
.states:hover {
@mapsam
mapsam / site.js
Last active August 29, 2015 13:57
using tabletop.js for spreadsheet access
// tabletop.js is linked above
function init() {
var json = []; //prented this is a geojson and not just an array
Tabletop.init({
key: '0AkE-VGwUGzsSdHRjTmtNMXhONjYxQUxnOV9SajY4VkE',
callback: function(data, tabletop) {
var entries = [];
@mapsam
mapsam / getajax.js
Created April 15, 2014 21:04
GET ajax
function init() {
var url = 'http://api.example.com/stuffs...'
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: url,
success: function(data) {
console.log(data);
},
@mapsam
mapsam / serialize.js
Created April 23, 2014 22:41
jQuery form serialization
$(document).ready(function(){
$('form').submit(function(event){
var json = JSON.stringify($('form').serializeObject());
$('#result').text(json);
return false;
});
$.fn.serializeObject = function() {
var geojson = {};
geojson['type'] = 'FeatureCollection';
@mapsam
mapsam / README.md
Created April 25, 2014 00:37
Inline SVG partial for WordPress

Good for acting on specific pieces of your SVG object instead of just link as an <img> you can bring the entire object into your HTML. You need two things:

  1. SVG file with a double extension ending with .php - e.g. logo.svg.php
  2. WP include statement with the built-in function get_template_part
<?php
get_template_part( 'includes/partials/logo', 'logo.svg' );
?>