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 { useRef, useEffect } from "react"; | |
| const useNonInitialEffect = (effect, deps = []) => { | |
| const initialRender = useRef(true); | |
| useEffect(() => { | |
| let effectReturns = () => {}; | |
| if (initialRender.current) { | |
| initialRender.current = false; |
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 from "react"; | |
| import { connect } from "react-redux"; | |
| import { loadMoreChatrooms } from "actions"; | |
| import AllChatrooms from "./AllChatrooms"; | |
| const Profile = ({ chatrooms, loadMoreChatrooms }) => { | |
| return ( | |
| <div> | |
| <AllChatrooms chatrooms={chatrooms} /> |
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
| console.log(JSON.stringify({ filter }, null, 4)); | |
| const start = new Date().getTime(); | |
| const end = new Date().getTime(); | |
| const time = end - start; | |
| console.log({ | |
| inLength: filteredChatrooms.length, | |
| filterTime: time, |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> //Header file for sleep(). man 3 sleep for details. | |
| #include <pthread.h> | |
| // A normal C function that is executed as a thread | |
| // when its name is specified in pthread_create() | |
| void *myThreadFun(void *vargp) | |
| { | |
| sleep(4); |
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
| -='cd -' | |
| ...=../.. | |
| ....=../../.. | |
| .....=../../../.. | |
| ......=../../../../.. | |
| 1='cd -' | |
| 2='cd -2' | |
| 3='cd -3' | |
| 4='cd -4' | |
| 5='cd -5' |
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
| { | |
| "eslint.options": { | |
| "rules": { | |
| "prettier/prettier": [ | |
| "error", | |
| { | |
| "endOfLine": "auto" | |
| } | |
| ] | |
| } |
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
| // Mobile: React Native | |
| import React, {useState, useEffect} from 'react'; | |
| import { View } from 'react-native'; | |
| import {Button} from 'react-native-paper'; | |
| import { WebView } from 'react-native-webview'; | |
| const App = () => { | |
| const [show, setShow] = useState({isOpen: false, url: null}); |
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
| // Web: React | |
| import { auth } from "./config/firebase"; | |
| auth.onAuthStateChanged((user) => { | |
| if (user) { | |
| user.getIdToken(true).then((idToken) => { | |
| // This is where to call the API | |
| const requestOptions = { |
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
| // Backend: Node - Express | |
| const express = require("express"); | |
| const admin = require("firebase-admin"); | |
| // Setup firebase admin [HERE] | |
| // Route that handles GET request | |
| app.post("/verify-token", (req, res) => { |
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
| // Web: React | |
| import { auth } from "./config/firebase"; | |
| auth.onAuthStateChanged((user) => { | |
| if (user) { | |
| user.getIdToken(true).then((idToken) => { | |
| // This is where to call the API | |
| const requestOptions = { |