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
| const extractIds = items => items.map(item => item.id) |
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
| const extractIds = items => { | |
| let itemIds = [] | |
| for (let i=0; i<items.length; i++) { | |
| itemIds.push(items[i].id) | |
| } | |
| return itemIds | |
| } |
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
| export const useFirestoreCollectionQuery = (path, renderFn) => { | |
| const [state, setState] = useState(null) | |
| const collection = useRef(useFirestoreCollection(path)) | |
| useEffect(() => { | |
| console.log('useEffect') | |
| return collection.current.onSnapshot(snapshot => { | |
| const docs = snapshot.docs.map(x => x.data()) | |
| setState(docs) |
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
| export const useFirestoreCollectionQuery = (path, renderFn) => { | |
| const [state, setState] = useState(null) | |
| const collection = useFirestoreCollection(path) | |
| useEffect(() => { | |
| console.log('useEffect') | |
| return collection.onSnapshot(snapshot => { | |
| const docs = snapshot.docs.map(x => x.data()) | |
| setState(docs) |
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
| export const useFirestoreCollectionQuery = (path, renderFn) => { | |
| const [state, setState] = useState(null) | |
| const collection = useFirestoreCollection(path) | |
| useEffect(() => { | |
| console.log('useEffect') | |
| return collection.onSnapshot(snapshot => { | |
| const docs = snapshot.docs.map(x => x.data()) | |
| setState(docs) |
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
| export const Counter = ({ initialValue, onChange }) => { | |
| const [count, setCount] = useState(initialValue) | |
| useEffect(() => onChange(count), [count]) | |
| const incrementCounter = () => setCount(count + 1) | |
| return ( | |
| <div> | |
| Count: {count} |
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
| const mapExample = arr => arr.map(square) |
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
| set nocompatible | |
| filetype off | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| Plugin 'gmarik/Vundle.vim' | |
| Plugin 'tpope/vim-fugitive' | |
| Plugin 'L9' | |
| Plugin 'int3/vim-extradite' | |
| Plugin 'scrooloose/syntastic' |
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
| /* global Obniz */ | |
| import React from 'react' | |
| import tokens from './tokens' | |
| class RemoteDevice extends React.Component { | |
| state = { text: this.props.text || `id: ${this.props.id}` } | |
| componentDidMount () { | |
| const { id } = this.props | |
| const access_token = tokens[id] |
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 <ESP8266WiFi.h> | |
| const char* ssid = "ssid"; | |
| const char* password = "password"; | |
| WiFiServer server(80); | |
| String header; | |
| int gpio_pins [] = { D0, D1, D2 }; |