Skip to content

Instantly share code, notes, and snippets.

View sairion's full-sized avatar
⚛️

Jaeho Lee (Jay) sairion

⚛️
View GitHub Profile
@sairion
sairion / Instagram shared data.js
Created August 28, 2016 10:35
Get Instagram shared data via fetching HTML (i.e. location data)
let __DEBUG_HTML = '';
function fetchLoc(locID){
return fetch(`https://www.instagram.com/explore/locations/${locID}/`)
.then(res => res.text())
.then(txt => {
__DEBUG_HTML = txt;
const doc = parseInstgramExplorePage(txt);
const sharedData = extractSharedData(doc);
const locData = extractLocationData(sharedData);
@sairion
sairion / inline_svg.py
Created October 29, 2014 08:10
inline_svg.py
from jinja2 import Markup
def include_raw(filename, wrapwith='div', classname='', endpoint='static'):
"""Include raw file content into Jinja2 template. Applicable for
document such as XML, SVG, PostScript.
Usage example:
{{ include_raw('images/icon.svg', classname='icon', wrapwith='span') }}
"""
with file(os.path.join(app.root_path, endpoint, filename),
@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
@sairion
sairion / Slice URL and get param values via JavaScript.js
Last active May 22, 2018 06:41
Slice URL and get param values via JavaScript
//using String.split to split and assign Object
function splitCurrentURL(){
//query given index.html?this=true&that=good;
var url = location.href.split("?")[1]; // this=true&that=good;
params = {}; //init param obj
url = url.split("&"); // ['this=true','that=good']
for(var i = 0; i<url.length; i++){
var split_cache = url[i].split("="); // ['this','true'], ...
@sairion
sairion / Data Structures.md
Created October 27, 2013 08:05
Data Structures

Popular Structures

List

Linked List: Linked list is a dynamic data structure whose length can be increased or decreased at run time.

How Linked lists are different from arrays? Consider the following points :

An array is a static data structure. This means the length of array cannot be altered at run time. While, a linked list is a dynamic data structure. In an array, all the elements are kept at consecutive memory locations while in a linked list the elements (or nodes) may be kept at any location but still connected to each other.

@sairion
sairion / README.md
Created January 3, 2018 16:25 — forked from ahmadsoe/README.md
VPNGate Python script

#VPNGate for OS X This script is a simple script for using to connect vpn server list provided VPNGate through OpenVPN on OS X environment.

It inspired by VPNGate Python script wrtten by Andrea Lazzarotto.

##Requirements If you use the script, Tunnelblick needs to be installed first.

##Installation Open terminal app and copy & paste the command below.

@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 / isdigit_bench.js
Last active May 5, 2017 17:29
isdigit_bench.js
function isDigit_parse(num){ return !Number.isNaN(Number(num.trim())) } // should trim for same functionality
function isDigit_regex(num){ return rgx.test(num) }
var ts = 'a'
var emptyString = ''
var ts2 = 'b'
var rgx = /^[0-9]+$/
console.time('pI')
@sairion
sairion / hacker-news.js
Last active April 15, 2017 13:19
trim and fetch some hn stuff
/*
function setCustomStyle(content) {
let style = q('#custom-style')
if (q('#custom-style') === null) {
style = document.createElement('style')
style.id = 'custom-style'
document.head.appendChild(style)
}
style.textContent = content
}
function range(limit) {
return Array.from(Array(limit)).map((_,i) => i)
}
function piramid(height = 10) {
return range(height).reduce((ret, i) => {
let space = ' '.repeat(height - i)
let slope = '*'.repeat(i)
return ret + `${space}${slope}*${slope}${space}\n`
}, '\n')