This file contains hidden or 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
<input type="number" id="zip"> | |
<button type="button" onClick="search_addr();">住所検索</button> | |
<input type="text" id="address"> | |
<!-- 스크립트를 로드 --> | |
<script src="//api.zipaddress.net/sdk/zipaddr.min.js" async></script> | |
<script> | |
var search_addr = function(){ | |
var $zip = $('#zip'); | |
var zip = $zip.val(); |
This file contains hidden or 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
# HTTP | |
server { | |
listen 80; | |
server_name example.com www.example.com; | |
# certbot --webroot 인증을 받기위한 설정 | |
#location ^~ /.well-known/acme-challenge/ { | |
# default_type "text/plain"; | |
# root /var/www/letsencrypt; | |
#} |
This file contains hidden or 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 | |
define('LOG_FILE_NAME', 'deploy.log'); | |
// bitbucket payload | |
// https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push | |
$input = json_decode(file_get_contents('php://input'), true); | |
$username = $input['actor']['username']; | |
$dpname = $input['actor']['display_name']; | |
$pushData = array_pop($input['push']['changes']); | |
$branch = $pushData['new'] ? $pushData['new']['name'] : ''; |
This file contains hidden or 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 httpRequest(params, postData) { | |
return new Promise(function(resolve, reject) { | |
var req = http.request(params, function(res) { | |
// reject on bad status | |
if (res.statusCode < 200 || res.statusCode >= 300) { | |
return reject(new Error('statusCode=' + res.statusCode)); | |
} | |
// cumulate data | |
var body = []; | |
res.on('data', function(chunk) { |
This file contains hidden or 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 checkSequnceNumbers(target, counterLength= 6){ | |
// under es6 | |
// let sequentialCounter = Array.apply(null, Array(counterLength)).map(Number.prototype.valueOf,0); | |
let sequentialCounter = new Array(counterLength).fill(0); | |
let count = 0; | |
for (let i = 0, len = target.length; i < len; i++) { | |
let subCount = 0; | |
for (let j = 1; j < len; j++) { |
This file contains hidden or 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 | |
/** | |
* [splitBetweenStr 텍스트 사이의 문자열을 배열로 반환] | |
* @param [string] $str [전체 문자열] | |
* @param [string] $startWord [찾을 시작 문자열] | |
* @param [string] $endWord [찾을 종료 문자열] | |
* @return [array] [텍스트 사이의 문자열 배열] | |
* | |
* ex) splitBetweenStr('<br>hi</br><b>test</b><br>graceful_light</br>', '<br>', '</br>') | |
* => ['hi', 'graceful_light'] |
This file contains hidden or 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
<? | |
/** | |
* [postData 외부파일을 POST 방식으로 읽기] | |
* @param [string] $str [url] | |
* @param [array] $data [parameters] | |
* @param [int] $sleepMs [연결지연ms] | |
* @return [string] [내용] | |
*/ | |
function postData($str, $data, $sleepMs=0){ | |
$url = parse_url($str); |
This file contains hidden or 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
<? | |
/** | |
* [getData 외부파일을 GET 방식으로 읽기] | |
* @param [string] $str [url] | |
* @param [array] $data [parameters] | |
* @return [string] [내용] | |
*/ | |
function getData($str, $data){ | |
$url = parse_url($str); | |
switch(strtoupper($url['scheme'])){ |
This file contains hidden or 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
/** | |
* [downloadImage] | |
* @param {[string]} img [base64encoded image data] | |
* @param {[string]} fileName [new file name] | |
* @return [image file] | |
*/ | |
function downloadImage(img, fileName) { | |
var imgData = atob(img.src.split(',')[1]), | |
len = imgData.length, | |
buf = new ArrayBuffer(len), |
This file contains hidden or 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_once "xmlrpc.inc"; | |
$title = $_POST['title']; | |
$content = $_POST['content']; | |
$result = newPost($title, $content); | |
echo json_encode($result); | |
// 블로그 API 함수 |