Skip to content

Instantly share code, notes, and snippets.

View tchayen's full-sized avatar

Tomasz Czajęcki tchayen

View GitHub Profile
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);
};
@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
import React from 'react';
import {View, Dimensions} from 'react-native';
import Animated, {
useAnimatedScrollHandler,
useAnimatedStyle,
useSharedValue,
} from 'react-native-reanimated';
const BORDER_RADIUS = 10;
const vertex = `
attribute vec2 a_position;
attribute vec3 a_barycentric;
uniform mat3 u_matrix;
varying vec3 vbc;
void main() {
vbc = a_barycentric;
gl_Position = vec4((u_matrix * vec3(a_position, 1)).xy, 0, 1);
}`
@tchayen
tchayen / script-calculator.js
Last active November 14, 2023 02:47
Javascript calculator using Reverse Polish notation and Shunting-yard algorithm
// function connecting algorithm with outer world
function updateCalculator(event) {
var expression = document.getElementById("calculator").value;
var result = calculate(expression);
document.getElementById('calculatorResult').innerHTML = result;
}
function calculate(expression) {