View msw-to-intercept-connector.ts
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 type { SetupWorkerApi } from 'msw' | |
export function connectWorkerToCypressIntercept(worker: SetupWorkerApi): void { | |
worker.events.on('request:start', request => { | |
if (!(window as any).cy) return | |
const cy = (window as any).cy | |
const mapping = Object.values(cy.state('routes')).map((route: any) => ({ | |
alias: route.alias, | |
method: route.options.method, | |
matcher: new RegExp( |
View RawSocketSender.kt
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 com.mycompany.service.fluentd | |
// this class is a fork of the fluent-logger-java library | |
import org.msgpack.core.MessagePack | |
import java.io.BufferedOutputStream | |
import java.io.IOException | |
import java.math.BigInteger | |
import java.net.InetSocketAddress | |
import java.net.Socket |
View CustomLogbackSystemFactory.kt
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 com.company.myservice.tool | |
import ch.qos.logback.classic.Level | |
import ch.qos.logback.classic.Logger | |
import ch.qos.logback.classic.LoggerContext | |
import ch.qos.logback.classic.joran.JoranConfigurator | |
import ch.qos.logback.classic.turbo.TurboFilter | |
import ch.qos.logback.core.spi.FilterReply | |
import ch.qos.logback.core.status.Status | |
import ch.qos.logback.core.status.StatusUtil |
View playground.tsx
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 React from "react"; | |
import { promises as fs } from "fs"; | |
import * as myDesignSystem from "my-design-system"; | |
import { LiveProvider, LiveError, LivePreview, LiveContext } from "react-live"; | |
import dynamic from "next/dynamic"; | |
let monaco: any = undefined; | |
const MonacoEditor: typeof import("react-monaco-editor").default = | |
(typeof global.window === 'undefined') ? undefined : dynamic(import("react-monaco-editor") | |
.then((mod) => { |
View add-mjs-extension-transformer.js
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 typescript = require("typescript"); | |
const path = require("path"); | |
module.exports = (_) => (transformationContext) => (sourceFile) => { | |
function visitNode(node) { | |
if (shouldMutateModuleSpecifier(node)) { | |
const factory = transformationContext.factory; | |
if (typescript.isImportDeclaration(node)) { | |
const newModuleSpecifier = factory.createStringLiteral(`${node.moduleSpecifier.text}.mjs`); | |
node = factory.updateImportDeclaration(node, node.decorators, node.modifiers, | |
node.importClause, newModuleSpecifier, node.assertClause); |
View get-string.ts
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
/** | |
* Reads a string from the memory table. | |
* When a web assembly returns a string, javascript only sees the pointer | |
* to the memory table, and has to read the value from the table. | |
* | |
* @param instance web assembly program instance (memory + code) | |
* @param pointer where does the string start in the memory table | |
* @returns a slice of the memory table starting from pointer and ending before \0 | |
*/ | |
export const getString = (instance: WebAssembly.Instance, pointer: number): string => { |
View [page].tsx
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 React from "react"; | |
import { promises as fs } from "fs"; | |
import { resolve } from "path"; | |
import matter from "gray-matter"; | |
import { MDXRemote } from "next-mdx-remote"; | |
import { serialize } from "next-mdx-remote/serialize"; | |
type PageProps = { documentProps: { | |
menu: Record<string, string>[]; | |
frontMatter: { |
View GrpcConfiguration.kt
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 com.company.service.configuration | |
import com.google.protobuf.MessageLite | |
import io.grpc.BindableService | |
import io.grpc.Channel | |
import io.grpc.netty.NettyChannelBuilder | |
import io.netty.handler.ssl.ApplicationProtocolConfig | |
import io.netty.handler.ssl.ApplicationProtocolConfig.Protocol.ALPN | |
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT | |
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE |
View Helpers.kt
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 com.mycompany.react | |
import org.w3c.dom.html.HTMLElement | |
import java.lang.reflect.InvocationHandler | |
import java.lang.reflect.Method | |
import java.lang.reflect.Proxy | |
import kotlin.reflect.KClass | |
import kotlin.reflect.KType | |
import kotlin.reflect.full.createType | |
import kotlin.reflect.full.isSubtypeOf |
View LoadYaml.kt
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 com.mycompany.library.tools | |
import org.springframework.boot.env.YamlPropertySourceLoader | |
import org.springframework.core.env.ConfigurableEnvironment | |
import org.springframework.core.env.Profiles | |
import org.springframework.core.io.ClassPathResource | |
object LoadYaml { | |
data class LoadOptions( |
NewerOlder