Skip to content

Instantly share code, notes, and snippets.

View WebTarantul's full-sized avatar

Taras Kapusta WebTarantul

View GitHub Profile
@WebTarantul
WebTarantul / React Native Clear Cache
Created June 22, 2021 14:32 — forked from jarretmoses/React Native Clear Cache
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
@WebTarantul
WebTarantul / README.txt
Created February 12, 2021 20:42
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@WebTarantul
WebTarantul / promise parallelLimit
Created October 3, 2020 12:41
promise parallelLimit
parallelLimit
@WebTarantul
WebTarantul / check_localStorage_items_size.js
Last active May 8, 2020 06:33
Check localStorage items size
var x,
xLen,
log = [],
total = 0;
for (x in localStorage) {
if (!localStorage.hasOwnProperty(x)) {
continue;
}
xLen = (localStorage[x].length * 2 + x.length * 2) / 1024;
log.push(x.substr(0, 30) + " = " + xLen.toFixed(2) + " KB");
@WebTarantul
WebTarantul / ErrorBoundary.jsx
Last active February 22, 2020 14:21
Error boundary component
import React, { PureComponent } from "react";
import ErrorIndicator from "../ErrorIndicator";
class ErrorBoundary extends PureComponent {
constructor(props) {
super(props);
this.state = {
hasError: false
};
@WebTarantul
WebTarantul / utils.js
Created February 22, 2020 14:13
My utils to React/MST projects
import {
onSnapshot,
applySnapshot,
getParent,
getRoot,
getIdentifier,
isStateTreeNode,
resolveIdentifier,
types,
} from 'mobx-state-tree';
@WebTarantul
WebTarantul / cutomSafeReference.js
Created February 22, 2020 14:07
MST Custom safe reference
export function safeReference(T) {
return types.reference(T, {
get(identifier, parent) {
if (isStateTreeNode(identifier)) {
identifier = getIdentifier(identifier);
}
return resolveIdentifier(T, parent, identifier);
},
set(value) {
return value;
@WebTarantul
WebTarantul / asyncModel.js
Created November 22, 2019 08:16
Async model for flowing to Api. - Mobx-state-tree
import { types, flow, getRoot } from 'mobx-state-tree';
import Api from 'src/api';
export const AuthStore = types.model('AuthStore', {
loginFlow: asyncModel(loginFlow),
registerFlow: asyncModel(registerFlow),
});
@WebTarantul
WebTarantul / setupProxy.js
Created August 23, 2019 15:12
proxy template
const createProxy = require('http-proxy-middleware');
const proxy = createProxy({
target: 'https://apiko-marketplace-api-2019.herokuapp.com/',
pathRewrite: {
'^/api': '',
},
changeOrigin: true,
});
function createStore(reducer, initialState) {
return {
_reducer: reducer,
_state: initialState,
_listeners: [],
dispatch(action) {