Skip to content

Instantly share code, notes, and snippets.

@yano3nora
yano3nora / kuromojin.md
Last active April 25, 2024 10:13
kuromojin - kuromoji.js wrapper.
@yano3nora
yano3nora / csv-writer.md
Last active April 16, 2024 04:06
csv-writer

Overview

https://github.com/ryu1kn/csv-writer

  • node 環境で csv write したいときのやつ
  • nextjs (express) の response と組み合わせて streaming 返却で利用した

Examples

API

import type { NextApiRequest, NextApiResponse } from 'next'
@yano3nora
yano3nora / react-plotlyjs.md
Last active March 23, 2024 10:25
react-plolty.js
@yano3nora
yano3nora / qrcode.react.md
Last active February 14, 2024 04:44
qrcode.react
@yano3nora
yano3nora / mathjs.md
Last active November 8, 2023 16:49
math.js
@yano3nora
yano3nora / svg.md
Last active March 23, 2024 09:53
SVG Libraries - react-svg / svg.js / plotly.js #js

react-svg

https://github.com/tanem/react-svg

  • svg ファイルを react component として使えるやつ
  • afterInjection から描画後の node 操作が可能
  • src の svg ファイルから width, height を読み取って viewBox 指定までやってくれるので、中に svg やら html (foreign object) やら nest してやれば resize 時に全体がよき感じに縮尺される
$ npm i react-svg
@yano3nora
yano3nora / phaser-portal-window.tsx
Last active July 15, 2023 09:34
phaser-portal-window - Phaser x React x window.open by createPortal. #js #react #phaser
import Phaser from 'phaser'
import { ReactNode, useEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
const PHASER_CONFIG = { /* ... */ }
const WIDTH = 1920 / 2
const HEIGHT = 1080 / 2
const LEFT = (screen.width - WIDTH) / 2
const TOP = (screen.height - HEIGHT) / 2
@yano3nora
yano3nora / react-new-window.md
Last active July 15, 2023 04:31
react-new-window #react #js
@yano3nora
yano3nora / fix-aspect.jsx
Last active June 6, 2023 10:30
Fix Aspect on Loading Image by native Width & Height Attributes. #css
/**
* @link https://parashuto.com/rriver/development/img-size-attributes-are-back
*/
import { Image } from '@chakra-ui/react'
export const myComponent = () => (
// chakra image には元々 max-width: 100%; height: auto があたってる
<Image
src={'/some-large-image.png'}
@yano3nora
yano3nora / rye.md
Last active June 5, 2023 08:32
Rye - Experimental Python Package Manager. #python

Overview

rye-up.com
mitsuhiko/rye - github.com

  • flask 作者の all in one な python の package manager
  • pyenv 的な python 自体の version 管理も機能として含んでる
  • まだ実験的なリリースだが、かなり使用感はよく、本番利用も全然イケそうに見える
  • venv + pip-tools を裏手で動かして、project ごとの python 仮想環境を透過的に管理するイメージ

Getting Started