Organization - Mozilla
Project Mentor - Mathieu Leplatre
Summary
| // src/intentEventParser.ts | |
| import { Connection, PublicKey } from '@solana/web3.js'; | |
| /* -------------------------------------------------------------------------- */ | |
| /* Types & helpers */ | |
| /* -------------------------------------------------------------------------- */ | |
| export interface ParsedIntentEvent { | |
| intentId: string; | |
| messageId: string; |
| import bs58 from 'bs58'; | |
| export class Address { | |
| private buffer: Buffer; | |
| private constructor(buffer: Buffer) { | |
| if (buffer.length !== 32) { | |
| throw new Error('Internal representation must be 32 bytes.'); | |
| } | |
| this.buffer = buffer; |
| git filter-branch --env-filter ' | |
| OLD_EMAIL="old@email.com" | |
| CORRECT_NAME="new_name" | |
| CORRECT_EMAIL="new@email.com" | |
| if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
| then | |
| export GIT_COMMITTER_NAME="$CORRECT_NAME" | |
| export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" |
| // base is milliseconds | |
| const second = 1000 | |
| const minute = 60 * second | |
| const hour = 60 * minute | |
| const day = 24 * hour | |
| const week = 7 * day | |
| const month = 4 * week | |
| const year = 12 * month | |
| import * as RadixDialog from '@radix-ui/react-dialog' | |
| import { keyframes, styled } from '@stitches/react' | |
| import clsx from 'clsx' | |
| import { forwardRef } from 'react' | |
| /** | |
| * This is a custom dialog component that has tailwind classes and and some structure pre built. | |
| * | |
| * Example: | |
| * ```tsx |
| import produce from 'immer'; | |
| import create, { GetState, SetState, State, StoreApi, UseStore } from 'zustand'; | |
| type StateCreator<T extends State, CustomSetState = SetState<T>, U extends State = T> = ( | |
| set: CustomSetState, | |
| get: GetState<T>, | |
| api: StoreApi<T> | |
| ) => U; | |
| const immer = <T extends State, U extends State>( |
| node_modules |
| // write a funcction which will find the number of time | |
| // a character is repeated in a string | |
| // input: aabbcccddefb | |
| // output: { a: 2, b: 3,c: 3, d: 2, e: 1,f:1} | |
| export function charOccurance(string: string) { | |
| let freq: Record<string, number> = {}; | |
| const strArr = Array.from(string); | |
| strArr.forEach(char => { | |
| if (freq[char]) { |