Skip to content

Instantly share code, notes, and snippets.

@klzns
klzns / plainChars.coffee
Created April 22, 2013 14:41
Function that removes all accentuation from a string (based on Underscore String)
plainChars = (str) ->
if not str? then return throw(new Error("plainChars needs a param"))
specialChars = "ąàáäâãåæćęèéëêìíïîłńòóöôõøśùúüûñçżź"
plain = "aaaaaaaaceeeeeiiiilnoooooosuuuunczz"
regex = new RegExp '[' + specialChars + ']', 'g'
str += ""
str.replace regex, (char) -> plain.charAt (specialChars.indexOf char)
@klzns
klzns / gist:5066139
Last active December 14, 2015 09:38 — forked from tzi/index.html
Detect Internet Explorer version in Coffeescript. Returns IE version number if true, otherwise returns false.
window.dammitIE = do ->
is_internet_explorer = ->
window.navigator.appName is "Microsoft Internet Explorer"
get_internet_explorer_version = ->
matches = new RegExp(" MSIE ([0-9].[0-9]);").exec(window.navigator.userAgent)
return parseInt(matches[1].replace(".0", "")) if matches? and matches.length > 1
true