event codes can be found here: http://www.aspdotnetfaq.com/Faq/What-is-the-list-of-KeyCodes-for-JavaScript-KeyDown-KeyPress-and-KeyUp-events.aspx
510013
function eventKeyUp(e) {
  var keycode = ('which' in e) ? e.which : e.keyCode;
  keyUp(keycode);
}
187631
function makeKeyDefinition ( code ) {
	return ( node, fire ) => {
		function keydownHandler ( event ) {
			var which = event.which || event.keyCode;

			if ( which === code ) {
				event.preventDefault();

				fire({
					node,
					original: event
				});
			}
		}

		node.addEventListener( 'keydown', keydownHandler, false );

		return {
			teardown () {
				node.removeEventListener( 'keydown', keydownHandler, false );
			}
		};
	};
}
1174807
function _processOnKeyUp(evt) {
        let key = evt.keyCode || evt.which;
        let char = String.fromCharCode(key);
        let self = this;
        if (key === 38) {
            if (self._idx > 0) {
                _unselectWord(self._words[self._idx]);
                self._idx--;
            }
            self._words[self._idx].className += ' ac__word--selected';
        } else if (key == 40) {
            if (self._idx < self._words.length - 1) {
                _unselectWord(self._words[self._idx]);
                self._idx++;
            }
            self._words[self._idx].className += ' ac__word--selected';
        } else if (key == 13) {
            if (self._words.length && self._idx > -1)
                self._onSelectedCB(_getStringFromWordElement(self._words[self._idx]));
            else
                self._onSelectedCB(self._input.value);
        } else if (/[a-zA-Z0-9-_ ]/.test(char) || key === 8) {
            self._idx = -1;
            let prefix = self._input.value;
            if (prefix != '')
                self._keyListenerDebounced(prefix);
            else
                _flushWordsContainer.call(self);
        }
    }
1005213
function mockKeyDown(code) {
        var event = mockEventOnDefaultEditableCells('keydown');
        event.keyCode = event.which = code;
        return event;
    }
474321
def key_press_event(self, widget, event):
        
        # get keyname or keycode and translate to ginga standard
        # keyname =
        # keycode =
        keyname = ''  # self.transkey(keyname, keycode)
        self.logger.debug("key press event, key=%s" % (keyname))
        return self.make_ui_callback('key-press', keyname)
1209898
function(event) {
		var datalistSelect = event.target,
			datalist = datalistSelect.parentNode,
			input = dcmnt.querySelector('input[list="' + datalist.id + '"]');

		// Check for whether the events target was a select or whether the input doesn't exist
		if (datalistSelect.tagName.toLowerCase() !== 'select' || input === null) {
			return;
		}

		// Determine a relevant key - either printable characters (that would have a length of 1) or controlling like Backspace
		if (event.key && (event.key === 'Backspace' || event.key.length === 1)) {
			input.focus();

			if (event.key === 'Backspace') {
				input.value = input.value.substr(0, input.value.length - 1);

				// Dispatch the input event on the related input[list]
				dispatchInputEvent(input);
			} else {
				input.value += event.key;
			}

			prepOptions(datalist, input);
		}
	}
1193072
function () {
			this.writeDebug('_formEventHandler');
			var _this = this;
			// ASP.net or regular submission?
			if (this.settings.noForm === true) {
				$(document).on('click.'+pluginName, '.' + this.settings.formContainer + ' button', function (e) {
					_this.processForm(e);
				});
				$(document).on('keydown.'+pluginName, function (e) {
					if (e.keyCode === 13 && $('#' + _this.settings.addressID).is(':focus')) {
						_this.processForm(e);
					}
				});
			}
			else {
				$(document).on('submit.'+pluginName, '#' + this.settings.formID, function (e) {
					_this.processForm(e);
				});
			}

			// Reset button trigger
			if ($('.bh-sl-reset').length && $('#' + this.settings.mapID).length) {
				$(document).on('click.' + pluginName, '.bh-sl-reset', function () {
					_this.mapReload();
				});
			}
		}
1146140
function getKeys(code) {
		var reKeys = /KEYS\[\s*(\d+)\s*\]/g
		,	match
		,	max = 0, d = 1000;
		while ((match = reKeys.exec(code)) && d > 0) {
			if (parseInt(match[1], 10) > max)
				max = parseInt(match[1], 10);
			d--;
		}
		self._keys[scriptName] = max;
		done(code);
	}
890317
def send_keycode(keycode)
      send_request RequestMessage.new(key_event_message: KeyEvent.new(keycode: keycode, action: Action::DOWN))
      send_request RequestMessage.new(key_event_message: KeyEvent.new(keycode: keycode, action: Action::UP))
    end
741776
function keydown(opts, optIdx, e) {
          var isStop = false;
          if (!opts.enterableKeyCodes) {} else if (e.which && opts.enterableKeyCodes[e.which]) {} else if (!e.metaKey && !e.ctrlKey && !e.shiftKey) {
            //console.log(e.which, opts.enterableKeyCodes);
            isStop = true;
          }
          if (isStop) ax5.util.stopEvent(e);
        }
1176814
function () {
            var me = this, shortcutkeys = this.shortcutkeys;
            me.addListener('keydown', function (type, e) {
                var keyCode = e.keyCode || e.which;
                for (var i in shortcutkeys) {
                    var tmp = shortcutkeys[i].split(',');
                    for (var t = 0, ti; ti = tmp[t++];) {
                        ti = ti.split(':');
                        var key = ti[0], param = ti[1];
                        if (/^(ctrl)(\+shift)?\+(\d+)$/.test(key.toLowerCase()) || /^(\d+)$/.test(key)) {
                            if (( (RegExp.$1 == 'ctrl' ? (e.ctrlKey || e.metaKey) : 0)
                                && (RegExp.$2 != "" ? e[RegExp.$2.slice(1) + "Key"] : 1)
                                && keyCode == RegExp.$3
                                ) ||
                                keyCode == RegExp.$1
                                ) {
                                if (me.queryCommandState(i,param) != -1)
                                    me.execCommand(i, param);
                                domUtils.preventDefault(e);
                            }
                        }
                    }

                }
            });
        }
1028578
function (evt) {
            var domEventCopy = (evt.$DomEvent != null);
            // objCopy = true happens when creating a DomEventWrapper from a DomEvent object

            // initialize the object property - cf. eventMap
            if (!domEventCopy && isIE8orLess && Aria.$window.event) {

                evt = Aria.$window.event;
                // create all object properties from the map
                for (var k in eventMap) {
                    if (eventMap.hasOwnProperty(k)) {
                        this[k] = evt[eventMap[k]];
                    }
                }
                if (evt.type == "mouseout") {
                    this.relatedTarget = evt["toElement"];
                } else if (evt.type == "mouseover") {
                    this.relatedTarget = evt["fromElement"];
                }
                // TODO: convert evt.button values (not the same in IE/Safari/FF)
            } else {
                // W3C event - duplicate event values
                for (var k in eventMap) {
                    if (eventMap.hasOwnProperty(k)) {
                        this[k] = evt[k];
                    }
                }
            }

            this.type = getType(evt.type);
            // TODO keyCode / charCode should be homogenized between IE and other browsers
            // What must be implemented: (cf. http://www.quirksmode.org/js/keys.html)
            // keyCode=keyboard key code (e.g. 'A' and 'a' have the same key code: 65)
            // charCode=ASCII value of the resulting character (i.e. 'A'=65 'a'=97
            this.charCode = 0;
            this.keyCode = 0;
            if (this.type == 'keydown' || this.type == 'keyup') {
                this.keyCode = evt.keyCode;
                this.isSpecialKey = this.isSpecialKey(this.keyCode, evt);
            } else if (this.type == 'keypress') {
                // In case of a keypress event the "keycode"
                // is different from the keyup or keydown situation
                // We use keyCode OR charCode to calculate it
                var baseKeyCode = evt.keyCode || evt.charCode;

                /*
                 * We need to calculate the corresponding keycode ... On gecko browsers, charcode is usually used and
                 * has the same value as the non-gecko keycode version For special keys such as TAB, ENTER, DELETE,
                 * BACKSPACE, ARROWS, function keys ... the evt.keycode is valid, should be used, without any offset
                 * applied. So if evt.keyCode is defined on gecko browsers we have to skip applying an offset to the
                 * keycode
                 */
                var skipOffset = isGeckoBefore66 && evt.keyCode;
                this.keyCode = baseKeyCode;

                if (!skipOffset) {

                    // default
                    this.keyCode = baseKeyCode;

                    // before 32 > strange chars
                    // 32 > space, stays the same
                    if (baseKeyCode > 32 && baseKeyCode < 38) {
                        this.keyCode = baseKeyCode + 16;
                    }
                    if (baseKeyCode == 38) {
                        this.keyCode = 55;
                    }
                    if (baseKeyCode == 40) {
                        this.keyCode = 57;
                    }
                    /*
                    *  if (baseKeyCode == 39) { this.keyCode = 56; } if (baseKeyCode == 41) { this.keyCode = 48; }
                    */
                    if (baseKeyCode > 41 && baseKeyCode < 48) {
                        // / to * range
                        this.keyCode = baseKeyCode + 64;
                    }
                    if (baseKeyCode > 47 && baseKeyCode < 58) {
                        // 0 to 9 range
                        this.keyCode = baseKeyCode + 48;
                    } /*
                    * if (baseKeyCode == 58) { this.keyCode = 59; } // 59 > 59 if (baseKeyCode == 60) {
                    * this.keyCode = 188; } if (baseKeyCode == 61) { this.keyCode = 107; } if (baseKeyCode == 62) {
                    * this.keyCode = 190; } if (baseKeyCode == 62) { this.keyCode = 191; } if (baseKeyCode == 64) {
                    * this.keyCode = 50; }
                    */
                    // 65 -> 90 A - Z

                    if (baseKeyCode > 96 && baseKeyCode < 123) {
                        // 'a' to 'z' range - transform to 65-90 range
                        this.keyCode = baseKeyCode - 32;
                    }
                }
                this.charCode = baseKeyCode;

                this.isSpecialKey = this.isSpecialKey(this.keyCode, evt);
            }

            /**
             * Stop propagation for this event. Should not be modified directly (use the stopPropagation method).
             * @type Boolean
             */
            this.hasStopPropagation = false;

            /**
             * Prevent default for this event. Should not be modified directly (use the preventDefault method).
             * @type Boolean
             */
            this.hasPreventDefault = false;

            /**
             * Cancel any default action associated with the event
             * @param {Boolean} stopPropagation tells if event propagation must also be stopped - default: false
             * @method
             */
            this.preventDefault = !evt.preventDefault ? function (stopPropagation) {
                this.hasPreventDefault = true;
                evt.returnValue = false;
                if (stopPropagation === true) {
                    this.stopPropagation();
                }
            } : function (stopPropagation) {
                this.hasPreventDefault = true;
                evt.preventDefault();
                if (stopPropagation === true) {
                    this.stopPropagation();
                }
            };

            /**
             * Prevent the event from bubbling
             * @method
             */
            this.stopPropagation = !evt.stopPropagation ? function () {
                this.hasStopPropagation = true;
                evt.cancelBubble = true;
            } : function () {
                this.hasStopPropagation = true;
                evt.stopPropagation();
            };

            /**
             * Needs to be here in order to access the closure variable 'evt'
             * @private
             */
            this._dispose = function () {
                evt = null;
                this.preventDefault = null;
                this.stopPropagation = null;
            };

        }
726662
protected boolean handleCtrlKeyDown(int keyCode)
	{
		if (!GuiScreen.isCtrlKeyDown())
			return false;

		switch (keyCode)
		{
			case Keyboard.KEY_LEFT:
				startSelecting();
				cursor.jumpToNextSpace(true);
				return true;
			case Keyboard.KEY_RIGHT:
				startSelecting();
				cursor.jumpToNextSpace(false);
				return true;
			case Keyboard.KEY_BACK:
				if (isEditable())
					this.deleteWord(true);
				return true;
			case Keyboard.KEY_END:
				startSelecting();
				cursor.jumpToEnd();
				return true;
			case Keyboard.KEY_A:
				selectingText = true;
				selectionCursor.jumpToStart();
				cursor.jumpToEnd();
				return true;
			case Keyboard.KEY_C:
				GuiScreen.setClipboardString(getSelectedText());
				return true;
			case Keyboard.KEY_V:
				if (isEditable())
					addText(GuiScreen.getClipboardString());
				return true;
			case Keyboard.KEY_X:
				GuiScreen.setClipboardString(getSelectedText());
				if (isEditable())
					addText("");
				return true;
			default:
				return false;
		}
	}
306349
function createKeyboardEvent(type, options) {
  options = clean(type, options);
  var e = document.createEvent('KeyboardEvent');
  (e.initKeyEvent || e.initKeyboardEvent).call(
    e,
    type,
    options.bubbles,
    options.cancelable,
    options.view,
    options.ctrl,
    options.alt,
    options.shift,
    options.meta,
    options.key,
    options.key
  );

  // http://stackoverflow.com/a/10520017
  if (e.keyCode !== options.key) {
    Object.defineProperty(e, 'keyCode', {
      get: function() { return options.key; }
    });
    Object.defineProperty(e, 'charCode', {
      get: function() { return options.key; }
    });
    Object.defineProperty(e, 'which', {
      get: function() { return options.key; }
    });
    Object.defineProperty(e, 'shiftKey', {
      get: function() { return options.shift; }
    });
  }

  return e;
}
22450
function _pointKeyDown(e) {
        var code = e.keyCode,
            self = e.target,
            bezierEditor = self.bezierEditor;

        if (code >= KeyEvent.DOM_VK_LEFT && code <= KeyEvent.DOM_VK_DOWN) {
            e.preventDefault();

            // Arrow keys pressed
            var $this = $(e.target),
                left = parseInt($this.css("left"), 10),
                top  = parseInt($this.css("top"), 10),
                offset = (e.shiftKey ? 15 : 3),
                newVal;

            switch (code) {
            case KeyEvent.DOM_VK_LEFT:
                newVal = Math.max(0, left - offset);
                if (left === newVal) {
                    return false;
                }
                $this.css({ left: newVal + "px" });
                break;
            case KeyEvent.DOM_VK_UP:
                newVal = Math.max(-HEIGHT_ABOVE, top - offset);
                if (top === newVal) {
                    return false;
                }
                $this.css({ top: newVal + "px" });
                break;
            case KeyEvent.DOM_VK_RIGHT:
                newVal = Math.min(WIDTH_MAIN, left + offset);
                if (left === newVal) {
                    return false;
                }
                $this.css({ left: newVal + "px" });
                break;
            case KeyEvent.DOM_VK_DOWN:
                newVal = Math.min(HEIGHT_MAIN + HEIGHT_BELOW, top + offset);
                if (top === newVal) {
                    return false;
                }
                $this.css({ top: newVal + "px" });
                break;
            }

            // update coords
            bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas
                .offsetsToCoordinates(bezierEditor.P1)
                .concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2));

            bezierEditor._commitTimingFunction();
            bezierEditor._updateCanvas();
            return true;

        } else if (code === KeyEvent.DOM_VK_ESCAPE) {
            return true;
        } else if (code === KeyEvent.DOM_VK_TAB && !e.ctrlKey && !e.metaKey && !e.altKey) {
            // Switch between the two points by tabbing
            if ($(e.target).hasClass("P1")) {
                $(".P2").focus();
            } else {
                $(".P1").focus();
            }
            e.preventDefault();
            return true;
        }

        return false;
    }
865305
def add_keyboard_event_listeners
      Element.find("html").on :keydown do |event|
        @keys[get_key_id(event)] = true
      end
      Element.find("html").on :keyup do |event|
        @keys[get_key_id(event)] = false
      end
      ::Window.on :blur do |event|
        @keys.fill false
      end
    end
827091
function _isReactKeyDown( event ) {
   return event &&
    typeof event === 'object' &&
    event.nativeEvent instanceof window.KeyboardEvent &&
    event.type === 'keydown';
}