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 { useEffect, useState } from 'react' | |
export const useCurrentUser () { | |
const [user, setCurrentUser] = useState() | |
const [error, setError] = useState<Error>() | |
const [loading, setLoading] = useState<boolean>(false) | |
const fetchLoggedUser = async () => { | |
setLoading(true) |
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
interface Props { | |
onStateHover?: (state: string) => void | |
} | |
export const BrazilCountyMap = ({ onStateHover }: Props) => { | |
return ( | |
<svg version="1.1" id="svg-map" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="450px" height="460px" viewBox="0 0 450 460" enable-background="new 0 0 450 460" xml:space="preserve"> | |
<g> | |
<a href="javascript:void(0)" class="estado" onMouseMove={() => onStateHover?.('Tocantins')} name="Tocantins" code="17" uf="to"> |
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 { google } from 'googleapis'; | |
const createAuth = () => { | |
const { GOOGLE_GSC_CREDENTIALS } = process.env; | |
if (!GOOGLE_GSC_CREDENTIALS) { | |
throw new Error('GOOGLE_GSC_CREDENTIALS env var is not set'); | |
} | |
const credentials = JSON.parse(GOOGLE_GSC_CREDENTIALS); |
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
/** | |
* This is really a _best guess_ promise checking. You | |
* should probably use Promise.resolve(value) to be 100% | |
* sure you're handling it correctly. | |
*/ | |
export const isPromise = (value: any): value is Promise<any> => { | |
if (!value) return false | |
if (!value.then) return false | |
if (!isFunction(value.then)) return false | |
return true |
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
function addSibs () { | |
const div = document.createElement('div') | |
const img = document.createElement('img') | |
div.style.position = 'fixed' | |
div.style.zIndex = '99999999' | |
div.style.right = '100px' | |
div.style.bottom = '0px' | |
div.appendChild(img) |
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 twilio from 'twilio' | |
import { MessageListInstanceCreateOptions } from 'twilio/lib/rest/api/v2010/account/message' | |
interface SendWhatsappMessageOptions { | |
to: string | |
from: string | |
body?: string | |
contentSid?: string | |
contentVariables?: Record<string, string> |
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
// server/middleware/auth.ts | |
import { DecodedIdToken } from 'firebase-admin/lib/auth/token-verifier' | |
import { createAuth } from '@/libs/firebase/firebaseAdmin' | |
export interface AuthContext { | |
isAuthenticated: boolean | |
user: DecodedIdToken | null | |
} |
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 async function processPromisesBatch( | |
items: Array<any>, | |
limit: number, | |
fn: (item: any) => Promise<any>, | |
): Promise<any> { | |
let results = []; | |
for (let start = 0; start < items.length; start += limit) { | |
const end = start + limit > items.length ? items.length : start + limit; | |
const slicedResults = await Promise.all(items.slice(start, end).map(fn)); |
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 { Platform } from 'react-native'; | |
import { | |
check, | |
request, | |
PERMISSIONS, | |
RESULTS, | |
openSettings, | |
} from 'react-native-permissions'; |
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
for line in (cat .env) do | |
export $line | |
done |
NewerOlder