Skip to content

Instantly share code, notes, and snippets.

View YankeeTube's full-sized avatar
🌩️

GM Yankee YankeeTube

🌩️
View GitHub Profile
@YankeeTube
YankeeTube / README.md
Last active June 11, 2023 23:49
Remix + Cloudflare KV Session

Remix On Cloudflare Worker KV Usage Example

This document started with my question on Remix.js discord.

About

This is an example of poor content in the official document, and for customization to use the prefix function, please check the contents written in the comment below.

createWorkersKVSessionStorage original code However, when I saw this code, I thought that this function had no role meaning, and there is a code for customizing it in the comment below.

@YankeeTube
YankeeTube / index.html
Last active October 22, 2022 08:18
So Very Fast NSFWJS on TFJS WASM + Web Worker
<html>
<head></head>
<body>
<div>
<input type="file" id="file-input" />
</div>
</body>
<script>
const worker = new Worker('worker.js');
@YankeeTube
YankeeTube / click_outside.ts
Created July 23, 2022 16:01
click outside vanilla ts
function clickOutSideHandler(elem: HTMLElement, e: Event) {
const isInside = elem?.contains(e.target as HTMLElement)
const handler = clickOutSideHandler.bind(null, elem);
if (!isInside) {
const closeEvent = new CustomEvent('CLOSE', {detail: e})
elem.dispatchEvent(closeEvent)
} else {
document.addEventListener('click', handler, {once: true})
}
@YankeeTube
YankeeTube / event_watcher.js
Last active December 3, 2021 05:52
It easily helps listeners of dirty events in Specific Elements. I was inspired by Vue.js' Watch.
const EventWatch = function(selector, instance, config={}) {
this.subscribe = {[selector]: {}}
this.selector = selector
this.element = document.querySelector(selector)
if (!this.element) throw "Element Not found."
Object.entries(instance).map(([eventName, eventHandler]) => {
const newEventHandler = (e) => {
const beforeEvent = new CustomEvent(`${eventName}:before`)
const afterEvent = new CustomEvent(`${eventName}:after`)
@YankeeTube
YankeeTube / 1_Storage.sol
Created November 21, 2020 11:18
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.17+commit.d19bba13.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
@YankeeTube
YankeeTube / nvm-install.sh
Created January 5, 2020 10:43
양키와 Prisma2 시작하기 #02. NVM으로 ndoejs 설치하기
#!/bin/bash
version=$(curl -sS https://github.com/nvm-sh/nvm/tags | grep 'href="/nvm-sh/nvm/releases/tag/' | head -n 1 | grep -oe '[^ /]*$' | grep -oe '[^ \">]*')
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$version/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
@YankeeTube
YankeeTube / docker-compose.yml
Created January 1, 2020 14:12
mysql 생성을 위한 컴포즈
version: '3'
services:
mysql:
image: mysql
restart: always
container_name: mysql
environment:
- MYSQL_ROOT_USER=root
- MYSQL_ROOT_PASSWORD=learn1234!
- MYSQL_DATABASE=learn
@YankeeTube
YankeeTube / install.sh
Created January 1, 2020 13:51
docker and docker-compose auto install
install_docker()
{
chk1=`dpkg -l | grep 'docker'`
if [ -z "$chk1" ]; then
echo "Docker Install Start..."
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
@YankeeTube
YankeeTube / print.py
Created May 7, 2019 08:47
Python Tutorial
print()
print("출력!")
print("\n\n")
@YankeeTube
YankeeTube / input2.py
Last active May 7, 2019 08:45
Python Tutorial
input("입력 : ")
input("값을 입력해주세요. \n") # \n 은 개행 문자라고 하며, 줄 바꿈을 의미합니다.