Skip to content

Instantly share code, notes, and snippets.

View Octagon-simon's full-sized avatar
Turning red flags into red tests that pass.

Simon Ugorji (Octagon) Octagon-simon

Turning red flags into red tests that pass.
View GitHub Profile
function solveCaptcha(siteKey, pageUrl){
const apiKey = "YOUR_API_KEY";
//make a GET request to 2captcha
fetch(`https://2captcha.com/in.php?key=${apiKey}
&method=userrecaptcha&googlekey=${siteKey}&pageurl=${pageUrl}&json=1`)
.then(response => response.json())
.then(data => {
//check if there's an error
if(!data.status){
//print out error
function solveCaptcha(siteKey, pageUrl){
//make printing text easier
let log = (text) => {console.log(text)};
let logErr = (text) => {console.error(text)};
//your api key
const apiKey = "YOUR_API_KEY";
//make a GET request to 2captcha
fetch(`https://2captcha.com/in.php?key=${apiKey}
&method=userrecaptcha&googlekey=${siteKey}&pageurl=${pageUrl}&json=1`)
.then(response => response.json())
for (let key in profile) {
console.log(key +' = '+ profile[key]);
}
const profile = {
name : "Simon",
email: "me@you.com",
gender : "male"
}
//loop through keys
Object.keys(profile).forEach( (key) => {
//access object value using key
console.log( key+' = '+profile[key] );
});
const profile = {
name : "Simon",
email: "me@you.com",
gender : "male"
}
let i = 0;
//get the length of the object
while( i < Object.keys(profile).length ){
//since we hold the current index, retrieve the key and value assigned to it
console.log( Object.keys(profile)[i]+' = '+Object.values(profile)[i] );
//our table's data
const tableData = {
1 : ["Simon ugorji", "simon@gmail.com", "01234", "Germany"],
2 : ["Tony ugorji", "tony@gmail.com", "013234", "Turkey"],
3 : ["Victor ugorji", "victor@gmail.com", "014234", "Germany"],
4 : ["Felix ugorji", "felix@gmail.com", "011234", "Canada"],
5 : ["Jordan ugorji", "jordan@gmail.com", "016234", "Costa Rica"],
6 : ["Henry ugorji", "henry@gmail.com", "0166234", "Belgium"],
7 : ["Frank Sams", "sams@gmail.com", "01234", "Nigeria"],
8 : ["John Doe", "jonny@gmail.com", "0123466", "Australia"],
//attach event listener
document.querySelector('#inp_search').addEventListener('input', function(){
//store the search query
let value = this.value.trim();
//check if value is not empty
if(value){
//store matching record IDs
let matchingIDs = [];
//loop index
let ind = 1;
//function to build table
function buildTable(matchingIDs){
//reset table data
tableDataElem.innerHTML = "";
//check if parameter is provided
if(typeof matchingIDs === "undefined"){
//our loop index
let ind = 0;
//our table index
let tableInd = 1;
//attach event listener
document.querySelector('#inp_search').addEventListener('input', function(){
//store the search query
let value = this.value.trim();
//check if value is not empty
if(value){
}else{
}
//our table's data
const tableData = {
1 : ["Simon ugorji", "simon@gmail.com", "01234", "Germany"],
2 : ["Tony ugorji", "tony@gmail.com", "013234", "Turkey"],
3 : ["Victor ugorji", "victor@gmail.com", "014234", "Paris"],
4 : ["Felix ugorji", "felix@gmail.com", "011234", "Canada"],
5 : ["Jordan ugorji", "jordan@gmail.com", "016234", "Costa Rica"],
6 : ["Henry ugorji", "henry@gmail.com", "0166234", "Belgium"],
7 : ["Frank Sams", "simon@gmail.com", "01234", "Nigeria"],
8 : ["John Doe", "jonny@gmail.com", "0123466", "Australia"],