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>
{
"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 / 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;
@SangHakLee
SangHakLee / binarySearch.java
Created April 13, 2016 15:39
Psedo Code of Binary Search
//Pseho Code
index binarySearch(int n, keytype[] S, keytype x){
location = 0; // 못 찾은 경우
int high, low, mid;
low = 1; // 시작은 1부터
high = n // 가장 큰 위치는 전체 배열 크기
while( low <= high && location == 0 ){
mid = (low + mid) / 2 // 소수점 자동 삭제됨
if( x == S[mid] ) // 중앙 값이 찾는 값
@SangHakLee
SangHakLee / recursiveFibonacci.java
Created April 13, 2016 15:45
Recursive Fibonacci Algorithm
//Psedo Code
int fib_1(int n){
if( n <= 1)
return n;
else
return fib_1(n-1) + fib_1(n-2);
}
@SangHakLee
SangHakLee / IterativeFibonacci.java
Created April 13, 2016 15:54
Iterative Fibonacci Algorithm
//Psedo Code
int fib_2(int n){
index i, j;
int f[] = new int[n+1];
int f[0] = 1; // 처음 값 1로
if( n > 0){
int f[1] = 1 ; // 두번째도 1로 피보나치 수열 기본
for( i = 2 ; i <= n ; i++)
f[i] = f[i-1] + f[i-2];
}