Skip to content

Instantly share code, notes, and snippets.

TheMapSmith / flights.js
Last active Mar 5, 2021
Fetching flight info
View flights.js
var fs = require('fs');
var request = require('request-promise');
var moment = require('moment')
// Globals
global.timestamp = moment().unix()
global.allPlaybacks = [];
global.geojson = {};
global.geojson['type'] = 'FeatureCollection';
global.geojson['features'] = [];
odoe / layerlist.js
Created Nov 6, 2016
Ghetto JSAPI layerlist toggle in JavaScript
View layerlist.js
function layerList(layers) {
const list = layers.reduce((ul, layer) => {
const li = document.createElement('li');
const toggle = document.createElement('input');
toggle.type = 'checkbox';
toggle.checked = layer.visible;'visible', () => toggle.checked = layer.visible);
toggle.addEventListener('change', () => layer.visible = !layer.visible);
const label = document.createElement('span');
label.innerHTML = layer.title;
maptastik / notepaddycakes.js
Created Aug 24, 2016
A bookmarklet to turn a browser into a notepad
View notepaddycakes.js
raykendo /
Last active Aug 23, 2016
Saving you some embarrassment on LinkedIn with this console tip

Browser console tips

LinkedIn - People I don't know

Current date: 2016-08-23

I'm one of those people who still holds on to the hope that LinkedIn is a good idea. I check in daily and check all the areas I've been trained to look at on most social media sites.

The thing that annoys me about LinkedIn is the "People you may know" page. That long list of your contacts' third cousins, college buddies, and other total strangers. They've designed the page so that you'll accidentally click on one of those strangers, causing an embarrasing incident.

"I'm not really interested in hiring a life-coach at my company right now. Sorry to get your hopes up."

raykendo / example.js
Created Mar 30, 2016
Quick and Dirty show Date from feature
View example.js
require(["esri/map", "esri/layers/FeatureLayer", "esri/tasks/query"], function (map, FeatureLayer, query) {
var features = [/* assume a list of feature graphics will be assigned here soon */];
// do stuff to assign maps, feature layers, etc.
// do stuff to assign features as a list of search results from a feature layer
var importantDates = (feature) {
if (feature.attributes["ImportantDate"] !== null) {
return new Date(feature.attributes["ImportantDate"]);
raykendo / LayerListModified.js
Last active Mar 24, 2016
ArcGIS JSAPI Hack: LayerList fixes
View LayerListModified.js
], function (declare, arrayUtils, dojoQuery, put, LayerList) {
return declare([LayerList], {
raykendo / PointWithin.js
Created Feb 1, 2016
Finding a point within a geometry for ArcGIS JavaScript API using client-side processing
View PointWithin.js
], function (arrayUtils, Polygon, Polyline, Point, geometryEngine) {
* Finds a point on a polyline
raykendo / UrlSearchParameters.js
Created Jan 18, 2016
Dojo plugin to parse URL parameters and translate them to a where clause for an ArcGIS JavaScript API Query
View UrlSearchParameters.js
* A dojo plugin that extracts possible query parameters from the URL.
* @module search/UrlSearch
define(["esri/urlUtils"], function (urlUtils) {
// regex for parameter names to ignore
var ignoreParameters = [
/^appid$/i, // ArcGIS Online uses appid parameter to define application id
/^folderid$/i, // ArcGIS Online uses folderid to define folder hash where webmap is stored
/^webmap$/i // ArcGIS Online uses webmap property to define the map to use in the application
raykendo / UniqueComboBox.js
Last active Dec 8, 2015
David Walsh's Display Unique Combobox ( updated for AMD
View UniqueComboBox.js
* An update on David Walsh's Unique Combobox
* Updated for Dojo AMD (tested at v. 1.10)
* Originally posted:
["dojo/_base/declare", "dojo/_base/array", "dijit/form/_ComboBoxMenu"],
function (declare, arrayUtils, _ComboBoxMenu) {
return declare([_ComboBoxMenu], {
createOptions: function (results, dataObject, labelFunc) {
raykendo / GetTimeStamp.js
Last active Nov 24, 2015
Dojo time stamp browser plugins
View GetTimeStamp.js
* Gets a time stamp out of either localStorage, or a cookie session, if those are available.
* Use in conjunction with SetTimeStamp module.
* @module GetTimeStamp
* @param {string} id - string id you want to use to retrieve a time stamp from the browser
* @returns {Date} - Date of the last time stamp
define(["dojo/cookie"], function (cookie) {
return {
load: function (id, require, callback) {