Skip to content

Instantly share code, notes, and snippets.

View tchayen's full-sized avatar

Tomasz Czajęcki tchayen

View GitHub Profile
@tchayen
tchayen / machine.js
Last active January 7, 2020 11:38
Generated by XState Viz: https://xstate.js.org/viz
const machine = Machine({
id: "authentication",
initial: "signIn",
context: {
name: "",
email: "",
password: "",
errors: {}
},
states: {
import React, { Component, createContext, useState } from "react";
import {
Animated,
TouchableOpacity,
View,
Text,
StyleSheet,
Platform
} from "react-native";
import { borderRadius, colors } from "./consts";
import React from 'react';
import {Dimensions, PixelRatio, StyleSheet, Text, View} from 'react-native';
import Animated, {
useSharedValue,
useAnimatedGestureHandler,
useAnimatedStyle,
useAnimatedProps,
useDerivedValue,
} from 'react-native-reanimated';
import {PanGestureHandler, TextInput} from 'react-native-gesture-handler';
import React from 'react';
import {ScrollView, View, Text, Dimensions} from 'react-native';
import Animated, {
useAnimatedGestureHandler,
useSharedValue,
useAnimatedStyle,
withTiming,
} from 'react-native-reanimated';
import {PinchGestureHandler} from 'react-native-gesture-handler';
import React, {useState} from 'react';
import Animated, {
useAnimatedScrollHandler,
useSharedValue,
useAnimatedStyle,
withTiming,
} from 'react-native-reanimated';
import {Image, Pressable, Dimensions} from 'react-native';
import FastImage from 'react-native-fast-image';
@tchayen
tchayen / reg.js
Last active August 31, 2020 14:05
const fetch = require("node-fetch");
const SERVICE_ID = "e5e795f2-7f35-4b11-ba7d-d1c45cbec182";
const YEAR = 2020;
const getWeekNumber = (date) => {
const firstDayOfYear = new Date(date.getFullYear(), 0, 1);
const pastDaysOfYear = (date - firstDayOfYear) / 86400000;
return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);
};
import React from 'react';
import {View, Dimensions} from 'react-native';
import Animated, {
useAnimatedScrollHandler,
useAnimatedStyle,
useSharedValue,
} from 'react-native-reanimated';
const BORDER_RADIUS = 10;
@tchayen
tchayen / main.js
Last active September 5, 2021 08:54
/**
* Usage:
* 1. Paste this into a main.js file in some empty directory.
* 2. Run: `yarn add web3 ethers abi-decoder`.
* 3. Go to contract's page
* https://etherscan.io/address/0x25ed58c027921E14D86380eA2646E3a1B5C55A8b
* and then to code and then copy "Contract ABI" and save it in the same dir
* as abi.json.
* 4. Create empty file backup.txt.
* 5. Download CSV data with transactions from etherscan page and save as