query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Helper to decode a buffer of encoded audio data. Guesses the format, and decodes to an AudioBuffer accordingly. | function decodeAudioData (buffer, done) {
var asset = AV.Asset.fromBuffer(buffer)
asset.on('error', function(err) {
done(err)
})
asset.decodeToBuffer(function(decoded) {
var deinterleaved = []
, numberOfChannels = asset.format.channelsPerFrame
, length = Math.floor(decoded.length / numberO... | [
"function decodeAudio( data ) {\n var audioData = data.audata;\n audioCtx = new (window.AudioContext || window.webkitAudioContext)();\n var sourceTemp = audioCtx.createBufferSource();\n audioCtx.decodeAudioData(audioData, function(buffer) {\n allAudio.push(buffer); \n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers an activity event handler for the _dialog_ event, emitted as the last event for an incoming activity. | onDialog(handler) {
return this.on('Dialog', handler);
} | [
"addListener(onDialog){\n this.onDialog.addListener(onDialog);\n }",
"function registerActivityHandler() {\n navigator.mozSetMessageHandler('activity', function activityHandler(a) {\n var activityName = a.source.name;\n switch (activityName) {\n case 'browse':\n // The user is proba... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Author: John Politis Date : 04/06/2017 Description : locates a winning move for X player on the current game state. if no winning move is detected then we return undefined | function findBestMoveForWinX(board) {
var bestMove;
for (var i = 0; i < predictionsMade.length; i++) {
board.poke(predictionsMade[i].row, predictionsMade[i].col, 'X');
if ( (predictionsMade[i].score === 10) && board.checkForWinningMove('X') ) {
board.poke(predic... | [
"function getWinningMove(board,player) {\n var moveToMake = -1;\n\n debugStrategyTop(\"getWinningMove \"+player); //print debugging for this strategy \n moveToMake = checkForThirdInARow(0,1,2,board,player); //check for win in top row\n if (moveToMake == -1)\n moveToMake = checkForThirdInARow(3,4,5,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make an ellipsoid, with numLongSteps longitudes. start with a sphere of radius 1 at origin Returns verts, tris and normals. | function makeEllipsoid(currEllipsoid,numLongSteps) {
try {
if (numLongSteps % 2 != 0)
throw "in makeSphere: uneven number of longitude steps!";
else if (numLongSteps < 4)
throw "in makeSphere: number of longitude steps too small!";
else { // good number longitude ... | [
"function makeEllipsoid(currEllipsoid, numLongSteps) {\n try {\n if (numLongSteps % 2 != 0) throw 'in makeSphere: uneven number of longitude steps!';\n else if (numLongSteps < 4) throw 'in makeSphere: number of longitude steps too small!';\n else {\n // good number longitude steps\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
variation is between [1maxVariance, 1+maxVariance], map this to [0, 1] | activateVariation(x) {
return (x + this.maxVariancePerPeriod - 1) / (2 * this.maxVariancePerPeriod);
} | [
"variance() {\n return ((this.valueCount > 1) ? this.newVariance / (this.valueCount - 1) : 0.0);\n }",
"deactivateVariation(x) {\n return x * 2 * this.maxVariancePerPeriod + 1 - this.maxVariancePerPeriod;\n }",
"get variance(): number {\n if(this.alpha > 2) {\n return Math.pow(th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check prerequisites for WebbNote. | function webbnote_check() {
var warning = new Array(),
message;
// Check if files variable have been set and contains files.
if ( typeof( files ) != undefined && files !== null && Object.prototype.toString.apply( files ) !== '[object Array]' && files.length === 0 ) {
// Add message to array.
warning.push( '<... | [
"function prerequisitesExist()\n {\n items.each(function() {\n //get item prerequisites\n var prerequisites = $(this).data(\"prerequisites\").toString();\n\n //if item has prerequisites, check they exist\n if(prerequisites.length !== 0) {\n var pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addBorderTrees() Purpose: adds numBorderTrees trees to the border defined by the given borderCurve to the given frame helper for makeUpperLeftForest() and makeLowerLeftForest() Parameters: frame (Object3D): the frame to add the trees to borderCurve (Curve): the curve the trees are placed along numBorderTrees (integer):... | function addBorderTrees (frame, borderCurve, numBorderTrees) {
var curvePoints = borderCurve.getSpacedPoints(numBorderTrees + 1);
for (var i = 1; i <= numBorderTrees; i++) {
var tree = hwTree.clone();
var point = curvePoints[i];
tree.position.set(point.x, 0, point.z);
tree.rotateY(Math.random()*2*Math.PI);
... | [
"function addTriangleTrees (frame, numTrees, a, b, c) {\n\tvar points = randomPointsInTriangle(a, b, c, numTrees);\n\tfor (var i = 0; i < points.length; i++) {\n\t\t//clone the hwTree\n\t\tvar tree = hwTree.clone();\n\n\t\t//scale the tree so the trees aren't all identical\n\t\ttree.scale.y = randomInRange(0.8, 1);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch the format of video | function getType(type){
type=decodeURIComponent(type);
type=type.split(";")[0];
if(type.toLowerCase()=="video/x-flv")
return "flv";
if(type.toLowerCase()=="video/mp4")
return "mp4";
if(type.toLowerCase()=="video/3gpp")
return "3gpp";
if(type.toLowerCase()=="video/webm")
return "webm";
} | [
"function enumcastVideoFormat(vf) {\n // match keys are MediaEnum.VideoFormat values\n return {\n Fit: 0 /* LetterBoxing */,\n Crop: 1 /* Cropping */,\n Stretch: 2 /* St... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TIME MAPPING CODE Using the x, y coordinates and the leftScroll get the x coordinate and map an island to a time. | function getTimestampFromPosition(x, leftScroll, islandWidth, interval, iPartLen, index){
var offset;
var increment;
var timestamp;
var nextDate;
var xLocation = x + leftScroll + (islandWidth/2); // compute the x value of where the island is located.
//alert("islandWidth is " + islandWidth);
incr... | [
"function getTime() {\r\n return loc.x;\r\n }",
"function calculateAnchorTime (coords) {\n return pc.math.clamp((coords[0] - gridLeft()) / gridWidth(), 0, 1);\n }",
"function time(){\n\t $('#Begtime').mobiscroll().time({\n\t theme: 'wp',\n\t display: 'inline',\n\t mode: '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the ExecutionContext the WebWorker runs in | async executionContext() {
return this._executionContextPromise;
} | [
"get worklet() {\n const executionContext = this[$executionContext];\n return executionContext != null ? executionContext.worker : null;\n }",
"executionContext() {\n return this._context;\n }",
"browserContext() {\n return this._target.browserContext();\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs the second step for testFocusTracksEmbedder(). See WebViewTest.Focus_FocusTracksEmbedder() to see how this is invoked. | function testFocusTracksEmbedderRunNextStep() {
g_webview.contentWindow.postMessage(
JSON.stringify(['request-waitForBlurAfterFocus']), '*');
window.addEventListener('message', function(e) {
var data = JSON.parse(e.data);
LOG('send window.message, data: ' + data);
if (data[0] == 'response-seenBlu... | [
"function testFocusTracksEmbedder() {\n var webview = document.createElement('webview');\n g_webview = webview;\n document.body.appendChild(webview);\n\n var onChannelEstablished = function(webview) {\n var msg = ['request-waitForFocus'];\n webview.contentWindow.postMessage(JSON.stringify(msg), '*');\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls progress() on click of the right answer, passing the tracker as an argument, also gets the player's name as input during the first stage | function OnCorrectChoice() {
//Gets player name input: executes once
if (!nameInputted) {
if ($("name").value !== "") {
name = $("name").value;
//If inputted value is null, the character's name remains the default
}
nameInputted = true;
}
//Progresses... | [
"function progress_button_click() {\n\t// Roll each of the dice, update our stage in the game, and \n\t// make a call to our server API to update our AI recommendation.\n\tif (gs.progress_button.is_roll()) {\n\t\tfor (let i = 0; i < gs.dice.length; i++) {\n\t\t\tgs.dice[i].start_roll(); \n\t\t}\n\t\tgs.stage = GAME... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toJSON Create a JSON string from a service definition object. This is a fairly trivial recursive process. The only tricky part is sorting according to a specified ordering attribute, when present. At face value, it looks like it should be possible to achieve this by using JSON.stringify with a replacement function as a... | function toJSON1(obj, orderer, prefix) {
if ( (typeof obj != 'object') || obj == null ) {
return JSON.stringify(obj);
}
if (obj.isArray) {
var prefix1 = prefix + ' ';
var ret = '[';
var sep = '\n';
for( var i=0; i < obj.length; i++ )... | [
"function jsonable(s) {\n/*23,0*/ s.toJSON = toJSON;\n/*24,0*/ return s;\n/*25,0*/}",
"toJSON(depth = 0, initDepth = depth){\n\n /**\n * Converts a resource object into serializable JSON.\n * May fail to serialize recursive objects which are not instances of Resource\n * @para... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
corrects a raw palette and data array | static correctDataAndPalette (data, palette) {
const originalPalette = palette.slice(0)
palette.sort((a, b) => a - b)
for (let x = 0; x < constants.SECTION_WIDTH; ++x) {
for (let y = 0; y < constants.SECTION_HEIGHT; ++y) {
for (let z = 0; z < constants.SECTION_WIDTH; ++z) {
// replac... | [
"function transformData(){\n const eyeColors = surveyAnswer.map(answer => answer[colomnNameOne]\n .toUpperCase()\n .replace(\"#\", \"\")\n .replace(\" \", \"\")\n .replace(\"BRUIN\", brownHex)\n .replace(\"LICHTBLAUW\", lightBlueHex)\n .replace(\"BLAUW\", blueHex)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the descendant node referred to by a specific path. If the path is an empty array, it refers to the root node itself. | get(root, path) {
var node = root;
for (var i = 0; i < path.length; i++) {
var p = path[i];
if (Text.isText(node) || !node.children[p]) {
throw new Error("Cannot find a descendant at path [".concat(path, "] in node: ").concat(JSON.stringify(root)));
}
node = node.children[p];
... | [
"descendant(root, path) {\n var node = Node$1.get(root, path);\n\n if (Editor.isEditor(node)) {\n throw new Error(\"Cannot get the descendant node at path [\".concat(path, \"] because it refers to the root editor node instead: \").concat(node));\n }\n\n return node;\n }",
"get(root6, path) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replaces the stats with the current brain stats | function updateStats(brain) {
emptyNode(statsNode);
replaceChildren(statsNode, brain.toHTML());
} | [
"function resetCurrentStats() {\n\n currentStats = {\n results: {\n bonus: {\n count: 0,\n total: 0,\n max: 'NA',\n min: 'NA',\n sumSquared: 0\n },\n result: {\n rejectCount: 0,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
manufacturer, model, pricewifiRange, lanPorts | constructor(manufacturer, model, price, wifiRange, lanPorts) {
super(manufacturer, model, price);
this.wifiRange = wifiRange;
this.lanPorts = lanPorts;
} | [
"function ListSerialPorts(){ \n serialport.list(function (err, ports) {\n console.log(\"\\n\");\n console.log(\"+++++++++++ port info +++++++++++\\n\");\n console.log(\"\\n\");\n ports.forEach(function(port) {\n console.log(\" \"+port.comName+\" , \"+port.pnpId+\" ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion nombre y apellido | function nombreApellido(nombre, apellido){
console.log(nombre + " " + apellido);
} | [
"getApellido () {\n return this.apellido;\n }",
"getApellido()\n {\n console.log(`Mi apellido es ${this.apellido}`);\n }",
"function validarApellidos(a, e){\n\tif (esVacio(a.value.trim())) {\n\t\te.innerHTML = \"Los apellidos no pueden estar vacíos.\";\n\t}\n\telse if (!esCorrecto(a.value.tri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read tag from input. The tag is encoded as a varint64 where the lower three bits are the opcode and the upper bits are the argument. | read_tag() {
// Low bits (0-27).
var lo = 0, shift = 0, b;
do {
b = this.input[this.pos++];
lo += (b & 0x7f) << shift;
shift += 7;
} while (b >= 0x80 && shift < 28);
if (b < 0x80) return [lo & 7, lo >>> 3];
// High bits (28-63).
var hi = 0;
shift = 0;
do {
b ... | [
"readTag() {\n // Low bits (0-27).\n var lo = 0, shift = 0, b;\n do {\n b = this.input[this.pos++];\n lo += (b & 0x7f) << shift;\n shift += 7;\n } while (b >= 0x80 && shift < 28);\n if (b < 0x80) return [lo & 7, lo >>> 3];\n\n // High bits (28-63).\n var hi = 0;\n shift = 0;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Slider Range TODO_10: make data anything | function wpbc_do_slider_range(range){
var rangeSliderJQ = range.find('.slider-range');
var rangeSlider = rangeSliderJQ.get(0);
if(!rangeSlider) return;
var deffaults_moneyFormat = {
decimals: 0,
thousand: '.',
prefix: 'USD'
};
var data_money_format = range.data('money-forma... | [
"selectDataFromSlider (data) {\n return {\n from: data.from,\n to: data.to,\n min: data.min,\n max: data.max,\n // if value\n from_value: data.from_value || null,\n to_value: data.to_value || null,\n // if pretty\n from_pretty: data.from_pretty || ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the increment values for R, G, and B using distance, fps, and duration. This calculation can be made in many different ways. | function calculateIncrement(distanceArray, fps, duration) {
var fps = fps || 30;
var duration = duration || 1;
var increment = [];
for (var i = 0; i < distanceArray.length; i++) {
var incr = Math.abs(Math.floor(distanceArray[i] / (fps * duration)));
if (incr == 0) {
incr = 1;
... | [
"function calculateIncrement(distanceArray, fps, duration) {\n var fps\t\t\t= fps || 30;\n var duration\t= duration || 1;\n var increment\t= [];\n for (var i = 0; i < distanceArray.length; i++) {\n var incr = Math.abs(Math.floor(distanceArray[i] / (fps * duration)));\n if (incr == 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processes Team into CRM | function vpta_processTeamName(vpta_teamname) {
try {
//Check if Team Name from PCMM integration service already exist in CRM
var vpta_conditionalFilter = "(ftp_name eq '" + vpta_teamname + "')";
vpta_getMultipleEntityDataAsync('ftp_pactSet', 'ftp_pactId, ftp_name', vpta_conditionalFilter, 'f... | [
"function PACTTeamChangeEvent() {\n try {\n var PACTTeamGUID = retrievePACTTeamGUIDfromLookup();\n\n if (typeof PACTTeamGUID !== 'undefined') {\n if (PACTTeamGUID !== null) {\n var PACTTeamMembers = GetPACTTeamMembersUserRecords(PACTTeamGUID);\n if (typeof P... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if sliders are needed. update state only if it changed slider's state will ONLY be set to new value if it has changed (toggled) setting slider's state fires up its "state" event handler | function onUpdateSliderState()
{
// check if sliders are needed since content.size has changed.
var x = true;
var y = true;
if (xslider.max > w) x = false;
if (yslider.max > h) y = false;
if ((xslider.max > w - t) && (yslider.max > h)){ x = false; }
if ((yslider.max > h - t) && (xslider.max > w)){ ... | [
"sliderChange(value) {\n //Onlu Update local state when value has changed\n this.setState( (prevState) => {\n if ( prevState.sliderValue !== value ) {\n return ({\n sliderValue: value\n })\n }\n })\n }",
"function ControlSliderState(value) { \n\n //sliderState = value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates HRLine with a margins defined by line_left_right_margin | function generateHRLine(marginTop, marginBottom) {
var top_margin = marginTop; // the top margin spacing
var bot_margin = marginBottom; // the bottom margin spacing
var hrLine = {
margin: [top_margin, line_left_right_margin, bot_margin, 7],
canvas: [{ type: 'line', x1: 0, y1: line_left_right_margin, x2: w... | [
"function createMiddleLine() {\n let line = document.createElement(\"hr\");\n return line;\n}",
"function line() {\n var inlineHtml =\n '<hr style=\"height:5px; width:100%; border-width:0; color:red; background-color:#fff\">'\n\n return inlineHtml\n }",
"function drawHorizontalLine(hx,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the gift registry purchases page. | function showPurchases() {
app.getView().render('account/giftregistry/purchases');
} | [
"function purchaseRig() {\n \n /*--update liveGameData with purchased rig details--*/\n liveGameData.rig.name = name;\n liveGameData.rig.cost = cost;\n liveGameData.rig.baseChance = chance;\n liveGameData.rig.baseHash = hash;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use Check Content in Text Editer | function CheckContent(field, rules, i, options) {
///Get Contents from Text Editer
var text = tinyMCE.activeEditor.getContent({
format: 'text'
});
///Remove extra spaces from text
text = $.trim(text);
///Check Lenght of text
if (text.length == 0) {
$("#Area_Text").val('');
... | [
"function switchText_cb(new_string) {\n\tnew_string = new_string.replace(/%u2026/g, \"\\n\");\n\tobjToCheck.value = new_string;\n\tobjToCheck.disabled = false;\n}",
"function ValidateNewsText(source,args)\r\n{\r\n var doc = FCKeditorAPI.GetInstance(editorID);\r\n if (doc != null) {\r\n if ((doc.Edito... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert area rich text options into a valid sanitizehtml configuration, so that h4 can be legal in one area and illegal in another. | optionsToSanitizeHtml(options) {
return {
...sanitizeHtml.defaults,
allowedTags: self.toolbarToAllowedTags(options),
allowedAttributes: self.toolbarToAllowedAttributes(options),
allowedClasses: self.toolbarToAllowedClasses(options),
allowedStyles: self.toolbarTo... | [
"function sanitize_options() {\n\t\tif (options.type === undefined) {\n\t\t\toptions.type = 'standard';\n\t\t}\n\n\t\tif (options.active_position === undefined || $.type(options.active_position) !== 'number') {\n\t\t\toptions.active_position = 50;\n\t\t}\n\n\t\tif (options.strip_size === undefined) {\n\t\t\toptions... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
color:string > cmd: string | function createScreenCommand(color) {
var cmd = ""
for (var r = 0; r < 8; r++) {
for (var c = 0; c < 8; c++) {
cmd += r + "," + c + "," + color + "\n";
}
}
return cmd;
} | [
"function color(code) {\n return process.argv.includes(\"--plain\") ? \"\" : \"\\033[\" + code + \"m\"\n}",
"function make_red(txt){\n return colors.red(txt); // display the help text in red on the console\n}",
"echo(msg) {\r\n this.terminal.echo(apply_color(msg, \"gray\"));\r\n }",
"command(com... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gives a warning if the server names do not start with a03 or a70 | function serverWarning(id){
color = document.getElementById(id).style.borderColor;
var str = document.getElementById(id).value;
if(str.startsWith("a03") || (str.startsWith("a70")))
{
document.getElementById('serverWarningText').innerHTML = "";
}
else
{
document.getEl... | [
"function is_servername() {\n if (doc.servername != null) {\n op_str.push(\"+servername\");\n }\n else {\n op_str.push(\"-servername\");\n }\n }",
"function isNCNameStartChar(c){return c>=0x41&&c<=0x5A||c===0x5F||c>=0x61&&c<=0x7A||c>=0xC0&&c<=0xD6||c>=0xD8&&c<=0x... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create(structure) create(name, structure) create(name, contentType, structure) | create(p1,p2,p3) {
var name, structure, contentType, properties
if (Array.isArray(p1)) {
// handle this call format: create(structure)
structure = p1
name = null
contentType = 'application/vnd.flexio.table'
}
else if (Array.isArray(p2)) {
... | [
"async create(data, params) {}",
"create (type, schemaDef, cb) {\n\n var payload = {};\n payload[type] = schemaDef;\n\n UtilXHR.post(payload, UrlBuilder.forOneSchema(type), cb);\n\n }",
"function create(o) { }",
"function createObject(json) {\n return {\n action_type: C.CREATE_OBJECT,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
logic to complete the turn after each player click test click number against game array to make sure the button matches the the game array if the player click the right button continue if the player clicks the wrong button through an error based on game mode strict = true game starts over, strict = false turn starts ov... | function player_turn(id) {
// function will take in button click of player
// add click to player sequence
player_sequence.push(parseInt(id));
player_clicks++;
// console.log(game_sequence);
// console.log(player_sequence);
// console.log(player_clicks);
// console.log(game_turn);
/... | [
"function check() {\n // If player sequence is not the same as computer sequence, correct will return as false.\n if (playerSequence[playerSequence.length - 1] !== sequence[playerSequence.length - 1]) {\n correct = false;\n }\n // If player is in strict mode reaches level 20, you will win the gam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Viz helpers / Queries the EventsDataBroker for events reported by the source Returns : SortedArray(Events) (unique elements) | events_for_source(sourceName, liveTimestamps) {
let coveredEventsIds = new SortedArray([], true)
if (this.sourceTimeEventTree.has(sourceName)) {
this.sourceTimeEventTree.get(sourceName).forEach((value, key) => {
if (liveTimestamps.includes(key.toString())) {
... | [
"getEvents() {\n return Object.values(this.events);\n }",
"eventList() {\n return this._events.toList();\n }",
"getEventList() {\n return Object.keys(this.events);\n }",
"getEvents() {\n\t\treturn this.metadata.events || {};\n\t}",
"get eventsList() {\n let events =\n typeof ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new blank configuration. See also `Config.defaultConfig()`. | static empty() {
return new Config({
extends: [],
rules: {},
plugins: [],
transform: {},
});
} | [
"static defaultConfig() {\n return new Config(defaultConfig);\n }",
"static defaultConfig() {\n return new Config(default_1.default);\n }",
"function newConfig() {\r\n //TODO\r\n}",
"function createConfiguration() {\n return new Configuration();\n}",
"static makeDefault() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
15 / In above example we had to return the inner function for the entire thing to work. We can either call the inner function right away or store the result of the function in a variable. Inner function can be anonynoums / Does the code below contain a closure? | function outerFn() {
var data = "something from outer";
return function innerFn() {
return "Just returned from the inner function";
}
} | [
"function outerFn() {\n\n return function() {\n return \"Gloria\";\n }\n }",
"function outerFn(){\n\treturn function(){\n\t\treturn \"Mike Larrabee\";\n\t}\n}",
"function outerFn() {\n return function(anonymous){\n return \"Landon Johnson\";\n }\n }",
"function outer() {\n function in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
aggregate the data for multiple lookup | MultiAggregateData(filter = {}, lookup = {}, lookup1 = {}, unwind, project = {}) {
return new Promise((resolve, reject) => {
this.collection.aggregate([
//1
{
$match: filter
},
//2
{
... | [
"function aggregateData () {\n if (allData[0].cases_weekly) return allData\n if (allData[0].countriesAndTerritories) return convertFromCaseDistribution()\n return convertFromNationalCasesDeaths()\n }",
"aggregate() {\n let allRecords = this.props.allRecords;\n let startDate = this.getDateFromMonth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies the properties on the prototype of sourceCtors to the prototype of targetCtor | function applyMixins(targetCtorParam, sourceCtors) {
const castTargetCtorParam = targetCtorParam;
sourceCtors.forEach((sourceCtor) => {
Object.getOwnPropertyNames(sourceCtor.prototype).forEach((name) => {
castTargetCtorParam.prototype[name] = sourceCtor.prototype[name];
});
});
} | [
"function applyMixins(targetCtorParam, sourceCtors) {\n var castTargetCtorParam = targetCtorParam;\n sourceCtors.forEach(function (sourceCtor) {\n Object.getOwnPropertyNames(sourceCtor.prototype).forEach(function (name) {\n castTargetCtorParam.prototype[name] = sourceCtor.prototype[name];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the selected values of a select2 using a selector. Provided value and index | function setSelectedBySelector(select2_, values, func) {
var select2 = _getSelect2(select2_);
if (getOptions(select2).ajax)
setValueBySelector(select2, values, func);
else {
if (!$.isArray(values))
values = [values];
... | [
"function setValue(select2_, value, id) {\n var select2 = _getSelect2(select2_);\n empty(select2, true);\n if (!id)\n id = value;\n if (typeof value === \"string\") {\n value = [value];\n id = [id];\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function does a binary search for a visible item in a sorted list. If we find a visible item, the code that uses this function will then iterate in both directions over this sorted list to find all visible items. | function binarySearchCustom(orderedItems, comparator, field, field2) {
var maxIterations = 10000;
var iteration = 0;
var low = 0;
var high = orderedItems.length - 1;
while (low <= high && iteration < maxIterations) {
var middle = Math.floor((low + high) / 2);
var item = orderedItems[middle];
var ... | [
"getVisibleItemIndexes(visibleAreaTop, visibleAreaBottom, listTopOffset) {\n\t\tlet firstShownItemIndex\n\t\tlet lastShownItemIndex\n\t\tlet itemsHeight = 0\n\t\tlet firstNonMeasuredItemIndex\n\t\tlet redoLayoutAfterRender = false\n\t\tlet i = 0\n\t\twhile (i < this.getItemsCount()) {\n\t\t\tconst height = this.ite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a translated name of a language, e.g. "German" instead of "Deutsch" | getTranslatedName(langKey, translationLanguage) {
let lookupKey = languageNameMap[langKey] || langKey;
return langData[translationLanguage][lookupKey];
} | [
"getTranslatedName(langKey, translationLanguage) {\n return langData[translationLanguage][langKey];\n }",
"function getLanguageString(pLocale) {\n if(pLocale.indexOf(\"es_\") != -1) {\n return \"Spanish\";\n } else if(pLocale.indexOf(\"en_\") != -1) {\n return \"English\";\n } else if(pLocale.indexOf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return available unique shapes from data files | function availableShape() {
let shapes = [];
Object.values(tdata).forEach(value => {
let shape = value.shape;
shape = shape[0].toUpperCase() + shape.substring(1);
if(shapes.indexOf(shape) !== -1) {
}
else {
shapes.push(shape);
}
});
return sha... | [
"static getSelectedShapes(){\n\t\treturn Object.keys(objectPrimary.store).length;\n\t }",
"function generateShapeData() {\n const data = [];\n const colors = [\"red\", \"green\", \"blue\"];\n const shapes = [\"square\", \"triangle\", \"circle\"];\n const repeats = [1, 2, 3];\n\n for (var i = 0; i <... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles websocket goodbye message event WAMP SPEC: [GOODBYE, Details|dict, Reason|uri] | async _onGoodbyeMessage () {
if (!this._cache.isSayingGoodbye) { // get goodbye, initiated by server
this._cache.isSayingGoodbye = true;
this._send([WAMP_MSG_SPEC.GOODBYE, {}, 'wamp.close.goodbye_and_out']);
}
this._cache.sessionId = null;
this._ws.close();
... | [
"function websocket_onclose() {\n console.log(\"Websocket connection closed.\");\n}",
"function handleSignalBye(reason){\n\tif(reason.code === 101){\n// the signaling has been taken over by the WebSocket Data Channel,\ntransferred = true;\n// and the websocket can be closed\n\t\twebSocket.close();\n\t} else {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
try to process leaflet.js error report into a friendlier string | function generateLeafletError(err) {
const errMessages = {
2004: 'Příliš vzdálené cíle (musí být blíže než 6000 km)',
2009: 'Nenalezena trasa mezi zadanými cíli'
};
if(typeof err !== 'object' || !err.message) {return err;}
let obj = JSON.parse(err.message);
if(!obj.error || !obj.error.code || !errMessag... | [
"errorMappingToHtml() {\n return (\n \"<li>Error : '\" + this.name + \"' midi element connection is not complete</li>\" +\n \"Expected Input \" + this.midiNamesIn.toString() + \"<br>\" +\n \"Result Input \" + Object.keys(this.midiInMapped).toString() + \"<br>\" +\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
let frase="amar ahorro camion aeropuerto aviar comun aura arriba partir andar ahorrar"; | function cantidadCaracteres(frase) {
let i=0;
let nuevaPalabra="";
let nuevaFrase="";
let longitud=frase.length;
let longitudNP=0;
for ( i == 0; i < longitud; i++) {
while (frase[i] ==" ") {
i++;
}
if (frase[i]=="a" || frase[... | [
"function construct_phrase()\n{\n\tif (!arguments || arguments.length < 1 || !is_regexp)\n\t{\n\t\treturn false;\n\t}\n\n\tvar args = arguments;\n\tvar str = args[0];\n\tvar re;\n\n\tfor (var i = 1; i < args.length; i++)\n\t{\n\t\tre = new RegExp(\"%\" + i + \"\\\\$s\", 'gi');\n\t\tstr = str.replace(re, args[i]);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to check if the kingdom has a villager | hasVillager(){
let villagerFound = false;
for(let unit of this.units){
if(unit.getType() === "Villager"){
villagerFound = true;
}
}
return villagerFound;
} | [
"isDangerous (groupe) {\n\t\t// Critere 1, nombre de maison par terrain pouvant etre achete\n\t\tlet nbMaison = (this.argent / groupe.maisons[0].prixMaison) / groupe.fiches.length;\n\t\t// compte les autres groupes\n\t\tlet criterePrix = (groupe.maisons[0].loyers[nbMaison]) / this.threasholdMontant;\n\t\t// Ligne p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pause the observers. No callbacks from observers will fire until 'resumeObservers' is called. | pauseObservers() {
// No-op if already paused.
if (this.paused) {
return;
}
// Set the 'paused' flag such that new observer messages don't fire.
this.paused = true;
// Take a snapshot of the query results for each query.
Object.keys(this.queries).forEach(qid => {
const query = ... | [
"resumeObservers() {\n // No-op if not paused.\n if (!this.paused) {\n return;\n }\n\n // Unset the 'paused' flag. Make sure to do this first, otherwise\n // observer methods won't actually fire when we trigger them.\n this.paused = false;\n\n Object.keys(this.queries).forEach(qid => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the sum of all credits in given array of courses | sumCredit(courses){
var sum=0;
for(var i=0;i<courses.length;i++){
sum=sum+parseInt(courses[i].courseCredit);
}
return sum;
} | [
"function loadCredits() {\n let totalCredits = 0;\n for (let i = 0; i < props.courses.length; i++) {\n totalCredits += parseInt(props.courses[i].credits, 10);\n }\n return totalCredits;\n }",
"calculateCredits(){\n var localCredits = 0;\n for(var i = 0;i < this.awesomeThings.length; i+... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the previous element to the passed element. | function prev(item) {
return item.previousElementSibling;
} | [
"function previousElement(element) {\r\n\r\n var prev_element = element.previousSibling;\r\n \r\n while ((prev_element != null) && (prev_element.nodeType != element.nodeType))\r\n \r\n prev_element = prev_element.previousSibling;\r\n \r\n return prev_element;\r\n}",
"function previousElem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PART 1: write a function called nicer(). It should clean up the language in its input sentence. [x] write a function called nicer. [x] Clean up language in it's input sentence. [x] Create for loop to loop over array [x] Create var sentenceArray = sentence.split(" ") | function nicer(sentence){
// converted into array
var sentenceArray = sentence.split(" ");
// console.log(sentenceArray);
// create a var that makes both strings equal eachother.
for (var i = 0; i < sentenceArray.length; i++) {
var currentWord = sentenceArray[i];
if(currentWord === "heck" || current... | [
"function nicer(sentence){\n //Convert a string input to an array.\n var sentenceArray = sentence.split(\" \");\n for(var i=0; i < sentenceArray.length; i++){\n var currentWord = sentenceArray[i];\n if (currentWord === \"heck\" || currentWord === \"darn\" || currentWord === \"crappy\" || currentWord === \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== from vm/instructions/assign/bound/Assign_Lex_Lex.java =================================================================== Needed early: Assign_Lex | function Assign_Lex_Lex() {
} | [
"function Assign_Lex_Other() {\r\n}",
"function Assign_Lex_Literal() {\r\n}",
"function Assign_Lex_Free() {\r\n}",
"function Assign_Lex_Stack() {\r\n}",
"function Bind_A_Oliteral() {\r\n}",
"function ruleAssign() {\n\tvar parent;\n\tvar node;\n\tvar tmp;\n\n\tif (accept(\"LX_ID\") &&\n\t [\"ASSIGN\", \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CartoDB / Mapnik sublayers | function CartoDBSubLayer(layer, position) {
SubLayerBase.call(this, layer, position);
this._bindInteraction();
var layer = this._parent.getLayer(this._position);
// TODO: Test this
if (Backbone.Model && layer) {
this.infowindow = new Backbone.Model(layer.infowindow);
this.infowindow.bind('change', fu... | [
"function addBaseMap() {\n\t\tvar basemap = trySetting('_tileProvider', 'CartoDB.Positron');\n\t\tL.tileLayer.provider(basemap, {\n\t\t\tmaxZoom: 22\n\t\t}).addTo(map);\n\t\tL.control.attribution({\n\t\t\tposition: trySetting('_mapAttribution', 'bottomright')\n\t\t}).addTo(map);\n\t}",
"function changeBaseMapDigi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a Node.js module, either by name or relative path, to look for. | lookupNodeModule(modulePath) {
const path = Path_1.default.create(modulePath);
this.lookups.push({
path,
raw: path,
type: types_1.LookupType.NODE_MODULE,
});
return this;
} | [
"function addModule (name, version, os, path, done) {\n fs.readFile(path, function (err, data) {\n if (err) return done(err);\n\n var doc = libxmljs.parseXml(data);\n\n // if it's already added do nothing\n if (exports.hasModule(doc, name, version, os)) return done();\n\n var root = doc.root();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates that limit has been called with the correct combination of parameters | function validateLimit(params) {
if (params.hasStart() &&
params.hasEnd() &&
params.hasLimit() &&
!params.hasAnchoredLimit()) {
throw new Error("Query: Can't combine startAt(), startAfter(), endAt(), endBefore(), and limit(). Use " +
'limitToFirst() or limitToLast() inste... | [
"function validateLimit(params) {\n if (params.hasStart() && params.hasEnd() && params.hasLimit() && !params.hasAnchoredLimit()) {\n throw new Error(\"Query: Can't combine startAt(), startAfter(), endAt(), endBefore(), and limit(). Use \" + 'limitToFirst() or limitToLast() instead.');\n }\n}",
"function vali... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return an array of Series from an array of SeriesGroup objects | function collectSeries(groups) {
var nested = groups.map(function(group) { return group.series; });
return d3.merge(nested);
} | [
"get timeseries() {\n return this.response.series.map((s) => ({\n x: _.range(\n extractYear(s.time_range.gte),\n extractYear(s.time_range.lte) + 1\n ),\n y: s.values,\n name: s.options.name,\n }));\n }",
"createSeriesGroup () {\n }",
"getSeriesData() {\n let _ser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this gets the bonuses from Relics and determines the modified Boons for all other Relic modifiers | function getRelicBonuses() {
relicsIndex = myCharacter.relics;
for(var relicName in relicsIndex) {
if(relicsIndex[relicName]['enabled'] == true) {
for(var bonusB in relicsIndex[relicName]['relicBoons']) {
myRelicBonusB.push(bonusB);
myRelicBonusB2.push(relicsIndex[relicName]['relicBoons'][bonusB]);
}
... | [
"function resetBonuses() {\n let bonusList = ['rollbonus', 'atkrollbonus', 'defrollbonus',\n 'patkbonus', 'eatkbonus', 'defensebonus', 'resistancebonus'];\n bonusList.forEach(function(b) {\n let bonuses = filterObjs(function(obj) {\n return obj.get('_type') == 'attribute'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Searches shows given a string: showName, and returns list of shows at /search | function searchShow(showName) {
showName = encodeURI(showName);
requestTVInfo('search?query='+showName+'&type=show', function (error, response, body) {
if (error) {
console.log(error);
} else {
app.get('/search', function(req, res) {
res.send(body);
});
}
});
} | [
"searchShow( name, callback ) {\n let url = this._getUrl( '/search/tv', { query: name } );\n this._fetchData( url, callback );\n }",
"async function searchShows(q) {\n\t// send GET request with show seach parameters to API and await show data in response\n\tconst res = await axios.get('https://api.tvmaze.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets all elements to zero | reset() {
for (let i = 0, l = this.matrix.length; i !== l; i++) {
this.matrix[i] = 0
}
} | [
"setZero() {\n const e = this.elements;\n e[0] = 0;\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 0;\n e[5] = 0;\n e[6] = 0;\n e[7] = 0;\n e[8] = 0;\n }",
"setZero() {\n const e = this.elements\n e[0] = 0\n e[1] = 0\n e[2] = 0\n e[3] = 0\n e[4] = 0\n e[5] = 0\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the current line is a comment line. | isCurrentLineComment() {
var ltrimmedLine;
// Checking explicitly the first char of the trim is faster than loops or strpos
ltrimmedLine = Utils.ltrim(this.currentLine, ' ');
return ltrimmedLine.charAt(0) === '#';
} | [
"function isCommentLine(line) {\r\n var firstChar = sh.strip(line).charAt(0)\r\n if (firstChar == '#' || firstChar == '!')\r\n return true\r\n\r\n return false\r\n}",
"isCurrentLineComment() {\n // Checking explicitly the first char of the trim is faster than loops or strpos\n const ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize sortable widgets for agile boards. | function initSortables() {
$scope.board.width = $scope.board.lists.length * 400;
setTimeout(function () {
$('div[data-board=' + $scope.board._id + ']').sortable({
handle: '.handler',
update: function(event, ui) {
var $item = $(ui.item);
Board.update_list($item.attr('id'... | [
"function makeWidgetsSortable() {\n function onStart(event, ui) {\n if (!jQuery.support.noCloneEvent) {\n $('object', this).hide();\n }\n }\n\n function onStop(event, ui) {\n $('object', this).show();\n $('.widgetHover', this).removeCla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clear accumulated short definitions | clearShortDefs () {
this.shortDefs = []
} | [
"clearShortDefs () {\n this.shortDefs = [];\n }",
"clearFullDefs () {\n this.fullDefs = []\n }",
"clearFullDefs () {\n this.fullDefs = [];\n }",
"_clearDefs() {\n const def = this._defs;\n def.gradient = {};\n def.clipping = {};\n }",
"function clearDefinitions() {\n for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
preloader hides after one minute | function preloader(){
setTimeout(function(){
$(".quick-view-preloader").hide();
}, 1500);
$(".quick-view-preloader").show();
} | [
"function hb_hide_preloader_after_s(){\n\tif ( $preloader ){\n\t\tsetTimeout(function(){\n\t\t\tif ( !$j('#hb-preloader').hasClass('ajax-like-initiated') ){\n\t\t\t\t$j('#hb-preloader').css('opacity', 0);\n\t \t\t$j('#hb-preloader').hide();\n\t \t\thb_anim_content_wait_preloader();\n \t\t}\n\t\t}, 5000);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrive cash out (natural) configuration | async retriveCashOutNaturalConfig() {
let cashOutNaturalConfig = null;
//retrive cash out (natural) configuration
await this.api.get(config.API_END_POINT.CASH_OUT_NATURAL_CONFIG_URL).then(function (data) {
cashOutNaturalConfig = new CashOutNaturalConfig(data.percents, data.week_limit... | [
"async retriveCashInConfiguration() { \n let cashInConfig = null;\n //retrive cash in configuration\n await this.api.get(config.API_END_POINT.CASH_IN_CONFIG_URL).then(function (data) {\n cashInConfig = new CashInConfig(data.percents, data.max.amount, data.max.currency);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws nodes on plot | function drawNodes(nodes) {
// used to assign nodes color by group
var color = d3.scale.category20();
d3.select("#plot").selectAll(".node")
.data(nodes)
.enter()
.append("circle")
.attr("class", "node")
.attr("id", function(d, i) { return d.name; })
.attr("cx... | [
"drawNodes() {\n this.canvas.clearCanvas();\n for (var i = 0; i < this.numNodes; i++) {\n var nodeToDraw = this.graph[i];\n\n this.canvas.drawCircle(nodeToDraw.x, nodeToDraw.y);\n }\n }",
"function drawNodes(nodes) {\n // used to assign nodes color by group... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
run weekly mission 1. fetch data from github 2. generate links for all users 3. post link for user to mattermost | async function weeklyReports(){
// github.fetchData();
var orgList = await db.listAllOrgId();
for (var org_id of orgList) {
var reportLinks = await report.generateReportLinks(org_id);
// console.log(reportLinks);
// Send report links
for (var user in reportLinks) {
... | [
"function getGitHubData() {\n // \"https://api.github.com/users/Jurecki07\"\n // fetch or axios request using this url\n // populate them html with the correct data from github\n \n}",
"function link( config, callback ) {\n var linkResult = {}; // results of the operation\n // get commits and p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
splits and decodes encoded values into strings containing of key=value | function decodeEncodedValues(encoded) {
const filterBlanks = item => !!(item || '').replace(/\s+/g, '');
const splitKeyValuePair = line => {
let index = line.indexOf("=");
if (index == -1) {
return [line];
}
return [line.substring(0, index), line.substring(index + 1)]... | [
"function StringMap(string, nameSeparator, valueSeparator, isEncoded) {\n this.nameSeparator = nameSeparator || \"&\";\n this.valueSeparator = valueSeparator || \"=\";\n this.isEncoded = isEncoded == null ? true : booleanValue(isEncoded);\n \n var pairs = new Array();\n string = trim(string);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a and set CSS file path according to default theme | initThemeCSS() {
this.linkEl = document.createElement('link')
this.linkEl.setAttribute('rel', 'stylesheet')
this.linkEl.setAttribute('data-highlight', true)
// Set default theme
this.switchTheme(this.themeName)
document.querySelector('head').appendChild(this.linkEl)
... | [
"function loadCssFile(){\nif (localStorage.selectedTheme === 'animals'){ \n var fileref = document.createElement(\"link\")\n fileref.setAttribute(\"rel\", \"stylesheet\")\n fileref.setAttribute(\"type\", \"text/css\")\n fileref.setAttribute(\"href\", 'animalcardset.css')\n document.getElementsByTagNa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update the patient list based on the filters applied | function updatePatients() {
let fullPatients = App.models.patients.getPatients();
self.patients = _.filter(fullPatients, self.filters);
} | [
"function updatePatientsVisible() {\n\n vm.cohort = osApi.getCohort();\n var align = vm.align.name;\n var sort = vm.sort.name;\n var filter = vm.filter.name;\n var events = vm.events.filter(function(e) {\n return e.selecte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Strict object type check. Only returns true for plain JavaScript objects. | isPlainObject(obj) {
return _toString.call(obj) === '[object Object]'
} | [
"function isPlainObject(obj){return _toString.call(obj) === '[object Object]';}",
"function isPlainObject(obj) { return _toString.call(obj) === '[object Object]'; }",
"function isPlainObject(obj){return _toString.call(obj)==='[object Object]';}",
"function jslibUTypeIsObj (aType) { return (aType == \"object... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a new node to the graph Takes in the value of that node Returns the added node | addNode(value){
if(!value){return null ; }
let node = new Vert(value);
this.nodes[value] = node;
return node;
} | [
"function addNode(n){\n\t\tif(!graph[n]) return _createNode(n);\n\t}",
"function addNode(rgraph, nodeId){\n //get graph to add\n var graph = JSON.stringify(detectExtraNodes(nodeId, JsonData));\n var tureGraph = eval('(' + graph + ')');\n\n \n\n //perform sum animation\n rgraph.op.sum(tureGraph, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load posts and replies dynamically | function loadPostsAndReplies(forumId){
getPostsAndReplies(forumId,function(result){
if(result != null){
var noOfPosts = result.length;
//console.log('noOfPosts - '+noOfPosts);
$("#noOfPostsInfo").text(noOfPosts + ' Posts');
for (var i=0; i < noOfPosts; i++) {
var postDescription = result[i].po... | [
"function loadPosts() {\n $.get(`${URL}/posts?userName=${currentUser.userName}`)\n .done(function (response) {\n bindPostsToTemplate(response);\n })\n}",
"function loadPosts() {\n if (settings.single) {\n loadAllPosts();\n } else {\n loadPostsByMonth();\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create event listeners for left arrow, right arrow, and center figure element | function createEventListeners() {
var leftarrow = document.getElementById("leftarrow");
if (leftarrow.addEventListener) {
leftarrow.addEventListener("click", leftArrow, false);
} else if (leftarrow.attachEvent) {
leftarrow.attachEvent("onclick", leftArrow);
}
var rightarrow = document.getEle... | [
"function createEventListeners() {\n var leftarrow = document.getElementById(\"leftarrow\");\n \n if (leftarrow.addEventListener) {\n leftarrow.addEventListener(\"click\", leftArrow, false);\n }\n \n else if (leftarrow.attachEvent) {\n leftarrow.attachEvent(\"onclick\", leftArrow);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given media object, export the corresponding file to disk, then load as a buffer | function getBufferByMedia( media, itcb ) {
var
tempFile,
mediaObj;
async.series(
[
loadMedia,
exportToDisk,
reorientPdf,
loadToBuf... | [
"async downloadMedia(headers, codec) {\r\n return fetch('/render', headers)\r\n .then(response => response.arrayBuffer())\r\n .then(arrayBuffer => {\r\n const blob = new Blob([arrayBuffer], {type: \"video/\" + codec})\r\n return URL.createObjectURL(blob)\r\n })\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A point pi moves with vi, a segment is defined with pj, vj, we find the time t at which the point intersects and returns parameters s on the segment TODO change order so that pj, vj is the ray | function segmentSegmentIntersection(pi, vi, pj, vj /* Vector of the segment */) {
// (vi -vj)(t, s)^T = (pj - pi)
var det = -(vi.x * vj.y - vj.x * vi.y);
if (det === 0) {
// Parallel lines
// Test this
if ((pi.x - pj.x) * vj.y - (pi.j - pj.y) * vj.x !== 0) return null; // Line does not belong
// T... | [
"function raySegmentIntersection (pi, vi, pj, vj) {\n const intersection = segmentSegmentIntersection(pj, vj, pi, vi)\n if (intersection === null) return interval.empty()\n const {t, s} = intersection\n // t is time in ray, s parameter on the segment\n if (t <= 0 || s < 0 || s > 1) {\n return interval.empty... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the given item to the bag. If the item already exists in the bag, updates the quantity. Arguments: item the item to add | function addItem(item) {
var foundItem = false;
// if there's another item exactly like this one, update its quantity
_.each(bag.getItems(), function(curItem) {
if (curItem.name == item.name && curItem.size == item.size &&
curItem.price == item.price && curItem.color == item.color) {
... | [
"function addItemQty(item, quantity){\n\t\t\tif(!item.qty) item.qty = quantity;\n\t\t\telse item.qty += quantity;\n\t\t}",
"addItem(item) {\n const goodItem = this.checkItem(item);\n if (!goodItem)\n return false;\n\n let foundItem = this.findItem(goodItem);\n\n if (foundIte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
====================================== pop_up_cerrar_ventana: cierra una ventana pop up id_ventana: recibe el id de la ventana a cerrar. ======================================== | function pop_up_cerrar_ventana(id_ventana){
$("#descripcion_img").val("");
$('#mensaje_img').empty();
document.getElementById('sombra').className='sombraUnload';
document.getElementById(id_ventana).className='windowUnload';
} | [
"function cerrarVentanaCarga(){\n $('.fb').hide();\n $('.fbback').hide();\n $('body').css('overflow','auto');\n var cod_inspector = getQueryVariable('id_inspector');\n var codigo_inspeccion = getQueryVariable('cod_inspeccion');\n var consecutivo_inspeccion = $(\"#text_consecutivo\").val();\n message = 'Todo ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests if a token is in range of a paladin and gives them the aura bonus of the paladin with the highest bonus. | calcBonus(token) {
const applicableBonuses = [];
const palList = STATE.PaladinList.get();
const paladinsToRemove = [];
const character = token.characterID && getObj('character', token.characterID);
palList.forEach(pID => {
const paladin = STATE... | [
"function rollUnderRange(){\n let _cToken = PlayabletokenId[betBuilder.idOfToken];\n let _minToPlay = _cToken.min;\n let _payOut = _minToPlay * 2.0102;\n _payOut = floor(_payOut,2);\n let _mul = _cToken.precision;\n $(DOMStrings.leftLmtRange).text('1');\n $(DOMStrings.rightLmtRange).text('95');\n $(DOMStrin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`equ` is used for direct text replacement. | function equ(state) {
var match = state.line.match(equRegex);
if (!match) {
(0, errors_1.throwError)("equ directive was not able to be parsed", state);
}
// lineExpressions only has ["equ", value] and might split the value, so use regex.
var name = match[1];
var value = match[2] || "";
... | [
"function BOT_wordIsEqu(word) {\r\n\tif(word == \"eq\") return(true) \r\n}",
"function equateStringsCaseSensitive(a,b){return equateValues(a,b);}",
"function inlineEquations(text) {\n // We want to match $a$ strings, except\n // * the closing $ is immediately followed by a word character (e.g. currencies)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sorts the specified array a[lo:hi] in descending order, assuming it is already a heap. | function sort(a, lo, hi) {
var n = hi - lo,
t;
while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);
return a;
} | [
"function sort(a, lo, hi) {\n var n = hi - lo,\n t;\n while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);\n return a;\n }",
"function sort(a, lo, hi) {\n var n = hi - lo,\n t;\n while (--n > 0) t = a[lo],... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uploads installation data to Parse.com | function _uploadParseInstallation() {
var deferred = $q.defer(),
parse = config.parse,
reqData = {
deviceType : parse.deviceType,
deviceToken : parse.deviceToken,
pushType : parse.pushType,
GCMSenderId : parse.GCMSenderId
};
$http.post(config.parse.endpoint, reqData, {
"he... | [
"function uploadToCloud(){\n\n }",
"function _upload_data() {\n\t\t\ttry {\n\t\t\t\tif ((Ti.Network.online) && (!Ti.App.Properties.getBool('lock_table_flag'))) {\n\t\t\t\t\t// send gps and download last updated\n\t\t\t\t\t// info\n\t\t\t\t\tif (Ti.App.Properties.getString('current_login_user_id') > 0) {\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes a site design. | deleteSiteDesign(id) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.clone(SiteDesigns, `DeleteSiteDesign`).execute({ id: id });
});
} | [
"deleteSiteDesign(id) {\n return this.clone(SiteDesignsCloneFactory, \"DeleteSiteDesign\").execute({ id: id });\n }",
"function deleteWebSite(index) {\n \n site.splice(index, 1);\n localStorage.setItem(\"siteLists\", JSON.stringify(site))\n displayWebsite()\n}",
"function siteDelete(siteId... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get update router data | getUpdateRouterData(id) {
return {
name: this.updateRouteName,
params: {
id,
},
};
} | [
"function get_updated_data() {\n socket.emit('request data');\n }",
"update_router(smart_router_json, router_id) {\n let url = `https://api.calltrackingmetrics.com/api/v1/accounts/${this.ctm_account_id}/conditional_routers/${router_id}`\n let ctm_auth_string = `${this.ctm_access_key}:${this.ctm_se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
for add iframe for menu for IE6 | function addiframe(elem)
{
var id = $(elem).attr('id');
id = id.substr(2);
if($('#ul'+id).length)
{
var w = $('#ul'+id)[0].offsetWidth;
var h = $('#ul'+id)[0].offsetHeight;
var l = $('#ul'+id)[0].offsetLeft;
var t = $('#ul'+id)[0].offsetTop;
$(elem).append('<iframe src="javascript:false;" id="fr... | [
"function addiframe(elem)\n{\n\tvar id = $(elem).attr('id');\n\tid = id.substr(2);\n\tif($('#ul'+id).length)\n\t{\n\t\tvar w = $('#ul'+id)[0].offsetWidth;\n\t\tvar h = $('#ul'+id)[0].offsetHeight;\n\t\tvar l = $('#ul'+id)[0].offsetLeft;\n\t\tvar t = $('#ul'+id)[0].offsetTop;\n\t\t$(elem).append('<iframe id=\"frame_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the contact previews | _getContactPreviews() {
this._loadContacts(null);
ensureValidToken((valid, token) => {
if(!valid){
this._loadContacts([]);
return;
}
const xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = () => {
... | [
"getPreviews() {\n const previews = {}\n for (const version of this._options.versions) {\n previews[version] = this.getPreview(version)\n }\n return previews\n }",
"active() {\n return this._previews.find(p => p.visible);\n }",
"extractPreviews() {\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check reference to album on facebook. Stub for now | function getAlbumReference() {
return true;
} | [
"_hasAlbum(albumId) {\n return openDatabase(this, (db, resolve, reject) => {\n const transaction = db.transaction(\"albums\", \"readonly\");\n const request = transaction\n .objectStore(\"albums\")\n .index(\"id\")\n .get(albumId);\n request.onsuccess = () => resolve(request.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This event is called when the filename or path of the form is changed. Because the image path is based on the form path the image must be reloaded. | onFilenameChanged() {
this.loadImage();
} | [
"onFilenameChanged() {\n this.loadImage();\n }",
"onFileChange(e) {\n let reader = new FileReader();\n const file = e.target.files[0];\n reader.readAsDataURL(file);\n /* set the value of form field to file value */\n this.form.patchValue({\n image: file,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clicks on Edit for the chosen list item | editListItem(listItemIndex) {
return this.listItems[listItemIndex].$("=Edit").click();
} | [
"function editItemsFromList(e) {\n const element = e.currentTarget.parentElement;\n // set edit item\n editElement = e.currentTarget.previousElementSibling;\n // set form value\n formInput.value = editElement.textContent;\n editFlag = true;\n editID = element.dataset.id;\n submitBtn.textContent = \"edit\";\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ADMIN LOGIN BOX OPEN AND CLOSE | function adminloginbox() {
var x = document.getElementById("adminloginbox");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
} | [
"function loginHandler() {\n setDisplayMenu(false);\n setDisplayLogin(true);\n setDisplaySignup(false);\n setDimOverlay(\"dim\");\n }",
"function switchToLogin(){\n\t\tturnService.closeWaitingAlert();\n\t\t$userLoginArea.show();\t\t\n\t\t$pageWrapper.hide();\n\t}",
"function showLogin() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find price that can fill order and buffer price by one order | function getBestOrderPrice(orderAmount,orderTotal,side,orderbook){if(side.toUpperCase()==='BUY'){var asks=orderbook.asks;// if orderTotal is provided for buy this means pre-fill was used
if(orderTotal){var total=0;var _index2=asks.length-1;while(total<orderTotal&&_index2>=0){total+=parseFloat(asks[_index2].total);_inde... | [
"_findMatches()\n {\n let priceGrouping = {};\n this.getData().forEach((order) =>{\n if (!(order.price in priceGrouping))\n priceGrouping[order.price] = 0;\n\n priceGrouping[order.price]++;\n });\n priceGrouping = Object.keys(priceGrouping).filt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implementation of DOM manipulation to add adventure details to DOM | function addAdventureDetailsToDOM(adventure) {
// TODO: MODULE_ADVENTURE_DETAILS
// 1. Add the details of the adventure to the HTML DOM
console.log(adventure);
document.getElementById("adventure-name").innerHTML = `${adventure.name}`;
document.getElementById(
"adventure-subtitle"
).innerHTML = `${advent... | [
"function addAdventureDetailsToDOM(adventure) {\n // TODO: MODULE_ADVENTURE_DETAILS\n // 1. Add the details of the adventure to the HTML DOM\n\n}",
"function addAdventureDetailsToDOM(adventure) {\n // TODO: MODULE_ADVENTURE_DETAILS\n // 1. Add the details of the adventure to the HTML DOM\n\n var head = docum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts a new binding value into a styling property tuple in the `TStylingContext`. A bindingValue is inserted into a context during the first update pass of a template or host bindings function. When this occurs, two things happen: If the bindingValue value is a number then it is treated as a bindingIndex value (a ind... | function addBindingIntoContext(context, isMapBased, index, bindingValue, countId) {
var valuesCount = getValuesCount(context, index);
var lastValueIndex = index + 3 /* BindingsStartOffset */ + valuesCount;
if (!isMapBased) {
// prop-based values all have default values, but map-based entries do not.... | [
"function addBindingIntoContext(context, index, bindingValue, bitIndex, sourceIndex) {\n if (typeof bindingValue === 'number') {\n var hostBindingsMode = isHostStylingActive(sourceIndex);\n var cellIndex = index + 4 /* BindingsStartOffset */ + sourceIndex;\n context[cellIndex] = bindingValue... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ui: terminus ui reference txt: text area to be stylized dom: stylized pre area is appended to dom mode: format to be displayed in | function stylizeCodeDisplay(ui, txt, dom, mode){
if(ui){
var cmConfig = ui.pluginAvailable("codemirror");
if(!(cmConfig)) return false;
var cm = new Codemirror(txt, mode, cmConfig);
}
else var cm = new Codemirror(txt, mode, {});
var pr = cm.colorizePre();
if(dom) dom.appendCh... | [
"function stylizeEditor(ui, txt, view, mode){\n if(ui){\n var cmConfig = ui.pluginAvailable(\"codemirror\");\n if(!(cmConfig)) return;\n var cm = new Codemirror(txt, mode, cmConfig);\n }\n else{\n var cm = new Codemirror(txt, mode, {});\n }\n\tvar ar = cm.colorizeTextArea(view);\n\tcm.update... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup a virtual 3D scene in which a real time feedback of the player's hands, recorded by the LeapMotion, is displayed under the form of 3D models. This methods instantiates the 3D scene, place the camera (for orienting the view of the hands), and the lights (for colouring the hands). NOTE : The "riggedHand" plugin add... | _setup3DScene() {
// It creates the camera.
let distCamera = 500;
let heightCamera = 300;
let ratio = 4;
let camera = new THREE.OrthographicCamera(
window.innerWidth / - ratio, // LEFT frustum plane
window.innerWidth / ratio, // RIGHT frustum pla... | [
"function init(){\n\n controller = new Leap.Controller();\n\n scene = new THREE.Scene();\n \n camera = new THREE.PerspectiveCamera( \n 50 ,\n window.innerWidth / window.innerHeight,\n sceneSize / 100 ,\n sceneSize * 4\n );\n\n // placing our camera position so it can see everything\n camera.posit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
bg is drawn adds specific animation to the symbol accordingly as long as there's more than 0 symbols in the array symbols are drawn on canvas | function update() {
drawBG();
for (let i = 0; symbols.length > i; i++) {
if (symbols[i].name == "star" || symbols[i].name == "sun" || symbols[i].name == "moon") {
symbols[i].rescale();
}
if (symbols[i].name == "tree") {
symbols[i].rotat... | [
"function displayComp(i){\r\n bg_mk.angleMode(DEGREES);\r\n bg_mk.rotate(0.05);\r\n bg_mk.noStroke();\r\n bg_mk.rectMode(RADIUS)\r\n bg_mk.fill(quadsBG[i].color);\r\n bg_mk.rect(quadsBG[i].x, quadsBG[i].y, quadsBG[i].w, quadsBG[i].h);\r\n}",
"function drawQuadsBG() {\r\n //reset arrays\r\n quadsBG.length ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a grid of vectors to points (P) so that they can be processed and turned into faces | function tileVectorToPoints(vs){
var ps = [];
for (var i=0; i<vs.length; i+=1){
ps.push([]);
for (var j=0; j<vs[i].length; j+=1){
ps[i].push(new P(vs[i][j]));
}
}
return ps;
} | [
"function placePointsGrid(grid_size, w, h) {\n var points = [];\n\n for (var y = 0; y < grid_size; y++) {\n for (var x = 0; x < grid_size; x++) {\n points.push({\n x: (x + .5) / grid_size * w,\n y: (y + .5) / grid_size * h,\n });\n }\n }\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
After the component mounts, fetch a weeks worth of hours for the date that was selected (defaulting to 'now') | componentDidMount() {
this.setHideTimeout()
this.props.fetchHours(
this.props.api.hours,
getWeekArray(moment().format("YYYY-MM-DD"))
)
} | [
"tick () {\n this.setState({\n hour: DateTime.local().hour,\n })\n }",
"handleSubmitHours_() {\n const {selectedSubscriptionWindow: {days}} = getStore();\n\n updateStore({\n action: actions.SELECTED_HOURS,\n data: {days, hours: this.hours_},\n });\n\n this.reset_();\n }",
"con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update COD Debit Transaction | updateDebitCod(id, payload) {
return this.request.put(`/${id}`, payload);
} | [
"doTransaction() {\n let oldNum = this.num.getNum();\n let newNum = oldNum + this.amountToAdd;\n this.num.setNum(newNum);\n }",
"doTransaction() {\n let oldNum = this.num.getNum();\n \n let newNum = oldNum + this.amountToAdd;\n \n this.num.setNum(newNum);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extract cornes from an array of annotations with element having boundBox.vertices prop | annotationsVertices (annotations) {
let start = annotations[0].boundingBox.vertices
let end = annotations[annotations.length - 1].boundingBox.vertices
return [ start[0], end[1], end[2], start[3] ]
} | [
"function convertCor(array,boundary){\n var polylines=[];\n var len = array.length;\n\n for(var i=0; i<len ; i++){\n var m = array[i].x;\n var n = array[i].y;\n m = convertToWebGLReference( boundary.maxX, boundary.minX, m);\n n = convertToWebGLReference( boundary.maxY, boundary.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add event listeners and loads bookmarks | function setup() {
initializeDatabase(renderBookmarks);
document.querySelector('input#url').addEventListener('keyup', validateURL);
document.querySelector('.submit-link-form > form').addEventListener('submit', addLink);
document.querySelector('.pages').addEventListener('click', handlePageNavClick);
document.q... | [
"function main(){\n api.getBookmarks()\n .then(bookmarks =>{\n bookmarks.forEach(bookmark => state.addBookmark(bookmark));\n bookmark.render();\n });\n bookmark.bindEventListeners();\n}",
"function initBookmarks() {\n if (!bgPage.bookmarksInitialized) {\n bgPage.bookmarksInitialized = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to handle for statements (return list of dependencies from all three parts) TODO: once we have list of nested for loops above current line, we can process the current line and then process each for statement and add deps to that list | function handle_fors(node, vars) {
// verify that node is a For Statement
if ( node.type != "ForStatement" ) {
throw "handle_fors() called on node that is not a for statement!!";
}
// handle the assignment (first part of the for statement)
if ( node.init.type == "AssignmentExpression" ) {
... | [
"function addFor() {\r\n\t\t//if (!firstMove) {\r\n\t\t//\taddMainProgramComment();\r\n\t\t\tfirstMove = true;\r\n\t\t//}\r\n\t\tvar indentStr = findIndentation(selRow);\r\n\t\tvar row;\r\n\t\tvar cell;\r\n\t\tvar innerTable;\r\n\r\n\t\tfor (var i = 0; i < 3; i++) {\r\n\t\t\trow = codeTable.insertRow(selRow + i);\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Atualiza as informacoes referentes a pontos de vida do personagem. | function _AtualizaPontosVida() {
// O valor dos ferimentos deve ser <= 0.
var pontos_vida_corrente =
gPersonagem.pontos_vida.total_dados + gPersonagem.pontos_vida.bonus.Total() + gPersonagem.pontos_vida.temporarios
- gPersonagem.pontos_vida.ferimentos - gPersonagem.pontos_vida.ferimentos_nao_letais;
I... | [
"function perdioVida() { \n setState(TIEMPOESPERA);\n user.perdioVida();\n if (user.conseguirVidas() > 0) {\n inicioNivel();\n }\n }",
"atualiza() {\n const intervaloDeFrames = 10;\n const passouIntervalo = frames % intervaloDeFrames === 0;\n if (pon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Evaluates, or attempts to evaluate, a NonNullExpression | function evaluateNonNullExpression({ node, environment, evaluate, statementTraversalStack }) {
return evaluate.expression(node.expression, environment, statementTraversalStack);
} | [
"tryEvaluate(field, data = {}) {\r\n return this.evaluate(field, data).orElseThrow();\r\n }",
"function evaluate(stmt) {\n if (is_self_evaluating(stmt)) {\n return stmt;\n } else if (is_empty_list_expression(stmt)) {\n return evaluate_empty_list_expression(stmt);\n } else if (is_name(stm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |