query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Invoke these methods on the mParticle.Identity.getCurrentUser().getCart() object. Example: mParticle.Identity.getCurrentUser().getCart().add(...); | function mParticleUserCart(mpid){
return {
/**
* Adds a cart product to the user cart
* @method add
* @param {Object} product the product
* @param {Boolean} [logEvent] a boolean to log adding of the cart object. If blank, no logging occurs.
*/
add: function(pr... | [
"function mParticleUserCart(mpid){\n return {\n /**\n * Adds a cart product to the user cart\n * @method add\n * @param {Object} product the product\n * @param {Boolean} [logEvent] a boolean to log adding of the cart object. If blank, no logging occurs.\n */\n add... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a piecewise 2D cumulative distribution function of light intensity from an env map | function envMapDistribution(image) {
var data = image.data;
var cdfImage = {
width: image.width + 2,
height: image.height + 1
};
var cdf = makeTextureArray$1(cdfImage.width, cdfImage.height, 2);
for (var y = 0; y < image.height; y++) {
var sinTheta = Math.sin(Math.PI * (y + 0.5) /... | [
"function envMapDistribution(image) {\n const data = image.data;\n\n const cdfImage = {\n width: image.width + 2,\n height: image.height + 1\n };\n\n const cdf = makeTextureArray$1(cdfImage.width, cdfImage.height, 2);\n\n for (let y = 0; y < image.height; y++) {\n const sinTheta = Math... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to insert that email visit the opportunity | function saveEmailVisitOpportunity(email, opportunity, objective){
return new Promise((resolve, reject) => {
pool.query(`INSERT ebdb.EmailVisitedOpportunity(email, opportunity, objective)
VALUES (?, ?, ?)
`, [email, opportunity, objective],
function(error, results, fields){
... | [
"function insertInvitationEntity(connection,entity,addresses,localtolls)\n{\n \n if(entity.AccessCode=='' || entity.AccessCode==null || entity.AccessCode=='undefined' || entity.AccessCode==undefined )\n {\n utility.log('AccessCode is not found.');\n mailer.sendMail(config.PIN_NOT_FOUND_EMAIL_SUBJECT,config.PIN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets Locaalstorage to the value of cart | function setCart() {
localStorage.setItem("cart", JSON.stringify(cart)); //updates the cart
} | [
"function setCart(){\n\t\tstorage.set({ \n\t\t\titems: 0, \n\t\t\tsubtotal: 0\n\t\t}, function(){\n\t\t\tupdateCart();\n\t\t});\n\t}",
"function setCartData(data) {\n localStorage.setItem('cart', JSON.stringify(data));\n}",
"function updateLocalCart(cart) {\n localStorage.setItem('cart', JSON.stringify(cart... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bind model factory service. | bindFactoryService() {
this.app.singleton('db.factory', Factory);
} | [
"createBindingModel(model) {\n let proxy;\n try {\n proxy = new Function('model', `\n 'use strict';\n return class ${model.name} extends model {}\n `)(model);\n }\n catch (_a) {\n /* istanbul ignore next: rollback (mostly <= IE10) */\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to position the site header. | function __repositionSiteHeader(headerHeight, $siteInner) {
if ('fixed' == __getPositionValue('.site-header')) {
$siteInner.css('margin-top', headerHeight + 'px');
} else {
$siteInner.removeAttr('style');
}
} | [
"function headerLocation() {\n if ($('body').innerWidth() < 1024) {\n // let headerHeight = header.outerHeight(true),\n // navigationBarHeight = navigationBar.outerHeight(true);\n // console.log(headerHeight);\n // console.log(document.body.clientWidth);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
unused harmony export ping | function ping() {
return 'pong';
} | [
"function Ping() {}",
"function pingPlugins() {\n plugin.Api('/ping.json', 'GET', [], [], function (e) {\n logResponse(e, developer);\n });\n}",
"onping() {\r\n this.emitReserved(\"ping\");\r\n }",
"onping() {\n this.emitReserved(\"ping\");\n }",
"onping() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets or sets the current line number | get lineNumber() {
return this.state.lineNumber;
} | [
"function gotoLine() {\n\teditor.openDialog('<input type=\"text\" value=\"default\">Line number</input>',\n\t\tfunction (str) {\n\t\t\tvar numLine = parseInt(str, 10);\n\t\t\t//console.log('Line:', str, numLine, isNaN(numLine));\t// DBG\n\t\t\tif (isNaN(numLine)) {return; }\t// Not a Number\n\t\t\tif (numLine > edi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plots an array of items on the graph. Provides drawingCallback with the x and y coords, as well as the current value. | function plot(values, drawingCallback) {
var xStep = plotArea.width / (values.length),
paddedHeight = plotArea.height + opts.padding,
adjustedHeight = paddedHeight > opts.height ? plotArea.height + 1 : paddedHeight, // Can't be larger than total height
xOffset = plotArea.x,
... | [
"plot() {\n\n\t\tlet points = this.points,\n\t\t\tctx = this.ctx;\n\t\tthis.ctx.fillStyle = \"#000\";\n\n\t\t// draw black points from our array\n\t\tctx.clearRect(0, 0, 400, 400);\n\t\tpoints.forEach((el, i) => {\n\t\t\tctx.beginPath();\n\t\t\tctx.arc(points[i].x, points[i].y, 4, 0, Math.PI * 2);\n\t\t\tctx.fill()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fade nodes on hover | function mouseOver(opacity) {
return function(d) {
// fade
node.style("stroke-opacity", function(o) {
thisOpacity = isConnected(d, o) ? 1 : opacity;
return thisOpacity;
});
node.style("fill-opacity", function(o) {
... | [
"fade_in_nodes(colour) {\r\n fade_in_nodes_d3(colour);\r\n }",
"function fade_nodes(opacity) {\n\t\treturn function(g, i) {\n\t\t\tsvg.selectAll(\".node\")\n\t\t\t .filter(function(d) {\n\t\t\t\t\treturn d.typeid != i+1;\n\t\t\t\t\t\n\t\t\t\t})\n\t\t\t\t.transition()\n\t\t\t\t.style(\"opacity\", opacity... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TimeLineAnimation: is a "class" that contains the behavior to animate the scrolling line showing the tie lapse on the brush handles. | function TimeLineAnimation(brushInput, tHeight, fxnCallBack){
// reference to the brush zone to allow for ".resize" handles to be grabbed.
this.brushInput = brushInput;
this.fxnCallBack = fxnCallBack;
// create the line variable.
this.lineAnimate = this.brushInput.append("line")
.attr("transform", ... | [
"function TimeLine() {\n animateList[animateId] = this;\n this.animateId = animateId;\n animateId++;\n\n this.timeLine = [];\n this.time = 0;\n this.startTime = -1;\n }",
"animateTimelines() {\n\n //master timeline\n new TimelineMax()\n .add(th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
car/finish line contact callback. Called at the completion of each lap | function crossFinishLine(carBody, lineBody, carFixture, lineFixture, begin, contact) {
//make sure it is a begin event so it is only called once each time the finish line is crossed
if (begin) {
if (lastLapTime != 0) { // if lastLapTime is not 0(if this isn't the first time crossing the finish line)
... | [
"function linesCB(l) {\n console.log('\\n-------------');\n console.log('A SimpleCTI.linesCB(' + l.length + ')');\n\n\n // Lines are returned in a list - Hook them all\n while (l.length) {\n var line = l.shift();\n /*\n * In this example we allow the lin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts spread assignments at the specified index. | insertSpreadAssignments(index, structures) {
return this._insertProperty(index, structures, () => this._context.structurePrinterFactory.forSpreadAssignment());
} | [
"insertSpreadAssignment(index, structure) {\r\n return this.insertSpreadAssignments(index, [structure])[0];\r\n }",
"insertAt(index, data) {}",
"function insert(arr, element, index) {\n insertAll(arr, [element], index);\n}",
"insertPropertyAssignments(index, structures) {\r\n return this._in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display an information message to the end user | function info(message) {
notify("Information", message);
} | [
"function show_info() {\n\tswitch (window.location.search) {\n\t\tcase '?succ_add':\n\t\t\tshow_message('Added new entry successfully!', 'green');\n\t\t\tbreak;\n\t\tcase '?fail_add':\n\t\t\tshow_message('Failed to add new entry due to invalid input!', 'red');\n\t\t\tbreak;\n\t\tcase '?succ_del':\n\t\t\tshow_messag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end buy_tower_btns name: do_buy description: does the buy action once a buy btn is clicked input:none output:none | do_buy(name) {
var tt = this;
var w = tt.world;
//try to buy the tower
if (w.buy_tower(this.yparent, name)) {
tt.remove_children();//remove buy btns
this.tower_stats();//show tower stats
this.phase = "stats";//change state (also disables buy btns)
} else {
return;//failed to buy... | [
"buy_towers_click() {\n if (this.phase !== \"buy\") {\n return;\n }\n var tt = this;\n var w = tt.world;\n\t\n\t\n if (tt.normal_tower.clicked(2)) {\n this.do_buy(\"normal\");\n\n }\n if (tt.ice_tower.clicked(2)) {\n this.do_buy(\"ice\");\n }\n if (tt.poison_tower.clicked(2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the type of element that should be created for the given mimetype. | function getMajorMimeType(mimetype) {
if (/^video/.test(mimetype)) {
return "video";
} else {
return "audio";
}
} | [
"function getItemType(mimeType) {\n if (dndState.isDragging) return dndState.itemType || undefined;\n if (mimeType == MSIE_MIME_TYPE || mimeType == EDGE_MIME_TYPE) return null;\n return (mimeType && mimeType.substr(MIME_TYPE.length + 1)) || undefined;\n }",
"function getItemType(mimeType... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
jumpBackward(distance) jump backward given a certain distance jumpBackward(50); | function jumpBackward(distance) {
$._move(0-distance, false);
} | [
"function moveBackward(distance) {\n $._move(0-(distance || 50), true);\n}",
"function jumpForward(distance) {\n $._move(distance, false);\n}",
"async function jumpBackwards() {\n let newPosition = await TrackPlayer.getPosition();\n newPosition -= jumpInterval;\n if (newPosition < 0) {\n newPosi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Concatenates each part's quantity with each location, and pastes it into the "Location" column (global variable 'concatStringColumn') Looks like "4 in Right Side T", with a new line for each location the part is in | function collectLocations() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Master Inventory');
var lastColumn = sheet.getLastColumn();
var range = sheet.getRange(firstBarcodeRow,firstBarcodeColumn,masterLastRow,lastColumn);
var sheetValues = range.getValues();
var locat... | [
"function formatLocationText(tmp) {\n\n var text = new Array()\n \n for (idx in tmp) {\n \n var h = tmp[idx][1].slice(0,2)\n var m = tmp[idx][1].slice(3,5)\n \n text.push(\" \" + tmp[idx][0]+ \" is available until \" + timeToString(h,m) + \"\\n\\n\")\n } \n \n return text.join(\"\")\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Simple Fun 10: Range Bit Counting Task 12 | function rangeBitCount(a, b) {
//coding and coding..
var sum = 0;
for (var i = a; i <= b; i++){
sum += i.toString(2).replace(/0/g, '').length;
}
return sum;
} | [
"function rangeBitCount(a, b) {\n var sum = 0;\n for(var i = a; i<=b; i++){\n var arr = i.toString(2).split('');\n for(var j = 0; j<arr.length; j++){\n if(arr[j] == '1'){\n sum++;\n }\n }\n }\n return sum;\n}",
"function rangeBitCount(a, b) {\n let count = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resolves the given (potentially relative) URL in the same way as the browser would resolve it | function resolveURL(url) {
return new URI(url).absoluteTo(new URI(document.baseURI).search("")).toString();
} | [
"function resolveUrl(url) {\n var url_ = new URI(url);\n return url_.resolve(urlObj).toString();\n }",
"function resolveUrl(req, relativeURL) {\n\tvar baseUri = req.url || \"\";\n\tif (req.protocol && req.get) {\n\t\tbaseUri = req.protocol + '://' + req.get(\"host\") + baseUri;\n\t}\n\n\tvar outU... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Chapter 12 After Class When the player spanks Amanda, with the fighting skill it can affect her submission level | function C012_AfterClass_Amanda_Spank() {
CurrentTime = CurrentTime + 50000;
if (!GameLogQuery(CurrentChapter, CurrentActor, "Spank")) {
GameLogAdd("Spank");
ActorChangeAttitude(-1, 1 + PlayerGetSkillLevel("Fighting"));
}
if (PlayerGetSkillLevel("Fighting") > 0) OverridenIntroText = GetText("SpankWithStrength")... | [
"function C012_AfterClass_Jennifer_Spank() {\n\tCurrentTime = CurrentTime + 50000;\n\tif (PlayerGetSkillLevel(\"Fighting\") > 0) {\n\t\tOverridenIntroText = GetText(\"SpankWithStrength\");\n\t\tif (!GameLogQuery(CurrentChapter, CurrentActor, \"Spank\")) {\n\t\t\tGameLogAdd(\"Spank\");\n\t\t\tActorChangeAttitude(0, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Description Controls the progress bar for the meta part of the test | function metaProgress() {
$('#metabar').css("width", function() {
return $(this).attr("aria-valuenow") + "%";
});
} | [
"showProgressBar() {\n // Get the progress bar filler texture dimensions.\n const {\n width: w,\n height: h\n } = this.textures.get('progress-bar').get();\n\n // Place the filler over the progress bar of the splash screen.\n const img = this.add.sprite(100, 350, 'progress-bar').setOrigin(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= Description Gets a element attribute of the view's cell. = Parameters +_key+:: The attribute key to get. +_force+:: Optional force switch, defaults to false = Returns The attribute value. | attr(_key, _force) {
return ELEM.getAttr(this.elemId, _key, _force);
} | [
"attrOfPart(_partName, _key, _force) {\n const _elemId = this._getMarkupElemIdPart(_partName, 'HView#attrOfPart');\n if (this.isntNull(_elemId)) {\n return ELEM.getAttr(_elemId, _key, _force);\n }\n else {\n return '';\n }\n }",
"function getAttribute(key) {\n\t\tif (typeof getters[key] ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the first ancestor of elem having tagname "type" example : var mydiv = selectAncestor(myelem, "div"); | function selectAncestor (elem, type) {
type = type.toLowerCase();
if (elem.parentNode === null) {
console.log("No more parents");
return undefined;
}
var tagName = elem.parentNode.tagName;
if ((tagName !== undefined) && (tagName.toLowerCase() === type)) {... | [
"function selectAncestor (elem, type) {\n\ttype = type.toLowerCase();\n\tif (elem.parentNode === null) {\n\t console.log(\"No more parents\");\n\t return undefined;\n\t}\n\tvar tagName = elem.parentNode.tagName;\n\n\tif ((tagName !== undefined) && (tagName.toLowerCase() === type)) {\n\t return elem.parentN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an edge set with all weights from the original delaunay triangulation. | function getEdgeWeightsDT( points ){
var dT = createDelaunayTriangulation(points);
var E = new Map();
for(var i=0; i<dT.length; i++){
for(var j=0; j<dT[i].length; j++){
if(!E.has( dT[i][j] + "," + i ) && isFinite(dT[i][j])){
E.set( i + "," + dT[i][j] , distance(points[i], points[dT[i][j]])... | [
"edgeSet() {\n return new abstract_set_1.AbstractSet(...this._edges.toArray());\n }",
"getAllEdges() {\n let edges = [];\n\n for (let [from, edgeList] of this.outboundEdges) {\n for (let [type, toNodes] of edgeList) {\n for (let to of toNodes) {\n edges.push({\n fro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
we have to check that one of the two arrays consists of square of second array. and return true if it happens else return false. 1. check whether two arrays are of equal length or not. 2. | function ArraySquareChecker(a1,a2){
// checking if the length of the both arrays is same or not
if(a1.length !== a2.length){
return false;
}
// checking if the correct square number is present in the second array in correct frequency or not.
else{
for(let i=0;i<a1.length;i++){... | [
"function squares(arr1, arr2) {\n // iterate thru the first array\n if (arr1.length === arr2.length) {\n for (let i = 0; i < arr1.length; i++) {\n // check if the el*el is present into the second arr\n // ** 2\n if (arr2.includes(arr[i] ** 2)) {\n // get the idx of that el*el in the secon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
synchronous connect to a WebSocket | function wsConnect(url) {
var future = new Future();
var ws = new WebSocket(url);
ws.on('open', function () {
ws.pause();
future.return(ws);
});
ws.on('error', function (err) {
future.return(err);
});
return future;
} | [
"connect(cb) {\n if(\"WebSocket\" in window)\n {\n if(this.sock != null)\n {\n return;\n }\n \n if (typeof MozWebSocket != \"undefined\")\n {\n this.sock = new MozWebSocket(this.url);\n }\n else\n {\n this.sock = new WebSocket(this.url);\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch a restaurant by its ID. | static fetchRestaurantById(id) {
// fetch all restaurants with proper error handling.
return fetch(DBHelper.DATABASE_URL_ID(id))
.then( response => {
if (response.ok){
return response.json();
}
}).catch(function(err){
console.log('Fetch error', err);
});
} | [
"static fetchRestaurantById(id) {\n return DBHelper.fetchRestaurants()\n .then(restaurants => restaurants.find(r => r.id === id));\n }",
"static fetchRestaurantById(id) {\r\n // fetch all restaurants with proper error handling.\r\n return DBHelper.fetchRestaurants()\r\n .then(restaurants => rest... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load and create tSNE worker. | createWorkerTsne () {
return new Promise((resolve, reject) => {
const hash = window.hipilerConfig.workerTsneHash.length ?
`-${window.hipilerConfig.workerTsneHash}` : '';
const loc = window.hipilerConfig.workerLoc || 'dist';
queue()
.defer(text, `${loc}/tsne-worker${hash}.js`)
... | [
"function createWorker()\n {\n var childWorkerId = workerPool.createWorkerFromUrl('js/'+WORKER_FILENAME);\n workerPool.sendMessage([\"3..2..\", 1, {helloWorld: \"Hello world!\"}], childWorkerId);\n }",
"function CloudNodesWorker() {}",
"function initTernWorker() {\n if (_ternWorker) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create object constructor for "pizza" that contains properties for the pizza size, the toppings, and the cost | function Pizza(size, toppings, cost) {
this.size = size;
this.toppings = 0;
this.cost = 0;
} | [
"function Pizza(size, cheese, toppings) {\n this.size = size,\n this.cheese = cheese,\n this.toppings = toppings,\n this.price = 0\n}",
"function buildPizza(size, toppings, price){\n this.size = size;\n this.toppings = toppings;\n this.price = price;\n}",
"function Pizza(myPizza, mySize, myTopping) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if top section has a initial entry for a particular business | checkSectionIsTop() {
if (!this.props.parentSectionBiz) {
return true;
}
} | [
"function orgCheck_hasHomepage( org ){\n if (checkKeyIsValid(org, \"contact\")){\n for (var i = 0; i < org.contact.length; i++){\n var contact = org.contact[i];\n if(contact.hasOwnProperty(\"website\") && contact.website !== null && contact.website.length > 1){\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or sets the end position or offset of a text selection. | get selectionEnd() {
return this.getInput().selectionEnd;
} | [
"get selectionEnd() { return this.selectionEndIn; }",
"get selectionEnd() {\n return this.i.selectionEnd;\n }",
"get end() {\n return this.selector('TextPositionSelector').end;\n }",
"get SelectionEnd() { return this.native.SelectionEnd; }",
"get selectionEnd() {\n return this.$.textarea.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct an IEditorFactoryService for CodeMirrorEditors. | function CodeMirrorEditorFactory(defaults) {
if (defaults === void 0) { defaults = {}; }
var _this = this;
/**
* Create a new editor for inline code.
*/
this.newInlineEditor = function (options) {
options.host.dataset.type = 'inline';
return new ... | [
"function _createDefaultEditorFactory() {\n var editorServices = new codemirror_1.CodeMirrorEditorFactory();\n return editorServices.newInlineEditor.bind(editorServices);\n }",
"function _createDefaultEditorFactory() {\n let editorServices = new codemirror_1.CodeMirrorEditorFactory();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
uploadSuccess : The upload succeed. We still need to parse its response | function uploadSuccess(event, file, data, response) {
// Getting JSON answer
try { data = $.parseJSON(data); }
//Not JSON
catch(e) {
resetUploadUI();
return $.ui.dialog.error(__('serverResponseUnknown'), __('error'));
}
// JSON return error
if (data.error) {
if (timeoutSample... | [
"function OnHttpUploadSuccess() {\n console.log('successful');\n}",
"handleSuccessfulUpload(file) {\n const json = JSON.parse(file.xhr.response);\n\n // SilverStripe send back a success code with an error message sometimes...\n if (typeof json[0].error !== 'undefined') {\n this.handleFailedUpload... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if there is an enemy at the specified position and false otherwise | function enemyAt(position) {
if (position < 0) {
return false;
}
if (position > ($scope.enemyBoard.board.length - 1)) {
return false;
}
return true;
} | [
"function isEnemy(element) {\r\n\treturn element.spawnType == \"Enemy\";\r\n}",
"function hittingEnemy(){\n \n for (var i = enemies.length-1;i>=0;i--){\n var enemy = enemies[i];\n if (Math.abs(enemy.x - x)<(COIN_SIZE + enemy.size)/2 \n && Math.abs(enemy.y - y)<(COIN_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if an element can receive focus programmatically or via a mouse click. If checkTabIndex is true, additionally checks to ensure the element can be focused with the tab key, meaning tabIndex != 1. | function isElementTabbable(element, checkTabIndex) {
// If this element is null or is disabled, it is not considered tabbable.
if (!element || element.disabled) {
return false;
}
var tabIndex = 0;
var tabIndexAttributeValue = null;
if (element && element.getAttribute) {
t... | [
"function isElementTabbable(element, checkTabIndex) {\n // If this element is null or is disabled, it is not considered tabbable.\n if (!element || element.disabled) {\n return false;\n }\n var tabIndex = 0;\n var tabIndexAttributeValue = null;\n if (element && element.getAttribute) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cb(err, owners) recursively fill the passed owners array | function getOwner(contractInstance, idx, owners, cb) {
contractInstance.ownersArr(idx, function(err, ownerX) {
console.log('getOwner: err = ' + err + ', ownersArr[' + idx + '] = ' + ownerX);
if (!err && !!ownerX && common.web3.isAddress(ownerX)) {
owners.push(ownerX);
if (idx <= 10) {
getOwner(contrac... | [
"function create_assets(build_marbles_users) {\n build_marbles_users = saferNames(build_marbles_users);\n logger.info('Creating marble owners and marbles');\n var owners = [];\n\n if (build_marbles_users && build_marbles_users.length > 0) {\n async.each(build_marbles_users, function (username, ow... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates a person's property with a value. | function updatePerson(person, prop, value){
person[prop] += value;
} | [
"setPlayerProperty(player, property, value) {\n\t\tlet data = {};\n\t\tdata[property] = value;\n\t\tthis.App.data.updatePlayer(player.id,data)\n\t}",
"function editVolunteer(property, value) {\n volunteer[property] = value\n}",
"updateProp(id, value) {\n const propName = this.propertyIndex[id].propert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update quiz result orders | function updateQuizResultOrders() {
$("#quiz_results_container .panel-quiz-result").each(function (index) {
var resultId = $(this).attr('data-result-id');
$('#quiz_result_order_' + resultId).text(index + 1);
$('#input_quiz_result_order_' + resultId).val(index + 1);
});
} | [
"function update_quiz_result_orders() {\n $(\"#quiz_results_container .panel-quiz-result\").each(function (index) {\n var result_id = $(this).attr('data-result-id');\n $('#quiz_result_order_' + result_id).text(index + 1);\n $('#input_quiz_result_order_' + result_id).val(index + 1);\n });\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a new mysteryWord object from the linked constructor, and a goalWord to compare it against | function newWord(word) {
mysteryWord = new Word(word);
mysteryWord.guess(" ");
goalWord = word;
goalWord = goalWord
.split("")
.join(" ")
.concat(" ");
} | [
"function newWord() {\n wordToGuess = compChoices();\n myInstrument = new Word(wordToGuess);\n}",
"function newWord() {\n\tvar chosenWord;\n\t// grabs random word from masterList\n\tchosenWord = masterList[Math.floor(Math.random() * masterList.length)];\n\t// makes a new Word object\n\tvar makeWord = new wo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gallerySlider: PDP page gallery functions | function gallerySlider() {
var elGallerySlider = document.getElementById('gallery_slider');
// check if ul.gallery_slider does not exist
if (elGallerySlider == null) {
return;
}
// ul.gallery does exist... so let's get our variables
var elGalleryThumbs = document.getElementById('gallery_thumbs'),
... | [
"function mkdPostGallerySlider(){\n\n var bsHolder = $('.mkd-pg-slider');\n\n if(bsHolder.length){\n bsHolder.each(function(){\n var thisBsHolder = $(this);\n\n thisBsHolder.flexslider({\n selector: \".mkd-pg-slides\",\n an... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Step 3: Discounts Offered | function singleClickDiscountsOffered(){
runReportAnimation(15); //of Step 2 which takes 10 units
$.ajax({
type: 'GET',
url: COMMON_LOCAL_SERVER_IP+'/'+SELECTED_INVOICE_SOURCE_DB+'/_design/invoice-summary/_view/grandtotal_discounts?startkey=["'+fromDate+'"]&endkey=["'+toDate+'"]',
timeout: 10000,
su... | [
"function accidentOption()\n{\n for (var i=0; i<rentals.length;i++)\n {\n if(rentals[i].options.deductibleReduction == true) \n {\n rentals[i].price+= 4* (getRentDays(rentals[i].pickupDate,rentals[i].returnDate) +1);\n }\n \n rentals[i].commission.drivy += 4* (getRentDays(rental... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert suit to entity code | translateSuitToEntityCode(){
return this.suitObjects[`${this.randomSuitName0 }`];
} | [
"function ecode(entity) /* (entity : entity) -> int */ {\n return entity.ecode;\n}",
"function mapGadQuestion4ToCode(entity){\n\n\tswitch(entity){\n\t\tcase 'not at all':\n\t\t\treturn 'at0024';\n\t\t\tbreak;\n\t\tcase 'several days':\n\t\t\treturn 'at0025';\n\t\t\tbreak;\n\t\tcase 'more than half the days':\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the angle equivalent of a value. | getAngleByValue(value, calculateDrawValue, returnDegrees) {
const that = this.context;
if (calculateDrawValue !== false && that.logarithmicScale) {
value = Math.log10(value);
}
const angleOffset = (value - that._drawMin) * that._angleRangeCoefficient;
let degrees;
... | [
"toAngle( val ) {\n return this.pointA.angle + ((val - this.pointA.value) * this.unitDegrees);\n }",
"function valueToAngle(value, maxValue, zeroAngle) {\n return ((value / maxValue) * pi2) + zeroAngle;\n}",
"function angle(v) {\n return Math.atan2(-v[1], v[0]) * 180 / Math.PI;\n}",
"getAngle(){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
for attrs that interact (like scales & autoscales), save the old vals before making the change val=undefined will not set a value, just record what the value was. attr can be an array to set several at once (all to the same val) | function doextra(attr, val) {
if (Array.isArray(attr)) {
attr.forEach(function (a) {
doextra(a, val);
});
return;
}
// if we have another value for this attribute (explicitly or
// via a parent) do not override with this auto-generated extra
if (attr in aobj || helpers.has... | [
"function setAttr (drawing, attr, value) {\n\n\t\tdrawing[attr].value = value;\n\t\tdrawing.changed.value = true;\n\n\t}",
"function setAttribute(attr, svgArray, val){\n var i = 0, len = svgArray.length, attrLength = attr.length, idx=-1, valueStart = 0;\n for(i; i < len; i++){\n idx = svgArray[i].indexOf(att... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maps a `Result` to `U` by applying _transformer_ to a contained `Ok(T)` value in _input_, or a _recoverer_ function to a contained `Err(E)` value in _input_. This function can be used to unpack a successful result while handling an error. | function mapOrElseForResult(input, recoverer, transformer) {
if (input.ok) {
var result = transformer(input.val);
return result;
}
var fallback = recoverer(input.err);
return fallback;
} | [
"function mapForResult(input, transformer) {\n if (!input.ok) {\n return input;\n }\n var result = transformer(input.val);\n return Result_1.createOk(result);\n}",
"function mapOrForResult(input, defaultValue, transformer) {\n if (input.ok) {\n var result = transformer(input.val);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to add a new toy | function addNewToy(name, image){
fetch('http://localhost:3000/toys', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({name, image, likes: 0})
})
.then(response => response.json())
.then(newToy => {
if (newToy) {
... | [
"function createNewToy(event){\n event.preventDefault();\n\n const formData = {\n name: event.target[0].value,\n image: event.target[1].value,\n likes: 0\n }\n\n event.target.reset();\n\n const reqObj = {\n method: 'POST',\n headers: {\n \"Content-Type\": \"application... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scale a size from the room to the view | scaleToRoom(size) {
return size * this.view.viewToSpaceRatio * this.view.zoomRatio;
} | [
"function setScale() {\n\t\tvar s = $(view).height() / (4 * $(world).height());\n\t\ttransform($(scale), 'scale(' + s.toFixed(4) + ',' + s.toFixed(4) + ')');\n\t}",
"resize() {\n this.setScale();\n }",
"function scaleToView(v) {\r\n v.x += 1.0;\r\n v.y += 1.0;\r\n v.x *= 0.5 * windowWidth;\r\n v.y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check collision with left players paddle. | _checkleftPaddleCollision() {
return (
this.position.x - this.width / 2 <= leftPaddle.position.x + leftPaddle.width / 2 &&
this.position.y >= leftPaddle.position.y - leftPaddle.height / 2 &&
this.position.y <= leftPaddle.position.y + leftPaddle.height / 2
);
} | [
"checkPaddleCollision() {\n // Left wall check\n if (this.paddle1.X + this.paddle1.W > this.canvas.width) {\n this.paddle1.X = this.canvas.width - this.paddle1.W;\n } else if (this.paddle1.X < 0) {\n this.paddle1.X = 0;\n }\n\n // Right Wall Check\n if (this.paddle2.X + this.paddle2.W > ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Appends the necessary HTML to the taskList element in the DOM to represent an empty task | function addEmptyTask() {
$("#taskList").append(
"<task class=\"task\">" +
"<text class=\"action\"></text> " +
"<date class=\"action\"></date> " +
"<button onclick='model.editTask(this)'>Edit</button> " +
"<button onclick='model.deleteTask(this)'>Delet... | [
"function generateNoTaskHTML() {\n document.getElementById('taskContainer').innerHTML = `<div class=\"no-tasks\">No tasks have been created yet.</div>`;\n}",
"function taskIncomplete() {\n //Append the task list item to the #incomplete-tasks\n let listItem = this.parentNode;\n incompleteTasksHolder.appendCh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connect the ChatBot to a User (receive and set username) | async connect() {
Channel.botMessage('Welcome to Routefusion Chat!\n\n');
this.user = await this.setUser();
this.greetUser();
} | [
"function connectUser() {\n if (drupalSettings.node_server) {\n socket.emit('new-user', roomName, name, userPicture)\n }\n }",
"async function startChat(user) {\n // replace selector with selected user\n let user_chat_selector = selector.user_chat;\n user_chat_selector = user_chat_selec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================== ObjectName property ================== | function GetObjectName()
{
return m_objectName;
} | [
"function getName(){\n\treturn \"-objProperty\";\n}",
"function GetObjectTypeNameAvailable() {\n\t}",
"function getObjectName(schemaProp) {\n\t var items = schemaProp.get('items');\n\t if (items) {\n\t return items.objectName;\n\t } else {\n\t return schemaProp.get('objectName');\n\t }\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a frame with the user informations | function createFrame(user) {
const row = $("#user-frame-row");
const div = $("#user-frame-box-" + user.login);
const buttonImg = document.createElement("img");
buttonImg.setAttribute("class", "add-user-button");
buttonImg.src = ADD_USER_BUTTON;
const a = document.createElement("a");
a.setAtt... | [
"static renderUserInformation(user) {\n // Inject the user's nickname\n ShowUserInfo.showParentElementAndInsertHtml('nickname', user.nickname);\n\n // Inject the login provider\n if (user.loginProvider !== '') {\n ShowUserInfo.showParentElementAndInsertHtml('loginProvider', user.loginProvider);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loadUSATTStarList() will setup the JSON object for list of USATT Star Rating Code. | function loadUSATTStarList() {
Lookup.all({where: {'lookup_type':'USATT_STAR'}}, function(err, lookups){
this.usatt_star_list = lookups;
next(); // process the next tick. If you don't put it here, it will stuck at this point.
}.bind(this));
} | [
"function initStarRating() {\n\t\tif ($('.user_star_rating li').length) {\n\t\t\tvar stars = $('.user_star_rating li');\n\n\t\t\tstars.each(function () {\n\t\t\t\tvar star = $(this);\n\n\t\t\t\tstar.on('click', function () {\n\t\t\t\t\tvar i = star.index();\n\n\t\t\t\t\tstars.find('i').each(function () {\n\t\t\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds Question Objects to Linked List as Nodes from Fetched Quiz Data | createQuiz(data) {
for (let i = 0; i < data.length; i++) {
if (!this.head) {
this.head = new Node(data[i]);
this.curr = this.head;
} else {
let itr = this.head;
while (itr.next) {
itr = itr.next;
... | [
"function addStuff(result, k, question, questions, test, data){\n question = dcopy(result[k]);\n //Get all answeredquestions for this question\n sql.connection.query('SELECT * FROM AnsweredQuestion WHERE AQQuestionId = ' + mysql.escape(question.QuestionId) + ' AND AQAnsweredTestId = ' + mysql.e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds the collection of cell using a voronoi diagram object from the JavascriptVoronoi library by Gorhill ( ) | buildFromVoronoiDiagram( vd ){
var vCells = vd.cells;
// for each cell
for(var i=0; i<vCells.length; i++){
var cellhes = vCells[i].halfedges;
var points = [];
for(var j=0; j<cellhes.length; j++){
points.push( cellhes[j].edge.va );
points.push( cellhes[j].edge.vb );
... | [
"generateVoronoi() {\n this.voronoi = new Voronoi()\n let bbox = { xl: 0, xr: this.width, yt: 0, yb: this.height }\n this.diagram = this.voronoi.compute(this.points, bbox)\n }",
"function voronoi(){\n voropoly=[];\n for(var i=0;i<points.length;i++){//for each point\n //console.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
//////////////////////// TRACK USER INPUT ////////////////////////// //////////////////////////////////////////////////////////////////// Set the number of drinks to be calculated for a row in the tally object | function setTallyCount(currentDrink, incrementValue) {
currentDrink.data('quantity', currentDrink.data('quantity') + incrementValue);
$('.options .quantity .count').html(currentDrink.data('quantity'));
calculate();
} | [
"incrementTally() {\r\n tally++;\r\n }",
"function setFoodCount(){\n\n foodCount = document.getElementById(\"foodCountField\").value ;\n fiveCount = Math.round(foodCount * 0.6) ;\n fifteenCount = Math.round(foodCount * 0.3) ;\n twentyfiveCount = Math.round(foodCount * 0.1) ;\n\n}",
"function giv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add 'belowentrymeta' class to elements. | function belowEntryMetaClass( param ) {
if ( body.hasClass( 'page' ) || body.hasClass( 'search' ) || body.hasClass( 'single-attachment' ) || body.hasClass( 'error404' ) ) {
return;
}
$( '.entry-content' ).find( param ).each( function() {
var element = $( this ),
elementPos = elem... | [
"function belowEntryMetaClass( param ) {\n\t\tvar sidebarPos, sidebarPosBottom;\n\n\t\tif ( ! $body.hasClass( 'has-sidebar' ) || (\n\t\t\t$body.hasClass( 'search' ) ||\n\t\t\t$body.hasClass( 'single-attachment' ) ||\n\t\t\t$body.hasClass( 'error404' ) ||\n\t\t\t$body.hasClass( 'twentyseventeen-front-page' )\n\t\t) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lower bound for distance from a location to points inside a bounding box | function boxDist(lng, lat, cosLat, node) {
var minLng = node.minLng;
var maxLng = node.maxLng;
var minLat = node.minLat;
var maxLat = node.maxLat;
// query point is between minimum and maximum longitudes
if (lng >= minLng && lng <= maxLng) {
if (lat < minLat) return haverS... | [
"d2e(x, y, boundingBox) {\n let distance = 1000000;\n let dTop = y;\n let dBottom = boundingBox.yb - y;\n let dRight = boundingBox.xr - x;\n let dLeft = x;\n let cmp = [dTop, dBottom, dRight, dLeft];\n for (let val of cmp) {\n if (val <= distance) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the metrics that has been documented in this section. Returns a tuple with metric name and metric offset | get_documented_metrics() {
let result = [];
let regex_assigned = /^(([^\s:\#])+)/gm;
let match;
while (match = regex_assigned.exec(this.content)) {
if (match.length > 1) {
result.push([match[0], match.index]);
}
}
return result;
... | [
"get metrics() {\n return this._metrics;\n }",
"getMetrics() {\n return this._client.send(\"Performance.getMetrics\");\n }",
"getMetricsIncludeDescr() {\n let metrics = [];\n for (var i in this._metricsArr) {\n let metric = {\n name: this._metricsArr[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return true if exactly 3 cards are selected, return false otherwise | function checkEnoughCardsSelected(){
let enoughCard = false;
if (model.getSelectedCardObjArr().length !== 3) {
displayInsfcntPopup();
while (model.getSelectedCardObjArr().length > 0) {
model.removeFromSelectedCardArr(0);
}
$('.selected-card... | [
"function less3Selected() {\n let numClicked = 0;\n if(turn % 2 === 0){\n for(card of userHand){\n if(card.selected){\n numClicked++\n }\n }\n if(numClicked < 3) {\n return true;\n } else {\n return false;\n }\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
stringifyNanoseconds takes an integer count of nanoseconds and returns it formatted as a human readable string, like "1h32m40s" If skipDayMax is true, then durations longer than 1 day will be represented in hours. Otherwise, they will be displayed as '>=1 day' | function stringifyNanoseconds(input, skipDayMax, skipSecMax) {
var NS_PER_MS = 1000 * 1000; // 10^6
var NS_PER_SEC = NS_PER_MS * 1000
var NS_PER_MINUTE = NS_PER_SEC * 60;
var NS_PER_HOUR = NS_PER_MINUTE * 60;
if (input == 0) {
return "0 seconds";
} else if (input < NS_PER_MS) {
return "< 1 ms";
}... | [
"toString() {\n // Largest time is 2540400h10m10.000000000s\n var buf = new bytes.Slice(32);\n var w = buf.length;\n\n var u = this.d.clone().toUnsigned();\n var neg = this.d.ltn(0);\n if (neg) {\n u = u.muln(-1);\n }\n\n if (u.lt(Second.d.toUnsigned())) {\n // Special case: if dur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return "before" or "after" if the given selector is a pseudo element (e.g., a::after). | function getPseudoElementType(selector) {
if (selector.length === 0) {
return;
}
var pseudos = selector[selector.length - 1].pseudos;
if (!pseudos) {
return;
}
for (var i = 0; i < pseudos.length; i++) {
if (isPseudoElementName(pseudos[i])) {
return pseudos[i].name;
}
}
} | [
"function styleShouldReturnComputedStylesForAfterPseudoElement() {\n pseudo.style(fixture.el.firstElementChild, \"::after\")\n expect(window.getComputedStyle)\n .toHaveBeenCalledWith(fixture.el.firstElementChild, \"::after\")\n}",
"function styleShouldReturnComputedStylesForBeforePseudoElement() {\n pseudo.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method uses Angular's [Router]( under the hood, it's equivalent to calling `this.router.navigateByUrl()`, but it's explicit about the direction of the transition. Going forward means that a new page is going to be pushed to the stack of the outlet (ionrouteroutlet), and that it will show a "forward" animation by d... | navigateForward(url, options = {}) {
this.setDirection('forward', options.animated, options.animationDirection, options.animation);
return this.navigate(url, options);
} | [
"static pageForward() {\n history.forward();\n }",
"_forward() {\n if (this._history.length) {\n this._navigateTo(Math.min(this._index + 1, this._history.length - 1));\n }\n }",
"static forward() {\n window.history.forward()\n }",
"function goForward() {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests let a = "000010100000100100110110010000010101111011011001101110111111111101000000101111001110001111100001101" let b = "110101001011101110001111100110001010100001101011101010000011011011001011101111001100000011011110011" let answer = "11011110110001001100010111011010000001110100010101100100001101100000110001111001... | function binaryAddition2(a, b) {
let carry = 0
let res = ""
while (a || b || carry) {
//sum the unit digit
let sum = +a.slice(-1) + +b.slice(-1) + carry
if (sum > 1) {
//update result string
res = (sum % 2) + res
carry = 1
} else {
res = sum + res
carry = 0
}
... | [
"function addBinary(a, b) {\n if (a.length < b.length) return addBinary(b, a);\n let answer = \"\";\n\n a[-1] + b[-1]\n for(let i=(a.length - 1); i >= 0; i--){\n let remainder = 0;\n\n if( a[i] + b[i] + remainder > 1){\n answer += \"0\";\n remainder = 1;\n }\n }\n\n return answer;\n}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send a signal at the end of the game with the results | finishGame(result) {
this.socket.emit('finish', result);
} | [
"finish(){\n this.status = 'stopped';\n this._finishCalled = true; \n this.emit('game over', this.board.score);\n }",
"function end() {\n game.end();\n console.log('End!!, thank you for playing');\n }",
"function endGame() {\n resetMainContainer();\n loadTemplate(\"result\", displayResults... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The rotation of the base servo in degrees | get baseRotationDegree() { return this._baseRotation * 180.0 / Math.PI; } | [
"get baseRotation() { return this._baseRotation; }",
"getRotationDeg(){\n return this.currentRot* (180/Math.PI);\n }",
"get rotation() {}",
"get angle() {\n return this.transform.rotation * RAD_TO_DEG;\n }",
"angleDeg () {\n return this.angleRad() * (180 / M.PI);\n }",
"get wristRotation... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the s2sTesting module is injected when it's loaded rather than being imported importing it causes the packager to include it even when it's not explicitly included in the build | function setS2STestingModule(module) {
s2sTestingModule = module;
} | [
"function initTesting() { \n function getAppDestPath() {\n return getBaseUrl('wwwroot/app/');\n }\n\n var getAllAppSpecFiles = function () {\n var appDestPath = getAppDestPath();\n var isAppDestFile = function (path) {\n return new RegExp('^' + appDestPath).test(path);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function that takes three strings a verb, an adjective, and a noun uppercases and interpolates them into the sentence "We shall VERB the ADJECTIVE NOUN". Use ES6 template literals. For example, > madLib('make', 'best', 'guac'); "We shall MAKE the BEST GUAC." | function madLib(verb, adjective, noun) {
return `We shall ${verb.toUpperCase()} the ${adjective.toUpperCase()} ${noun.toUpperCase()}`;
} | [
"function madLib(verb, adjective, noun) {\n let sentence = `We shall ${verb.toUpperCase()} the ${adjective.toUpperCase()} ${noun.toUpperCase()}`;\n console.log(sentence);\n}",
"function madLib(verb, adjective, noun) {\n return `We shall ${verb.toUpperCase()} the ${adjective.toUpperCase()} ${noun.toUpperCase()}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find the previous one of the Node contain given item,return the previous Node | function findPrev(item) {
let currNode = this.head;
while(currNode.next.element != item && currNode.next.element != "head") {
currNode = currNode.next;
}
if(currNode.next.element == item) {
return currNode;
}
return -1;
} | [
"function prev(item){\n return item.previousElementSibling;\n }",
"function prev(item) {\n return item.previousElementSibling;\n }",
"function prev(item) {\n return item.previousElementSibling;\n }",
"_findPrev() {\r\n var node = this.parent._head;\r\n if (node == this)\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a script which conditionally loads the `polyfill.js` file if and only if the browser fails the `urc.modernBrowserTest`. | function getConditionalPolyfill({ webpackCompilation, urc, publicPath }) {
if (!urc.polyfill) {
return '';
}
const polyfillSrc = path.join(
publicPath,
getAssetFilename(webpackCompilation.chunks, 'polyfill')
);
return `<script>
var modernBrowser = (
${urc.modernBrowserTest}
);
if... | [
"function polyfillIt(polyfill, entry) {\n return polyfill ? ['babel-polyfill', entry] : entry;\n}",
"function fetch_blind_polyfill() { \n\trun(\"curl 'https://cdn.polyfill.io/v2/polyfill.min.js?features=default-3.6,NodeList.prototype.@@iterator,NodeList.prototype.forEach,RegExp.prototype.flags,Object.entries,Obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This creates a div with the structure to print a message if the message is own adds the "own" class otherwise the "external" if the user has a name (which could have but we don't know in case it's not a friend), then we show the name. Because of how data is stored on the server, this already takes care of printing atta... | function msgDiv(msg) {
const div = document.createElement('div');
div.classList.add("message", msg.author == data.user.id ? "own" : "external");
const author = document.createElement('span');
author.innerHTML = data.users[msg.author].user;
author.className = "author";
author.style.color = data.users[msg.aut... | [
"ownMessage(msguser) {\n // the current user is compared to the username of the message\n if (Meteor.user().username === msguser) {\n // sets the class of the message to 'ownMessage' if both are identical\n return 'ownMessage';\n }\n return '';\n }",
"function FriendMessage(us... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3. Given an array of numbers which is almost sorted in ascending order. Find the index where sorting order is violated. | function getIndx(arr){
let res = arr.reduce(function(t, el, i, arr){
return t = el < arr[i - 1] ? i : t;
}, 0);
return res ? res : -1;
} | [
"function viravorIndex(arr){\r\n for(let i = 0; i < arr.length - 1; i++){\r\n if(arr[i] <= arr[i + 1]) continue;\r\n else{\r\n return i + 1\r\n }\r\n }\r\n return -1\r\n}",
"function getIndexToIns(arr, num) {\n let sorted = arr.sort(function (a, b) {\n return a - b;\n });\n\n console.log(so... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Give each square a random background color | function newColors() {
for (var i = 0; i < squares.length; i++) {
squares[i].style.backgroundColor = randomColor();
}
} | [
"function randomColors() {\n for (var i = 0; i < squares.length; i++) {\n squares[i].style.backgroundColor = generateRGB();\n }\n}",
"function colors(square){\t\t\n\t\t\tfor(var i=0;i<length;i++){\n\t\t\t\tsquare[i].style.background=\"rgb(\"+Math.floor(Math.random()*255)+\", \"+Math.floor(Math.random... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get site article url | function siteArticleUrl(columnWebId, articleWebId){
return siteColumnUrl(columnWebId) + articleWebId;
} | [
"getUrl() {\n let url = ''\n let pageConfig = Config.pages[this.page] || {}\n\n if(this.isBlogPost) {\n url = `${Config.siteUrl}/${this.post.frontmatter.path}`\n }\n else {\n url = pageConfig.url || Config.siteUrl\n }\n\n return url\n }",
"function get_article_url(art){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
will be called before the component unmounts, adds changelisteners for stores | componentWillUnmount(){
ItemsStore.removeListener("change", this.getItems);
} | [
"componentWillUnmount(){\n _.each(this.constructor.stores, function(store){\n store.removeChangeListener(this.storeChanged);\n }.bind(this));\n }",
"componentWillUnmount() {\n PersonStore.unlisten(this.onStoreChange);\n }",
"componentWillUnmount() {\n ProductStore.removeChangeListener(this._h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads character data based on selected season Reuse this function for char info below | function charSeasonSelect(season){
console.log("Season is " + season)
var section
if (season == 1){
section = "SymphogearSeasonOneCharacterData"
}
else if(season == 2){
section = "SymphogearSeasonTwoCharacterData"
}
else if(season == 3){
section = "SymphogearSeasonThreeCharacterData"
}
else if(season == ... | [
"function loadCharacters () {\n harry.beHarry();\n draco.beDraco();\n hermione.beHermione();\n voldemort.beVoldemort();\n }",
"async function getCharacters(season) {\n try {\n let response = await fetch(url + queryParamsFilms + season + '/');\n if (response.ok) {\n let j... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Writes `value` for `key` in the keyvalue store on the server. | async function writeValueToServer(key, value) {
const serverUrl = `${STORE_URL}?key=${key}&value=${value}`;
await fetch(serverUrl);
} | [
"writeKeyValue(key, value) {\n this._isChanged = true;\n this._json = null;\n // write the key value to data in derived class\n }",
"function setValue(key, value) {\n redis.set(key, value);\n}",
"set(key, value) {\n this.store[key] = value;\n }",
"function writeCache (key, value) {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the nth element as optional of an Element object | getAsElem(index, defaults = Monad_1.Optional.absent) {
return (index < this.rootNode.length) ? Monad_1.Optional.fromNullable(this.rootNode[index]) : defaults;
} | [
"getAsElem(index, defaults = Optional.absent) {\n return (index < this.rootNode.length) ? Optional.fromNullable(this.rootNode[index]) : defaults;\n }",
"elementAt(index) {\n const elements = this.allElements;\n if (elements && elements.length && elements.length >= index) {\n return elements[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the 'team' property for every player in the game, there is the same amount of players in each team ('blue' or 'red') or +1 player in the 'blue' team depending on the number of players (even or odd) | playerTeamAttribution() {
this.players = shuffle(this.players);
const size = this.players.length;
for (let i=0; i<size; i++) {
if (i < Math.floor(size/2)) {
this.players[i].team = 'red';
} else {
this.players[i].team = 'blue';
... | [
"joinTeam(){\n let numInRoom = Object.keys(this.roomList[this.room].players).length\n if (numInRoom % 2 === 0) this.team = 'blue'\n else this.team = 'red'\n }",
"function setAliveTeamMembers(players, teamColor) {\n\taliveTeamMembers = players;\n\tcurrentTeamColor = teamColor;\n\n\tif (updatingTeamMember... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Source: DESCRIPTION: Write a function that, given a string of text (possibly with punctuation and linebreaks), returns an array of the top3 most occurring words, in descending order of the number of occurrences. Assumptions: A word is a string of letters (A to Z) optionally containing one or more apostrophes (') in ASC... | function topThreeWords(text) {
let allWordsArray = text.toLowerCase().match(/[a-z]+'?[a-z]*/g);
if (!allWordsArray) return [];
let uniqueWordsObj = {};
for (let word of allWordsArray) {
if (uniqueWordsObj[word]) uniqueWordsObj[word]++;
else uniqueWordsObj[word] = 1;
}
let uniqu... | [
"function topThreeWords(text) {\n let regExp = /[a-z]+/i;\n let words = text.trim().split(\" \");\n words = words\n .filter((word) => regExp.test(word))\n .map((word) => word.toLowerCase().replace(/[^a-z']/g, \"\"));\n\n let counts = {};\n words.forEach((word) => {\n // if(!Object.keys(counts).i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3 functions to rework text into quotes/HTML format for the purposes of being loaded into a workable CSV | function csvQuotes(myText){
myText = ("\"" + myTrim(myText) + "\"");
return myText
} | [
"function csvQuotes(myText){\n myText = (\"\\\"\" + trim(myText) + \"\\\"\");\n return myText\n}",
"function normalize(text) {\n\t function spaces() {\n\t\tvar col = arguments[1] + inserted,\n\t\t spaces = ' '.substr(col % 8);\n\t\tinserted += spaces.length - 1;\n\t\treturn spaces;\n\t }\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterates over each item in the list, in reverse, without actually reversing the list. cb See LinkedList.each(). Returns the list instance. | eachReverse(cb) {
let curr = this.last(true);
while (curr !== this[this._start]) {
if (false === cb.call(this, curr.data, curr)) {
break;
}
curr = curr[this._prev];
}
return this;
} | [
"eachReverse(callback, thisArg) {\n return this._iterate(callback, thisArg, this._tail, this._head,\n this._prev);\n }",
"reverse() {\n return new Iterator(iterator => {\n let items = this.list();\n let modifies = false;\n let actions = [];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Improve the function so that it return a random integer number between start (inclusive) to end (inclusive) | function getRandomInteger(start,end) {
return (start + Math.floor(Math.random() * (end - start + 1)));
} | [
"function getRandomNumber(start, end) { return ((Math.random() * (end - start)) + start) }",
"function getRandomNumber(start, end) { return ((Math.random() * (end-start)) + start); }",
"function getRandInt(start, end) {\n return Math.floor(Math.random() * (end - start) + start)\n }",
"function randint(sta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
EXERCISE: The Geometrizer Calculate properties of a circle, using the definitions here. Store a radius into a variable. Calculate the circumference based on the radius, and output "The circumference is NN". Calculate the area based on the radius, and output "The area is NN". | function geometrizer()
{
radius = 4;
circumference = 2 * 3.142 * radius;
area = 3.142 * Math.pow(radius,2)
alert("The circumference is "+ circumference);
alert("The area is " + area);
} | [
"function calculateCircleValues(radius){\n var pi = Math.pi();\n\n var diameter = 2 * radius;\n var circumference = 2 * pi * radius \n var area = pi * (radius ** 2);\n console.log (\" The circle's diameter is: \" + diameter + \". The circle's circumference is \" + circumference + \". The circle's ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Realiza las modificaciones necesarias para indicar un conjunto de elementos invalidos. | function validationSetInvalidFields(elements,message) {
for (var i=0; i < elements.length; i++) {
validationSetInvalidField(elements[i],message)
};
} | [
"function marcaElementosErro(errorElements)\n{\n\t// loop nos elementos com erro\n\tfor (chave in errorElements) {\n\t\t// recuperando elemento\n\t\telemento = dijit.byId(errorElements[chave]);\n\t\t// setando estado de erro\n\t\telemento.state = 'Error';\n\t\telemento._setStateClass();\n\t\tdijit.setWaiState(eleme... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is called everytime there is some update in the component. In this case, if the user object's length is 0 then homepage componet is called. | componentDidUpdate(){
console.log(this.props.auth)
if(Object.keys(this.props.auth.user).length === 0){
window.location.href = "/"
}
} | [
"componentDidUpdate(){\n if(Object.keys(this.props.auth.user).length === 0){\n window.location.href = \"/\"\n }\n }",
"componentDidUpdate() {\n if (!this.props.user.isLoading && this.props.user.userName === null) {\n this.props.history.push('/hom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to reset the direction line at the centre of the white ball this function is called when the balls stop moving | function nextShot()
{
wBall.moving = false;
// re-drawing the direction line, starting from the center of the white ball
line.position = {
x : wBall.position.x + (wBall.size / 2), // wBall.size / 2 = the radius of the white ball
y : wBall.position.y + (wBall.size / 2)
}
... | [
"function ballReset() {\n ball.position.x = game.size.x / 2;\n ball.position.y = game.size.y / 2;\n ball.direction.x = ball.initial.x;\n ball.direction.y = ball.initial.y;\n}",
"function resetBall() {\n ball.x = -10;\n ball.speed = 2;\n ball.holed = false;\n}",
"function resetBall()\n{\n console.log(\"b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add hex to path | addHex(newHex){
if(this.hexesInPath.length !=0){
this.addLineSegment(this.getTail(), newHex);
}
this.hexesInPath.push(newHex);
if(this.hexesInPath.length == 1){
this.initializeGuidingLine();
this.initializePathLine();
}
this.addToColumnsAffected(newHex);
this.pathOptions =... | [
"function addHexPrefix(hex) {\n return hex.startsWith('0x') ? hex : `0x${hex}`;\n}",
"function getHexFile(python) {\n var hexlified_python = hexlify(python);\n var insertion_point = ':::::::::::::::::::::::::::::::::::::::::::';\n return firmware.replace(insertion_point, hexlified_python);\n}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends the name of the new session to server and starts to generate location data periodically | function startRecording(){
sessionName = $("#session").val();
if(sessionName == null || sessionName == "")
alert("Enter a name for the session");
else{
$.ajax({
url: "newSession",
type: 'POST',
data: sessionName
}).done(function(resp){
timer = setInterval(funct... | [
"function sessionStart() {\n\t///////////////////////////////////\n\t// USED FOR TESTING! DELETES ALL LOCAL DATA!\n\t// ONLY UNCOMMENT IF YOU WANT TO DELETE LOCAL DATA!\n //localStorage.clear();\n\t///////////////////////////////////\n\t\n //var _tempData = queryServer();\n //dataObj.steps = stepCount;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether an element has a given class. Handles multiple classes on one element. | function hasClass(element, cls) {
var classes = element.className;
if (!classes) return false;
var l = classes.split(' ');
for (var i = 0; i < l.length; i++) {
if (l[i] == cls) {
return true;
}
}
return false;
} | [
"function hasClass(element, clas)\n{\n return (' ' + element.className + ' ').indexOf(' ' + clas + ' ') > -1;\n}",
"function hasClass(element, cls) {\nreturn (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;\n}",
"function hasClass(cls,element) {\n\t\treturn (' ' + element.className + ' ').index... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
!After each loop, keydowns are cleared, as polling speed is fixed !and may not be in sync with the controllers. | clear_keydowns() {
clear(this.keydowns);
clear(this.quick_access);
} | [
"function clearKeys() {\n for (var i = 0; i < 10; i++) {\n keysDown[i] = false;\n }\n }",
"resetKeys() {\r\n keys.A.isDown = false;\r\n keys.D.isDown = false;\r\n keys.W.isDown = false;\r\n cursors.left.isDown= false;\r\n cursors.right.isDown= false;\r\n cursors.up.isDown= fa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the value "rounded" according to config.value_resolution | function getRoundedValue(v) {
return config.value_resolution === null ? v : Math.round(v / config.value_resolution) * config.value_resolution;
} | [
"function roundme(val) {\n return val;\n }",
"function roundSubPixelValue(value) {\n return Math.round(\n Number(value.number),\n );\n}",
"function roundDuration(value) {\n // Ensure there's always an extra day or so\n var sz = zoomLevels[zoomLevels.length - 1];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns 'true' if the edge corresponds to a type where nameOrIndex is an index, and false otherwise. | _isIndex() {
switch (this.snapshotType) {
case 1 /* Element */: // Array element.
case 4 /* Hidden */:// Hidden from developer, but influences in-memory size. Apparently has an index, not a name. Ignore for now.
return true;
case 0 /* ContextVariable */: // Cl... | [
"get isIndex()\n {\n return Boolean(this._data.index);\n }",
"isIndexReference() {\n return this.isIndex() || this.isRange();\n }",
"static isValidIndexName(name) {\n switch (name) {\n case constants.INDEX_LOOPBACK:\n case constants.INDEX_FILE:\n case constants.INDEX_NRLS:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to get image type based on starting bytes of the image file. | function getImageType(content) {
// Classify the contents of a file based on starting bytes (aka magic number:
// tslint:disable-next-line:max-line-length
// https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files)
// This aligns with TensorFlow Core code:
// tslint:disable-n... | [
"function getType( imageFilename ) {\n \tvar startCheck = imageFilename.lastIndexOf(\".\");\t// Find where the file extension is.\n \tvar type = null;\t\t\t\t\t\t\t\t\t// Return value if we don't find a file extension.\n \tif (startCheck > -1)\t\t\t\t\t\t\t\t// if there's a file extension, extract it.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the annotations of an image to the cache if they are not in it already. | function loadAnnotations(imageId, cb) {
imageId = parseInt(imageId);
if (gImageList.indexOf(imageId) === -1) {
console.log(
'skiping request to load annotations of image ' + imageId +
' as it is not in current image list.');
return;
}
var params = {
image_id: imageId
... | [
"function annotation_image_loaded () {\n\treset_image_display ( 'annotation_image' ) ;\n\tloading ( -1 ) ;\n}",
"function preloadImages() {\n // TODO: preload the next needed images according to the annotations\n var keepImages = [];\n for (var imageId = gImageId - PRELOAD_BACKWARD;\n imageId <= ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lasso is round change handler. | lassoIsRoundChangeHandler () {
this.store.dispatch(setLassoIsRound(!this.lassoIsRound));
return true;
} | [
"function updateAmountOnRadiusChange() {\n var $preAmountChecked = $preAmount.filter(':checked');\n\n if ($preAmountChecked.length) {\n if ($preAmountChecked.val() === 'other') {\n updateTotalAmount($otherAmount.val());\n } else {\n updateTotalAmount... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ post moderation and unread | function sfjmoderatePost(posturl, url, canRemove, postid, forumid, action)
{
if(posturl != '' && action == 9)
{
window.location = posturl;
return;
}
var modpostid = 'modp' + postid;
var modrowid = 'modrow' + postid;
var modpostrowid = 'modpostrow' + postid;
var modicon = 'modicon' + postid;
var topics = '... | [
"function alertNotAMod(e){\n\te.message.channel.sendMessage(\"You are not a moderator.\");\n}",
"postReply(content, parentId, transcriptLineId) {\n this.#manager.postReply(content, parentId, transcriptLineId).then(() => {\n this.updateDiscussion();\n });\n }",
"function postAction(){\n\t\tvar th = $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filters android games data to remove games that are unreleased i.e where the date is > todays date. | function removeComingSoon() {
sortedGames = [];
let todayDate = new Date();
let parseTodaysDate = Date.parse(todayDate);
for (let i of gameList) {
let itemDate = (i.releaseDate);
let parseItemDate = Date.parse(i.releaseDate);
if (!itemDate.includes("t.b.d") && parseTodaysDate ... | [
"function clearOutdated() {\n gamelogic.getGames({ expired: { $lt: new Date() } })\n .then(function (response) {\n if (response.status == \"ok\" && response.gameTokenArray.length > 0) {\n removeGames(response.gameTokenArray);\n //result of removing is not showing to users\n }\n });\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: _fnLanguageProcess Purpose: Copy language variables from remote object to a local one Returns: Inputs: object:oLanguage Language information | function _fnLanguageProcess( oLanguage )
{
if ( typeof oLanguage.sProcessing != 'undefined' )
_oLanguage.sProcessing = oLanguage.sProcessing;
if ( typeof oLanguage.sLengthMenu != 'undefined' )
_oLanguage.sLengthMenu = oLanguage.sLengthMenu;
if ( typeof oLanguage.sZeroRecords != 'undefined' )
... | [
"function addLanguage() {\n // VARIABLES\n var langObj;\n // PROCESS\n // drill down to the languages object and assign a variable to the location\n langObj = nestedObject.data.languages;\n // add a new object (language object) to this object\n // added object should have a key (name of the language) and v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |