Skip to content

Instantly share code, notes, and snippets.

View razvanstatescu's full-sized avatar
⌨️
Probably coding...

Răzvan Stătescu razvanstatescu

⌨️
Probably coding...
View GitHub Profile
@razvanstatescu
razvanstatescu / generate-wallet.ts
Created July 9, 2023 17:40
Generate a MultiversX wallet in a specific shard
import { bech32 } from 'bech32';
import { generateMnemonic, mnemonicToSeedSync, validateMnemonic } from 'bip39';
import { derivePath } from 'ed25519-hd-key';
import * as tweetnacl from 'tweetnacl';
const MNEMONIC_LENGTH = 256;
const HD_PREFIX = "m/44'/508'/0'/0'";
const ERD = "erd";
const HD_PATH = `${HD_PREFIX}/0'`;
<div class="bg-gradient-to-br from-yellow-400 to-pink-500 via-red-400 w-full h-screen flex items-center justify-center">
<div class="bg-white p-8 bg-opacity-80 rounded-3xl flex space-x-12 items-center shadow-md">
<div>
<svg class="h-32 w-32" viewBox="0 -32 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m62.640625 137.230469c2.804687-46.371094 41.292969-83.113281 88.371094-83.113281 37.964843 0 70.347656 23.902343 82.929687 57.476562 32.695313.394531 59.082032 27.003906 59.082032 59.792969 0 33.035156-26.78125 59.816406-59.816407 59.816406-13.828125 0-154.71875 0-168.925781 0-25.960938 0-47.007812-21.046875-47.007812-47.007813 0-25.410156 20.167968-46.097656 45.367187-46.964843zm0 0" fill="#f0f5f7"/><path d="m293.023438 171.390625c0 23.898437-14.027344 44.53125-34.292969 54.105469 3.652343-7.738282 5.699219-16.390625 5.699219-25.519532 0-32.789062-26.382813-59.402343-59.078126-59.792968-12.585937-33.578125-44.964843-57.476563-82.933593-57.476563-17.121094 0-33.109375 4.859375-46.65625 13.281
@razvanstatescu
razvanstatescu / dynamic-input-width.directive.ts
Created December 26, 2020 19:30
An Angular directive that adjust input width based on the content size.
import { Directive, ElementRef, HostListener } from '@angular/core';
@Directive({
selector: '[dynamic-input]',
})
export class DynamicInputDirective {
constructor(private el: ElementRef) {
this.resize();
}
@razvanstatescu
razvanstatescu / publish.js
Created November 19, 2020 16:49
Pusher Channels example
const Pusher = require("pusher");
const pusher = new Pusher({
appId: "APP_ID",
key: "APP_KEY",
secret: "APP_SECRET",
cluster: "APP_CLUSTER"
});
pusher.trigger("user-123", "notifications", {
@razvanstatescu
razvanstatescu / color_checker.html
Created August 22, 2020 06:04
Quick color checker. Validate and display a HEX color.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Color checker</title>
<style>
.container {
display: flex;
justify-content: center;
@razvanstatescu
razvanstatescu / copy_to_clipboard.html
Created August 7, 2020 16:49
Copy input text to clipboard using Javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Copy to clipboard</title>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {