Skip to content

Instantly share code, notes, and snippets.

View bvodola's full-sized avatar

Brunno Vodola Martins bvodola

View GitHub Profile
// App.js
const App = () =>
<Context.Provider value={this.state.context}>
<AppBar onPressLogoutButton={this.logout} />
<View style={{paddingTop: 64}}>
<Router>
<Route exact path="/" exact component={Home} />
</Router>
</View>
@bvodola
bvodola / FirebasePhoneAuth.js
Created June 25, 2020 22:02
Firebase Phone Authentication Example
import React from "react";
import firebase, { auth } from "src/firebase";
const App = () => {
const [phoneNumber, setPhoneNumber] = React.useState("");
const [code, setCode] = React.useState("");
const [user, setUser] = React.useState(null);
React.useEffect(() => {
// =======
import React from "react";
import { Modal } from "src/components";
const CrudPanel = ({ key, data, tableFields, entryFields, operations }) => {
const [isModalVisible, setIsModalVisible] = React.useState(false);
const openModal = () => setIsModalVisible(true);
const closeModal = () => setIsModalVisible(false);
return (
@bvodola
bvodola / get-recipe-schema.js
Created December 17, 2020 16:54
Get Recipe Schema from Website
function getRecipeSchema(schema) {
if(!schema) {
const nodes = document.querySelectorAll('script[type="application/ld+json"]');
let returnData;
nodes.forEach(n => {
const childSchema = JSON.parse(n.innerText);
const data = getRecipeSchema(childSchema);
if(data) returnData = data;
});
return returnData;