Run on start and automatically unbind
767116
function first (callback) {
        if (typeof callback !== 'function') {
          throw new Error('Callback must be a function, instead got: ' + (typeof callback));
        }

        function firstCallback (result) {
          callback(result);
          unbind('start', firstCallback);
        }

        bind('start', firstCallback);
        bind('stop', unbind.bind(null, 'end', firstCallback));

        return self;
      }
1277861
def autojump():
    """"""
    currently_enabled = autojump_enabled()
    toggle_autojump()
    if not currently_enabled:
        click.secho("Autojump enabled", fg='green')
    else:
        click.secho("Autojump disabled", fg='red')
1095380
def stop_program(self, turn_off_load=True):
        
        self.__set_buffer_start(self.CMD_STOP_PROG)
        self.__set_checksum()
        self.__send_buffer()
        if turn_off_load and self.load_on:
            self.load_on = False
731813
def unbind name
      pipes.delete name
      if pipes.empty?
        exit_callbacks.each do |cb|
          EM.next_tick do
            cb.call status
          end
        end
        if status.exitstatus == 0
          EM.next_tick do
            succeed self
          end
        else
          EM.next_tick do
            fail self
          end
        end
      end
    end
529787
final static void enable() {
		if (lifeCycle.getStatus().equals(RunStatus.READY) || lifeCycle.getStatus().equals(RunStatus.STOPPED)) {
			init();
		} else if (lifeCycle.getStatus().equals(RunStatus.DISABLED)) {
			lifeCycle.setStatus(RunStatus.RUNNING);
		}
	}
1028162
def start(self, ignore_state=False):
        """"""
        self.logger.debug("Start service")
        self._toggle_running(True, ignore_state)
260417
def start_system(components, bind_to, hooks={}):
    """"""
    deps = build_deps_graph(components)
    started_components = start_components(components, deps, None)

    run_hooks(hooks, started_components)

    if type(bind_to) is str:
        master = started_components[bind_to]
    else:
        master = bind_to

    setattr(master, '__components', started_components)
    return master
20435
function onUnmount( instance ) {
  store.deleteInstance( instance );
  if ( store.isEmpty() ) {
    listeners.unbindClicks( _onClick );
    listeners.unbindKeys( _onKeyDown );
  }
}
836505
def uninitialize_ui(self):
        

        LOGGER.debug("> Uninitializing '{0}' Component ui.".format(self.__class__.__name__))

        self.__remove_actions()

        # Signals / Slots.
        self.__view.expanded.disconnect(self.__view__expanded)
        self.__view.doubleClicked.disconnect(self.__view__doubleClicked)
        self.__view.selectionModel().selectionChanged.disconnect(self.__view_selectionModel__selectionChanged)
        self.__script_editor.Script_Editor_tabWidget.currentChanged.disconnect(
            self.__script_editor_Script_Editor_tabWidget__currentChanged)
        self.__script_editor.model.project_registered.disconnect(self.__script_editor_model__project_registered)

        self.__view_remove_actions()

        self.__model = None
        self.__delegate = None
        self.__view = None

        self.initialized_ui = False
        return True
1126225
def unregister(self, event):
        
        if self.running:
            raise RuntimeError("Can't unregister while running")
        self._handlers.pop(event, None)
968866
def start(path=None, host=None, port=None, color=None, cors=None, detach=False, nolog=False):
    """"""
    if detach:
        sys.argv.append('--no-log')
        idx = sys.argv.index('-d')
        del sys.argv[idx]
        cmd = sys.executable + ' ' + ' '.join([sys.argv[0], 'start'] + sys.argv[1:])
        if os.name == 'nt':
            cmd = 'start /B %s' % cmd
        else:
            cmd = '%s &' % cmd
        os.system(cmd)
    else:    
        if path:
            path = os.path.abspath(path)
        app.config['PATH_HTML']= first_value(path, app.config.get('PATH_HTML',None), os.getcwd())
        app.config['HOST'] = first_value(host, app.config.get('HOST',None), '0.0.0.0')
        app.config['PORT'] = int(first_value(port, app.config.get('PORT',None), 5001))
        app.logger.setLevel(logging.DEBUG)
        app.config['historylog'] = HistoryHandler()
        app.logger.addHandler(app.config['historylog'])
        if not nolog:
            app.logger.addHandler(StreamHandler())
        if cors: CORS(app)
        app.run(host = app.config['HOST'],
                port = app.config['PORT'],
                threaded = True)
404308
def switch_off(self):
        """"""
        success = self.set_status(CONST.STATUS_CLOSED_INT)

        if success:
            self._json_state['status'] = CONST.STATUS_CLOSED

        return success
1240867
def _disable(name, started, result=True, skip_verify=False, **kwargs):
    '''
    
    '''
    ret = {}

    if not skip_verify:
        # is service available?
        try:
            if not _available(name, ret):
                ret['result'] = True
                return ret
        except CommandExecutionError as exc:
            ret['result'] = False
            ret['comment'] = exc.strerror
            return ret

    # Set default expected result
    ret['result'] = result

    # is enable/disable available?
    if 'service.disable' not in __salt__ or 'service.disabled' not in __salt__:
        if started is True:
            ret['comment'] = ('Disable is not available on this minion,'
                              ' service {0} started').format(name)
        elif started is None:
            ret['comment'] = ('Disable is not available on this minion,'
                              ' service {0} is in the desired state'
                              ).format(name)
        else:
            ret['comment'] = ('Disable is not available on this minion,'
                              ' service {0} is dead').format(name)
        return ret

    # Service can be disabled
    if salt.utils.platform.is_windows():
        # service.disabled in Windows returns True for services that are set to
        # Manual start, so we need to check specifically for Disabled
        before_toggle_disable_status = __salt__['service.info'](name)['StartType'] in ['Disabled']
    else:
        before_toggle_disable_status = __salt__['service.disabled'](name)
    if before_toggle_disable_status:
        # Service is disabled
        if started is True:
            ret['comment'] = ('Service {0} is already disabled,'
                              ' and is running').format(name)
        elif started is None:
            # always be sure in this case to reset the changes dict
            ret['changes'] = {}
            ret['comment'] = ('Service {0} is already disabled,'
                              ' and is in the desired state').format(name)
        else:
            ret['comment'] = ('Service {0} is already disabled,'
                              ' and is dead').format(name)
        return ret

    # Service needs to be disabled
    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Service {0} set to be disabled'.format(name)
        return ret

    if __salt__['service.disable'](name, **kwargs):
        # Service has been disabled
        ret['changes'] = {}
        after_toggle_disable_status = __salt__['service.disabled'](name)
        # on upstart, certain services like apparmor will always return
        # False, even if correctly activated
        # do not trigger a change
        if before_toggle_disable_status != after_toggle_disable_status:
            ret['changes'][name] = True
        if started is True:
            ret['comment'] = ('Service {0} has been disabled,'
                              ' and is running').format(name)
        elif started is None:
            ret['comment'] = ('Service {0} has been disabled,'
                              ' and is in the desired state').format(name)
        else:
            ret['comment'] = ('Service {0} has been disabled,'
                              ' and is dead').format(name)
        return ret

    # Service failed to be disabled
    ret['result'] = False
    if started is True:
        ret['comment'] = ('Failed when setting service {0} to not start'
                          ' at boot, and is running').format(name)
    elif started is None:
        ret['comment'] = ('Failed when setting service {0} to not start'
                          ' at boot, but the service was already running'
                          ).format(name)
    else:
        ret['comment'] = ('Failed when setting service {0} to not start'
                          ' at boot, and the service is dead').format(name)
    return ret
641376
def unselect(self):
        
        if sys.platform=='win32':
            self.dc.SelectObject(wx.NullBitmap)
            self.IsSelected = False
944890
function(element, selector, event, callback, capturePhase) {

    unbind($(element).array[0], event, callback, capturePhase)
  }
470847
function autoCleanup (self, cleanupFn) {
  if (self.mousedown || self.lastRipple) {
    self.mousedown = false;
    self.$mdUtil.nextTick(angular.bind(self, cleanupFn), false);
  }
}
1260089
function() {
    this._unbindModel();
    this.map.bind('change:view_bounds_sw',  this._changeBounds, this);
    this.map.bind('change:view_bounds_ne',  this._changeBounds, this);
    this.map.bind('change:zoom',            this._setZoom, this);
    this.map.bind('change:scrollwheel',     this._setScrollWheel, this);
    this.map.bind('change:keyboard',        this._setKeyboard, this);
    this.map.bind('change:center',          this._setCenter, this);
    this.map.bind('change:attribution',     this.setAttribution, this);
  }