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
{ | |
"data": { | |
"__schema": { | |
"queryType": { | |
"name": "QueryRoot" | |
}, | |
"mutationType": { | |
"name": "Mutation" | |
}, | |
"subscriptionType": null, |
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 _ from "lodash"; | |
export function addParent(schema) { | |
function extractFields(type) { | |
// no need to inspect circular types any further | |
if (type.type === "[Circular]") return [type]; | |
// same with scalars and enums | |
if (_.includes(["SCALAR", "ENUM"], type.kind && type.kind)) return []; | |
if ( |
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
type Author { | |
firstName: String @deprecated | |
id: Int! @deprecated(reason: "Thrown away") | |
lastName: String | |
posts: [Post!]! | |
} | |
type Comment { | |
comment: String! | |
id: Int! |
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
{ | |
types: { | |
'TYPE::Author': { | |
kind: 'OBJECT', | |
name: 'Author', | |
description: 'A blog author', | |
interfaces: [], | |
fields: { | |
id: { | |
name: 'id', |
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 {SignJWT, jwtVerify, type JWTPayload} from 'jose'; | |
export async function sign(payload: Token, secret: string): Promise<string> { | |
const iat = Math.floor(Date.now() / 1000); | |
const exp = iat + 60* 60; // one hour | |
return new SignJWT({...payload}) | |
.setProtectedHeader({alg: 'HS256', typ: 'JWT'}) | |
.setExpirationTime(exp) | |
.setIssuedAt(iat) |
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
# The origin of this script is https://gist.github.com/iambchan/273219729eb88155e11672c4ccac72b3 | |
# as linked in the blog post https://building.kickstarter.com/how-to-konmari-your-git-repo-474907a29d2e | |
# I applied two changes: a fix for cursor loop and add multiple dates for the PR for better reporting | |
require 'http' | |
require 'date' | |
REPOSITORY_OWNER = "" | |
REPOSITORY_NAME = "" | |
REFS_PREFIX = "refs/heads/" |
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 Foundation | |
extension String { | |
func index(from: Int) -> Index { | |
return self.index(startIndex, offsetBy: from) | |
} | |
func substring(from: Int) -> String { | |
let fromIndex = index(from: from) | |
return String(self[fromIndex...]) |