Skip to content

Instantly share code, notes, and snippets.

// based on: https://github.com/brianc/node-postgres/blob/a536afb1a8baa6d584bd460e7c1286d75bb36fe3/lib/client.js#L275-L299
function safeText(str: string) {
let hasBackslash = false;
let escaped = `'`;
for (const c of normalizeUnicode(str)) {
if (c === `'`) {
escaped += c + c;
} else if (c === `\\`) {
escaped += c + c;
import leven from 'leven';
import {Result, error, ErrorResult} from './ParserTypes';
export default class StringInput {
public readonly index: number;
public readonly value: string;
constructor(index: number, value: string) {
this.index = index;
this.value = value;
}
{
"dependencies": {
"@databases/pg-test": "^0.0.1",
"jest": "^24.1.0"
},
"pg": {
"test": {
"migrationsScript": ["yarn", "migrations", "up"]
}
},

Getting Started

Install the GitHub App

To get started, you will need to install the GitHub App. This allows us to detect pull requests, comment on your pull requests with a preview of the change log, update build statuses, and trigger GitHub actions workflows if you use them for releases.

INSTALL CTA GOES HERE

**Selector to choose between GitHub actions and Circel CI, styled somethign like https://twitter.com/steveschoger/status/1024720091546562560/photo/1 **

# Config for graphql-code-generator
schema: ./schema.graphql
overwrite: true
generates:
./__generated__/types.ts:
plugins:
- add: '/* tslint:disable */'
- add: '// This file was automatically generated and should not be edited.'
- add: import ResolverContext from '../ResolverContext';
<style>
main {
width: 100%;
display: flex;
}
.column {
flex-basis: 0;
flex-grow: 1;
}
img {
@ForbesLindesay
ForbesLindesay / settings.json
Created September 14, 2018 10:56
VSCode Settings
{
"editor.fontFamily": "FiraCode-Regular, Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
"window.zoomLevel": 4,
"editor.formatOnSave": true,
"[html]": {
"editor.formatOnSave": false
},
"[json]": {
"editor.formatOnSave": false

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@ForbesLindesay
ForbesLindesay / iter.js
Last active October 20, 2017 18:11 — forked from nanot1m/iter.js
Push iterator
const Queue = require('then-queue'); // async queue that doesn't care what order you call push and pop.
const queue = new Queue();
// push sends to the first waiting `pop` if available, otherwise it acts as a buffer
listenToNewMessages(message => queue.push(message));
async function* MessagesGenerator() {
try {
while (true) {
type Children = {
children: void | Array<Children>
message: [MessageBlame, MessageBlame, MessageBlame, MessageBlame, MessageComment, MessageBlame]
};
type Extra = {
children: void | Array<Children>
message: [MessageBlame, MessageBlame, MessageBlame, MessageBlame, MessageComment, MessageBlame] | [MessageBlame, MessageBlame]
};
type FlowErrorDuplicateProvider = {
kind: "duplicate provider"