Skip to content

Instantly share code, notes, and snippets.

@mpfund
Last active August 29, 2015 14:15
Show Gist options
  • Save mpfund/fd22bc40137219e6ec84 to your computer and use it in GitHub Desktop.
Save mpfund/fd22bc40137219e6ec84 to your computer and use it in GitHub Desktop.
JavaScript Shorties
$('*').each(function(k,v){
if("abrcodemetahtmlspanlidivimgh1h2h3formtextareainputulstrongblockquotelabelnoscriptbodyheadlinktitle".indexOf(v.tagName.toLowerCase())<0)
{console.log(v)}
})
function To2DigitString(k){
var str = k.toString(16);
if(str.length == 1){
str = "0" + str;
}
return str;
}
function toHex(str){
var hex = "";
for(var x=0;x<str.length;x++){
hex +=To2DigitString(str.charCodeAt(x));
}
return hex;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment