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
| --- | |
| // src/components/ProgressBar.astro | |
| --- | |
| <div id="top-progress-bar"></div> | |
| <style is:global> | |
| #top-progress-bar { | |
| position: fixed; | |
| top: 0; |
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 { ClientRouter } from "astro:transitions"; | |
| --- | |
| <ClientRouter /> | |
| <script> | |
| import { pathCache } from "./path-cache"; | |
| document.addEventListener("astro:before-preparation", (ev) => { |
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 type { z } from "astro/zod"; | |
| type ExtractParams<T extends string> = | |
| T extends `${string}[${infer Param}]${infer Rest}` | |
| ? { [K in Param | keyof ExtractParams<Rest>]: string } | |
| : {}; | |
| type IsEmptyObject<T> = keyof T extends never ? true : false; | |
| type HrefArgs<T extends string, S extends z.ZodTypeAny | undefined> = |
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 { Semaphore } from "es-toolkit"; | |
| const totalCpuCores = 8; // TODO: Should be set to total number of cpu cores | |
| const totalClients = Math.ceil(totalCpuCores * 1.5); // We want to have more clients than the number of cpu cores to avoid starvation | |
| const lock = new Semaphore(totalClients); | |
| class RpcClient { | |
| createAccount(name: string): Promise<string> { | |
| return Promise.resolve(`Account ${name} created`); |
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
| package main | |
| import ( | |
| "errors" | |
| "sync" | |
| "time" | |
| ) | |
| func main() { | |
| sm := NewSyncedMessage("abc") |
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
| 'use strict'; | |
| const f = require('from'); | |
| const t = require('through'); | |
| const pokemons = f(['charmander', 'bulbasaur', 'squirtle']); | |
| const evolve = t((pokemon) => { | |
| 'use strict'; | |
| let evolvedPokemon = pokemon; |
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
| defmodule P2 do | |
| def num_to_list(mx) do | |
| if mx > 1 do | |
| Enum.reduce(1..mx, fn (x, acc) -> "#{acc},#{x}" end) | |
| else | |
| "#{mx}" | |
| end | |
| end |
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
| defmodule P2 do | |
| def num_to_list(mx) when mx > 1 do | |
| num_to_list(mx, mx - 1) | |
| end | |
| def num_to_list(mx) do | |
| "#{mx}" | |
| end |
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
| package main | |
| import ( | |
| "fmt" | |
| "strconv" | |
| ) | |
| type Power struct { | |
| up 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
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "os" | |
| ) | |
| func main() { | |
| f, err := os.Open("./temp") |
NewerOlder