Skip to content

Instantly share code, notes, and snippets.

View sairion's full-sized avatar
⚛️

Jaeho Lee (Jay) sairion

⚛️
View GitHub Profile
@sairion
sairion / the-great-suspender-url-retriever.js
Last active September 13, 2015 23:59
the-great-suspender-url-retriever.js
newlineSeparatedUrls.split('\n')
.map(url => {
if (url.startsWith('chrome-extension')) return decodeURIComponent(url.split('#url=')[1]);
else return url;
})
.sort()
.reduce((urls, url) => urls + '\n' + url); // TODO: duplicate removal
@sairion
sairion / tokenizer.js
Created August 31, 2015 08:32
tokenizer.js
// given string
// team_id=T024SJH61&team_size=130&ver=10566d07abfaee053ed117f2ea998043c5626d16-1440968282&data=client_load%3A10784.614%3Bused_js_heap_size%3A51.022
// recursively tokenize
// 'stage' is needed, since there is strcuture
// `value ; value` => `value & value` => `key = value`
// solution 1: define steps and define token types.
// token types are:
@sairion
sairion / func-creator.js
Created August 30, 2015 14:05
Create named function
function funcCreator (funcName) {
eval('window.' + funcName + ' = function ' + funcName + ' () {};');
var func = window[funcName];
window[funcName] = undefined;
delete window[funcName];
return func;
}
@sairion
sairion / fbmodules.js
Created August 24, 2015 17:28
Facebook Modules of 2015-08-25
var a= '';
for (var i in require.__debug.modules) {
a += (i + '\n');
}
console.log(a);
/*
module
exports
define
function asyncIterCreator() {
var i = null;
var stopper = false;
return {
iter: function asyncIter(iterfunc) {
return (i = setTimeout(function iterable() {
if (stopper) return;
iterfunc();
@sairion
sairion / The Technical Interview Cheat Sheet.md
Last active August 29, 2015 14:27 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@sairion
sairion / painkiller-public.js
Created June 11, 2015 04:47
painkiller-public.js
(function(memberId){
var TARGET_SPECIFER = '___TARG';
var TARGET_SPECIFER_CLASS = '.' + TARGET_SPECIFER;
var fireInterval = 100000;
// Add style
var TARGET_STYLE = TARGET_SPECIFER_CLASS + ' { opacity: 0.1; }'
document.styleSheets[0].insertRule(TARGET_STYLE, 0)
var taggedMessagesCount = 0;
@sairion
sairion / Starting with Webpack.md
Last active August 29, 2015 14:18
Starting with Webpack.md

Webpack을 사용한 현대적 자바스크립트 개발 시작하기

Webpack은 @sokra(Tobias Koppers)와 컨트리뷰터들이 구현하고 있는 자바스크립트 기반의 모듈 번들러와 그를 받쳐주는 라이브러리(webpack/lib), 그리고 에코시스템(플러그인, 로더)들을 의미합니다.

스포카에서는 2014년 12월부터 React.js를 전면 도입하여 새 버젼의 적립 애플리케이션을 제작하고 있습니다. 이 개발 과정을 뒷받침해주고 있는 가장 중요한 도구를 말하라고 한다면 두말할 것도 없이 Webpack일 것입니다.

사실 Node.js나 파이썬 같은 환경에서 개발을 해본 사람들에게는 모듈이라는 개념이 익숙하지만, 웹 프론트엔드 개발자에게 모듈이라는 개념은 조금 낯설 수 있는 것이 사실입니다. require.js와 같은 AMD 시스템 또는 Browserify같은 도구를 이용해 본 경험이 없다면 말이죠.

모듈이라는 것은 굉장히 중요합니다. 모듈 시스템을 갖춘 환경에서 일해본 사람은 어떤 이유에서든 그 중요성에 모두 공감할 것입니다. 하지만 웹에는 표준적인 개념의 모듈이라는 것이 없었습니다 (사실 아직도 제대로 된 것은 딱히 없습니다만). 그렇기 때문에 자바스크립트 모듈을 사용하기 위해서는 모듈을 다룰 수 있는 시스템 (RequireJS, CommonJS 등)이 필요하고, 모듈들의 내용과 export들을 이해하고 원하는 형태로 변형할 수 있는 도구가 필요합니다. Webpack과 Browserify는 이런 것을

@sairion
sairion / ikea-availability.py
Last active October 20, 2017 17:20
get ikea availability data
# -*- coding: utf-8 -*-
import datetime
import requests
from xml.etree import ElementTree
# \n릴나겐 유리닦이 202.435.97 / 직원문의\n링셴 샤워커튼링 001.793.90 / 직원문의\n에게그룬드 샤워커튼 902.094.39 / 직원문의\n고드모르곤 양문형 거울장(총 3짝 사야함, 옆에 붙어있어도 문이 열리는지 확인) 702.189.96 / 직원문의\n알렉스 서랍유닛 801.928.25 / 11.19\n칼뷔 조리대 (나무 3종) 202.971.18 / 직원문의\n로그룬드 휴지스탠드 102.530.73 / 직원문의\n세베른 샤워 커튼봉 701.667.99 / 직원문의\n롱란 거울 402.886.98 / 직원문의\n오플란트 4칸 서랍장 302.691.53 / 품절\n오플란드 2칸 서랍장 202.691.44 / 직원문의\n드라간 욕실 수납함 2종 202.226.08 / 직원문의\n임멜른 비누받침 902.526.25 / 직원문의\n몰게르 거울 (80*60) 602.304.99 / 44.10\n비테묄라 벽부착등 102.835.03 / 품절\n(몰게르 벽선반이 없으면) 몰게르 선반장 702.673.93 / 32.10\n몰게르 벽선반 802.423.59 / 44.04\n".match(/(\d+\.\d+.\d+)/g).map(function(e){e.split('.').join('')})
item_ids = ["20243597", "00179390", "90209439", "70218996", "80192825", "20297118", "10253073", "70166799", "40288698", "30269153", "20269144", "20222608", "90252625", "60230499", "10283503", "70267393", "80242359", "40249961"]
item_query_result = [] # item_id, item_availability, validDate
@sairion
sairion / inline svg icon.jsx
Created March 18, 2015 11:36
inline svg icon.jsx
"use strict";
/**
* <IconSvg />
* (from https://gist.github.com/MoOx/1eb30eac43b2114de73a, modified by Jaeho Lee)
*
* Usage:
* <IconSvg svg={require("gear.svg")} />
*
*/