Skip to content

Instantly share code, notes, and snippets.

View mgray88's full-sized avatar
:shipit:

Mike Gray mgray88

:shipit:
View GitHub Profile
@mgray88
mgray88 / api-handler.ts
Last active June 6, 2025 21:02
Expo API Routes Middleware handler
/* eslint-disable @typescript-eslint/no-empty-object-type */
import log from "@/lib/logger"; // This is using adze
// Define a base context type
type BaseContext = Record<string, any>;
// Define a middleware function type
export type Middleware<T extends BaseContext = BaseContext> = (
request: Request,
) => T | Promise<T> | void;

Keybase proof

I hereby claim:

  • I am mgray88 on github.
  • I am mgray88 (https://keybase.io/mgray88) on keybase.
  • I have a public key ASCsSoE64iG9qpWzPoo5VCJb2RMpyAu9WmkTNbuPcNkGhwo

To claim this, I am signing this object:

@mgray88
mgray88 / android-vector-drawable-to-svg.xsl
Created October 1, 2021 14:29 — forked from ok3141/android-vector-drawable-to-svg.xsl
Convert Android Vector Drawable to SVG with XSLT
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<svg xmlns="http://www.w3.org/2000/svg">
<xsl:attribute name="width">
<xsl:value-of select="substring-before(vector/@width, 'dp')"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="substring-before(vector/@height, 'dp')"/>
</xsl:attribute>
@mgray88
mgray88 / SortedDifference.kt
Created January 5, 2021 21:10
A general sequence diffing algorithm, with a very specific purpose
// Imitated from https://github.com/groue/SortedDifference
class SortedDifference<LeftSequence: Collection<LeftElement>, RightSequence: Collection<RightElement>, LeftElement, RightElement, ID: Comparable<ID>>(
private val left: LeftSequence,
private val leftID: (LeftElement) -> ID,
private val right: RightSequence,
private val rightID: (RightElement) -> ID
) : Iterable<SortedDifferenceChange<LeftElement, RightElement>> {
override fun iterator(): Iterator {
return Iterator(