Skip to content

Instantly share code, notes, and snippets.

@gotenxds
gotenxds / x.js
Created September 17, 2020 10:27
import pg from 'pg';
import { ApolloServer } from 'apollo-server';
import { makeSchemaAndPlugin } from 'postgraphile-apollo-server';
export default async () => {
const pgPool = new pg.Pool({
"user": "postgres",
"database": "postgres",
"password": "secret",
"host": "localhost"
allAccounts
{
nodes {
companyId: company
companyByCompany {
name
id
}
}
}
{
allAccounts(first: 10, offset: 20, condition:{ company: 1 })
{
nodes {
companyId: company
companyByCompany {
name
id
}
}
async function rainSomeCatsAndDogs() {
const [dogs, cats] = await Promise.all([getDogs(), getCats()]);
 
await makeItRain(cats, dogs);
openAnimalProffUmbrella();
}
async function rainSomeCatsAndDogs() {
const [dogs, cats] = await Promise.all([getDogs(), getCats()]);
 
await makeItRain(cats, dogs);
await openAnimalProffUmbrella();
}
async function rainSomeCatsAndDogs() {
  const dogsPromise = getDogs();
  const catsPromise = getCats();
  const [dogs, cats] = [await dogsPromise, await catsPromise];
 
await makeItRain(cats, dogs);
  await openAnimalProffUmbrella();
}
async function rainSomeCatsAndDogs() {
  const [dogs, cats] = await Promise.all([getDogs(), getCats()]);
 
  await makeItRain(cats, dogs);
  await openAnimalProffUmbrella();
}
async function rainSomeCatsAndDogs() {
  const dogs = await getDogs();
  const cats = await getCats();
await makeItRain(cats, dogs);
  await openAnimalProffUmbrella();
}
@gotenxds
gotenxds / 3.js
Last active January 19, 2018 21:02
function rainSomeCatsAndDogs(){
  return Promise.all([getDogs(), getCats()])
.then([dogs, cats] => makeItRain(cats, dogs))
  .then(openAnimalProffUmbrella);
}
async function doStuff(){
try {
  return await rainSomeCatsAndDogs();
  } catch(someCatsAndDogs) {
  // do something;
  }
}