Skip to content

Instantly share code, notes, and snippets.

Ken Doman raykendo

Block or report user

Report or block raykendo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@raykendo
raykendo / file.js
Last active Mar 14, 2018
Throttle Ajax Requests
View file.js
(function () {
// ajax function from https://gist.github.com/Xeoncross/7663273
function ajax(url, callback, data, x) {
try {
x = new (this.XMLHttpRequest || ActiveXObject)("MSXML2.XMLHTTP.3.0");
x.open(data ? "POST" : "GET", url, 1);
x.setRequestHeader("X-Requested-With", "XMLHttpRequest");
x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
x.onreadystatechange = function () {
@raykendo
raykendo / file.js
Last active Jan 15, 2018
Get URL query or hash parameter
View file.js
(function () {
//source: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
// modified to also check hash
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?#&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
@raykendo
raykendo / delete-stuff2.py
Last active Aug 16, 2017
Removing junk files from a folder recursively (Python)
View delete-stuff2.py
#!/usr/bin/env python
#
# delete-stuff2.py: delete specific files and folders within subdirectories of a folder.
# by raykendo
# Python 2.7+
#
import os
import stat
import sys
@raykendo
raykendo / example.js
Created Feb 16, 2017
Getting max distance between a shape and a reference point
View example.js
(function () {
"use strict";
//...
/**
* defining {object} point
* @property {number} x - x coordinate for the point.
* @property {number} y - y coordinate for the point.
*/
@raykendo
raykendo / CleanWebMapRequest.js
Created Feb 10, 2017
Cleaning Export Web Map request plugin
View CleanWebMapRequest.js
/**
* Some people just need a paper map. ArcGIS Server provides a service to turn a web map into an image, pdf, or other file
* The process to generate these documents can be long and intensive (in relative web terms), taking up to 2 minutes to generate
* a document.
*/
/* globals: define*/
define([
"dojo/_base/lang",
"dojo/_base/array",
"dojo/json",
@raykendo
raykendo / index.html
Last active Sep 23, 2016
Mapillary JS + ArcGIS JavaScript API 4.x Example
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mapillary-JS + ArcGIS JSAPI 4.x example</title>
<link rel="stylesheet" href="https://unpkg.com/mapillary-js@1.7.1/dist/mapillary-js.min.css">
<link rel="stylesheet" href="https://js.arcgis.com/4.0/esri/css/main.css">
<script type="text/javascript">
dojoConfig = {
async: true,
@raykendo
raykendo / index.html
Last active Sep 23, 2016
Mapillary JS + ArcGIS JavaScript API 3.x
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mapillary-JS + ArcGIS JSAPI 3.x example</title>
<link rel="stylesheet" href="https://unpkg.com/mapillary-js@1.7.1/dist/mapillary-js.min.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.17/esri/css/esri.css">
<script type="text/javascript">
dojoConfig = {
async: true,
@raykendo
raykendo / swt_linkedin1.md
Last active Aug 23, 2016
Saving you some embarrassment on LinkedIn with this console tip
View swt_linkedin1.md

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."

View caesar.py
#!/usr/bin/python
import string
import sys
def caesar(value):
for i in range(0, 26):
#print(value.translate(str.maketrans(myAlphabet, myAlphabet[i:] + myAlphabet[:i])))
print(value.translate(str.maketrans(string.ascii_letters, string.ascii_lowercase[i:] + string.ascii_lowercase[:i] + string.ascii_uppercase[i:] + string.ascii_uppercase[:i])))
@raykendo
raykendo / app.js
Created Mar 30, 2016
Formatting Dates Only in ArcGIS Online web map popups.
View app.js
require(["esri/arcgis/utils"], function (arcgisUtils) {
//...
// functionality to fix dates
var oneDay = 24 * 60 * 60 * 1000;
function timeFix(value) {
var dateShift, val;
if (value === undefined || value === null) {
return value;
}
You can’t perform that action at this time.