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 * as toml from 'https://deno.land/std@0.207.0/toml/mod.ts'; | |
async function getStripeConfig() { | |
const { stdout } = await new Deno.Command('stripe', { | |
args: ['config', '--list'], | |
stderr: 'inherit', | |
}).output(); | |
return toml.parse(new TextDecoder().decode(stdout)) as any; | |
} |
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 memoize<Args extends unknown[], R>(f: (...args: Args) => R): (...args: Args) => R { | |
const cache = new Map(); | |
let retCache: { value: R } | undefined; | |
return (...args: Args): R => { | |
if (args.length > 0) { | |
if (!cache.has(args[0])) { | |
cache.set(args[0], memoize((...restArgs) => (f as any)(args[0], ...restArgs))); | |
} | |
return cache.get(args[0])(...args.slice(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
import graphql from 'graphql'; | |
const resp = await fetch(url, { method: 'POST', body: JSON.stringify({ query: graphql.getIntrospectionQuery() }), headers: { 'content-type': 'application/json' } }); | |
const introspectionResult = await resp.json(); | |
const schema = graphql.buildClientSchema(introspectionResult.data); | |
const sdl = graphql.printSchema(schema); |
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 { list } from '@keystone-6/core'; | |
import { graphql } from '@keystone-6/core'; | |
import { allowAll } from '@keystone-6/core/access'; | |
import { checkbox, relationship, text, timestamp } from '@keystone-6/core/fields'; | |
import { select } from '@keystone-6/core/fields'; | |
import { BaseListTypeInfo, CommonFieldConfig, FieldTypeFunc, fieldType } from '@keystone-6/core/types'; | |
interface TranslatedFieldConfig< | |
ListTypeInfo extends BaseListTypeInfo, | |
LanguageTag extends string, |
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 fetch = require('node-fetch'); | |
const util = require('util'); | |
util.inspect.defaultOptions.depth = null; | |
console.log = (...args) => { | |
return fetch('https://webhook.site/XXXXX', { | |
method: 'POST', | |
body: util.format(...args), | |
}); | |
}; |
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 { mapSchema, getDirective, MapperKind } from '@graphql-tools/utils'; | |
import { defaultFieldResolver, GraphQLError, GraphQLFieldResolver, GraphQLSchema } from 'graphql'; | |
function wrapField<Field extends { resolve?: GraphQLFieldResolver<any, any> }>(field: Field, authDirective: Record<string, any>) { | |
const { resolve = defaultFieldResolver } = field; | |
field.resolve = (src, args, ctx, info) => { | |
if (ctx.role !== authDirective.role) throw new GraphQLError(`${authDirective.role} role is needed but your role is ${ctx.role}.`); | |
return resolve(src, args, ctx, info); | |
}; |
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
echo abc | openssl rsautl -encrypt -pubin -inkey <(ssh-keygen -f <(curl https://github.com/acomagu.keys) -e -m PKCS8) | openssl rsautl -decrypt -inkey ~/.ssh/id_rsa |
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
<!DOCTYPE html> | |
<body> | |
<form method="POST" action="https://raraya:Qm3VMV7pgnAgNch2WzqWYN5kDVNLGmiNCk6nihwc8U4KwEKSmd@shop-stage.raraya.co.jp/external/ordermadeparts.php"> | |
<input type="hidden" name="apiKey" value="ZWJcQYnhM9YNS4OiVcphyDmEtNGr8rKv4qgEUKdDxGZ1WEzBnc" /> | |
<input type="hidden" name="a" value="1" /> | |
<input type="hidden" name="b" value="1" /> | |
<input type="hidden" name="c" value="1" /> | |
<input type="hidden" name="d" value="1" /> | |
<input type="hidden" name="e" value="1" /> | |
<input type="hidden" name="f" value="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 { Node, Construct } = require('constructs'); | |
class RootConstruct extends Construct { | |
onSynthesize() { | |
console.log(this.synthesize()); | |
} | |
synthesize() { | |
return Object.assign({}, | |
...Node.of(this).children.map(child => child.synthesize()), | |
); |
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
package xml_marshallable_map | |
// XMLMarshallableMap contains nestable data and implements | |
// XMLMarshaller. The actual type of interface{} part must be string or | |
// map[string]interface{}. The fields are sorted in alphabetical | |
// order and encoded. | |
type XMLMarshallableMap map[string]interface{} | |
func (m XMLMarshallableMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error { | |
if err := e.EncodeToken(start); err != nil { |
NewerOlder