This file contains 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 ObjToArr(Obj){ | |
if(typeof(Obj)=="object"){ | |
let Arr = Object.keys(Obj).map(function(key) { | |
return " "+ObjToArr(Obj[key]); //join with comma separator | |
}); | |
return Arr; | |
}else{ | |
return Obj; | |
} | |
} |
This file contains 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
import random | |
#regular random | |
print("".join(["s","j"]*10)) | |
#random random | |
print("".join([random.choice(["s","j"]) for i in range(20)])) |
This file contains 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 scrollLoop(delay=5000){ // delay for a animation duration | |
$('html, body').on('down', function () { | |
$(this).animate({ scrollTop: $(document).height() - $(window).height() }, delay); | |
$(this).trigger('up'); | |
}); | |
$('html, body').on('up', function () { | |
$(this).animate({ scrollTop: 0 }, delay); | |
$(this).trigger('down'); | |
}); | |
$('html, body').trigger('down'); // start with scroll down |
This file contains 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 blockInputInjection = (input) => { | |
return input.replace(/<\/[^>]*>/g, "</div>").replace(/<[^>]*>/g, "<div hidden>"); | |
} | |
// Sample Usage | |
harmfulInput = 'Hi, <b>Listen Me Now</b><br></br><img src="x"><br/><img src="y"/><script>alert("You have been hacked.");fetch("POST url datas");</script>'; | |
harmlessInput = blockInputInjection(harmfulInput); | |
// Result | |
'Hi, <div hidden>Listen Me Now<div hidden><div hidden><div hidden><div hidden><div hidden><div hidden><div hidden>alert("You have been hacked.");fetch("POST url datas");<div hidden>' |
This file contains 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 iConverterTurkish($str, $dir="upper"){ | |
$low = array('ı','i','ğ','ü','ş','ö','ç'); | |
$up = array('I','İ','Ğ','Ü','Ş','Ö','Ç'); | |
return $dir=="upper" ? | |
str_replace($low, $up, $str) : | |
str_replace($up, $low, $str) ; | |
} | |
function ucfirstTurkish($str) { |
This file contains 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
let reMessage = "You deleted that message but you cannot delete this message"; | |
let controlLastNMessage = 5; | |
let msgSelector = "#main > div._amm9 > div > div._ajyl > div.x3psx0u.xwib8y2.xkhd6sd.xrmvbpv"; | |
function isThereReMessageLast(num) { | |
if(num==0) return false; | |
if(document.querySelector(msgSelector + " > div:nth-last-child("+num+")").innerHTML.includes(reMessage)) { | |
return true; | |
} | |
return isThereReMessageLast(num-1); |
This file contains 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
<style> | |
/* define a function */ | |
.myFunction { | |
border: 3px solid rgba(var(--baseColorRGB)); | |
background-color: rgba(var(--baseColorRGB), 0.2); | |
} | |
/* Global Variables (Default Parameters) */ | |
:root { | |
--baseColorRGB: 255, 0, 0; |
This file contains 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
CREATE TABLE parentTable ( | |
id int NOT NULL AUTO_INCREMENT, | |
PRIMARY KEY (id), | |
name varchar(50) NOT NULL, | |
createdAt datetime DEFAULT CURRENT_TIMESTAMP, | |
-- Dynamic Columns : own datas | |
visible tinyint(1) NOT NULL DEFAULT 1, -- default is required | |
expiredAt datetime DEFAULT NULL | |
); |
This file contains 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
$("a[href*=http]").attr("target","_blank"); |
This file contains 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 | |
function showArrayAsTable($array, $parent=1) { | |
if ($parent) { | |
echo "<table>"; | |
echo "<tr>"; | |
foreach ($array[0] as $key => $value) { | |
echo "<td>{$key}</td>"; | |
} | |
echo "</tr>"; | |
} |
OlderNewer