Skip to content

Instantly share code, notes, and snippets.

View SangHakLee's full-sized avatar
🦄
https://stackshare.io/SangHakLee

Sanghak,Lee SangHakLee

🦄
https://stackshare.io/SangHakLee
View GitHub Profile
@SangHakLee
SangHakLee / simpleServer.js
Created December 22, 2015 16:43
Create simple web server in Node.js. ES5
var http = require('http'); // node 내장 모듈 불러옴
var hostname = '127.0.0.1'; // localhost와 동일
var port = 3000;
http.createServer(function(req, res){
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello World\n');
}).listen(port, hostname);
@SangHakLee
SangHakLee / popover.html
Created December 23, 2015 07:34
Append form tag in popover and prevent submit event in Bootstrap
<button id="popoverBtn" type="button" class="btn btn-primary pull-right" data-toggle="popover" data-placement="top">Add</button>
<div id="popover-content" class="hide">
<form id="addFaq" role="form">
<div class="form-group">
<label for="popoverTitle">Title</label>
<textarea class="form-control" name="title" id="popoverTitle" placeholder="Enter title" required></textarea>
</div>
<div class="form-group">
<label for="popoverContents">Content</label>
<textarea class="form-control" name="contents" rows="5" id="popoverContents" placeholder="Enter content" required></textarea>
@SangHakLee
SangHakLee / tab.html
Created December 24, 2015 01:29
Focus current tab after reload page in Bootstarp tab.
<!--simple bootstarp tab example-->
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<!--class="active" means now focusing. 현재 첫번째 home으로 가는 li 태그가 기본-->
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
<li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
<li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
</ul>
@SangHakLee
SangHakLee / isEmpty.js
Created December 28, 2015 16:31
check some value is empty ( include empty array, empty object and exclude number 0
// 넘어온 값이 빈값인지 체크합니다.
// !value 하면 생기는 논리적 오류를 제거하기 위해
// 명시적으로 value == 사용
// [], {} 도 빈값으로 처리
var isEmpty = function(value){
if( value == "" || value == null || value == undefined || ( value != null && typeof value == "object" && !Object.keys(value).length ) ){
return true
}else{
return false
}
{
"auto_complete": true,
"auto_indent": true,
"default_encoding": "UTF-8",
"disable_formatted_linebreak": true,
"font_size": 12,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
#include <stdio.h>
int main(void) {
printf("hello c\n");
}
// 문자열
var name = "Ryan"
var sex = "male"
// 숫자
var age = 26
var weight = 77
// 불린
var happy = true;
@SangHakLee
SangHakLee / literal.js
Created April 13, 2016 12:53
JavaScript literal
// 문자열
var name = "Ryan"
var sex = "male"
// 숫자
var age = 26
var weight = 77
// 불린
var happy = true;
@SangHakLee
SangHakLee / varCopy.js
Last active June 8, 2016 16:12
JavaScript variable copy
// color1의 값을 color2에 저장한다.
var color1 ="red";
var color2 = color1;
console.log(color1); // "red"
console.log(color2); // "red"
color1 = "blue"
console.log(color1); // "blue"
@SangHakLee
SangHakLee / sequentialSearch.java
Created April 13, 2016 15:28
Psedo code of Sequential Search
// Psedo Code
public static index seqSearch(int n, keytype[] S, keytype x){
location = 1;
while( location <= n && S[location] != x ){
location++;
}
if( location >n )
location = 0;
return location;