Skip to content

Instantly share code, notes, and snippets.

View kenu's full-sized avatar

kenu kenu

View GitHub Profile
@kenu
kenu / jscommons
Created May 25, 2014 17:24
js commons
var commons = {
drop: function (list, i) {
return list.slice(0, i).concat(list.slice(i + 1));
},
getOptions: function(list, vkey, nkey) {
var listHtml = "";
for (var i=0 ; i<list.length ; i++) {
listHtml += "<option value='";
listHtml += list[i][vkey];
@kenu
kenu / money.js
Last active August 29, 2015 14:02
jquery plugin for money
$.fn.money = function() {
var M = {};
M = {
prefix: "$ ",
floatFlag: "off",
format: function() {
M.config(this);
var n = $(this).val().replace(/[\$\s,]/g, "");
$("#checkAll").on("click", function(){
var sts = $("#checkAll").attr("checked") == "checked";
$('input[name="code"]').attr("checked", sts);
});
$("#frm").serialize().split("&").sort();
private static final Logger logger = LoggerFactory.getLogger(Commons.class);
public static void writeJSON(HttpServletResponse response,
final String label, final Object data) {
JSONObject jsonObj = new JSONObject();
jsonObj.put(label, data);
response.setContentType("application/json; charset=UTF-8");
@kenu
kenu / util.js
Created August 14, 2011 06:42
javascript file loading
function loadJQuery() {
var oScript = document.createElement("script");
oScript.type = "text/javascript";
oScript.charset = "utf-8";
oScript.src = "http://code.jquery.com/jquery-1.6.2.min.js";
document.getElementsByTagName("head")[0].appendChild(oScript);
}
@kenu
kenu / loadcss.js
Created August 29, 2011 08:37
stylesheet loading
var cLink = document.createElement("link");
cLink.rel = "stylesheet";
cLink.type = "text/css";
cLink.href = "/event/200908/nas.css";
document.getElementsByTagName("head")[0].appendChild(cLink);
@kenu
kenu / decodeAny
Created March 3, 2020 02:56
decodeAny
package com.okdevtv;
import static org.junit.Assert.*;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import org.junit.Test;
public class KrDecoderTest {
@Test
@kenu
kenu / jest.md
Last active May 25, 2020 09:11
jest

Jest

jest 설치

npm i -g jest

파일 테스트

  • 개별 파일
@kenu
kenu / gist:971d4354f09bd2490c7a69c69f1cb988
Created December 19, 2020 14:02
extract youtube list
var items = document.querySelectorAll('[id=dismissable]')
items.forEach(item => {
var data = {
title: item.children[1].children[0].children[0].innerText,
link: item.children[1].children[0].children[0].children[1].href,
meta: item.children[1].children[0].children[1].innerText
};
console.log(JSON.stringify(data));
});
@kenu
kenu / hide.js
Last active September 8, 2021 07:49
Hide lines of issue with `Bump` keyword.
* Hide line of issues with `Bump` keyword.
* Use this code in console of GitHub issue list page.
```js
const issues = document.querySelectorAll('.js-issue-row');
[...issues].forEach((issue, idx) => {
issues[idx].hidden = issue.innerText.includes('Bump');
});
```