Skip to content

Instantly share code, notes, and snippets.

View thomasJang's full-sized avatar
🎯
Focusing

JANG KI-YOUNG thomasJang

🎯
Focusing
View GitHub Profile
@thomasJang
thomasJang / querySelector.js
Last active August 29, 2015 14:11 — forked from Fusselwurm/querySelector.js
exception for modern browser
/*global document */
/**
* define document.querySelector & document.querySelectorAll for IE7
*
* A not very fast but small hack. The approach is taken from
* http://weblogs.asp.net/bleroy/archive/2009/08/31/queryselectorall-on-old-ie-versions-something-that-doesn-t-work.aspx
*
*/
/*
@thomasJang
thomasJang / paramToJson.js
Last active August 29, 2015 14:23
window.location parameter convert to JSON
// window.location parameter convert to JSON
var
param = {},
parameter = window.location.search.replace(/^\?/, '').split(/&/g),
i = parameter.length, pidx;
while(i--){
param[ parameter[i].substr(0, pidx = parameter[i].indexOf("=")) ] =
parameter[i].substr( pidx + 1 );
}
@thomasJang
thomasJang / gist:9c2a4e8564a1b3bb5d4a
Last active August 29, 2015 14:23
AXISJ bindSelector - onsearch
var iiac_cat_options = [];
$("#itemMapCd").bindSelector({
appendable:false,
//options: options,
onsearch: function(objID, objVal) {
var options = [];
if(objVal == ""){
options = [].concat(iiac_cat_options);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script>
var db_name = "chequer", db_version = 1;
var idb = (function(){
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB,
@thomasJang
thomasJang / find.js
Created August 23, 2015 14:54
axisj get_event_target
e = e || window.event;
var target = axf.get_event_target(e.target, function(el){
if(axdom(el).hasClass("AXTag-selector-tagitem-remove")){
event_type = "remove";
return true;
}
else
if(axdom(el).hasClass("AXTag-selector-tagitem")){
event_type = "item";
return true;
@thomasJang
thomasJang / find_event.js
Created August 23, 2015 15:11
find event - axisj
this.els["control"].bind("click", function (e) {
e = e || window.event;
var btn_value;
var target = axf.get_event_target(e.target, function (el) {
if ('getAttribute' in el) {
if (btn_value = el.getAttribute("data-els-btn")) {
return true;
}
}
});
var stDtTime = ax5.util.date(data.rsvtStDt).getTime();
var endDtTime = ax5.util.date(data.rsvtEndDt).getTime();
for(var _d = stDtTime; _d <= endDtTime; _d = _d + (1000*60*60*24)){
console.log( _d, new Date(_d));
}
@thomasJang
thomasJang / re_replace.js
Last active November 10, 2015 02:06
regExp replace
var url_string = "https://lh3.googleusercontent.com/-6z6mZ1jCGoA/VhVvM9dr_6I/AAAAAAAAVwU/djxcLHi-KLY/Ic42/IMG_2553.jpg";
console.log(url_string);
url_string = url_string.replace(/(\w*)[\\\/]\w*\.\w*$/, function(match, folder){
return folder + '-thomas' + match.substr(folder.length);
});
console.log(url_string);
@thomasJang
thomasJang / marko-component-render-html-control.js
Created November 15, 2015 17:06
marko-component-render-html-control.js
exports.render = function(input, out) {
var _s = "";
var _out = {
w: function(text) {
var text_array = text.split(/\n/g);
if (text_array.length > 0) {
var find_first_line = false, i = 0;
while (!find_first_line) {
if (text_array[i] != '') {
@thomasJang
thomasJang / catch-console.js
Created December 21, 2015 23:30
catch-console.js
(function () {
var console = window.console;
if (!console) return;
function intercept(method) {
var original = console[method];
console[method] = function () {
// do sneaky stuff
if (original.apply) {
// Do this for normal browsers