Skip to content

Instantly share code, notes, and snippets.

View Namchee's full-sized avatar
:octocat:
Lorem Ipsum

Cristopher Namchee

:octocat:
Lorem Ipsum
View GitHub Profile
@Namchee
Namchee / jest-to-vitest.sh
Created June 23, 2024 12:24 — forked from wojtekmaj/jest-to-vitest.sh
Automatically migrate Jest project to Vitest
#!/bin/bash
# Ensure we're working on the latest version of the main branch
git switch main
git fetch
git pull
# Create a new branch
git switch -c vitest
@Namchee
Namchee / builder.rs
Created February 28, 2024 13:48
Rust implementation of Builder Pattern
// Builder pattern lets you construct a complex object step by step
//
// In this case, let's say that you want to build a PC. As a first time
// however, you have difficulties in choosing the best part for your dream
// rig. Moreover, it seems like a new-and-better product will be coming soon.
// So, you buy those parts step-by-step and build them when all required
// parts are present.
//
// Moreover, a builder prevents you from making rookie mistakes such as choosing the wrong
// socket of CPU and motherboard or choosing outdated memory.
@Namchee
Namchee / advent-24.ts
Last active December 25, 2023 15:15
Advent of TypeScript Day 24
type Alley = " ";
type MazeItem = "🎄" | "🎅" | Alley;
type DELICIOUS_COOKIES = "🍪";
type MazeMatrix = MazeItem[][];
type Directions = "up" | "down" | "left" | "right";
type BuildTuple<L extends number, T extends any[] = [], Value = any> =
T['length'] extends L ? T : BuildTuple<L, [...T, Value], Value>;
type Increment<A extends number> = [...BuildTuple<A>, 1]['length'];
@Namchee
Namchee / layout.tsx
Created October 30, 2023 06:56
NextJS Server Component - Accessing Param
import { store } from './helpers/store';
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
const slug = store.get('slug');
return (
@Namchee
Namchee / intro.md
Last active September 27, 2023 12:00
Master Duel Handtrap Guide

Introduction to Hand Traps and Disclaimers

First off, what is a handtrap?

A handtrap is commonly known as a card that you discard/use to stop your opponent’s plays during their turn.

Some examples of those are Ash Blossom and Joyous Spring, or Effect Veiler. For convenience’s sake, I will list below the handtrap’s full name and its abbreviation, given by the community. This list will only have the most popular handtraps, as there are many in the game.

| Name | Alias |

@Namchee
Namchee / discordjs-slash-commands.md
Created May 26, 2021 02:18 — forked from advaith1/discordjs-slash-commands.md
Slash Commands in Discord.js
@Namchee
Namchee / solution.js
Created April 28, 2021 06:57
Serial Promise Resolver - courtesy of Anthony Budianto's tweet https://twitter.com/antonybudianto/status/1387211508296261633
// really quick and dirty way to solve it.
let count = 0;
const promisified = (time) => new Promise(resolve => {
setTimeout(resolve, time);
});
async function timeoutProms(proms, c, time) {
count++;
@Namchee
Namchee / Sample.vue
Last active February 28, 2021 10:00
[FAIL] Nuxt + CompositionAPI + TypeScript
<template>
<!-- start: navigation bar wrapper -->
<div class="flex justify-center items-center
navbar">
<!-- start: navigation bar -->
<div class="flex justify-evenly items-center
w-container">
<!-- start: logo -->
<nuxt-link
to="/">
@Namchee
Namchee / bot.ts
Created December 16, 2020 07:40
DiscordJS: onReact doesn't work
import { Client, Collection, Guild, Message, MessageReaction, OverwriteResolvable, Role, TextChannel, User } from 'discord.js';
import { format } from 'date-fns';
import { readdirSync } from 'fs';
import { resolve } from 'path';
import { prefix, textChannelName, categoryChannelName, react } from './../../bot.config.json';
import { CommandHandler, Context, HandlerFunction, RETWEET } from '../common/types';
import { Tweet } from '../entity/tweet';
/**
* Core functionality of the bot. Allows users to interact
@Namchee
Namchee / test.tex
Created March 2, 2020 05:42
HAHAHAHA
\documentclass{report}
\usepackage{amsmath}
\begin{document}
Jika $-1 < a < 1$, maka,
\begin{equation}
\int_{0}^{\infty} \frac{u^a}{(1 + u)^2} du = a!(-a)!
\label{eq:rumus}