Skip to content

Instantly share code, notes, and snippets.

View emireadcode's full-sized avatar

Tamunoemi Amachree emireadcode

View GitHub Profile
@emireadcode
emireadcode / paths-of.ts
Created February 23, 2024 16:17 — forked from steven-schmoll-at/paths-of.ts
A typescript type to extract the keys and sub-keys of objects as dot separated paths.
type CombineAll<T> = T extends {[name in keyof T]: infer Type} ? Type : never
type PropertyNameMap<T, IncludeIntermediate extends boolean> = {
[name in keyof T]: T[name] extends object ? (
SubPathsOf<name, T, IncludeIntermediate> | (IncludeIntermediate extends true ? name : never)
) : name
}
type SubPathsOf<key extends keyof T, T, IncludeIntermediate extends boolean> = (
`${string & key}.${string & PathsOf<T[key], IncludeIntermediate>}`
@emireadcode
emireadcode / Event-stream based GraphQL subscriptions.md
Created March 27, 2023 14:32 — forked from OlegIlyenko/Event-stream based GraphQL subscriptions.md
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

SELECT
polygons.*,
COUNT(points.*)
FROM polygons, points
WHERE ST_Intersects(points.the_geom, polygons.the_geom)
import pandas as pd
from geopandas import GeoDataFrame, points_from_xy
import geopandas as gpd
import time
# Load the Uber point data
df = pd.read_csv('uber_all.csv')
# Create the GeoDataFrame and assign the proper projection
@emireadcode
emireadcode / spatial_sql.sql
Created January 8, 2023 11:31 — forked from mbforr/spatial_sql.sql
Example Spatial SQL Post
-- written for PostGIS
-- table states is US State Polygons
-- table capitals are US State Capital points
select
a.name,
a.id,
-- create a centroid of the state polygon
WITH
buildings AS (
SELECT
id,
latitude,
longitude,
username,
osm_timestamp,
FROM
`bigquery-public-data.geo_openstreetmap.planet_nodes`
@emireadcode
emireadcode / select.sql
Created January 8, 2023 11:30 — forked from mbforr/select.sql
Spatial SQL - select
select
*
from
`bigquery-public-data.geo_us_boundaries.states`
@emireadcode
emireadcode / select_columns.sql
Created January 8, 2023 11:29 — forked from mbforr/select_columns.sql
Spatial SQL - select columns
select
state_geom, state_name, state
from
`bigquery-public-data.geo_us_boundaries.states`
@emireadcode
emireadcode / select_all.sql
Last active January 8, 2023 11:29 — forked from mbforr/select_all.sql
Spatial SQL - Basic Query
select
*
from bigquery-public-data.geo_us_boundaries.state
select
state_geom, state_name, state
from
`bigquery-public-data.geo_us_boundaries.states`
limit 10