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 / 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 = "";
@Dinir
Dinir / mb_ereg_bulk_replace.php
Created September 20, 2017 07:04
Replace multiple parts of a string at once using `mb_ereg_replace`.
<?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
*