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
":" //#;exec /usr/bin/env node --input-type=module - $@<$0 | |
import process from 'process' | |
const { argv } = process | |
console.log(argv) |
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 unified = require('unified') | |
const parseMarkdown = require('remark-parse') | |
const parseHtml = require('rehype-parse') | |
const remark2rehype = require('remark-rehype') | |
const rehype2remark = require('rehype-remark') | |
const rehypeStringify = require('rehype-stringify') | |
const visit = require('unist-util-visit') | |
async function go() { | |
const inputString = ` |
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
/* eslint-disable no-undef */ | |
const axios = require("axios"); | |
const { | |
STAGE: stage, | |
APPLICATION: application, | |
ENVIRONMENT: environment, | |
CONFIGURATION: configuration, | |
} = process.env; |
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
service: serverless-feature-flag | |
provider: | |
name: aws | |
runtime: nodejs12.x | |
lambdaHashingVersion: 20201221 | |
memorySize: 128 | |
stage: ${opt:stage, 'develop'} | |
region: eu-west-1 | |
apiGateway: | |
shouldStartNameWithService: true |
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
/** @typedef {import("graphql-config").IGraphQLConfig} IGraphQLConfig */ | |
const {loadEnvConfig} = require('@next/env'); | |
loadEnvConfig(__dirname, true); | |
/** @type IGraphQLConfig */ | |
const config = { | |
schema: process.env.GRAPHCMS_ENDPOINT, | |
extensions: { |
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
type MarkUndefinable<A, B> = { | |
[K in keyof A]: A[K] extends O.Object | |
? MarkUndefinable<A[K], A.At<B, K>> | |
: K extends keyof B ? A[K] | undefined : A[K] | |
} | |
type UnionizeDeep<A extends object, B extends object> = | |
O.Merge<MarkUndefinable<A, B>, B, 'deep', M.BuiltIn, undefined> | |
type test = A.Compute<UnionizeDeep<{ |
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
function httpFiFoRequestsExecutor({ | |
onTaskSuccess, | |
onTaskFail, | |
}) { | |
async function* execute(taskInfos, props) { | |
const { | |
taskIdentifier, | |
taskFn | |
} = taskInfos || {}; | |
try { |
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 {spawnSync} = require('child_process') | |
const inquirer = require('inquirer') | |
const glob = require('glob') | |
async function go() { | |
const files = glob | |
.sync('src/+(exercise|final)/*.+(js|ts|tsx)', { | |
ignore: ['*.d.ts'], | |
}) | |
.map(f => f.replace(/^src\//, '')) |
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
MIT License | |
Copyright (c) 2021 Daniel Ethridge | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
// three indices to efficiently support all lookups | |
function createDB() { | |
return {eav: new Map(), | |
ave: new Map(), | |
vea: new Map()}; | |
} | |
function addToIndex(xs, x, y, z, triple) { | |
let ys = xs.get(x); | |
if(ys == undefined) { |