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