Skip to content

Instantly share code, notes, and snippets.

View raidenz's full-sized avatar

raidenz raidenz

View GitHub Profile
@raidenz
raidenz / reloop.ts
Created October 25, 2025 09:55
re loop dummy image
// use for fake data
const images = [1, 2, 3, 4]
const articles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const paired = articles.map((article, i) => ({
article,
image: images[i % images.length],
}))
// ---
@raidenz
raidenz / prisma-sqlite-checklist.md
Created October 25, 2025 05:37
prisma sqlite cheatsheet

prisma sqlite checklist

npm install better-sqlite3
npm install prisma --save-dev
npx prisma init --datasource-provider sqlite

# update database on .env DATABASE_URL="file:./dev.db"
# create schema
@raidenz
raidenz / elipsisPagination.js
Created October 25, 2025 05:28
elipsis pagination
// make pagination array smaller, better for responsive design
function elipsisPagination(currentPage, totalPages, visibleCount = 5) {
const pages = []
const showEllipsis = (arr, position) => {
if (position === 'start' && arr[0] !== 1) {
arr.unshift('...')
arr.unshift(1)
}
if (position === 'end' && arr[arr.length - 1] !== totalPages) {
@raidenz
raidenz / aliases.sh
Created January 10, 2025 12:35
Git bash alias (MyZsh) sh
// C:\Program Files\Git\etc\profile.d\aliases.sh
# Some good standards, which are not used if the user
# creates his/her own .bashrc/.bash_profile
# --show-control-chars: help showing Korean or accented characters
alias ls='ls -F --color=auto --show-control-chars'
alias ll='ls -l'
# Aliases
@raidenz
raidenz / windowsBootableUsbFromMac
Last active April 12, 2020 06:14
create usb bootable windows from mac
diksutil list
# change number wit your usb
diskutil eraseDisk MS-DOS "{usbName}" MBR disk{number}
# open iso files
ls /Volumes
# try to use -Rp instead
cp -Rp /Volumes/{OsIsoName}/* /Volumes/{usbName}/
@raidenz
raidenz / HomepageLayout.tsx
Created December 12, 2019 15:54
HomepageLayout with typescript
import * as React from "react";
import { Route, RouteProps } from "react-router";
interface Props {
component: React.ComponentType<RouteProps>;
}
export const HomepageLayout = ({ component: Component, ...rest }: Props) => {
return (
<Route {...rest} render={routeProps => <Component {...routeProps} />} />
);
@raidenz
raidenz / DumbComponent.jsx
Last active August 18, 2018 07:04
:medium: Dumb Compenent
import React from 'react'
const Name = (props) => {
return(
<div>
dumb Component
<div>
name: {props.name}
</div>
<input name="name" value={props.name} onChange={props.handleChange}/>
@raidenz
raidenz / SmartComponent.jsx
Last active August 18, 2018 07:06
:medium: smart component
import React from 'react'
class Statefull extends React.Component {
constructor(props){
super(props)
this.state={
name: ''
}
}
handleChange = (e) => {
@raidenz
raidenz / componenttype.txt
Last active August 18, 2018 06:56
:medium: react component type
╔════════════════╦═══════════════════╗
║ smart componen ║ dumb component ║
╠════════════════╬═══════════════════╣
║ statefull ║ Stateless ║
╠════════════════╬═══════════════════╣
║ container ║ functional ║
╚════════════════╩═══════════════════╝
@raidenz
raidenz / README.md
Created February 21, 2018 02:47
Sequelize + Express + Migrations + Seed Starter