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 | |
$tree_text = function(string $text): array { | |
$lines = explode(PHP_EOL, $text); | |
$levels = array_map(function($line){ | |
$level = 0; | |
while(substr($line, $level, 1) == "\t") { | |
$level++; | |
} | |
return $level; | |
}, $lines); |
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
/** | |
* @typedef {object} stoppableTimer | |
* @desc 일시정지가 가능한 인터벌 타이머입니다. | |
* @method stop 타이머를 멈춥니다. | |
* @method start 타이머를 시작합니다. 새로운 타이머 값을 줄 수 있습니다. | |
* @method reset 타이머를 리셋합니다. 새로운 타이머 값을 줄 수 있습니다. | |
*/ | |
/** | |
* 일시정지가 가능한 인터벌 타이머를 만듭니다. |
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 | |
/** | |
* 날짜 문자열을 다른 언어의 표기 방식에 따라 바꾸어서 반환합니다. | |
* | |
* @param string $date_string 'YYYY-MM-DD' 형식으로 표기한 날짜입니다. | |
* @param string $language 날짜를 표시하려는 언어입니다. (ISO 639 언어 코드)[_(ISO 3166 국가 코드)] 형식을 따릅니다. | |
* | |
* @return string 바꾸어진 날짜 문자열입니다. | |
*/ | |
function format_date(string $date_string, string $language): string { |
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
/** | |
* Prepare pins to put on a block display element, probably with an image in it. | |
* | |
* As creating an instance, a CSS rule will be written in the document | |
* for the pins with `className` as the class name. | |
* And the element the pins will be on will have its position property | |
* set to 'relative'. | |
* | |
* @param {!HTMLElement} containerDOM the element to put pins on | |
* @param {number} [diameter=24] diameter of pins |
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
/* eslint-disable no-undef */ | |
window.onload = function () { | |
const axisDom = document.getElementsByClassName('analogLeft')[0] | |
const dpadDoms = document.getElementsByClassName('dpad')[0] | |
const buttonDoms = document.getElementsByClassName('buttons')[0] | |
const cos45 = Math.cos(1 / 4 * Math.PI) | |
let mapping = { | |
analogLeft: [0, 1], // hori, vert | |
dpad: [12, 13, 14, 15], // up, down, left, right |
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
/** | |
* 오브젝트가 비어있는지 확인합니다. | |
* | |
* @param {object} obj | |
* @returns {boolean} | |
*/ | |
var isEmptyObj = function (obj) { | |
if(obj) | |
return Object.keys(obj).length === 0 && obj.constructor === Object; | |
else |
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
const rAF = window.requestAnimationFrame; | |
const gamepads = {}; | |
const handler = { | |
connect: function(e) { | |
gamepads[e.index] = e; | |
console.log(`${e.index} connected`); | |
}, | |
disconnect: function(e) { |
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 | |
/** | |
* Format a copy-pasted table data text from Hangul Word Processor as an array. | |
* | |
* A pasted text is formatted like this: | |
* \nA1\nB1\nC1\nA2\nB2\nC2\nA3\nB3\nC3\n | |
* | |
* with an appropriate regex used as a delimiter, e.g. '/\R(?!A)/', | |
* this function can format the text to an array: | |
* [['A1', 'B1', 'C1'], ['A2', 'B2', 'C2'], ['A3', 'B3', 'C3']] |
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
============================================================================================ | |
PICO-8 v0.1.8 | |
http://www.pico-8.com | |
(c) Copyright 2014-2016 Lexaloffle Games LLP | |
만든 이: Joseph White // [email protected] | |
옮긴 이: Dinir Nertan // [email protected] | |
PICO-8은 아래의 기술로 만들어졌습니다: | |
SDL2 http://www.libsdl.org |
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
const changeClass = (target, firstCl, secondCl) => { | |
// if first exist = add it | |
// if both exist = change first to second | |
// if both exist and first is * = overwrite with second | |
if(firstCl) { | |
if(!secondCl) { | |
target.className += ` ${firstCl}`; | |
} else { | |
target.className = firstCl==="*"? | |
secondCl: |