Skip to content

Instantly share code, notes, and snippets.

View DonHuskini's full-sized avatar
🏠
Working from home

Don Huskini DonHuskini

🏠
Working from home
View GitHub Profile
@DonHuskini
DonHuskini / reset.sh
Created March 16, 2025 20:18 — forked from m5lil/reset.sh
[reset jetbrains application trial] reset jetbrains ide evals v1.0.4 #others
#!/bin/bash
# reset jetbrains ide evals v1.0.4
OS_NAME=$(uname -s)
JB_PRODUCTS="IntelliJIdea CLion PhpStorm GoLand PyCharm WebStorm Rider DataGrip RubyMine AppCode"
if [ "$OS_NAME" == "Darwin" ]; then
echo 'macOS:'
for PRD in $JB_PRODUCTS; do
//@version=5
indicator("EMAs", shorttitle="EMA", overlay=true)
// Plot 100H4 EMA line
plot(request.security(syminfo.tickerid, '240', ta.ema(close, 100)), linewidth=1, color=color.gray, title='100H4', trackprice = true, show_last = 1)
// Plot 200H4 EMA
plot(request.security(syminfo.tickerid, '240', ta.ema(close, 200)), linewidth=1, color=color.gray, title='200H4', trackprice = true, show_last = 1)
// Plot 100D1 EMA
@DonHuskini
DonHuskini / fp-composition-generics.ts
Created February 22, 2023 14:48
Example of Functional Programming composition funciton with TypeScript Generics
interface IMealCategory {
id: number
key: 'desert' | 'slow-cook' | 'breakfast' | 'protein'
}
const getMealCategoryBy = <T extends IMealCategory, K extends keyof IMealCategory>(mealCategories: T[], by: K) => {
return (value: T[K]) => {
return mealCategories.find((mealCategory) => {
return mealCategory[by] === value
})
@DonHuskini
DonHuskini / dialog.tsx
Created December 3, 2022 21:56
radixui dialog + specialized dialog
import * as DialogPrimitive from '@radix-ui/react-dialog'
import CloseIcon from 'components/icons/CloseIcon'
import React from 'react'
const classes = {
overlay: /* tw: */ `fixed inset-0 bg-black/30 rdx-state-open:animate-fade-in rdx-state-closed:animate-fade-out`,
content: /* tw: */ `fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 w-[calc(100%-40px)] h-[calc(100%-40px)] md:h-auto max-w-[900px] overflow-hidden rounded-md drop-shadow-card bg-white outline-none rdx-state-open:animate-fade-in rdx-state-closed:animate-fade-out`
}
type DialogProps = {
@DonHuskini
DonHuskini / ShopPageMainSection.tsx
Last active December 13, 2022 18:39
Example working with variant
import { EExperimentVersion } from '@/types'
import ProductCardA, { type IProductCardAProps } from './ProductCardA'
import ProductCardC, { type IProductCardCProps } from './ProductCardC'
type PropsVariantA = {
variant?: Extract<keyof typeof EExperimentVersion, 'a'>
} & IProductCardAProps
type PropsVariantC = {
import React, { ReactNode } from 'react'
type CardProps = {
children: React.ReactNode
}
const Slots = {
image: null,
title: null,
content: null,
import cn from 'classnames'
import useEmblaCarousel, { UseEmblaCarouselType } from 'embla-carousel-react'
import React, { useCallback, useContext, useEffect, useState } from 'react'
import { NextButton, PrevButton } from './CarouselButtons'
const Context = React.createContext<{
emblaRef: UseEmblaCarouselType[0]
thumbRef: UseEmblaCarouselType[0]
/**
* @deprecated Use the new {@see [Tooltip](../common/Tooltip/Tooltip.tsx)} component instead.
*/
@DonHuskini
DonHuskini / debugger-setup.txt
Created November 8, 2022 00:28
Setup VSCode Debbuger (Best Way)
# .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
@DonHuskini
DonHuskini / this-was-though.js
Last active October 14, 2022 17:01
Node with multiple Requests with `request` lib. With Promises.
const request = require("request");
const baseUrl = "https://jsonmock.hackerrank.com/api/football_matches";
async function myReq(url) {
return new Promise((resolve) => {
request.get(url.toString(), (err, response, body) => {
const data = JSON.parse(body);
resolve(data);
});