function dfs(graph, start) {
const stack = [start];
const visited = new Set();
const result = [];
while (stack.length) {
const vertex = stack.pop();
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
| // DeepPartial with Mapped Types | |
| type DeepPartial<T> = { | |
| [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]>: T[P]; | |
| }; | |
| // Example | |
| type User = { | |
| name: string; | |
| address: { | |
| street: string; |
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 MutableRefObject, type RefCallback } from 'react'; | |
| type MutableRefList<T> = Array<RefCallback<T> | MutableRefObject<T> | undefined | null>; | |
| export function mergeRefs<T>(...refs: MutableRefList<T>): RefCallback<T> { | |
| return (val: T) => { | |
| setRef(val, ...refs); | |
| }; | |
| } |
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
| { | |
| // Editor Configurations | |
| "editor.fontSize": 12, | |
| "editor.fontFamily": "Fira Code", | |
| "editor.rulers": [100,130], | |
| "editor.tabSize": 2, | |
| "editor.parameterHints.enabled": false, | |
| "editor.renderLineHighlight": "gutter", | |
| "editor.lineHeight": 26, | |
| "editor.suggestSelection": "first", |
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
| # If you come from bash you might have to change your $PATH. | |
| # export PATH=$HOME/bin:/usr/local/bin:$PATH | |
| # Path to your oh-my-zsh installation. | |
| export ZSH="$HOME/.oh-my-zsh" | |
| #Add .NET to $PATH | |
| export DOTNET_ROOT=$HOME/.dotnet | |
| export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools |
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
| // npm install googleapis@105 @google-cloud/[email protected] --save | |
| const fs = require('fs'); | |
| const fsp = fs.promises; | |
| const path = require('path'); | |
| const process = require('process'); | |
| const {authenticate} = require('@google-cloud/local-auth'); | |
| const {google} = require('googleapis'); |
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 { Switch, Case, Default } from '@/components/conditional-switch' | |
| export default function MyComponent({ goal }) { | |
| return ( | |
| <Switch> | |
| <Case conditional={goal < 30}>Case 1</Case> | |
| <Case conditional={goal >= 30}>Case 2</Case> | |
| <Case conditional={goal >= 60}>Case 3</Case> | |
| <Default>Default Case</Default> | |
| </Switch> |
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
| const moment = require("moment"); | |
| const fs = require("fs"); | |
| let calendar = []; | |
| const today = moment(); | |
| const startDay = today.clone().startOf("month").startOf("week"); | |
| const endDay = today.clone().endOf("month").endOf("week"); | |
| let date = startDay.clone().subtract(1, "day"); |
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
| $remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '" | |
| $found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'; | |
| if( $found ){ | |
| $remoteport = $matches[0]; | |
| } else{ | |
| echo "The Script Exited, the ip address of WSL 2 cannot be found"; | |
| exit; | |
| } |
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
| docker run -d --name database-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e TZ=America/Sao_Paulo mysql:5.7.31 --default-authentication-plugin=mysql_native_password --sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER --explicit_defaults_for_timestamp |
NewerOlder