This file contains hidden or 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
create or replace function public.gen_id() | |
returns text as $$ | |
declare | |
chars text := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
max_multiple integer := floor(256 / char_length(chars)) * char_length(chars); | |
i integer; | |
auto_id text := ''; | |
target_length integer := 20; | |
bytes bytea; | |
begin |
This file contains hidden or 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 admin from "firebase-admin"; | |
import fs from "fs/promises"; | |
const serviceAccount1 = JSON.parse(await fs.readFile("./service-account-1.json")); | |
const serviceAccount2 = JSON.parse(await fs.readFile("./service-account-2.json")); | |
const admin1 = admin.initializeApp({ credential: admin.credential.cert(serviceAccount1) }, "one"); | |
const admin2 = admin.initializeApp({ credential: admin.credential.cert(serviceAccount2) }, "two"); | |
const db1 = admin1.firestore(); |
This file contains hidden or 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 Container from 'components/Container'; | |
import Text from 'components/Text'; | |
import Title from 'components/Title'; | |
import { TERMS_PRIVACY } from 'localization/constants'; | |
import { useI18n } from 'localization/helpers'; | |
import { GetServerSideProps } from 'next'; | |
import React, { FC } from 'react'; | |
import FormRow from 'sections/FormRow'; | |
import useStyles from '../screens/terms-privacy-policy/styles'; |
This file contains hidden or 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 ReplaceFieldType: Plugin = (builder) => { | |
// Process the output fields | |
builder.hook("GraphQLObjectType:fields:field", (field, build, context) => { | |
const { getTypeByName, graphql } = build; | |
const { GraphQLList, GraphQLNonNull } = graphql; | |
const { | |
scope: { pgFieldIntrospection: attr }, | |
} = context; |
This file contains hidden or 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
{ | |
"0-1": { | |
"description": "Processing center response timeout", | |
"message": "sv_unavailable" | |
}, | |
"0-100": { | |
"description": "No payment attempts", | |
"message": "no_payments_yet" | |
}, | |
"0-2000": { |
This file contains hidden or 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 { Plugin } from "graphile-build"; | |
import { | |
PgAttribute, | |
PgClass, | |
PgIntrospectionResultsByKind, | |
} from "graphile-build-pg"; | |
import { | |
embed, | |
gql, | |
makeExtendSchemaPlugin, |
This file contains hidden or 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
// RECOMMENDED: Disconnect HEROKU from Github before doing this (though not strictly necessary, I think). | |
//See https://stackoverflow.com/a/61272173/6569950 for more info. | |
// PARAMETERS | |
const TOKEN = ""; // MUST BE `repo_deployments` authorized | |
const REPO = ""; // e.g. "repository" | |
const USER_OR_ORG = ""; // e.g. "your-name" | |
// GLOBAL VARS | |
const URL = `https://api.github.com/repos/${USER_OR_ORG}/${REPO}/deployments`; |
This file contains hidden or 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 { omitBy } from "lodash"; | |
import { Plugin } from "postgraphile"; | |
export const RemoveByNodeIdPlugin: Plugin = (builder) => { | |
builder.hook("GraphQLObjectType:fields", (fields, _) => { | |
return omitBy(fields, (_, key) => key.endsWith?.("ByNodeId")); | |
}); | |
}; | |
export default RemoveByNodeIdPlugin; |
This file contains hidden or 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
#!/usr/bin/env sh | |
set -e | |
export TEST_SQL="select user || ' connection to ' || (select current_database()) || ' ✅'" | |
### GET CONNECTION DETAILS AND TEST IT | |
echo "First please provide superuser credentials and endpoint" |
This file contains hidden or 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 fs from 'fs' | |
export function getLogger (path) { | |
const stream = fs.createWriteStream(path) | |
process.on('beforeExit', () => stream.close()) | |
return msg => { | |
const _ = msg + '' | |
if (!/ select /i.test(_)) { |