Skip to content

Instantly share code, notes, and snippets.

@gabrielstuff
Created January 9, 2013 14:29
Show Gist options
  • Select an option

  • Save gabrielstuff/4493545 to your computer and use it in GitHub Desktop.

Select an option

Save gabrielstuff/4493545 to your computer and use it in GitHub Desktop.
Helper object
var Helper = {
slugify : function(text) {
text = text.replace(/[^-a-zA-Z0-9,&\s]+/ig, '');
text = text.replace(/-/gi, "_");
text = text.replace(/\s/gi, "-");
return text;
},
injectCSS: function(css) {
if ('\v' == 'v') /* ie only */ {
document.createStyleSheet().cssText = css;
}
else {
var style = document.createElement('STYLE');
style.type = 'text/css';
style.innerHTML = css;
document.getElementsByTagName('HEAD')[0].appendChild(style);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment