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
rules_version = '2'; | |
service cloud.firestore { | |
match /databases/{database}/documents { | |
match /{document=**} { | |
allow read, delete: | |
if request.auth != null && request.auth.uid == resource.data.userUid; | |
allow create, update: | |
if request.auth != null && request.auth.uid == request.resource.data.userUid; | |
} | |
} |
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
docker volume ls -q -f dangling=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
import React from 'react'; | |
export default function usePrevious(value) { | |
const ref = React.useRef(); | |
React.useEffect(() => { | |
ref.current = value; | |
}, [value]); | |
return ref.current; |
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
docker volume rm `docker volume ls -q -f dangling=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
import { v4 as uuidv4 } from 'uuid'; | |
const TASKS_KEY = 'tasks'; | |
export const retrieveTasks = () => { | |
const serialized = localStorage.getItem(TASKS_KEY); | |
const tasks = serialized ? JSON.parse(serialized) : []; | |
return tasks; | |
}; |
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 chunk from 'lodash/chunk'; | |
/** | |
* | |
* Util to map values to `Promise`s and invoke them in queue order, | |
* being assured each `Promise` is resolved before the next be created. | |
* | |
* It reduces `data` array to a `Promise` which is the accumulated chain | |
* of async tasks resulting of each element mapped thru `asyncIteratee`. | |
* As a chain, each `asyncIteratee` follows a queue order of call, and |
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
find . -name '*.pyc' -delete |
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
git branch | grep -v "main" | xargs git branch -D |
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 function reorderSdpMediaLines(sdp) { | |
const lineBreaker = '\r\n'; | |
const parsed = sdp.split(lineBreaker).reduce((parser, line) => { | |
const reading = (line.startsWith('m=video') && 'video') | |
|| (line.startsWith('m=audio') && 'audio') | |
|| parser.reading; | |
if (line === '') { | |
return parser; | |
} |
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 compactObject(data) { | |
if (typeof data !== 'object') { | |
return data; | |
} | |
return Object.keys(data).reduce(function(accumulator, key) { | |
const isObject = typeof data[key] === 'object'; | |
const value = isObject ? compactObject(data[key]) : data[key]; | |
const isEmptyObject = isObject && !Object.keys(value).length; | |
if (value === undefined || isEmptyObject) { |