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 removeAdTwt = ()=>{ | |
document.querySelectorAll('[data-testid="placementTracking"]').forEach(oDiv=>{ | |
if(oDiv.innerHTML.includes('Promoted</span>')){ | |
oDiv.remove(); | |
} | |
}) | |
}; | |
window.addEventListener("load", removeAdTwt); |
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 main =function(){ | |
this.name="The Main function" | |
helper.bind(this); | |
helper(); | |
console.log("FROM MAIN:",this.name); | |
} | |
function helper(){ | |
console.log("FROM HELPER:",this.name); | |
this.name = "The Helper Function"; |
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
var romanToInt = function(s) { | |
let num=0; | |
let romans ={ | |
"I":1, | |
"V":5, | |
"X":10, | |
"L":50, | |
"C":100, | |
"D":500, | |
"M":1000 |
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
var intToRoman = function(num) { | |
let romans={ | |
"1": ["I","V"], | |
"2": ["X","L"], | |
"3": ["C","D"], | |
"4": ["M","M"] | |
} | |
let s = num.toString(); | |
let converted=""; | |
for(let i=0 ; i<s.length; i++){ |
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
for(let i=1, x=0; i<40;i=i+2, x++){ | |
let empty = " ".repeat(40-(x)); | |
let rand = ()=>Math.floor(Math.random()*i); | |
let star = "*".repeat(i).split(''); | |
star[rand()]="❆"; | |
// star[rand()]="🎁"; | |
// star[rand()]="🔔"; | |
console.log(empty,star.join('')); | |
} |
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
// Top-down without memoization, kind of bruteforce. Time complexity is too bad. | |
var longestCommonSubsequence = function(text1, text2) { | |
if(text1.length===0 || text2.length===0) return 0; | |
let letter1 = text1[0]; | |
let firstOccurance = text2.indexOf(letter1); | |
let case1 = longestCommonSubsequence(text1.substring(1), text2); | |
// text1 in ilk harfiyle olan kombinasyon cozumun parcasi degilse, ilk harfi haric text1 ile text2 recursive sokulur | |
let case2=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
let scripts = document.querySelectorAll('script[type="application/ld+json"]'); | |
// you might wanna change filter criteria as you wish to get any information from json_ld data | |
sku = [...scripts].map(ingredient=>JSON.parse(ingredient.innerText)).filter(scr=>scr["@type"]==="Product")[0].sku; |
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 dec2bin(dec){ | |
if(dec<2){ | |
return dec; | |
} | |
return dec2bin(((dec-(dec%2))/2)).toString()+(dec%2).toString(); | |
} | |
console.log(dec2bin(642313587)) |
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 bin2dec(bin){ | |
bin=bin.toString(); | |
let binArr = bin.split(''); | |
binArr = binArr.reverse(); | |
let dec = 0; | |
binArr.forEach((count,index)=>{ | |
dec+=count*Math.pow(2,index); | |
}) | |
return dec; | |
} |
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 isAnagramFunction (word_A, word_B){ | |
let isAnagram=true; | |
let map_A=Object.create(null); | |
let map_B=Object.create(null); | |
let arr_A = word_A.split(''); | |
let arr_B = word_B.split(''); | |
arr_A.forEach(letter=>{ | |
if(map_A[letter]){ |
NewerOlder