Skip to content

Instantly share code, notes, and snippets.

@SBub
SBub / HOC.js
Created March 29, 2018 10:02 — forked from shotaK/HOC.js
React Higher Order Component with props validation.
import React, { Component, PropTypes } from 'React';
export const Enhance = ComposedComponent => {
class WrappedComponent extends Component {
attachFunction() {
ComposedComponent.attachFunction();
}
render() {
return <ComposedComponent {...this.props} additionalProps={this.state.additionalData} />;
}
var upperFirst = formatter( function formatting(v){
return v[0].toUpperCase() + v.substr( 1 ).toLowerCase();
} );
@SBub
SBub / concrete-deps.ts
Last active September 17, 2021 13:30
Inversify like container
/*
* register IDepA with no dependencies
*/
@Register('IDepA', [])
class ConcreteA implements IDepA {
doA(): void {
console.log('Doing A');
}
}
@SBub
SBub / verify_signature_solana-v1.txt
Last active February 27, 2025 22:50
Verify signature of a signed message
// sign a message with a wallet private key and validate its signature
// https://github.com/0xC0A1/web3-auth/tree/master
import { useEffect } from "react";
import b58 from "bs58";
import nacl from "tweetnacl";
import { PublicKey } from "@solana/web3.js";
import { useWallet } from "@solana/wallet-adapter-react";
export const Sign = () => {