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
Lightweight form of highlight proceed over this line and update state, but don't save a style array. Used for lines that aren't currently visible.
function processLine(cm, text, state, startAt) { var mode = cm.doc.mode; var stream = new StringStream(text, cm.options.tabSize); stream.start = stream.pos = startAt || 0; if (text == "") callBlankLine(mode, state); while (!stream.eol() && stream.pos <= cm.options.maxHighlightLength) { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "highlightLine(line_num)\n{\n this.highlightSet = line_num;\n}", "function highlightLine(cm, line, state, forceToEnd) {\n\t\t // A styles array always starts with a number identifying the\n\t\t // mode/overlays that it is based on (for easy invalidation).\n\t\t var st = [cm.state.modeGen], lineClasses ...
[ "0.6845844", "0.6801911", "0.6746598", "0.66967887", "0.6685893", "0.66727555", "0.6644832", "0.6644832", "0.6644832", "0.6644832", "0.6644832", "0.6644832", "0.6644832", "0.66420275", "0.66420275", "0.66311455", "0.66285306", "0.66064763", "0.66064763", "0.65936595", "0.6517...
0.0
-1
Render the DOM representation of the text of a line. Also builds up a 'line map', which points at the DOM nodes that represent specific stretches of text, and is used by the measuring code. The returned object contains the DOM node, this map, and information about linewide styles that were set by the mode.
function buildLineContent(cm, lineView) { // The padding-right forces the element to have a 'border', which // is needed on Webkit to be able to get line-level bounding // rectangles for it (in measureChar). var content = elt("span", null, null, webkit ? "padding-right: .1px" : null); var build...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n ...
[ "0.72580177", "0.72580177", "0.7192126", "0.7192126", "0.7192126", "0.70289665", "0.702209", "0.70012474", "0.6998166", "0.69852144", "0.698445", "0.69751626", "0.6961716", "0.6952634", "0.69465035", "0.69465035", "0.69465035", "0.69465035", "0.69465035", "0.69465035", "0.694...
0.729485
0
Build up the DOM representation for a single token, and add it to the line map. Takes care to render special characters separately.
function buildToken(builder, text, style, startStyle, endStyle, title) { if (!text) return; var special = builder.cm.options.specialChars, mustWrap = false; if (!special.test(text)) { builder.col += text.length; var content = document.createTextNode(text); builder.map.push(builder.po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "drawHTMLToken() {\n const tokenContainer = document.createElement('div');\n const gameBoardUnderlay = document.getElementById('game-board-underlay');\n gameBoardUnderlay.appendChild(tokenContainer);\n tokenContainer.setAttribute(\"id\", this.id);\n tokenContainer.setAttribute(\"c...
[ "0.63364595", "0.6152449", "0.6113837", "0.6113837", "0.6113837", "0.6104204", "0.60897434", "0.604226", "0.60420346", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", ...
0.611563
2
Work around nonsense dimensions being reported for stretches of righttoleft text.
function buildTokenBadBidi(inner, order) { return function(builder, text, style, startStyle, endStyle, title) { style = style ? style + " cm-force-border" : "cm-force-border"; var start = builder.pos, end = start + text.length; for (;;) { // Find the part that overlaps with the start ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function textResize(elt, d) {\n\n var textWidth = elt.getComputedTextLength();\n var arrayBro = elt.parentNode.childNodes;\n var len = arrayBro.length;\n var i = len / 2;\n\n if (arrayBro[i].firstChild === null || elt.firstChild === null)\n return null;\n\n while (arrayBro[i].firstChild.no...
[ "0.6418405", "0.6295126", "0.6238145", "0.6076527", "0.6073687", "0.5946578", "0.5921007", "0.58702046", "0.5853181", "0.57192", "0.57192", "0.5668393", "0.5668393", "0.566205", "0.56426734", "0.56314427", "0.56128454", "0.5596522", "0.5596522", "0.5596522", "0.5593755", "0...
0.0
-1
Outputs a number of spans to make up a line, taking highlighting and marked text into account.
function insertLineContent(line, builder, styles) { var spans = line.markedSpans, allText = line.text, at = 0; if (!spans) { for (var i = 1; i < styles.length; i+=2) builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options)); retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertLineContent(line, builder, styles) {\n\t var spans = line.markedSpans, allText = line.text, at = 0;\n\t if (!spans) {\n\t for (var i = 1; i < styles.length; i+=2)\n\t builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));...
[ "0.6614318", "0.66115975", "0.6580373", "0.65693927", "0.65664506", "0.65664506", "0.654721", "0.6531402", "0.6522913", "0.65173876", "0.6500858", "0.6500858", "0.649338", "0.649338", "0.649338", "0.6462281", "0.6462281", "0.6462281", "0.64612234", "0.64611715", "0.64610916",...
0.65085655
10
DOCUMENT DATA STRUCTURE By default, updates that start and end at the beginning of a line are treated specially, in order to make the association of line widgets and marker elements with the text behave more intuitive.
function isWholeLineUpdate(doc, change) { return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && (!doc.cm || doc.cm.options.wholeLineUpdateBefore); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(text, start, end) {\n this.lineOffsets = undefined;\n const content = this.getText();\n this.setText(content.slice(0, start) + text + content.slice(end));\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t\t function spansFor(n) {return markedSpans ? marke...
[ "0.6209731", "0.5762373", "0.57160366", "0.5716028", "0.5716028", "0.56956804", "0.5683243", "0.5683243", "0.5683243", "0.5683243", "0.5683243", "0.5683243", "0.5683243", "0.5683243", "0.5683243", "0.5683243", "0.5683243", "0.5637713", "0.5637713", "0.5637713", "0.5637713", ...
0.0
-1
Perform a change on the document data structure.
function updateDoc(doc, change, markedSpans, estimateHeight) { function spansFor(n) {return markedSpans ? markedSpans[n] : null;} function update(line, text, spans) { updateLine(line, text, spans, estimateHeight); signalLater(line, "change", line, change); } var from = change.from, t...
{ "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.70639664", "0.65255326", "0.60612947", "0.5983165", "0.57900375", "0.5765763", "0.57389504", "0.5728134", "0.56999445", "0.5689289", "0.568801", "0.5685086", "0.5677597", "0.5652581", "0.5643472", "0.563531", "0.563531", "0.563531", "0.56288433", "0.55978465", "0.5595986",...
0.0
-1
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 tre...
function LeafChunk(lines) { this.lines = lines; this.parent = null; for (var i = 0, height = 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.56859815", "0.5454054", "0.5454054", "0.5315474", "0.5282716", "0.52814066", "0.52756864", "0.52500665", "0.5235863", "0.51988924", "0.51819396", "0.5178975", "0.5177187", "0.51740324", "0.517146", "0.517146", "0.5166855", "0.5155169", "0.5155169", "0.51526767", "0.5139234...
0.49900407
65
Call f for all linked documents.
function linkedDocs(doc, f, sharedHistOnly) { function propagate(doc, skip, sharedHist) { if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) { var rel = doc.linked[i]; if (rel.doc == skip) continue; var shared = sharedHist && rel.sharedHist; if (sharedHistOnly &&...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOn...
[ "0.72686803", "0.72686803", "0.72686803", "0.72686803", "0.72686803", "0.72686803", "0.72686803", "0.724379", "0.724379", "0.724379", "0.7239275", "0.7239275", "0.7239275", "0.7239275", "0.7239275", "0.7239275", "0.7239275", "0.7239275", "0.7239275", "0.7239275", "0.7239275",...
0.7289204
0
Attach a document to an editor.
function attachDoc(cm, doc) { if (doc.cm) throw new Error("This document is already in use."); cm.doc = doc; doc.cm = cm; estimateLineHeights(cm); loadMode(cm); if (!cm.options.lineWrapping) findMaxLine(cm); cm.options.mode = doc.modeOption; regChange(cm); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attachDoc(cm, doc) {\n\t\t if (doc.cm) throw new Error(\"This document is already in use.\");\n\t\t cm.doc = doc;\n\t\t doc.cm = cm;\n\t\t estimateLineHeights(cm);\n\t\t loadMode(cm);\n\t\t if (!cm.options.lineWrapping) findMaxLine(cm);\n\t\t cm.options.mode = doc.modeOption;\n\t\t ...
[ "0.6626215", "0.6624217", "0.6578821", "0.6578821", "0.6578821", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.64938515", "0.64938515", "0.64938515", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321", ...
0.65262896
5
LINE UTILITIES Find the line object corresponding to the given line number.
function getLine(doc, n) { n -= doc.first; if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); for (var chunk = doc; !chunk.lines;) { for (var i = 0;; ++i) { var child = chunk.children[i], sz = child.chunkSize(); if (n < sz) {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function code_line(code, line) {\n return code.findIndex(l => l.line === line)\n}", "getLine(x, y) {\n var cell = this.getCell(x, y)\n if (cell == null) return null\n if (cell.type !== 'line') return null\n return cell.line\n }", "line(n) {\n if (n < 1 || n > this.lines)\n throw...
[ "0.71355015", "0.6993042", "0.69637924", "0.68186873", "0.6650509", "0.64616144", "0.64616144", "0.6456767", "0.6447401", "0.64452225", "0.64452225", "0.64452225", "0.64452225", "0.64452225", "0.64452225", "0.64452225", "0.64452225", "0.64452225", "0.64452225", "0.64452225", ...
0.0
-1
Get the part of a document between two positions, as an array of strings.
function getBetween(doc, start, end) { var out = [], n = start.line; doc.iter(start.line, end.line + 1, function(line) { var text = line.text; if (n == end.line) text = text.slice(0, end.ch); if (n == start.line) text = text.slice(start.ch); out.push(text); ++n; }); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBetween(doc, start, end) {\n var out = [], n = start.line;\n doc.iter(start.line, end.line + 1, function (line) {\n var text = line.text;\n if (n == end.line) { text = text.slice(0, end.ch); }\n if (n == start.line) { text = text.slice(start.ch); }\n out.push(text);\n ++n...
[ "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.73343515", "0.7319094", "0.7319094", "0.7319094", ...
0.7271897
41
Get the lines between from and to, as array of strings.
function getLines(doc, from, to) { var out = []; doc.iter(from, to, function(line) { out.push(line.text); }); return out; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function(line) { out.push(line.text); });\n return out;\n }", "function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function(line) { out.push(line.text); });\n return out;\n }", "function getLines(doc...
[ "0.7889981", "0.7889981", "0.7889981", "0.7889981", "0.7889981", "0.7889981", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "0.7849642", "...
0.7850907
6
Update the height of a line, propagating the height change upwards to parent nodes.
function updateLineHeight(line, height) { var diff = height - line.height; if (diff) for (var n = line; n; n = n.parent) n.height += diff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n\t\t }", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) for (var n = line; n; n = n.paren...
[ "0.83197033", "0.8304085", "0.828024", "0.828024", "0.828024", "0.828024", "0.828024", "0.828024", "0.828024", "0.8276326", "0.8276326", "0.8276326", "0.8276326", "0.8276326", "0.8276326", "0.8276326", "0.8276326", "0.8276326", "0.8276326", "0.8276326", "0.8276326", "0.8276...
0.82587874
29
Given a line object, find its line number by walking up through its parent links.
function lineNo(line) { if (line.parent == null) return null; var cur = line.parent, no = indexOf(cur.lines, line); for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { for (var i = 0;; ++i) { if (chunk.children[i] == cur) break; no += chunk.children[i].chunkS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineNo(line) {\n\t\t if (line.parent == null) { return null }\n\t\t var cur = line.parent, no = indexOf(cur.lines, line);\n\t\t for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n\t\t for (var i = 0;; ++i) {\n\t\t if (chunk.children[i] == cur) { break }\n\t\t ...
[ "0.76442444", "0.7633338", "0.75937176", "0.75937176", "0.75937176", "0.75879866", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738", "0.7587738"...
0.760459
2
Find the line at the given vertical position, using the height information in the document tree.
function lineAtHeight(chunk, h) { var n = chunk.first; outer: do { for (var i = 0; i < chunk.children.length; ++i) { var child = chunk.children[i], ch = child.height; if (h < ch) { chunk = child; continue outer; } h -= ch; n += child.chunkSize(); } retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLineHeight(line, height) {\n var diff = height - line.height;\n\n if (diff) {\n for (var n = line; n; n = n.parent) {\n n.height += diff;\n }\n }\n } // Given a line object, find its line number by walking up through", "lineBlockAtHeight(height) {\n this.readMeasu...
[ "0.6573439", "0.6411567", "0.63364756", "0.63364756", "0.63364756", "0.63168085", "0.62935245", "0.62645507", "0.62553746", "0.6221541", "0.6221541", "0.6221541", "0.6221541", "0.6221541", "0.6221541", "0.6221541", "0.6221541", "0.6221541", "0.6221541", "0.6221541", "0.622154...
0.6222597
9
Find the height above the given line.
function heightAtLine(lineObj) { lineObj = visualLine(lineObj); var h = 0, chunk = lineObj.parent; for (var i = 0; i < chunk.lines.length; ++i) { var line = chunk.lines[i]; if (line == lineObj) break; else h += line.height; } for (var p = chunk.parent; p; chunk = p, p = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function heightAtLine(lineObj) {\n\t\t lineObj = visualLine(lineObj);\n\t\t\n\t\t var h = 0, chunk = lineObj.parent;\n\t\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t\t var line = chunk.lines[i];\n\t\t if (line == lineObj) break;\n\t\t else h += line.height;\n\t\t }\n\t\t for (...
[ "0.7671464", "0.76677096", "0.7596726", "0.7596726", "0.75906456", "0.7559263", "0.7559263", "0.7559263", "0.7559263", "0.7559263", "0.7559263", "0.7559263", "0.75546443", "0.75546443", "0.75546443", "0.75546443", "0.75546443", "0.75546443", "0.75546443", "0.75546443", "0.755...
0.7551161
29
Get the bidi ordering for the given line (and cache it). Returns false for lines that are fully lefttoright, and an array of BidiSpan objects otherwise.
function getOrder(line) { var order = line.order; if (order == null) order = line.order = bidiOrdering(line.text); return order; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOrder(line) {\n\t\t var order = line.order;\n\t\t if (order == null) order = line.order = bidiOrdering(line.text);\n\t\t return order;\n\t\t }", "function getOrder(line) {\n\t var order = line.order;\n\t if (order == null) order = line.order = bidiOrdering(line.text);\n\t return or...
[ "0.7618922", "0.7584603", "0.7584603", "0.7584603", "0.75777864", "0.75777864", "0.75777864", "0.75777864", "0.75777864", "0.75777864", "0.75777864", "0.7471544", "0.7224491", "0.7135738", "0.7135738", "0.7135738", "0.7135738", "0.7135738", "0.7135738", "0.7135738", "0.713573...
0.75556743
11
Create a history change event from an updateDocstyle change object.
function historyChangeFromChange(doc, change) { var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function historyChangeFromChange(doc, change) {\n\t\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t\t linkedDocs(doc, function(doc) {attachLocalSpans(do...
[ "0.69617647", "0.6947776", "0.6934313", "0.6934313", "0.69262254", "0.69262254", "0.69262254", "0.69262254", "0.69262254", "0.69262254", "0.69262254", "0.69262254", "0.69262254", "0.69262254", "0.69262254", "0.692196", "0.692196", "0.692196", "0.691096", "0.691096", "0.691096...
0.69026434
25
Pop all selection events off the end of a history array. Stop at a change event.
function clearSelectionEvents(array) { while (array.length) { var last = lst(array); if (last.ranges) array.pop(); else break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearSelectionEvents(array) {\n\t\t while (array.length) {\n\t\t var last = lst(array);\n\t\t if (last.ranges) array.pop();\n\t\t else break;\n\t\t }\n\t\t }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) ...
[ "0.7114935", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.71047795", "0.71020734", "0.71020734", "0.71020734", "0.7082853", "0.7082853", "0.7082853", "0.7082853", "0.7082853", "0.7082853", "0.7082853", "0.7082853", "0.7082853",...
0.70783186
29
Find the top change event in the history. Pop off selection events that are in the way.
function lastChangeEvent(hist, force) { if (force) { clearSelectionEvents(hist.done); return lst(hist.done); } else if (hist.done.length && !lst(hist.done).ranges) { return lst(hist.done); } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { hist.done....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist....
[ "0.66849047", "0.63813424", "0.6359494", "0.6341463", "0.6341463", "0.6341463", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", "0.62868226", ...
0.62480915
30
Register a change in the history. Merges changes that are within a single operation, ore are close together with an origin that allows merging (starting with "+") into a single event.
function addChangeToHistory(doc, change, selAfter, opId) { var hist = doc.history; hist.undone.length = 0; var time = +new Date, cur; if ((hist.lastOp == opId || hist.lastOrigin == change.origin && change.origin && ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addChangeToHistory(doc, change, selAfter, opId) {\n\t\t var hist = doc.history;\n\t\t hist.undone.length = 0;\n\t\t var time = +new Date, cur;\n\t\t\n\t\t if ((hist.lastOp == opId ||\n\t\t hist.lastOrigin == change.origin && change.origin &&\n\t\t ((change.origin.charAt(0) == \...
[ "0.6296305", "0.62939656", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6286975", "0.6279759", "0.62785363", ...
0.6230213
30
Called whenever the selection changes, sets the new selection as the pending selection in the history, and pushes the old pending selection into the 'done' array when it was significantly different (in number of selected ranges, emptiness, or time).
function addSelectionToHistory(doc, sel, opId, options) { var hist = doc.history, origin = options && options.origin; // A new event is started when the previous origin does not match // the current, or the origins don't allow matching. Origins // starting with * are always merged, those starting ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_gcSelections () {\n for (let i = 0; i < this._selections.length; ++i) {\n const s = this._selections[i]\n const oldOffset = s.offset\n\n // check for newly downloaded pieces in selection\n while (this.bitfield.get(s.from + s.offset) && s.from + s.offset < s.to) {\n s.offset += 1\n ...
[ "0.6612278", "0.6612278", "0.6612278", "0.64062285", "0.63359755", "0.6259356", "0.6259356", "0.6259356", "0.6165588", "0.6139127", "0.6100716", "0.6090815", "0.6090815", "0.6083206", "0.60524267", "0.6051391", "0.60489184", "0.60489184", "0.6045485", "0.6045187", "0.6021936"...
0.6015027
43
Used to store marked span information in the history.
function attachLocalSpans(doc, change, from, to) { var existing = change["spans_" + doc.id], n = 0; doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) { if (line.markedSpans) (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMarkedSpan(line, span) {\n\t\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t\t span.marker.attachLine(line);\n\t\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span....
[ "0.6327484", "0.6285503", "0.6285503", "0.6285503", "0.62029684", "0.61554384", "0.6131782", "0.6125477", "0.6125477", "0.6085742", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.6...
0.5554014
58
When un/redoing restores text containing marked spans, those that have been explicitly cleared should not be restored.
function removeClearedSpans(spans) { if (!spans) return null; for (var i = 0, out; i < spans.length; ++i) { if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); } else if (out) out.push(spans[i]); } return !out ? spans : out.length ? out : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remark() {\n for (var i = 0; i < vm.game.marked.length; i++) {\n var element = angular.element(document.getElementById('text-' + i));\n var marked = vm.game.marked[i];\n element.removeClass('last');\n element.removeClass('first');\n ...
[ "0.6540807", "0.65240675", "0.64632744", "0.6355915", "0.6311201", "0.6300562", "0.6292375", "0.62831897", "0.6254594", "0.6254594", "0.6254594", "0.6239038", "0.6210667", "0.62025976", "0.6202088", "0.6201283", "0.61964935", "0.61964935", "0.61964935", "0.61964935", "0.61964...
0.58934474
85
Retrieve and filter the old marked spans stored in a change event.
function getOldSpans(doc, change) { var found = change["spans_" + doc.id]; if (!found) return null; for (var i = 0, nw = []; i < change.text.length; ++i) nw.push(removeClearedSpans(found[i])); return nw; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) { return null }\n\t\t var nw = [];\n\t\t for (var i = 0; i < change.text.length; ++i)\n\t\t { nw.push(removeClearedSpans(found[i])); }\n\t\t return nw\n\t\t }", "function getOldSpans(doc, cha...
[ "0.77960473", "0.77758455", "0.77452487", "0.77452487", "0.77452487", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755", "0.7710755"...
0.7655312
29
Used both to provide a JSONsafe object in .getHistory, and, when detaching a document, to split the history in two
function copyHistoryArray(events, newGroup, instantiateSel) { for (var i = 0, copy = []; i < events.length; ++i) { var event = events[i]; if (event.ranges) { copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); continue; } var changes = event.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "serializeHistory(state) {\r\n if (!state)\r\n return null;\r\n // Ensure sure that all entries have url\r\n var entries = state.entries.filter(e => e.url);\r\n if (!entries.length)\r\n return null;\r\n // Ensure the index is in bounds.\r\n var index = (state.index || entries.length) - 1...
[ "0.6128736", "0.597194", "0.5751274", "0.5658887", "0.5648688", "0.55759466", "0.55759466", "0.55759466", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.55629796", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0....
0.50627196
83
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.7397952", "0.7375274", "0.711438", "0.6920561", "0.6904765", "0.687358", "0.686189", "0.680521", "0.67269665", "0.6600654", "0.6581299", "0.65552354", "0.65401167", "0.6529911", "0.6517975", "0.6485189", "0.6480019", "0.64591163", "0.6439742", "0.64371014", "0.64327615", ...
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 realloc...
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++) { rebaseHistSel...
{ "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.6720824", "0.6720824", "0.6720824", "0.6720824", "0.64946175", "0.64900583", "0.6475097", "0.6475097", "0.6475097", "0.6475097", "0.6475097", "0.6475097", "0.6475097", "0.6474302", "0.6474302", "0.6474302", "0.6474302", "0.6474302", "0.6474302", "0.6474302", "0.6474302", ...
0.64707965
30
Often, we want to signal events at a point where we are in the middle of some work, but don't want the handler to start calling other methods on the editor, which might be in an inconsistent state or simply not expect any other events to happen. signalLater looks whether there are any handlers, and schedules them to be...
function signalLater(emitter, type /*, values...*/) { var arr = emitter._handlers && emitter._handlers[type]; if (!arr) return; var args = Array.prototype.slice.call(arguments, 2), list; if (operationGroup) { list = operationGroup.delayedCallbacks; } else if (orphanDelayedCallbacks) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signalLater(emitter, type /*, values...*/) {\n\t\t var arr = getHandlers(emitter, type, false)\n\t\t if (!arr.length) return;\n\t\t var args = Array.prototype.slice.call(arguments, 2), list;\n\t\t if (operationGroup) {\n\t\t list = operationGroup.delayedCallbacks;\n\t\t } else if (orph...
[ "0.65534204", "0.64444053", "0.64444053", "0.64444053", "0.6412821", "0.6408329", "0.6219146", "0.6219146", "0.6219146", "0.6219146", "0.6219146", "0.6154097", "0.6154097", "0.6154097", "0.6154097", "0.6154097", "0.6154097", "0.6154097", "0.6154097", "0.6154097", "0.6154097",...
0.622941
6
The DOM events that CodeMirror handles can be overridden by registering a (nonDOM) handler on the editor for the event name, and preventDefaulting the event in that handler.
function signalDOMEvent(cm, e, override) { signal(cm, override || e.type, cm, e); return e_defaultPrevented(e) || e.codemirrorIgnore; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signalDOMEvent(cm, e, override) {\n\t\t if (typeof e == \"string\")\n\t\t { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }\n\t\t signal(cm, override || e.type, cm, e);\n\t\t return e_defaultPrevented(e) || e.codemirrorIgnore\n\t\t }", "function signalDOMEve...
[ "0.71285355", "0.7110928", "0.6913236", "0.6913236", "0.6910011", "0.6910011", "0.6910011", "0.69009715", "0.6879663", "0.6879663", "0.6879663", "0.6879663", "0.6879663", "0.6879663", "0.6879663", "0.6879663", "0.6879663", "0.6879663", "0.6879663", "0.6879663", "0.6879663", ...
0.6817294
41
Add on and off methods to a constructor's prototype, to make registering events on such objects more convenient.
function eventMixin(ctor) { ctor.prototype.on = function(type, f) {on(this, type, f);}; ctor.prototype.off = function(type, f) {off(this, type, f);}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static mixin(constr) {\n // instance._events = {};\n [\"on\", \"once\", \"off\", \"emit\"].forEach(name => {\n const property = Object.getOwnPropertyDescriptor(Emitter.prototype, name);\n Object.defineProperty(constr.prototype, name, property);\n });\n }", "function ...
[ "0.68007386", "0.67394525", "0.67394525", "0.67068744", "0.67068744", "0.67068744", "0.66898924", "0.66598463", "0.66598463", "0.66598463", "0.66598463", "0.66598463", "0.66598463", "0.66598463", "0.66598463", "0.66598463", "0.66598463", "0.66598463", "0.66598463", "0.66598463"...
0.66954523
6
The inverse of countColumn find the offset that corresponds to a particular column.
function findColumn(string, goal, tabSize) { for (var pos = 0, col = 0;;) { var nextTab = string.indexOf("\t", pos); if (nextTab == -1) nextTab = string.length; var skipped = nextTab - pos; if (nextTab == string.length || col + skipped >= goal) return pos + Math.min(skipped, go...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function firstInColumnLocation(col) {\r\n\t\tvar sets = $['mapsettings'];\r\n\t\tvar point = new Point(sets.columns[col],0);\r\n\t\tvar offset = getRelativePoint(point);\r\n\t\treturn offset.x;\r\n\t}", "function getRelativeColStart(col) {\r\n\t\tvar loc = new Point(sets.columns[col],0);\r\n\t\tvar offset = getR...
[ "0.7021987", "0.6775611", "0.65452886", "0.6529331", "0.6511735", "0.6411007", "0.6410537", "0.6356087", "0.63428265", "0.6291044", "0.62446356", "0.6230127", "0.6212064", "0.62012273", "0.6193145", "0.6193145", "0.6193145", "0.6193145", "0.6193145", "0.6193145", "0.61714053"...
0.6145379
38
WINDOWWIDE EVENTS 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.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_initEvents() {\n window.addEventListener(\"submitCommand\", event => this._processInput(event.detail));\n this.input.editableNode.onkeypress = () => {\n if (this.mode == Editor.MODE_INSERT)\n this.modificationSaved = false;\n };\n this.input.editableNode.onkey...
[ "0.5910158", "0.5884189", "0.58081603", "0.58081603", "0.5806247", "0.5806247", "0.5806247", "0.5800258", "0.57930315", "0.5790672", "0.57749575", "0.5755503", "0.57010466", "0.5682024", "0.56588525", "0.5658256", "0.5640037", "0.56253564", "0.5617324", "0.5602502", "0.557831...
0.0
-1
This is needed in order to move 'visually' through bidirectional text i.e., pressing left should make the cursor go left, even when in RTL text. The tricky part is the 'jumps', where RTL and LTR text touch each other. This often requires the cursor offset to move more than one unit, in order to visually move one unit.
function moveVisually(line, start, dir, byUnit) { var bidi = getOrder(line); if (!bidi) return moveLogically(line, start, dir, byUnit); var pos = getBidiPartAt(bidi, start), part = bidi[pos]; var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit); for (;;) { if (targ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "navigateWordLeft() {\n this.selection.moveCursorWordLeft();\n this.clearSelection();\n }", "function moveLeft(input) { setCursor(input, input.selectionStart - 1) }", "moveCursor(direction){\n\t\tif(direction == GAUCHE){\n\t\t\tvar x = (parseInt(this.cursor.style.left, 10)-33);\n\t\t\tvar y = ...
[ "0.64485466", "0.62389255", "0.61791986", "0.61756593", "0.6168636", "0.6148929", "0.6142902", "0.61419654", "0.6087775", "0.6067822", "0.6032292", "0.5974135", "0.5930453", "0.5874224", "0.5792836", "0.5787203", "0.5780208", "0.5762407", "0.57401395", "0.5678598", "0.5676572...
0.5383448
52
Turns a plugin!resource to [plugin, resource] with the plugin being undefined if the name did not have a plugin prefix.
function splitPrefix(name) { var prefix, index = name ? name.indexOf('!') : -1; if (index > -1) { prefix = name.substring(0, index); name = name.substring(index + 1, name.length); } return [prefix, name]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function splitPrefix(name){var prefix,index=name?name.indexOf('!'):-1;if(index > -1){prefix = name.substring(0,index);name = name.substring(index + 1,name.length);}return [prefix,name];} //Creates a parts array for a relName where first part is plugin ID,", "function build_plugin_names() {\n const args = Norma(...
[ "0.60889494", "0.5514901", "0.5498451", "0.5432961", "0.5398501", "0.52130866", "0.52130866", "0.5178085", "0.5129986", "0.51132685", "0.5012371", "0.499462", "0.4879099", "0.48786902", "0.48741692", "0.47715914", "0.47442123", "0.47087735", "0.4702723", "0.469877", "0.468467...
0.0
-1
creates token objects and pushes them to a list
function tokener(value, type) { session.tokens.push({ value: value, type: type || value, start: null, end: null }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeBdTokenList(){\n BD18.boardTokens = [];\n if (BD18.gm.brdTks.length === 0) return;\n var token,sn,ix,flip,bx,by;\n for(var i=0;i<BD18.gm.brdTks.length;i++) {\n sn = BD18.gm.brdTks[i].sheetNumber;\n ix = BD18.gm.brdTks[i].tokenNumber;\n flip = BD18.gm.brdTks[i].flip;\n bx = BD18.gm.brdT...
[ "0.7013138", "0.6979932", "0.6950582", "0.6806109", "0.6779935", "0.6726763", "0.65844953", "0.6443425", "0.6442827", "0.6370297", "0.63461494", "0.6277411", "0.6234265", "0.61898226", "0.61630046", "0.59994644", "0.5962916", "0.5939153", "0.5929126", "0.59134024", "0.5911193...
0.555459
47
token handlers follow for: white space, comment, string, identifier, number, operator
function white() { var c = walker.ch, token = ''; while (c === " " || c === "\t") { token += c; c = walker.nextChar(); } tokener(token, 'white'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tokenize() {\r\n var ch = walker.ch;\r\n \r\n if (ch === \" \" || ch === \"\\t\") {\r\n return white();\r\n }\r\n\r\n if (ch === '/') {\r\n return comment();\r\n } \r\n\r\n if (ch === '\"' || ch === \"'\") {\r\n return str();\r\n }\r\n \r\n if (ch === '(') {\r\n ...
[ "0.6628595", "0.65813243", "0.6502615", "0.64352596", "0.64352596", "0.6415648", "0.6393269", "0.6346397", "0.6346397", "0.6327717", "0.6327717", "0.63193566", "0.63077074", "0.6301843", "0.62601215", "0.6251614", "0.62495416", "0.6221102", "0.618177", "0.6153507", "0.6113447...
0.0
-1
call the appropriate handler based on the first character in a token suspect
function tokenize() { var ch = walker.ch; if (ch === " " || ch === "\t") { return white(); } if (ch === '/') { return comment(); } if (ch === '"' || ch === "'") { return str(); } if (ch === '(') { return brace(); } if (ch =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "firstToken({token, counter}) {\n\t\t// Invalidade any dict ending in: [ ( .\n\t\tif (token.value === null) {\n\t\t\tconst lastToken = this.listener.currentTokens[this.listener.currentTokens.length -1];\n\t\t\tconst second = token;\n\t\t\tif (lastToken.value === '(' || lastToken.value === '[' || lastToken.value ===...
[ "0.66001403", "0.65129524", "0.6325205", "0.6322606", "0.63020575", "0.6029795", "0.5970151", "0.5963363", "0.59361285", "0.5894771", "0.5869274", "0.58648247", "0.58290815", "0.5819305", "0.5813164", "0.58069897", "0.5774987", "0.5731725", "0.5726119", "0.5680361", "0.567009...
0.59022075
9
Optimize attribute set: remove duplicates and merge class attributes
function optimizeAttributes(attrs) { // clone all attributes to make sure that original objects are // not modified attrs = _.map(attrs, function(attr) { return _.clone(attr); }); var lookup = {}; return _.filter(attrs, function(attr) { if (!(attr.name in lookup)) {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get observedAttributes(){this.finalize();const e=[];// Use forEach so this works even if for/of loops are compiled to for loops\n// expecting arrays\nreturn this._classProperties.forEach((t,n)=>{const r=this._attributeNameForProperty(n,t);void 0!==r&&(this._attributeToPropertyMap.set(r,n),e.push(r))}),e}", ...
[ "0.6052237", "0.6048285", "0.6039772", "0.5971719", "0.5861021", "0.58387834", "0.57835835", "0.56778365", "0.56702906", "0.56166244", "0.55771595", "0.5563958", "0.5557324", "0.5524872", "0.5507199", "0.550244", "0.54919505", "0.5471265", "0.5445815", "0.5404441", "0.5404441...
0.7001043
0
Resolves property name (abbreviation): searches for snippet definition in 'resources' and returns new name of matched property
function resolvePropertyName(name, syntax) { var snippet = resources.findSnippet(syntax, name); if (!snippet && prefs.get('css.fuzzySearch')) { var minScore = parseFloat(prefs.get('css.fuzzySearchMinScore')); snippet = resources.fuzzyFindSnippet(syntax, name, minScore); } i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processNaming(resources) {\n return resources.reduce((col, res) => {\n col[res.spec.kind] = {\n scope: res.spec.scope ? res.spec.scope.kind : undefined,\n plural: res.spec.plural\n };\n return col;\n }, {})\n}", "resourceNamed(name) {\n return this.o...
[ "0.58748955", "0.52458376", "0.5180754", "0.5109305", "0.50496423", "0.50433815", "0.5019786", "0.49249497", "0.49076906", "0.4852448", "0.48496565", "0.48201033", "0.47846207", "0.47808748", "0.47667602", "0.47563818", "0.4751944", "0.4751944", "0.4751944", "0.4751404", "0.4...
0.65412897
0
function to render the "PP" abreviated logo
function PPSymbol({ style }: LogoProps): ComponentNode<LogoProps> { const { color = BUTTON_COLOR.BLUE } = style; if ( color === BUTTON_COLOR.BLUE || color === BUTTON_COLOR.DARKBLUE || color === BUTTON_COLOR.BLACK ) { return <PPLogo logoColor={LOGO_COLOR.WHITE} />; } if ( color === BUTTON_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logoArt() {\n console.log(logo(config).render());\n start();\n}", "function showLogo() {\n var logo = [aa(_templateObject), aa(_templateObject2), aa(_templateObject3), aa(_templateObject4), aa(_templateObject5), aa(_templateObject6)];\n logo.forEach(function (line) {\n return console.log('\\t' + ...
[ "0.7081766", "0.6612912", "0.64706236", "0.64680266", "0.6436468", "0.63746786", "0.6320346", "0.6289938", "0.62564206", "0.6247169", "0.6177031", "0.6076095", "0.6071128", "0.6061616", "0.6022446", "0.5990772", "0.5966168", "0.5962322", "0.59537756", "0.59490234", "0.5925010...
0.59753084
16
1000/20 = 50 fps
function init() { for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; } if (!window....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static getFrameRate(frames) {\nvar frameok;\n//------------\n// Use 25fps as the somewhat arbitrary default value.\nframeok = frames && frames.length !== 0;\nif (frameok) {\nreturn 1000 / frames[0].duration;\n} else {\nreturn 25;\n}\n}", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this....
[ "0.720995", "0.7167648", "0.71105725", "0.7052196", "0.7015777", "0.6987235", "0.69732195", "0.6970348", "0.69407", "0.6899664", "0.68854696", "0.6869363", "0.6847184", "0.68309283", "0.68256474", "0.67752266", "0.6740224", "0.6734846", "0.67285585", "0.672178", "0.67174107",...
0.0
-1
Constructor for creating the widget
function Chart(options, element) { var _this = _super.call(this, options, element) || this; /** @public */ _this.animated = false; /** @private */ _this.isPointMouseDown = false; /** @private */ _this.isScrolling = false; /** @private */ _this.char...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Widget() {\n _super.call(this);\n this._flags = 0;\n this._parent = null;\n this._children = [];\n this._box = null;\n this._rect = null;\n this._limits = null;\n this.addClass(exports.WIDGET_CLASS);\n }", "constructor(){\n this.insta...
[ "0.66539955", "0.6647039", "0.66324884", "0.6605175", "0.6595505", "0.6539456", "0.6478983", "0.64370453", "0.641638", "0.6393276", "0.6380318", "0.6379059", "0.6377319", "0.63604516", "0.6355674", "0.6304924", "0.62978125", "0.62835115", "0.6282769", "0.6263024", "0.6248024"...
0.0
-1
"use strict"; main( require("fs") .readFileSync("/dev/stdin", "UTF8") .trim() .split("\n") );
function main(input) { input = input.trim().split("\n"); const N = parseInt(input.shift()); const permutation = input[0].split(" ").map(Number); let result = 0; let min = permutation[0]; for (let i = 0; i < N; i++) { if (min >= permutation[i]) { result++; min = permutation[i]; } } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readInput(err,data){\r\n if (err) {\r\n return console.log(err);\r\n }\r\n inputString = data.split('\\n');\r\n \r\n main();\r\n}", "function read_stdin(): Promise<string> {\n return new Promise((resolve, reject) => {\n let chunks: string[] = [];\n process.stdin.on(\"data\",...
[ "0.7199981", "0.67323655", "0.65868074", "0.6585657", "0.65720093", "0.64947814", "0.6384554", "0.61711365", "0.6152408", "0.61253536", "0.60878724", "0.6070194", "0.5997105", "0.5991697", "0.59719753", "0.59634525", "0.5941972", "0.59228957", "0.59029764", "0.5900661", "0.58...
0.0
-1
Enable Direct Sockets API
async headers() { return [ { source: "/:path*", headers: [ { key: "Cross-Origin-Opener-Policy", value: "same-origin", }, { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initSocket() {\n\tg_socket = io.connect(g_server_address, {secure: true});\n}", "function proxySocket() {\n\t\tproxyEvents.forEach(function(event){\n\t\t\tsocket.on(event, function(data) {\n\t\t\t\tamplify.publish('socket:'+event, data || null);\n\t\t\t});\n\t\t});\n\t\tsocket.on('connect', function() {...
[ "0.64172596", "0.6369122", "0.6191283", "0.615134", "0.6072771", "0.60097677", "0.60021883", "0.5992686", "0.59880984", "0.59589726", "0.59212166", "0.5916527", "0.5854617", "0.58330905", "0.58229244", "0.5806724", "0.5756707", "0.5754484", "0.5750982", "0.57397956", "0.57335...
0.0
-1
Operates independent of history, etc.
overRideGeoJSON(text){ this.setState({geojson: text}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function performOperationAndAdjustObject() {\n calculatorObject.numbers.push(Number(display.textContent));\n display.textContent = operate(calculatorObject.numbers[0], calculatorObject.numbers[1], calculatorObject.operators[0]);\n calculatorObject.numbers.shift();\n calculatorObject.numbers[0] = Number...
[ "0.58169985", "0.5765463", "0.57336694", "0.5720404", "0.5574852", "0.5571607", "0.5563176", "0.55210584", "0.55046934", "0.5493182", "0.548924", "0.53863657", "0.5384083", "0.5363494", "0.536316", "0.5352171", "0.5340698", "0.5340636", "0.53303736", "0.53289384", "0.53201675...
0.0
-1
this sets up setting the values of the inputs
mapPropsToValues({ username, password }) { return { username: username || "", password: password || "" }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setupInitialValues() {\n this.__xSpacingInput.value = \"1.0\";\n this.__ySpacingInput.value = \"1.0\";\n\n this.__xDimInput.value = 5;\n this.__yDimInput.value = 1;\n }", "function defineInputs() {\r\n\r\n\tsteerYes = filterRadios[0];\r\n\tsteerNo = filterRadios[1];\r\n\tsteerBoth ...
[ "0.7594982", "0.6992331", "0.66791064", "0.6617939", "0.6567142", "0.6419758", "0.64154476", "0.6333016", "0.6326457", "0.6308931", "0.62693495", "0.62675", "0.6264066", "0.6257361", "0.6252354", "0.6212514", "0.62101096", "0.6198542", "0.6172596", "0.61312544", "0.60777456",...
0.0
-1
this sets ups submitting the form
handleSubmit(values, { setStatus, resetForm, setSubmitting }) { axios .post("https://tripsplitr.herokuapp.com/auth/login", values) .then(apiData => { console.log("handle submit res: ", apiData); setStatus(apiData.data); resetForm(); }) .catch(err => alert(err)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitForm () {\n\n\t\t\t// Add submitting state\n\t\t\tform.setAttribute('data-submitting', true);\n\n\t\t\t// Send the data to the MailChimp API\n\t\t\tsendData(serializeForm(form));\n\n\t\t}", "submitForm(){\n\t\tlet instance = this;\n\t\tconst\tdata = JSON.stringify({\n\t\t\tinterest: instance.dropd...
[ "0.7500097", "0.710478", "0.69103926", "0.681613", "0.6811596", "0.6751432", "0.67398846", "0.67281383", "0.6707604", "0.66897196", "0.6688845", "0.6648258", "0.66325426", "0.6631672", "0.66181207", "0.66072464", "0.66005254", "0.6572256", "0.6567056", "0.6560562", "0.6515965...
0.0
-1
Program Framework The primary export of the electron module is a function that composes a new program framework. The returned `program` is a chainable api that allow you to change settings, define commands, and start launch the program. The primary argument provided on construction is the base name used through the hel...
function Program (base, opts) { /*! * @param {String} base name * @param {Object} options */ Drip.call(this, { delimeter: ' ' }); this.commands = []; this._colorized = false; this.opts = defaults(opts || {}, { useColors: istty , version: null , desc: null , name: base || 'Electron'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setupProgram(program) {\n }", "function main(){\n // Path\n if (program.moduleName) {\n var nameArg = program.args.shift();\n }else{\n console.log(chalk.red('Please enter a module name with -n.'));\n console.log(chalk.red('Example: node libs/scripts/module -n sample'));\n ...
[ "0.64821345", "0.6370832", "0.6036497", "0.59571695", "0.5896582", "0.57504845", "0.5666505", "0.56255203", "0.55852115", "0.55502266", "0.5518867", "0.54993737", "0.54550254", "0.54331213", "0.5419457", "0.53936344", "0.53849655", "0.53563786", "0.5340111", "0.5322601", "0.5...
0.7319797
0
Gets all reviewers for our current organization from the API. This also filters out the current user if he or she has reviewing privileges. This result is stored to the validReviewers field.
async getReviewers({ commit, rootState }) { if (isSuperUser() || isWriter()) { let response = await reviewersAPI.getReviewers(); if (response.status === 200 && response.data) { commit('set_reviewers', { reviewers: response.data }) let filteredData = response.data.filter(r => r.id !== r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findAllReviewsForUser() {\n var url = \"/api/reviews/user\";\n\n return $http.get(url)\n //unwrap response\n .then(function (response) {\n // return as embedded response\n return response.data;\n });\n\n ...
[ "0.60111475", "0.60009295", "0.56649405", "0.55157125", "0.54778576", "0.5415185", "0.52880716", "0.5235664", "0.5140773", "0.5128149", "0.4888681", "0.48540786", "0.4852665", "0.48188686", "0.474982", "0.47490183", "0.4746339", "0.46874684", "0.46429342", "0.46251836", "0.45...
0.6763499
0
This calls getReviewers() if we can't find the requested user id in our store. If we can find it, nothing will happen.
async getReviewersIfNotStored({ getters, dispatch }, { userId }) { if (!getters.getUserById({ id: userId })) { dispatch('getReviewers'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getReviewers({ commit, rootState }) {\n if (isSuperUser() || isWriter()) {\n let response = await reviewersAPI.getReviewers();\n\n if (response.status === 200 && response.data) {\n commit('set_reviewers', { reviewers: response.data })\n\n let filteredData = response.data.filter(r =...
[ "0.6468149", "0.60279197", "0.5955672", "0.5731787", "0.5679753", "0.56026936", "0.55773616", "0.5557501", "0.55260015", "0.5513568", "0.55074817", "0.5492687", "0.5488956", "0.5472539", "0.5447139", "0.54184973", "0.5371315", "0.5353056", "0.53368336", "0.5334086", "0.533276...
0.7890611
0
Writes the fetched reviewers to the store.
set_reviewers(state, { reviewers }) { state.reviewers = reviewers.map( reviewer => new AttributedUser({ user: reviewer, role: 'Reviewer' }) ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "write() {\n const json = this.toJson()\n for (let i = 0; i < this._stores.length; i++) {\n this._stores[i].write(json)\n }\n }", "putReviews(reviews) {\n if (!reviews.push) reviews = [reviews];\n return this.db.then(db => {\n const store = db.transaction('reviews', 'readwrite').objectSt...
[ "0.6268659", "0.5991651", "0.59854984", "0.588765", "0.5706981", "0.5587669", "0.54717785", "0.53920525", "0.5327383", "0.52628106", "0.52572155", "0.5221632", "0.521176", "0.5199225", "0.50815094", "0.5043761", "0.5020408", "0.5011294", "0.5006524", "0.49486518", "0.49294406...
0.48007527
33
Writes the fetched reviewers to the store. No filters are applied by this function.
set_valid_reviewers(state, { reviewers }) { state.validReviewers = reviewers.map( reviewer => new AttributedUser({ user: reviewer, role: 'Reviewer' }) ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeReview(recReview) {\n var written = document.getElementById('complete-review').value;\n var named = document.getElementById('review-name').value;\n\n for (i = 0; i < reviews.length; i++) {\n if (reviews[i].name.indexOf(recReview) !== -1) {\n reviews[i].review.push(written);\n reviews[...
[ "0.60909927", "0.60036457", "0.5959008", "0.5761341", "0.5705771", "0.5657018", "0.54344636", "0.54329264", "0.53787035", "0.53065777", "0.5247814", "0.5240955", "0.52348703", "0.5233745", "0.52258056", "0.51858026", "0.514529", "0.5121964", "0.511822", "0.5109083", "0.505609...
0.0
-1
This keeps your state in sync with the opening/closing of the menu via the default means, e.g. clicking the X, pressing the ESC key etc.
handleStateChange(state) { this.setState({ menuOpen: state.isOpen }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function manageMenu() {\n if (menuOpen) {\n menuOpen = false;\n closeMenu();\n } else {\n menuOpen = true;\n openMenu();\n }\n}", "handleMenuClick() {\r\n const open = this.state.menuOpen ? false:true;\r\n this.setState({menuOpen: open});\r\n }", "function ...
[ "0.6920165", "0.6787442", "0.67623675", "0.6606717", "0.65386665", "0.6440277", "0.6416821", "0.6416821", "0.6406458", "0.6396547", "0.6389918", "0.6363712", "0.63622075", "0.63524246", "0.6302102", "0.6295529", "0.62668264", "0.6233996", "0.6227284", "0.622197", "0.6210709",...
0.60872334
39
This can be used to toggle the menu, e.g. when using a custom icon Tip: You probably want to hide either/both default icons if using a custom icon See
toggleMenu() { this.setState({ menuOpen: !this.state.menuOpen }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleMenu() {\n if (menu.classList.contains('active')) {\n menu.classList.remove('active')\n toggle.querySelector('a').querySelector('img').src = \"/feather_icon/menu.svg\";\n } else {\n menu.classList.add('active')\n toggle.querySelector('a').querySelector('img').src = ...
[ "0.75698185", "0.73570275", "0.72885954", "0.72660923", "0.72476023", "0.71807516", "0.71471834", "0.71218115", "0.7103998", "0.70347977", "0.6964086", "0.69322354", "0.69271684", "0.69254225", "0.68931365", "0.6889386", "0.68624383", "0.6860795", "0.6860139", "0.6856626", "0...
0.0
-1
las respuestas a los metodos asincronos varian dependiendo de muchos factores no se puede conocer cual sera el orden de las respuestas de las peticiones
function onError(id){ console.log(`Error obteniendo el personaje ${id}`) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resumen_estado_nave(){\n this.ajuste_potencia();\n if (typeof this._potencia_disponible !== \"undefined\"){\n if (this._potencia_disponible){\n let estado_plasma = \"\";\n for (let i = 0; i < this._injectores.length; i++) {\n estado_plasma +...
[ "0.63467246", "0.6329728", "0.6289834", "0.6158661", "0.61199725", "0.6118748", "0.6036517", "0.6013578", "0.6010828", "0.5998118", "0.59654605", "0.59357285", "0.5904941", "0.5893277", "0.5871339", "0.58632064", "0.5855653", "0.5843758", "0.58236647", "0.5801677", "0.5768993...
0.0
-1
Public Methods Initialize Game Variables and objects
Start() { //console.log ("GAME OVER YEAH"); this._background = new objects.GameObject(this.assetManager, "backgroundlv3"); this._background.x = 1000; this._background.y = -10; this.addChild(this._background); this._overLabel = new objects.Label("GA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init () {\r\n initAllVars();\r\n gameLoop();\r\n}", "function initGame() {\n players = [];\n teams = [];\n orbs = [];\n bases = [];\n createOrbs(defaultOrbs);\n createBases(defaultBases);\n}", "function initVariables() {\n enemies = [];\n Scene = this;\n eActive = 0;\n wAct...
[ "0.78324926", "0.7809384", "0.7805961", "0.7628414", "0.7607137", "0.7584114", "0.75663465", "0.7522725", "0.7431061", "0.74220276", "0.74190694", "0.73449355", "0.73330224", "0.73282194", "0.72951114", "0.7287207", "0.7238607", "0.7215046", "0.7211539", "0.7185936", "0.71847...
0.0
-1
This is where the fun happens
Main() { // add the welcome label to the scene this.addChild(this._overLabel); // add the backButton to the scene this.addChild(this._backButton); // event listeners this._backButton.on("click", this._backButtonClick); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fn() {\n\t\t }", "private internal function m248() {}", "private public function m246() {}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion (){}", "static private internal function m121() {}", "function wa(){}", "function fun() { }", "...
[ "0.6406158", "0.6224045", "0.6218049", "0.621337", "0.621337", "0.621337", "0.6213218", "0.6111896", "0.60149497", "0.6014524", "0.600519", "0.59688735", "0.596559", "0.58677924", "0.58527124", "0.58433354", "0.58433354", "0.58433354", "0.583774", "0.58215934", "0.58048326", ...
0.0
-1
create student creating method: POST path: /v2/student
static async create(req, res) { try { const { name } = req.body const student = await studentService.create({name}) // create response const response = { success: true, data: { student, }, } res.send(response) } catch (e) { res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "create(req, res) {\n studentDAO.createStudent(db, req.body.student)\n .then(() => {\n res.sendStatus(201)\n })\n .catch(err => {\n console.error(err)\n res.sendStatus(404)\n })\n }", "async function createNewStudent(req, res) {\n try {\n let transactionID;\n if...
[ "0.7993325", "0.75852776", "0.7510655", "0.72480917", "0.6889968", "0.68085957", "0.67110616", "0.66198933", "0.6569031", "0.6558627", "0.6545246", "0.6506594", "0.6475338", "0.6399945", "0.637762", "0.6338255", "0.62842244", "0.6258052", "0.61577725", "0.6076033", "0.6053260...
0.7570809
2
findList student list method: GET path: /v2/student
static async findList(req, res) { try{ const { name } = req.query // get student list const students = await studentService.findList({keyword:name}) // create response const response = { success: true, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "list(req, res) {\n studentDAO.getStudents(db)\n .then(students => {\n res.status(200).json(students)\n })\n .catch(err => {\n console.error(err)\n res.sendStatus(404)\n })\n }", "function getStudentList() {\n return studentList.requestCall().$promise;\n ...
[ "0.80095", "0.7465916", "0.7459175", "0.7161483", "0.7041731", "0.66751295", "0.66230476", "0.6588106", "0.6550937", "0.6516631", "0.64665663", "0.6442942", "0.6439868", "0.6428251", "0.63840604", "0.63696206", "0.63640153", "0.6339014", "0.63347596", "0.6334591", "0.63014466...
0.7701293
1
update student update method: PATCH path: /v2/student/:id
static async update(req, res) { try { const { id } = req.params const { changeName } = req.body const updateStudent = await studentService.updateById(id,{ name:changeName }) // create response const response = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(req, res) {\n studentDAO.updateStudent(db, req.body.student)\n .then(() => {\n res.sendStatus(200)\n })\n .catch(err => {\n console.error(err)\n res.sendStatus(404)\n })\n }", "async function updateStudent(req, res) {\n const { id } = req.params;\n const { fi...
[ "0.78311324", "0.73726296", "0.7287851", "0.7133024", "0.6982313", "0.6789758", "0.66990525", "0.6505708", "0.64819443", "0.6472313", "0.6448333", "0.64393044", "0.63878626", "0.6311457", "0.62716275", "0.62611276", "0.62584704", "0.624689", "0.6228287", "0.61914194", "0.6171...
0.70112306
4
delete student deleting method: DELETE path: /v2/student/:id
static async delete(req, res) { try { const { id } = req.params console.log('here') // deleting student info await studentService.Deleting(id) // create response const response = { success: true, } res.send(response) } catch (e) { res.send(e) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "delete(req, res) {\n studentDAO.deleteStudent(db, req.params.studentID)\n .then(() => {\n res.sendStatus(204)\n })\n .catch(err => {\n console.error(err)\n res.sendStatus(404)\n })\n }", "function deleteStudent(id) {\n axios.delete(`http://localhost:3456/users/${id...
[ "0.8306057", "0.8128218", "0.80898577", "0.7686718", "0.75390553", "0.74461824", "0.731574", "0.71435773", "0.70145315", "0.6981698", "0.6880085", "0.6869581", "0.68195206", "0.67674464", "0.6677391", "0.65986204", "0.6598313", "0.6574773", "0.6546021", "0.6540827", "0.651922...
0.7806187
3
Exibe mensagem em um elemento de ID msg
function displayMessage(msg) { $('#msg').bind("DOMSubtreeModified", function () { window.setTimeout(function () { $(".alert").fadeTo(500, 0).slideUp(500, function () { $(this).remove(); document.getElementById("msg").classList.toggle("frente"); }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function msg(id,message){\n $(id).text(message).show;\n }", "function msg(id,message){\n $(id).text(message).show;\n }", "function message(retorno){\n\n if(retorno[0] == 'msg'){\n let msg = $('<div/>').addClass('alert alert-'+retorno[1]+' alert-dismissible fadeshow col-md-12');\n msg...
[ "0.67785627", "0.67785627", "0.66702545", "0.6623197", "0.6550635", "0.6525292", "0.65234065", "0.647004", "0.64675045", "0.646357", "0.6443506", "0.63805664", "0.63767254", "0.63648856", "0.63370377", "0.63216984", "0.6319863", "0.63133657", "0.6303444", "0.62956524", "0.628...
0.0
-1
Leave className with the inherited value of "Field" so that the UI knows how to render (hide) it. FUTURE: we may want to define something like a HiddenField that the we can use to represent a Field that should not be rendered. className = 'ComponentDefinitionField';
_setValue(value) { if (value !== null) { // Also allow for "componentName" as "component" is a MSON keyword and results in compilation value = { ...value, component: value.component ? value.component : value.componentName, componentName: undefined, }; } super._setV...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FormField(props) {\n var children = props.children,\n className = props.className,\n control = props.control,\n disabled = props.disabled,\n error = props.error,\n inline = props.inline,\n label = props.label,\n required = props.required,\n type = props.type,\n ...
[ "0.6696293", "0.6650529", "0.66316557", "0.6600599", "0.65946496", "0.6562012", "0.6559794", "0.65485144", "0.65387094", "0.64775085", "0.64775085", "0.6462746", "0.6456208", "0.6290843", "0.6252875", "0.61701375", "0.6138843", "0.61197555", "0.5960287", "0.59327054", "0.5896...
0.0
-1
This is so the stack trace the developer sees is one that's closer to their code (because async stack traces are hard to follow).
function copyStackTrace(target, source) { target.stack = source.stack.replace(source.message, target.message) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "stackTraceRequest(response, args) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const connection = this._connections.get(args.threadId);\n if (!connection) {\n throw new Error('Unknown thread ID');\n }\n\n ...
[ "0.6251372", "0.5927782", "0.5920466", "0.57711494", "0.5671949", "0.5654079", "0.56528795", "0.5620678", "0.5596962", "0.5500262", "0.5483393", "0.5478307", "0.54399985", "0.543255", "0.5430147", "0.5430147", "0.5430147", "0.5430147", "0.54221493", "0.54177374", "0.5414692",...
0.0
-1
Functions Game entry point function
function startGame() { displayCharacterStats(null); return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startGame() { }", "function HostGame() {\n\t// Your code goes here for hosting a game\n\tprint(\"Complete this method in Multiplayer.js\");\n}", "function startgame() {\t\r\n\tloadImages();\r\nsetupKeyboardListeners();\r\nmain();\r\n}", "function main(mainFunction){\n game.start=mainFunction;\n}", ...
[ "0.7545208", "0.7499957", "0.74931246", "0.7300459", "0.7290976", "0.72854143", "0.71937346", "0.71820486", "0.7159608", "0.7143002", "0.7116499", "0.71024877", "0.7080403", "0.7053688", "0.704945", "0.7039352", "0.70375526", "0.7033088", "0.70289296", "0.7019306", "0.6992637...
0.6714283
55
Displays stats on the character panel using the provided character object array. Pass in null if using the global character array
function displayCharacterStats(charactersArray) { var loopOnThisArray = null; // As default, use the all character objects array if(charactersArray === null) { loopOnThisArray = _allCharacterObjects; } else { loopOnThisArray = charactersArray; } for(var i=0; i<loopOnThisArray.length; i++) { var currentObj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function statWindow (char) { //Display character stats during the fight\n return \"Health Point: \" + char.hp +\n \"<br />Strength: \" + char.str +\n \"<br />Agility: \" + char.agi +\n \"<br />Intelligence: \" + char.int;\n}", "function characterDisplay() {\n //display the first character on the...
[ "0.6586077", "0.59921485", "0.59882236", "0.5931266", "0.58841133", "0.58657044", "0.5760587", "0.57466507", "0.5720327", "0.57056606", "0.5684332", "0.5634453", "0.56099284", "0.5606403", "0.5576237", "0.5557161", "0.5546815", "0.5544518", "0.5534365", "0.5508195", "0.549358...
0.7393369
0
This function is used to determine if a clicked character needs to be placed in the selected fighter section or the defender section
function characterClicked(characterElement, characterObject) { // Check if the global var used to hold the selected figther is undefined. // This is how it will be determined if the user has not selected a fighter. if(typeof _selectedFighterObj === 'undefined') { $('#selected-character').empty(); /* Remove oran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function whatCharacterIsClicked () {\n $ ('#stats0, #stats1, #stats2, #stats3').one ('click', function (e) {\n if (this.id === 'stats0') {\n console.log ('clicked geralt!');\n characters.geralt.isSelected = true;\n if (characters.geralt.isSelected) {\n $ ('#selected-character-...
[ "0.6448205", "0.6444244", "0.643901", "0.63428295", "0.6340848", "0.6323057", "0.6315315", "0.63141906", "0.6247491", "0.6233183", "0.6212816", "0.61531705", "0.614411", "0.61100817", "0.6082671", "0.60633725", "0.60295916", "0.60278696", "0.59679466", "0.59283245", "0.589497...
0.68340385
0
Loops through the character array object and if the objecxt has not been selected by the user as their fighter it will place it in the available enemies section of the page
function populateAvailableEnemies() { var elementIdCounter = 1; for(var i=0; i<_allCharacterObjects.length; i++) { var currentObject = _allCharacterObjects[i]; // Only display the remaining characters after the user has selected their fighter. // If a characters has been defeated, it should not be displayed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderEnemy(array = enemySelect) {\n var $enemy = $fightCont.querySelectorAll('article');\n\n $enemy.forEach(enemy => {\n let index = [...$enemy].indexOf(enemy);\n enemy.setAttribute('data-name', array[inde...
[ "0.6931624", "0.68950075", "0.6879311", "0.68061537", "0.6724455", "0.66921586", "0.66376555", "0.66274995", "0.66137505", "0.658942", "0.65200186", "0.64947206", "0.64899683", "0.64831233", "0.6464674", "0.6436981", "0.6426125", "0.63955873", "0.63757557", "0.63614476", "0.6...
0.740473
0
Shifts available enemy panels to ensure no empty slots are displayed
function shiftAvailableEnemies() { var elementIdCounter = 1; for(var i=0; i<_allCharacterObjects.length; i++) { var currentObject = _allCharacterObjects[i]; // Only work with characters that have not been defeated yet if(!currentObject.selectedAsDefender && !currentObject.selectedAsFighter && !currentObject.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function UpdateTeamPanel( teamPanel )\n{\n\t//$.Msg(\"function UpdateTeamPanel( teamPanel )\")\n\t// Get the id of team this panel is displaying\n\tvar teamId = teamPanel.GetAttributeInt( \"team_id\", -1 );\n\tif ( teamId <= 0 )\n\t\treturn;\n\t\n\t// Add all of the players currently assigned to the team \n\tvar t...
[ "0.61971694", "0.5918899", "0.57378733", "0.57211155", "0.56926537", "0.56553817", "0.56282157", "0.56237507", "0.56115806", "0.5570839", "0.55528086", "0.55326307", "0.55279887", "0.552685", "0.55071163", "0.5459602", "0.5430517", "0.5428771", "0.5414088", "0.54130447", "0.5...
0.64452505
0
Checks if the user has won the current match
function hasUserWonMatch() { if(_selectedFighterObj.healthPoints > 0 && _selectedDefenderObj.healthPoints <= 0) { return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkWin() {\n if (userScore === numToMatch) {\n wins++;\n $(\"#wins\").text(\"Success: \" + wins);\n reset();\n } else if (userScore > numToMatch) {\n losses++\n $(\"#losses\").text(\"Fails: \" + losses);\n reset();\n ...
[ "0.7801421", "0.7309871", "0.71919495", "0.716051", "0.710999", "0.70884115", "0.70760274", "0.7071122", "0.70683956", "0.7057451", "0.70551", "0.7054566", "0.69959605", "0.6974767", "0.69657546", "0.6960964", "0.6935255", "0.6914638", "0.69015336", "0.689189", "0.6881552", ...
0.72919714
2
Checks if the user has defeated all enemies and won the game
function hasUserWonGame() { if(_selectedFighterObj.healthPoints > 0) { for(var i=0; i<_availableEnemyObjects.length; i++) { var curObj = _availableEnemyObjects[i]; // If any available enemies with hasBeenDefeated set to true exist // the user has not won the game yet, so don't continue checking if(!curO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isGameWon () {\n console.log('checking if you won the game')\n return gameState.enemiesLeft === 0\n}", "enemyAlive() {\n for(let i = 0; i < enemies.length; i++) {\n if (enemies[i].health <= 0) {\n enemies[i].isEnemyAlive = false;\n }\n }\n }", "function checkIsGameOver () {\n...
[ "0.71408534", "0.710962", "0.69808733", "0.68700004", "0.6799286", "0.67891705", "0.6763533", "0.6742013", "0.6733168", "0.6694483", "0.6649456", "0.66450936", "0.66427976", "0.65770936", "0.65769666", "0.6528301", "0.65247834", "0.65217054", "0.65204835", "0.6518183", "0.649...
0.8025693
0
Checks if the user has lost
function hasUserLost() { if(_selectedFighterObj.healthPoints <= 0 && _selectedDefenderObj.healthPoints > 0) { return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function userLoses() {\n userObject.losses++;\n databaseModify.update();\n userScreen.lose();\n setTimeout(function() {\n game.newRound();\n }, 2000);\n }", "function hasLost(){\n if (total_score > targetNumber){\n loss++;\n $(\".loss\").text(loss);\n ...
[ "0.7101126", "0.66929924", "0.6660236", "0.6635055", "0.6616762", "0.65240574", "0.6379032", "0.6379032", "0.6359355", "0.6346106", "0.62920725", "0.62859005", "0.62403256", "0.6230732", "0.61999", "0.61372805", "0.6106425", "0.6074419", "0.6004691", "0.5971839", "0.5958027",...
0.7129847
0
For those times when a draw is all you have left
function isMatchDraw() { if(_selectedFighterObj.healthPoints <= 0 && _selectedDefenderObj.healthPoints <= 0) { return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkDraw() {\n return playerOSelections.length + playerXSelections.length >= cells.length\n}", "function gameIsDraw() {\n let x = 0;\n\n while (x <= 6) {\n if (spaceAvailable(x)) {\n return false\n } else {\n x++;\n }\n }\n return true;\n }", "_checkTurnEn...
[ "0.65541214", "0.6416424", "0.64105505", "0.63819104", "0.63304174", "0.62957644", "0.6275516", "0.62610275", "0.61680996", "0.6116127", "0.6101952", "0.6081701", "0.6068541", "0.606795", "0.604826", "0.60451233", "0.60414296", "0.60194004", "0.6008805", "0.6005619", "0.60030...
0.0
-1
Clears the defender panel
function clearDefender() { _selectedDefenderObj.hasBeenDefeated = true; $('#enemy-selected').empty(); $('#vs-text').fadeOut('slow'); return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset(){\n $('#selection-area').empty();\n $('#species-info').empty().css('background-color', panelColor);\n $('#last-dropdown-area').empty();\n $('.counties').css('fill', mapColor);\n $('.labels').css('fill', panelColor);\n }", "function clear() {\n var resetPanel...
[ "0.7262869", "0.72122145", "0.70728207", "0.6852688", "0.6821505", "0.6749717", "0.6749717", "0.67479163", "0.67334247", "0.6715688", "0.67101324", "0.6688428", "0.66423345", "0.66423345", "0.66423345", "0.66423345", "0.66423345", "0.66423345", "0.66423345", "0.66423345", "0....
0.6732006
9
Ends game based on if user has won or lost and will add the restart button to the DOM
function endTheGame(isWinner, isDraw) { var attackMessages = $('#attack-messages'); var audioElementId; var message; if(isWinner) { audioElementId = '#the-force-is-strong'; message = 'You have defeated all your enemies. Well done!'; } else if(isDraw) { audioElementId = '#doomed'; message = 'It\'s a dr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endGame() {\n disableButtons();\n if (isWinner) {\n msgEl.innerHTML = `Congratulations! You're memory is too great for this game!\n Press restart and play again!`;\n yahoo.play();\n } else {\n msgEl.innerHTML = `Wrong answer! Press restart to try again!`;\n }\n}", "function endGame(){\n ...
[ "0.78385705", "0.7771051", "0.7686845", "0.7549129", "0.75257474", "0.7519733", "0.7489465", "0.7463631", "0.7449758", "0.7437524", "0.7432137", "0.7416682", "0.7410339", "0.74035007", "0.7401072", "0.7389879", "0.73725164", "0.7365047", "0.736461", "0.73488843", "0.73415536"...
0.0
-1
Definition for the List controller. quizMetrics and dataService are two services that are created in js/factories/QuizFact.js,js/factories/DataService.js and filterFilter to filter the data. respectively.
function ListController(DataService,filterFilter,Quizfact){ var v=this; v.show=show; v.dataservice=DataService; v.Quizfact=Quizfact; // Controllers reference to the Quiz data from factory function show(index){ //simple function to show the quiz according to the choice of user Quizfact.getbyi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ListController(quizMetrics, DataService){\n var vm = this;\n\n /*\n * The interface for the controller. The below code shows all the\n * variables that are available from inside the view. References to\n * named functions are used instead of inline anon functions. Thi...
[ "0.8286367", "0.7292531", "0.709304", "0.6804583", "0.64890003", "0.561684", "0.52499783", "0.5121055", "0.5093154", "0.49751672", "0.49088675", "0.4874245", "0.4837548", "0.47754365", "0.47480756", "0.4742511", "0.47277224", "0.47191238", "0.47154", "0.4714303", "0.4713005",...
0.75113446
1
Controllers reference to the Quiz data from factory
function show(index){ //simple function to show the quiz according to the choice of user Quizfact.getbyid(index); //Get the data by category of quiz }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function QuizCtrl($scope, Quiz) {\n $scope.currentQuiz = Quiz.getCurrentQuiz();\n $scope.completedQuiz = Quiz.getCompletedQuiz();\n}", "function ListController(DataService,filterFilter,Quizfact){\n\n var v=this;\n v.show=show;\n v.dataservice=DataService;\n v.Quizfact=Quizfact; // Controllers r...
[ "0.7406928", "0.71021545", "0.68651974", "0.6786786", "0.6759986", "0.6549952", "0.6330803", "0.63077694", "0.6299179", "0.6258557", "0.6258557", "0.6258557", "0.621766", "0.6200752", "0.6191595", "0.6163759", "0.6149652", "0.6078733", "0.60767794", "0.6045736", "0.6044599", ...
0.6381052
6
auxiliary function to generate a fresh id
function genID() { return (+new Date() + Math.floor(Math.random() * 999999)).toString(36); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeId() {\n return \"_\" + (\"\" + Math.random()).slice(2, 10); \n }", "generateId() {\n return'id' + Date.now().toString() + Math.floor(Math.random(1000)).toString();\n }", "function makeId() {\n return \"_\" + Math.random().toString(36).substr(2, 9);\n }", "function generateId() ...
[ "0.85290146", "0.84441346", "0.8415433", "0.83941483", "0.8389886", "0.8385193", "0.8368912", "0.8338345", "0.8334947", "0.83324146", "0.8320642", "0.8313126", "0.8276806", "0.82765216", "0.82765216", "0.8268396", "0.825307", "0.825307", "0.82421416", "0.82301587", "0.8228962...
0.7991533
43
endregion region project management
function getProjects() { var req = new XMLHttpRequest(); if (sessionStorage.getItem("userlevel") == 3) { req.open("GET", "http://34.89.108.223/projects/"); } else { req.open("GET", "http://34.89.108.223/projects/aproved"); } req.addEventListener("load", function() { var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getcurrentprojects() { }", "function initializeProjects() {\n displayProjects();\n}", "function makeProject(tittle, synopsis, tumbnailURL, numbLikes, numbViews, dateOri, dateModi) {\n let project = {\n tittle: tittle,\n synopsis: synopsis,\n tumbnailURL: tumbnailURL,...
[ "0.5880251", "0.571025", "0.5675675", "0.56490326", "0.5646721", "0.5590158", "0.55780584", "0.5563695", "0.5549018", "0.54830307", "0.5427465", "0.5423446", "0.54081255", "0.539802", "0.5389966", "0.53611344", "0.5294967", "0.5271368", "0.5259999", "0.5258538", "0.5231542", ...
0.0
-1
endregion region task management
function getTasks(id) { var req = new XMLHttpRequest(); req.open("GET", "http://34.89.108.223/projects/"+id); req.addEventListener("load", function() { var tasks = JSON.parse(this.responseText); console.log(tasks); document.getElementById('ProjetNameTasks').innerHTML = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createTask(v,t){\r\n \r\n }", "async prepareTask() {\n await super.prepareTask.apply(this, arguments);\n\n if(!this.task) {\n return;\n }\n\n if(this.options.task.cleanUpStorageInterval) {\n await this.task.add('cleanUpStorage', this.options.task.cleanUpStorag...
[ "0.71656156", "0.6959767", "0.6917443", "0.6899377", "0.68982655", "0.6860849", "0.6804186", "0.66917163", "0.66467744", "0.6635498", "0.66211724", "0.6576763", "0.65294915", "0.6511116", "0.64374185", "0.6396885", "0.6390617", "0.6384887", "0.6365631", "0.63613784", "0.63253...
0.0
-1
User starts running, record start time and inital position
start (lat, lon) { this._creationTime = Date.now() this._pastPos.push([lat, lon, this._creationTime]) this._pastPos.shift() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function recordStartTime() {\n\tthis._startAt = process.hrtime()\n\tthis._startTime = new Date()\n}", "function recordStartTime () {\n this._startAt = process.hrtime()\n this._startTime = new Date()\n}", "function recordStartTime () {\n this._startAt = process.hrtime()\n this._startTime = new Date()\n}", ...
[ "0.69227004", "0.6897106", "0.6897106", "0.6897106", "0.6897106", "0.6897106", "0.68508434", "0.6395741", "0.63736564", "0.6309195", "0.62768996", "0.62505126", "0.6156987", "0.6136817", "0.6133831", "0.6130032", "0.60509056", "0.6011159", "0.5963176", "0.5963176", "0.5963176...
0.5657195
85
Return a boolean stating if the user has started running
hasStarted () { return Boolean(this._pastPos[this._pastPos.length-1]) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isRunning() {\n return running;\n }", "function isSomRunning() {\n return isRunning;\n}", "async is_running(name) {\n let ref = this;\n\n let pids = await ref.find_pids(name);\n \n if (pids.length == 0) {\n return false;\n } else {\n retu...
[ "0.7578235", "0.7188241", "0.69852996", "0.6928734", "0.68857735", "0.6884133", "0.6860606", "0.6808148", "0.67779684", "0.66643876", "0.65673465", "0.643102", "0.6262386", "0.62319416", "0.6224993", "0.60003006", "0.5997647", "0.5997647", "0.5984656", "0.5953958", "0.593941"...
0.0
-1
Adds a new GPS position of the user Pre: hasStarted()
addPos (lat, lon) { this._pastPos.push([lat,lon,Date.now()]) this._pastPos.shift() const length = this._pastPos.length let extraDist = this._getDistanceFromLatLonInKm(this._pastPos[length-2][0], this._pastPos[length-2][1], this._pastPos[length-1][0], this._pastPos[length-1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function succes_gps(position){\n\n user_pos = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n marker.setPosition(user_pos);\n marker.setMap(map);\n\n\n}", "start (lat, lon) {\r\n this._creationTime = Date.now()\r\n this._pastPos.push([lat, lon, this._creationTim...
[ "0.6674827", "0.654885", "0.6409145", "0.64089656", "0.6395543", "0.6298758", "0.6254533", "0.6227879", "0.6171552", "0.6157663", "0.61542934", "0.61377054", "0.6129661", "0.60826135", "0.607311", "0.6055076", "0.6047823", "0.6032374", "0.60276747", "0.6021728", "0.6007427", ...
0.6636987
1
Return a boolean stating whether there are enough data points to generate status
isStatusReady () { return this._pastPos[0] !== undefined }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isFull(){\n let isFull = true;\n for(let i=0; i<this.data.length; i++){\n if(typeof this.data[i] === \"undefined\"){\n isFull = false;\n }\n }\n return isFull;\n }", "isReady() {\n if ((newDataset.isEmpty()) && (this.addresses.length == t...
[ "0.68891346", "0.6792006", "0.65844345", "0.65219146", "0.63177186", "0.6288775", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647", "0.6190647",...
0.0
-1
Returns an object that contains the newest status Pre: isStatusReady() (=> hasStarted())
getStatus () { const length = this._pastPos.length const timeDiff = (this._pastPos[length-1][2] - this._pastPos[0][2]) / 1000 const pace = (timeDiff / 60) / ((this._sum(this._pastDist)) / 1000) let quality; //CUSTOMIZABLE, pace quality depends on GPS ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStatus() {\n // TODO: perhaps remove this if no other status added\n return status;\n }", "isStatusReady () {\r\n return this._pastPos[0] !== undefined\r\n }", "function getStatus() {\n return status;\n }", "status() {\n if (this.statusListene...
[ "0.71136755", "0.70932", "0.7039357", "0.70252496", "0.68133295", "0.65478635", "0.6536541", "0.6496666", "0.6491195", "0.6491195", "0.6491195", "0.6491195", "0.6491195", "0.6491195", "0.6491195", "0.6491195", "0.6491195", "0.64864415", "0.64864415", "0.64864415", "0.64864415...
0.57219344
80
Helper functions that sums up the values in an array
_sum (arr) { return arr.reduce((acc,val) => acc+val) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sumArr(array){\n\n}", "function summArray(array){\n var tot = 0;\n for(var i = 0; i < array.length; i++){\n tot += array[i]\n }\n return tot\n}", "function sum_array(values) {\n return values.reduce(function(acc, a) { return acc + a; }, 0);\n}", "function sumArray(array) {\n ...
[ "0.81573987", "0.8087515", "0.8068667", "0.804706", "0.8041344", "0.80379534", "0.80370486", "0.7976055", "0.79660356", "0.7956189", "0.7948729", "0.7945843", "0.7945618", "0.7943738", "0.7940244", "0.79375184", "0.79363316", "0.79222035", "0.791969", "0.7917836", "0.7910477"...
0.76099163
82
Helper function that implements the Haversine formula
_getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) { var R = 6371; // Radius of the earth in km var dLat = this._deg2rad(lat2-lat1); var dLon = this._deg2rad(lon2-lon1); var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(this._deg2rad(lat1)) * Math.cos(this._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function haversine() \n {\n //Se convierte a radianes\n var radians = Array.prototype.map.call(arguments, function(deg) { return deg/180.0 * Math.PI; });\n var lat1 = radians[0], lon1 = radians[1], lat2 = radians[2], lon2 = radians[3];\n ...
[ "0.81127024", "0.7939667", "0.7732166", "0.74988747", "0.7399778", "0.73967636", "0.7199839", "0.70759565", "0.69756156", "0.6896953", "0.6877247", "0.6868854", "0.68352664", "0.6743758", "0.6658177", "0.6635493", "0.6634841", "0.65368515", "0.627155", "0.6238237", "0.6119806...
0.0
-1
A helper function that returns the standardized ghost DNA The function returs an array of segment objects, which each have these properties pace: The pace of the segment; distance: The distance of the segment; startTime: The time when the segment starts; => this allows quick checking of which segment we are in startDis...
_standardize (args) { const output = [] const firstSeg = { pace: typeof(args[0]) === "number" ? args[0] : args[0][0], distance: typeof(args[0]) === "number" ? 1000 : args[0][1], startTime: 0, startDistance: 0 } output.push(firstSeg)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "start () {\r\n this._startTime = Date.now()\r\n\r\n const lastSeg = this._dna[this._dna.length-1]\r\n this._totalRunningTime = lastSeg.startTime + lastSeg.pace * 60 / 1000 * lastSeg.distance\r\n }", "_getDistance (timeElapsed) {\r\n const currentSeg = this._dna[this._getSegIndex(ti...
[ "0.5408212", "0.5137196", "0.5063165", "0.49786946", "0.49178812", "0.47542664", "0.47273538", "0.47202685", "0.47068778", "0.46814325", "0.4666201", "0.4647113", "0.46454808", "0.4644378", "0.46122155", "0.45751432", "0.45627952", "0.4560372", "0.45573923", "0.4553909", "0.4...
0.57026345
0
Function to let the ghost start running Warning: calling start() multiple times will update the starting and ending time to the newest call
start () { this._startTime = Date.now() const lastSeg = this._dna[this._dna.length-1] this._totalRunningTime = lastSeg.startTime + lastSeg.pace * 60 / 1000 * lastSeg.distance }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function start() {\n\t\t\tsetTimeout(startUp, 0);\n\t\t}", "function start() {\n //Currently does nothing\n }", "function start(){\n\t\n}", "function start() {\n\n}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "function startTimer() {\n if(sta...
[ "0.71867996", "0.7012416", "0.6993934", "0.69915193", "0.6893526", "0.6893526", "0.6893526", "0.6893526", "0.6893526", "0.6893526", "0.68207306", "0.68010116", "0.677876", "0.677876", "0.677876", "0.677876", "0.677876", "0.677876", "0.677876", "0.677876", "0.677876", "0.677...
0.0
-1
Returns a boolean stating if the ghost has started running
hasStarted () { return Boolean(this._startTime) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isRunning() {\n return this._process !== null;\n }", "function isRunning() {\n return running;\n }", "function isRunning() {\n return (offset >= 0);\n }", "function isSomRunning() {\n return isRunning;\n}", "async is_running(name) {\n let ref = this;\n\n let pids = await ...
[ "0.77453065", "0.75005704", "0.72064084", "0.7197347", "0.7096409", "0.7046291", "0.7018855", "0.6862193", "0.68051344", "0.6711778", "0.66963345", "0.65407014", "0.6286661", "0.6269588", "0.62256473", "0.618512", "0.61516696", "0.6083056", "0.6081094", "0.6080045", "0.606315...
0.6578254
11
Returns a boolean stating if the ghost has finished the scheduled run Pre: hasStarted()
hasEnded () { return this._getTime() > this._totalRunningTime }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isFinished (){\n\t\treturn this.status !== null && this.finishDelay < 0;\n\t}", "hasStarted () {\r\n return Boolean(this._startTime)\r\n }", "isComplete() {\n if (!this.endTime) return false;\n if (this.now() > this.endTime) {\n return true;\n }\n else {\n ...
[ "0.7337497", "0.7276782", "0.7108792", "0.70391214", "0.7019257", "0.6963953", "0.68390644", "0.6812481", "0.67032593", "0.66999537", "0.6630543", "0.66002744", "0.659675", "0.6450692", "0.6422291", "0.6403952", "0.6403602", "0.6397292", "0.63711536", "0.6354607", "0.6305759"...
0.7281502
1
Return status of the ghost Pre: hasStarted(), !hasEnded()
getStatus () { const timeElapsed = this._getTime() return new Status(this._dna[this._getSegIndex(timeElapsed)].pace, "good", this._getDistance(timeElapsed), timeElapsed) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isStatusReady () {\r\n return this._pastPos[0] !== undefined\r\n }", "static async checkStatusAndStartOrStop() {\n const status = await this.checkStatus();\n\n const { canTrack, isRunning } = status;\n\n if (canTrack && !isRunning) {\n this.start();\n }\n\n if (!canTrack && isRunnin...
[ "0.66756624", "0.6618493", "0.6618493", "0.6361507", "0.6338092", "0.62803626", "0.6135936", "0.61244726", "0.6123503", "0.60873747", "0.60621583", "0.60606426", "0.6022404", "0.602004", "0.6004747", "0.59290284", "0.59049815", "0.58980584", "0.5891628", "0.5856981", "0.58499...
0.58971447
18
Helper that gets the time elapsed in seconds since start time
_getTime () { return (Date.now() - this._startTime) / 1000 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_elapsed_time(start_time) {\n\tnow = new Date();\n\treturn (now.getTime() - start_time) / 1000;\n}", "function seconds_elapsed() {\n var date_now = new Date();\n var time_now = date_now.getTime();\n var time_diff = time_now - startTime;\n var seconds_elapsed = Math.floor(time_diff / 1000)...
[ "0.8366684", "0.82683074", "0.78186387", "0.7403871", "0.7398365", "0.73376024", "0.73263013", "0.7193586", "0.7165474", "0.71235955", "0.710827", "0.71007437", "0.71007437", "0.71007437", "0.7043955", "0.70373154", "0.7034301", "0.6982468", "0.69753057", "0.6962504", "0.6946...
0.6932647
21
Helper that gets the distance travelled by ghost so far in meters, extrapolated by pace in segments
_getDistance (timeElapsed) { const currentSeg = this._dna[this._getSegIndex(timeElapsed)] const distInThisSeg = (timeElapsed - currentSeg.startTime) / (currentSeg.pace * 60 / 1000) return currentSeg.startDistance + distInThisSeg }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "GetDistanceToPoint() {}", "get distance() {}", "function dist() {\n let temp = Math.floor(\n findDistance(coord.lat, goal.lat, coord.long, goal.long)\n );\n\n return temp;\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math....
[ "0.6870834", "0.6653191", "0.660793", "0.65477693", "0.65477693", "0.65477693", "0.64816695", "0.64668554", "0.63961", "0.63945323", "0.6377033", "0.6310581", "0.6288244", "0.6249313", "0.6249116", "0.62222385", "0.62094706", "0.6199964", "0.61555", "0.6138109", "0.613254", ...
0.6065992
27
Gives the index of the current segment we are in given time elapsed. Will return the last segment still if race has ended
_getSegIndex (timeElapsed) { let i = this._cachedIndex // Invariant a[0..i].startTime < timeElapsed while (i+1 < this._dna.length && this._dna[i+1].startTime < timeElapsed) i++ this._cachedIndex = i return i }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function currentTimeSegment(timeFrame) {\n\t\tvar step = $scope.timeSegmentsList[0].segmentRange;\n\t\tvar indexInTimeSegments = Math.floor(timeFrame / step);\n\t\tif (indexInTimeSegments == $scope.timeSegmentsList.length) indexInTimeSegments--;\n\t\treturn indexInTimeSegments;\n\t}", "findClosestSegment(current...
[ "0.6530748", "0.62904054", "0.56817245", "0.56663316", "0.565456", "0.55698746", "0.55588627", "0.5498858", "0.5380337", "0.5219608", "0.5196945", "0.5044724", "0.50200975", "0.5010634", "0.49841124", "0.49836907", "0.49546072", "0.4917946", "0.48201102", "0.4810824", "0.4792...
0.79017735
0
acc = acc0 ... 1, so acc0 of times
function forEvery(ms, acc, func) { if (acc > 0) { func() setTimeout(() => forEvery(ms, acc-1, func), ms) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countUserTrials() {\n //equals to acc += 1\n acc = acc + 1;\n counterEl.innerHTML = acc;\n}", "function acc(func, initial) {\n return function (...args) {\n return args.reduce((result, curr, idx) => {\n return func(result, curr, idx)\n }, initial);\n };\n}", "fu...
[ "0.5716909", "0.5675588", "0.5524191", "0.5462597", "0.54602253", "0.5436812", "0.54248244", "0.53933364", "0.53722984", "0.53363764", "0.531003", "0.52995384", "0.527661", "0.527614", "0.52728266", "0.5225585", "0.52114964", "0.5211127", "0.52065545", "0.52059656", "0.520596...
0.6330182
0
This section manages the 'twisty' text on the bottom of the page
function toggleTwisty(tid, ttxt, dashed) { var feature = $('#' + ttxt); var twisty = $('#' + tid); var list = $('#' + dashed); if (twisty.hasClass('twisty-right')) { twisty.removeClass('twisty-right'); twisty.addClass('twisty-down'); feature.css('top',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bottomText() {\n\t// Clear last & set color\n\tctx.clearRect(0, gameHeight, gameWidth, 300);\n\tconst levelTitle = levelText();\n\t\n\tctx.fillStyle = levelTitle.color;\n\tctx.font = \"24px 'Press Start 2P'\";\n\n\t// Level title\n\tctx.textAlign = 'left';\n\tctx.fillText(levelTitle.text, 10, gameHeight +...
[ "0.57923436", "0.57440466", "0.5686415", "0.5612021", "0.55840355", "0.55651444", "0.5446187", "0.54148465", "0.54043907", "0.5403776", "0.5361519", "0.53524745", "0.53375345", "0.5289672", "0.527958", "0.5276431", "0.52464116", "0.52211887", "0.5217395", "0.52107626", "0.520...
0.0
-1
Primary function to be carried out when the command is executed (after argument validation). Should be overriden by child class
operation( context, args ) { return {ok: true, context, args} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleCommand() {}", "function commandTrigger() {\n var line = promptText;\n if (typeof config.commandValidate == 'function') {\n var ret = config.commandValidate(line);\n if (ret == true || ret == false) {\n if (ret) {\n ...
[ "0.7185477", "0.65897137", "0.6556066", "0.6542205", "0.6303805", "0.6207481", "0.6155225", "0.61335117", "0.6114966", "0.60895544", "0.60895544", "0.60880196", "0.6074907", "0.60311836", "0.60311836", "0.59171885", "0.58961785", "0.5894848", "0.58812535", "0.58780175", "0.58...
0.0
-1