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
export function pemToBinary(pem: string): Uint8Array { | |
return decodeBase64(pem.replace(/-+(BEGIN|END).*/g, '').replace(/\s/g, '')) | |
} |
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 <objc/runtime.h> | |
void dumpClass(Class clz) { | |
unsigned int instanceMethodCount = 0; | |
printf("Found %d instance methods on '%s'\n", instanceMethodCount, class_getName(clz)); | |
Method *instanceMethods = class_copyMethodList(clz, &instanceMethodCount); | |
for (unsigned int i = 0; i < instanceMethodCount; i++) { | |
Method method = instanceMethods[i]; |
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 main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
"strings" | |
"time" | |
) |
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
module github.com/Code-Hex/slack2discord | |
go 1.18 | |
require ( | |
github.com/Code-Hex/dd v1.1.0 // indirect | |
github.com/bwmarrin/discordgo v0.25.0 // indirect | |
github.com/gorilla/websocket v1.4.2 // indirect | |
github.com/slack-go/slack v0.11.2 // indirect | |
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect |
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 Worker Syntax で書いてます | |
// addEventListener('fetch', event => { | |
// event.respondWith(handleRequest(event.request)); | |
// }); | |
// Module Worker Syntax で書いてます | |
// async function handleRequest(request) { | |
// return new Response('Hello worker!', { | |
// headers: { 'content-type': 'text/plain' }, | |
// }); |
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
addEventListener('fetch', (event: FetchEvent) => { | |
// @ts-ignore | |
console.log({ ...global }) | |
event.respondWith(verifyJWT(event.request)) | |
}) |
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 useIntersectionObserver = () => { | |
const headingElementsRef = useRef<Record<string, IntersectionObserverEntry>>( | |
{} | |
); | |
useEffect(() => { | |
const callback = (headings: Array<IntersectionObserverEntry>) => { | |
headingElementsRef.current = headings.reduce((map, headingElement) => { | |
map[headingElement.target.id] = headingElement; | |
return map; | |
}, headingElementsRef.current); |
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 bit | |
import ( | |
"math" | |
"testing" | |
) | |
// SignExtend は a の値を bitSize で指定される値を解釈し、変換したものを返します。 | |
// a の値は 32bit 以下の任意のbitSizeの値が入ってくる可能性があります。 | |
// unsignedが入ってくる可能性は考慮されていません。(仕様外) |
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 cheerio = require('cheerio'); | |
const fetch = require('node-fetch'); | |
const fs = require('fs'); | |
// roles["roles/accesscontextmanager.policyAdmin"]["en"] | |
const roles = {}; | |
async function makePredefinedRoles(locale) { | |
const response = await fetch( | |
`https://cloud.google.com/iam/docs/understanding-roles?hl=${locale}` |
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
module github.com/Code-Hex/gql-filter | |
go 1.16 | |
require ( | |
github.com/graphql-go/graphql v0.7.9 // indirect | |
github.com/k0kubun/pp v3.0.1+incompatible // indirect | |
github.com/mattn/go-colorable v0.1.8 // indirect | |
) |
NewerOlder