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 test = require('ava') | |
| const request = require('supertest') | |
| const app = require('../lib/infra') | |
| const Joi = require('@hapi/joi') | |
| const agent = request.agent(app) | |
| test('main', async (t) => { | |
| const { body } = await agent.get('/') |
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
| import React, {useContext, useState} from "react"; | |
| export default null; | |
| const FeathersContext = React.createContext(null); | |
| export const useFeathers = () => useContext(FeathersContext); | |
| export const FeathersProvider = ({ children, client: feathersClient }) => { | |
| const [isLoggedIn, setIsLoggedIn] = useState(false); |
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
| version: '3.1' | |
| services: | |
| reverse-proxy: | |
| image: traefik # The official Traefik docker image | |
| command: --api --docker # Enables the web UI and tells Traefik to listen to docker | |
| ports: | |
| - "3000:3000" # The HTTP port | |
| - "8080:8080" # The Web UI (enabled by --api) | |
| volumes: | |
| - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events |
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
| /* | |
| Copy this into the console of any web page that is interactive and doesn't | |
| do hard reloads. You will hear your DOM changes as different pitches of | |
| audio. | |
| I have found this interesting for debugging, but also fun to hear web pages | |
| render like UIs do in movies. | |
| */ | |
| const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
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 children = []; | |
| const getChildren = el => [...el.children].map(child => { | |
| getChildren(child); | |
| child.style.transition = 'all ease 0.5s' | |
| children.push(child); | |
| }); | |
| getChildren(document.body); |
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
| import { Plugins } from "@capacitor/core"; | |
| const { Storage } = Plugins; | |
| export default class CapacitorStorage { | |
| static async getItem(key: string) { | |
| const { value } = (await Storage.get({ key })) || { value: null }; | |
| return value; | |
| } |
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 response = yield cps(cb => | |
| new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve(true); | |
| }, 1000); | |
| }).then(data => cb(null, data)) | |
| .catch(error => cb(error)) | |
| ); |
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
| appcenter distribute release -f app-debug.apk -g Collaborators |
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 messages = app.service('/messages'); | |
| messages.on('created', (data) => { | |
| dispatch(services.messages.onCreated(data)); | |
| }) | |
| messages.on('updated', (data) => { | |
| dispatch(services.messages.onUpdated(data)); | |
| }) | |
| messages.on('patched', (data) => { | |
| dispatch(services.messages.onPatched(data)); |
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
| import {fetchUtils} from 'react-admin'; | |
| const httpClient = (url, options = {}) => { | |
| if (!options.headers) { | |
| options.headers = new Headers({Accept: 'application/json'}); | |
| } | |
| const token = localStorage.getItem('jwt'); | |
| options.headers.set('Authorization', `Bearer ${token.replace(/"/g, '')}`); | |
| return fetchUtils.fetchJson(url, options); | |
| }; |