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
for file in *; do | |
# Check if the file name contains spaces | |
if [[ "$file" == *" "* ]]; then | |
# Replace spaces with dots and rename the file | |
new_name=$(echo "$file" | tr ' ' '.') | |
mv "$file" "$new_name" | |
echo "Renamed '$file' to '$new_name'" | |
fi | |
done |
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
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Attach to Node", | |
"port": 9229, | |
"request": "attach", |
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 express, { Request, Response } from 'express'; | |
import z, { AnyZodObject, ZodError } from 'zod'; | |
import { generateError } from 'zod-error'; | |
const app = express(); | |
const mySchema = z.object({ | |
body: z.object({ | |
name: z.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
#!/bin/bash | |
randomScreenShotName="$RANDOM.png" | |
screenShotPath="/tmp/$randomScreenShotName" | |
screencapture $screenShotPath | |
screenShotDir="$HOME/screenshots/$(date +"%Y-%m-%d")" | |
if ! [ -d $screenShotDir ]; then | |
mkdir -p $screenShotDir |
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
-- HTML | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title></title> | |
</head> | |
<body> |
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 z from 'zod'; | |
const LocalStorageSchema = z.object({ | |
name: z.string(), | |
age: z.number(), | |
isEmployed: z.boolean(), | |
}); | |
type LocalStorageData = z.infer<typeof LocalStorageSchema>; |
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
<img | |
referrerpolicy="no-referrer" | |
src="link-to-image" | |
/> |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Attach to Node", | |
"port": 9229, | |
"request": "attach", | |
"skipFiles": ["<node_internals>/**"], | |
"envFile": "${workspaceFolder}/.env", | |
"type": "node" |
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
#!/bin/bash | |
function ss() { | |
local screenName="$1" | |
if [ -z "$screenName" ]; then | |
echo "No service name provided." | |
exit 1 | |
fi | |
local isScreenRunning=$(screen -ls | grep -ciw "$screenName") |
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
type Listener<Args extends Array<any>> = (...args: Args) => void; | |
class MyEmitter<EventMap extends Record<string, Array<any>>> { | |
private eventListeners: { | |
[K in keyof EventMap]?: Set<Listener<EventMap[K]>>; | |
} = {}; | |
constructor() {} | |
on<K extends keyof EventMap>( |
NewerOlder