Skip to content

Instantly share code, notes, and snippets.

View steveoh's full-sized avatar
🚀

steveoh steveoh

🚀
View GitHub Profile
@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'
{
"lighthouseVersion": "9.6.8",
"requestedUrl": "https://plss.utah.gov/",
"finalUrl": "https://plss.utah.gov/",
"fetchTime": "2023-01-19T16:49:35.063Z",
"gatherMode": "navigation",
"runWarnings": [
"There may be stored data affecting loading performance in this location: IndexedDB. Audit this page in an incognito window to prevent those resources from affecting your scores."
],
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
@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
@steveoh
steveoh / module-main.tf
Last active November 24, 2021 19:11
GitHub Workflow Identity Federation Terraform module
module "gcp_services" {
source = "../gcp-services"
project_id = var.project_id
services = [
"cloudresourcemanager.googleapis.com",
"iam.googleapis.com",
"iamcredentials.googleapis.com",
"sts.googleapis.com"
]
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

[
{
"request_count": "9590125",
"search_table": "sgid10.boundaries.municipalities"
},
{
"request_count": "9509793",
"search_table": "sgid10.location.zipplus4points"
},
{
@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 / react-refactorings-map.js
Last active June 5, 2019 22:21
common react refactorings... removing duplication with `map`
export default () => {
const [active, setActive] = useState('agent');
return (
<div fluid className="filter-selector">
<ButtonGroup>
<Button color={active === 'agent' ? 'warning' : 'secondary'} onClick={() => setActive('agent')}>Agent</Button>
<Button color={active === 'offender' ? 'warning' : 'secondary'} onClick={() => setActive('offender')}>Offender</Button>
<Button color={active === 'location' ? 'warning' : 'secondary'} onClick={() => setActive('location')}>Location</Button>
<Button color={active === 'date' ? 'warning' : 'secondary'} onClick={() => setActive('date')}>Date</Button>