Skip to content

Instantly share code, notes, and snippets.

View 3ru's full-sized avatar
❄️
Waitin' 2045

Leo 3ru

❄️
Waitin' 2045
  • usc
  • Los Angeles, Tokyo
  • 06:40 (UTC +09:00)
View GitHub Profile
@3ru
3ru / fileCreator.ts
Created March 26, 2023 12:45
Function to create files and directories simultaneously using the fs package.
import fs from 'fs/promises'
/**
* Create files recursively if no directory.
*/
export const createFile = async (
data: string,
filePath: string,
): Promise<void> => {
try {
@3ru
3ru / ReactP5Wrapper.tsx
Last active March 26, 2023 12:47
React p5 wrapper on Nextjs
import dynamic from 'next/dynamic';
import { P5WrapperProps } from 'react-p5-wrapper';
import { NamedExoticComponent } from 'react';
const importReactP5Wrapper = async () => {
const module = await import('react-p5-wrapper');
return module.ReactP5Wrapper as NamedExoticComponent<P5WrapperProps>;
};
export const ReactP5Wrapper = dynamic(importReactP5Wrapper, {
@3ru
3ru / .commit_template
Last active April 9, 2021 04:00
🐲 Emoji prefix
# ==== Prefix ====
# init
# feat
# fix
# refactor
# docs
# des
# remove
TypeScript 2 hrs 29 mins ██████████████████░░░ 86.0%
YAML 17 mins ██░░░░░░░░░░░░░░░░░░░ 9.8%
textmate 5 mins ▋░░░░░░░░░░░░░░░░░░░░ 3.1%
yarn.lock 1 min ▏░░░░░░░░░░░░░░░░░░░░ 0.7%
JSON 0 secs ░░░░░░░░░░░░░░░░░░░░░ 0.3%