Skip to content

Instantly share code, notes, and snippets.

View alejovdev's full-sized avatar
💻
Coding

Alejov alejovdev

💻
Coding
View GitHub Profile
name: Firestore Backups
on:
workflow_dispatch:
inputs:
name:
description: 'Backup'
default: 'Backup'
required: false
schedule:
- cron: '0 0 1-31/2 * *'
const [cookies, setCookie] = useCookies(['frbstkn', 'redirect'])
useEffect(() => {
auth.onAuthStateChanged((user) => {
if (user) getCustomToken()
})
}, [])
const getCustomToken = async () => {
if (auth.currentUser === null) return
import * as functions from 'firebase-functions'
import * as service from './service.json'
import admin = require('firebase-admin')
const params = {
type: service.type,
projectId: service.project_id,
privateKeyId: service.private_key_id,
privateKey: service.private_key,
clientEmail: service.client_email,
import React, { useState, useLayoutEffect, useRef } from 'react'
function MyComponent() {
const [windowSize, _setWindowSize] = useState([
window.innerWidth,
window.innerHeight,
])
const windowSizeRef = useRef(windowSize)
const setWindowSize = (value) => {
import React, { useState, useLayoutEffect, useRef } from 'react'
function MyComponent() {
const [windowSize, _setWindowSize] = useState([0, 0])
const windowSizeRef = useRef(windowSize)
const setWindowSize = (value) => {
windowSizeRef.current = value
_setWindowSize(value)
}
import React, { useState, useLayoutEffect, useRef } from 'react'
function MyComponent() {
useLayoutEffect(() => {
function onWindowResize() {}
return () => {}
}, [])
return <div>Hi There</div>
}
import React, { useState, useLayoutEffect, useRef } from 'react'
function MyComponent() {
return <div>Hi There</div>
}
export default MyComponent
<script>
let todoDescription = "";
let todosList = [];
const onAddToList = () => {
todosList = [
...todosList,
{
id: new Date().getTime(),
description: todoDescription,
<script>
export let dark;
function handleToggle() {
dark = !dark;
}
</script>
<style>
.container {
const pickImage = async () => {
let result = await ImagePicker.launchCameraAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: true,
aspect: [1, 1],
quality: 1,
base64: true
})
if (!result.cancelled){
// I'm adding the data:image, if you want to use the image locally before uploading, you can use a state hook first