Skip to content

Instantly share code, notes, and snippets.

// Copyright (c) 2016, Scott Motte
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
import { clsx } from 'clsx';
import { ReactElement } from 'react';
export function TruncateMiddle(props: {
children: string;
className?: string;
prefixLength?: number;
suffixLength?: number;
}): ReactElement {
const text = props.children;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
bcrt1qf5v8n3kfe6v5mharuvj0qnr7g74xnu9leut39r
bcrt1qnkmmcu79glheaqsq3gj4gg4675z3cjzn39dt24
bcrt1qrvt6c60848p8y8vd3pejdt33davp5ka9vxupuj
bcrt1qur2tmednr6e52u9du972nqvua60egwqkf98ps8
bcrt1qxvvp3tz5u8t90nwwjzsalha66zk9em95tgn3fk
bcrt1qdje7lynhsru5t9f2d8u6ckzsvmj8awq4m2qudx
bcrt1qj8wk7gzvaj6hyyupsj0hkuevg97lu23axlkjnm
bcrt1qqjrg9hkffz76fppvvlz5qulleagnhdkvde2xg2
bcrt1q7gqw25aac4k3um5v7n45tg08944nru29hkz9xc
bcrt1q2tke5fa7wx26m684d7yuyt85rvjl36u6q8l6e2
@fuxingloh
fuxingloh / Bip32Patch.test.ts
Created April 5, 2021 06:25
Bip32Path TypeScript
import { BIP32Path } from '../../src/utils/bip32_path'
describe('fromPathArray()', function () {
it('should work with proper input', function () {
const bipPath = BIP32Path.fromPathArray([44 | 0x80000000, 1, 1, 0])
expect(bipPath.toString()).toBe("m/44'/1/1/0")
})
})
describe('toPathArray()', function () {
@fuxingloh
fuxingloh / intellij-markdown.css
Created December 11, 2020 06:15
Ultra simple white theme markdown for IntelliJ
body {
filter: invert(1);
background: #fff;
}
img {
filter: invert(1);
}
@fuxingloh
fuxingloh / lightsail.sh
Created September 21, 2020 09:19
Setup Docker & Docker-Compose on AWS Lightsail Amaozn Linux 2
sudo yum install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo chkconfig docker on
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
@fuxingloh
fuxingloh / Data.java
Created April 17, 2020 07:36
Selectively Patch Data with Jackson ObjectMapper in Spring Web & Spring Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Entity
public class Data {
@NotNull
@Id
@Column(length = 255, updatable = false, nullable = false, unique = true)
private String id;
@fuxingloh
fuxingloh / SleepUtils.java
Created January 21, 2020 06:47
Thread.sleep with checked InterruptedException wrapped in unchecked.
package dev.fuxing.utils;
import java.time.Duration;
/**
* Created by: Fuxing
* Date: 20/8/18
* Time: 6:43 PM
*/
public final class SleepUtils {
@fuxingloh
fuxingloh / JsonUtils.java
Created January 21, 2020 06:46
JsonUtils is basically a singleton ObjectMapper that wraps all JSON Error into {@code JsonException}. There are also a bunch of helper method for parsing collections.
package dev.fuxing.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.type.CollectionType;
import com.fasterxml.jackson.databind.type.MapType;
import dev.fuxing.err.JsonException;