               "url=#{encodeURIComponent url}"
 
     return fullurl
+
+
+  applyMarkdown: (text, options = {})->
+
+    return null unless text
+
+    options.gfm       ?= true
+    options.pedantic  ?= false
+    options.sanitize  ?= true
+    options.highlight ?= (text, lang) ->
+      if hljs.getLanguage lang
+      then hljs.highlight(lang,text).value
+      else text
+
+    marked Encoder.htmlDecode(text), options
+
 
   # This function checks current user's preferred domain and
   # set's it to preferredDomainCookie

      else
        null

  getDummyName:->
    u  = KD.utils
    gr = u.getRandomNumber
    gp = u.generatePassword
    gp(gr(10), yes)

  generateDummyUserData:->

    u  = KD.utils

    uniqueness = (Date.now()+"").slice(6)
    return formData   =
      agree           : "on"
      email           : "sinanyasar+#{uniqueness}@gmail.com"
      firstName       : u.getDummyName()
      lastName        : u.getDummyName()
      # inviteCode      : "twitterfriends"
      password        : "123123123"
      passwordConfirm : "123123123"
      username        : uniqueness

  registerDummyUser:->

    return if location.hostname is "koding.com"

    u  = KD.utils

    KD.remote.api.JUser.register u.generateDummyUserData(), => location.reload yes

  startRollbar: ->
    @replaceFromTempStorage "_rollbar"


        to   = to
        niceify to - from

  hasPermission: (name) ->

    (KD.config.permissions.indexOf name) >= 0
