Skip to content

Instantly share code, notes, and snippets.

View QuadFlask's full-sized avatar
๐ŸŒด
wanna go vacation

QuadFlask

๐ŸŒด
wanna go vacation
  • Seoul, Korea
View GitHub Profile
const url = 'https://www.lego.com/ko-kr/product/horizon-forbidden-west-tallneck-76989';
const stockSelector = "#main-content > div > div.ProductDetailsPagestyles__ProductOverviewContainer-sc-1waehzg-1.dgDnXa > div > div.ProductOverviewstyles__Container-sc-1a1az6h-2.hHubKC > div.ProductOverviewstyles__PriceAvailabilityWrapper-sc-1a1az6h-10.bwcpjP > p > span";
const titleSelector = "#main-content > div > div.ProductDetailsPagestyles__ProductOverviewContainer-sc-1waehzg-1.dgDnXa > div > div.ProductOverviewstyles__Container-sc-1a1az6h-2.hHubKC > div.ProductOverviewstyles__ProductOverviewRow-sc-1a1az6h-1.hblOYO > h1 > span";
async function loadWeb(url, selectors) {
const wv = new WebView();
wv.loadURL(url);
await wv.waitForLoad();
return await wv.evaluateJavaScript(`
@QuadFlask
QuadFlask / .phoenix.js
Last active May 23, 2022 03:58
phoenix screen config
Key.on("left", ["ctrl", "alt", "cmd"], function () {
const window = Window.focused();
if (window) {
const currentFocusedScreen = window.screen();
const screen = currentFocusedScreen.flippedVisibleFrame();
// const screen = currentFocusedScreen.next().flippedVisibleFrame();
if (isCloseRect(window.frame(), {x: screen.x, y: screen.y, width: screen.width / 2, height: screen.height})) {
if (closeTo(window.frame().width, screen.width / 2)) {
window.setFrame({
@QuadFlask
QuadFlask / KakaoAirPollution.js
Last active March 14, 2021 15:56
[ Scriptable] ์นด์นด์˜ค ์„œ์šธ ๋‚ ์”จ
const url = encodeURI("https://m.search.daum.net/kakao?w=tot&DA=Z8T&rtmaxcoll=Z8T&q=์„œ์šธ ์˜ค๋Š˜ ๋‚ ์”จ")
const wv = new WebView()
wv.loadURL(url)
await wv.waitForLoad()
const cont = await wv.evaluateJavaScript(`[...document.querySelectorAll(".cont_air>ul>li")].map(t => {
return {
title: t.querySelector('.txt_type')?.innerText,
import React, {FC} from "react";
const SimpleLineChart: FC<{
width: number;
height: number;
strokeWidth?: number;
strokeColor?: string;
data: { value: number; label?: string }[];
padding?: number;
}> = ({
@QuadFlask
QuadFlask / DonutChart.tsx
Created January 28, 2021 02:50
donut chart using svg
const DonutChart: FC<{
size: number;
data: {
value: number;
color: string;
}[];
strokeWidth?: number;
bgColor?: string;
}> = ({size, strokeWidth = 10, bgColor, data}) => {
const cx = size / 2;
@QuadFlask
QuadFlask / CovidStat.js
Last active December 22, 2020 16:14 — forked from julio-kim/CovidStat.js
[Scriptable] ์ฝ”๋กœ๋‚˜ ํ™•์ง„์ž ํ˜„ํ™ฉ
// ์ˆ˜์ • ๋‚ด์šฉ: ํŽ˜์ด์ง€ ๋Œ€์‹  ajax ํ˜ธ์ถœ๋กœ ์†๋„ ํ–ฅ์ƒ, ๋ฐ์ดํ„ฐ ์‚ฌ์šฉ๋Ÿ‰ ๊ฐ์†Œ
// ๊ธฐ๋ณธ ์ƒ‰์ƒ ๊ฒ€์€ ๋ฐฐ๊ฒฝ, ํฐ ๊ธ€์”จ, ๋นจ๊ฐ„ ์•„์ด์ฝ˜์œผ๋กœ ๋ณ€๊ฒฝ
const source = 'http://corona-live.com';
const request = new Request('https://apiv2.corona-live.com/stats.json?timestamp='+Date.now())
const response = await request.loadJSON()
const count = response.overview.current[0];
const now = new Date();
const date = `${now.getMonth()+1}์›” ${now.getDate()}์ผ ${now.toLocaleString('kr', { hour: 'numeric', minute: 'numeric', hour12: true })}`;
@QuadFlask
QuadFlask / websocket.d.ts
Created April 27, 2019 15:59
Type definition for WebSocket
// code from typescript/lib/lib.dom.d.ts
// It is useful when using react-native with typescript.
// Or you can add dom libarary as `lib: ["esnext" ,"dom"]` in tsconfig.json
interface WebSocketEventMap {
"close": CloseEvent;
"error": Event;
"message": MessageEvent;
"open": Event;
}
interface WithLoadingProps {
    loading: boolean;
}

const withMaybe = <P extends object>(predicate: (props: P) => boolean) =>
    (Component: React.ComponentType<P>) =>
        (props: P) => predicate(props) ? <Component {...props}/> : null;

JPA

1. JPA ์†Œ๊ฐœ

์™œ JPA? ๊ฐ์ฒด์ง€ํ–ฅ ๋ชจ๋ธ๋ง์„ ํ•  ์ˆ˜ ์žˆ์Œ. ์—ฐ๊ด€๊ด€๊ณ„์™€ ๊ด€๋ จ๋œ ํŒจ๋Ÿฌ๋‹ค์ž„ ๋ถˆ์ผ์น˜๋ฅผ ํ•ด๊ฒฐํ•ด์คŒ. ๊ฐ์ฒด ๊ทธ๋ž˜ํ”„ ํƒ์ƒ‰์ด ๊ฐ€๋Šฅํ•จ.(sql ์„ ์ง์ ‘ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ sql ์— ๋”ฐ๋ผ ๊ฐ์ฒด ๊ทธ๋ž˜ํ”„๋ฅผ ์–ด๋””๊นŒ์ง€ ํƒ์ƒ‰ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์ •ํ•ด์ง). ๋น„๊ต์— ์žˆ์–ด์„œ sql ์„ ํ†ตํ•ด ๊ฐ™์€ ๋กœ์šฐ๋ฅผ ๊ฐ€์ ธ์˜ฌ ๊ฒฝ์šฐ ์ธ์Šคํ„ด์Šค๊ฐ€ ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ์— ๋™์ผ์„ฑ ๋น„๊ต์— ์‹คํŒจ(์ด๊ฑด equals ๋งค์†Œ๋“œ ๊ตฌํ˜„์ด ๊ผญ ํ•„์š”ํ•จ)

์ƒ์‚ฐ์„ฑ, ์œ ์ง€๋ณด์ˆ˜, ์„ฑ๋Šฅ, ๋ฐ์ดํ„ฐ ์ ๊ทผ ์ถ”์ƒํ™”, ๋ฒค๋” ๋…๋ฆฝ์„ฑ, ํ‘œ์ค€

์ˆ˜์น˜ ๋ฏธ๋ถ„ Numerical Differentitaion link

f(x) = ax^n f`(x) = anx^(n-1) = df/dx (x) // ๊ตฌ์กฐ์ ์œผ๋กœ ๋ฏธ๋ถ„ํ•˜๋Š” ํ•ด์„์  ๋ฐฉ๋ฒ•

ํ•˜์ง€๋งŒ ์ปดํ„ฐ์—” ๋ฌดํ•œ์†Œ๊ฐ€ ์—†๊ธฐ๋•Œ๋ฌธ์— ์ˆ˜์น˜ ๋ฏธ๋ถ„์„ ํ•จ

df/dx (x) = ( f(x + dx) - f(x) ) / dx // forward differentiation