This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Name: Deep URL decode | |
// Description: Sometimes you want to know what inside a URL, use this to show as a deep json... | |
import "@johnlindquist/kit" | |
const decode = (str: string) => decodeURIComponent((str + '').replace(/\+/g, '%20')) | |
function getParamsFromUrl(url: string): Record<string, string> | void { | |
if (url.startsWith("https%")) return getParamsFromUrl(decode(url)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Name: Deep URL decode | |
// Description: Sometimes you want to know what inside a URL, use this to show as a deep json... | |
// Example url: https://google.com/notify/messages/1295812905/click?signature=fake_signature_id&url=https%3A%2F%2Fgoogle.com%2Fusers%2Flink%2FZW1hbnVlbC5-9AF80a98fg8vbQ%3D%3DMTY3NDQzMjg2NA%3D%3D6a8f74a552%3Fredirect_to%3Dhttps%253A%252F%252Fgoogle.com%252Fteam%252F832678%252Fincidents%252F331734795%26utm_source%3Descalation_mailer%26utm_medium%3Demail%26utm_campaign%3Dresolved | |
import "@johnlindquist/kit" | |
const decode = (str: string) => decodeURIComponent((str + '').replace(/\+/g, '%20')) | |
function getParamsFromUrl(url: string): Record<string, string> | void { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Name: Deep URL decode | |
// Description: Sometimes you want to know what inside a URL, use this to show as a deep json... | |
import "@johnlindquist/kit"; | |
const decode = (str: string) => decodeURIComponent((str + '').replace(/\+/g, '%20')) | |
function getParamsFromUrl(url: string): Record<string, string> | void { | |
if (url.startsWith("https%")) return getParamsFromUrl(decode(url)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Raw Query | |
const getUnnacentPersonIdsByNameOrNickname = async (text?: string | null) => { | |
if (!text) return [] | |
// Search accent case with View | |
const unnacentLower = (str: string) => | |
str | |
.normalize('NFD') | |
.replace(/[\u0300-\u036f]/g, '') | |
.toLocaleLowerCase() | |
const nameWhere = `unaccent(lower(name)) ilike '%${unnacentLower( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Idea from https://github.com/hayes/pothos/issues/1349 | |
import { builder } from '@/schema/builder' | |
import { pubsub } from '@/pubsub' | |
import { withFilter } from 'graphql-subscriptions' | |
import { queryFromInfo } from '@pothos/plugin-prisma' | |
import crypto from 'crypto' | |
import { Context } from '@/context' | |
import { prisma } from '@orm/db' |
OlderNewer