๐
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 | |
| // temporary explanation: | |
| // $menu_href is a multi-dimensional array with depth levels for each item as values | |
| // $menu_name is a multi-dimensional array with names for each item as values | |
| // Yes these are not so effective ways to contain list datas. Terrible, actually. | |
| // @@ gets the link, ## gets the content, $$ gets the contents under it (if there is) | |
| $sub_menu_format = array( | |
| array( | |
| '', | |
| "<li class='sub'>\n"."$$\n"."</li>\n", |
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
| var randomNumber = function(length, isLengthRandom = false) { | |
| var number = 0; | |
| actualLength = isLengthRandom? | |
| parseInt(Math.random()*length)+1: | |
| length; | |
| number = parseInt(Math.random()*Math.pow(10, actualLength)); | |
| return number; | |
| } | |
| var formatEachLetter = function(str, format, indicator) { | |
| var formatted = ""; |
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 | |
| /** | |
| * It let you do what you can do with `preg_replace` with `mb_ereg_replace`. | |
| * | |
| * replacing multiple strings at once. | |
| * | |
| * @param array $pattern | |
| * @param array $replacement | |
| * @param $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
| <?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) { |