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
| // timer.start('PROCESS'); | |
| // YOUR PROCESS TO MEASURE | |
| // timer.end(); | |
| import log from './log'; | |
| const logTimer = () => { | |
| let _initiTime: number; | |
| let _title = ''; |
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 AsyncStorage from '@react-native-community/async-storage'; | |
| class Storage { | |
| async set( | |
| key: string, | |
| value: string | Date | Record<string, unknown>, | |
| ): Promise<any> { | |
| return await AsyncStorage.setItem(key, JSON.stringify(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
| // TO USE: | |
| // Add a interceptor to the request: | |
| // api.interceptors.request.use((request) => cacheHandler.requestHandler(request)); | |
| // api.interceptors.response.use( | |
| // (response) => cacheHandler.responseHandler(response), | |
| // (error) => cacheHandler.errorHandler(error), | |
| // ); | |
| import { AxiosRequestConfig, AxiosResponse } from 'axios'; | |
| import Storage from './Storage'; |
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
| function generatePDF(ssID, sheetId, fileName) { | |
| // Base URL | |
| const url = 'https://docs.google.com/spreadsheets/d/SS_ID/export?'.replace('SS_ID', ssID); | |
| var rangeParam = '&r1=0' + '&r2=82' + '&c1=0' + '&c2=11' | |
| const exportOptions = | |
| 'exportFormat=pdf&format=pdf' + // export as pdf / csv / xls / xlsx | |
| '&size=A4' + // paper size legal / letter / A4 | |
| '&portrait=true' + // orientation, false for landscape |
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
| Interceptor Axios RefreshToken | |
| let isRefreshing = false; | |
| let failedRequestsQueue: any[] = []; | |
| api.interceptors.response.use( | |
| (response) => { | |
| return response; | |
| }, | |
| async (error: AxiosError) => { |
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 stringify from './stringfy'; | |
| const params = [{"teste": "1"},{"teste": "2"},{"teste": "3"}]; | |
| const stringParams = stringify(params, { | |
| encodeValuesOnly: true, | |
| encode: false, | |
| encoder: encodeURIComponent, | |
| addQueryPrefix: true, | |
| }); |
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
| // add to package.json | |
| // "postinstall": "node scripts/removeDependencyFromYarnLock.js" | |
| const fs = require('fs'); | |
| const FILE_SRC = 'yarn.lock'; | |
| const REPLACE = ''; | |
| const replace = (path, opts = 'utf8') => | |
| new Promise((resolve, reject) => { |
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 url = "painel.toloja.com.br"; | |
| const regex = url.match(/[a-z]+\.?(([a-z]+)\.(([a-z]+)\.[a-z]+\.[a-z]+))[:\d]*/); | |
| const mainUrl = regex ? (regex[2]=== "dev" ? regex[1]: regex[3]) : "defaultOrganizationUrl"; | |
| const newOrganization = regex ? regex[4] : "defaultOrganization"; | |
| console.log(regex); | |
| console.log(mainUrl); | |
| console.log(newOrganization); |
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
| /* eslint-disable no-bitwise */ | |
| interface StringifyOptions { | |
| encoder?: any; | |
| encode?: boolean; | |
| encodeValuesOnly?: boolean; | |
| addQueryPrefix?: boolean; | |
| allowDots?: boolean; | |
| charset?: string; | |
| charsetSentinel?: boolean; |
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
| name: Deploy to S3 (Prod) | |
| on: workflow_dispatch | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: |
OlderNewer