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 { useRef, useEffect } from "react"; | |
const useNonInitialEffect = (effect, deps = []) => { | |
const initialRender = useRef(true); | |
useEffect(() => { | |
let effectReturns = () => {}; | |
if (initialRender.current) { | |
initialRender.current = false; |
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 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 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 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 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 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 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 {SafeAreaView, StatusBar} from 'react-native'; | |
import {WebView} from 'react-native-webview'; | |
const App = () => { | |
return ( | |
<> | |
<StatusBar barStyle="dark-content" /> | |
<SafeAreaView style={{flex: 1}}> | |
<WebView source={{uri: 'https://medium.com/'}} /> |
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
{ "tenantId": "some-random-tenant", "provider": "third.party" } |
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
export const signInUserWithAuthProvider = async ( | |
authProvider: AuthProvider | |
) => { | |
firebase.auth().tenantId = authProvider.tenantId; | |
const provider = new firebase.auth.SAMLAuthProvider(authProvider.provider); | |
firebase.auth().signInWithRedirect(provider); | |
const authResult = await firebase.auth().getRedirectResult(); | |
return authResult; |
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
const signInUser = () => { | |
return firebase.auth().signInWithEmailAndPassword(email, password); | |
} |