Skip to content

Instantly share code, notes, and snippets.

View yannvr's full-sized avatar
💭
∞ + 1

Yann VR yannvr

💭
∞ + 1
View GitHub Profile
@yannvr
yannvr / trustake-form.tsx
Last active June 25, 2024 11:35
dynamic import of validation and submit objects
import type { ChangeEvent, ReactNode } from "react";
import { Button, Typography } from "@mui/material";
import type { EnhancedStore } from "@reduxjs/toolkit";
import notices from "@contracts/trumatic/notices.json";
import type { TokenSymbol } from "@interfaces/shared-types";
import formSlice from "@store/form/form.reducer";
import { selectUserStakingTokenBalance, selectUserStakerSummary } from "@store/staker/staker.selectors";
import { trimInputValue } from "@utils/helpers/forms/trim-input-values";
import { validateAllocationAmount } from "./form-validation/trustake-common.validation";
import { formSubmitActions, formValidationActions } from "./submit-actions/trustake-form-submit-actions";
@yannvr
yannvr / wallet-observer-test.ts
Last active May 28, 2024 10:53
wallet observer tests
import { WalletCore } from "@aptos-labs/wallet-adapter-core";
import { MartianWallet } from "@martianwallet/aptos-wallet-adapter";
import { PetraWallet } from "petra-plugin-wallet-adapter";
import { connectWalletAction, disconnectWalletAction } from "@store/wallet/wallet.reducer";
import { getAptosWalletState } from "@store/wallet/wallet.utils";
import { aptosWalletCore, connectAptosWallet, injectStoreToAptosWalletConfig } from './wallet.config.aptos';
jest.mock("@aptos-labs/wallet-adapter-core");
jest.mock("@martianwallet/aptos-wallet-adapter");
jest.mock("petra-plugin-wallet-adapter");
@yannvr
yannvr / view localforage keys
Created June 2, 2016 00:45
view localforage keys
localforage.keys().then((keys) => console.log(keys))
@yannvr
yannvr / gist:5e45463f3da942d86e96
Created December 1, 2015 16:38
Iterate over localforage values
localforage.iterate(function(value, key, iterationNumber) {
// Resulting key/value pair -- this callback
// will be executed for every item in the
// database.
console.log([key, value]);
}, function(err) {
if (!err) {
console.log('Iteration has completed');
}
});
@yannvr
yannvr / compassUsefulPlaceholdersAndMixins.scss
Created June 11, 2014 19:55
compassUsefulPlaceholdersAndMixins
%text-shadow { text-shadow: 2px 2px 1px black; }
%clearfix {
&:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
@yannvr
yannvr / compassFlexMixins
Created June 11, 2014 19:54
Cross browser Flex mixins
// ==================================================================
// Flexbox
//
// Implementation based on Chris Coyier's article:
// Using Flexbox: Mixing Old and New for the Best Browser Support || http://css-tricks.com/using-flexbox/
// ==================================================================
// Flexbox Context (applied to container element of flex items)
@mixin flex-display {
@include experimental-value(display, box, -moz, -webkit, -ms, not -khtml, official);
@yannvr
yannvr / animationKeyFrameCom.scss
Last active August 29, 2015 14:02
Compass and CSS for cross browser keyframe AND related animation
// animation.css
@include keyframes(reduce) {
0% {
width: 100%;
background-color: #828282;
}
80% {
background-color: #828282;
}
100% {