This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cut_text($text, $count, $more = "...") { | |
$length = mb_strlen($text, "UTF-8"); | |
if($length <= $count) | |
return $text; | |
else | |
return mb_substr($text, 0, $count, "UTF-8") . " " . $more; | |
} | |
echo cut_text('우리 나라 만세', 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_POST['submit'])) { | |
$save_dir = "./"; | |
//파일이 HTTP POST 방식을 통해 정상적으로 업로드되었는지 확인한다. | |
if(is_uploaded_file($_FILES["upload_file"]["tmp_name"])){ | |
echo "업로드한 파일명 : " . $_FILES["upload_file"]["name"]; | |
//파일을 저장할 디렉토리 및 파일명 | |
$dest = $save_dir . $_FILES["upload_file"]["name"]; | |
//파일을 지정한 디렉토리에 저장 | |
if(move_uploaded_file($_FILES["upload_file"]["tmp_name"], $dest)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link href="css/bootstrap.css"rel="stylesheet"media="screen"> | |
<style type="text/css"> | |
.foo { | |
margin-left: 30px; | |
width: 300px; | |
border: solid 10px #AAA; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Detect devices | |
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); | |
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); | |
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); | |
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); | |
if ( $Android ) | |
echo 'Android'; | |
else if ( $iPod || $iPhone || $iPad ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 참고주소: | |
*/ | |
?> | |
<!doctype html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <stdio.h> | |
int a = 6; | |
int main( void ) | |
{ | |
int b; | |
pid_t pid; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$username = 'user name'; | |
$password = 'password'; | |
$range = 'range'; | |
if (!isset($_SERVER['PHP_AUTH_USER']) || | |
!isset($_SERVER['PHP_AUTH_PW']) || | |
($_SERVER['PHP_AUTH_USER'] != $username) || | |
($_SERVER['PHP_AUTH_PW'] != $password)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void select_sort(int a[], int n) { | |
for (int i = 0; i < n - 1; i++) { | |
int min = i; | |
for (int j = i + 1; j < n; j++) { | |
if (a[j] < a[min]) min = j; | |
} | |
// swap | |
int temp = a[i]; | |
a[i] = a[min]; | |
a[min] = temp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void insert_sort(int a[], int n) { | |
for (int i=1; i<n; i++) { | |
int temp = a[i]; | |
// 정렬되어 있는 배열의 경우 루프를 실행하지 않는다. | |
for (int j=i; j>0 && a[j-1] > a[j]; j--) { | |
a[j] = a[j-1]; | |
a[j-1] = temp; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void bubble_sort(int a[], int n) { | |
for (int i = 0; i < n - 1; i++) { | |
for (int j = 0; j < n - 1 - i; j++) { | |
if (a[j] > a[j + 1]) { | |
int temp = a[j]; | |
a[j] = a[j + 1]; | |
a[j + 1] = temp; | |
} | |
} | |
} |