Skip to content

Instantly share code, notes, and snippets.

@andygup
andygup / check-version.js
Created April 29, 2022 19:33
Compare installed library version with the latest version on npm
#!/usr/bin/env node
const exec = require("util").promisify(require("child_process").exec);
/**
* Compare the installed version against the latest @next version
* @returns {{validate: boolean, nextRelease: string}}
*/
const checkVersion = async (currentVersion) => {
let installedVersion, nextRelease, validate = false;
try {
import {
Component,
OnInit,
ViewChild,
ElementRef,
OnDestroy
} from '@angular/core';
import WebMap from '@arcgis/core/WebMap';
import MapView from '@arcgis/core/views/MapView';
import Widget from "@arcgis/core/widgets/Widget";
import { subclass, property } from "@arcgis/core/core/accessorSupport/decorators";
import { messageBundle } from "@arcgis/core/widgets/support/decorators/messageBundle";
import { tsx } from "@arcgis/core/widgets/support/widget";
const CSS = {
base: "esri-hello-world",
emphasis: "esri-hello-world--emphasis"
};
@andygup
andygup / cartegraph-test.html
Last active July 1, 2020 23:58
Automated MapView test using a basemap and a modal map
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://jsdev.arcgis.com/next/esri/themes/light/main.css" />
<style>
html,
body,
@andygup
andygup / time-slider.js
Created May 7, 2020 22:47
Main app for leveraging time slider
/*
Copyright 2020 Esri
Licensed under the Apache License, Version 2.0 (the "License"); You
may not use this file except in compliance with the License. You may
obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@andygup
andygup / touch-emulator.js
Created November 12, 2019 23:16
touch-emulator
(function(window, document, exportName, undefined) {
"use strict";
var isMultiTouch = false;
var multiTouchStartPos;
var eventTarget;
var touchElements = {};
// polyfills
if(!document.createTouch) {
@andygup
andygup / esri-map.component.ts
Created September 25, 2019 17:43
Webpack esri map component
/*
Copyright 2019 Esri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
@andygup
andygup / cc.json
Last active August 9, 2019 21:13
Counterclockwise geojson
{ "type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-107.957138652555,
32.9007913911884
],
@andygup
andygup / esri-map.component.ts
Last active July 25, 2019 23:03
ArcGIS JavaScript map component using webpack imports with Angular 8
/*
Copyright 2019 Esri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
@andygup
andygup / CheckForGeolocation.js
Created February 5, 2019 22:43
Validate if JavaScript Geolocation API is available or not
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(({ coords }) => {
const { latitude, longitude } = coords;
console.log(latitude + ", " + longitude);
}, error => {
console.error(error);
});
} else {
// handle the error