Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
UPDATING Allow "beforeChange" event handlers to influence a change
function filterChange(doc, change, update) { var obj = { canceled: false, from: change.from, to: change.to, text: change.text, origin: change.origin, cancel: function () { return obj.canceled = true; } }; if (update) { obj.update = function (from, to, text, origin) { if (from) { obj.from = clipPos(doc, from); } if (to) { obj.to = clipPos(doc, to); } if (text) { obj.text = text; } if (origin !== undefined) { obj.origin = origin; } }; } signal(doc, "beforeChange", doc, obj); if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); } if (obj.canceled) { if (doc.cm) { doc.cm.curOp.updateInput = 2; } return null } return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_beforeChange () {\n // nop\n }", "_beforeChange () {\n // nop\n }", "afterValidChange() { }", "internalOnChange(event) {\n const me = this,\n value = me.value,\n oldValue = me._lastValue;\n\n // Don't trigger change if we enter invalid value or if value has not changed (for IE when p...
[ "0.79979867", "0.79979867", "0.7394063", "0.71244186", "0.712134", "0.696543", "0.69208336", "0.6911699", "0.68549484", "0.6852987", "0.6852832", "0.6847706", "0.6826507", "0.68111897", "0.6745635", "0.6742414", "0.6727392", "0.6717367", "0.6686759", "0.66838634", "0.66737986...
0.0
-1
Apply a change to a document, and add it to the document's history, and propagating it to all linked documents.
function makeChange(doc, change, ignoreReadOnly) { if (doc.cm) { if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) } if (doc.cm.state.suppressEdits) { return } } if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { change = filterChange(doc, change, true); if (!change) { return } } // Possibly split or suppress the update based on the presence // of read-only spans in its range. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); if (split) { for (var i = split.length - 1; i >= 0; --i) { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); } } else { makeChangeInner(doc, change); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "apply(doc) {\n if (this.length != doc.length)\n throw new RangeError(\"Applying change set to a document with the wrong length\");\n iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false);\n return doc;\n }", "function...
[ "0.63611466", "0.6288531", "0.6288531", "0.6288531", "0.6288531", "0.6288531", "0.6288531", "0.6288531", "0.6288531", "0.6288531", "0.6288531", "0.6288531", "0.6286658", "0.6273469", "0.6273469", "0.6273469", "0.6273469", "0.6273469", "0.6273469", "0.6273469", "0.6273469", ...
0.0
-1
Revert a change stored in a document's history.
function makeChangeFromHistory(doc, type, allowSelectionOnly) { var suppress = doc.cm && doc.cm.state.suppressEdits; if (suppress && !allowSelectionOnly) { return } var hist = doc.history, event, selAfter = doc.sel; var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done; // Verify that there is a useable event (so that ctrl-z won't // needlessly clear selection events) var i = 0; for (; i < source.length; i++) { event = source[i]; if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) { break } } if (i == source.length) { return } hist.lastOrigin = hist.lastSelOrigin = null; for (;;) { event = source.pop(); if (event.ranges) { pushSelectionToHistory(event, dest); if (allowSelectionOnly && !event.equals(doc.sel)) { setSelection(doc, event, {clearRedo: false}); return } selAfter = event; } else if (suppress) { source.push(event); return } else { break } } // Build up a reverse change object to add to the opposite history // stack (redo when undoing, and vice versa). var antiChanges = []; pushSelectionToHistory(selAfter, dest); dest.push({changes: antiChanges, generation: hist.generation}); hist.generation = event.generation || ++hist.maxGeneration; var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange"); var loop = function ( i ) { var change = event.changes[i]; change.origin = type; if (filter && !filterChange(doc, change, false)) { source.length = 0; return {} } antiChanges.push(historyChangeFromChange(doc, change)); var after = i ? computeSelAfterChange(doc, change) : lst(source); makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)); if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); } var rebased = []; // Propagate to the linked documents linkedDocs(doc, function (doc, sharedHist) { if (!sharedHist && indexOf(rebased, doc.history) == -1) { rebaseHist(doc.history, change); rebased.push(doc.history); } makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)); }); }; for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) { var returned = loop( i$1 ); if ( returned ) return returned.v; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function undo() {\n var doc = app.activeDocument;\n var states = doc.historyStates;\n \n var curr = 0;\n for (var i=0; i<states.length; i++) {\n if (states[i] == doc.activeHistoryState) {\n curr = i;\n }\n }\n \n var prev ...
[ "0.66680455", "0.66616225", "0.6657286", "0.6404642", "0.6340545", "0.63315004", "0.62797564", "0.62797564", "0.62788147", "0.62651217", "0.6206819", "0.6140144", "0.6129406", "0.6101191", "0.6099247", "0.60932523", "0.6078618", "0.5995395", "0.59712195", "0.59365827", "0.593...
0.0
-1
Subviews need their line numbers shifted when text is added above or below them in the parent document.
function shiftDoc(doc, distance) { if (distance == 0) { return } doc.first += distance; doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range( Pos(range.anchor.line + distance, range.anchor.ch), Pos(range.head.line + distance, range.head.ch) ); }), doc.sel.primIndex); if (doc.cm) { regChange(doc.cm, doc.first, doc.first - distance, distance); for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) { regLineChange(doc.cm, l, "gutter"); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bn(e,t,a,n){null==t&&(t=e.doc.first),null==a&&(a=e.doc.first+e.doc.size),n||(n=0);var r=e.display;if(n&&a<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>t)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)// Change after\n Jo&&pe(e.doc,t)<r.viewTo&&vn(e);else if(a<=r.viewFrom)// C...
[ "0.59886837", "0.5932061", "0.5651753", "0.56376565", "0.55780476", "0.55274785", "0.55163205", "0.55099046", "0.5506641", "0.54507947", "0.5449167", "0.5448703", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "...
0.0
-1
More lowerlevel change function, handling only a single document (not linked ones).
function makeChangeSingleDoc(doc, change, selAfter, spans) { if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) } if (change.to.line < doc.first) { shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); return } if (change.from.line > doc.lastLine()) { return } // Clip the change to the size of this doc if (change.from.line < doc.first) { var shift = change.text.length - 1 - (doc.first - change.from.line); shiftDoc(doc, shift); change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), text: [lst(change.text)], origin: change.origin}; } var last = doc.lastLine(); if (change.to.line > last) { change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), text: [change.text[0]], origin: change.origin}; } change.removed = getBetween(doc, change.from, change.to); if (!selAfter) { selAfter = computeSelAfterChange(doc, change); } if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); } else { updateDoc(doc, change, spans); } setSelectionNoUndo(doc, selAfter, sel_dontScroll); if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0))) { doc.cantEdit = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "change(docId, doc) {\n const cleanedDoc = this._getCleanedObject(doc);\n let storedDoc = this.store[docId];\n deepExtend(storedDoc, cleanedDoc);\n\n let changedData = {};\n _.each(cleanedDoc, (value, key) => {\n changedData[key] = storedDoc[key];\n });\n\n ...
[ "0.70032954", "0.6605747", "0.6573152", "0.65437555", "0.6486668", "0.6486668", "0.64346707", "0.64346707", "0.64346707", "0.64346707", "0.64346707", "0.6405342", "0.6405342", "0.6405342", "0.6405342", "0.6405342", "0.6405342", "0.6403209", "0.63989764", "0.6398355", "0.63615...
0.6453599
17
Handle the interaction of a change to a document with the editor that this document is part of.
function makeChangeSingleDocInEditor(cm, change, spans) { var doc = cm.doc, display = cm.display, from = change.from, to = change.to; var recomputeMaxLength = false, checkWidthStart = from.line; if (!cm.options.lineWrapping) { checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); doc.iter(checkWidthStart, to.line + 1, function (line) { if (line == display.maxLine) { recomputeMaxLength = true; return true } }); } if (doc.sel.contains(change.from, change.to) > -1) { signalCursorActivity(cm); } updateDoc(doc, change, spans, estimateHeight(cm)); if (!cm.options.lineWrapping) { doc.iter(checkWidthStart, from.line + change.text.length, function (line) { var len = lineLength(line); if (len > display.maxLineLength) { display.maxLine = line; display.maxLineLength = len; display.maxLineChanged = true; recomputeMaxLength = false; } }); if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; } } retreatFrontier(doc, from.line); startWorker(cm, 400); var lendiff = change.text.length - (to.line - from.line) - 1; // Remember that these lines changed, for updating the display if (change.full) { regChange(cm); } else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) { regLineChange(cm, from.line, "text"); } else { regChange(cm, from.line, to.line + 1, lendiff); } var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change"); if (changeHandler || changesHandler) { var obj = { from: from, to: to, text: change.text, removed: change.removed, origin: change.origin }; if (changeHandler) { signalLater(cm, "change", cm, obj); } if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); } } cm.display.selForContextMenu = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _onCurrentDocumentChange() {\n var doc = DocumentManager.getCurrentDocument(),\n container = _editorHolder.get(0);\n \n var perfTimerName = PerfUtils.markStart(\"EditorManager._onCurrentDocumentChange():\\t\" + (!doc || doc.file.fullPath));\n\n // Remove scroller-sha...
[ "0.6989578", "0.68647164", "0.6661219", "0.6592309", "0.65232587", "0.63881063", "0.63272256", "0.63092566", "0.6279335", "0.62503177", "0.61630493", "0.61265033", "0.61171705", "0.61171705", "0.6100543", "0.6096026", "0.60762805", "0.60762805", "0.6036763", "0.6016115", "0.6...
0.59413064
59
Rebasing/resetting history to deal with externallysourced changes
function rebaseHistSelSingle(pos, from, to, diff) { if (to < pos.line) { pos.line += diff; } else if (from < pos.line) { pos.line = from; pos.ch = 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetHistory() {\n // TODO: clean out localStorage\n ExCommandHistory.resetHistory();\n }", "function clearChangeHistory() {\n changeHistory = [];\n historyPosition = 0;\n }", "function setHistory() {\n // clear undo history\n $('#undoHistoryList')\n .empty()...
[ "0.7398873", "0.73758394", "0.7114035", "0.69220054", "0.6904946", "0.68740624", "0.68633354", "0.68047863", "0.67265755", "0.6599614", "0.6581044", "0.6556663", "0.6539293", "0.6528778", "0.6519331", "0.648415", "0.64797103", "0.646039", "0.6439766", "0.64363205", "0.6433971...
0.0
-1
Tries to rebase an array of history events given a change in the document. If the change touches the same lines as the event, the event, and everything 'behind' it, is discarded. If the change is before the event, the event's positions are updated. Uses a copyonwrite scheme for the positions, to avoid having to reallocate them all on every rebase, but also avoid problems with shared position objects being unsafely updated.
function rebaseHistArray(array, from, to, diff) { for (var i = 0; i < array.length; ++i) { var sub = array[i], ok = true; if (sub.ranges) { if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; } for (var j = 0; j < sub.ranges.length; j++) { rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff); rebaseHistSelSingle(sub.ranges[j].head, from, to, diff); } continue } for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) { var cur = sub.changes[j$1]; if (to < cur.from.line) { cur.from = Pos(cur.from.line + diff, cur.from.ch); cur.to = Pos(cur.to.line + diff, cur.to.ch); } else if (from <= cur.to.line) { ok = false; break } } if (!ok) { array.splice(0, i + 1); i = 0; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (!sub.copied) { cur.from = copyPos(cur.from); cur.to = copyPos(cur.to); }\n ...
[ "0.6718455", "0.6718455", "0.6718455", "0.6718455", "0.6492295", "0.648774", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.64685804", "0.64341486", "0.64341486", "0.6425354", "0.6421519", "0.63940966", "0.63940966", "0.63940966"...
0.64719915
29
Utility for applying a change to a line by handle or number, returning the number and optionally registering the line as changed.
function changeLine(doc, handle, changeType, op) { var no = handle, line = handle; if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); } else { no = lineNo(handle); } if (no == null) { return null } if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); } return line }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeLine(doc, handle, changeType, op) {\n\t var no = handle, line = handle;\n\t if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n\t else no = lineNo(handle);\n\t if (no == null) return null;\n\t if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType)...
[ "0.73571676", "0.73571676", "0.73571676", "0.73494065", "0.73494065", "0.73494065", "0.73494065", "0.73494065", "0.73494065", "0.73494065", "0.73469555", "0.7316735", "0.73150647", "0.7235541", "0.7235541", "0.7227161", "0.7227161", "0.7227161", "0.7227161", "0.7227161", "0.7...
0.7342512
23
The document is represented as a BTree consisting of leaves, with chunk of lines in them, and branches, with up to ten leaves or other branch nodes below them. The top node is always a branch node, and is the document object itself (meaning it has additional methods and properties). All nodes have parent links. The tree is used both to go from line numbers to line objects, and to go from objects to numbers. It also indexes by height, and is used to convert between height and line object, and to find the total height of the document. See also
function LeafChunk(lines) { this.lines = lines; this.parent = null; var height = 0; for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; height += lines[i].height; } this.height = height; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BTree(){\n\tthis.root = null;\n\tthis.length = 0;\n}", "function documentFragment(children, height, depth, maxFontSize) {\n this.children = children || [];\n this.height = height || 0;\n this.depth = depth || 0;\n this.maxFontSize = maxFontSize || 0;\n}", "function documentFragment(childre...
[ "0.5686588", "0.545292", "0.545292", "0.5316049", "0.5282906", "0.52820325", "0.5277185", "0.5250241", "0.52339", "0.51990473", "0.51844394", "0.5180048", "0.51776135", "0.51741374", "0.51716566", "0.51716566", "0.5167105", "0.5155398", "0.5155398", "0.51544017", "0.51374495"...
0.5140878
27
Create a marker, wire it up to the right lines, and
function markText(doc, from, to, options, type) { // Shared markers (across linked documents) are handled separately // (markTextShared will call out to this again, once per // document). if (options && options.shared) { return markTextShared(doc, from, to, options, type) } // Ensure we are in an operation. if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) } var marker = new TextMarker(doc, type), diff = cmp(from, to); if (options) { copyObj(options, marker, false); } // Don't connect empty markers unless clearWhenEmpty is false if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) { return marker } if (marker.replacedWith) { // Showing up as a widget implies collapsed (widget replaces text) marker.collapsed = true; marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget"); if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); } if (options.insertLeft) { marker.widgetNode.insertLeft = true; } } if (marker.collapsed) { if (conflictingCollapsedRange(doc, from.line, from, to, marker) || from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) { throw new Error("Inserting collapsed marker partially overlapping an existing one") } seeCollapsedSpans(); } if (marker.addToHistory) { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); } var curLine = from.line, cm = doc.cm, updateMaxLine; doc.iter(curLine, to.line + 1, function (line) { if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) { updateMaxLine = true; } if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); } addMarkedSpan(line, new MarkedSpan(marker, curLine == from.line ? from.ch : null, curLine == to.line ? to.ch : null)); ++curLine; }); // lineIsHidden depends on the presence of the spans, so needs a second pass if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) { if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); } }); } if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); } if (marker.readOnly) { seeReadOnlySpans(); if (doc.history.done.length || doc.history.undone.length) { doc.clearHistory(); } } if (marker.collapsed) { marker.id = ++nextMarkerId; marker.atomic = true; } if (cm) { // Sync editor state if (updateMaxLine) { cm.curOp.updateMaxLine = true; } if (marker.collapsed) { regChange(cm, from.line, to.line + 1); } else if (marker.className || marker.startStyle || marker.endStyle || marker.css || marker.attributes || marker.title) { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } } if (marker.atomic) { reCheckSelection(cm.doc); } signalLater(cm, "markerAdded", cm, marker); } return marker }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawMarker(lineWidth, lineHeightPerc, offset, markerLength, horiz) {\n var start, end;\n var height = em.height();\n if (horiz) {\n start = { x: offset, y: height};\n end = { x: offset, y: height - (markerLength*lineHeightPerc)};\n...
[ "0.70629317", "0.6923921", "0.6829593", "0.6760992", "0.6707142", "0.6680169", "0.6593751", "0.65839785", "0.65754306", "0.6537855", "0.645969", "0.6453781", "0.6453521", "0.6445277", "0.6431482", "0.6415655", "0.63720506", "0.6368411", "0.6367104", "0.63644373", "0.6347738",...
0.0
-1
These must be handled carefully, because naively registering a handler for each editor will cause the editors to never be garbage collected.
function forEachCodeMirror(f) { if (!document.getElementsByClassName) { return } var byClass = document.getElementsByClassName("CodeMirror"), editors = []; for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) { editors.push(cm); } } if (editors.length) { editors[0].operation(function () { for (var i = 0; i < editors.length; i++) { f(editors[i]); } }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _registerHandlers(editor) {\n $(editor).on(\"keyEvent\", _cursorHandler);\n $(editor.document).one(\"change\", _handler);\n editor.document.addRef();\n }", "getEditorListeners() {\n return {\n focusout: 'onEditorFocusOut',\n focusin: 'onEditorFocusIn',\n start: ...
[ "0.7412128", "0.6621844", "0.6621844", "0.6262634", "0.6257714", "0.607542", "0.6045522", "0.60446435", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", ...
0.0
-1
Called when the window resizes
function onResize(cm) { var d = cm.display; // Might be a text scaling operation, clear size caches. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; d.scrollbarsClipped = false; cm.setSize(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onWindowResize() {\n updateSizes();\n }", "function windowResized() {\n resize();\n redraw();\n}", "onWindowResize() {\n\t\tthis.windowHeight = this.getWindowHeight();\n\t\tthis.updatePosition();\n\t}", "function onWindowResize() {\n\n\t\t\t}", "function windowResized() {\n resizeCanvas...
[ "0.87504816", "0.8489634", "0.84696436", "0.8312124", "0.7998738", "0.79904795", "0.7962713", "0.7941597", "0.79165184", "0.79024243", "0.7881844", "0.7881551", "0.78685206", "0.78685206", "0.7828244", "0.78222525", "0.78173137", "0.7804665", "0.7797177", "0.778925", "0.77879...
0.0
-1
This is a kludge to keep keymaps mostly working as raw objects (backwards compatibility) while at the same time support features like normalization and multistroke key bindings. It compiles a new normalized keymap, and then updates the old object to reflect this.
function normalizeKeyMap(keymap) { var copy = {}; for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) { var value = keymap[keyname]; if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue } if (value == "...") { delete keymap[keyname]; continue } var keys = map(keyname.split(" "), normalizeKeyName); for (var i = 0; i < keys.length; i++) { var val = (void 0), name = (void 0); if (i == keys.length - 1) { name = keys.join(" "); val = value; } else { name = keys.slice(0, i + 1).join(" "); val = "..."; } var prev = copy[name]; if (!prev) { copy[name] = val; } else if (prev != val) { throw new Error("Inconsistent bindings for " + name) } } delete keymap[keyname]; } } for (var prop in copy) { keymap[prop] = copy[prop]; } return keymap }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeKeyMap(keymap) {\n\t\t var copy = {};\n\t\t for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n\t\t var value = keymap[keyname];\n\t\t if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n\t\t if (value == \"...\") { delete keymap[keyname]; co...
[ "0.68514186", "0.66198206", "0.6603239", "0.6603239", "0.6602559", "0.65583634", "0.65583634", "0.65583634", "0.65583634", "0.65583634", "0.65583634", "0.65583634", "0.65583634", "0.65583634", "0.65583634", "0.65583634", "0.58321124", "0.55477774", "0.55415845", "0.5539959", ...
0.6629671
16
Modifier key presses don't count as 'real' key presses for the purpose of keymap fallthrough.
function isModifierKey(value) { var name = typeof value == "string" ? value : keyNames[value.keyCode]; return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function usualKeys(e) {\n\t\t\tview.put(String.fromCharCode(e.which));\n\t\t\treturn false;\n\t\t}", "function bufferModifier(e) { return e.shiftKey*1 + e.ctrlKey*2 + e.altKey*4 }", "function keyName(event, noShift) {\n\t\t if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n\t\t var ...
[ "0.71554196", "0.6904054", "0.68411905", "0.6807457", "0.67904764", "0.67508173", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564", "0.6713564",...
0.64971703
60
Look up the name of a key as indicated by an event object.
function keyName(event, noShift) { if (presto && event.keyCode == 34 && event["char"]) { return false } var name = keyNames[event.keyCode]; if (name == null || event.altGraphKey) { return false } // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause, // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+) if (event.keyCode == 3 && event.code) { name = event.code; } return addModifierNames(name, event, noShift) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEventName(event_id) {\n for(var i in event_reference) {\n var obj = event_reference[i];\n if(obj.id === event_id)\n return obj.name;\n }\n return undefined;\n}", "function grabKey(obj, key) {\n return obj[key];\n}", "function getKey(object, key) {\n return obje...
[ "0.68437785", "0.66774225", "0.6616543", "0.63617873", "0.6232344", "0.58947927", "0.58873767", "0.582189", "0.5820872", "0.57668227", "0.57626027", "0.5733329", "0.57292217", "0.571779", "0.571779", "0.571779", "0.571779", "0.57143486", "0.57070446", "0.57045966", "0.5690433...
0.0
-1
Helper for deleting text near the selection(s), used to implement backspace, delete, and similar functionality.
function deleteNearSelection(cm, compute) { var ranges = cm.doc.sel.ranges, kill = []; // Build up a set of ranges to kill first, merging overlapping // ranges. for (var i = 0; i < ranges.length; i++) { var toKill = compute(ranges[i]); while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { var replaced = kill.pop(); if (cmp(replaced.from, toKill.from) < 0) { toKill.from = replaced.from; break } } kill.push(toKill); } // Next, remove those actual ranges. runInOp(cm, function () { for (var i = kill.length - 1; i >= 0; i--) { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); } ensureCursorVisible(cm); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeTextSelections() {\n if (document.selection) document.selection.empty();\n else if (window.getSelection) window.getSelection().removeAllRanges();\n}", "function removeTextSelection() {\n\n if (window.getSelection) {\n\n window.getSelection().removeAllRanges();\n\n } else if (document.se...
[ "0.74456984", "0.7390331", "0.7098297", "0.7048888", "0.6970701", "0.69376636", "0.69182247", "0.6821997", "0.68106675", "0.6800755", "0.6720468", "0.6719371", "0.6719371", "0.6719371", "0.6719371", "0.6719371", "0.6719371", "0.6719371", "0.6719371", "0.6719371", "0.66853714"...
0.57738036
92
Run a handler that was bound to a key.
function doHandleBinding(cm, bound, dropShift) { if (typeof bound == "string") { bound = commands[bound]; if (!bound) { return false } } // Ensure previous input has been read, so that the handler sees a // consistent view of the document cm.display.input.ensurePolled(); var prevShift = cm.display.shift, done = false; try { if (cm.isReadOnly()) { cm.state.suppressEdits = true; } if (dropShift) { cm.display.shift = false; } done = bound(cm) != Pass; } finally { cm.display.shift = prevShift; cm.state.suppressEdits = false; } return done }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBindingHandler (/* key */) {}", "function receive(key, handler) {\n pxsim.board().bus.listen(key, 0x1, handler);\n }", "function bind(key, action) {\r\n bindings[key] = action; \r\n\r\n}", "function listen(key, callback) {\n handlers[key] = callback;\n}", "function handleCb(key, ...
[ "0.66893464", "0.6387576", "0.6263076", "0.6140119", "0.6125587", "0.5889015", "0.5853597", "0.5827518", "0.5789461", "0.5789461", "0.5789461", "0.5789461", "0.5789461", "0.57228875", "0.5662782", "0.5644284", "0.5632373", "0.5600212", "0.5537149", "0.55028874", "0.5479583", ...
0.0
-1
Handle a key from the keydown event.
function handleKeyBinding(cm, e) { var name = keyName(e, true); if (!name) { return false } if (e.shiftKey && !cm.state.keySeq) { // First try to resolve full name (including 'Shift-'). Failing // that, see if there is a cursor-motion command (starting with // 'go') bound to the keyname without 'Shift-'. return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); }) || dispatchKey(cm, name, e, function (b) { if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) { return doHandleBinding(cm, b) } }) } else { return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "HandleKeyDown(event) {}", "function keydown_handler(event)\n{\n\tif (event.defaultPrevented) return;\n\tif (game.handle_key(event.code, true)) return;\n\n\t// cancel the default action to avoid it being handled twice\n\tevent.preventDefault();\n}", "function keyDownHandler(event) {\n keyHandler(true, event)...
[ "0.775545", "0.7531992", "0.7253767", "0.71955645", "0.71929777", "0.71917444", "0.7183162", "0.715556", "0.7124231", "0.7111242", "0.7088713", "0.7051842", "0.7051158", "0.7048878", "0.7048878", "0.70424455", "0.70308423", "0.7003227", "0.6974658", "0.6955478", "0.695327", ...
0.0
-1
Handle a key from the keypress event
function handleCharBinding(cm, e, ch) { return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "HandleKeyDown(event) {}", "function handleKeyPress({ key }) {\n dispatch(playerTyped(key.toLowerCase()));\n }", "handleInput(keycode) {\n if (keycode !== undefined && player.moves === true) {\n key = keycode;\n }\n }", "handleKeyPress(kEvent) {\n switch (kEvent.keyCod...
[ "0.7767834", "0.765871", "0.758574", "0.74911857", "0.741585", "0.7402115", "0.7374124", "0.737354", "0.73173136", "0.72986954", "0.7289434", "0.7274268", "0.7264864", "0.72491187", "0.72488683", "0.7228675", "0.7217789", "0.7216279", "0.7157265", "0.71438694", "0.71438676", ...
0.0
-1
A mouse down can be a single click, double click, triple click, start of selection drag, start of text drag, new cursor (ctrlclick), rectangle drag (altdrag), or xwin middleclickpaste. Or it might be a click on something we should not interfere with, such as a scrollbar or widget.
function onMouseDown(e) { var cm = this, display = cm.display; if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return } display.input.ensurePolled(); display.shift = e.shiftKey; if (eventInWidget(display, e)) { if (!webkit) { // Briefly turn off draggability, to allow widgets to do // normal dragging things. display.scroller.draggable = false; setTimeout(function () { return display.scroller.draggable = true; }, 100); } return } if (clickInGutter(cm, e)) { return } var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single"; window.focus(); // #3261: make sure, that we're not starting a second selection if (button == 1 && cm.state.selectingText) { cm.state.selectingText(e); } if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return } if (button == 1) { if (pos) { leftButtonDown(cm, pos, repeat, e); } else if (e_target(e) == display.scroller) { e_preventDefault(e); } } else if (button == 2) { if (pos) { extendSelection(cm.doc, pos); } setTimeout(function () { return display.input.focus(); }, 20); } else if (button == 3) { if (captureRightClick) { cm.display.input.onContextMenu(e); } else { delayBlurEvent(cm); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefl...
[ "0.7091867", "0.7091867", "0.7091618", "0.7091618", "0.7091618", "0.7091618", "0.7091618", "0.7091618", "0.7091618", "0.7091618", "0.7091618", "0.7091199", "0.70880425", "0.7081969", "0.70559573", "0.70553166", "0.70553166", "0.70397806", "0.7016578", "0.6998851", "0.6998704"...
0.7023528
27
Start a text drag. When it ends, see if any dragging actually happen, and treat as a click if it didn't.
function leftButtonStartDrag(cm, event, pos, behavior) { var display = cm.display, moved = false; var dragEnd = operation(cm, function (e) { if (webkit) { display.scroller.draggable = false; } cm.state.draggingText = false; off(display.wrapper.ownerDocument, "mouseup", dragEnd); off(display.wrapper.ownerDocument, "mousemove", mouseMove); off(display.scroller, "dragstart", dragStart); off(display.scroller, "drop", dragEnd); if (!moved) { e_preventDefault(e); if (!behavior.addNew) { extendSelection(cm.doc, pos, null, null, behavior.extend); } // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081) if ((webkit && !safari) || ie && ie_version == 9) { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); } else { display.input.focus(); } } }); var mouseMove = function(e2) { moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10; }; var dragStart = function () { return moved = true; }; // Let the drag handler handle this. if (webkit) { display.scroller.draggable = true; } cm.state.draggingText = dragEnd; dragEnd.copy = !behavior.moveOnDrag; // IE's approach to draggable if (display.scroller.dragDrop) { display.scroller.dragDrop(); } on(display.wrapper.ownerDocument, "mouseup", dragEnd); on(display.wrapper.ownerDocument, "mousemove", mouseMove); on(display.scroller, "dragstart", dragStart); on(display.scroller, "drop", dragEnd); delayBlurEvent(cm); setTimeout(function () { return display.input.focus(); }, 20); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startDragText(evt)\r\n{\r\n\r\n if(ActiveElem&&!DraggingObj) //---prevents dragging conflicts on other draggable elements---\r\n {\r\n if(evt.target.parentNode.getAttribute(\"id\")==\"activeText\")\r\n {\r\n if(evt.target.parentNode.parentNode.getAttribute(\"class\")==\"drag...
[ "0.66870064", "0.64880925", "0.64526504", "0.643963", "0.63796633", "0.6295826", "0.62258095", "0.6052833", "0.6033996", "0.6015346", "0.60106355", "0.60037816", "0.59898204", "0.5974962", "0.5962932", "0.5919407", "0.5909692", "0.58979154", "0.58868265", "0.5882919", "0.5857...
0.0
-1
Normal selection, as opposed to text dragging.
function leftButtonSelect(cm, event, start, behavior) { var display = cm.display, doc = cm.doc; e_preventDefault(event); var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; if (behavior.addNew && !behavior.extend) { ourIndex = doc.sel.contains(start); if (ourIndex > -1) { ourRange = ranges[ourIndex]; } else { ourRange = new Range(start, start); } } else { ourRange = doc.sel.primary(); ourIndex = doc.sel.primIndex; } if (behavior.unit == "rectangle") { if (!behavior.addNew) { ourRange = new Range(start, start); } start = posFromMouse(cm, event, true, true); ourIndex = -1; } else { var range = rangeForUnit(cm, start, behavior.unit); if (behavior.extend) { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); } else { ourRange = range; } } if (!behavior.addNew) { ourIndex = 0; setSelection(doc, new Selection([ourRange], 0), sel_mouse); startSel = doc.sel; } else if (ourIndex == -1) { ourIndex = ranges.length; setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex), {scroll: false, origin: "*mouse"}); } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) { setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), {scroll: false, origin: "*mouse"}); startSel = doc.sel; } else { replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); } var lastPos = start; function extendTo(pos) { if (cmp(lastPos, pos) == 0) { return } lastPos = pos; if (behavior.unit == "rectangle") { var ranges = [], tabSize = cm.options.tabSize; var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize); var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol); for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); line <= end; line++) { var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); if (left == right) { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); } else if (text.length > leftPos) { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); } } if (!ranges.length) { ranges.push(new Range(start, start)); } setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), {origin: "*mouse", scroll: false}); cm.scrollIntoView(pos); } else { var oldRange = ourRange; var range = rangeForUnit(cm, pos, behavior.unit); var anchor = oldRange.anchor, head; if (cmp(range.anchor, anchor) > 0) { head = range.head; anchor = minPos(oldRange.from(), range.anchor); } else { head = range.anchor; anchor = maxPos(oldRange.to(), range.head); } var ranges$1 = startSel.ranges.slice(0); ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head)); setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse); } } var editorSize = display.wrapper.getBoundingClientRect(); // Used to ensure timeout re-tries don't fire when another extend // happened in the meantime (clearTimeout isn't reliable -- at // least on Chrome, the timeouts still happen even when cleared, // if the clear happens after their scheduled firing time). var counter = 0; function extend(e) { var curCount = ++counter; var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle"); if (!cur) { return } if (cmp(cur, lastPos) != 0) { cm.curOp.focus = activeElt(); extendTo(cur); var visible = visibleLines(display, doc); if (cur.line >= visible.to || cur.line < visible.from) { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); } } else { var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; if (outside) { setTimeout(operation(cm, function () { if (counter != curCount) { return } display.scroller.scrollTop += outside; extend(e); }), 50); } } } function done(e) { cm.state.selectingText = false; counter = Infinity; // If e is null or undefined we interpret this as someone trying // to explicitly cancel the selection rather than the user // letting go of the mouse button. if (e) { e_preventDefault(e); display.input.focus(); } off(display.wrapper.ownerDocument, "mousemove", move); off(display.wrapper.ownerDocument, "mouseup", up); doc.history.lastSelOrigin = null; } var move = operation(cm, function (e) { if (e.buttons === 0 || !e_button(e)) { done(e); } else { extend(e); } }); var up = operation(cm, done); cm.state.selectingText = up; on(display.wrapper.ownerDocument, "mousemove", move); on(display.wrapper.ownerDocument, "mouseup", up); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unselectText_() {\n try {\n this.win.getSelection().removeAllRanges();\n } catch (e) {\n // Selection API not supported.\n }\n }", "clearSelection() {\n this._clearSelection();\n }", "cut() {\n if (this.owner.isReadOnlyMode || this.selection.isEmpty) {\n return;\...
[ "0.7486875", "0.72677946", "0.7257403", "0.72473305", "0.72473305", "0.72473305", "0.71620464", "0.71620464", "0.71315503", "0.7116692", "0.7113116", "0.70956546", "0.7062658", "0.7048435", "0.7040968", "0.7010727", "0.7001272", "0.69776547", "0.6956012", "0.6949947", "0.6938...
0.0
-1
Used when mouseselecting to adjust the anchor to the proper side of a bidi jump depending on the visual position of the head.
function bidiSimplify(cm, range) { var anchor = range.anchor; var head = range.head; var anchorLine = getLine(cm.doc, anchor.line); if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range } var order = getOrder(anchorLine); if (!order) { return range } var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index]; if (part.from != anchor.ch && part.to != anchor.ch) { return range } var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1); if (boundary == 0 || boundary == order.length) { return range } // Compute the relative visual position of the head compared to the // anchor (<0 is to the left, >0 to the right) var leftSide; if (head.line != anchor.line) { leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0; } else { var headIndex = getBidiPartAt(order, head.ch, head.sticky); var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1); if (headIndex == boundary - 1 || headIndex == boundary) { leftSide = dir < 0; } else { leftSide = dir > 0; } } var usePart = order[boundary + (leftSide ? -1 : 0)]; var from = leftSide == (usePart.level == 1); var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before"; return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setLabelAnchor(d) {\r\n if (d.target.x >= (d.source.x + 20)) return \"start\";\r\n if (d.target.x <= (d.source.x - 20)) return \"end\";\r\n return \"middle\";\r\n }", "function updateAnchorPos() {\n if (!labelSim.selection) return;\n\n labelSim.selection.each(function(d) {\n v...
[ "0.6865997", "0.65352046", "0.63302565", "0.6309565", "0.6135887", "0.6132395", "0.6033308", "0.6033308", "0.6033308", "0.5898258", "0.5860216", "0.5860216", "0.5860216", "0.5844974", "0.5740096", "0.5736967", "0.5736967", "0.5736967", "0.5736967", "0.569803", "0.56956744", ...
0.0
-1
Determines whether an event happened in the gutter, and fires the handlers for the corresponding event.
function gutterEvent(cm, e, type, prevent) { var mX, mY; if (e.touches) { mX = e.touches[0].clientX; mY = e.touches[0].clientY; } else { try { mX = e.clientX; mY = e.clientY; } catch(e$1) { return false } } if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false } if (prevent) { e_preventDefault(e); } var display = cm.display; var lineBox = display.lineDiv.getBoundingClientRect(); if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) } mY -= lineBox.top - display.viewOffset; for (var i = 0; i < cm.display.gutterSpecs.length; ++i) { var g = display.gutters.childNodes[i]; if (g && g.getBoundingClientRect().right >= mX) { var line = lineAtHeight(cm.doc, mY); var gutter = cm.display.gutterSpecs[i]; signal(cm, type, cm, line, gutter.className, e); return e_defaultPrevented(e) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox...
[ "0.6422186", "0.6422186", "0.6422186", "0.6422186", "0.6422186", "0.6422186", "0.6422186", "0.6414585", "0.6379669", "0.63603884", "0.63506794", "0.63389903", "0.63349676", "0.63349676", "0.63349676", "0.63349676", "0.63349676", "0.63349676", "0.63208854", "0.63208854", "0.63...
0.63234776
23
CONTEXT MENU HANDLING To make the context menu work, we need to briefly unhide the textarea (making it as unobtrusive as possible) to let the rightclick take effect on it.
function onContextMenu(cm, e) { if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return } if (signalDOMEvent(cm, e, "contextmenu")) { return } if (!captureRightClick) { cm.display.input.onContextMenu(e); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rightClickHandler(ev, textarea, screenElement, selectionService, shouldSelectWord) {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n // Get textarea ready to copy from the context menu\n textarea.va...
[ "0.68549496", "0.66134685", "0.66105276", "0.65586615", "0.65378284", "0.65269154", "0.6480186", "0.64347166", "0.635688", "0.6342562", "0.63181025", "0.63181025", "0.63043785", "0.6293949", "0.6293949", "0.62910026", "0.6225243", "0.6213995", "0.62080663", "0.6180426", "0.61...
0.5824024
74
A CodeMirror instance represents an editor. This is the object that user code is usually dealing with.
function CodeMirror(place, options) { var this$1 = this; if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) } this.options = options = options ? copyObj(options) : {}; // Determine effective options based on given values and defaults. copyObj(defaults, options, false); var doc = options.value; if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); } else if (options.mode) { doc.modeOption = options.mode; } this.doc = doc; var input = new CodeMirror.inputStyles[options.inputStyle](this); var display = this.display = new Display(place, doc, input, options); display.wrapper.CodeMirror = this; themeChanged(this); if (options.lineWrapping) { this.display.wrapper.className += " CodeMirror-wrap"; } initScrollbars(this); this.state = { keyMaps: [], // stores maps added by addKeyMap overlays: [], // highlighting overlays, as added by addOverlay modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info overwrite: false, delayingBlurEvent: false, focused: false, suppressEdits: false, // used to disable editing during key handlers when in readOnly mode pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll selectingText: false, draggingText: false, highlight: new Delayed(), // stores highlight worker timeout keySeq: null, // Unfinished key sequence specialChars: null }; if (options.autofocus && !mobile) { display.input.focus(); } // Override magic textarea content restore that IE sometimes does // on our hidden textarea on reload if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); } registerEventHandlers(this); ensureGlobalHandlers(); startOperation(this); this.curOp.forceUpdate = true; attachDoc(this, doc); if ((options.autofocus && !mobile) || this.hasFocus()) { setTimeout(bind(onFocus, this), 20); } else { onBlur(this); } for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt)) { optionHandlers[opt](this, options[opt], Init); } } maybeUpdateLineNumberWidth(this); if (options.finishInit) { options.finishInit(this); } for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); } endOperation(this); // Suppress optimizelegibility in Webkit, since it breaks text // measuring on line wrapping boundaries. if (webkit && options.lineWrapping && getComputedStyle(display.lineDiv).textRendering == "optimizelegibility") { display.lineDiv.style.textRendering = "auto"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options || {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);...
[ "0.76397574", "0.75973415", "0.7584642", "0.7584642", "0.75527847", "0.75521165", "0.75487804", "0.7531102", "0.75298876", "0.7528814", "0.7528267", "0.7528267", "0.75014883", "0.74978673", "0.7479799", "0.7479799", "0.7479799", "0.7479799", "0.7479799", "0.7479799", "0.74789...
0.74789435
25
Attach the necessary event handlers when initializing the editor
function registerEventHandlers(cm) { var d = cm.display; on(d.scroller, "mousedown", operation(cm, onMouseDown)); // Older IE's will not fire a second mousedown for a double click if (ie && ie_version < 11) { on(d.scroller, "dblclick", operation(cm, function (e) { if (signalDOMEvent(cm, e)) { return } var pos = posFromMouse(cm, e); if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return } e_preventDefault(e); var word = cm.findWordAt(pos); extendSelection(cm.doc, word.anchor, word.head); })); } else { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); } // Some browsers fire contextmenu *after* opening the menu, at // which point we can't mess with it anymore. Context menu is // handled in onMouseDown for these browsers. on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); on(d.input.getField(), "contextmenu", function (e) { if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); } }); // Used to suppress mouse event handling when a touch happens var touchFinished, prevTouch = {end: 0}; function finishTouch() { if (d.activeTouch) { touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000); prevTouch = d.activeTouch; prevTouch.end = +new Date; } } function isMouseLikeTouchEvent(e) { if (e.touches.length != 1) { return false } var touch = e.touches[0]; return touch.radiusX <= 1 && touch.radiusY <= 1 } function farAway(touch, other) { if (other.left == null) { return true } var dx = other.left - touch.left, dy = other.top - touch.top; return dx * dx + dy * dy > 20 * 20 } on(d.scroller, "touchstart", function (e) { if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) { d.input.ensurePolled(); clearTimeout(touchFinished); var now = +new Date; d.activeTouch = {start: now, moved: false, prev: now - prevTouch.end <= 300 ? prevTouch : null}; if (e.touches.length == 1) { d.activeTouch.left = e.touches[0].pageX; d.activeTouch.top = e.touches[0].pageY; } } }); on(d.scroller, "touchmove", function () { if (d.activeTouch) { d.activeTouch.moved = true; } }); on(d.scroller, "touchend", function (e) { var touch = d.activeTouch; if (touch && !eventInWidget(d, e) && touch.left != null && !touch.moved && new Date - touch.start < 300) { var pos = cm.coordsChar(d.activeTouch, "page"), range; if (!touch.prev || farAway(touch, touch.prev)) // Single tap { range = new Range(pos, pos); } else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap { range = cm.findWordAt(pos); } else // Triple tap { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); } cm.setSelection(range.anchor, range.head); cm.focus(); e_preventDefault(e); } finishTouch(); }); on(d.scroller, "touchcancel", finishTouch); // Sync scrolling between fake scrollbars and real scrollable // area, ensure viewport is updated when scrolling. on(d.scroller, "scroll", function () { if (d.scroller.clientHeight) { updateScrollTop(cm, d.scroller.scrollTop); setScrollLeft(cm, d.scroller.scrollLeft, true); signal(cm, "scroll", cm); } }); // Listen to wheel events in order to try and update the viewport on time. on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); }); on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); }); // Prevent wrapper from ever scrolling on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }); d.dragFunctions = { enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }}, over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }}, start: function (e) { return onDragStart(cm, e); }, drop: operation(cm, onDrop), leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }} }; var inp = d.input.getField(); on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); }); on(inp, "keydown", operation(cm, onKeyDown)); on(inp, "keypress", operation(cm, onKeyPress)); on(inp, "focus", function (e) { return onFocus(cm, e); }); on(inp, "blur", function (e) { return onBlur(cm, e); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n\n\t\t// Bind the editor elements to variables\n\t\tbindElements();\n\n\t\t// Create event listeners for keyup, mouseup, etc.\n\t\tcreateEventBindings();\n\t}", "initEventListners() {\n this.engine.getSession().selection.on('changeCursor', () => this.updateCursorLabels());\n\n th...
[ "0.80966556", "0.77389115", "0.75494534", "0.72982234", "0.7282955", "0.723292", "0.7122359", "0.71221983", "0.71001315", "0.7071713", "0.7025846", "0.6915193", "0.6894815", "0.68728834", "0.685716", "0.68458426", "0.68189013", "0.6798981", "0.6797055", "0.6743994", "0.672856...
0.0
-1
Indent the given line. The how parameter can be "smart", "add"/null, "subtract", or "prev". When aggressive is false (typically set to true for forced singleline indents), empty lines are not indented, and places where the mode returns Pass are left alone.
function indentLine(cm, n, how, aggressive) { var doc = cm.doc, state; if (how == null) { how = "add"; } if (how == "smart") { // Fall back to "prev" when the mode doesn't have an indentation // method. if (!doc.mode.indent) { how = "prev"; } else { state = getContextBefore(cm, n).state; } } var tabSize = cm.options.tabSize; var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize); if (line.stateAfter) { line.stateAfter = null; } var curSpaceString = line.text.match(/^\s*/)[0], indentation; if (!aggressive && !/\S/.test(line.text)) { indentation = 0; how = "not"; } else if (how == "smart") { indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text); if (indentation == Pass || indentation > 150) { if (!aggressive) { return } how = "prev"; } } if (how == "prev") { if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); } else { indentation = 0; } } else if (how == "add") { indentation = curSpace + cm.options.indentUnit; } else if (how == "subtract") { indentation = curSpace - cm.options.indentUnit; } else if (typeof how == "number") { indentation = curSpace + how; } indentation = Math.max(0, indentation); var indentString = "", pos = 0; if (cm.options.indentWithTabs) { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} } if (pos < indentation) { indentString += spaceStr(indentation - pos); } if (indentString != curSpaceString) { replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input"); line.stateAfter = null; return true } else { // Ensure that, if the cursor was in the whitespace at the start // of the line, it is moved to the end of that space. for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) { var range = doc.sel.ranges[i$1]; if (range.head.line == n && range.head.ch < curSpaceString.length) { var pos$1 = Pos(n, curSpaceString.length); replaceOneSelection(doc, i$1, new Range(pos$1, pos$1)); break } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function indentLine(cm, n, how, aggressive) {\n\t var doc = cm.doc, state;\n\t if (how == null) how = \"add\";\n\t if (how == \"smart\") {\n\t // Fall back to \"prev\" when the mode doesn't have an indentation\n\t // method.\n\t if (!doc.mode.indent) how = \"prev\";\n\t else state = ge...
[ "0.7560999", "0.7560999", "0.75511813", "0.75368756", "0.7525595", "0.74956495", "0.74829096", "0.74829096", "0.7468585", "0.74491745", "0.74491745", "0.74491745", "0.74491745", "0.7437678", "0.7415526", "0.7408092", "0.7408092", "0.7408092", "0.7408092", "0.7408092", "0.7408...
0.7505184
21
The publicly visible API. Note that methodOp(f) means 'wrap f in an operation, performed on its `this` parameter'. This is not the complete set of editor methods. Most of the methods defined on the Doc type are also injected into CodeMirror.prototype, for backwards compatibility and convenience.
function addEditorMethods(CodeMirror) { var optionHandlers = CodeMirror.optionHandlers; var helpers = CodeMirror.helpers = {}; CodeMirror.prototype = { constructor: CodeMirror, focus: function(){window.focus(); this.display.input.focus();}, setOption: function(option, value) { var options = this.options, old = options[option]; if (options[option] == value && option != "mode") { return } options[option] = value; if (optionHandlers.hasOwnProperty(option)) { operation(this, optionHandlers[option])(this, value, old); } signal(this, "optionChange", this, option); }, getOption: function(option) {return this.options[option]}, getDoc: function() {return this.doc}, addKeyMap: function(map, bottom) { this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map)); }, removeKeyMap: function(map) { var maps = this.state.keyMaps; for (var i = 0; i < maps.length; ++i) { if (maps[i] == map || maps[i].name == map) { maps.splice(i, 1); return true } } }, addOverlay: methodOp(function(spec, options) { var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec); if (mode.startState) { throw new Error("Overlays may not be stateful.") } insertSorted(this.state.overlays, {mode: mode, modeSpec: spec, opaque: options && options.opaque, priority: (options && options.priority) || 0}, function (overlay) { return overlay.priority; }); this.state.modeGen++; regChange(this); }), removeOverlay: methodOp(function(spec) { var overlays = this.state.overlays; for (var i = 0; i < overlays.length; ++i) { var cur = overlays[i].modeSpec; if (cur == spec || typeof spec == "string" && cur.name == spec) { overlays.splice(i, 1); this.state.modeGen++; regChange(this); return } } }), indentLine: methodOp(function(n, dir, aggressive) { if (typeof dir != "string" && typeof dir != "number") { if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; } else { dir = dir ? "add" : "subtract"; } } if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); } }), indentSelection: methodOp(function(how) { var ranges = this.doc.sel.ranges, end = -1; for (var i = 0; i < ranges.length; i++) { var range = ranges[i]; if (!range.empty()) { var from = range.from(), to = range.to(); var start = Math.max(end, from.line); end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1; for (var j = start; j < end; ++j) { indentLine(this, j, how); } var newRanges = this.doc.sel.ranges; if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); } } else if (range.head.line > end) { indentLine(this, range.head.line, how, true); end = range.head.line; if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); } } } }), // Fetch the parser token for a given character. Useful for hacks // that want to inspect the mode state (say, for completion). getTokenAt: function(pos, precise) { return takeToken(this, pos, precise) }, getLineTokens: function(line, precise) { return takeToken(this, Pos(line), precise, true) }, getTokenTypeAt: function(pos) { pos = clipPos(this.doc, pos); var styles = getLineStyles(this, getLine(this.doc, pos.line)); var before = 0, after = (styles.length - 1) / 2, ch = pos.ch; var type; if (ch == 0) { type = styles[2]; } else { for (;;) { var mid = (before + after) >> 1; if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; } else if (styles[mid * 2 + 1] < ch) { before = mid + 1; } else { type = styles[mid * 2 + 2]; break } } } var cut = type ? type.indexOf("overlay ") : -1; return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1) }, getModeAt: function(pos) { var mode = this.doc.mode; if (!mode.innerMode) { return mode } return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode }, getHelper: function(pos, type) { return this.getHelpers(pos, type)[0] }, getHelpers: function(pos, type) { var found = []; if (!helpers.hasOwnProperty(type)) { return found } var help = helpers[type], mode = this.getModeAt(pos); if (typeof mode[type] == "string") { if (help[mode[type]]) { found.push(help[mode[type]]); } } else if (mode[type]) { for (var i = 0; i < mode[type].length; i++) { var val = help[mode[type][i]]; if (val) { found.push(val); } } } else if (mode.helperType && help[mode.helperType]) { found.push(help[mode.helperType]); } else if (help[mode.name]) { found.push(help[mode.name]); } for (var i$1 = 0; i$1 < help._global.length; i$1++) { var cur = help._global[i$1]; if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) { found.push(cur.val); } } return found }, getStateAfter: function(line, precise) { var doc = this.doc; line = clipLine(doc, line == null ? doc.first + doc.size - 1: line); return getContextBefore(this, line + 1, precise).state }, cursorCoords: function(start, mode) { var pos, range = this.doc.sel.primary(); if (start == null) { pos = range.head; } else if (typeof start == "object") { pos = clipPos(this.doc, start); } else { pos = start ? range.from() : range.to(); } return cursorCoords(this, pos, mode || "page") }, charCoords: function(pos, mode) { return charCoords(this, clipPos(this.doc, pos), mode || "page") }, coordsChar: function(coords, mode) { coords = fromCoordSystem(this, coords, mode || "page"); return coordsChar(this, coords.left, coords.top) }, lineAtHeight: function(height, mode) { height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top; return lineAtHeight(this.doc, height + this.display.viewOffset) }, heightAtLine: function(line, mode, includeWidgets) { var end = false, lineObj; if (typeof line == "number") { var last = this.doc.first + this.doc.size - 1; if (line < this.doc.first) { line = this.doc.first; } else if (line > last) { line = last; end = true; } lineObj = getLine(this.doc, line); } else { lineObj = line; } return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top + (end ? this.doc.height - heightAtLine(lineObj) : 0) }, defaultTextHeight: function() { return textHeight(this.display) }, defaultCharWidth: function() { return charWidth(this.display) }, getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}}, addWidget: function(pos, node, scroll, vert, horiz) { var display = this.display; pos = cursorCoords(this, clipPos(this.doc, pos)); var top = pos.bottom, left = pos.left; node.style.position = "absolute"; node.setAttribute("cm-ignore-events", "true"); this.display.input.setUneditable(node); display.sizer.appendChild(node); if (vert == "over") { top = pos.top; } else if (vert == "above" || vert == "near") { var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); // Default to positioning above (if specified and possible); otherwise default to positioning below if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) { top = pos.top - node.offsetHeight; } else if (pos.bottom + node.offsetHeight <= vspace) { top = pos.bottom; } if (left + node.offsetWidth > hspace) { left = hspace - node.offsetWidth; } } node.style.top = top + "px"; node.style.left = node.style.right = ""; if (horiz == "right") { left = display.sizer.clientWidth - node.offsetWidth; node.style.right = "0px"; } else { if (horiz == "left") { left = 0; } else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; } node.style.left = left + "px"; } if (scroll) { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); } }, triggerOnKeyDown: methodOp(onKeyDown), triggerOnKeyPress: methodOp(onKeyPress), triggerOnKeyUp: onKeyUp, triggerOnMouseDown: methodOp(onMouseDown), execCommand: function(cmd) { if (commands.hasOwnProperty(cmd)) { return commands[cmd].call(null, this) } }, triggerElectric: methodOp(function(text) { triggerElectric(this, text); }), findPosH: function(from, amount, unit, visually) { var dir = 1; if (amount < 0) { dir = -1; amount = -amount; } var cur = clipPos(this.doc, from); for (var i = 0; i < amount; ++i) { cur = findPosH(this.doc, cur, dir, unit, visually); if (cur.hitSide) { break } } return cur }, moveH: methodOp(function(dir, unit) { var this$1 = this; this.extendSelectionsBy(function (range) { if (this$1.display.shift || this$1.doc.extend || range.empty()) { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) } else { return dir < 0 ? range.from() : range.to() } }, sel_move); }), deleteH: methodOp(function(dir, unit) { var sel = this.doc.sel, doc = this.doc; if (sel.somethingSelected()) { doc.replaceSelection("", null, "+delete"); } else { deleteNearSelection(this, function (range) { var other = findPosH(doc, range.head, dir, unit, false); return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other} }); } }), findPosV: function(from, amount, unit, goalColumn) { var dir = 1, x = goalColumn; if (amount < 0) { dir = -1; amount = -amount; } var cur = clipPos(this.doc, from); for (var i = 0; i < amount; ++i) { var coords = cursorCoords(this, cur, "div"); if (x == null) { x = coords.left; } else { coords.left = x; } cur = findPosV(this, coords, dir, unit); if (cur.hitSide) { break } } return cur }, moveV: methodOp(function(dir, unit) { var this$1 = this; var doc = this.doc, goals = []; var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected(); doc.extendSelectionsBy(function (range) { if (collapse) { return dir < 0 ? range.from() : range.to() } var headPos = cursorCoords(this$1, range.head, "div"); if (range.goalColumn != null) { headPos.left = range.goalColumn; } goals.push(headPos.left); var pos = findPosV(this$1, headPos, dir, unit); if (unit == "page" && range == doc.sel.primary()) { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); } return pos }, sel_move); if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++) { doc.sel.ranges[i].goalColumn = goals[i]; } } }), // Find the word at the given position (as returned by coordsChar). findWordAt: function(pos) { var doc = this.doc, line = getLine(doc, pos.line).text; var start = pos.ch, end = pos.ch; if (line) { var helper = this.getHelper(pos, "wordChars"); if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; } var startChar = line.charAt(start); var check = isWordChar(startChar, helper) ? function (ch) { return isWordChar(ch, helper); } : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); } : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); }; while (start > 0 && check(line.charAt(start - 1))) { --start; } while (end < line.length && check(line.charAt(end))) { ++end; } } return new Range(Pos(pos.line, start), Pos(pos.line, end)) }, toggleOverwrite: function(value) { if (value != null && value == this.state.overwrite) { return } if (this.state.overwrite = !this.state.overwrite) { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); } else { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); } signal(this, "overwriteToggle", this, this.state.overwrite); }, hasFocus: function() { return this.display.input.getField() == activeElt() }, isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) }, scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }), getScrollInfo: function() { var scroller = this.display.scroller; return {left: scroller.scrollLeft, top: scroller.scrollTop, height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight, width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth, clientHeight: displayHeight(this), clientWidth: displayWidth(this)} }, scrollIntoView: methodOp(function(range, margin) { if (range == null) { range = {from: this.doc.sel.primary().head, to: null}; if (margin == null) { margin = this.options.cursorScrollMargin; } } else if (typeof range == "number") { range = {from: Pos(range, 0), to: null}; } else if (range.from == null) { range = {from: range, to: null}; } if (!range.to) { range.to = range.from; } range.margin = margin || 0; if (range.from.line != null) { scrollToRange(this, range); } else { scrollToCoordsRange(this, range.from, range.to, range.margin); } }), setSize: methodOp(function(width, height) { var this$1 = this; var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; }; if (width != null) { this.display.wrapper.style.width = interpret(width); } if (height != null) { this.display.wrapper.style.height = interpret(height); } if (this.options.lineWrapping) { clearLineMeasurementCache(this); } var lineNo = this.display.viewFrom; this.doc.iter(lineNo, this.display.viewTo, function (line) { if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } } ++lineNo; }); this.curOp.forceUpdate = true; signal(this, "refresh", this); }), operation: function(f){return runInOp(this, f)}, startOperation: function(){return startOperation(this)}, endOperation: function(){return endOperation(this)}, refresh: methodOp(function() { var oldHeight = this.display.cachedTextHeight; regChange(this); this.curOp.forceUpdate = true; clearCaches(this); scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop); updateGutterSpace(this.display); if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping) { estimateLineHeights(this); } signal(this, "refresh", this); }), swapDoc: methodOp(function(doc) { var old = this.doc; old.cm = null; // Cancel the current text selection if any (#5821) if (this.state.selectingText) { this.state.selectingText(); } attachDoc(this, doc); clearCaches(this); this.display.input.reset(); scrollToCoords(this, doc.scrollLeft, doc.scrollTop); this.curOp.forceScroll = true; signalLater(this, "swapDoc", this, old); return old }), phrase: function(phraseText) { var phrases = this.options.phrases; return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText }, getInputField: function(){return this.display.input.getField()}, getWrapperElement: function(){return this.display.wrapper}, getScrollerElement: function(){return this.display.scroller}, getGutterElement: function(){return this.display.gutters} }; eventMixin(CodeMirror); CodeMirror.registerHelper = function(type, name, value) { if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; } helpers[type][name] = value; }; CodeMirror.registerGlobalHelper = function(type, name, predicate, value) { CodeMirror.registerHelper(type, name, value); helpers[type]._global.push({pred: predicate, val: value}); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, valu...
[ "0.66755027", "0.66755027", "0.66755027", "0.66755027", "0.66755027", "0.66755027", "0.66755027", "0.66755027", "0.66755027", "0.6658413", "0.6635639", "0.6635639", "0.66199344", "0.6608263", "0.6597126", "0.6597126", "0.615284", "0.61331004", "0.61331004", "0.61331004", "0.6...
0.66199344
16
Used for horizontal relative motion. Dir is 1 or 1 (left or right), unit can be "char", "column" (like char, but doesn't cross line boundaries), "word" (across next word), or "group" (to the start of next group of word or nonwordnonwhitespace chars). The visually param controls whether, in righttoleft text, direction 1 means to move towards the next index in the string, or towards the character to the right of the current position. The resulting position will have a hitSide=true property if it reached the end of the document.
function findPosH(doc, pos, dir, unit, visually) { var oldPos = pos; var origDir = dir; var lineObj = getLine(doc, pos.line); var lineDir = visually && doc.direction == "rtl" ? -dir : dir; function findNextLine() { var l = pos.line + lineDir; if (l < doc.first || l >= doc.first + doc.size) { return false } pos = new Pos(l, pos.ch, pos.sticky); return lineObj = getLine(doc, l) } function moveOnce(boundToLine) { var next; if (visually) { next = moveVisually(doc.cm, lineObj, pos, dir); } else { next = moveLogically(lineObj, pos, dir); } if (next == null) { if (!boundToLine && findNextLine()) { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); } else { return false } } else { pos = next; } return true } if (unit == "char") { moveOnce(); } else if (unit == "column") { moveOnce(true); } else if (unit == "word" || unit == "group") { var sawType = null, group = unit == "group"; var helper = doc.cm && doc.cm.getHelper(pos, "wordChars"); for (var first = true;; first = false) { if (dir < 0 && !moveOnce(!first)) { break } var cur = lineObj.text.charAt(pos.ch) || "\n"; var type = isWordChar(cur, helper) ? "w" : group && cur == "\n" ? "n" : !group || /\s/.test(cur) ? null : "p"; if (group && !first && !type) { type = "s"; } if (sawType && sawType != type) { if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";} break } if (type) { sawType = type; } if (dir > 0 && !moveOnce(!first)) { break } } } var result = skipAtomic(doc, pos, oldPos, origDir, true); if (equalCursorPos(oldPos, result)) { result.hitSide = true; } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findPosH(doc, pos, dir, unit, visually) {\r\n var line = pos.line, ch = pos.ch, origDir = dir;\r\n var lineObj = getLine(doc, line);\r\n var possible = true;\r\n function findNextLine() {\r\n var l = line + dir;\r\n if (l < doc.first || l >= doc.first + doc.size) return (possible = f...
[ "0.61296076", "0.6125485", "0.6125485", "0.6125485", "0.6125485", "0.6125485", "0.6125485", "0.6122467", "0.60935616", "0.60555094", "0.60536236", "0.60270697", "0.60214835", "0.60214835", "0.60214835", "0.59962684", "0.59857744", "0.59748083", "0.59748083", "0.59748083", "0....
0.5998135
16
For relative vertical movement. Dir may be 1 or 1. Unit can be "page" or "line". The resulting position will have a hitSide=true property if it reached the end of the document.
function findPosV(cm, pos, dir, unit) { var doc = cm.doc, x = pos.left, y; if (unit == "page") { var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3); y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount; } else if (unit == "line") { y = dir > 0 ? pos.bottom + 3 : pos.top - 3; } var target; for (;;) { target = coordsChar(cm, x, y); if (!target.outside) { break } if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break } y += dir * 5; } return target }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n ...
[ "0.69151056", "0.69151056", "0.6821693", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.68065315", "0.68065315", "0.67795277", "0.67302203", "0.67302203", "0.67302203", "0.67302...
0.6870279
15
Selectall will be greyed out if there's nothing to select, so this adds a zerowidth space so that we can later check whether it got selected.
function prepareSelectAllHack() { if (te.selectionStart != null) { var selected = cm.somethingSelected(); var extval = "\u200b" + (selected ? te.value : ""); te.value = "\u21da"; // Used to catch context-menu undo te.value = extval; input.prevInput = selected ? "" : "\u200b"; te.selectionStart = 1; te.selectionEnd = extval.length; // Re-set this, in case some other handler touched the // selection in the meantime. display.selForContextMenu = cm.doc.sel; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectAll()\r\n\t\t{\r\n\t\t\tthis.focus();\r\n\t\t\tthis.select();\r\n\t\t}", "function show_select_all(){\r\n var th = getPatternResult(PATTERN['select_all']).snapshotItem(0);\r\n if (th == null) \r\n return;\r\n th.innerHTML = '<input type=\"checkbox\"/>';\r\n th.setAttribute('titl...
[ "0.7960442", "0.684858", "0.68469757", "0.68469757", "0.68469757", "0.68469757", "0.68469757", "0.6834171", "0.6793573", "0.6772544", "0.67601126", "0.67601126", "0.67601126", "0.67488813", "0.67488813", "0.674015", "0.674015", "0.67336243", "0.67294997", "0.6716153", "0.6716...
0.67056537
46
This is a crude lookahead trick to try and notice that we're parsing the argument patterns for a fatarrow function before we actually hit the arrow token. It only works if the arrow is on the same line as the arguments and there's no strange noise (comments) in between. Fallback is to only notice when we hit the arrow, and not declare the arguments as locals for the arrow body.
function findFatArrow(stream, state) { if (state.fatArrowAt) state.fatArrowAt = null; var arrow = stream.string.indexOf("=>", stream.start); if (arrow < 0) return; if (isTS) { // Try to skip TypeScript return type declarations after the arguments var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow)) if (m) arrow = m.index } var depth = 0, sawSomething = false; for (var pos = arrow - 1; pos >= 0; --pos) { var ch = stream.string.charAt(pos); var bracket = brackets.indexOf(ch); if (bracket >= 0 && bracket < 3) { if (!depth) { ++pos; break; } if (--depth == 0) { if (ch == "(") sawSomething = true; break; } } else if (bracket >= 3 && bracket < 6) { ++depth; } else if (wordRE.test(ch)) { sawSomething = true; } else if (/["'\/`]/.test(ch)) { for (;; --pos) { if (pos == 0) return var next = stream.string.charAt(pos - 1) if (next == ch && stream.string.charAt(pos - 2) != "\\") { pos--; break } } } else if (sawSomething && !depth) { ++pos; break; } } if (sawSomething && !depth) state.fatArrowAt = pos; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findFatArrow(stream, state) {\n if (state.fatArrowAt) state.fatArrowAt = null;\n var arrow = stream.string.indexOf(\"=>\", stream.start);\n if (arrow < 0) return;\n\n if (isTS) { // Try to skip TypeScript return type declarations after the arguments\n var m = /:\\s*(?:\\w+(?:<[^>]*>|\\[\\...
[ "0.65002364", "0.65002364", "0.65002364", "0.65002364", "0.65002364", "0.65002364", "0.65002364", "0.6379487", "0.5909741", "0.58358055", "0.5675954", "0.5675954", "0.5675954", "0.5672122", "0.56436837", "0.5634487", "0.5597511", "0.5436599", "0.5396029", "0.53609353", "0.520...
0.64995736
15
Variables: xSrc, ySrc : coordinates in source image xDst, yDst : coordinates in destination (projected) image uSrc, vSrc : uniform coordinates in source image uDst, vDst : uniform coordinates in destination image wSrc, hSrc : width and height of source image wDst, hDst : width and height of destination image Assumption: pixels have a dimension (are not infinitely small). Then source image has coordinates (x,y) = ([0..width],[0..height]). Or, otherwise, coordinates (u,v) = ([0.5..0.5],[0.5..0.5]) This corresponds to ([hfov/2..hfov/2],[vfov/2..vfov/2]). So: xAngSrc = hfov (xSrc / wSrc 0.5) xSrc = wSrc (xAngSrc / hfov + 0.5) And: xDst = wDst tan(xAngSrc) = wDst tan(hfov (xSrc / wSrc 0.5)) xAngSrc = atan(xDst) / wDst xSrc = wSrc ((atan(xDst) / wDst) / hfov + 0.5 Or: xAngSrc = hfov uSrc uSrc = xAngSrc / hfov And: uDst = tan(xAngSrc) = tan(hfov uSrc) xAngSrc = atan(uDst) uSrc = atan(uDst) / hfov Same for y dimension of course.
function JSPanoViewer(opts) { var debug = false; // Set to true to enable some debug information // Private variables (non-changeable after initialization) var containerId; // id of pano container var container; // pano container var imageUrl; // url of source image var image; // source image var slices; // array with vertical image slices var wSlice; // Width of each slice (in screen pixels) // Image parameters for source and destination image (screen): // width, height, horizontal/vertical field of view var wSrc, hSrc, hFovSrc, vFovSrc; var wDst, hDst, hFovDst, vFovDst; var angCenter; // View angle var mode; var optShift, optScale, optMath, optPower; var optCircleSize; // Set default options this.setDefaults(); // Supplied options override default options this.setOptions(opts); // Load CSS, if not already loaded if(!this.cssLoaded) this.loadCss(); this.init(); this.addControls(); if(typeof(this.imageUrl) != 'undefined') { this.loadImage(this.imageUrl); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "project(ax, ay, az, angles){\r\n var x = ax - this.camera_p.x;\r\n var y = ay - this.camera_p.y;\r\n var z = az - this.camera_p.z;\r\n \r\n var dx = angles.cy*(angles.sz*y + angles.cz*x) - angles.sy*z;\r\n var dy = angles.sx*(angles.cy*z + angles.sy*(angles.sz*y + angles.cz*x)) + angles.cx*(angle...
[ "0.61471117", "0.6036922", "0.5688516", "0.5638165", "0.5613809", "0.55740416", "0.5479777", "0.53457654", "0.5290381", "0.5269545", "0.5267563", "0.5235603", "0.5201322", "0.5181598", "0.5171746", "0.51491964", "0.5145085", "0.511403", "0.50903916", "0.50893575", "0.50868213...
0.0
-1
Low Level Functions TODO
static get(path, successHandler, failureHandler) { // returns URL Storage.get(path).then((url) => { log&&console.log("Storage successfully retrieved file! URL = " + url); if (successHandler) { successHandler(url); } }).catch((error) => { err&&console.error("Storage failed to retrieve file with path = " + path + "... Error: " + error); if (failureHandler) { failureHandler(error); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _____SHARED_functions_____(){}", "private public function m246() {}", "static private internal function m121() {}", "private internal function m248() {}", "function miFuncion (){}", "function FunctionUtils() {}", "transient protected internal function m189() {}", "static final private intern...
[ "0.6780673", "0.67056334", "0.6682646", "0.6682084", "0.6577993", "0.64812523", "0.64528537", "0.6422087", "0.6412744", "0.6412744", "0.6412744", "0.63291126", "0.6301539", "0.6300643", "0.62916064", "0.626478", "0.626478", "0.6158779", "0.6103225", "0.6051021", "0.6028055", ...
0.0
-1
... more overloads ...
function createElement(tagName) { return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "function oi(){}", "transient protected internal function m189() {}", "apply () {}", "function es1(params) {\n \n}", "transient private protected internal function m182() {}", "obtain(){}", "private internal function m248() {}", "function ba(){}", "function ...
[ "0.59703475", "0.56033206", "0.5592253", "0.558463", "0.55371785", "0.553448", "0.5449269", "0.54484195", "0.53812164", "0.53812164", "0.53812164", "0.53812164", "0.53737336", "0.536679", "0.53559905", "0.5351454", "0.53463596", "0.5333846", "0.5321548", "0.53132546", "0.5313...
0.0
-1
fetching email ids from db
function empDataCollection() { client.query('SELECT * from employees', (err, res) => { if (err) { errorLog(err, 'data fetching issue', 'Pending') } else { console.log('fetching email ids') res.rows.map(item => { //email validation if (mailformat.test(item.emailid.trim())) { email.push(item.emailid) } else { let err = 'Invalid email ' + item.emailid console.log(err); errorLog(err, 'email validation', 'Pending') } }) } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetchEmailsFromDatabase(callback) {\n const emails = [\n {\n author: 'Bobby Bob',\n subject: 'Hey Friend!',\n body: `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercita...
[ "0.687989", "0.6711965", "0.6588783", "0.646086", "0.6425887", "0.6421459", "0.6415822", "0.63674015", "0.633978", "0.63247657", "0.6318787", "0.6252117", "0.6244056", "0.6229757", "0.62080944", "0.6198618", "0.6193193", "0.6189425", "0.61688787", "0.6145366", "0.6138443", ...
0.63529164
8
fetching data from errorlog table for rerun the scheduler
function errorDataCollection() { let today = new Date() let pendingSchedule = [''] let currentTime = new Date() let timePeriod = new Date(currentTime.setMinutes(currentTime.getMinutes() - 8)); client.query(`SELECT * from schedule_error WHERE error_area != 'email validation' AND status != 'Success' AND datetime <= '${today}' AND datetime >= '${timePeriod}'`, (err, res) => { if (err) { errorLog(err, 'reschedule', 'Pending') } else { pendingSchedule = res.rows for (let errorrow of pendingSchedule) { reScheduling(errorrow); } } // console.log(res.rows); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "refreshAnomalyTable() {\n const { anomalyIds, exploreDimensions } = this.currentModel;\n if (anomalyIds && anomalyIds.length) {\n get(this, 'loadAnomalyData').perform(anomalyIds, exploreDimensions);\n }\n }", "function get_data_from_log_table(func)\n{\n\tif(typeof static_local_db=='undef...
[ "0.625712", "0.56987184", "0.55910146", "0.54449993", "0.54331005", "0.54055744", "0.5359964", "0.53308415", "0.52409154", "0.522169", "0.52164537", "0.5203963", "0.51914084", "0.5180849", "0.51371044", "0.51195794", "0.5112088", "0.5087484", "0.5078544", "0.5068073", "0.5056...
0.7026856
0
insering error to db
function errorLog(error, area, status) { var today = new Date(); client.query( `INSERT INTO schedule_error(message, datetime,error_area,status)VALUES('${error}','${today}','${area}','${status}')`, (err, res) => { if (err) { console.log(err) } } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function errorDB(tx, err) {\n\t\tif (err && err.message) {\n\t\t alert(\"Error processing SQL: \" + err.message);\n\t\t} else {\n\t\t alert(\"Error processing SQL: \" + tx);\n\t\t}\n\t}", "function showError() {\n console.log(\"error in writing data to the database\")\n}", "function dbErrorHandler(err...
[ "0.70000505", "0.66978574", "0.6451408", "0.6393154", "0.6319233", "0.6264156", "0.6204822", "0.61405236", "0.6096386", "0.6084221", "0.60840803", "0.59512264", "0.59374774", "0.5872387", "0.5869617", "0.58605194", "0.5832813", "0.5815779", "0.58133054", "0.5811347", "0.58071...
0.6570999
2
updating db status after rescheduling the cron
function update(row, status) { let errorId = parseInt(row.errorId) client.query( `UPDATE schedule_error SET status = '${status}' WHERE "errorId"= '${errorId}'`, (err, res) => { console.log(`UPDATE schedule_error SET status = '${status}' WHERE "errorId"= '${errorId}'`); if (err) { errorLog(err, 'rescheduling updation failed', 'Failed') }else { console.log('successfully updated'); } } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cron() {\n console.log(`Updating db - ${new Date()}`);\n updateDb(payload)()\n .then((res) => console.log('sucess!'))\n .catch((err) => console.error(err));\n }", "changeStatus(req, res, taskDB) {\n\n taskDB.status = 'On Hold';\n taskDB.total_time = 0;\n taskDB....
[ "0.74272317", "0.69068563", "0.6885459", "0.63597184", "0.63363063", "0.63096744", "0.6302215", "0.6151328", "0.6123157", "0.60297394", "0.59153324", "0.5911979", "0.59087694", "0.58488804", "0.5837589", "0.58220947", "0.58122486", "0.5798191", "0.5788578", "0.5756711", "0.57...
0.55259514
41
TODO add mousedragged panning system
function draw() { background(0, 0, 0, 0.031); translate(posX ? posX : 0, posY ? posY : 0) stroke(78, 255, 255) rect(0.9 * width, 0, 10, accumulator); // fill(0,255,0,0.05) // fft.smooth(); // fft.log // noise.start(); spectrum = fft.analyze(); chunkSize = Math.floor(spectrum.length / population); reducedSpectrum = arrayChunk(spectrum, chunkSize); // con reducedSpectrum.map((cluster, index) => { let sum = cluster.reduce((accum, element) => { return accum + element; }); // then((sum) => { let val = sum / cluster.length; // console.log(val) if (index < population) { var comp = map(index, 0, population, 360, 0); stroke(comp, 255, 255); var r = map(val, 0, 255, 0.1, 125); x = map(index, 0, population, 0, width); y = map(index, 0, population, height, 0); ellipse(width / 2 + ants[index].dist, y , r); random(1) < 0.13 ? ants[index].move() : null; } else { accumulator += val; } // }) // }) }) // for (i = 0; i < spectrum.length; i++) { // if (i < population) { // var comp = map(i, 0, population, 360, 0); // stroke(comp, 255, 255); // var r = map(spectrum[i], 0, 255, 0.1, 125); // x = map(i, 0, population, 0, width); // y = map(i, 0, population, height, 0); // ellipse(width / 2 + ants[i].dist, y, r); // ants[i].move(); // } else { // accumulator += spectrum[i]; // } // } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mouseDrag(prev, pt) {}", "mouseDrag(prev, pt) {}", "onDrag(mousePosition) {\n }", "function mouseDragged(){\r\n inputForMDragging(mouseX, mouseY);\r\n\r\n\r\n}", "function MouseDownHandler(e) {\n pan_context = true;\n pan_dx = e.x;\n pan_dy = e.y;\n}", "function drag(e, selected) {\r\n\r\n ...
[ "0.7735252", "0.7735252", "0.73893714", "0.7227028", "0.7152726", "0.70997655", "0.7056806", "0.6971906", "0.6926726", "0.69207484", "0.691976", "0.6884179", "0.6860881", "0.68426406", "0.6799577", "0.6771831", "0.67569953", "0.6738576", "0.67344797", "0.6700918", "0.6698888"...
0.0
-1
make a function that returns it to use later in the gridlines
function make_xAxis(){ return xAxis; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addGridLines () {\n }", "function makeGrid() {\n\n\n}", "function FunctionNumberLineGrid(options) {\n let grid,\n lineInterval,\n strokeWidth,\n stroke,\n group,\n where;\n\n grid = this;\n\n init(options);\n\n return grid;\n\n /* INITIALIZE */\n function init(options) {\n\n _required(...
[ "0.6213417", "0.59470516", "0.57941544", "0.559212", "0.55903167", "0.5544916", "0.548228", "0.54819", "0.5469781", "0.5462998", "0.5451679", "0.5450763", "0.54480135", "0.5445739", "0.54091287", "0.54035133", "0.54035133", "0.54035133", "0.54035133", "0.54035133", "0.5401679...
0.0
-1
Change to color to match the result
function markerSize(earthquake_size) { return 200; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function colorForCurrent(){\n\n}", "function changeColorFaded() {\n\n temp = 330;\n cont1 = 0;\n cont2 = 125;\n cont3 = 254;\n\n function cycler(cont) {\n if(cont >= 255) \n op = 'decr';\n else\n op = 'incr';\n\n switch(op) {\n case 'decr':\n ...
[ "0.7579182", "0.7420032", "0.71965784", "0.7143855", "0.7115005", "0.7096492", "0.7084842", "0.70112765", "0.69973755", "0.6982523", "0.69674814", "0.69609386", "0.695327", "0.6947832", "0.69305116", "0.6929169", "0.6917636", "0.6910333", "0.68937707", "0.6892108", "0.6875651...
0.0
-1
Define a function we want to run once for each feature in the features array Give each feature a popup describing the place and time of the earthquake
function onEachFeature(feature, layer) { console.log("I'm in onEachFeature") layer.bindPopup("<h3>" + feature.properties.YEAR_MONTH + "</h3><hr><p>" + feature.properties.NARRATIVE + "</p>"); var two_coords =[] two_coords.push(feature.properties.Longitude); two_coords.push(feature.properties.Latitude); console.log(two_coords); console.log("Year" +feature.properties.YR); sizeMarkers.push( L.circle(two_coords, { color: 'red', stroke: false, fillColor: '#f03', fillOpacity: 1,//(feature.properties.mag/5), radius: 50//markerSize(feature.properties.mag) }) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onEachFeature(feature, layer) {\n // Give each feature a popup describing the place and time of the earthquake\n layer.bindPopup(`<h3> ${feature.properties.place} </h3> <hr> <p> ${Date(feature.properties.time)} </p>`);\n }", "function onEachFeature(feature, layer) {\n // does this feat...
[ "0.7831195", "0.764172", "0.7465871", "0.7382966", "0.7374346", "0.737402", "0.7373242", "0.7370269", "0.73434675", "0.7341874", "0.7341864", "0.7328692", "0.72994506", "0.72984785", "0.72964346", "0.72964346", "0.72964346", "0.72761595", "0.72721845", "0.725579", "0.72524047...
0.6347618
100
welcome to experience this demo, and fork to modify it. ^_^ concent build a ctx for every instance, it supplies state, sync, dispatch and etc ... you can use them in any of components bellow more details see doc: and your can copy left side bar other file's content to experience like registerhookcomp.js ... visit more demos:
function changeGreeting(greeting) { return { greeting }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function App() {\n \n \n return (\n <div className=\"App\">\n <div className=\"count\">\n \n {/* <HookuseState/>\n <HookuseState2/>\n <UseStateArray/>\n <HookMouse/> */}\n {/* <MouseContainer/> */}\n <firstName.Provider value = {{name:\"pavan \" ,lastname:\"kmar\" , number:861545}}>\n ...
[ "0.65954447", "0.6262957", "0.62339205", "0.6203804", "0.6031257", "0.59684414", "0.5920189", "0.5849903", "0.58327913", "0.58259284", "0.5818412", "0.5815311", "0.5801055", "0.5776937", "0.5754485", "0.5722362", "0.5694953", "0.56917197", "0.5671994", "0.5655382", "0.5648013...
0.0
-1
show loadig mask on modal before form submission;
function maskModal($maskTarget) { var padding = $maskTarget.height() - 80; if (padding > 0) { padding = Math.floor(padding / 2); } $maskTarget.append("<div class='modal-mask'><div class='circle-loader'></div></div>"); //check scrollbar var height = $maskTarget.outerHeight(); $('.modal-mask').css({"width": $maskTarget.width() + 30 + "px", "height": height + "px", "padding-top": padding + "px"}); $maskTarget.closest('.modal-dialog').find('[type="submit"]').attr('disabled', 'disabled'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadSubmitForm() {\n $(\".modal\").css(\"display\", \"block\");\n}", "function showPopupFormular() {\r\n $(\"#\" + global.Element.PopupFormular).modal(\"show\");\r\n }", "function showLoadingGifOnFormSubmit(){\r\n\t$(\"form\").on('submit',function(){$(\".se-pre-con\").show();});\r\n}", ...
[ "0.73136425", "0.7036392", "0.6976032", "0.67675775", "0.6669644", "0.6627278", "0.66062284", "0.6520373", "0.6496843", "0.6449265", "0.64232475", "0.6415154", "0.63968897", "0.63818896", "0.637293", "0.63629764", "0.63433206", "0.6342307", "0.63421863", "0.62763625", "0.6270...
0.6713065
4
remove loadig mask from modal
function unmaskModal() { var $maskTarget = $(".modal-body"); $maskTarget.closest('.modal-dialog').find('[type="submit"]').removeAttr('disabled'); $(".modal-mask").remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeModal() {\n $(\".mask\").removeClass(\"active-modal\");\n}", "_remove() {\n this.backdrop.remove();\n this.modal.remove();\n Utils.removeClass(document.body, 'modal-mode');\n }", "function removeModal() {\n modal.innerHTML = \"\";\n removeClass(modal...
[ "0.71414036", "0.6967064", "0.6928043", "0.6900116", "0.6839112", "0.682834", "0.67987084", "0.67844504", "0.67694855", "0.6729312", "0.66909117", "0.6657209", "0.6653627", "0.6600607", "0.65530455", "0.6522409", "0.64977694", "0.6493927", "0.6480022", "0.64788026", "0.646669...
0.77769476
0
colse ajax modal and show success check mark
function closeAjaxModal(success) { if (success) { toastmessage(showSuccessToast) $(".modal-mask").html("<div class='circle-done'><i class='fa fa-check'></i></div>"); setTimeout(function () { $(".modal-mask").find('.circle-done').addClass('ok'); }, 30); } setTimeout(function () { $(".modal-mask").remove(); // toggleAjaxSlickModal(); settings.onModalClose(); }, 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajax_success() {\n console.log('Update Status worked');\n // TODO: \n // improve loading time of ajax request because modal is loading to slow\n $(\".modal\").addClass(\"is-active\"); \n}", "function successModal(message1,message2) {\n $(\"#modalsave\").hide();\n $(\"#sure .mo...
[ "0.7221789", "0.7013255", "0.68668854", "0.68075836", "0.67512566", "0.6748442", "0.6672075", "0.66658974", "0.6620404", "0.6616794", "0.6615691", "0.66063505", "0.6568175", "0.6550736", "0.65324014", "0.649554", "0.64890504", "0.6488747", "0.6460605", "0.64553523", "0.639360...
0.6455422
19
abort ajax request on modal close. console.log(dialogFx);
function CloseFxDialog(e) { $('#app-ajax-modal .modal-dynamic-content').html(''); // console.log('modal close events',e); // $(this).find(".modal-dialog").removeClass("modal-lg").addClass("mini-modal"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abort() {\n if ( this.xhr ) {\n this.xhr.abort();\n }\n }", "abort () {\n this.request.abort();\n }", "abort() {\n if (this.xhr) {\n this.xhr.abort();\n }\n }", "close() {\n window.http.xmlHtpRequest.abort();\n }", "cancel() {\n $('...
[ "0.69036615", "0.6819364", "0.6784362", "0.67662436", "0.671851", "0.6714289", "0.6650974", "0.66455555", "0.6547914", "0.64068896", "0.6378657", "0.6334685", "0.6310845", "0.6302307", "0.6302307", "0.62889886", "0.62829703", "0.6265919", "0.6260881", "0.6260623", "0.62488747...
0.70408756
0
function to be called when above animation needed
function fadeinup() { var time = 0; $(".radio_select" ).addClass("hide").each(function( index ) { setTimeout(function(){ openAnimate(".radio_select:eq( "+index+" )",'fadeInUp'); },time+=200); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animcompleted() {\n\t\t\t\t\t\t}", "function initAnimation() {\n}", "onAnimationEnd() {\n\n }", "function checkAnimation() {\n chartBarCheckAnimation();\n portfolioCheckAnimation();\n //contactBackgrounCheck();\n }", "if (m_bInitialAnim) { return; }", "updateAnimation() {\n ...
[ "0.6965173", "0.6893152", "0.6892171", "0.6869036", "0.68424535", "0.6834406", "0.68333143", "0.68333143", "0.6763035", "0.65878785", "0.65238184", "0.64966154", "0.64811736", "0.6477121", "0.646685", "0.6462727", "0.64462996", "0.63869977", "0.6381941", "0.6381366", "0.63803...
0.0
-1
IN: Min (int) y Max (int) OUT: Valor aleatorio (int)
function getRndInteger(min, max) { return Math.floor(Math.random() * (max - min + 1) ) + min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "limits() {\n var keys = Object.keys(this.data);\n var min = parseInt(this.data[keys[0]]); // ignoring case of empty list for conciseness\n var max = parseInt(this.data[keys[0]]);\n var i;\n for (i = 1; i < keys.length; i++) {\n var value = parseInt(this.data[keys[i]]);...
[ "0.67397434", "0.658559", "0.64779675", "0.63878226", "0.63664895", "0.63454515", "0.6339881", "0.63163865", "0.6304568", "0.62992996", "0.6296427", "0.62957144", "0.62934166", "0.6291427", "0.62857276", "0.61903274", "0.61647516", "0.6160126", "0.61532164", "0.61035377", "0....
0.0
-1
Clase cadena que contiene un numero aleatorio de simbolos
function Cadena(){ this.Caracteres = []; this.longitud = getRndInteger(5,35); this.velocidad = getRndInteger(2,10); this.rellenarCadena = function(x, y){ var first = (Math.random()>0.75) ? true : false; for(var i=0;i<this.longitud;i++){ var Caracter = new Simbolo(x,y,this.velocidad,first); Caracter.SimboloAleatorio(); this.Caracteres.push(Caracter); y -= tamLetra; first = false; } } this.Representar = function(){ this.Caracteres.forEach(function(caracter){ ctx.shadowColor = "#FFFFFF"; if (caracter.primero == true){ ctx.fillStyle = "#c8ffc8"; ctx.shadowBlur = 5; } else { ctx.fillStyle = "#32CD32"; ctx.shadowBlur = 0; } ctx.fillText(caracter.valor,caracter.x,caracter.y); caracter.Mover(); }); } this.Mover = function(){ this.y = (this.y>=alto) ? 0 : this.y += this.vel; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generarAleatorio(valor)\r\n{\r\n return numIdentificacion = Math.floor(Math.random() * ((valor+1) - 0) + 0); \r\n}", "function soma(nnumero){\r\n let cont = 0;\r\n for (let num of numeros){\r\n cont = cont +num\r\n }\r\n return soma \r\n }", "function sequencia1(num)...
[ "0.64673537", "0.63441026", "0.63142586", "0.62975824", "0.6282687", "0.62693846", "0.6196332", "0.6183926", "0.6175108", "0.61521196", "0.61468077", "0.60744035", "0.60362285", "0.60308456", "0.6003629", "0.60004634", "0.59629554", "0.58911943", "0.58869135", "0.58610123", "...
0.0
-1
Funcion encargada de animar esperando al refresco de la pantalla
function Animar(){ FPS = (FPS > 59) ? 0 : FPS += 1; ctx.clearRect(0,0,ancho,alto); cadenas.forEach(function(cad){ cad.Representar(); }); requestAnimFrame(Animar); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animacaoJogo(){\n __life.step();\n __life.desenhaGrid(window.ctx);\n window.idTimeoutJogo = setTimeout(animacaoJogo, 10);\n }", "function animacion(algo){\n\tvar contenido = document.getElementById(\"esfera\");\n\t$(\"#esfera\").addClass('esfera');\n\t$(\"#direccion\").addClass...
[ "0.6773356", "0.67409164", "0.66439044", "0.65856576", "0.65445185", "0.6470602", "0.64201653", "0.63934785", "0.63816625", "0.63495076", "0.6347462", "0.634076", "0.629086", "0.6290574", "0.62838614", "0.62724656", "0.6258089", "0.62214375", "0.62159", "0.62074697", "0.62071...
0.59244645
60
Import an existing client VPN endpoint.
static fromEndpointAttributes(scope, id, attrs) { class Import extends core_1.Resource { constructor() { super(...arguments); this.endpointId = attrs.endpointId; this.connections = new connections_1.Connections({ securityGroups: attrs.securityGroups }); this.targetNetworksAssociated = new core_1.ConcreteDependable(); } } return new Import(scope, id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function connect() {\n\tlet endpoint = document.getElementById('endpoint').value;\n\tif (!window.substrate || global.endpoint != endpoint) {\n\t\tconst provider = new api.WsProvider(endpoint);\n\t\tlog.innerHTML = 'Connecting to Endpoint...';\n\t\twindow.substrate = await api.ApiPromise.create({ provider });...
[ "0.48225453", "0.4765728", "0.47521713", "0.4705232", "0.46199226", "0.4579531", "0.4577182", "0.44900233", "0.44326177", "0.44282335", "0.44114634", "0.44019303", "0.43894327", "0.4327132", "0.427638", "0.42644092", "0.42630386", "0.42555544", "0.42428967", "0.42097768", "0....
0.46052915
5
Adds an authorization rule to this endpoint.
addAuthorizationRule(id, props) { return new client_vpn_authorization_rule_1.ClientVpnAuthorizationRule(this, id, { ...props, clientVpnEndoint: this, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function internal_initialiseAclRule(access) {\n let newRule = createThing();\n newRule = setIri(newRule, rdf.type, acl.Authorization);\n if (access.read) {\n newRule = addIri(newRule, acl.mode, internal_accessModeIriStrings.read);\n }\n if (access.append && !access.write) {\n newRule = addIri(newRule, a...
[ "0.53518724", "0.530408", "0.5295703", "0.5171888", "0.4973788", "0.4855524", "0.46431932", "0.45918423", "0.4578135", "0.45691445", "0.45688903", "0.45602107", "0.44586676", "0.44305253", "0.4387325", "0.4367352", "0.4365117", "0.43496346", "0.4349448", "0.433964", "0.433628...
0.6404505
0
Adds a route to this endpoint.
addRoute(id, props) { return new client_vpn_route_1.ClientVpnRoute(this, id, { ...props, clientVpnEndoint: this, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addRoute(route, fn) {\n this.routes.push({\n params: this._getParams(route),\n pattern: this._getPattern(route),\n route,\n fn\n })\n }", "addRoute(method, route, ...handlers) {\n this.routes.add({\n method,\n route,\n handlers\n });\n }", "addRoute...
[ "0.7348392", "0.73283225", "0.7174983", "0.70851684", "0.6981869", "0.64044505", "0.6316121", "0.6303698", "0.62048244", "0.61579347", "0.60936403", "0.6076617", "0.60673183", "0.5975605", "0.5882683", "0.5813818", "0.57438993", "0.5739003", "0.5731479", "0.56811005", "0.5663...
0.590955
14
Code was taken from
function link(scope, element, attrs, ngModel){ ngModel.$parsers.push(function(value) { return '' + value; }); ngModel.$formatters.push(function(value) { return parseFloat(value, 10); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "protected internal function m252() {}", "private public function m246() {}", "static private internal function m121() {}", "transient protected internal function m189() {}", "static final private internal function m106() {}", "transient private protected internal ...
[ "0.6637666", "0.6245441", "0.6194101", "0.5991553", "0.5879009", "0.57580876", "0.57424504", "0.5728488", "0.5648674", "0.5533786", "0.53940654", "0.53386253", "0.52824235", "0.5281371", "0.5260329", "0.52568775", "0.5213232", "0.5184796", "0.5178606", "0.5166621", "0.5117431...
0.0
-1
function hosinting > se puede llamar a la funcion desde cualquier lugar
function saludar() { console.log("HOLA MUNDO"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onloevha() {\n}", "function hoge() {}", "function Ha(){}", "function wa(){}", "function lalalala() {\n\n}", "function Xh(){}", "function hc(){}", "function fuctionPanier(){\n\n}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function iniciar() {\n ...
[ "0.68201166", "0.6808166", "0.67719495", "0.6608295", "0.64503205", "0.6399824", "0.63191307", "0.62855446", "0.61775273", "0.61775273", "0.61775273", "0.612758", "0.60673636", "0.60551196", "0.6034784", "0.6012645", "0.60060745", "0.59636414", "0.596215", "0.59451497", "0.59...
0.5649616
56
needed for every function in this file
function check_page_status() { return page_ready; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _____SHARED_functions_____(){}", "function Utils() {}", "function Utils() {}", "function Utils(){}", "private public function m246() {}", "function __func(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function FunctionUtils() {}", "private interna...
[ "0.7540967", "0.6896817", "0.6896817", "0.6857529", "0.6823426", "0.6699541", "0.66894835", "0.66894835", "0.66894835", "0.6665797", "0.66367316", "0.66357386", "0.6635374", "0.6614718", "0.6574803", "0.6531108", "0.6523745", "0.6486448", "0.6481003", "0.6474403", "0.6447882"...
0.0
-1
Dynamically create questions for form
function createForm(){ $("#startQuest").append("<div class=\"row\"><div class=\"col-md-6\"><h2>About You</h2</div></div>"); //About you header //Create name and image inputs textboxBank.forEach(function(value, index){ var rowInput = $('<div>').addClass("row"); //Create Row var colInput = $('<div>').addClass("col-md-8"); //Create Column var groupInput = $('<div>').addClass("form-group questionGroup");//Create input div var inputBox = $('<input>', {"type":"text", "class":"form-control", "placeholder":value, "aria-describedby":"basic-addon1", "id": "box"+index}); //Create textbox $("#startQuest").append(rowInput.append(colInput.append(groupInput.append(inputBox)))); }); //For every question in questionBank, create an element tag with the question #, question, and answer button questionBank.forEach(function(value, index){ var row = $('<div>').addClass("row"); //Create Row var col = $('<div>').addClass("col-md-6"); //Create Column var group = $('<div>').addClass("input-group-btn questionGroup"); //Create button div (container) var button = $('<button>', {"class":"btn btn-default dropdown-toggle", "data-toggle": "dropdown", "aria-haspopup": "true",// Create button "aria-expanded": "false"}).html("Choose an Option "); var caret = $('<span>').addClass("caret"); //Create caret for button button.append(caret); //Add caret to button var list = $('<ul>').addClass("dropdown-menu").attr('id', "answer"+index); //Create dropdown menu answerBank.forEach(function(value1, index){ var item = $('<li>').append("<a href=\"#\">"+value1+"</a>"); list.append(item); }); row.append(col.append(group.append(button, list))); //Add everything (div's, button, list) above together var questNum = $('<h3>').html("Question "+(index+1)+":"); //Question # div var quest = $('<h4>').html(value); //Question div $("#startQuest").append(questNum, quest, row); //Add question #, question, and dropdown to page }); //Add submit button var row = $('<div>').addClass("row"); //Create Row var col = $('<div>').addClass("col-md-12"); //Create Column var para = $('<p>').addClass("submitButton"); var button = $('<button>', {"class":"btn btn-default center", "id":"submit"}).html("Submit Survey!"); //Create button $("#startQuest").append(row.append(col.append(para.append(button)))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildQuestions() {\n var questionHTML = \"\";\n for (var i = 0; i < game.questions.length; i++) {\n questionHTML = questionHTML + formTemplate(game.questions[i]);\n }\n $(\"#questions\").append(questionHTML);\n }", "function createQuestion(questions) {\n for (var i = 0; i < ...
[ "0.75608057", "0.7535552", "0.7459917", "0.7376936", "0.73558605", "0.732428", "0.73031706", "0.72831917", "0.72679275", "0.7236456", "0.7175217", "0.71306336", "0.71182334", "0.7112259", "0.71099806", "0.7098095", "0.70945364", "0.70871824", "0.70802903", "0.70771414", "0.70...
0.0
-1
function starts here with Element, url and display, these are passed in by other piece of code to allow for reuse of code
function fetchOffer(element, url, method) { //fetch the URL, then return the response as text, then log the data and display the element and data and if theres an error comes up then display the error fetch(url) .then ( function(response) { return response.text(); } ) .then ( function(data) { method(element, data); } ) .catch ( function(err) { document.getElementById(element).innerHTML = ("Something went wrong.", err); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPage(page,el){if(page===undefined){handleComing();return}fetch(page).then(function(res){return res.text()}).then(function(data){return displayFetch(el,data)});// give clicked element and the data from the server to display.\n}// if it does give the data to the function below for display.", "function ...
[ "0.6249263", "0.60308814", "0.5956144", "0.5953142", "0.59246266", "0.5875343", "0.58489054", "0.582305", "0.57936525", "0.5746954", "0.5739765", "0.57296485", "0.57270056", "0.57013005", "0.5690718", "0.56743723", "0.56682044", "0.5653042", "0.5653042", "0.5652667", "0.56065...
0.0
-1
constructor arguments: cl:: object of type [CL11](cl11.html) handle:: OpenCL handle
function CLWrapper(cl, handle, releaseFunction) { assert(cl instanceof CL11, "Argument 'cl' is not a CL11 instance."); assert(ref.getType(handle) === ref.types.void, "Argument 'handle' is not a pointer."); assert(!ref.isNull(handle), "Handle is null."); Disposable.call(this, releaseFunction); // ## object of type [CL11](cl11.html) this.cl = cl; // ## the OpenCL object handle this.handle = handle; this._cache = {}; this._infoFunction = this.cl.imports[this._classInfoFunction]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(options) {\n super();\n this._kernel = new KernelConnector(options);\n this._context = new ContextConnector(options);\n }", "function gen_op_ldl_kernel()\n{\n gen_opc_ptr.push({func:op_ldl_kernel});\n}", "function createLContext(lView,nodeIndex,_native2){return{lView:lVie...
[ "0.5168888", "0.51356775", "0.50367385", "0.49625137", "0.4949822", "0.4907119", "0.48962805", "0.48678347", "0.48567903", "0.4853583", "0.48302686", "0.48228937", "0.48228937", "0.48228937", "0.48228937", "0.48228937", "0.48228937", "0.481383", "0.480489", "0.4803235", "0.47...
0.81737417
0
On inital load, fetch data
componentWillMount() { const {fetchCatFactsAndPics, catFactsAndPicsProps} = this.props; fetchCatFactsAndPics(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n fetchData();\n}", "initialFetch() {\n this.fetchData({type: \"INITIAL_TABLE_DATA_FETCH\"})\n }", "fetchData() {\n this.initLoading();\n let qs = this.setAndGetQuerySetFromSandBox(this.view, this.qs_url);\n this.data.instance = qs.cache...
[ "0.8595201", "0.76764184", "0.75965047", "0.75965047", "0.75288916", "0.74673873", "0.7390784", "0.73400784", "0.7329104", "0.726089", "0.72332233", "0.72240025", "0.7186323", "0.7104218", "0.70820445", "0.7066101", "0.6984008", "0.69422996", "0.68664616", "0.68631786", "0.68...
0.0
-1
this is simply a shortcut for the eyes and fingers
function $(id) { return document.getElementById(id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function servostart(e) {\n\tx_finger_bak = e.changedTouches[0].screenX\n\ty_finger_bak = e.changedTouches[0].screenY\n\treturn false\n}", "function drawFace() {\n // eyes\n leftEye = draw(\"O\", 300, 140);\n rightEye = draw(\"O\", 400, 140);\n blink(leftEye, \"^\", 200);\n blink(rightEye, \"^\", 200);\n\n ...
[ "0.6300379", "0.6289942", "0.6143357", "0.6110359", "0.60592806", "0.60223633", "0.59375006", "0.5894093", "0.5888623", "0.58865297", "0.58089197", "0.57427055", "0.5659047", "0.56529963", "0.56498903", "0.5630506", "0.5618757", "0.56185204", "0.5575314", "0.55681705", "0.555...
0.0
-1
Unify messaging method And eliminate callbacks (a message is replied with another message instead)
function messaging( message, callback ) { chrome.runtime.sendMessage( message, callback ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sendMessage (_connection, _message) { methodNotDefined() }", "function onMessage(event) {\n const { id, ...data } = event.data;\n const onSuccess = callbacks[id];\n delete callbacks[id];\n onSuccess(data);\n }", "onMessagesRemoved() {}", "deleteMessageCallBack(message){\n ...
[ "0.6653445", "0.661786", "0.65832067", "0.6271684", "0.62485707", "0.616913", "0.61296", "0.6111585", "0.60993516", "0.6089836", "0.607648", "0.60564375", "0.60214627", "0.6006649", "0.59896284", "0.5984158", "0.5975027", "0.59736884", "0.5957051", "0.59212697", "0.5899306", ...
0.0
-1
GUID get globally unique id taken from stack overflow overkill but what the heck
function guid() { function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function guid() {return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();}", "function _guid() {\n function S4() {\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\n }\n\n return (S4() + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" ...
[ "0.84004", "0.81764644", "0.8162497", "0.8102747", "0.8102747", "0.8102747", "0.8102747", "0.8099086", "0.80888516", "0.80447716", "0.80329", "0.80313355", "0.8023454", "0.799118", "0.7988847", "0.7988721", "0.7988093", "0.7987416", "0.79869384", "0.7984767", "0.7982642", "...
0.7879503
38
convenience for creating DOM elements
function $t (tag) { tag = tag || 'div'; return $('<'+tag+'/>'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createElements() {\n var nodeNames = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n nodeNames[_i] = arguments[_i];\n }\n return nodeNames.map(function (name) { return document.createElement(name); });\n }", "function create(element) { return document.cr...
[ "0.7755558", "0.7419851", "0.7339416", "0.73245627", "0.72975487", "0.72562987", "0.7250714", "0.7225091", "0.72154486", "0.7203097", "0.7178776", "0.7178776", "0.7178776", "0.7178776", "0.7178776", "0.7178776", "0.7178776", "0.71544677", "0.714577", "0.714333", "0.7142153", ...
0.0
-1
The dummy class constructor
function Class() { // All construction is actually done in the init method if ( !initializing && this.init ) this.init.apply(this, arguments); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructur() {}", "function DummyClass() {\r\n // All construction is actually done in the construct method\r\n if ( !init && this.construct )\r\n this.construct.apply(this, arguments);\r\n }", "constructor(){}", "constructor(){}", "constructor(){}", "construc...
[ "0.83117235", "0.8150335", "0.8125716", "0.8125716", "0.8125716", "0.8125716", "0.8125716", "0.8125716", "0.8125716", "0.81216276", "0.81216276", "0.81216276", "0.80153376", "0.80066764", "0.7822476", "0.7822476", "0.7822476", "0.7822476", "0.7822476", "0.7822476", "0.7822476...
0.0
-1
Closes the milestone by number
closeMilestone(number) { return this.patch(`milestones/${number}`, { state: 'closed' }).then( ({ code, body }) => { if (code !== 200) return Promise.reject(body); else return body; } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function close(n){\n\t\treturn barsAgo(CLOSE,n);\n\t}", "_close() {\n set(this, 'isOpen', false);\n set(this, 'isToStep', false);\n\n let action = get(this, 'attrs.closeAction');\n let vals = get(this, '_dates');\n let isRange = get(this, 'range');\n\n if (action) {\n action(isRange ? vals...
[ "0.61144936", "0.5881121", "0.5792084", "0.5696418", "0.567205", "0.5663822", "0.55725956", "0.5498331", "0.53649366", "0.53035235", "0.5291249", "0.5291249", "0.5208043", "0.52034384", "0.520063", "0.51972425", "0.5183096", "0.51806325", "0.5175055", "0.51574785", "0.5107038...
0.81170195
0
Add "name id : lambda node" to G.functions
function setUp(program) { const ids = []; const push_vals = []; for (const identId of Object.keys(program.identifiers)) { const identifier = getIdentifier(program, identId); if (identifier.scope !== null || !identifier.value) { continue; } ids.push(identifier.id); push_vals.push(extractFragment(program, identifier.value)); } pushEnvironment(ids, push_vals); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static _gX(fn, lambda){\n return lambda+\"*(\"+fn+\")+x\";\n }", "function _exec_funcdef(ast, context, debug) {\n var FRecord = new ObjectClass.SFunction();\n FRecord.closure_active_record = context;\n var funcName = \"\";\n for (var item in ast.sons) {\n if (ast.sons[i...
[ "0.66948587", "0.61025375", "0.59935665", "0.59694844", "0.58709174", "0.58472437", "0.58472437", "0.58472437", "0.58358914", "0.58179855", "0.57676876", "0.5713963", "0.5679388", "0.5679388", "0.5672613", "0.5656917", "0.5623293", "0.56213665", "0.5603906", "0.56018776", "0....
0.0
-1
Evaluate expression precursor (takes care of let bindings)
function evaluateStep(node, callback) { if (G.continue) { const boundIds = getIdentifiersScopedToNode(G.program, node.id).filter(id => id.value != null); if (boundIds.length > 0) { const binding_names = []; const boundExprs = []; for (var i = 0; i < boundIds.length; i++) { binding_names.push(boundIds[i].id); boundExprs.push(boundIds[i].value); } const bound_expressions = boundExprs.map(i => getNode(G.program, i)); return call(eval_star, bound_expressions, 0, function (binding_vals) { pushEnvironment(binding_names, binding_vals); return call(evaluateBody, node, function (b) { popEnvironment(binding_names); return call(callback, b); }); }); } else { return call(evaluateBody, node, callback); } } else { G.fail(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "evaluate(expr) {\n const result = compile(this.get_('eval.env'), expr).flatMap((f) => f());\n if (fail.match(result)) throw result.get();\n else return result.get();\n }", "operator(ctx, expr) {\n const ast = expr.ast, fn = ctx.functions;\n return _ => interpret(ast, fn, _);\n }", "function pa...
[ "0.61201286", "0.6109549", "0.58949345", "0.5878548", "0.5868856", "0.5862156", "0.5853399", "0.5846044", "0.5846044", "0.5824166", "0.57821757", "0.5733217", "0.57074213", "0.56627035", "0.56627035", "0.5581029", "0.55312055", "0.5501942", "0.5488177", "0.5457945", "0.543778...
0.0
-1
For evaluating a list of arguments
function eval_star(exps, pos, callback) { if (pos === exps.length) { return call(callback, []); } else { return call(evaluateStep, exps[pos], function (x) { return call(eval_star, exps, pos+=1, function (y) { return call(callback, [x].concat(y)); }); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sum(list){\n var l = arguments.length;\n var sum = 0;\n for (var i = 0; i < l; i++){\n sum = sum + arguments[i];\n }\n console.log(\"Exploring arguments in JavaScript------\");\n console.log(\"Sum: \", sum);\n}", "function parseArgumentList() {\n var token, expr, args = [];\n\n wh...
[ "0.633214", "0.6068839", "0.6052271", "0.5942134", "0.5892068", "0.5872663", "0.5854768", "0.5847211", "0.5841843", "0.58242476", "0.58242476", "0.58151037", "0.58042556", "0.5801591", "0.5801591", "0.5801591", "0.57891035", "0.57891035", "0.57837", "0.5780412", "0.57629204",...
0.0
-1
For evaluating case statement's cases
function evaluate_cases(exps, callback, elseExp, pos) { if (pos === exps.length) { return call(evaluateStep, getNode(G.program, elseExp.expression), callback); } else { const cs = getNode(G.program, exps[pos]); return call(evaluateStep, getNode(G.program, cs.condition), function (condition) { const cond = rootNode(condition).constructor; const t = getBasisEntity(G.program, basis.constructors.True).id; if (cond === t) return call(evaluateStep, getNode(G.program, cs.expression), callback); else return call(evaluate_cases, exps, callback, elseExp, pos+=1); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function evaluateCaseClause({ node, evaluate, environment, statementTraversalStack }, switchExpression) {\n const expressionResult = evaluate.expression(node.expression, environment, statementTraversalStack);\n // Stop immediately if the expression doesn't match the switch expression\n if (expressionResul...
[ "0.7166076", "0.68776727", "0.6639018", "0.6639018", "0.66252387", "0.66252387", "0.66252387", "0.66252387", "0.6625037", "0.6598244", "0.65829885", "0.6570482", "0.6569818", "0.6552599", "0.6552599", "0.6552599", "0.6552599", "0.65211713", "0.6513756", "0.651139", "0.650248"...
0.65555906
13
Evaluation continue and speed methods
function stopEval() { G.continue = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculate() {\r\n\teval();\r\n\tstopAll();\r\n}", "step()\n {\n if (this.halted)\n {\n return false;\n }\n\n let instruction = this._read(this.pointer);\n let startingPoint = this.pointer;\n\n let opCode = this._opCode(instruction);\n if (op...
[ "0.64004916", "0.5890402", "0.5782383", "0.5757836", "0.57486874", "0.5722435", "0.5712351", "0.5686748", "0.56770235", "0.56695014", "0.56613064", "0.5655313", "0.5645503", "0.5611494", "0.5603561", "0.55956364", "0.5540564", "0.5498653", "0.54841673", "0.54639125", "0.54459...
0.578478
2
Hack for replacing response body vars with dynamic URI params
function parseUriVars(uriVars, reqUrl, respBody) { var k = null; for (var k in uriVars) { if (uriVars.hasOwnProperty(k)) { var replacementValue = reqUrl.split('/').filter(el => {return !!el})[k]; respBody = respBody.replace(URL_VAR_REGEX, replacementValue); } } return respBody; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rewriteURIForGET(chosenURI, body) {\n // Implement the standard HTTP GET serialization, plus 'extensions'. Note\n // the extra level of JSON serialization!\n var queryParams = [];\n var addQueryParam = function (key, value) {\n queryParams.push(key + \"=\" + encodeURIComponent(value));\...
[ "0.5775589", "0.5758471", "0.5758471", "0.57027376", "0.56722003", "0.56715554", "0.56715554", "0.5544978", "0.55126494", "0.5461489", "0.53812575", "0.53673273", "0.53009576", "0.53003883", "0.527321", "0.52616066", "0.5228786", "0.5202805", "0.5154325", "0.5144916", "0.5087...
0.67443967
0
Allows a user to start an application. Takes tokens from user and sets apply stage end time.
apply(listing, tokens, data = '', opts) { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(), account = this.requireAccount(opts); return yield deployed.methods.apply(listing, tokens, data).send({ from: account }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startApp() {\n\tinquirer\n\t\t.prompt([\n\t\t\t{\n\t\t\t\tname: 'startApp',\n\t\t\t\ttype: 'confirm',\n\t\t\t\tmessage: 'Would you like to assemble a team?',\n\t\t\t},\n\t\t])\n\t\t.then((res, err) => {\n\t\t\tif (err) console.error(err);\n\t\t\tif (res.startApp) {\n\t\t\t\taddManager();\n\t\t\t} else {\n...
[ "0.5705647", "0.5705638", "0.56621903", "0.56415176", "0.5572144", "0.53576237", "0.533769", "0.5332166", "0.52593726", "0.52576435", "0.5240772", "0.5219025", "0.51860857", "0.5110994", "0.51070863", "0.5083727", "0.50498295", "0.5037655", "0.5034069", "0.5033402", "0.502464...
0.0
-1
Returns a bool that indicates if `apply` was called for a given listing hash
appWasMade(listing) { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(); return deployed.methods.appWasMade(listing).call(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isApply(m) {\n return isFunctor(m) && isFunction(m.ap)\n}", "function isBindCallApply(func, environment) {\n switch (func) {\n case Function.prototype.bind:\n case Function.prototype.call:\n case Function.prototype.apply:\n return true;\n }\n if (environment != ...
[ "0.5276118", "0.52356726", "0.52291125", "0.5064019", "0.50615746", "0.4994776", "0.49335325", "0.49187532", "0.4884205", "0.48785177", "0.48162445", "0.48162445", "0.48073068", "0.4801175", "0.47908694", "0.47611004", "0.4759886", "0.47545362", "0.47419408", "0.47417414", "0...
0.0
-1
Starts a poll for a listingHash which is either in the apply stage or already in the whitelist. Tokens are taken from the challenger and the applicant's deposits are locked.
challenge(listing, data = '', opts) { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(), account = this.requireAccount(opts); return yield deployed.methods.challenge(listing, data).send({ from: account }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "polling() {\n const hourInSec = PASConfig.pollingTimeDevelop || 3200; // Use develop value if available for this RI\n const hourInMS = hourInSec * 1000;\n const fiveMin = hourInMS / 12;\n\n // Poll every 5 minutes in the first half hour\n let numPolls = 1;\n let context = this;\n let polling =...
[ "0.5411924", "0.52926207", "0.5135856", "0.5104827", "0.5075564", "0.5017226", "0.49952075", "0.49858502", "0.4978382", "0.4871183", "0.48711342", "0.4826024", "0.47945887", "0.47945887", "0.47902086", "0.47778672", "0.47672728", "0.47649515", "0.4747191", "0.47253856", "0.47...
0.0
-1
Return a challenge corresponding to the given challegeID.
challenges(challengeID) { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(); return yield deployed.methods.challenges(challengeID).call(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getChallenge(challengeId) {\n return wordChallenges.findOne({ _id: challengeId });\n }", "getChallengeID() {\r\n let matches = this._challengeURLMatches();\r\n return matches[1];\r\n }", "function _getChallengeById(req, res, next) {\n var json = {};\n var query = { \"_id\": new Object...
[ "0.6971245", "0.62784463", "0.58492416", "0.55079806", "0.54730904", "0.5441973", "0.5395898", "0.51554036", "0.5043459", "0.5019115", "0.4908836", "0.48976633", "0.48744273", "0.4806224", "0.4806224", "0.48039496", "0.48034048", "0.4802444", "0.4792775", "0.47824928", "0.475...
0.6414845
1
Pepare the deploy options, passing them along with the instantiated web3 and optional contract options to the super class' _deploy method.
deploy(web3, params, opts) { const _super = name => super[name]; return __awaiter(this, void 0, void 0, function* () { const dp = { abi: Registry_json_1.default.abi, bytecode: Registry_json_1.default.bytecode, args: [ params.tokenAddress, params.votingAddress, params.parameterizerAddress, params.name ] }; return _super("deployContract").call(this, web3, dp, opts); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deploy(web3, params, opts) {\n const _super = name => super[name];\n return __awaiter(this, void 0, void 0, function* () {\n const dp = {\n abi: Parameterizer_json_1.default.abi,\n bytecode: Parameterizer_json_1.default.bytecode,\n args: [\n ...
[ "0.7261169", "0.6316964", "0.57954097", "0.55136895", "0.5453097", "0.5438545", "0.5392325", "0.53471273", "0.5239186", "0.5185985", "0.5051503", "0.5004959", "0.4959975", "0.49317", "0.49084374", "0.4884491", "0.4848416", "0.48382464", "0.48246276", "0.4811499", "0.47355208"...
0.6881086
1
Allows the owner of a listingHash to remove the listingHash from the whitelist Returns all tokens to the owner of the listingHash
exit(listing, opts) { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(), account = this.requireAccount(opts); return yield deployed.methods.exit(listing).send({ from: account }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearTokenList() {\n const tokenList = STATE.get('TokenList');\n if (tokenList) {\n Object.keys(tokenList).forEach(k => {\n const tokenObj = STATE.get('TokenList', k);\n Token.setBonus(tokenObj, 0);\n });\n }\n }", "removeFromWh...
[ "0.58116317", "0.56265426", "0.5623505", "0.54492575", "0.53926015", "0.5390373", "0.53650695", "0.53305995", "0.5243471", "0.52257824", "0.5115779", "0.5111097", "0.509937", "0.5066188", "0.50565386", "0.5055926", "0.50168896", "0.50134844", "0.50092185", "0.49956807", "0.49...
0.0
-1
Return a bool indicating if this listing has been whitelisted
isWhitelisted(listing) { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(); return yield deployed.methods.isWhitelisted(listing).call(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isBlacklisted() {\n\t var blacklist = this.opts.blacklist;\n\t return blacklist && blacklist.indexOf(this.node.type) > -1;\n\t}", "function isBlacklisted() {\n\t var blacklist = this.opts.blacklist;\n\t return blacklist && blacklist.indexOf(this.node.type) > -1;\n\t}", "function isBlacklisted() {\...
[ "0.6541155", "0.6541155", "0.6449632", "0.6285243", "0.5984127", "0.59645337", "0.591445", "0.59121346", "0.580228", "0.57853556", "0.5738085", "0.5717761", "0.56691015", "0.5668057", "0.5640495", "0.5622889", "0.559966", "0.55952406", "0.5587593", "0.5568334", "0.5550307", ...
0.6948313
0
Return a listing corresponding to the given listing hash.
listings(listing) { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(); return yield deployed.methods.listings(listing).call(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static async getListing(id) {\n let res = await this.request(`listings/${id}`);\n return res.listing;\n }", "listing_get(id) {\n return this._get(`listing/${id}`);\n }", "static async getListing(listing_id) {\n let res = await this.request(`api/listings/${listing_id}`);\n return res;\n ...
[ "0.5939349", "0.58070993", "0.5639183", "0.5626736", "0.5582744", "0.55319446", "0.547254", "0.54663557", "0.5300959", "0.52984", "0.526791", "0.52489066", "0.51860386", "0.51660913", "0.5164093", "0.5157202", "0.5100387", "0.5090333", "0.5074413", "0.5040025", "0.5034525", ...
0.45078295
85
Return the name passed to this contract instance at deploy time
name() { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(); return yield deployed.methods.name().call(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deploySingle(contractName){\n return `\n const A = artifacts.require(\"${contractName}\");\n module.exports = function(deployer) { deployer.deploy(A) };\n `;\n}", "function getAssetName(assetAddr){\n return tokenContract.methods.getContractName(assetAddr).call();\n }", "function getName() ...
[ "0.63645667", "0.60966045", "0.5953498", "0.59323144", "0.58770484", "0.57235014", "0.566225", "0.5619028", "0.56117105", "0.55981636", "0.5573826", "0.5566985", "0.55458844", "0.55158335", "0.5502829", "0.55023736", "0.54788876", "0.54555434", "0.54370517", "0.5435066", "0.5...
0.616771
1
Return the address of the parameterizer referenced by this contract instance
parameterizer() { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(); return yield deployed.methods.parameterizer().call(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get address () {\n return this.contractAddress\n }", "function nameAddr() {\n return wrap('name-addr', and(opt(displayName), angleAddr)());\n }", "function nameAddr() {\n return wrap('name-addr', and(opt(displayName), angleAddr)());\n }", "function nameAddr() {\n return wra...
[ "0.52728605", "0.5252432", "0.5252432", "0.5252432", "0.5252432", "0.515658", "0.5100179", "0.507445", "0.5065813", "0.5043498", "0.5039015", "0.50276905", "0.47889346", "0.47812968", "0.4757697", "0.47184244", "0.47033963", "0.47015712", "0.4657827", "0.46570027", "0.4640416...
0.42445526
76
Return the address of the token referenced by this contract instance
token() { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(); return yield deployed.methods.token().call(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTokenAddress(tokenName) {\n\t\n\tvar result = null;\n\n\tif (tokenName == \"TEST\") {\n\t\tresult = \"0x875664e580eea9d5313f056d0c2a43af431c660f\";\n\t} else if (tokenName == \"DAI\") {\n\t\tresult = \"0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359\";\n\t}\n\n\treturn result;\n}", "function getToken() {\...
[ "0.65727425", "0.64078283", "0.629507", "0.61594784", "0.6152112", "0.60370374", "0.6021377", "0.59762293", "0.5931954", "0.592103", "0.58387554", "0.58381087", "0.5817307", "0.5764241", "0.5761903", "0.5722279", "0.56745714", "0.5674456", "0.56385756", "0.56327605", "0.56102...
0.503679
79
Updates a listingHash's status from 'application' to 'listing' or resolves a challenge if one exists. Delegates to `whitelistApplication` or `resolveChallenge`
updateStatus(listing, opts) { return __awaiter(this, void 0, void 0, function* () { const account = this.requireAccount(opts), deployed = this.requireDeployed(); return yield deployed.methods.updateStatus(listing).send({ from: account }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "appWasMade(listing) {\n return __awaiter(this, void 0, void 0, function* () {\n const deployed = this.requireDeployed();\n return deployed.methods.appWasMade(listing).call();\n });\n }", "function handleUpdateListing(e) {\n //e.preventDefault();\n\n // get new data from m...
[ "0.5223855", "0.4951868", "0.48654446", "0.4864351", "0.4799458", "0.47674277", "0.46703455", "0.4588139", "0.45853782", "0.45470458", "0.45210463", "0.44564027", "0.44555843", "0.44072017", "0.4376598", "0.43688685", "0.43531272", "0.432941", "0.43260267", "0.43152893", "0.4...
0.62385035
0
Return the address of the plcrvoting referenced by this contract instance
voting() { return __awaiter(this, void 0, void 0, function* () { const deployed = this.requireDeployed(); return yield deployed.methods.voting().call(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getAddress() {\n let encodable = [\n me.record ? me.record.id : this.pubkey,\n bin(this.box.publicKey),\n PK.usedBanks\n ]\n return base58.encode(r(encodable))\n }", "get address () {\n return this.contractAddress\n }", "get address() {\n\t\treturn this.__address;\n\t}", "get...
[ "0.62185663", "0.61201245", "0.602159", "0.5961195", "0.5926115", "0.59094363", "0.5832323", "0.5807537", "0.57356143", "0.56750107", "0.5613339", "0.56107175", "0.5578925", "0.5457772", "0.5455659", "0.5455659", "0.54519016", "0.54519016", "0.54519016", "0.53830427", "0.5363...
0.0
-1
end: imprimir correu start: imprimir any
function any(){ today = new Date(); start = new Date(today.getFullYear(),00,01); document.write(today.getFullYear()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mostraNotas(){}", "onAny() {}", "function any() {\n }", "doneIf(start, end, ids) {\n return ids.length === 1;\n }", "function aclaracion(i) { //Saca un mensaje de aclaraci?n de la respuesta\n\tif ((pulsado!=0) & (acla[i]!=\"\")) {alert(acla[i]);}\n}", "function tes...
[ "0.59841377", "0.5569984", "0.5488535", "0.53245795", "0.5274336", "0.51943105", "0.51943105", "0.519286", "0.5180364", "0.516617", "0.51426905", "0.51320547", "0.513153", "0.5120919", "0.5098592", "0.50934374", "0.50877506", "0.5072636", "0.5018478", "0.50133914", "0.5005626...
0.0
-1
end: imprimir any start: mostrar i ocultar divs
function mostrarOcultar(id) { var elemento = document.getElementById(id); var enlace = document.getElementById('meta'); if(elemento.style.display == "" || elemento.style.display == "none") { elemento.style.display = "block"; enlace.innerHTML = 'Contenido de metadatos <button type="button" class="close" onClick="mostrarOcultar(\'content_metas\'); return false;"><i class="icon-btn-arrow-toggle2"></i></button>'; } else { elemento.style.display = "none"; enlace.innerHTML = 'Contenido de metadatos <button type="button" class="close" onClick="mostrarOcultar(\'content_metas\'); return false;"><i class="icon-btn-arrow-toggle"></i></button>'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mostrarDiv(idmuestra,idoculta){\n\tvar ident=\"#\"+idmuestra;\n\tvar identOculta=\"#\"+idoculta;\n\t$(identOculta).hide();\n\t$(ident).show();\r\n}", "function displayElements() {\n $(\"body\").append($(\"<button id='start'>Start</button>\"));\n $(\"#start\").click(function () {\n ...
[ "0.6120295", "0.5963741", "0.5862363", "0.5861383", "0.5830938", "0.5813858", "0.58057344", "0.5784806", "0.57847667", "0.57563806", "0.5690682", "0.5689795", "0.56868", "0.5672368", "0.5640133", "0.56222546", "0.5621443", "0.5618863", "0.5616946", "0.5613145", "0.56024504", ...
0.0
-1
end: mostrar i ocultar divs
function disabledChecbox(){ var element = document.getElementById('noticia'); var element2 = document.getElementById('seccions'); if(element.checked){ element2.style.display='none'; return false; }else{ element2.style.display='block'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mostrarDiv(idmuestra,idoculta){\n\tvar ident=\"#\"+idmuestra;\n\tvar identOculta=\"#\"+idoculta;\n\t$(identOculta).hide();\n\t$(ident).show();\r\n}", "function displayDOM(){\r\n\t\tvar str = '';\r\n\t\tcontainer.getChildren().each(function(item){\r\n\t\t\tstr += '<div style=\"' + item.style.cssText + '\...
[ "0.67785376", "0.65896064", "0.65088654", "0.6403261", "0.6289337", "0.62873626", "0.626295", "0.6211447", "0.62088764", "0.6185049", "0.6176599", "0.61536396", "0.6144058", "0.6119681", "0.6098986", "0.606385", "0.60301894", "0.6028177", "0.6028177", "0.60181767", "0.6016511...
0.0
-1
==================================================================================================================================================== VIEW INVENTORY FUNCTION ====================================================================================================================================================
function viewInventory() { var query = "SELECT item_id, product_name, department_name, price, stock_quantity FROM products"; connection.query(query, function (err, res) { var t = new Table(); t.push( ["ID", " Name", "Price", "In Stock"] ); for (var i = 0; i < res.length; i++) { t.push( [res[i].item_id, res[i].product_name, "$" + res[i].price.toFixed(2), res[i].stock_quantity] ); } console.log(" Current Inventory"); console.log("" + t); console.log(lineBreak); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function itemInventoryTable() { }", "function inventoryMenu() {\n $scope.menuTitle = createText(\"Inventory\", [20, 10]);\n\n var datas = CharServ.getAllDatas();\n\n var i = 30;\n _.forIn(datas.inventory, function(value) {\n if (value.quantity > 0) {\n createItem(value, i);\n i += ...
[ "0.69774467", "0.6840686", "0.6809285", "0.67614305", "0.6634676", "0.66144264", "0.65712404", "0.64476293", "0.6440312", "0.6438192", "0.6428924", "0.64040977", "0.6378214", "0.6331662", "0.63025576", "0.62754565", "0.6212317", "0.61818695", "0.61768633", "0.6151363", "0.614...
0.6215763
16
==================================================================================================================================================== PURCHSE QUESTIONS FUNCTION ====================================================================================================================================================
function purchaseQuestions() { inquirer .prompt([ { type: "input", name: "id", message: "Enter the ID of the product you would like to purchase." }, { type: "input", name: "amount", message: "How many units would you like?" } ]).then(function (answer) { productId = answer.id; quantity = answer.amount; itemPurchase(); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteQs() {\n return db.Question.remove({})\n}", "function deleteUsed (){\n\tif(Questions.length > 0) {\n\t\tQuestions.splice(Questions.indexOf(question),1);\n\t} else {\n\t\tdocument.getElementById('answerT').style.display=\"none\";\n\t\tdocument.getElementById('answerF').style.display=\"none\";\n\t\...
[ "0.6742662", "0.6623651", "0.64511627", "0.62269586", "0.61851627", "0.6184869", "0.61477876", "0.61279154", "0.61273134", "0.6112415", "0.6048065", "0.6027864", "0.59538245", "0.59505713", "0.59446764", "0.59431803", "0.59361166", "0.592414", "0.59151703", "0.5908261", "0.58...
0.0
-1
==================================================================================================================================================== ITEM PURCHASE FUNCTION ====================================================================================================================================================
function itemPurchase() { connection.query("SELECT * FROM products WHERE ?", { item_id: productId }, function (err, res) { console.log(lineBreak); if (res[0].stock_quantity < quantity) { console.log("Insufficient quantity. There are "+ res[0].stock_quantity +" "+ res[0].product_name + "(s) left in stock.") purchaseQuestions(); // setTimeout(purchaseQuestions, 500); } else { console.log(" -- Order Summary -- ") console.log("Item: " + res[0].product_name); console.log("Quantity: " + quantity); var totalPrice = res[0].price * quantity; console.log("Order Total: $" + totalPrice.toFixed(2)); console.log(lineBreak); calculateInventory(); } // console.log(" -- Order Summary -- ") // console.log("Item: " + res[0].product_name); // console.log("Quantity: " + quantity); // var totalPrice = res[0].price * quantity; // console.log("Order Total: $" + totalPrice.toFixed(2)); // console.log(lineBreak); // calculateInventory(); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {}", "function purchaseItem() {\n return\n}", "async purchaseItem(itemId) {\n const purchase_result = await this.__re...
[ "0.778736", "0.778736", "0.778736", "0.778736", "0.778736", "0.778736", "0.7162589", "0.646271", "0.6375092", "0.6323577", "0.6308525", "0.6232949", "0.61997014", "0.60794747", "0.60682166", "0.60376316", "0.60256445", "0.5989342", "0.59829056", "0.59819", "0.5978416", "0.5...
0.0
-1
==================================================================================================================================================== RECALCULATE INVENTORY FUNCTION ====================================================================================================================================================
function calculateInventory() { // var query = "UPDATE products SET stock_quantity = quantity WHERE item_id = productId"; var query = "UPDATE products SET stock_quantity = stock_quantity-" + quantity + " WHERE item_id = " + productId; connection.query(query, function (err, res) { }) setTimeout(viewInventory, 1500); setTimeout(purchaseQuestions, 2000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkout(Inventory) {\n let total = 0;\n this.items.forEach(i => {\n let [ sku, name, quantity, price ] = Inventory.get(i[0]);\n console.log(`${name} ${i[1]} x ${price} = ${i[1] * price}`);\n total += i[1] * price;\n\n // update Inventory state\n ...
[ "0.66921705", "0.63994807", "0.6345309", "0.6334346", "0.63101435", "0.6300602", "0.6288587", "0.62541956", "0.6223666", "0.6151304", "0.60939634", "0.6023022", "0.59956044", "0.5950191", "0.59009093", "0.58965343", "0.58905244", "0.5884783", "0.58498657", "0.58396703", "0.58...
0.57477957
30
Do not override these
async attack (action_) { _attack (action_); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "transient private protected internal function m182() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "transient final protected internal function m174() {}", "transient private internal function m185() {}", "private i...
[ "0.68481994", "0.6811481", "0.67693365", "0.66646963", "0.6609396", "0.6497686", "0.63607806", "0.6226011", "0.6152291", "0.6143716", "0.61403376", "0.60844713", "0.6052514", "0.6048533", "0.60242015", "0.6005584", "0.599231", "0.59667456", "0.5966392", "0.5966392", "0.590876...
0.0
-1
Reset the mook model's resources for use
startTurn () { this.resetResources (); this._startTurn (); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() {\n BaseAPI.reset.call(_self);\n\n // Data Model\n _self.cmi = new CMI(_self);\n _self.adl = new ADL(_self);\n }", "function reset() {\n BaseAPI.reset.call(_self);\n\n // Data Model\n _self.cmi = new CMI(_self);\n }", "resetResources()\n {\n t...
[ "0.74161077", "0.7365143", "0.7055081", "0.70172304", "0.6884132", "0.68580866", "0.67824113", "0.6743249", "0.6684327", "0.6573121", "0.6547111", "0.65466857", "0.65466857", "0.6514078", "0.65129024", "0.6496836", "0.6470842", "0.6457946", "0.6452422", "0.643962", "0.6421307...
0.0
-1
Can the token do something to increase its movement range?
get canZoom () { return this.zoomsRemaining > 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n this.vel.add(this.acc);\n this.pos.add(this.vel);\n this.lifespan -= 2;\n\n this.vel.limit(5);\n }", "move() {\n this.x = this.x - 7\n }", "move(){\n if(this.counter <= 80){\n this.height = (this.counter*this.mworld.sqsize)/80;\n this.counter += ...
[ "0.6102732", "0.5807488", "0.57916284", "0.5774277", "0.57652086", "0.57527107", "0.5745585", "0.57452047", "0.57203805", "0.5718107", "0.5667535", "0.5655507", "0.56264305", "0.562299", "0.5622085", "0.5621657", "0.5596414", "0.55859965", "0.55736107", "0.55712384", "0.55573...
0.0
-1
todo: Advanced weapon selection
get meleWeapon () { return this.hasMele ? this.meleWeapons[0] : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function equipWeapon(selection){\n\tplayer.weapon = armory[wList[selection]].weapon;\n}", "function selectItem(num){\n if (inventstage.split(\"_\")[0] !== \"toolbelt\") {\n if (num == 0) { selected = slot1.textContent.split(\":\")[0] }\n if (num == 1) { selected = slot2.textContent.split(\":\")[...
[ "0.77129143", "0.6950002", "0.67625266", "0.6728606", "0.6725735", "0.6708103", "0.6697753", "0.66797227", "0.6649426", "0.66385984", "0.6531744", "0.652346", "0.6503461", "0.6501489", "0.64737064", "0.6449697", "0.6446425", "0.6440887", "0.6417962", "0.6379309", "0.6359034",...
0.587757
78