Skip to content

Instantly share code, notes, and snippets.

View baotuo's full-sized avatar

Pu Lifei baotuo

  • ELESTYLE Inc.
  • Tokyo
View GitHub Profile
@baotuo
baotuo / gist:e444e236af08f873435b
Last active November 11, 2021 09:22
Remove HTML formatting from a String
// removes MS Office generated guff
function cleanHTML(input) {
// 1. remove line breaks / Mso classes
var stringStripper = /(\n|\r| class=(")?Mso[a-zA-Z]+(")?)/g;
var output = input.replace(stringStripper, ' ');
// 2. strip Word generated HTML comments
var commentSripper = new RegExp('<!--(.*?)-->','g');
var output = output.replace(commentSripper, '');
var tagStripper = new RegExp('<(/)*(meta|link|span|\\?xml:|st1:|o:|font)(.*?)>','gi');
// 3. remove tags leave content if any
@baotuo
baotuo / gist:a7c13d1632b64d58ad6a
Last active August 29, 2015 14:06
8 great SVG loading icons
body{
padding: 1em;
background: #2B3134;
color: #777;
text-align: center;
font-family: "Gill sans", sans-serif;
width: 80%;
margin: 0 auto;
}
h1{