Skip to content

Instantly share code, notes, and snippets.

@yano3nora
yano3nora / scp.md
Last active November 20, 2024 09:02
scp - file transfer (download) command by ssh

https://qiita.com/katsukii/items/225cd3de6d3d06a9abcb

# CREDENTIAL.pem を使って ec2-user ユーザで xxx ホスト (ec2) の
# ~/path/to/src ファイルをローカルの ~/path/to/dist に落としてくる
$ scp -i "CREDENTIAL.pem" -r ec2-user@xxx.ap-northeast-1.compute.amazonaws.com:~/path/to/src ~/path/to/dist
@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 September 20, 2024 06:13
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'}