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 searchInput = document.getElementById("search-in-select-input") | |
const selectTagToManage = document.getElementById("csvBoxAbove") | |
function searchInSelect(value) { | |
for (let index = 0; index < selectTagToManage.options.length; index++) { | |
selectTagToManage.options[index].hidden = !(new RegExp(`${value}`, "ig")).test(selectTagToManage.options[index].value) | |
} | |
} |
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 getDomainName(url){ | |
function isDomainName(domain){ | |
return domain.match(/^[a-zA-Z0-9][a-zA-Z0-9-\.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/)!==null | |
} | |
let matches = url.match(/^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/\n]+)/) | |
if(matches.length>=2){ | |
let domain = matches[1] | |
return isDomainName(domain)? domain : 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
// An asynchronous function | |
async function theAsynchronousMethod() { | |
return Math.floor(Math.random() * Math.floor(6)); | |
} | |
// Another asynchronous function | |
async function anotherAsynchronousMethod() { | |
// Wait the response | |
let dice = await theAsynchronousMethod(); | |
// And continue |
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
// Execute the first method and THEN call the resolve method or CATCH the rejection | |
thePromiseGiver().then(yes).catch(no); |
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
// The method wich return a promise | |
function thePromiseGiver() { | |
return new Promise((resolve, reject) => { | |
let dice = Math.floor(Math.random() * Math.floor(6)); | |
if (dice>=3) { | |
resolve(dice); | |
}else{ | |
reject(new Error(dice)); | |
} | |
}); |
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
// The callback method | |
function theCallback() { | |
console.log("Hello from the callback !"); | |
} | |
// The callback will execute in 1000 ms | |
setTimeout(theCallback,1000); | |
console.log("Hello World !"); |
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
public interface Repository<T> { | |
/** | |
* Get all element which respect the filter | |
* @param filter | |
* @return List of result | |
*/ | |
public ArrayList<T> readAll(T filter); |