Skip to content

Instantly share code, notes, and snippets.

View Taump's full-sized avatar
💪
Not give up is my magic

Alexander Ponomarev Taump

💪
Not give up is my magic
View GitHub Profile
This file has been truncated, but you can view the full file.
{
"data": {
"unstable_mc_joints": [
{
"unit": {
"version": "3.0t",
"alt": "2",
"messages": [
{
"app": "payment",
const my_share = inputRedeem * 10 ** reserve_asset_decimals / fund_state.shares_supply;
const reserve_amount = Math.floor(my_share * fund_balance?.[reserve_asset]);
const t1_amount = Math.floor(my_share * p1Balance);
const exchange = t1_amount && $get_exchange_result(obj);
const you_get_in_full_units = (reserve_amount - exchange.reserve_needed - (reserve_asset === "base" ? 4000 : 0));
const you_get = you_get_in_full_units / 10 ** reserve_asset_decimals;
const fee_percent = (exchange.fee / you_get_in_full_units) * 100;
@Taump
Taump / tokens.md
Created September 2, 2020 15:14 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@Taump
Taump / .env
Created April 21, 2020 07:24
REACT CREATE APP ENV for ESLINT
EXTEND_ESLINT=true
{
base_aa: 'GGLDAQJOMIACSC3WSF7YI47OERBN3LYK',
params: {
oracle: 'F4KHJUCLJKY4JV7M5F754LAJX4EB7M4N',
overcollateralization_ratio: 1.5,
max_loan_value_in_underlying: 10000000,
decimals: 2,
auction_period: 3000,
liquidation_ratio: 1.3,
feed_name: 'GBYTE_USD',
@Taump
Taump / useLocalStorage.js
Created January 23, 2020 07:16
hook local storage
import { useState } from "react";
export const useLocalStorage = (key, initialValue) => {
const [storedValue, setStoredValue] = useState(() => {
try {
const item = window.localStorage.getItem(key);
return item ? JSON.parse(item) : initialValue;
} catch (error) {
console.log(error);
return initialValue;
@Taump
Taump / useWindowSize.js
Last active January 23, 2020 07:15
hook windows resize
import { useLayoutEffect, useState } from "react";
export const useWindowSize = () => {
const [size, setSize] = useState([0, 0]);
useLayoutEffect(() => {
function updateSize() {
setSize([window.innerWidth, window.innerHeight]);
}
window.addEventListener("resize", updateSize);
updateSize();
@Taump
Taump / ManageOrdersRelay.js
Created September 6, 2019 09:55 — forked from feus4177/ManageOrdersRelay.js
Example using createPaginationContainer from RelayJS.
import React from 'react';
import PropTypes from 'prop-types';
import {graphql, QueryRenderer, createPaginationContainer} from 'react-relay';
import {Button} from 'react-bootstrap';
import environment from '@/environment';
import PageBar from '@/components/PageBar';
import Loading from '@/components/Loading';
import OrderTableRelay from '@/components/OrderTableRelay';
.menu__item_active:after {
content: "";
display: block;
width: 100%;
height: 2px;
background: url(../img/border.svg) no-repeat;
position: absolute;
background-size: cover;
left: 0;
bottom: -5px;
@Taump
Taump / react_tz.md
Created May 5, 2018 14:41 — forked from beshkenadze/react_tz.md
Тестовое задание для ReactJS Frontend-разработчика

##Погодное одностраничное веб-приложение

(!) Данные можно взять с сайта openweathermap.org или с любого другого сервиса.

(!) Обязательно использовать react.js и redux.

Приложение должно уметь:

  • Добавлять/удалять города
  • Сохранять локально данные