Skip to content

Instantly share code, notes, and snippets.

@egoing
egoing / gist:11163965
Last active January 8, 2018 13:51
Youtube에서 재생목록의 총재생시간을 알아내는 스크립트
var times = document.querySelectorAll('.pl-video .pl-video-time .timestamp span');
var duration = 0;
for(var i=0; i<times.length; i++){
var t = times[i];
t = t.innerText;
t = t.split(':')
min = t[0];
sec = t[1];
duration = duration + parseInt(sec) + parseInt(min)*60
}
@egoing
egoing / gist:1f14bbe0cba467ccacfb
Last active May 20, 2017 15:20
페이스북 자동 가입
auto_register = new Object();
auto_register.add_member = function(member_id, group_id, ignore, callback) {
x = new XMLHttpRequest();
x.onreadystatechange = function() {
if (x.readyState == 4) {
if (x.status == 200) {
if (callback)
callback(member_id, group_id);
console.log('success', member_id);
} else
@egoing
egoing / gist:f5548477280b9cc95029
Created July 10, 2015 05:23
국가도메인 리스트 배열
[".ac",".ad",".ae",".af",".ag",".ai",".al",".am",".an",".ao",".aq",".ar",".as",".at",".au",".aw",".ax",".az",".ba",".bb",".bd",".be",".bf",".bg",".bh",".bi",".bj",".bm",".bn",".bo",".br",".bs",".bt",".bu",".bv",".bw",".by",".bz",".ca",".cc",".cd",".cf",".cg",".ch",".ci",".ck",".cl",".cm",".cn",".co",".cr",".cs",".cu",".cv",".cx",".cy",".cz",".de",".dj",".dk",".dm",".do",".dz",".ec",".ee",".eg",".eh",".er",".es",".et",".eu",".fi",".fj",".fk",".fm",".fo",".fr",".ga",".gb",".gd",".ge",".gf",".gg",".gh",".gi",".gl",".gm",".gn",".gp",".gq",".gr",".gs",".gt",".gu",".gw",".gy",".hk",".hm",".hn",".hr",".ht",".hu",".id",".ie",".il",".im",".in",".io",".iq",".ir",".is",".it",".je",".jm",".jo",".jp",".ke",".kg",".kh",".ki",".km",".kn",".kp",".kr",".kw",".ky",".kz",".la",".lb",".lc",".li",".lk",".lr",".ls",".lt",".lu",".lv",".ly",".ma",".mc",".md",".me",".mg",".mh",".mk",".ml",".mm",".mn",".mo",".mp",".mq",".mr",".ms",".mt",".mu",".mv",".mw",".mx",".my",".mz",".na",".nc",".ne",".nf",".ng",".ni",".nl",".no",".np",".nr",".n
function uniqify(target){
var cleaned = target.replace(/(^[ \t]*\n)/gm, "");
var cleanedArr = cleaned.split('\n');
var uniqued = cleanedArr.filter(function(item, pos) {
return cleanedArr.indexOf(item) == pos;
});
return uniqued.join('\n');
}
function shuffle(a) {
var j, x, i;
for (i = a.length; i; i--) {
j = Math.floor(Math.random() * i);
x = a[i - 1];
a[i - 1] = a[j];
a[j] = x;
}
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
body{
background-image: url("https://source.unsplash.com/collection/958757/1600x900");
background-repeat: no-repeat;
background-size: cover;
@egoing
egoing / gist:cbe2475cd1628b9a5456a34775910b36
Created June 29, 2017 00:11
코딩야학 1기 사연 공개키
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArkut5UC/R8V+lxryaLb6
Cf4qxUarRqBTl8JrMOXveB6ta9/n54bHfNCciILE0hAG0d4GN4oI6votS9YOP9aT
DBpDQpPy6HHR+o20ti91Oh/HZbwso+gUkzTycRYsReumCWcii6iwl7bdqaAyg7+S
CaPDcfEEt4geBizfLaaaJIHKY4ImCdemEB6jKFXRE5xsb7NCCLqS7wq01J2fau4w
JkyFxmhd9Ira8GO465tb0RZ61z2scwWc7gnRLrVOaC5LxjVoKYXXxJLS9rRBhA37
2vuzW/YcNL4bmxD9x/E6IpI6FMToa+V3LtgArc2GyLSD2W4hn5DjqdwcPBecEnLY
AwIDAQAB
-----END PUBLIC KEY-----
@egoing
egoing / gist:20de97ee243e163272cde3db7e09bda8
Created August 11, 2017 10:05
구글 스프래드쉬트를 활용한 추첨
function shuffle(a) {
var j, x, i;
for (i = a.length; i; i--) {
j = Math.floor(Math.random() * i);
x = a[i - 1];
a[i - 1] = a[j];
a[j] = x;
}
}
/*
댓글 선택자를 설정해주셔야 합니다.
페이스북 그룹
리액션 : '#mount_0_0 > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div:nth-child(4) > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div > div.iqfcb0g7.tojvnm2t.a6sixzi8.k5wvi7nf.q3lfd5jv.pk4s997a.bipmatt0.cebpdrjk.qowsmv63.owwhemhu.dp1hu0rb.dhp61c6y.l9j0dhe7.iyyx5f41.a8s20v7p > div > div > div > div.q5bimw55.rpm2j7zs.k7i0oixp.gvuykj2m.j83agx80.cbu4d94t.ni8dbmo4.eg9m0zos.l9j0dhe7.du4w35lb.ofs802cu.pohlnb88.dkue75c7.mb9wzai9.l56l04vs.r57mb794.kh7kg01d.c3g1iek1.otl40fxz.cxgpxx05.rz4wbd8a.sj5x9vvc.a8nywdso > div.j83agx80.cbu4d94t.buofh1pr a.esr5mh6w'
공유 : '#mount_0_0 > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div:nth-child(4) > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div > div.iqfcb0g7.tojvnm2t.a6sixzi8.k5wvi7nf.q3lfd5jv.pk4s997a.bipmatt0.cebpdrjk.qowsmv63.owwhemhu.dp1hu0rb.dhp61c6y.l9j0dhe7.iyyx5f41.a8s20v7p > div > div > div h3 a';
댓글 : '#mount_0_0 > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div.rq0escxv.l9j0dhe7.du4w35lb > div > div > div.j83agx80.cbu4d94t.d6urw2fd.dp1h
@egoing
egoing / gist:25cc277c2201e1aeac270ce6621a33b6
Last active April 25, 2018 04:05
생활코딩 페이스북 그룹 소개
생활코딩 페이스북 그룹은 코딩을 처음 시작하는 분들이 서로를 돕기 위해서 시작된 커뮤니티입니다. 코딩이라는 범위 안에서 정보와 의견을 나누는 공간입니다. 활동을 시작하기 전에 가이드를 읽어주세요. https://www.facebook.com/notes/생활코딩/생활코딩-페이스북-그룹-커뮤니티-정책-rfc/1797775593596302/