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
| function ChatScroller(props) { | |
| const ref = useRef() | |
| const shouldScrollRef = useRef(true) | |
| useEffect(()=> { | |
| if (shouldScrollRef.current) { | |
| const node = ref.current | |
| node.scrollTop = node.scrollheight | |
| } | |
| }) | |
| const handleScroll = () => { |
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 React, { useState, useEffect, useContext, createContext } from 'react' | |
| import firebase from './firebase' | |
| const AuthContext = createContext() | |
| export const AuthProvider = ({ children }) => { | |
| const auth = useProvideAuth() | |
| return <AuthContext.Provider value={auth}>{children}</AuthContext.Provider> | |
| } |
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 { | |
| Box, | |
| Flex, | |
| Image, | |
| Link, | |
| IconButton, | |
| Button, | |
| Heading, | |
| Icon, | |
| HStack, |
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 { onMounted, ref } from 'vue'; | |
| export default function useTextToSpeech() { | |
| const isLoading = ref(true); | |
| const isSupported = ref(null); | |
| const supportedVoices = ref([]); | |
| const message = ref(null); | |
| const checkIfSupported = () => { | |
| isLoading.value = true; |
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 { watch, ref } from "vue"; | |
| const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition; | |
| const recognition = new SpeechRecognition(); | |
| recognition.continuous = true; | |
| recognition.interimResults = true; | |
| recognition.lang = "en-US"; | |
| export default function useSpeechRecognition() { |
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
| [{ | |
| "id": 1, | |
| "name": { | |
| "english": "Bulbasaur", | |
| "japanese": "フシギダネ", | |
| "chinese": "妙蛙种子", | |
| "french": "Bulbizarre" | |
| }, | |
| "type": [ | |
| "Grass", |
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 { useSWRInfinite } from 'swr'; | |
| const fetcher = (url) => fetch(url).then((res) => res.json()); | |
| const baseUrl = 'https://www.reddit.com'; | |
| export const useRedditPosts = (subreddit, sort = 'hot') => { | |
| if (!subreddit) { | |
| throw new Error('Subreddit is required'); | |
| } |
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 { View } from 'react-native'; | |
| import { WebView } from 'react-native-webview'; | |
| const INJECTED_JAVASCRIPT = `(function() { | |
| const tokenLocalStorage = window.localStorage.getItem('token'); | |
| window.ReactNativeWebView.postMessage(tokenLocalStorage); | |
| })();`; | |
| export default function App() { | |
| const onMessage = (payload) => { |
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
| <template> | |
| <button @click="ping">Ping</button> | |
| </template> | |
| <script setup> | |
| import useCancelToken from './useCancelToken'; | |
| import axios from 'axios' | |
| const cancelToken = useCancelToken(); |
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
| <template> | |
| <button @click="ping">Ping</button> | |
| </template> | |
| <script setup> | |
| import useUnmountSignal from './useUnmountSignal'; | |
| const unmountSignal = useUnmountSignal(); | |
| const ping = () => { |