Skip to content

Instantly share code, notes, and snippets.

View ygkn's full-sized avatar
A believing heart is your magic.

YAGITA Yugo ygkn

A believing heart is your magic.
View GitHub Profile
String[] fontList = PFont.list();
PFont font;
String showText = "令和";
String findFont(String fontPattern) {
for (int i = 0; i < fontList.length; i++) {
String[] match = match(fontList[i], fontPattern);
if (match != null) {
return match[0];
@ygkn
ygkn / hex-base64.ts
Created August 21, 2022 00:52
Hex and Base64 interop in TypeScript
const hexToBase64 = (hex: string) =>
btoa(
String.fromCharCode(
...(hex.match(/[0-9a-f]{2}/gi) ?? []).map((c) => parseInt(c, 16))
)
);
const base64ToHex = (base64: string) =>
[...atob(base64)]
.map((c) => c.charCodeAt(0).toString(16).padStart(2, "0"))
index time(ms) size distance d/s log(d/s+1)
1 785 317.6 521.12 1.6 1.4
2 681 238.2 224.02 0.9 0.96
3 786 158.8 419.91 2.6 1.87
4 738 238.2 27.64 0.1 0.16
5 939 158.8 675.64 4.3 2.39
6 1271 238.2 711.44 3 2
7 926 79.4 290.64 3.7 2.22
8 927 79.4 366.9 4.6 2.49
9 861 238.2 624.8 2.6 1.86
[
{
"time":785,
"size":317.6,
"distance":521.12
},
{
"time":681,
"size":238.2,
"distance":224.02
@ygkn
ygkn / README.md
Last active July 21, 2022 08:00
少女☆歌劇 レヴュースタァライト in TypeScript

少女☆歌劇 レヴュースタァライト in TypeScript

import type { StorybookViteConfig } from '@storybook/builder-vite';
import { mergeConfig } from 'vite';
import viteConfig from '../vite.config';
const config: StorybookViteConfig = {
core: { builder: '@storybook/builder-vite' },
stories: ['../src/**/*.stories.@(ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
{
console.log("array\n")
const array: string[] = [];
array[100] = "100";
array[110] = "110";
array[105] = "105";
console.log(
array.map((v) => {
echo '{"scripts": {"chan":"echo んちゃんんちゃんにしたろ"}}' > package.json
const FieldArrayItem = <TFieldArrayName extends FieldArrayPath<FormValue>>({
name,
children,
}: {
name: TFieldArrayName;
children: (
methods: UseFieldArrayReturn<FormValue, TFieldArrayName>
) => React.ReactNode[];
}) => {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
* {
box-sizing: border-box;