Skip to content

Instantly share code, notes, and snippets.

View namomo's full-sized avatar

Dongho, Shin namomo

View GitHub Profile
function addComma(val)
{
if (val === undefined) return '0';
var reg = /(^[+-]?\d+)(\d{3})/;
val += '';
while(reg.test(val)) {
val = val.replace(reg, '$1' + ',' + '$2');
}
return val;
@namomo
namomo / windowClose.js
Last active January 24, 2017 15:45
window close
function closeWindow()
{
window.open("about:blank","_self").close(); // 새창 열기를 통해 열어진 윈도우 닫기
// or
self.opener = self; // 기본적으로 창 닫기
window.close();
}
@namomo
namomo / getMySqlQueryResult_in_bash.sh
Last active October 28, 2015 02:05
bash db query
#!/bin/bash
QUERY=`mysql -u[ID] -p[PW] -s -N -e "select email from [DATABASE].[TABLE]"`
for email in ${QUERY}; do
echo ${email}
done
@namomo
namomo / resizeDIV.js
Created October 28, 2015 01:46
div resize
function resizeDiv()
{
var size = {
width: window.innerWidth || document.body.clientWidth,
height: window.innerHeight || document.body.clientHeight
};
var contSize = {
width: 480,
height: 720
}
@namomo
namomo / check_condition.sh
Created October 6, 2015 04:57
check_condition.sh
#!/bin/sh
# To check if a directory exists in a bash shell script you can use the following:
if [ -d "$DIRECTORY" ]; then
# Will enter here if $DIRECTORY exists
fi
# Or to check if a directory doesn't exist:
if [ ! -d "$DIRECTORY" ]; then
@namomo
namomo / remove.sh
Created October 6, 2015 04:02
remove.sh
#!/bash/sh
# find [시작위치] -name 패턴 -type 타입 -exec 명령어+옵션 {} \;
# find는 대상을 찾을 때 마다, 그 이름을 {}에 하나씩 하나씩 넣어주며,
# -exec뒤에 전달된 명령어+옵션을 실행해 준다.
# 그리고, \;는 명령어에 해당하는 옵션들이 모두 입력 되었음을 의미한다.
# 현재 디렉토리와 하위 디렉토리 중 font 이름의 디렉토리를 찾아 삭제
find . -name "font" -type f -exec rm -rf {} \;
@namomo
namomo / reset.css
Created September 19, 2015 04:01
Reset.css
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
var arr = [0, 1, 2, 3, 4, 5];
arr.sort(function(a, b) { return -0.5+Math.random(); });
// or
Array.prototype.randomSort = function() {
this.sort(function(a, b) {
return -0.5+Math.random();
});
}
@namomo
namomo / findBrowserUserAgent.html
Last active September 11, 2015 03:05 — forked from yamoo9/index.html
XP, IE 10 브라우저 미만 찾기
<!DOCTYPE html>
<html lang="ko-KR">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta charset="UTF-8">
<title>XP, IE10 미만 브라우저 접근 금지</title>
<script>
(function(){
var OSV = navigator.appVersion,
OSName="Unknown OS";