Skip to content

Instantly share code, notes, and snippets.

View pedrogardim's full-sized avatar
🎯
Focusing

Pedro Gardim pedrogardim

🎯
Focusing
View GitHub Profile
@pedrogardim
pedrogardim / objectId.go
Created October 5, 2023 13:33
Golang | Generate random MongoDB ObjectId
func mongoObjectId() string {
ts := time.Now().UnixMilli() / 1000;
id := strconv.FormatInt(ts, 16)
for i := 0; i < 16; i++ {
id += fmt.Sprintf("%x", rand.Intn(16))
}
return id
}
@pedrogardim
pedrogardim / useTypingText.tsx
Created October 19, 2023 17:00
Typing text effect React hook
import { useState, useEffect } from "react";
export default function useTypingText(originalText: string, delay = 50) {
const [letterCount, setLetterCount] = useState(0);
useEffect(() => {
const interval = setInterval(() => {
setLetterCount((prev) => {
if (prev === originalText.length) {
clearInterval(interval);
{"name":"vscode-2023-12","settings":"{\"settings\":\"{\\n \\\"workbench.iconTheme\\\": \\\"material-icon-theme\\\",\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\",\\n \\\"editor.formatOnSave\\\": true,\\n \\\"git.confirmSync\\\": false,\\n \\\"git.enableSmartCommit\\\": true,\\n \\\"git.ignoreRebaseWarning\\\": true,\\n \\\"diffEditor.ignoreTrimWhitespace\\\": false,\\n \\\"terminal.integrated.defaultProfile.osx\\\": \\\"zsh\\\",\\n \\\"[html]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"vscode.html-language-features\\\"\\n },\\n \\\"editor.scrollbar.horizontal\\\": \\\"hidden\\\",\\n \\\"workbench.editor.limit.value\\\": 2,\\n \\\"window.commandCenter\\\": false,\\n \\\"workbench.layoutControl.enabled\\\": false,\\n \\\"workbench.colorTheme\\\": \\\"Moegi Dark Vitesse\\\",\\n \\\"editor.renderWhitespace\\\": \\\"none\\\",\\n \\\"breadcrumbs.enabled\\\": false,\\n \\\"editor.renderControlCharacters\\\": false,\\n \\\"workbench.editor.showTabs\\\": \\\"single\\\",\\n