Skip to content

Instantly share code, notes, and snippets.

View dblanchardDev's full-sized avatar

David Blanchard dblanchardDev

View GitHub Profile
@dblanchardDev
dblanchardDev / arcgis-maps-js-inspector.js
Last active March 24, 2023 15:14
Inspect the properties of an ArcGIS Maps SDK for JavaScript object and optionally print them out to the console.
// Maximum depth objects will be converted
const MAX_DEPTH = 2;
/**
* Check whether an object is likely an ArcGIS Maps SDK object.
* @param {object} obj object or class
* @returns {boolean}
*/
function isMapsSDKObject(obj) {
@dblanchardDev
dblanchardDev / Fix_Python3_ArcPy_Paths.py
Created February 2, 2022 20:14
Repair paths used for Python imports and ArcPy DLLs before importing ArcPy. Fixes issues where ArcPy in Python 2.7 is used to call a Python 3 script with ArcPy.
import sys, os
# FIX PATHS FOR IMPORTS & DLL WHEN RUNNING ON SERVER
# (otherwise, it will try to load ArcPy from the Python 2.7 libraries when called via ArcGIS Server)
if ("\\Server\\framework\\runtime\\" in sys.executable):
# Get installation base (e.g. C:\Program Files\ArcGIS)
base = sys.executable.rsplit("\\Server\\", 1)[0]
baseLower = base.lower()
# Remove invalid python import paths
@dblanchardDev
dblanchardDev / LitElementI18N.js
Last active August 23, 2021 23:07
An extension of a Lit-Element allowing for easy addition of internationalization dictionaries.
/*
LITE-ELEMENT-I18N
Lit Element i18n © 2021 by David Blanchard is licensed under CC BY 4.0
Extension of the lit-element to add base support for an i18n dictionnary.
*/
import {LitElement} from "lit";
/**
@dblanchardDev
dblanchardDev / LitScafold.js
Last active August 23, 2021 23:06
Template/Scafold to use when writing a Lit (Element/HTML/CSS) from scratch.
import {LitElement, html, css} from "lit";
class MyElement extends LitElement {
/**
* Reactive Properties
*/
static properties = {
name: {type: String, attribute: true, reflect: false},
};
@dblanchardDev
dblanchardDev / HTMLElementPlus.js
Last active May 13, 2020 21:49 — forked from AdaRoseCannon/HTMLElementPlus.js
HTML Element Plus for Web Components
/**
* HTML Element Plus – Add helper methods to HTMLElement for Web Components.
*/
/*eslint-disable accessor-pairs,no-empty-function,no-unused-vars,no-use-before-define*/
/**
* The class to extend in order to access helper methods from a Web Component.
*/
export default class HTMLElementPlus extends HTMLElement {