-
Log all commits that add/delete the
search_string
in the repogit log -S search_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
import { describe, expect, test } from "bun:test"; | |
import { m } from "./utils"; | |
describe("utils", () => { | |
describe("m", () => { | |
test("message", () => { | |
const commit = m`Hello, world!`; | |
expect(commit.subject).toBe("Hello, world!"); | |
expect(commit.body).toBeUndefined(); | |
}); |
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" | |
"testing" | |
) | |
type memo = map[int]bool | |
func mCanSum(target int, numbers []int, m memo) bool { |
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 randomAvailablePort(): number { | |
const server = Bun.serve({ fetch: () => new Response(), port: 0 }); | |
const port = server.port; | |
server.stop(true); | |
return port; | |
} |
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
#!/usr/bin/env bash | |
# https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425 | |
set -euo pipefail | |
DEBUG=${DEBUG:-} | |
PWD=$(pwd) | |
SCRIPT_DIR=$(dirname "$0") | |
if [ -n "$DEBUG" ]; then |
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
Show hidden characters
{ | |
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json", | |
"organizeImports": { | |
"enabled": true | |
}, | |
"vcs": { | |
"enabled": true, | |
"root": ".", | |
"clientKind": "git", | |
"useIgnoreFile": true |
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
Java 6 hrs 38 mins ███████▍░░░░░░░░░░░░░ 35.6% | |
sh 5 hrs 52 mins ██████▌░░░░░░░░░░░░░░ 31.5% | |
YAML 3 hrs 27 mins ███▉░░░░░░░░░░░░░░░░░ 18.5% | |
TypeScript 47 mins ▉░░░░░░░░░░░░░░░░░░░░ 4.2% | |
.env file 28 mins ▌░░░░░░░░░░░░░░░░░░░░ 2.5% |
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
/** | |
* Join string class names and ignore falsy values. | |
* | |
* ### Example | |
* | |
* ```tsx | |
* <div className={`class1 class2 class3 ${condition ? 'class4' : ''} ${data ? 'class5' : ''}`} /> | |
* // becomes | |
* <div | |
* className={classNames( |
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
// @ts-check | |
const build = () => process.exit(1); | |
const noBuild = () => process.exit(0); | |
const { | |
VERCEL, // An indicator that the app is deployed and running on Vercel. Example: 1. | |
CI, // An indicator that the code is running in a Continuous Integration environment. Example: 1. NOTE: This Variable is only exposed during Build Step. | |
VERCEL_ENV, // The Environment that the app is deployed an running on. The value can be either production, preview, or development. | |
VERCEL_URL, // The URL of the deployment. Example: my-site-7q03y4pi5.vercel.app |
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 { useCallback, useRef, useState } from 'react'; | |
export function useArray(initialState = []) { | |
const { current: originalState } = useRef(initialState); | |
const [array, setArray] = useState(initialState); | |
const setAt = useCallback( | |
(index, value) => { | |
const newArray = array.slice(); | |
newArray[index] = value; |
NewerOlder