Skip to content

Instantly share code, notes, and snippets.

View turivishal's full-sized avatar
🎯
Focusing

Vishal Turi turivishal

🎯
Focusing
View GitHub Profile
@turivishal
turivishal / html_minify.js
Last active December 11, 2020 11:56
Monify HTML using JavaScript
let html = `
Welcome to City
<table width="100%" bgcolor="#fff" cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<tr>
<td width="100%">
@turivishal
turivishal / detect_urls.js
Created November 11, 2020 05:48
Detect URL's from text in Javascript
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 https://www.example.com and also at http://stackoverflow.com';
var html = urlify(text);

Keybase proof

I hereby claim:

  • I am turivishal on github.
  • I am turivishal (https://keybase.io/turivishal) on keybase.
  • I have a public key ASAKCbRNf1cP9786qkVX9NmYGUAEUlnokGLk8Vithn9OWAo

To claim this, I am signing this object: