Skip to content

Instantly share code, notes, and snippets.

View Dinir's full-sized avatar
๐Ÿฆฝ
Lost

Dinir Nertan Dinir

๐Ÿฆฝ
Lost
View GitHub Profile
@Dinir
Dinir / showCenterOfWindow.js
Last active February 1, 2018 08:01
I need this to adjust the position of monitors.
document.body.style.margin = "0";
document.body.style.overflow = "hidden";
const windowSize = {x:window.innerWidth, y:window.innerHeight};
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
canvas.setAttribute("width", windowSize.x);
canvas.setAttribute("height", windowSize.y);
document.body.appendChild(canvas);
@Dinir
Dinir / startCounter.html
Last active January 2, 2018 05:49
Counts the time you pressed the start button in your joystick.
<!DOCTYPE html>
<html>
<style>
body {
background-color: black;
font-family: "Fira Code";
color: white;
}
#counter {
@Dinir
Dinir / wtfisthis.php
Created December 20, 2017 03:25
you're a terrible coddrererrerewrewrarfawerf
<?php
class FormOption
{
public
$style,
$suggested_value,
$placeholder,
$autofocus;
@Dinir
Dinir / currentTime.html
Last active December 19, 2017 05:04
display current time
<!DOCTYPE html>
<html>
<style>
body {
margin: 0;
padding: 0;
background-color: black;
color: white;
font-family: "Fira Code";
/**
* ์ „ํ™”๋ฒˆํ˜ธ์— ํ•˜์ดํ”ˆ์„ ๋ถ™์ž…๋‹ˆ๋‹ค.
* 02-000-0000, 02-0000-0000, 000-000-0000, 000-0000-0000,
* 010-000-0000, 010-0000-0000, 1000-0000
* ์˜ ํ˜•ํƒœ๋กœ ์ „ํ™”๋ฒˆํ˜ธ๋ฅผ ๊ฐ€๊ณตํ•˜๊ณ , ์ˆซ์ž๊ฐ€ ๋” ๋‚จ์•˜์„ ๊ฒฝ์šฐ ๋’ค์— ์ด์–ด๋ถ™์—ฌ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
*
* @param {string} number ์ „ํ™”๋ฒˆํ˜ธ๋ฅผ ๋‹ด์€ ๋ฌธ์ž์—ด
* @returns {string}
*/
@Dinir
Dinir / same_value_array.php
Created November 16, 2017 05:39
making an array with keys occasionally having same values.
<?php
$type = array_merge(
array_fill_keys([
'css',
'css2'
], 'css'),
array_fill_keys([
'prejs',
'prejs2',
'js',
text = text.replace(/(={65})\s*([^=\n]*)\s*(={65})/g, '# $2');
text = text.replace(/(-{65})\s*([^\n]*)\s*(-{65})/g, '## $2');
text = text.replace(/ ([^\n]*)\s*\n-+\n/g, '### $1\n\n');
text = text.replace(/ ([^\s]+) +(.+)/, 'ftyuftyu');
<?php
class db_handler extends PDO
{
private function emitError($message)
{
return $message;
}
public function immigrateData(
$table_from, $columns_from, $table_to, $mapping, $start_at = 0, $limit = null
@Dinir
Dinir / format_tree_text.php
Created October 6, 2017 06:51
the purpose is too specific I won't add a detailed explanation here
<?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",
@Dinir
Dinir / modifyStreamlabsHostingAlertViewerCount.js
Last active January 2, 2018 05:21
add random number of digits to Streamlabs' host alert message in the viewer count
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 = "";