Skip to content

Instantly share code, notes, and snippets.

View HaydenElza's full-sized avatar

Hayden Elza HaydenElza

View GitHub Profile
@HaydenElza
HaydenElza / Allow Paste.md
Created April 5, 2024 20:35
Re-enable paste in form input when disabled by website.

Allow Paste

Re-enable paste in form input when disabled by website.

var allowPaste = function(e) {
  e.stopImmediatePropagation();
  console.log("Free the paste!")
  return true;
};
@HaydenElza
HaydenElza / agol_transfer_ownership.py
Last active March 6, 2024 05:26
Given an app item ID, transfer ownership of the app and all associated items in ArcGIS Online.
"""Transfer Ownership of App and Associated Web Maps and Feature Layers.
Given an app item ID, transfer ownership of the app and all associated items.
"""
from arcgis.gis import *
# Parameters
@HaydenElza
HaydenElza / README.md
Created February 29, 2024 23:34
Disable xss prevention for Esri feature service.

ArcGIS Online: Update Service to Allow HTML Links in Fields

By default feature layers hosted on ArcGIS Online do not allow you to insert links into fields because it could be "harmful". This code snippet allows you to edit the service definition of a feature layer to allow links to be added to fields.

@HaydenElza
HaydenElza / amend-second-to-last-commit.md
Last active January 19, 2024 21:27
Git amend second to last commit.

Amend Second to Last Commit

Steps

  1. Stash any unstaged changes

  2. Rebase to desired commit

    git rebase -i HEAD~2
    
<form action="/set-timer" method="get" id="timer-form">
<label for="time-select">Enter a date and time for the glitter bomb to detonate:</label>
<input id="time-select" type="datetime-local" name="time" />
<button type="submit" form="timer-form">Start Timer</button>
</form>
<script>
document.getElementById("time-select").value = Date().toString();
</script>
This file has been truncated, but you can view the full file.
[
{
"rank": "1",
"chamber": "Rep.",
"firstname": "Darrell ",
"lastname": "Issa ",
"party": "R",
"state": "California",
"gender": "M",
"worth": "283250020",
-- Enable postgis
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
// ==UserScript==
// @name Survey Notes XL
// @namespace http://elza.me
// @version 0.1
// @description Default to XL images. Go big or go home!
// @author Hayden Elza
// @match http://digicoll.library.wisc.edu/cgi-bin/SurveyNotes/*
// @require https://code.jquery.com/jquery-latest.js
// ==/UserScript==
@HaydenElza
HaydenElza / hooferflag.gs
Last active April 29, 2021 19:32
Tracks changes in UW Madison Hoofer Sailing Club lake conditions flag. Flag status is saved in a google sheets to display the history later. Visit site at: https://elza.me/hooferflag
function fetchData() {
// Fetch data
//var url = 'http://testout.hoofersailing.org/feed.php'
//var url = 'https://ehs.wisc.edu/current-flag.php'
var url = 'https://endpoints.wams.doit.wisc.edu/ehs.wisc.edu/LakeConditions/Api/'
var response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true});
// Process response to object
var json = response.getContentText().replace(/\(|\)|;/g, '');
var data = JSON.parse(json);
@HaydenElza
HaydenElza / feature_class_to_postgres_v3.py
Created February 13, 2019 21:04
Load a spatial dataset from feature class to a table in postgres.
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# feature_class_to_postgres_v3.py
# Load county dataset from feature class to a table in postgres.
# Hayden Elza (hayden.elza@gmail.com)
# Created: 2018-08-09
# Modified: 2018-08-20
#------------------------------------------------------------------------------