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
import 'types/schemas/knex-tables' | |
import { Tables } from 'knex/types/tables' | |
type TableColumns<TTableName extends keyof Tables = keyof Tables> = { | |
[T in TTableName]: (keyof Tables[T]['base'])[] | |
} | |
const deleteColumns: Partial<TableColumns> = { | |
users: ['name'], | |
} |
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
export function bigIntP(value: bigint, percentage: number, scalingFactor = 1000000000): bigint { | |
const scaledPercentage = BigInt(Math.round(percentage * 100 * scalingFactor)) | |
const result = (value * scaledPercentage) / (BigInt(100) * BigInt(scalingFactor)) | |
return result | |
} |
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
import Script from 'next/script' | |
// Add this file to some Server Component, in my case I use this in `app/layout.tsx` | |
// Next.js, will inline all the process.env.SOMETHING variables into the code at build time. | |
// Which will force us to build the app for each environment we want to deploy to, with the | |
// only different being few environment variables. Instead, what we want is to get the environment | |
// dynamically from the runtime, so if we change them in the env and run the app again, it must | |
// use the new environment variables. To do this, we will inject the environment variables into | |
// the window object, so we can access them in the runtime. |
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 9 columns, instead of 6 in line 7.
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
city 1, city 2 distance, city 2, city 3 distance, city 3, city 4 distance, city 4, city 5 distance, city5 | |
Bronx , 23 , Brooklyn , 11 , Manhattan , 18 , New York , 13 , Queens | |
Bronx , 23 , Brooklyn , 11 , Manhattan , 13 , Queens , 18 , New York | |
Bronx , 23 , Brooklyn , 18 , New York , 11 , Manhattan , 13 , Queens | |
Bronx , 23 , Brooklyn , 18 , New York , 13 , Queens , 11 , Manhattan | |
Bronx , 23 , Brooklyn , 13 , Queens , 11 , Manhattan , 18 , New York | |
Bronx , 23 , Brooklyn , 13 , Queens , 18 , New York , 11 , Manhattan | |
Bronx , 11 , Manhattan , 23 , Brooklyn , 1 |
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
const supabase = useMemo(() => { | |
return createClient( | |
process.env.NEXT_PUBLIC_SUPABASE_URL!, | |
process.env.NEXT_PUBLIC_SUPABASE_KEY!, | |
{ | |
global: { | |
headers: { | |
telegram_init_data: initDataRaw || "", | |
}, | |
}, |
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
--[[ | |
===================================================================== | |
==================== READ THIS BEFORE CONTINUING ==================== | |
===================================================================== | |
Kickstart.nvim is *not* a distribution. | |
Kickstart.nvim is a template for your own configuration. | |
The goal is that you can read every line of code, top-to-bottom, and understand |
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
import { jsonParse } from "@dataplan/json"; | |
import { access, context, lambda, listen } from "grafast"; | |
import { gql, makeExtendSchemaPlugin } from "graphile-utils"; | |
const PackagePlugin = makeExtendSchemaPlugin((build) => { | |
const { sql } = build; | |
if (!sql) { | |
throw new Error("sql not found"); | |
} |
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
import cors from "cors"; | |
import express, { Express, NextFunction } from "express"; | |
import { IncomingMessage, Server, ServerResponse } from "http"; | |
import inspector from "inspector"; | |
import { Duplex } from "stream"; | |
import { isDev, isLocal } from "./config.js"; | |
import * as middleware from "./middleware/index.js"; | |
import { firebaseAuthMiddleware } from "./middleware/installFirebaseAuth.js"; | |
import { makeShutdownActions, ShutdownAction } from "./shutdownActions.js"; |
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
import { PgSelectSingleStep } from "@dataplan/pg"; | |
import { Episode } from "@mythrillfiction/types"; | |
import { context, lambda } from "grafast"; | |
import { gql, makeExtendSchemaPlugin, makeWrapPlansPlugin, PlanWrapperFn } from "graphile-utils"; | |
import { WorkerUtils } from "graphile-worker"; | |
import _ from "lodash"; | |
import * as yup from "yup"; | |
import { SCHEMA_NAME } from "../config.js"; | |
import { adminDb } from "../firebase.js"; |
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
import { jsonParse } from "@dataplan/json"; | |
import { access, context, lambda, listen } from "grafast"; | |
import { gql, makeExtendSchemaPlugin } from "graphile-utils"; | |
import { SCHEMA_NAME } from "../config.js"; | |
/* The JSON object that `tg__graphql_subscription()` delivers via NOTIFY */ | |
interface TgGraphQLSubscriptionPayload { | |
event: string; | |
subject: string | null; |
NewerOlder