Skip to content

Instantly share code, notes, and snippets.

"use client";
// Import necessary utilities and components.
// tailwind-merge is used to intelligently merge Tailwind CSS classes, preventing conflicts.
import React from "react";
import { twMerge } from "tailwind-merge";
// useState is a React Hook for managing state within the component.
import { useState } from "react";
// Custom icon components for the sidebar.
/**
* Compose functions from right to left
*
* @link {@see https://www.oreilly.com/library/view/hands-on-functional-programming/9781788831437/d3234c19-df94-49e3-ab09-f0da9fbb71f7.xhtml reference}
* @usage
* ```ts
* const composed = pipe(
* (num: number) => num + 1,
* (num: number) => num * 2,
* );
@iamyuu
iamyuu / deleteStaleBranches.js
Created March 5, 2024 04:54
Delete stale branches on GitHub
async function deleteStaleBranches(delay = 500) {
var stale_branches = document.querySelectorAll('[aria-label="Delete branch"]');
for (var i = 0; i < stale_branches.length; i++) {
stale_branches.item(i).click();
await new Promise(r => setTimeout(r, delay));
}
const next = document.querySelector('[aria-label="Next Page"]');
if (next) {
next.click();
import * as React from 'react';
import toast from 'favorite-toast-library';
export type UseFormSubmissionOptions = (formData: FormData) => void | Promise<void>;
export function useFormSubmission(mutationFn: UseFormSubmittionOptions) {
const [isSubmitting, setSubmitting] = React.useState(false);
async function submitHandler(event: React.FormEvent) {
event.preventDefault();
@iamyuu
iamyuu / README.md
Created July 24, 2021 10:01
Postman auto set token after login

Add this on Tests tab:

const jsonData = pm.response.json();
pm.environment.set("auth-token", jsonData["token"]);

token: response from service auth-token: variable name on postman

{
"paddingVertical": "56px",
"paddingHorizontal": "56px",
"backgroundImage": null,
"backgroundImageSelection": null,
"backgroundMode": "color",
"backgroundColor": "rgba(171, 184, 195, 1)",
"dropShadow": true,
"dropShadowOffsetY": "20px",
"dropShadowBlurRadius": "68px",
@iamyuu
iamyuu / BOL.md
Last active January 10, 2021 10:10
Download lecture notes from binus online learning

Motivasi

Mengunduh satu per satu berkas itu sangat melelahkan, jadi kenapa tidak di otomatiskan saja.

Penggunaan

CATATAN: Untuk saat ini Anda perlu berpindah mata kuliah secara manual.

Dari halaman /Dashboard pilih salah satu mata kuliah, setelah ke halaman /Course/Activity lalu di bagian tab pilih References, lalu klik kanan pada halaman dan pilih Inspect, setelah itu tinggal copy & paste pada tab Console

@iamyuu
iamyuu / History\-20c52759\entries.json
Last active August 16, 2022 12:55
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///d%3A/dev/researcher-client-2.0/src/views/CxTools/Survey/CreateNPS/components/step/GeneralInformation.js","entries":[{"id":"gHIg.js","timestamp":1660640861905},{"id":"nn00.js","timestamp":1660641336423},{"id":"bZnT.js","timestamp":1660641487296},{"id":"kVHE.js","timestamp":1660641511299},{"id":"uTZu.js","timestamp":1660641831144},{"id":"uvbb.js","timestamp":1660641845617},{"id":"jyBZ.js","timestamp":1660641861101},{"id":"cyvl.js","timestamp":1660641900542},{"id":"sxpD.js","timestamp":1660641991222},{"id":"Ry4o.js","timestamp":1660642068528},{"id":"6PNk.js","source":"Workspace Edit","timestamp":1660644884705},{"id":"QOVZ.js","timestamp":1660644922682},{"id":"Qehf.js","timestamp":1660645038395},{"id":"Np4J.js","timestamp":1660646765038},{"id":"QwmM.js","timestamp":1660647278763},{"id":"CnQI.js","timestamp":1660647297415},{"id":"NswJ.js","timestamp":1660647335671},{"id":"3ME0.js","timestamp":1660647356022},{"id":"dY9z.js","timestamp":1660647370981},{"id":"xOj4.js","source":"Worksp