This file contains hidden or 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 urlString = window.location.href; | |
const url = new URL(urlString); | |
const urlParamLang = url.searchParams.get('param'); |
This file contains hidden or 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
class Popover extends React.Component { | |
constructor() { | |
super(); | |
this.handleClick = this.handleClick.bind(this); | |
this.handleOutsideClick = this.handleOutsideClick.bind(this); | |
this.state = { | |
popupVisible: false | |
}; |
This file contains hidden or 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 urlify(text) { | |
var urlRegex = /(https?:\/\/[^\s]+)/g; | |
return text.replace(urlRegex, function(url) { | |
return '<a href="' + url + '">' + url + '</a>'; | |
}) | |
} | |
var text = "Find me at http://www.example.com and also at http://stackoverflow.com"; | |
var html = urlify(text); |
This file contains hidden or 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 extractHostname = (url) => { | |
let hostname = ''; | |
// find & remove protocol (http, ftp, etc.) and get hostname | |
if (url.indexOf('//') > -1) hostname = url.split('/')[2]; | |
else hostname = url.split('/')[0]; | |
// find & remove port number | |
hostname = hostname.split(':')[0]; | |
// find & remove "?" |
This file contains hidden or 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 getNumFromString(string) { | |
const numbers = string.match(/\d+/g).map(Number); | |
return numbers; | |
} | |
export default getNumFromString; | |
// string = "border-radius:10px 20px 30px 40px" | |
// console.warn(getNumFromString(string)); |
This file contains hidden or 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 removeCharacter(str, charPos) { | |
part1 = str.substring(0, charPos); | |
part2 = str.substring(charPos + 1, str.length); | |
return `${part1}${part2}`; | |
} | |
export default removeCharacter; | |
// console.log(remove_character("Python",3)); |
This file contains hidden or 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
[ | |
{ | |
"name": "Afghanistan", | |
"dial_code": "+93", | |
"code": "AF" | |
}, | |
{ | |
"name": "Aland Islands", | |
"dial_code": "+358", | |
"code": "AX" |
NewerOlder