Skip to content

Instantly share code, notes, and snippets.

View iAnisdev's full-sized avatar
💻
Debugging

Anis iAnisdev

💻
Debugging
View GitHub Profile
// function to return parseInt str
function originalparseInt(str) {
return parseInt(str);
}
// custom function to return parseInt str
function customparseInt(str) {
str = str.replace(/\s/g , '');
if( /^[a-z]/i.test(str)){
@iAnisdev
iAnisdev / sort.cards.js
Created February 13, 2023 10:37
Sort cards deck
let cards = ['J', 10 , 8, 2, 6, 'K', 5, 3, 'Q','A' , 7 , 4 , 9 ];
// change this to match the rules of card game
let theRightOrder = ["A", 2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K"];
cards.sort((a, b) => theRightOrder.indexOf(a) - theRightOrder.indexOf(b));
console.log(cards);
@iAnisdev
iAnisdev / findsum.js
Last active February 13, 2023 10:40
Find set of sum in a number
function findSums(arr , num){
let result = []
arr.forEach((n , i) => {
if(arr.includes(num - n , i)){
result.push([n , num - n])
}
})
return result
}
@iAnisdev
iAnisdev / linkedin.js
Last active February 13, 2023 10:40
Remove LinkedIn Connection with single click.
function querySelectorIncludesText (selector, text){
return Array.from(document.querySelectorAll(selector))
.find(el => el.textContent.includes(text));
}
function stepOne(){
setInterval(async function () {
if(step == 1 && document.querySelector('button.display-flex')){
document.querySelector('button.display-flex').click();
step = 2