Skip to content

Instantly share code, notes, and snippets.

View steveoh's full-sized avatar
🚀

steveoh steveoh

🚀
View GitHub Profile

This style guide seeks to:

  • Standardize the language used across all platforms that UGRC interacts with.
  • Provide a uniform customer experience for our associates.
  • Prevent misunderstandings due to lack of consistency and clarity.

Tone

Our written content should be:

@steveoh
steveoh / main.py
Last active May 4, 2023 20:56
Sending email with SendGrid
#!/usr/bin/env python
# * coding: utf8 *
"""
main.py - A script that send an email with sendgrid
"""
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
from_address = 'no-reply@utah.gov'
@steveoh
steveoh / address systems.js
Created January 10, 2023 18:02
arcade expression to assign address systems
var layerName = 'Address Systems';
var set = FeatureSetByName($datastore, layerName);
function getAttributeFromLargestArea(feat, set, field) {
var items = intersects(set, feat);
var counts = count(items);
if (counts == 0) {
return { 'errorMessage': 'No intersection found' };
'''
AGOLPallet.py
A module that contains a pallet definition for the data that gets pushed to AGOL.
'''
import re
import traceback
from datetime import timedelta
from os import mkdir, rename
from os.path import basename, dirname, join
services.AddMediatR(typeof(Startup));
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(PerformanceLogger<,>));
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>));
services.AddSingleton(new Lazy<NaicsProvider>(() => new NaicsProvider()));
services.AddScoped<IHasOwnership, OwnershipResolver>();
// add context for computations
services.AddDbContext<AppDbContext>(
options => options

Spatial Filters

Introduction

Create a set of spatial filters based on OGC spatial functions.

Proposal

Example Objects

@steveoh
steveoh / overflow fade.css
Created June 18, 2019 16:32
fade the bottom of an element
.shorten-sm {
height: 50px;
overflow: hidden;
position: relative;
}
.shorten-sm:before {
content: '';
width: 100%;
height: 100%;
@steveoh
steveoh / unused_domains.py
Last active July 11, 2020 05:33
list usused domains and fields with domain
from pprint import pprint
import arcpy
arcpy.env.workspace = r'stage.sde'
output = {}
tables = []
for dirpath, dirnames, walked_tables in arcpy.da.Walk(datatype=['FeatureClass', 'Table']):
@steveoh
steveoh / get all domains.sql
Last active March 13, 2019 16:27
get domain name/code/value from an SDE database
SELECT
cv_domain.value('DomainName[1]', 'nvarchar(50)') AS 'DomainName',
coded_value.value('Code[1]','nvarchar(50)') AS 'Code',
coded_value.value('Name[1]','nvarchar(50)') AS 'Value'
FROM
sde.GDB_ITEMS AS items INNER JOIN sde.GDB_ITEMTYPES AS itemtypes ON
items.Type = itemtypes.UUID
CROSS APPLY
items.Definition.nodes('/GPCodedValueDomain2/CodedValues/CodedValue') AS CodedValues(coded_value)
CROSS APPLY
@steveoh
steveoh / pro-addin-version.cs
Created March 28, 2018 20:54
get the version info from a pro addin
var myDocs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var arcGisProLocation = Path.Combine(myDocs, "ArcGIS", "AddIns", "ArcGISPro");
var attribute = (GuidAttribute) _assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];
var proAddinFolder = $"{{{attribute.Value}}}";
var addinFolder = Path.Combine(arcGisProLocation, proAddinFolder);
if (!Directory.Exists(addinFolder))
return null;