   console.log codeConverter
 
   initializeSocket = ->
-    `var canvas`
     canvas = document.getElementById('screen')
     canvas.tabIndex = 1000
     ctx = canvas.getContext('2d')

    request.then successHandler, failureHandler

  successHandler = (response) ->
    response.data

  failureHandler = (response) ->
    console.error 'error getting the os list'
    return

  {
    getList: getList
    post: post
    put: put
    delete: deletea
  }
app.factory 'socket', ->
  url = location.origin + '/vm'
  socket = io.connect(url)
  socket
app.controller 'HomeController', ($scope, $mdSidenav, os, socket, $rootScope, $mdDialog, $mdToast) ->

  timerToString = (timer) ->
    minutes = '' + Math.floor(timer / 60)
    seconds = '' + timer % 60

  os.getList().then (osList) ->
    $scope.osList = osList
    return

  socket.on 'available-sessions', (data) ->
    $scope.sessionsAvailable = data.sessions
    $scope.$apply()

  socket.on 'session-timer', (data) ->
    $scope.timer = timerToString(data.timer)

  socket.on 'session-expired', ->
    $mdToast.show $mdToast.simple().content('Session expired!').position('right bottom').hideDelay(2000)
    $scope.vmIsRunning = false
    $scope.title = 'Select an OS'

  $scope.toggleSidenav = (menuId) ->
    $mdSidenav(menuId).toggle()

  $scope.title = 'Select an OS'

