Skip to content

Instantly share code, notes, and snippets.

@yangkun
yangkun / file_list.groovy
Created April 4, 2013 17:03
[groovy] list dirs/files (dir first and sort as name)
import groovy.io.*
def listfiles(dir) {
dlist = []
flist = []
new File(dir).eachDir {dlist << it.name }
dlist.sort()
new File(dir).eachFile(FileType.FILES, {flist << it.name })
flist.sort()
return (dlist << flist).flatten()
@yangkun
yangkun / pde.js
Created August 12, 2013 15:46
[js] Prevent Default Event for IE
function pde(e) { //Function to prevent Default Events
if(e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
}
@yangkun
yangkun / DB_Controller.php
Last active December 22, 2015 08:48 — forked from jondavidjohn/MY_Controller.php
[codeigniter] using multiple database
<?php
/***
* filepath: application/core/MY_Controller.php
*/
//setup your base controller
class DB_Controller extends CI_Controller {
//declare them globally in your controller
protected $billing_db;
@yangkun
yangkun / get_keywords.sql
Created July 2, 2015 01:18
[oracle] 조인된 테이블의 멀티 값을 한 컬럼으로 붙이기
CREATE OR REPLACE FUNCTION get_keywords(p_powerlink in TOUR_POWER_LINK_KEYS.TPLK_POWER_LINK%TYPE)
RETURN VARCHAR2
IS
l_text VARCHAR2(32767) := NULL;
BEGIN
FOR cur_rec IN (SELECT TPLK_KEYWORD FROM TOUR_POWER_LINK_KEYS WHERE TPLK_POWER_LINK = p_powerlink order by tplk_seq asc) LOOP
l_text := l_text || ',' || cur_rec.TPLK_KEYWORD;
END LOOP;
RETURN LTRIM(l_text, ',');
END;
@yangkun
yangkun / menus.vm
Created July 2, 2015 02:33
[velocity] print tree structure
#macro(menuTree $menus $url)
#set($macro.url = $url)
#foreach($m in $menus)
#set($macro.depth = ($m.Depth - 1) * 5)
<tr>
<td class="title">
${vstr.repeat('&nbsp;', $macro.depth)}
#if($m.Childs && $m.Childs.size() > 0) <i class="fa fa-minus-square-o"></i> #else <i class="fa fa-square-o"></i> #end
<a href="#">${m.Name}</a>
</td>
@yangkun
yangkun / calc_distance.sql
Created July 14, 2015 18:28
[sql] get distance lat-lng
CREATE OR REPLACE FUNCTION calc_distance(
pLat1 NUMBER,
pLon1 NUMBER,
pLat2 NUMBER,
pLon2 NUMBER)
RETURN NUMBER
IS
-- r is the spherical radius of earth in Kilometers
cSpherRad CONSTANT NUMBER := 6367;
@yangkun
yangkun / list.vm
Created July 14, 2015 22:34
[velocity] list $no
#set($no = $__query__.Rows - (($__query__.Page - 1) * $__query__.PageSize + ($foreach.count - 1)))
@yangkun
yangkun / loop.sh
Created July 18, 2015 03:48
[bash] loop example
#!/bin/bash
#Basic
for i in {1..5}
do
echo "$i"
done
#Basic and leading zero
@yangkun
yangkun / bootstrap.html
Last active October 8, 2015 06:32
[html] bootstrap-skeleton
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>delay</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
<style>
#box {width: 100px; height: 100px; background-color: #000;}
@yangkun
yangkun / ribbon.htm
Last active October 1, 2015 02:43
yellow ribbon for SEWOL
<!--
``...-----------..``
`.--::::::::::::::::::::--.`
.--::::::::::::::::::::::::::::-.`
`.-::::::::::::::::::::::::::::::::::-`
`-:::::::::::::::::::::::::::::::::::::::-`
.-:::::::::::::::::::::::::::::::::::::::::-.
`-:::::::::::::::::::::::::::::::::::::::::::::-`
.-:::::::::::::::::::::::::::::::::::::::::::::::-`