query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Force a number between 0 and 1 | function clamp01(val) {
return Math.min(1, Math.max(0, val));
} | [
"function lessThanOrEqualToZero(num) {\r\n if(num <= 0){\r\n return true;\r\n } else{\r\n return false;\r\n }\r\n}",
"function controlloRangeNumeri(min, max, number) {\n var result = false;\n if (number >= min && number <= max) {\n result = true;\n }\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform OpenStreetMap hours into french readable hours (or not) | function getReadableHours(opening_hours){
return opening_hours;
/**.replace("Mo", "Lundi")
.replace("Tu", "Mardi")
.replace("We", "Mercredi")
.replace("Th", "Jeudi")
.replace("Fr", "Vendredi")
.replace("Sa", "Samedi")
.replace("Su", "Dimanche")
.replace("off"... | [
"get formattedHours() {\n const _hours = this.hours;\n let hours = _hours;\n if (_hours !== null) {\n hours = this.amPm && _hours > HOURS_OF_NOON\n ? _hours - HOURS_OF_NOON : this.amPm && !_hours ? HOURS_OF_NOON : _hours;\n }\n return this.formattedUnit(h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the p2 RaceCar | function p2RaceCar(collision_id,clientID, world, position, angle, width, height, mass) {
// Create a dynamic body for the chassis
let chassisBody = new p2.Body({
mass: mass,
position: position,
id: clientID
});
let boxShape = new p2.Box({
width: width,
height: hei... | [
"function Car(vehicletype,name,model,type){ //\nVehicle.call(this, vehicletype)\n if(typeof(vehicletype) == typeof(\"\")){\n this.vehicletype = vehicletype;\n }\n else{\n this.vehicletype = \"Car\";\n }\n if(typeof(name) == typeof(\"\")){\n this.name = name;\n }\n else{\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
' Name : handle_user_upd_profile ' Return type : None ' Input Parameter(s) : req, startTime, apiName ' Purpose : Creating a class to handle the USER_UPD_PROFILE API error with following members ' History Header : Version Date Developer Name ' Added By : 1.0 28th Apr,2012 Ravi Raj ' | function handle_user_upd_profile(req, startTime, apiName) {
this.req = req; this.startTime = startTime; this.apiName = apiName;
} | [
"function handle_user_get_profile(req, startTime, apiName) {\n this.req = req; this.startTime = startTime; this.apiName = apiName;\n}",
"function profileHandler(err, resp, body) {\n var profile = profileParser(body), query = {};\n if (profile.error) return console.error(\"Error returned fro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extends a json file object in siteContext with its contents | function addContextFile(filePath, contents, context){
if (p.extname(filePath) === '.json') {
context.files[filePath] = extend(true, context.files[filePath], {contents: contents, context: {}});
}
} | [
"load(statsFile = Statistics.defaultLocation) {\n if (!fs.existsSync(path.dirname(statsFile))) {\n fs.mkdirSync(path.dirname(statsFile), { recursive: true });\n }\n if (!fs.existsSync(statsFile)) {\n if (fs.existsSync(\"./data/stats.json\")) {\n fs.renameSyn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
VALIDATEINSTRUCTIONCHECKS: makes sure they answered the questions about instructions correctly | function validateInstructionChecks() {
hideElements();
instructionChecks = $('#instr').serializeArray();
var ok = true;
for (var i = 0; i < instructionChecks.length; i++) {
// check for incorrect responses
if(instructionChecks[i].value != "correct") {
alert('At least on... | [
"function checkRequirements() {\n if (firstPassword.length < 5) {\n firstInputIssuesTracker.add(\"كلمه المرور اقل من 5 حروف\");\n } else if (firstPassword.length > 15) {\n firstInputIssuesTracker.add(\"كلمه المرور اكبر من 5 حروف\");\n }\n\n \n\n if (!firstPassword.match(/[a-z | A-Z | ا-ي]/g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the list of indexes of 4 elements adjacent to the one located at [row][col] for adjacency checking the NSWE north, south, west, east directions are taken into account that list may have from 0 to 4 (both ends included) entries depending on the size of 'this.arr' and the 'wrapIndexes' parameter | adjacency4IndexesList(row, col, wrapIndexes = false) {
if (!this.isRowColInRange(row, col)) return [];
//trivial case - no neighbors
if (this.rows === 1 && this.cols === 1) return [];
// just a little trick:
// we add the "elem's" indexes to the list as the first entry
... | [
"getAdjacent(tile) {\n\t\t\n\t\tconst index = tile.getIndex();\n\t\t\n\t\tconst col = index % this.width;\n\t\tconst row = Math.floor(index / this.width);\n\n\t\tconst first_row = Math.max(0, row - 1);\n\t\tconst last_row = Math.min(this.height - 1, row + 1);\n\n\t\tconst first_col = Math.max(0, col - 1);\n\t\tcons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function charFreq() that takes a string and builds a frequency listing of the characters contained in it. Represent the frequency listing as a Javascript object. Try it with something like charFreq("abbabcbdbabdbdbabababcbcbab"). | function charFreq (string) {
var frequency = {};
function addfrequency (character) {
if (frequency[character]) {
frequency[character] += 1;
} else {
frequency[character] = 1;
};
};
string.split('').forEach(addfrequency);
return frequency;
} | [
"function timesOfMostFreqChar(chars) {\n let joined = chars.split(\" \").join(\"\").split(\"\");\n\n let maxFreq = 0,\n freq = {},\n maxChar = \"\";\n joined.forEach((char) => {\n if (freq[char]) {\n freq[char]++;\n if (freq[char] > maxFreq) {\n maxFreq = freq[char];\n maxChar = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the given permission | remove(permission) {
this.mode = 'REMOVE_PERMISSIONS';
if (permission == null) {
return;
}
if (!permission.principal.name) {
return;
}
// we set empty permissions
let promise = this.setPermission(permission.principal.name, []);
promise.then(() => {
this.codenvyNotif... | [
"removePermissionFromRole (roleId, action) {\n assert.equal(typeof roleId, 'string', 'roleId must be string')\n assert.equal(typeof action, 'string', 'action must be string')\n return this._apiRequest(`/role/${roleId}/permission/${action}`, 'DELETE')\n }",
"mayRevoke(permission, granteePermissions = [])... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if there is a winner to reset game on any button click | function checkWinner() {
(winner === true)? resetGame() : (winner = false)
} | [
"function correct() {\n wins++;\n restartGame();\n }",
"function reset(){\n p1Score=0;\n p2Score=0;\n p1Display.textContent=\"0\";\n p2Display.textContent=\"0\";\n //we are not gonna check which span is has the green clas turned on, we will just remove it from both\n p1Display.classList.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Event handler for the selection selectorControl in a data row. Sets the _bocList_isSelectorControlClick flag. | function BocList_OnSelectionSelectorControlClick()
{
_bocList_isSelectorControlClick = true;
} | [
"function BocList_OnRowClick(bocList, currentRow, selectorControl)\n{\n if (_bocList_isCommandClick)\n {\n _bocList_isCommandClick = false;\n return;\n } \n \n if (_bocList_isSelectorControlLabelClick)\n {\n _bocList_isSelectorControlLabelClick = false;\n return;\n } \n\n var currentRowBlock =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For nodes which are projected inside an embedded view, this function sets the renderParent of their dynamic LContainerNode. | function setRenderParentInProjectedNodes(renderParent, viewNode) {
if (renderParent != null) {
var node = viewNode.child;
while (node) {
if (node.type === 1 /* Projection */) {
var nodeToProject = node.data.head;
var lastNodeToProject = node.data.tail;
... | [
"function findRenderContainer(node, rootNode, container) {\n var currentNode = node.parentNode;\n if (!currentNode ||\n node === rootNode ||\n currentNode === rootNode ||\n currentNode === document.body ||\n currentNode === document.documentElement ||\n !(currentNode instanceof Element)) {\n return contai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a string representing a GetFeatureInfo request URL for the current map, based on the passed parameters: serviceUrl: the URL of the WMS service layers: list of layers to query srs: the SRS of the layers (x,y): (pixel) coordinates of query point | function createWMSGetFeatureInfoRequestURL (serviceUrl, layers, srs, x, y) {
var extent = app.map.getExtent();
if (seldon.gisServerType === "ArcGIS") {
extent = extent.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection(seldon.projection));
}
return ... | [
"function webgis_tile_url(pt, zoom) {\n\tvar x = pt.x;\n\tvar y = pt.y;\n\tvar url = \"\";\n\tif (this.urls.length >= 2) {\n\t\t// select server\n\t\tvar index = x % this.urls.length;\n\t\turl = this.urls[Math.floor(index)];\n\t} else\n\t\turl = this.server_url;\n\n\turl += \"/map_gmaps?x=\" + x + \"&y=\" + y + \"&... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filter bids to dedupe them? | function _getUniqueTagids(bids) {
var key;
var map = {};
var Tagids = [];
bids.forEach(function(bid) {
map[utils.getBidIdParamater('tagid', bid.params)] = bid;
});
for (key in map) {
if (map.hasOwnProperty(key)) {
Tagids.push(map[key]);
}
}
return Tagids;
} | [
"removeBike(bike) {\n //Removes bike from basket\n for (let i of basket) {\n if (bike == i) {\n this.totalPrice -= basket[basket.indexOf(i)].displayPrice;\n basket.splice(basket.indexOf(i), 1);\n shared.basketLength = basket.length;\n this.updateBasket();\n this.calcDis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `SubjectAlternativeNameMatchersProperty` | function CfnVirtualGateway_SubjectAlternativeNameMatchersPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected... | [
"function CfnVirtualNode_SubjectAlternativeNameMatchersPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserlob_partitioning_storage. | visitLob_partitioning_storage(ctx) {
return this.visitChildren(ctx);
} | [
"visitModify_lob_storage_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitLob_storage_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitLob_storage_parameters(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitOut_of_line_part_storage(ctx) {\n\t return this.visitChildren(ct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns boolean true if the given text seems to be an email address. From | static isEmail(text) {
const pattern = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/gim;
return pattern.test(text);
} | [
"#checkForEmail(line) {\n\n // the line must contain the @ symbol\n // then any of the parts of the line split on a space could be email\n // then if the part matches the normal email regular expression\n // WITH the addition of spaces that people might put in to avoid email checking\n\n let looksLik... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Executes all the operations needed to complete the loading of a Nodes map window | function completeLoading(windowId){
loadJsonAlerts(windowId);
loadJsonNodes(windowId);
loadJsonLogs(windowId);
addSensorMarkers(windowId);
//Creates the draggable
$( "#"+windowId+"-maptabs" ).draggable({
containment: $("#"+windowId+"-mapcontainer"),
handle: $( "#"+windowId+"-messagescontainer-handle... | [
"function load_graph_to_map(results){\n load_markers(results.locations);\n //draw_lines(results);\n draw_spanning_tree(results);\n\n}",
"function loadTasksMatrix() {\n loadAllTasks();\n loadMatrixArea();\n assignTaskToBox();\n}",
"function loadObjectsAfterWaitingForScripts(){\n\t\tlet waitingT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validatePartNo() ================ Method to validate the part number Parameters Return value | function validatePartNo(aField)
{
var lstrValue = aField.value;
var lchrTemp;
re = new RegExp("-","g");
lstrValue = lstrValue.replace(re,"");
/* for(i=0;i<lstrValue.length;i++) {
lchrTemp = lstrValue.charAt(i);
if (!( (lchrTemp >= 'A' && lchrTemp <= 'Z')
|| (lchr... | [
"function validatePageNo(objPageNo) {\n // No data to go\n if (!checkNoDataToSave_('DataTable')) {\n return false;\n }\n // do processing to go to desired page\n var lstrPageNo = objPageNo.value;\n //Check mandatory input\n if (!mandatoryCheck(objPageNo)) {\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extendBy floor(pt) This function is used to take all the points in the array and convert them to integer values | function floor(points) {
var results = new Array(points.length);
for (var ii = points.length; ii--; ) {
results[ii] = init(~~points[ii].x, ~~points[ii].y);
} // for
return results;
} | [
"function flattenPoints(input) {\n let res = new Array(input.length * 2);\n for (let i = 0; i < input.length; i++) {\n res[i * 2] = input[i].x;\n res[i * 2 + 1] = input[i].y;\n }\n return res;\n}",
"assignedPointsMean(arr, len) {\n \n const meanX = arr.map(p => p.x).red... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a ternary expression; the boolean expression is if all the floats given are greater than 0 | function ternary(floats, success, failure, not = false) {
// TODO make this type safe (ran into a type error here)
// wrap single float in array if need be
if (!Array.isArray(floats) && floats !== null)
floats = [floats].map((f) => expr_1.wrapInValue(f));
// TODO get rid of this cast
return ... | [
"function posNeg(x,y, z) {\n\t(((x < 0)&&(y > 0)) || ((x > 0) && (y < 0)) || ((x < 0)&&(y<0) && (z === true))) ? console.log(\"true\") : console.log(\"false\");\n}",
"static evalReadingGreaterThanOrEqualToZero(context, dict) {\n return (libLocal.toNumber(context, dict.ReadingSim) >= 0);\n }",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
tickPeriod is an object representing the period of xaxis ticks, like that in the period property of the object returned by tickOptions. Returns the time of the first tick in the plot's current interval as a unix time in ms. If the tick period is greater than one, there are multiple choices for where to put the first ti... | _firstTick(interval, tickPeriod) {
const time = interval.start;
var period = tickPeriod.value;
var unit = tickPeriod.unit;
var roundedTime = time.clone().startOf(unit);
if (!roundedTime.isSame(time)) {
roundedTime.add(1, unit);
}
if (unit === 'h' || unit === 'M') {
return rounde... | [
"_ticks(interval) {\n // We use the first interval passed to the XAxis object to initialize\n // this._timeZone and this._tickReferenceTime, to avoid needing to pass a\n // timeZone to the constructor.\n if (!this._timeZone) {\n this._timeZone = interval.start.tz();\n this._tickReferenceTime ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a Splay tree. A splay tree is a selfbalancing binary search tree with the additional property that recently accessed elements are quick to access again. It performs basic operations such as insertion, lookup and removal in O(log(n)) amortized time. | function SplayTree() { } | [
"function Sll()\n{\n/* this.head places \"head\" into the object with the value null; head is a pointer that will be set to a memory space containing another object */\n\tthis.head = null\n/* this.add is a function that checks to see if there exists a node that branches from the current node; if there is, current w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add mouse events to the list for list and the slider | function addlistmouseevents(firstlist){
firstlist.roothtmldivelement.onmousemove=function(event){
if(firstlist.orientation=="verticle"){
if(firstlist.state==1){
firstlist.xoffset=firstlist.xdown-event.pageX;
firstlist.yoffset=firstlist.ydown-event.pageY;
var total=firstlist.startpixelindex+first... | [
"function addListEventLeft(comparelist, data, selector, listeningElement, otherlisteningElement, lineId) {\n\t\t\t\t\tcomparelist.selectAll(selector + \" \" + listeningElement) //i.e, \"#list1 rect\" or #list1 text\n\t\t\t\t\t\t.data(data)\n\t\t\t\t\t.on(\"click\", function (d, i) {\n\t\t\t\t\t\tvar $s_rect = $(li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In this toy problem you have to write a method that folds a given array of integers by the middle xtimes. Fold 1times: [1,2,3,4,5] > [6,6,3] A little visualization (NOT for the algorithm but for the idea of folding): Step 1 Step 2 Step 3 Step 4 Step5 5/ 5| 5\ 5 4 4/ 4| 4\ 1 2 3 4 5 1 2 3/ 1 2 3| 1 2 3\ 6 6 3 Fold 2time... | function foldingTime(array,n) {
var newArray = array.slice();
for (var z = 0; z < n; z++) {
if(newArray.length%2===1){
var newLength = Math.floor(newArray.length/2)+1;
var x = newArray.length - newLength;
var fold = newArray.splice(newLength,x).reverse();
for (var i = 0; i < fold.length... | [
"fold (f, a) {\n return fold(f, a, this)\n }",
"function intermediateSums(arr) {\n var lastSet = arr.length % 10;\n var sum = 0;\n for (var i = arr.length - 1; i > arr.length - (1 + lastSet); i--) {\n sum += arr[i];\n }\n arr[arr.length] = sum;\n // for loop incremented by 11 (10 plus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loads the game state from local storage into state | function loadState()
{
if( savedStateExists() )
{
console.log("Found a saved state to load.");
// pause game
bPauseGame = true;
// load into a holding area
var tempload = JSON.parse(localStorage.getItem(savedStateKey));
// load data into real state
stat... | [
"load() {\n let jsonState = localStorage.getItem('state')\n if (jsonState) {\n let parsedState = JSON.parse(jsonState)\n // Do this so we add in the defaults for any new state objects which are missing.\n if (parsedState.version !== stateVersion) {\n sta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Invoke a static block, preserving some number of stack entries for use in updating. | function InvokeStaticBlockWithStack(block, callerCount) {
let {
parameters
} = block.symbolTable;
let calleeCount = parameters.length;
let count = Math.min(callerCount, calleeCount);
if (count === 0) {
return InvokeStaticBlock(block);
}
let out = [];
out.push(op(0
/* PushFrame */
));
if... | [
"function InvokeStaticBlock(block) {\n return [op(0\n /* PushFrame */\n ), op('PushCompilable', block), op('JitCompileBlock'), op(2\n /* InvokeVirtual */\n ), op(1\n /* PopFrame */\n )];\n}",
"enterMethodInvocation_lf_primary(ctx) {\n\t}",
"function call(){\n\t\t\t$.each(funstack, function(index, value){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles the user clicking the menu Flag item. | function flagClick() {
const flagIndex = Data.Flags.indexOf(Data.Filename);
if (flagIndex !== -1) {
Data.Flags.splice(flagIndex, 1);
} else {
Data.Flags.push(Data.Filename);
}
localStorage.setItem(StoreName.Flags, JSON.stringify(Data.Flags));
updateMenuFlag();
} | [
"function updateMenuFlag() {\n const menuFlag = document.getElementById('menu-flag');\n if (menuFlag) {\n if (Data.Flags.includes(Data.Filename)) {\n menuFlag.title = 'Remove flag';\n menuFlag.className = 'flagged';\n } else {\n menuFlag.title = 'Flag this diagram';\n menuFlag.className ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
populating the Dossiers once the component mounts | componentDidMount() {
this.props.getDossiers();
} | [
"componentDidMount() {\n this._isMounted = true;\n this.loadRecommendedItems();\n }",
"componentDidMount() {\n \n this.loadHoldings();\n\n }",
"componentDidMount(){\n this.getItems()\n }",
"mountChilds(){\n for(let child of this.childs){\n child.mount(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make the squares on the screen | function makeSquares() {
squareSize = sizeArray[j];
//squareSize = sizeArray[j];
for (let x = 0; x < width; x += squareSize) {
for (let y = 0; y < height; y += squareSize) {
fill(int(random(200, 255)), 0, int(random(100, 150)));
rect(x, y, squareSize, squareSize);
}
}
} | [
"function drawSquareSideHouse() {\n moveForward(50);\n turnRight(90);\n}",
"function displayGridPaper()\r\n{\r\n for(var row = 0; row < noRows; row++)\r\n {\r\n for(var col = 0; col < noCols; col++)\r\n {\r\n var x = col * squareSize;\r\n var y = row * squareSize;\r\n\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Si devuelve true significa que la fecha es anterior, y si devuelve false significa que la fehca introducida es posterior a la actual. | function esFechaMenorActual(date) {
var x = new Date();
var fecha = date.split("-");
if (fecha[0]>1000) {
x.setFullYear(fecha[0], fecha[1]-1, fecha[2]);
} else {
x.setFullYear(fecha[2], fecha[1]-1, fecha[0]);
}
var today = new Date();
if (x >= today) {
var error = "La fecha de desaparición es posterior al... | [
"has_life_expired() {\n if ((this.lifetime !== null) && (this.age >= this.lifetime)) {\n return true;\n } else {\n return false;\n }\n }",
"function IsEarlier(less, more)\n{\n\tif (less.getFullYear() > more.getFullYear())\n\t{\n\t\treturn false;\n\t}\n\tif (less.getMonth() > more.getMonth() &&... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Browse Titles collection by Name on odata.netflix.com | function BrowseByName()
{
HideListingCriteria();
$("#Language").attr('selectedIndex', 0);
$("#Genre").attr('selectedIndex', 0);
var movieNameToSearch = $("#txtName").val();
movieCriteria = "Name"
movieCriteriaValue = movieNameToSearch;
var uri = MOVIE_BY_NAME_URI.replace("*name*", movieName... | [
"function BrowseMovies() \n{\n HideListingCriteria();\n movieCriteria = \"All\"\n movieCriteriaValue = \"Movies\";\n BuildMoviesCache(MOVIE_LISTING_URI)\n startPage = 0;\n FetchTitles(startPage)\n}",
"getByTitle(title) {\n return List(this, `getByTitle('${encodePath(title)}')`);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
logs the name of each driver whose hometown matches the passedin argument | function logDriversByHometown(drivers, hometown) {
drivers.forEach((currentDriver)=> {
if (currentDriver.hometown === hometown){
console.log(currentDriver.name)
}
})
} | [
"function getFullNames(runners) {\n /* CODE HERE */\n let name = [];\n runners.forEach((index) => {\n name.push(index.last_name + \", \" + index.first_name);\n })\n return name;\n}",
"function printSearchResults (result) {\n console.log(`Found ${result.rowCount} by the name ${searchName}`);\n for (let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build a list of cigar operators from a cigarString. Removes padding operators and concatenates consecutive operators of the same type | function buildOperators(cigarString) {
var operators, buffer, i, len, prevOp, next, op, nBases;
operators = [];
buffer = [];
// Create list of cigar operators
prevOp = null;
len = cigarString.length;
for (i = 0; i < len; i++) {
next = cigarString.ch... | [
"function getOps(str){\r\n let operands=[];\r\n let str2=str.replace(/\\w+(?=\\s)/,\"\").replace(/\\s/g,\"\");\r\n operands=(/,/.test(str2))?str2.split(','):str2.split();\r\n if (operands[0]!=\"\"){\r\n let i=0;\r\n let opsnumber=operands.length;\r\n console.log(\"this a test \"+operands[0]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns all of the relationship keys on a record which also have a value in the update object. | function relationshipKeys(model, update) {
if (!model) {
return []
}
return Object.keys(model).filter(function(key) {
return model[key].relationshipType;
}).filter(function(key) {
return key in update
});
} | [
"function attributeKeys(record) {\n return Object.keys(record).filter(function(key) {\n return key !== 'id' || key !== 'type';\n })\n}",
"function getChangedFields (instance) {\n var changeSet = getChangeSet(instance) || [];\n var props = changeSet.reduce(function (accum, change) {\n // Distill th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assert `value` matches the bound `expression`. | function assertion(value) {
return expression.test(value)
} | [
"function verify(expression) {\n return true;\n }",
"function assertMatch(actual, expected, message) {\n if (isRegExp(expected)) assert(expected.test(actual), message || 'Expected \"' + actual + '\" to match \"' + expected + '\"');else if (typeof expected === 'function') assert(expected(actual), mess... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Form ligaturelike combinations of characters for text mode. This includes inputs like "", "", "``" and "''". The result will simply replace multiple textord nodes with a single character in each value by a single textord node having multiple characters in its value. The representation is still ASCII source. The group w... | formLigatures(group) {
let n = group.length - 1;
for (let i = 0; i < n; ++i) {
const a = group[i]; // $FlowFixMe: Not every node type has a `text` property.
const v = a.text;
if (v === "-" && group[i + 1].text === "-") {
if (i + 1 < n && group[i + 2].text ===... | [
"_combineLayers(layerStateArray) {\n let selectedChars = new Array(this._text.length).fill(false);\n for (let layer of layerStateArray) {\n for (let annotation of layer.getAnnotationList()) {\n annotation.validate(this._text);\n for (let i=annotation.start; i < annotation.end; i++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function iterates through a books "borrows" key by using forEach. Each iteration will utilize the find method which is passed the accounts array. This will search for an id in the accounts array that matches the id in the borrowList. If one is found and is not a duplicate, a "returned" key will be created and the ... | function getBorrowersForBook(book, accounts) {
const borrowList = book.borrows;
const borrowedBy = [];
borrowList.forEach((borrow) => {
let findAccount = accounts.find((account) => account.id.includes(borrow.id));
let dupliCheck = borrowedBy.some((borrow) => borrow.id === findAccount.id);
if(findAccou... | [
"function retrievedBooks (account, books) {\n let id = account.id\n let allBooksCheckedOut = [];\n for (let i = 0; i < books.length; i ++) {\n if (books[i].borrows[0].returned === false && books[i].borrows[0].id === id) {\n allBooksCheckedOut.push(books[i])\n }\n }\n return allBooksCheckedOut\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsidiary Double Factorial of odd/even Number (by task) | function factorialOdd(number) {
let result = BigInt(number); //BigInteger for precision
while (number > 2) {
number = number - 2;
result = result * BigInt(number);
}
return result;
} | [
"function faktorial(n)\r\n{\r\n\tif (n == 0) return 1\r\n\treturn n * faktorial( n - 1 ) // 5 * ( 4 * ( 3 * ( 2 * ( 1 ) ) ) )\r\n}",
"function oddProduct(arr) {\n\tlet a = 1;\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tif (arr[i] % 2 === 1) {\n\t\t\ta *= arr[i];\n\t\t}\n\t}\n\treturn a;\n}",
"function primeF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the given object is an instance of Resolver. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process. | static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Resolver.__pulumiType;
} | [
"static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === RelationshipLink.__pulumiType;\n }",
"static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display payment options based on preference | function paymentOptions(option) {
const ccDIV = document.getElementById("credit-card");
const ppDIV = document.getElementById("paypal");
const bitcoinDIV =document.getElementById("bitcoin");
if(option == "credit card"){
ccDIV.style.display = "inherit";
ppDIV.style.display = "none";... | [
"function hidePaymentOptions() {\n // loop through paymentOptions object and set display to none\n for (prop in paymentOptions)\n toggleView(paymentOptions[prop], false);\n }",
"function updatePaymentInfo () {\n\n switch (document.querySelector(\"#payment\").value) {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scan for available devices | scan(){
// TODO : scan for new devices
let ret="", dev=[], device=null,re=null,id=null;
this.count = 0;
if(this.Bridges.ADB.isReady()){
dev = this.Bridges.ADB.listDevices();
this.count += dev.length;
for(let i in dev){
this.devices[... | [
"scanForAllDevices() {\n if (this.btDevicesToPing.length <= 0) {\n // console.log(`[${new Date()}] no BT devices to ping`);\n } else {\n // console.log(`[${new Date()}] scanning for presence of any of ${this.btDevicesToPing.length} BT devices`);\n\n // scan for each de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Increments or decrements the volume. This is to keep other code from having to know about globalVolume. Argument is desired change in volume. | function adjustVolume(deltaVolume){
setVol(globalVolume + deltaVolume);
} | [
"function adjustVolume(){\n volumeController.volume = \"0.5\";\n volumeController.adjustVolume();\n}",
"setVolume(volume) {\r\n assertRange(volume, 0, 1, 'volume');\r\n this._volume = volume;\r\n this.audio.volume = volume;\r\n this.emit(exports.PlayerEvent.VolumeChange, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate HTML for correct answer | function correctAnswerHtml() {
console.log("Generating Correct Answer Response");
return `
<br>
<div class="correct-answer">
<img src="images/correct-answer.jpg">
<h2>Great Job! That is correct!</h2>
</div>
`
} | [
"function generateWrongView() {\n return `<img src=\"images/beavis-butthead-electrified.gif\" alt=\"Beavis and Butt-Head are getting fried\">\n <h2>WRONG ANSWER!</h2>\n <p> \n ${DATA[questionNumber].correctAnswer}</p>\n <button role=\"button\" class=\"nextQuestionBtn\">NEXT QUESTION... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup for testing MessageList component | function setupMessageList() {
let props = {
messages: [
{
id: 0,
user: {
name: 'John Doe',
picture: 'johndoe.jpg'
},
text: 'test',
date: '1465332186'
}
],
... | [
"function setupMessage() {\n let props = {\n id: 0,\n text: 'test',\n date: '1465332186',\n user: {\n name: 'John Doe',\n picture: 'johndoe.jpg'\n },\n current_user: {\n name: 'John Doe',\n picture: 'johndoe.jpg'\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter a parse tree produced by KotlinParserinOperator. | enterInOperator(ctx) {
} | [
"enterIsOperator(ctx) {\n\t}",
"function ExpressionParser() {\n \t\tthis.parse = function() {\n\t \t\treturn Statement(); \n\t \t}\n \t\t\n//\t\tStatement := Assignment | Expr\t\n\t\tthis.Statement=function() {return Statement();}\n\t \tfunction Statement() {\n\t \t\tdebugMsg(\"ExpressionParser : Statement\");\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that save failed status from google | function saveGoogleFailedStatus(user, id) {
return new Promise((resolve, reject) => {
let query = 'SELECT * FROM ' + table.GOOGLE_LIST + ' WHERE ouid = ?'
db.query(query, [id], (error, rows, fields) => {
if (error) {
reject({ message: message.INTERNAL_SERVER_ERROR })
} else {
... | [
"async function setTaskFailedStatus(uri) {\n await update(`\n PREFIX mu: <http://mu.semte.ch/vocabularies/core/>\n PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n PREFIX adms: <http://www.w3.org/ns/adms#>\n\n DELETE WHERE {\n GRAPH ?g {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
state begins with an empty array of 'suggestions.' these will be populated by using queries to the algolia database, suggestions are then used to populate Preview items to render in the popup | constructor( props ) {
super( props );
this.state = {
suggestions: []
};
} | [
"function showSuggestions() {\n var v = getNeedle();\n\n if (v.length == 0) {\n box.css('display', 'none');\n return;\n }\n\n suggestions = 0;\n\n box.empty();\n\n options.filters.each(function(i, f) {\n if (suggestions == options.size) {\n return;\n }\n\n list.ever... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes a hex number and generates a decimal number can set the sum to whatever is best, depending on problem criteria does not include decoding | function generateDecimalFromHex (hiByte, LoByte) {
var strCompleteHex = '' + hiByte + LoByte;
var sum = -8192;
var hex = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F'};
for (var positionIndex = 3; positionIndex >= 0; positionIndex--) {
var... | [
"function hexToDecimal(args) {\n var hexNumber = args[0],\n decNumber = 0,\n tempNumber,\n power = 1,\n i;\n\n for (i = hexNumber.length - 1; i >= 0; i -= 1) {\n switch (hexNumber[i]) {\n case 'A': tempNumber = '10'; break;\n case 'B': tempNumber = '11'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve a 4character tag from the DataView. Tags are used to identify tables. | function getTag(dataView, offset) {
var tag = '';
for (var i = offset; i < offset + 4; i += 1) {
tag += String.fromCharCode(dataView.getInt8(i));
}
return tag;
} | [
"function ipV4OctetString() {\n return operator_1.chain(string_1.stringToNaturalNumber(), number_1.ltEq(255), (_name, octet) => {\n return octet.toString();\n });\n}",
"function fnExoticToStringTag() {}",
"function getHTMLTag(tagName) {\n const a = '<'+tagName+'></'+tagName+'>';\n return a;\n\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/motors/guide/id/complete.html. Motor guide complete results page, renders with guide/complete.hbs. | function doCompletePage(req, res, rockets) {
loadGuideResult(req, res, function(result) {
var adapters = false,
i;
for (i = 0; i < result.mmts.length; i++) {
if (result.mmts[i].adapter)
adapters = true;
}
if (result.conditions.stableVel == null)
result.conditions.stableVe... | [
"function markGoalComplete() {\n\t\tprops.markGoalComplete(props.goalId);\n }",
"function completeCycleIfNecessary() {\n if (stateManager.getAccountsWithStatus(Statuses.NOT_STARTED).length == 0 &&\n stateManager.getStatus() != Statuses.COMPLETE) {\n stateManager.setStatus(Statuses.COMPLETE);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
runProgram() Run the sorting algorithm | function runProgram() {
var arr = [];
var resultString = [];
// Get the array lenght
var len = CodeUtils.getDataLen();
// Fill the array with random integers
for (var i = 0; i < len; i++) {
arr[i] = CodeUtils.getRandomInt(0, 100);
}
resultString[0] = 'unsorted array: ' + arr;
// Call the inser... | [
"function runComparison() {\r\n\tgenerateArray();\r\n\tfor(var j = 0; j < ALGORITHMS.length; j++) {\r\n\t\tif(ALGORITHMS[j].use == true) {\r\n\t\t\trun(ALGORITHMS[j].name);\r\n\t\t}\r\n\t}\r\n\t_all = [['Algorithm', 'Comparisons', 'Swaps', 'Distance', 'Time (ms)']];\r\n\t_comparisons = [['Algorithm', 'Comparisons']... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set an exclusive timeout, such that only one timer is running at any given time | function setExclusiveTimeout(timeId, fn, timeout)
{
if (timeId > 0)
clearTimeout(timeId);
timeId = 0;
timeId = setTimeout(fn, timeout);
timeoutId = timeId;
} | [
"function setTimers(timeout)\n{\n // warning 5 mn before the end.\n setTimeout('showAlmostExpiredLock()',(timeout-5)*60000);\n setTimeout('showExpiredLock()',timeout*60000); \n}",
"function set_timer_for_continuse_attack(){\n\tvar _p2Id = Session.get('p2Id');\n\tSession.set(_p2Id, 'locked');\n\tmakePl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the motion according to a direction | function updateMotion(dir) {
switch(dir) {
case "N":
motX=0;motY=-1;
break;
case "S":
motX=0;motY=1;
break
case "E":
motX=1;motY=0;
break;
case "W":
motX=-1;motY=0;
break;
}
} | [
"function updateDirection() {\n\n\tvar p2 = {\n\t\tx: state.tree[1],\n\t\ty: state.tree[0]\n\t};\n\n\tvar p1 = {\n\t\tx: state.user.location[1],\n\t\ty: state.user.location[0]\n\t};\n\n\t// angle in degrees\n\tvar angleDeg = Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI;\n\tangleDeg -= state.user.heading\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[4] Step::= AxisSpecifier NodeTest Predicate | AbbreviatedStep [12] AbbreviatedStep::= '.' | '..' | function step(stream, a) {
var abbrStep = stream.trypop(['.', '..']);
if ('.' === abbrStep) // A location step of . is short for self::node().
return a.node('Axis', 'self', 'node');
if ('..' === abbrStep) // A location step of .. is short for parent::node()
return a.node('Axis', 'parent', 'node'... | [
"#setActiveStepAttributes() {\n let { activeStep } = this;\n for (let step of this.children) {\n let name = step.getAttribute(\"name\");\n if (name === activeStep) {\n step.slot = \"active\";\n } else {\n step.slot = \"\";\n }\n }\n }",
"function relativeLocationPath(lh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
==== Server Timezone Helpers end==== ==== Local Timezone Helpers start==== server date convert into local date | convert_date_to_local(date) {
if(typeof(date) == 'undefined' || date == null)
return null;
var local_tz = Intl.DateTimeFormat().resolvedOptions().timeZone; // local timezone
return moment(date).tz(local_tz).format('YYYY-MM-DD');
... | [
"getLocalDate()\n\t{\n\t\treturn new Date(new Date().toLocaleString('nl-NL', { timeZone: this.homey.clock.getTimezone() }));\n\t}",
"toBrowserLocalTime() {\n const localOffset = (new Date()).getTimezoneOffset();\n this.dateTime.utcOffset(-localOffset);\n return this;\n }",
"function normalise_date(dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
on parcourt les livres et on affiche les livres en dessous du prixMax | function afficheLivres(prixMax = 20) {
let bonPrix = livres.filter((livre) => livre.prix < prixMax);
console.log(bonPrix);
for (let itemBonPrix in bonPrix) {
let articleLong = document.createElement("article");
articleLong.classList.add("article-allonge");
articleLong.innerHTML += ` ... | [
"function billet(prix , rendu){\n const result = prix - rendu;\n return result\n }",
"function calcularProm(filas)\n{\n let promedio = document.getElementById('promedio');\n let max = document.getElementById('precioMaximo');\n let min = document.getElementById('precioMinimo');\n if(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create an words array from filter input field | function getSearchWords() {
// get inpu
let entry = document.getElementById('search-field').value;
// split in words
let words = entry.split(' ');
// del empty elements of array, and make all to lower case
for (let i = words.length - 1; i >= 0; i--) {
// to lower case
words[i] = ... | [
"words(content) {\n //@TODO\n let content_array = content.split(/\\s+/);\n const normalized_content = content_array.map((w)=>normalize(w));\n const words = normalized_content.filter((w) => !this.noise_w_set.has(w)); \n return words;\n }",
"function getWords() {\n\t\tvar raw = Util.txt.getInputT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds or removes showmodal to class list of sign up so that it appears | function toggleSignupModal() {
signup_modal.classList.toggle("show-modal");
} | [
"function toggleSigninModal() {\n signin_modal.classList.toggle(\"show-modal\");\n}",
"function signUp() {\n $('#main-header').text(\"B-Day List\");\n $('#login-container').hide();\n $('#logout-btn').removeClass('hide');\n $('#add-btn').removeClass('hide');\n }",
"function openClose__UserTool() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
swallow any errors from an action and log them to the console returns a function that takes in a previous promise result arg that is passed down to swallowed action | function swallow(action, name) {
return function(result) {
return action(result).catch(function(e) {
console.error("Failed to swallow task " + name, e);
});
};
} | [
"function rejected(x){\n\t if(async) context = cat(future.context, cat(asyncContext, context));\n\t settle(action.rejected(x));\n\t }",
"_onJobFailure(...args) {\n const onJobFailure = this.options.onJobFailure;\n if (isFunction(onJobFailure)) {\n onJobFailure(...args);\n } else if (!this.opt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a listener to the element for clicking and holding | function addHoldListener(elem) {
var tm;
elem.addEventListener("mousedown", function() {
tm = window.setInterval(function() {
_ROTATE_FUNCTIONS[elem.id]();
},10);
});
elem.addEventListener("mouseup", function() {
clearTimeout(tm);
})
} | [
"add_click(func) {\n this.add_event(\"click\", func);\n }",
"function addEventListeners() {\n // pan watch point event\n var hammerPointer = new Hammer(document.querySelector('#pointer'));\n hammerPointer.on('pan', onPanPointer);\n}",
"_shieldSwapListener() {\n document.addEventListener(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
private v: stack array to restore ret: lenght of restored stack | restore_stack(stuff){
const v = stuff.stack;
const s = v.length;
for(var i=0; i<s; i++){
this.stack[i] = v[i];
}
this.last_refer = stuff.last_refer;
this.call_stack = [...stuff.call_stack];
this.tco_counter = [...stuff.tco_counter];
return s;
} | [
"save_stack(s){\n var v = [];\n for(var i=0; i<s; i++){\n v[i] = this.stack[i];\n }\n return { stack: v, last_refer: this.last_refer, call_stack: [...this.call_stack], tco_counter: [...this.tco_counter] };\n }",
"function saveState () {\n stack.splice(stackPointer);\n var cs = slot... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sends brewlist to the map | function passToMap() {
let startBar = [STORE.brewList[0].longitude, STORE.brewList[0].latitude];
let otherBars = [];
STORE.brewList.forEach((bar) => {
otherBars.push([bar.longitude, bar.latitude, bar.name]);
});
removeMarkers();
recenter(startBar);
addMarker(otherBars);
} | [
"function loadBrewsByType(brewList) {\n // These are all know types of brews on tap at various bars; some may be\n // empty.\n var brews = {\n brewDogBeers: [],\n guestBeers: [],\n ciders: [],\n craftyDevilTakeover: [],\n };\n\n var ranges = getRanges(brewList);\n\n if (ranges) {\n // Brutely c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MemberDirectoryListCtrl is shared by all directives. | function MemberDirectoryListCtrl($filter, $http) {
return function($scope, $element, $attrs) {
angular.extend($scope, {
reset: reset,
pageSize: 20,
currentPage: 0,
numberOfPages: 1
});
activate();
function activate() {
ge... | [
"function redrawChannelMembers() {\n\t\tutilsModule.clearChildren(memberListElem);\n\t\tvar profile = self.activeWindow[0];\n\t\tvar party = self.activeWindow[1];\n\t\tvar show = profile in connectionData && party in connectionData[profile].channels;\n\t\tif (show) {\n\t\t\tvar members = connectionData[profile].cha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter of the imageURL attribute. | set imageURL(aValue) {
this._logger.debug("imageURL[set]");
this._imageURL = aValue;
} | [
"set imageURL(aValue) {\n this._logService.debug(\"gsDiggEvent.imageURL[set]\");\n this._imageURL = aValue;\n }",
"set imageUrl(monImageUrl) {\n this._imageUrl = monImageUrl\n }",
"get imageUrl() {\n return this._imageUrl\n }",
"get imageURL() {\n this._logger.debug(\"imageURL[ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the keyonly container | function removeKeyOnly() {
document.getElementById('keyonly').outerHTML = '';
} | [
"removeKeys () {\n this._eachPackages(function (_pack) {\n _pack.remove()\n })\n }",
"remove(key) {\n var item = this.map[key];\n if (!item) return;\n this._removeItem(item);\n }",
"remove(key) {\n let index = Hash.hash(key, this.sizeLimit);\n\n if (\n this.hashTable[index].leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform the range ref's current value by an operation. | transform(ref, op) {
var {
current,
affinity
} = ref;
if (current == null) {
return;
}
var path = Range.transform(current, op, {
affinity
});
ref.current = path;
if (path == null) {
ref.unref();
}
} | [
"transform(ref, op) {\n var {\n current,\n affinity\n } = ref;\n\n if (current == null) {\n return;\n }\n\n var path = Range.transform(current, op, {\n affinity\n });\n ref.current = path;\n\n if (path == null) {\n ref.unref();\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allows items to be deleted from the item array at runtime (this is only available if options.saveData was true at initial creation or rebuild) Note we don't remove from the item array directly so that calculations based on the number of items is still accurate; items are added when a rebuild is triggered | function deleteItem(i) {
return this.each(function() {
var d = getSavedData($(this));
if(d) {
for(it in i)
d.delItems.push(i[it]);
saveData($(this), d);
}
});
} | [
"removeNeededItems() {\n this.neededItems = [];\n }",
"deleteItemsEventsEtc() {\n let items_buffer = getReferencesOfType('AGItem');\n items_buffer.forEach(function (buffer) {\n deleteItem(buffer);\n });\n let conditions_buffer = getReferencesOfType('AGCondition');\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sonarDistance = 1; // now has to be fetched as values with getIOPinState(echoPin) | constructor(){
// Map pin numbers to simulated pin indexes
for (let i = 0 ; i < 50 ; ++i){
this.pinMapping[i + ""] = i;
}
// Map analog pin names to simulated pin indexes
for (let i = 0 ; i < 8 ; ++i){
this.pinMapping["A" + i] = 24 + i;
}
... | [
"function update() {\n\tvar out;\n\n\tconfig.motors.forEach(function (motor) {\n\t\t// update motor.gpio with value from rawMotorValues[motor.key]\n\t\t// todo: constrain motor output values to range in configuration\n\t\t//out = ((rawMotorValues[motor.position.key] || 1000) - 1000) / 1000;\n\t\t//out = (out < 0 ? ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Isotope Filters (for gallery) | function isotopeFilters(gallery) {
var gallery = $(gallery);
if (gallery.length) {
var container = gallery;
var optionSets = $(".filters-by-category .option-set"),
optionLinks = optionSets.find("a");
optionLinks.on('click', function (e) {
var thisLink = $(this);
if (thisLink.hasClass("selected"... | [
"function filterGrid()\n{\n //use text to filter so we can easily switch text and maintain functionality\n if ( $(this).text() == \"ART\" ) {\n $('.grid').isotope({ \n filter: \"*\"\n });\n setDataLightbox( \"grid-item\" );\n }\n else {\n var filterValue = \".\" + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array of promises for copying of all files that don't need transformation | async function copyFiles() {
for (const file of verbatimFiles) {
const src = path.join('./', file);
const dest = path.join(directory, file);
await fs.copyFile(src, dest);
}
} | [
"function copyVendorFilesFn () {\n var\n asset_group_table = pkgMatrix.xhiVendorAssetGroupTable || [],\n dev_dependency_map = pkgMatrix.devDependencies || {},\n asset_group_count = asset_group_table.length,\n promise_list = [],\n\n idx, asset_group_map, asset_list, asset... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The greediness of a superscript or subscript Handle a subscript or superscript with nice errors. | handleSupSubscript(name) {
const symbolToken = this.nextToken;
const symbol = symbolToken.text;
this.consume();
this.consumeSpaces(); // ignore spaces before sup/subscript argument
const group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS);
if (!group) {
... | [
"function isFreeSubline(varOfInst, sublineChars){\n var lineChars = sublineChars;\n var isBound = false;\n var parenCount = 0;\n for (var i = 0; i < lineChars.length; i++){\n if (lineChars[i] == varOfInst){\n if (i-2 > 0 && (lineChars[i-2] == \"E\" || lineChars[i-2] == \"U\") && lineChars[i-1] == \"Q\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Blank Output (End Of Line) | function blank() {
putstr(padding_left(seperator, seperator, sndWidth));
putstr("\n");
} | [
"function emptyLines(number) {\n if (typeof number !== 'undefined') {\n for (i = 1; i <= number; i++) {\n console.log(' ');\n }\n }\n else {\n console.log(' ');\n }\n}",
"EmptyStatement() {\n this._eat(\";\");\n return factory.EmptyStatement();\n }",
"end() {\n\t\treturn this.prog.lengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Primary Instructor add event | function onAddPrimaryInstructor() {
angular.element('.input-assisting-instructor-class')[0].disabled = false;
} | [
"addInstructor(newInstructor){\n this.instructors.push(newInstructor);\n }",
"function onChangePrimaryInstructor() {\n if (angular.isObject(self.event.primaryInstructorName)) {\n angular.element('.input-assisting-instructor-class')[0].disabled = false;\n } else {\n angular.elem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Price in cents to euros | function centsToEuros(priceInCents){
let result = priceInCents / 100;
return result;
} | [
"function convertPrices(price) {\n if (price !== undefined) {\n if (vat['show']) {\n price = parseFloat(price) * vat['quote'];\n }\n dataPrice = price.toFixed(2).toString().split('.');\n dataPrice[0] = dataPrice[0].replace(',', '.');\n if(dataPrice[1] === undefined){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find the owner by his id | function findOwnerById (id){
for (var user in users){
var u=users[user];
if (u.id==id){
return u.name;
break;
}
}
// return "";
} | [
"getUserFromUhId(uhID) {\n check(uhID, String);\n return this._collection.findOne({ uhID });\n }",
"function findPerson(id) {\n var foundPerson = null;\n for (var i = 0; i < persons.length; i++) {\n var person = persons[i];\n if (person.id == id) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds an existing or create a new view hub instance. | static getInstance() {
return ViewHub._findInstance() || new ViewHub(appEnvStub);
} | [
"function newView(socketCall) {\n var token = getToken();\n if (token) {\n setView('chartsView');\n initCharts();\n initModalBoxes();\n if (socketCall != 'socketCall') {\n setUpWebSocket();\n }\n } else {\n setView('loginView');\n }\n}",
"_createVie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the ngrepeat directive to the element. In the case of multielement (start, end) it adds the appropriate multielement ngrepeat to the first and last element in the range. | function addNgRepeatToElement(element, attrs, repeatExpression) {
if (element[0].hasAttribute('dir-paginate-start') || element[0].hasAttribute('data-dir-paginate-start')) {
// using multiElement mode (dir-paginate-start, dir-paginate-end)
attrs.$set('ngRepeatStart', repeatExp... | [
"function range(start, end, increment) {\n var myArr = [];\n var incr;\n if (increment === undefined) {\n incr = 1;\n } else {incr = increment};\n if (start == end) {\n return myArr;\n } else if (start < end && incr > 0) {\n while (start <= end) {\n myArr.push(start);\n start += incr;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get template install package | function getTemplateInstallPackage(template, originalDirectory) {
let templateToInstall = 'ins-template';
if (template) {
if (template.match(/^file:/)) {
templateToInstall = `file:${path.resolve(originalDirectory, template.match(/^file:(.*)?$/)[1])}`;
} else if (template.includes('://') || template.ma... | [
"function getPackageInfo(installPackage) {\n if (installPackage.match(/^.+\\.(tgz|tar\\.gz)$/)) {\n return getTemporaryDirectory()\n .then(obj => {\n let stream;\n if (/^http/.test(installPackage)) {\n stream = hyperquest(installPackage);\n } else {\n stream = fs.crea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Consider static for reflection probe. | set ReflectionProbeStatic(value) {} | [
"get ReflectionProbeStatic() {}",
"setupStatic() {\n }",
"get OccludeeStatic() {}",
"_registerStaticField (classInfo) {\n if (!(classInfo instanceof Ast.ApexClass)) return\n\n classInfo.staticFields.keys().forEach((fieldName) => {\n const staticField = classInfo.staticFields.get(fieldName)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[MSOFFCRYPTO] 2.3.4. EncryptionInfo Stream | function parse_EncryptionInfo(blob, length) {
var vers = parse_CRYPTOVersion(blob);
switch(vers.Minor) {
case 0x02: return parse_EncInfoStd(blob, vers);
case 0x03: return parse_EncInfoExt(blob, vers);
case 0x04: return parse_EncInfoAgl(blob, vers);
}
throw new Error("ECMA-376 Encryped file unrecognized Versio... | [
"function encryptData(textToEncryp){\n \n // Cipher text\n const cipher = crypto.createCipheriv('aes256', cipherKey, initializationVector);\n \n // Text encrypted with AES-256\n let encrypted = cipher.update(textToEncryp,'utf8','hex');\n encrypted += cipher.final('hex');\n // JSON with Ciphr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
It's possible to remove a component by typeId or by the specific object. typeId: if the scene object contains a component of this type, will be removed specific object: if the scene object contains the specified object, will be removed | removeComponent(findComponent) {
let typeId = "";
let comp = null;
if (typeof(findComponent)=="string") {
typeId = findComponent
comp = this.component(findComponent);
}
else if (findComponent instanceof bg.scene.Component) {
comp = findComponent;
typeId = findComponent.typeId;
}
... | [
"removeObject(object) {\n this.scene.remove(object);\n }",
"function delete_object_type (type) {\r\n type = type.toLowerCase();\r\n if (TypeData['types'][type]) {\r\n TypeData['types'][type] = null;\r\n TypeData['type_count']--;\r\n DataStore[type] = null;\r\n }\r\n}",
"function removeCompon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove existing item from order | function removeItem(item) {
item.order = null;
var ix = this.orderItems.indexOf(item);
if (ix > -1) {
this.orderItems.splice(ix, 1);
}
} | [
"removeItem(item) {\n Items.remove(item._id)\n }",
"function removeItem() {\n \n var idxToRemove = $('.remove-from-cart').attr('data-index');\n \n cart.items.splice(idxToRemove, 1);\n renderCart(cart, $('.template-cart'), $('.cart-container'));\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter for grabbing nval, tval for observation fact | getObservationFacts () {
return {
nval_num: this.state.nval_num,
tval_char: this.state.tval_char
}
} | [
"getEntityValue(entity) {\n return this.isLazy ? entity[\"__\" + this.propertyName + \"__\"] : entity[this.propertyName];\n }",
"function getValue(fLabel, t) {\n var series = plot.getData();\n for (var i = 0; i < series.length; ++i)\n if (series[i].label == fLabel) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to check CN Domain name(name part only) | function fn_CheckCNDomainNameOnly ( strDomainName )
{
str = trimString(strDomainName);
// must not exceed 20 chars
if( str.length==0 || str.length > 20)
{
return (false);
}
// with only leagal chars
re = /^[a-zA-Z0-9\-\u4E00-\u9FA5\uFE30-\uFFA0]+$/g
if ( ! re.test(str) )
{
return (false)... | [
"function fn_CheckCNDomainName ( strDomainName )\n\t{\n\t\tstrDomainName = trimString ( strDomainName ) ;\n\t\t\n\t\tarrayOfStrings = strDomainName.split(\".\");\n\t\tif ( arrayOfStrings.length < 2 )\n\t\t{\n\t\t\treturn (false);\t// no enough parts\n\t\t}\n\t\tfor(i=0;i<arrayOfStrings.length;i++)\n\t\t{\n\t\t\tstr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine the length of the payload section of a frame. Only applies to frame types that MAY have both metadata and data. | function getPayloadLength(frame, encoders) {
let payloadLength = 0;
if (frame.data != null) {
payloadLength += encoders.data.byteLength(frame.data);
}
if ((0, _RSocketFrame.isMetadata)(frame.flags)) {
payloadLength += UINT24_SIZE;
if (frame.metadata != null) {
payloadLength += encoders.metadat... | [
"function getSize(payload) {\n // Message header length is 24 bytes.\n const len = payload.length + 24;\n if (len >= 1024) {\n return (len / 1024).toFixed(2) + \"KiB\";\n } else {\n return len + \"B\";\n }\n}",
"function getLength(data) {\n\treturn Object.keys(data).length;\n}",
"function DataLength(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
complicated method, which gets a feed url compares it with any cached data from that feed url plays what it finds using the following rules (thanks Richard): If there is a whole new one play it else play from where I stopped in whatever when that finishes play the next newer one (irrespective of listenedness) or if the... | function playFromCache(feedUrl, bookmarked){
// Tell the player to update its database, discovering
// any audio files in the music directory specified in
// the config file.
player.updateDatabase();
//make a simplified name from the feedUrl
var fn = makeRSSName(feedUrl);
console.log("caching feedurl "+fe... | [
"function checkLiveData(teamUrl, scoreUrl){\n if ( teamDataDate === \"\" || Date.parse(teamDataDate) + 12*60*60*1000 < new Date ){\n refreshTeamData(teamUrl)\n }\n if( teamDataDate !== \"\" ){\n refreshLiveData(scoreUrl)\n }\n //add liveDataTimestamp comparison after timestamp has been set\n if( liveDat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build a JavaScript "map" from a 2column range. First column is lowercased and becomes key, second column becomes value. | function getMapFromRange(range) {
var rangeValues = range.getValues();
var map = {};
for ( var i in rangeValues ) {
var key = rangeValues[i][0];
var value = rangeValues[i][1];
map[key.toLowerCase()] = value;
}
return map;
} | [
"function Map(rows, columns) {\n\tlet cells = [];\n\tlet i = 0;\n\twhile (i < Number(rows * columns)) {\n\t\tcells.push(Cell(i));\n\t\ti++;\n\t}\n\treturn {\n\t\tcells: cells,\n\t\ttoString: function() {\n\t\t\treturn \"(Map : {cells: \" + this.cells.toString() + \"})\";\n\t\t}\n\t}\n}",
"function createValueMap(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Order statements according to their dependencies. Optional 2nd arguments is a list of ids giving the roots to start searching for dependencies from. This is used by the regression pass to only traverse statements that regressions depend on, and to preserve order in case of ties for the purpose of picking good residual ... | function findDependencyOrder(statements, roots) {
/* jshint maxcomplexity:16 */
var exportLevels = [];
var assignments = {}; // symbol => [id] of assigners
var multiplyDefined = {}; // symbol => sentinal
var cyclicallyDefined = {}; // symbol => [symbols]
var nodes = {}; /... | [
"build_nodes_topological_ordering(){\n var topological_ordered_list = [];\n\n //get all nodes\n var all_nodes = this.get_nodes();\n var ids_queue = this.get_nodes_att_values(all_nodes, 'id');\n\n //console.log(ids_queue.shift(),ids_queue);\n //var count = 15;\n while (ids_queue.length > 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setting the config array for the background positions | setBackgroundSizeConfig() {
let backgroundSizeConfig = [];
for (let xAxisIndex = 0; xAxisIndex < 4; xAxisIndex++) {
for (let yAxisIndex = 0; yAxisIndex < 3; yAxisIndex++) {
backgroundSizeConfig.push((xAxisIndex * this.blockWidth) + 'px ' + (yAxisIndex * this.blockHeight) + 'p... | [
"function setBg () \r\n\t{\r\n\t\tvar x = '0px';\r\n\t\tvar y = '0px';\r\n\r\n\t\tfor (var i = 0; i < puzzlePieces.length; i++) //iterates over the puzzle piece and specifies the part of the image to be shown\r\n\t\t{\r\n\t\t\tpuzzlePieces[i].style.backgroundPosition = x + \" \" + y;\r\n\r\n\t\t\tif (parseInt (x, 1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return true if player with session id is round judge | isRoundJudge(sessionID, round) {
let player = this.getPlayer(sessionID);
return player && round.roundJudge.pID === player.pID;
} | [
"playerWins(){ // i2 - put inline\n\t\tif (this.player === activePlayer && playing === false) {\n\t\t\treturn true;\n\t\t}\t}",
"checkNaturalWin(){\n let win = false;\n\n //Player has natural 9\n if(this.playerHand.total === 9 && this.bankerHand.total <= 8 || \n //Player has natura... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets state to next player | nextPlayer() {
this.currentState = GAME_STATES.NEXT_PLAYER;
} | [
"next() {\n const idx = this.getIdx();\n if (idx + 1 < this.state.records.length) {\n this.playRecord(this.getKey(idx + 1));\n }\n }",
"changeActive(next, username){\n let currNode = this.state.playerToNode[username];\n if(currNode){\n switch(next){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set whether this object is new | setNew(val) {
return this._new !== val
? Object.assign(new this.constructor(this._data), {
_new: val
})
: this
} | [
"getIsNewMark() {\n return this.__isNew === true;\n }",
"isNew() {\n return this.getIsNewMark();\n }",
"toggleAddByDefault(){\n this.add_new_robot = !this.add_new_robot;\n }",
"markAsNotNew({ source } = {}) {\n this.setIsNewMark(false, { source });\n }",
"setNewInstal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
are the sets equal in value | function areSetsEqual(a, b, isEqual, meta) {
var isValueEqual = a.size === b.size;
if (isValueEqual && a.size) {
a.forEach(function (aValue) {
if (isValueEqual) {
isValueEqual = false;
b.forEach(function (bValue) {
if (!isValu... | [
"equals(otherSet) {\n if (this === otherSet) {\n return true;\n } else if (\n !(otherSet instanceof BetterSet) ||\n this.size !== otherSet.size\n ) {\n return false;\n } else {\n for (let value of this.values()) {\n if (!otherSet.has(value)) {\n return false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
close modal if form is submitted | function submitForm() {
modal.style.display = "none";
} | [
"function closeModal() {\n if (showModal) {\n setShowModal(false);\n props.location.openModal = false;\n if (success) {\n history.push(\"/\");\n dispatch(sendMessage(\"\"));\n } else {\n history.push(\"/registration\");\n dispatch(sendMessage(\"\"));\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
productId: the key to lock on transaction: an async function that performs the transaction timeout: how long to keep retrying before throwing | async function withLock (productId, transaction, timeout) {
// if there's already a lock on this id...
if (locks[productId]) {
// and we've exhausted the timeout…
if (timeout <= 0) {
// throw an error
throw new Error('Unable to acquire lock');
}
// otherwise wait 100ms…
await slee... | [
"function getProductPriceFromTaoBaoP(productName) {\n var rwPromise = new RWPromise();\n setTimeout(function () {\n var rate = Math.random();\n if (rate >= 0.5) { //50/50 fail success rate\n rwPromise.resolve(productName + \" price from taobao is: \" + (100 + Math.random() * 100));\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a fucntion that: Find a given book ('JavaScript: The Definitive Guide') | function isTheBook(item){
return item.title === 'JavaScript: The Definitive Guide'
} | [
"function readbook(book) {\n var lev = book.arg;\n var i, tmp;\n if (lev <= 3)\n i = rund((tmp = splev[lev]) ? tmp : 1);\n else\n i = rnd((tmp = splev[lev] - 9) ? tmp : 1) + 9;\n learnSpell(spelcode[i]);\n updateLog(`Spell \\'<b>${spelcode[i]}</b>\\': ${spelname[i]}`);\n updateLog(` ${speldescript[i]}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if video is already on list | function checkDupeVideo(videoId)
{
for (var i = 0; i < videoList.length; i++)
{
if (videoId == videoList[i].id)
{
sendServerMsgUser("Video is already on playlist");
return true;
}
}
return false;
} | [
"function checkWatchedVideos(title_content, image_url, video_url) {\n recently_watched_videos = JSON.parse(localStorage.getItem('watchedVideosArray'));\n\n if (recently_watched_videos.length == 0) {\n // ADD FIRST VIDEO TO JSON\n pushVideosToWatchedList(title_content, image_url, video_url);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The zerobased page index of the displayed list of items. Defaulted to 0. | get pageIndex() { return this._pageIndex; } | [
"function DDLightbarMenu_GetTopItemIdxOfLastPage()\n{\n\tvar numItemsPerPage = this.size.height;\n\tif (this.borderEnabled)\n\t\tnumItemsPerPage -= 2;\n\tvar topItemIndex = this.NumItems() - numItemsPerPage;\n\tif (topItemIndex < 0)\n\t\ttopItemIndex = 0;\n\treturn topItemIndex;\n}",
"pageIndex(itemIndex) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Response to the client making a contestant choice on a hot seat question. Expected to only come from contestant sockets. | contestantChoose(socket, data) {
Logger.logInfo('contestantChoose: ' + data.choice);
var player = this.playerMap.getPlayerBySocket(socket);
player.chooseHotSeat(data.choice);
// If this is a phoned player who hasn't made a choice yet, we should set the friendChoice.
if (player == this.serverState.... | [
"hotSeatConfirmWalkAway(socket, data) {\n Logger.logInfo('hotSeatConfirmWalkAway');\n\n // Question index needs to be deprecated to make sure hot seat player only gets money for the\n // questions they completed.\n this.serverState.hotSeatQuestionIndex--;\n\n this.serverState.setHotSeatStepDialog(und... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |