Skip to content

Instantly share code, notes, and snippets.

View betiol's full-sized avatar
🏠
Working from home

Nikollas Betiol betiol

🏠
Working from home
View GitHub Profile
@jarretmoses
jarretmoses / React Native Clear Cache
Last active March 11, 2024 10:20
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
@jeffijoe
jeffijoe / app.js
Last active September 1, 2023 07:34
Streaming uploads through Koa.
import Koa from 'koa'
import parse from './busboy'
import AWS from 'aws-sdk'
const app = new Koa()
const s3 = new AWS.S3({
params: { Bucket: 'myBucket' }
})
@joseluisq
joseluisq / database.module.ts
Last active April 18, 2023 07:40
Nest Database Module (Type ORM) with environment variables support
import { Module, Global, DynamicModule } from '@nestjs/common'
import { EnvModule } from './env.module'
import { EnvService } from './env.service'
import { TypeOrmModule } from '@nestjs/typeorm'
function DatabaseOrmModule (): DynamicModule {
const config = new EnvService().read()
return TypeOrmModule.forRoot({
type: config.DB_TYPE,
@geoffreydhuyvetters
geoffreydhuyvetters / react_fiber.md
Last active January 13, 2023 06:49
What is React Fiber? And how can I try it out today?
@bvaughn
bvaughn / eager-prefetching-async-data-example.js
Last active November 30, 2022 21:16
Advanced example for eagerly prefetching async data in a React component.
// This is an advanced example! It is not intended for use in application code.
// Libraries like Relay may make use of this technique to save some time on low-end mobile devices.
// Most components should just initiate async requests in componentDidMount.
class ExampleComponent extends React.Component {
_hasUnmounted = false;
state = {
externalData: null,
};
******** PARTE 1 - COMANDOS BÁSICOS
## Para listar as imagens existentes localmente
-> docker images
## Para rodar um container
-> docker run -it centos /bin/bash
run > executar uma imagem
-i > interatividade
import React from 'react';
import {
View,
Text,
} from 'react-native';
import { TextInputMask } from 'react-native-masked-text'
export default function maskedInputTemplate(locals) {
if (locals.hidden) {
return null;
import { useState, useEffect } from 'react';
import { database } from './';
import UserStorage from '../shared/UserStorage';
export async function save(data) {
const { uid } = await UserStorage.getUser();
const request = await database.ref(`user/${uid}/decks`);
await request.push({ ...data });
}
@webuniverseio
webuniverseio / forceUpdate.js
Created April 2, 2017 16:01
react-redux forceUpdate
componentDidMount() {
let prevState = this.props.getState();
this.unsubscribe =
this.props.subscribe(() => {
const state = this.props.getState();
if (state != prevState) {
this.forceUpdate();
prevState = state;
}
});
@betiol
betiol / Distances.js
Last active May 9, 2017 18:25
Get distance by Latitude & Longitude KM/Meters/Miles
var Distance = (function () {
var toRad = function (num) {
return num * Math.PI / 180
}
return function Distance(start, end, options) {
options = options || {}
var radii = {