Displays dots until returned event is set
965846
def wait_for(text, finish=None, io=None):
    """"""
    if finish:
        finish.set()
        time.sleep(0.1) # threads, sigh
    if not io:
        io = sys.stdout
    finish = threading.Event()
    io.write(text)
    def _wait():
        while not finish.is_set():
            io.write('.')
            io.flush()
            finish.wait(timeout=1)
        io.write('\n')
    threading.Thread(target=_wait).start()
    return finish
449967
function() {
    this.appendValueInput('CONDITION')
        .setCheck('Boolean')
        .appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);
    this.appendValueInput('VALUE')
        .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    this.setColour(Blockly.Blocks.procedures.HUE);
    this.setTooltip(Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP);
    this.setHelpUrl(Blockly.Msg.PROCEDURES_IFRETURN_HELPURL);
    this.hasReturnValue_ = true;
  }
1153632
def OnText(self, event):
        """"""

        if not self.ignore_changes:
            post_command_event(self, self.CodeEntryMsg, code=event.GetString())

        self.main_window.grid.grid_renderer.cell_cache.clear()

        event.Skip()
45641
function check() {

		var el,
		    i;

		// Return early if no elements need to be checked
		if (!elements.length) {
			return;
		}

		for (i = 0; i < elements.length; i++) {
			el = elements[i];

			if (el.isVisible(options.padding)) {
				if (live) {
					el.classList.remove(query);
				} else {
					elements.splice(i, 1);
				}

				i--;
				callback(el);

				// If delay_callback is true,
				// wait until the next check to call another item
				if (options.delay_callback) {
					req();
					break;
				}
			}
		}

		// Stop all future checks if no elements are left and it's not live
		if (!live && !elements.length) {
			document.removeEventListener('wheel', req);
			document.removeEventListener('click', req);
			document.removeEventListener('scroll', req);
			that.removeListener('rendered', req);
			clearInterval(intervalId);
			queue.destroy();
		}
	}
404036
def on_click(self, event):
        
        DesktopNotification(
            title=event.title,
            body="{} until {}!".format(event.time_remaining, event.title),
            icon='dialog-information',
            urgency=1,
            timeout=0,
        ).display()
224309
function Dot(runner, options) {
  Base.call(this, runner, options);

  var self = this;
  var width = (Base.window.width * 0.75) | 0;
  var n = -1;

  runner.on(EVENT_RUN_BEGIN, function() {
    process.stdout.write('\n');
  });

  runner.on(EVENT_TEST_PENDING, function() {
    if (++n % width === 0) {
      process.stdout.write('\n  ');
    }
    process.stdout.write(Base.color('pending', Base.symbols.comma));
  });

  runner.on(EVENT_TEST_PASS, function(test) {
    if (++n % width === 0) {
      process.stdout.write('\n  ');
    }
    if (test.speed === 'slow') {
      process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
    } else {
      process.stdout.write(Base.color(test.speed, Base.symbols.dot));
    }
  });

  runner.on(EVENT_TEST_FAIL, function() {
    if (++n % width === 0) {
      process.stdout.write('\n  ');
    }
    process.stdout.write(Base.color('fail', Base.symbols.bang));
  });

  runner.once(EVENT_RUN_END, function() {
    console.log();
    self.epilogue();
  });
}
349764
protected void notifyStatus(String event){
		BlockingQueue<String> eventsQueue = (LinkedBlockingQueue<String>)getServletContext().getAttribute("eventsQueue");
//		if (eventsQueue == null) eventsQueue = new LinkedBlockingQueue<String>();
//		getServletContext().setAttribute("eventsQueue", eventsQueue);
		
		try {
			eventsQueue.put(event);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}		
	}
1023999
@Override
	public void waitForElementPresent(long time) throws WidgetException {
		try {
			waitForCommand(new ITimerCallback() {

				@Override
				public boolean execute() {
					try {
						return isElementPresent();
					} catch (WidgetException e) {
						return false;
					}
				}

				@Override
				public String toString() {
					return "Waiting for Element: " + locator + " to be present";
				}
			}, time);
		} catch (WidgetTimeoutException e) {
			throw new WidgetException("Error while waiting for element to be present", locator, e);
		}
	}
674883
function waitForReadyOutput() {
      function onCloseBeforeReady(exitCode) {
        done(exitCode && new Error('non-zero exit code ' + exitCode));
      }

      let outputBuffer = '';

      function checkChunkForReady(chunk) {
        outputBuffer += chunk.toString('utf8');

        // ensure the buffer doesn't grow out of control
        if (outputBuffer.length >= opts.readyBufferLength) {
          outputBuffer = outputBuffer.slice(outputBuffer.length - opts.readyBufferLength);
        }

        // don't strip ansi until we check, incase an ansi marker is split across chuncks.
        if (!opts.ready.test(stripAnsi(outputBuffer))) return;

        outputBuffer = '';
        proc.removeListener('close', onCloseBeforeReady);
        proc.stdout.removeListener('data', checkChunkForReady);
        proc.stderr.removeListener('data', checkChunkForReady);
        done();
      }

      proc.on('close', onCloseBeforeReady);
      proc.stdout.on('data', checkChunkForReady);
      proc.stderr.on('data', checkChunkForReady);
    }
1178471
function (event) {
            // flag that avoids to trigger the user callback when browsing the checkbox list
            var avoidCallback = (this._hasFocus || this._keepFocus);
            this.$TextInput._dom_onfocus.call(this, event, true);
            if (this._cfg.onfocus && !avoidCallback) {
                this.evalCallback(this._cfg.onfocus);
            }
        }
1004187
function waitForString(page, ph, str, callback) {
    var elapsed = 0;
    var currentDom = '';
    var timeout = false;

    async.until(
        function () {
            timeout = elapsed > constants.WAIT_TIMEOUT;
            return currentDom.indexOf(str) > -1 || timeout;
        },

        function (callback) {
            setTimeout(function () {
                getData.takeSnapshot(page, ph, function (error, page, ph, dom) {
                    if (error) {
                        callback(error);
                        return;
                    }
                    currentDom = dom;
                    elapsed += constants.POLL_INTERVAL;
                    callback();
                })
            }, constants.POLL_INTERVAL);
        },

        function (error) {
            if (error) {
                callback(error, page, ph);
                return;
            }
            if (timeout) {
                callback('Timeout while waiting for string', page, ph);
                return;
            }
            callback(null, page, ph);
        }
    );
}
780574
def on_event_pre(self, e: Event) -> None:
        """"""
        super().on_event_pre(e)
        ct_msg = e.init.get('currentTarget', dict())
        if e.type in ('input', 'change'):
            # Update user inputs
            self._set_text_content(ct_msg.get('value') or '')
1333480
function _fnCalculateEnd( oSettings )
		{
			if ( oSettings.oFeatures.bPaginate === false )
			{
				oSettings._iDisplayEnd = oSettings.aiDisplay.length;
			}
			else
			{
				/* Set the end point of the display - based on how many elements there are
				 * still to display
				 */
				if ( oSettings._iDisplayStart + oSettings._iDisplayLength > oSettings.aiDisplay.length ||
					   oSettings._iDisplayLength == -1 )
				{
					oSettings._iDisplayEnd = oSettings.aiDisplay.length;
				}
				else
				{
					oSettings._iDisplayEnd = oSettings._iDisplayStart + oSettings._iDisplayLength;
				}
			}
		}
729589
function() {
      var done = Todos.done().length;
      var remaining = Todos.remaining().length;

      if (Todos.length) {
        this.main.show();
        this.footer.show();
        this.footer.html(this.statsTemplate({done: done, remaining: remaining}));
      } else {
        this.main.hide();
        this.footer.hide();
      }

      this.allCheckbox.checked = !remaining;
    }
206662
function hoverIntent(hoverEvent) {
		// Only continue if tooltip isn't disabled
		if(this.disabled || this.destroyed) { return FALSE; }

		// Cache the event data
		this.cache.event = hoverEvent && $.event.fix(hoverEvent);
		this.cache.target = hoverEvent && $(hoverEvent.target);

		// Start the event sequence
		clearTimeout(this.timers.show);
		this.timers.show = delay.call(this,
			function() { this.render(typeof hoverEvent === 'object' || options.show.ready); },
			options.prerender ? 0 : options.show.delay
		);
	}
60495
def OnGetItemAttr(self, item):
        """"""
        if self.indicated > -1 and item == self.indicated:
            return self.indicated_attribute
        return None
1192254
def is_displayed(self):
        
        t = self.wait_timeout
        self.wait_timeout = 0
        try:
            self.reload()
            return any(e.is_displayed() for e in self)
        finally:
            self.wait_timeout = t