Skip to content

Instantly share code, notes, and snippets.

@asizer
asizer / Gruntfile.js
Last active February 11, 2024 23:13
Grunt tasks for concatenating and minifying AMD modules and templates
/*global module:false*/
module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
// use esri_slurp to download api locally. This allows a custom build of the
@asizer
asizer / index.html
Created February 24, 2015 22:06
Fixing BMG and original basemaps with labels
<!DOCTYPE html>
<html>
<head>
<title>Fixing Basemap Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no,width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" href="//js.arcgis.com/3.12/esri/css/esri.css">
@asizer
asizer / index.html
Created February 24, 2015 22:08
Remove webmap basemap
<!DOCTYPE html>
<html>
<head>
<title>Webmap Basemaps</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no,width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" href="//js.arcgis.com/3.12/esri/css/esri.css">
@asizer
asizer / index.html
Created February 24, 2015 22:29
Broken BMG with basemap labels
<!DOCTYPE html>
<html>
<head>
<title>Broken Basemap Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no,width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" href="//js.arcgis.com/3.12/esri/css/esri.css">
@asizer
asizer / README.md
Created March 4, 2015 15:07
Popup on hover

Use esri popup as tooltip, and templating to reuse content framework.

@asizer
asizer / slightlyDifferent.js
Last active August 29, 2015 14:24
csv exports
generateCSV: function(graphicsArr, indicators, adminLevel) {
var titleRow = ['Region'];
indicators.each(function(indicator) {
titleRow.push('"' + indicator.get('DESC_SHORT') + '"');
});
var csvBody = [];
_.each(graphicsArr, function(feat) {
var row = [];
row.push('"' + feat.attributes['NAME_' + adminLevel] + '"');
@asizer
asizer / Gruntfile.js
Last active August 29, 2015 14:25
Sample gruntfile
module.exports = function(grunt) {
'use strict';
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
// ********** setup tasks ********** //
// title for BasemapToggle
'title': 'Campus',
// path to thumbnail. Starts in root directory of app (relative from index.html)
'thumbnailUrl': 'assets/images/TopoCampus.png',
// Can include multiple layers here. In this one, the default topo map is combined
// with a custom campus map so that there's a fallback basemap in areas that the campus map doesn't cover.
'baseMapLayers': [{
url: '//services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer'
}, {
url: '//arcgis-tenone2012-1974758903.us-west-1.elb.amazonaws.com/arcgis/rest/services/Campus/MapServer'
@asizer
asizer / DCPS racial makeup.csv
Created August 21, 2015 20:23
DC Public Schools demographics
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 32 columns, instead of 24. in line 4.
School,Lat,Lng,Total Enrollment,Percent of District Enrollment,Percent White,Percent Asian,Percent W&A,Percent Black,Percent Hispanic,Percent Pacific/Hawaiian,Percent Native/Alaskan,Percent Multiple Races,Percent ELL,Percent FRL,Percent SPED,Percent In-Boundary,Percent Math BB,Percent Math B,Percent Math P,Percent Math A,Percent Math P&A,Percent Reading BB,Percent Reading B,Percent Reading P,Percent Reading A,Percent Reading P&A,Percent Math Improvement,Percent Reading Improvement,Attendance Rate,Re-enrollment,Percent Truancy
Aiton Elementary School,-76.93370318,38.89700927,252,0.62,0,0,0,100,0,0,0,0,0,99,11,59,40,39,20,1,21,30,53,16,1,17,48,43,92,76,10
Amidon-Bowen Elementary School,-77.01812759,38.87952285,293,0.73,2,2,4,92,5,0,0,0,3,99,12,84,44,40,14,3,17,33,46,20,2,22,30,33,93,80,15
Anacostia High School,-76.98307953,38.87009151,697,1.73,0,0,0,100,0,0,0,0,0,99,36,71,52,38,9,0,9,47,40,13,0,13,33,34,65,83,67
Ballou High School,-77.00097754,38.83939011,791,1.96,0,0,0,99,1,0,0,0,0,99,36,82,39,38,22,1,23,36,44
@asizer
asizer / index.html
Last active September 8, 2015 16:28
createMap + layers with different sharing settings
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>WebMap with restricted and unrestricted layers</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/dijit/themes/claro/claro.css">
<style>