query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
The endQuiz() function clears the timer and brings the user to the High Scores Page | function endQuiz() {
// clear interval
clearInterval(intervalId);
// Show the user the quiz is over
setTimeout(showHighScore, 2000);
} | [
"function endQuiz(){\n clearInterval(timerId)\n questionZoneEl.style.display = 'none';\n finalZoneEl.style.display = 'block';\n finalScoreEl.append(timeRemaining);\n\n}",
"function allQuestionsAnswered() {\n clearTimeout(countdown);\n}",
"function end() {\n\t// set GAMEOVER to true\n\tGAME_OVER = t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validateTheEnteredName(): validates the entered name as per current item name Updates the teddy dialogue box with text stating whether the answer is correct or wrong and also makes the item image draggable if the name is correct | function validateTheEnteredName(){
//Scrolls to the question element.Useful in portrait mode.
scrollRightPanelContainer();
//Fetch the user entered name
var enteredName = document.getElementById('answerInputElement').value;
//Check if the user entered an item name and the name is equal to current item
if... | [
"function validate_name(name_id, item)\n{\n\tvar name = document.getElementById( name_id );\n\tif( ! name || (name.value.length === 0) )\n\t{\n\t\talert( 'Please enter a name for the \"' + item + '\"' );\n\t\treturn null;\n\t}\n\treturn name.value;\n}",
"function validateName()\n{\n\t//variable name is set by ele... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if the URL anchor destiny is the starting section (the one using 'active' class before initialization) | function isDestinyTheStartingSection(){
var anchors = window.location.hash.replace('#', '').split('/');
var destinationSection = getSectionByAnchor(decodeURIComponent(anchors[0]));
return !destinationSection.length || destinationSection.length && destinationSection.index() ... | [
"onCurrent(element) {\n\t\tvar slide = _.getSlide(element);\n\n\t\tif (slide) {\n\t\t\treturn \"#\" + slide.id === location.hash;\n\t\t}\n\n\t\treturn false;\n\t}",
"function atBeginning() {\n\treturn currentSceneIndex === 0;\n}",
"function activeRoute(routeName) {\n return window.location.href.indexOf(route... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API void GetTexDataAsRGBA32(unsigned char out_pixels, int out_width, int out_height, int out_bytes_per_pixel = NULL); // 4 bytesperpixel | GetTexDataAsRGBA32() {
return this.native.GetTexDataAsRGBA32();
} | [
"GetTexDataAsAlpha8() {\r\n return this.native.GetTexDataAsAlpha8();\r\n }",
"function modifyImgRGBA(data, indexes, typeOfJoint) {\n var len = indexes.length; /// length of buffer\n var i = 0; /// cursor for RGBA buffer\n var t = 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
produce an array of math problems with a top number, a bottom number, an operator, an answer | function makeProblems(digits, operator) {
var p = [];
for (var i=0; i<25; i+=1) {
// get random numbers with the biggest one first
// TODO: figure out "negative numbers" feature here and in controls
var numbers = [];
numbers.push(getRandomInt(getMax(digits)));
numbers.pus... | [
"function evaluate(numbers, op) {\n if(op === '+')\n return numbers.reduce(add);\n else if(op === '-')\n return numbers.reduce (subtract);\n else if(op === '*')\n return numbers.reduce(multiply);\n else if(op === '/')\n return numbers.reduce(divide);\n else if(op === '%')\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display guess history to user | function displayHistory (){
let list = "<ul class='list-group'>"
for (let i = guesses.length - 1; i >= 0; i--){
list += "<li class='list-group-item'>" + "You guessed " + guesses[i] + "</li>"
}
list += '</ul>'
document.getElementById('history').innerHTML = list
} | [
"function saveGuessHistory(guess) {\n\tguesses.push(guess)\n}",
"function updateGuess() {\n ch_push(state.guess)\n }",
"function updateGuessedDisplay() {\n $('#guessed0').html(currentGuess[0]);\n $('#guessed1').html(currentGuess[1]);\n $('#guessed2').html(currentGuess[2]);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal function to obtain a nested property in `obj` along `path`. | function deepGet(obj, path) {
var length = path.length;
for (var i = 0; i < length; i++) {
if (obj == null) return void 0;
obj = obj[path[i]];
}
return length ? obj : void 0;
} | [
"function setGetObjPath(obj, path, value) {\n addLog('setGetObjPath was Triggered');\n if (typeof path == 'string') {\n path = path.split('.');\n obj = obj || scope[path.splice(0, 1)];\n\n if (!obj) {\n return false;\n }\n return se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Occurs after all windows have been closed. | onAllWindowsClosed() {
// Stub
} | [
"function onClosed() {\n\t// dereference the window\n\t// for multiple windows store them in an array\n\tmainWindow = null;\n}",
"function mainWindowCloseCallback() {\n logger.silly(\"Closing main window\");\n\n // Save the sizes of the window\n const size = mainWindow.getSize();\n store.set(\"main-wi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createTable: method responsible for creating the table Arguments: x, y, z position of the table | createTable(x, y, z) {
'use strict';
var table = new Table(x, y, z);
table.createTableLeg(-35, 30, -50);
table.createTableLeg(-35, 30, 50);
table.createTableLeg(35, 30, -50);
table.createTableLeg(35, 30, 50);
table.createTableTop();
this.scene.add(table);
return table;
} | [
"function createTable(table, columnX, columnY) {\n let counter = 0;\n\n for (let valueX of columnX) {\n let row = table.insertRow();\n let cell = row.insertCell();\n let text = document.createTextNode(valueX);\n cell.appendChild(text);\n\n let cellY = row.insertCell();\n let textY = document.cre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : accSanInit AUTHOR : Clarice Salanda DATE : March 15, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : initializes data in table PARAMETERS : RETURN : | function accSanInit(){
var accStat='';
var accSanityStat='';
if(globalInfoType == "JSON"){
var devices = getDevicesNodeJSON();
}else{
var devices =devicesArr;
}
for(var i = 0; i < devices.length; i++){
accStat+="<tr>";
accStat+="<td>"+devices[i].HostName+"</td>";
if(devices[i].Console... | [
"function connSanInit(){\n\tvar connStat='';\n\tvar connSanityStat='';\n\tif(globalInfoType == \"JSON\"){\n var devices = getDevicesNodeJSON();\n }else{\n var devices =devicesArr;\n }\n\tfor(var i = 0; i < devices.length; i++){\n\t\tconnStat+=\"<tr>\";\n\t\tconnStat+=\"<td>\"+devices[i].HostNam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks that the default caption passed in the constructor and in the setter is returned by getDefaultCaption, and acts as a default caption, i.e. is shown as a caption when no items are selected. | function testDefaultCaption() {
select.render(sandboxEl);
var item1 = new goog.ui.MenuItem('item 1');
select.addItem(item1);
select.addItem(new goog.ui.MenuItem('item 2'));
assertEquals(defaultCaption, select.getDefaultCaption());
assertEquals(defaultCaption, select.getCaption());
var newCaption = 'new c... | [
"static setAsDefault(captionAssetId){\n\t\tlet kparams = {};\n\t\tkparams.captionAssetId = captionAssetId;\n\t\treturn new kaltura.RequestBuilder('caption_captionasset', 'setAsDefault', kparams);\n\t}",
"function build_caption(item) {\n\t\t\tif (item !== undefined) {\n\t\t\t\treturn caption(item);\t\n\t\t\t} else... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a row context with index | getRowContext(index) {
return new Expression.ShadowContext(this, this.rows[index]);
} | [
"get rowIndex() {\n return INDEX2ROW(getTop());\n }",
"visitTable_index_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"get row() {\n return INDEX2ROW(getTop()) + 1;\n }",
"visitTable_indexed_by_part(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitIndex_expr(ctx) {\n\t r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reveals the background of the popup, if asked | function revealPopupBackground(systemPopup) {
var settings = systemPopup.data("popup-settings");
var extra = systemPopup.data("popup-extra");
// Checks fade
if (settings.withFade) {
$(".popupOverlay", extra.parent).fadeIn(200);
} else {
$(".popupOverlay", ... | [
"static set popup(value) {}",
"function showPopup () {\n $('#popup').css('z-index', '20000');\n $('#popup .popup-title').text($('#title').val());\n $('#popup .popup-content').text($('#content').val());\n $('.hide-container').show();\n $('#popup').show();\n }",
"function unb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========= Updates the Rover Position in the Grid =========== | function updateRoverPosition(rover) {
board[rover.x][rover.y] = rover;
} | [
"function setRoverPosition(rover, x, y) {\n rover = board[x][y];\n updateBoardGrid(rover);\n updateRoverPosition(rover);\n}",
"function moveForward(marsRover){ // moving depending on the position with x and y\n console.log(\"moveForward was called\");\n if (marsRover.x >= 0 && marsRover.x <= 9 && marsRover.y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Se crea una funcion para que con cualquier archivo que no se encuentrre retorne un error 404 | function fileNotFound(req, h){
const response = req.response
//Preguntamos que si la response es un mensaje de boom y si el codigo es 404
if (!req.path.startsWith('/api') && response.isBoom && response.output.statusCode === 404) {
//Retornamos la vista de la pagina que muestra el error 404 de una fo... | [
"function fileRouter(parsedUrl, res) {\n\tvar code;\n\tvar page;\n\tvar filePath = './' + parsedUrl.pathname;\n\tif (fs.existsSync(filePath)) {\n\t\t// We found the page, read it and set the code\n\t\tcode = 200;\n\t\tpage = fs.readFileSync(filePath);\n\t}\n\telse {\n\t\t// We didn't find the requested page, so rea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wait till dropdown exist and change data (torrent list) | function updateDropDown(){
const ul = $('ul.dropdown-menu')
ul.arrive("div.active",{onceOnly: true},() => {
let ids = $('div.active');
for ( let elements of ids){
data = {
hash : elements.id,
id : $(elements).attr("data"),
status : "s... | [
"function initDropdown(){\n $.ajax({\n url: '/playlists',\n type: 'GET',\n contentType: 'application/json',\n success: function(res) {\n var pDrop = ``;\n for(var i=0; i<res.length; i++){\n pl = res[i]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add Key Down Event On Delete Remove Selected Object from canvas | function OnkeyDown(event){
var activeObject = PhotoCollage.getActiveObject();
if (event.keyCode === 46) {
PhotoCollage.remove(activeObject);
}
} | [
"function ondelete() {\n var index = getToggledIndex();\n if (index >= 0) {\n children[index].ontoggle();\n children.splice(index,1);\n ctx.onmodify();\n recalcHeight(); // this will redraw the screen\n }\n }",
"delete() {\n this.deltaX = 0;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Images Looking for popImage class on outer wrapper | function popImage()
{
var imgCount = 0;
var popImages = {};
popImages.imgSet = {};
popImages.viewer = '';
popImages.functions =
{
init: function(el)
{
popImages.viewer = el.data('popviewer');
popImages.imgSet.img... | [
"function PopupInfoImages() {\n this.mainBlock = document.body;\n this.images = this.mainBlock.querySelectorAll('.js-img-wrap img');\n this.typeImages = ['png', 'jpg', 'gif'];\n this.typeVideos = ['mp4', 'webm'];\n\n // Add hover for all image with attr data-src\n for(let i = 0; i < this.images.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inlined / shortened version of `kindOf` from | function miniKindOf(val) {
if (val === void 0) return 'undefined';
if (val === null) return 'null';
var type = typeof val;
switch (type) {
case 'boolean':
case 'string':
case 'number':
case 'symbol':
case 'function':
{
return type;
}
}
if (Array.isArray(val)) return... | [
"function isTextual(type, value) {\n return t.logicalExpression(\"||\", t.binaryExpression(\"===\", type, t.stringLiteral(\"number\")), t.logicalExpression(\"||\", t.binaryExpression(\"===\", type, t.stringLiteral(\"string\")), t.logicalExpression(\"&&\", t.binaryExpression(\"===\", type, t.stringLiteral(\"object\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
prompt to see if guest wants to continue shopping | function continueShopping(){
inquirer.prompt({
type: "confirm",
name: "confirm",
message: "Would you like to continue shopping?"
}).then(function(answer){
if (answer.confirm === true){
start();
}else if(answer.confirm === false){
console.log("Thank you for shopping");
... | [
"function purchasePrompt() {\n inquirer.prompt([{\n type: \"confirm\",\n name: \"purchase\",\n message: \"Would you like to make a purchase?\",\n default: true\n\n }]).then (function (user) {\n if (user.purchase === true) {\n itemSelect();\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
renders markers that track the highest red flower height so far | function renderHeightMarker() {
var hrfy = canvas.height - yValFromPct( highestRedFlowerPct ); // highest red flower y value currently
var chmp = 100-pctFromYVal(HeightMarker.y); // current height marker percentage
if ( Math.floor( highestRedFlowerPct ) > Math.floor(chmp) ) { // initializes animations if new ... | [
"function markerColor(magnitude) {\n if (magnitude<1) {\n return \"#459E22\"}\n else if (magnitude<2) {\n return \"#7FB20E\"}\n else if (magnitude<3) {\n return \"#BEBE02\"}\n else if (magnitude<4) {\n return \"#B19A0F\"}\n else if (magnitude<5) {\n return \"#B54C0B\"}\n else if (magnitude>... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subject to validation of searchparameters in info as per FN_INFOS.findSensorTypes, return all sensortypes which satisfy search specifications in info. Note that the searchspecs can filter the results by any of the primitive properties of sensor types. The returned value should be an object containing a data property wh... | async findSensorTypes(info) {
const searchSpecs = validate('findSensorTypes', info);
//@TODO
var nextInteger;
var findsensorType={nextInteger:{},data:{}};
var index=0;
var findObj={
id: searchSpecs.id,
index: searchSpecs.index,
count: searchSpecs.count,
quantity: searchSpecs.quantity,
... | [
"function _findSensors(object, sensorType) {\n\t\t\tscope.log('finding sensors');\n\t\t\tvar sensorNames = [];\n\n\t\t\tfor ( var name in scope.sensorRegistry[ sensorType ] ) {\n\t\t\t\tif (!scope.sensorRegistry[ sensorType ].hasOwnProperty(name)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t//this.log('Checking the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints the current word to the user. | function printWord() {
$("#word").text(current_word.displayed_word);
} | [
"function displayCurrentWord(){\n\t/** Change the html to the current word status */\n\tdocument.querySelector(\"#correctorGuess\").innerHTML = currentWordArray.join(\" \");\n}",
"function printHint() {\n $('#hint').text(current_word.hint);\n}",
"showWordProgress() {\n console.log(`The word now looks like... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to clear the fileds | function ClearFields() {
self.model.code = "";
self.model.component = "";
} | [
"function clear_form(){\n $(form_fields.all).val('');\n }",
"function clear() {\n clearCalculation();\n clearEntry();\n resetVariables();\n operation = null;\n }",
"clearData(){\n //reset table data \n this.config.currentData = {};\n this.config.page... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns bounding boxes of the selected regions. | getSelectedRegionsBounds() {
const regions = this.lookupSelectedRegions().map((region) => {
return {
id: region.ID,
x: region.x,
y: region.y,
width: region.boundRect.width,
height: region.boundRect.height,
... | [
"lookupSelectedRegions() {\r\n const collection = Array();\r\n for (const region of this.regions) {\r\n if (region.isSelected) {\r\n collection.push(region);\r\n }\r\n }\r\n return collection;\r\n }",
"function getBoundingBox() {\n var rec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
using the inventory array of objects, we apply a callback to inventory with Array.map. This will apply the getGoodsFromDesigner function as a callback, that callback will go over the key/value pairs and return all the designer's shoes on new lines. | function listInventory(inventory){
return inventory.map(function(designerObject){
return getGoodsFromDesigner(designerObject)
}).join('\n');
} | [
"function renderInventory(inventory){\n return inventory.map(function(designerObject){\n return renderGoodsStringForDesigner(designerObject)\n }).join('\\n');\n}",
"function getGoodsFromDesigner(designerObject){\n return getShoesFromDesigner(designerObject.name, designerObject.shoes).join('\\n');\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds data to new node at end of list If list is empty, create new node and as head | append(data) {
if (this.head == null) {
this.head = new Node(data);
return;
}
let currentNode = this.head;
while (currentNode.next != null) {
currentNode = currentNode.next;
}
currentNode.next = new Node(data);
} | [
"addAfter(key, data) {\n if (this.head == null) return;\n\n let currentNode = this.head;\n while (currentNode != null && currentNode.data != key) {\n currentNode = currentNode.next;\n }\n\n if (currentNode) {\n let tempNode = currentNode.next;\n currentNode.next = new Node(data);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get child that is in visible in this tree | getChildInTree() {
if (!this._children || this._children.length === 0)
return null;
for (var ch of this._children) {
if (ch.isStartingPerson)
return ch;
if (ch.getChildInTree())
return ch;
}
return null;
} | [
"function areChildrenVisible(item) {\n // we do not want to populate item with \n if (typeof item.ChildrenVisible != \"undefined\") {\n return item.ChildrenVisible;\n } else {\n return true;\n }\n }",
"_getAriaActiveDescendant() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loops through all the items accessible through the iterator and tells them to accept a visitor, if they know how to do so. If they don't, they are IGNORED! no return value. | function Iterator_iterateVisitor(objVisitor) {
var strRoutine = "Iterator_iterateVisitor";
var strAction = "";
try {
//check that what we were passed is really a visitor?
strAction = "loop through the current items provided by this iterator";
for (this.first(); !this.isDone(); this.next()) {
strAction = "c... | [
"each(visitor, context) {\n return this.items.forEach(visitor, context);\n }",
"accept(visitor, params) {\n throw new Error('Not Supported');\n }",
"visitCollection_item(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"iterate(enter, leave) {\n for (let depth = 0; ; ) {\n let ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
expand one level of tree | function expand1Level(d) {
var q = [d]; // non-recursive
var cn;
var done = null;
while (q.length > 0) {
cn = q.shift();
if (done !== null && done < cn.depth) { return; }
if (cn._children) {
done = cn.depth;
cn.children = cn._children;
... | [
"function expandAll(d) {\n root.children.forEach(expand);\n update(root);\n }",
"function propagateExpanded(data, state) {\n data.data.expanded = state;\n data.children.forEach(child => propagateExpanded(child, state));\n }",
"function MoveUpOneLevel()\r\n{\r\n var treeFrame = GetTre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cancels the modification of the formula | cancelModification() {
this.input.value = this.getFormula();
} | [
"abort() { \n this.reset = true;\n }",
"cancel() {\n\t\tthis.reconciling = false;\n\t}",
"function resetEquation() {\n let initial_html = `<span class=\"nonterminal\">${initialNonterminal_}</span>`;\n $('#cfg-equation').html(initial_html);\n reapplyNonterminalClickEvent();\n testMatchingEquation... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Colorplaceholder and select elements | function recolorSelect( $this ) {
var val = $this.val();
$('#result').append('<div>value=' + val + '</div>');
if ( val != '' ) {
$this.removeClass('color-placeholder');
} else {
$this.addClass('color-placeholder');
}
} | [
"function selectPlaceholder(selectID){\n var selected = $(selectID + ' option:selected');\n var val = selected.val();\n $(selectID + ' option' ).css('color', '#000');\n selected.css('color', '#d5d5d5');\n if (val == \"\") {\n $(selectID).css('color', '#d5d5d5');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accumulates without regard to direction, does not look for phased registration names. Same as `accumulateDirectDispatchesSingle` but without requiring that the `dispatchMarker` be the same as the dispatched ID. | function accumulateDispatches(id, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
event._dispatchListeners =
accumulateInto(e... | [
"function accumulator(xf) {\n function xformed(source, additional) {\n // Return a new accumulatable object who's accumulate method transforms the `next`\n // accumulating function.\n return accumulatable(function accumulateXform(next, initial) {\n // `next` is the accumulating function we are transf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates "Select all" control in a data table js | function updateDataTableSelectAllCtrl(table){
var $table = table.table().node();
var $chkbox_all = $('tbody input[type="checkbox"]', $table);
var $chkbox_checked = $('tbody input[type="checkbox"]:checked', $table);
var chkbox_select_all = $('thead input[name="select_all"]', $table).ge... | [
"function selectAll(astrTable, aobjSelectAll) {\n var lstrSelected;\n var lobjSelected;\n var lobjStatus;\n var lintCount;\n var lobjTable = document.getElementById(astrTable);\n var lintNumRows = lobjTable.rows.length;\n for (lintCount=0;lintCount < lintNumRows;li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======== onChangePolicyInitFxn ======== onChange callback function for the policyInitFunction config | function onChangePolicyInitFxn(inst, ui)
{
let subState = inst.policyInitFunction !== 'Custom';
ui.policyInitCustomFunction.hidden = subState;
} | [
"function onChangeEnablePolicy(inst, ui)\n{\n let subState = !inst.enablePolicy;\n\n ui.enablePinParking.hidden = subState;\n ui.policyInitFunction.hidden = subState;\n ui.policyFunction.hidden = subState;\n\n onChangePolicyInitFxn(inst,ui);\n onChangePolicyFxn (inst,ui);\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if the number is within [avg, avg+5] | function fromAvg(temp) {
return (temp >= result.avg && temp <= (result.avg + 5));
} | [
"function toAvg(temp) {\n return (temp <= result.avg && temp >= (result.avg - 5));\n}",
"function under50(num) {\n return num < 50;\n}",
"function check(num1, num2) {\n var sum = 0;\n sum = sum + num1 + num2;\n if (sum <= 25) {\n console.log(\"true\")\n } else {\n console.log(\"fal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A cache of compiled shaders, keyed by shader source strings. Compilation of long shaders can be time consuming. By using this class, the application can ensure that each shader is only compiled once. | function ShaderCache() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
gl = _ref.gl,
_ref$_cachePrograms = _ref._cachePrograms,
_cachePrograms = _ref$_cachePrograms === void 0 ? false : _ref$_cachePrograms;
(0, _classCallCheck2.default)(this, ShaderC... | [
"function recompileShader() {\n shaderSourceChanged = true;\n}",
"function _compileShaders()\n\t{\n\t\tvar vertexShader = _loadShaderFromDOM( _vertexShaderId );\t\t// Get shaders and compile them.\n\t\tvar fragmentShader = _loadShaderFromDOM( _fragmentShaderId );\n\n\t\t_renderingProgram = gl.createProgram();\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Injects .html plot in a iframe tag | newPlotWidgetIframe(name, url) {
var that = this;
G.addWidget(1).then(w => {
w.setName(name);
w.$el.append("<iframe src='" + url + "' width='100%' height='100%s'/>");
that.widgets.push(w);
w.showHistoryIcon(false);
w.showHelpIcon(false);
... | [
"plotExternalHTML(url, plot_name) {\n fetch(url)\n .then((response) => {\n if (response.ok) {\n return response.json()\n } else {\n throw new Error('Something went wrong');\n }\n })\n .then((re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method replaces the url domain with localhost domain when we are in development mode (when localhost is the current location). | function urlReplace(url) {
if (window.location.host.indexOf('localhost') !== -1) {
var urlNew = new URL(url);
urlNew.host = 'localhost';
urlNew.protocol = window.location.protocol;
return urlNew.toString();
}
return url;
} | [
"function saveDomain() {\n getCurrentUrl().then(function(url){\n var domain,\n protocol,\n full;\n\n domain = TOCAT_TOOLS.getDomainFromUrl(url);\n protocol = TOCAT_TOOLS.getProtocolFromUrl(url);\n full = protocol + '://' + domain;\n\n TOCAT_TOOLS.saveDomain(full);\n });\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We extend nylas observables with our own methods. This happens on require of nylasobservables | extendRxObservables() {
return require('nylas-observables');
} | [
"function wrap(observable) { return new Wrapper(observable); }",
"createEventObservable(eventName, layer) {\n return new rxjs__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"](observer => {\n this._layers.get(layer).then(d => {\n d.addListener(eventName, e => this._zone.run(() => observer.ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert MusicXML to timing, lyric, and mouth shape data | function convertXML2TimingList(xml) {
var timingList = [];
var lyricList = [];
var mouthList = [];
var curTimeSec = 0; // physical time in sec
var tempo = 110; // default tempo
var secPerDivision;
var durationDiv; // duration of a note in division unit
var durationSec; // duration of a note in sec u... | [
"function convertSongScript2XML(scriptArray) {\n var xmlSource = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\n + '<!DOCTYPE score-partwise PUBLIC \"-//Recordare//DTD MusicXML 2.0 Partwise//EN\"'\n + ' \"http://www.musicxml.org/dtds/partwise.dtd\">'\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read a byte from the keyboard memory bank. This is an odd system where bits in the address map to the various bytes, and you can read the OR'ed addresses to read more than one byte at a time. This isn't used by the ROM, I don't think. For the last byte we fake the Shift key if necessary. | readKeyboard(addr, clock) {
addr -= BEGIN_ADDR;
let b = 0;
// Dequeue if necessary.
if (clock > this.keyProcessMinClock) {
const keyWasPressed = this.processKeyQueue();
if (keyWasPressed) {
this.keyProcessMinClock = clock + KEY_DELAY_CLOCK_CYCLES;
... | [
"async readByte() {\n while (this.r === this.w) {\n if (this.eof)\n return Deno.EOF;\n await this._fill(); // buffer is empty.\n }\n const c = this.buf[this.r];\n this.r++;\n // this.lastByte = c;\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::S3::Bucket.VersioningConfiguration` resource | function cfnBucketVersioningConfigurationPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnBucket_VersioningConfigurationPropertyValidator(properties).assertSuccess();
return {
Status: cdk.stringToCloudFormation(properties.status),
};
} | [
"function CfnBucket_VersioningConfigurationPropertyValidator(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('Expected an ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A single cell on the board. This has no state just two props: flipCellsAroundMe: a function rec'd from the board which flips this cell and the cells around of it isLit: boolean, is this cell lit? coords: the y and x coordinates of the cell used in "flipCellsAroundMe" handleClick: This handles clicks by calling flipCell... | function Cell({ flipCellsAroundMe, isLit, coords}) {
const handleClick = () => {
flipCellsAroundMe(coords);
};
const classes = `Cell ${isLit ? "Cell-lit" : ""}`;
return <div className={classes} onClick={handleClick}></div>;
} | [
"function flipCell() {\n // Run flip from style.css for the clicked cell (this)\n this.classList.toggle('flip');\n\n flippedCell = this;\n cellColor = flippedCell.dataset.color;\n outcome(cellColor);\n}",
"__handleClick(evt) {\n // get x from ID of clicked cell\n const x = +evt.target.id[0]\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates an array list of PAGE.appGroups Items along with it's file and group. Handy for updating the documentation when changes were made | function associateFileDesc() {
let result = {
group: [],
file: [],
desc: []
};
PAGE.appGroups.forEach(group => {
group.items.forEach(item => {
result.group.push(group.group);
result.file.push(item.file);
result.desc.push(ite... | [
"function createItemGroup(pkg, callback){\n var item = {\n title : pkg.title,\n description : pkg.notes,\n created : pkg.metadata_created,\n url : config.ckan.server+\"/dataset/\"+pkg.name,\n ckan_id : pkg.id,\n updated : pkg.revision_time... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create event listener for add blog post button | function addBlogPost() {
clearDialogInputs();
showDialog(blogPosts, "add");
} | [
"function createNewPostPage(e){\n\t\te.preventDefault();\n\t\t// If the user clicked the button with id newPost, then display the posting page on the right part of the screen.\n\t\tif (e.target.id == 'newPost'){\n\t\t\tmainContent.innerHTML = `\n\t\t\t\t<form>\n\t\t\t\t\t<p class=\"newPostPageText\">Title: </p> <te... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
depending on which tab is clicked, render Assignments, AllStudents, or Student component | handleTabs() {
if (this.props.tabView === 'Students') {
return (
<AllStudentsTab />
);
} else if (this.props.tabView === 'Student') {
return <Student />;
} else if (this.props.tabView === 'Assignment') {
return <Assignment />;
}
return (
<AssignmentsTab />
)... | [
"renderLessonTabs() {\n let lessons = this.state.lessons;\n return lessons.map(\n (lesson) => {\n return <LessonTabItem key={lesson.id}\n lesson={lesson}\n courseId={this.props.courseId}\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implement .inRange() method [CodeCademy solution]: node test/inrange.js passed | inRange (number, start, end) {
if (end === undefined) {
end = start
start = 0
}
if (start > end) {
let temp = end
end = start
start = temp
}
let isInRange = (number >= start && number < end)
return isInRange
} | [
"inRangeIdea (num, start, end) {\n let startRange\n let endRange\n if (!end) {\n startRange = 0\n endRange = start\n } else if (start > end) {\n startRange = end\n endRange = start\n } else {\n startRange = start\n endRange = end\n }\n return this.checkRangeIdea(nu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to get data values calculated with the analytic dhis process | async getDataValueProgramIndicators(indicators,periods,ous){
let url="analytics?dimension=dx:"+indicators+"&dimension=pe:"+periods+"&dimension=ou:"+ous+"&displayProperty=NAME"
return await this.getResourceSelected(url)
} | [
"static async getTotalCovidData() {\n const res = await axios.get(`${url}/total`);\n const data = res?.data[0]?.globalData;\n return data;\n }",
"function getCampaignPerformance() {\n \n var entityIdFieldName = 'CampaignId';\n var reportName = 'CAMPAIGN_PERFORMANCE_REPORT';\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert align="center" to align="middle" | function convert_align_middle_to_center(code)
{
r = /(\salign="middle")/gi;
r1 = /(\salign=middle)/gi;
code = code.replace(r," align=\"center\"");
code = code.replace(r1," align=center");
return code;
} | [
"align(text, length, alignment, filler) {\n if (!filler) filler = SPACE;\n if (!alignment)\n ArgumentNullException(\"alignment\");\n switch (alignment) {\n case \"c\":\n case \"center\":\n return S.center(text, length, filler);\n case \"l\":\n case \"left\":\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update opponent athlete statistics based on the game actions list. | UPDATE_OPP_ATHLETE_STATISTICS(state) {
let result = [];
for (let athlete in state.oppRoster) {
result.push(
{
name: state.oppRoster[athlete].name,
number: state.oppRoster[athlete].number,
points:0,
... | [
"UPDATE_UPRM_STATISTICS(state) {\n let result = {\n freethrow: 0,\n freethrowAttempt: 0,\n twopoints: 0,\n twopointsAttempt: 0,\n threepoints: 0,\n threepointsAttempt: 0,\n assists: 0,\n blocks: 0,\n rebounds: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
plays the note corresponding to the keycode of e | function playNote(keycode) {
//dont trigger if key is already pressed
if (!keysPressed.includes(keycode)) {
//push keycode to pressed
keysPressed.push(keycode);
//get respective key from keycode
var key = document.querySelector(".key[data-keycode=\"" + keycode + "\"]");
//add playing transform t... | [
"function play(){\n\treadAndPlayNote(readInNotes(), 0, currentInstrument);\n}",
"playNote(note, octave, duration) {\n\t\tthis.synth.triggerAttackRelease(note+octave, duration);\n\t}",
"function hitKey(e){\n\tswitch(e.key){\n\t\tcase 's':\n\t\t\tstartButton.click();\n\t\t\tbreak;\n\t\tcase 'r':\n\t\t\tresetButto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw given content item on canvas if in (current) range | function drawContentItem(range, contentItem) {
// Check if content item visible in current range
if (contentItem.getBeginDate() >= range.begin || contentItem.getEndDate() <= range.end) {
contentItem.draw();
}
} | [
"function drawContentItems() {\r\n // Get current range\r\n var range = Canvas.Timescale.getRange();\r\n drawContentItemsLoop(_contentItems, range, true);\r\n drawContentItemsLoop(_contentItems, range, false);\r\n }",
"function drawGridContent(){\n for( var i =0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for a Percy token and returns it. | getToken() {
let token = this.token || this.env.token;
if (!token) throw new Error('Missing Percy token');
return token;
} | [
"async function checkToken() {\n const tokenNameResponse = await rpcClient.invokeFunction(\n inputs.tokenScriptHash,\n \"symbol\"\n );\n\n if (tokenNameResponse.state !== \"HALT\") {\n throw new Error(\n \"Token not found! Please check the provided tokenScriptHash is correct.\"\n );\n }\n\n va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update build.xcconfig with Branch's Header Paths | function updateHeaderPaths(config) {
config = config.split("\n")
.map(function (line) {
if (line.indexOf("HEADER_SEARCH_PATHS") > -1 && line.indexOf("Branch-SDK") === -1) {
line += ' "${PODS_ROOT}/Branch/Branch-SDK/Branch-SDK" "${PODS_ROOT}/Branch/Branch-SDK/Branch-SDK/Networking" "${PODS_RO... | [
"function updatePlatformConfig(platform) {\n var configData = parseConfigXml(platform),\n platformPath = path.join(rootdir, 'platforms', platform);\n\n _.each(configData, function (configItems, targetFileName) {\n var targetFilePath;\n if (platform === 'ios') {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserpackage_obj_spec. | visitPackage_obj_spec(ctx) {
return this.visitChildren(ctx);
} | [
"visitPackage_obj_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitCreate_package_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitCreate_package(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitPackage_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitDrop_pack... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to generate a unique file name from the user user id and time of upload | function generateUniqueFileName(user, filename) {
var fileExtension = getFileExtension(filename);
var currentTime = new Date().toISOString().replace(/\./g, '-').replace(/\:/g, '-');
var tempFile = user + currentTime + fileExtension;
console.log(tempFile);
return tempFile;
... | [
"function generateFileName(filetype) {\n return 'msfu_' + (+new Date()) + Math.floor((Math.random() * 100) + 1) + ':' + filetype;\n\n }",
"generateRandomFilename() {\r\n // create pseudo random bytes\r\n const bytes = crypto.pseudoRandomBytes(32);\r\n\r\n // create the md5 hash of the random bytes\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
persistConfig writes config to the environment. config changes must always be persisted to the environment because automation api introduces new program lifetime semantics where program lifetime != module lifetime. | function persistConfig(config, secretKeys) {
const store = state_1.getStore();
const serializedConfig = JSON.stringify(config);
const serializedSecretKeys = Array.isArray(secretKeys) ? JSON.stringify(secretKeys) : "[]";
store.config[exports.configEnvKey] = serializedConfig;
store.config[exports.conf... | [
"function save() {\n\twriteFile(config, CONFIG_NAME);\n\tglobal.store.dispatch({\n\t\ttype: StateActions.UPDATE_CONFIGURATION,\n\t\tpayload: {\n\t\t\t...config\n\t\t}\n\t})\n}",
"function saveConfiguration () {\n\tJSON.stringify(config).to(SITE_DIR+'config.json');\n}",
"function writeConfig () {\n self._re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to query product skus from the product style service | function getProductSkus(productIdVar){
var res = request('GET', 'http://oldnavy.gap.com/resources/productStyle/v1/' + productIdVar + '?redirect=true&isActive=true');
var availableSizeCodes = {};
var bodyjson = JSON.parse(res.getBody());
var variants = flattenVariantResponse(bodyjson);
// Loop on product resp... | [
"function show_supplier_selector(product_id)\n{\n\n\n}",
"function getAllFashionProductsByProvider(req,res){\n var query = {provider:req.query.provider};\n baseRequest.getProductByCategory(req,res,query,Fashion)\n}",
"function pricingAPIs(searchString, apiDataWalmart, apiDataAmazon) {\n\t\tamazon.getItems... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function adds a link for a form element to the left menu for adding to the contract | function add_link_line(name, schema){
$("#new_contract_menu").append("<li><a href='#'></a></li>");
$("#new_contract_menu > li > a:last").text(schema.title).click(function() {
app.forms.start_contract(name);
});
} | [
"function addFormElem(moduleChosen){\n\tclearForm();\n\tvar moduleCode = moduleChosen.split(' ')[0];\n\taddLecture(moduleCode);\n\taddRest(moduleCode);\n\taddButton();\n\tselectize();\n\tprepareInfoDisplay();\n\taddEventForFormElem(moduleCode);\n}",
"function openUpdateEmailMenu(event) {\n // Prevent any defau... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns 5% of that income if it is less than $10000, 10% of that income if it is between $10000$20000, and 15% if it is greater than $20000 | function calculateTaxes(income) {
if (income < 10000) {
return (income * .05);
} else if (income >10000 <20000) {
return (income * .10);
} else if (income > 20000) {
return (income * 15);
}
} | [
"function calculatePercentage(percentage) {\n return (5000 / 100) * percentage;\n}",
"function getPercentage(annualAmount,citizenType)\n {\n var PercentageValue;\n \n \n if(citizenType == \"general\")\n {\n if(annualAmount<=500000)\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
transform solr date to UTC | function fromSolrDateToUTC(date){
date = date.replace("Z", "");
var year = date.split("T")[0].split("-")[0];
var month = parseInt(date.split("T")[0].split("-")[1]-1);
var day = date.split("T")[0].split("-")[2];
var hour = date.split("T")[1].split(":")[0];
var minutes = date.split("T")[1].split("... | [
"function getOnsetAsUTC(obs, localdate) {\n //return new Date(localdate.getTime() - obs.offsetFrom);\n return localdate - obs.offsetFrom;\n }",
"function setUTCValuesInDate(date) {\n return new Date(\n date.getUTCFullYear(),\n date.getUTCMonth(),\n date.getUTCDate(),\n date... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RCVT[] Read Control Value Table entry 0x45 | function RCVT(state) {
var stack = state.stack;
var cvte = stack.pop();
if (exports.DEBUG) { console.log(state.step, 'RCVT', cvte); }
stack.push(state.cvt[cvte] * 0x40);
} | [
"testStoredValueForIndex( accTypeEnumIndex )\n {\n if ( accTypeEnumIndex < 0 || accTypeEnumIndex > CMD4_ACC_TYPE_ENUM.EOL )\n return undefined;\n\n return this.storedValuesPerCharacteristic[ accTypeEnumIndex ];\n }",
"function parseCtrlStr(ctrlStr) {\n ctrlStr = ctrlStr.toLowerCase();\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save the snake queue in his old position, to delete of board later | saveOldQueuePosition(){
const { snakeBodyParts, length} = this;
const lastBodyPart = snakeBodyParts[ length -1 ];
this.lastBodyPartOldPosition = {
...lastBodyPart
}
} | [
"moveSnake() {\n\t\tthis.moveQueue.unshift(this.direction);\n\n\t\tfor (let i = 0; i < this.snake.length; i++) {\n\t\t\tconst {r, c} = this.snake[i];\n\t\t\tconst {newR, newC} = this.nextCoordinates(r, c, this.moveQueue[i]);\n\n\t\t\tthis.checkBounds(newR, newC);\n\n\t\t\tif (this.board[newC][newR] === 2) {\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the colors on the stations to the colors stored on the server typially used on startup to retrieve the last stored state of the system | function SyncColorsFromServer(){
for(var i=0;i<STATION_COUNT;i++){
SetColors(i,0,colors[i]);
}
} | [
"function SetColors(stationId,startIndex,colorArray){\n //update server's copy of the LED custer state\n colors[stationId][ledIndex].r = ledColor.r;\n colors[stationId][ledIndex].g = ledColor.g;\n colors[stationId][ledIndex].b = ledColor.b;\n\n var dataBuffer = new Uint8Array([ledIndex,numToFill,ledC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the Sauce Labs endpoint | function getSauceEndpoint(region) {
const shortRegion = REGION_MAPPING[region] ? region : 'us';
return `https://app.${REGION_MAPPING[shortRegion]}saucelabs.com/tests/`;
} | [
"apiUrl() {\n const url = this.globalConfigService.getData().apiUrl;\n return url || Remote_1.RemoteConfig.uri;\n }",
"baseURL () {\n return config.api.baseUrl;\n }",
"getUrl() {\n return process.env.ENVIRONMENT === \"DEV\" ? \"http://localhost:3001\" : \"prod\";\n }",
"function getEn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Activates and deactivates listeners depending on if the component is `enabled` | _switch() {
let enabled = this.get('enabled');
if (enabled) {
this.activateListeners();
} else {
this.deactivateListeners();
}
} | [
"_toggleRecognizer(name, enabled) {\n const {\n manager\n } = this;\n\n if (!manager) {\n return;\n }\n\n const recognizer = manager.get(name); // @ts-ignore\n\n if (recognizer && recognizer.options.enable !== enabled) {\n recognizer.set({\n enable: enabled\n });\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines wheter tileArr1 and tileArr2 have identical endpoints computes the intersection of tileArr1 and tileArr2 | hasIdenticalEndPoints(tileArr1,tileArr2){
return (tileArr1.filter(endPoint=>{
return tileArr2.indexOf(endPoint)!=-1;
}).length>0);
} | [
"tilesAreEqual(tile1, tile2) {\n return tile1 && tile2 && tile1.x == tile2.x && tile1.y == tile2.y;\n }",
"function cullIntersections() {\n function toLines(pts) {\n let lns = [];\n for (let i=0, il=pts.length; i<il; i += 2) {\n lns.push({a: pts[i], b: pts[i+1], l: pts[i].dis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sort rank array in descending order and keep rank array at length of 10. | function ranking() {
rank.sort(function(a, b) {
return b[1] - a[1];
});
rank.splice(10, rank.length - 10);
} | [
"function sortMoviesByRank ( movies ) {\n// Code from previous sortBestRatingsFirst() function\n for ( let j = 0; j < movies.length - 1; j ++ ) {\n \n let max_obj = movies[ j ];\n let max_location = j;\n \n for ( let i = j; i < movies.length; i ++ ) {\n if ( movies[ ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 458 Create a function which adds zeros to the start of a binary string, so that its length is a mutiple of 8. | function completeBinary(str) {
let a = str;
while (a.length % 8 !== 0) {
a = "0" + a;
}
return a;
} | [
"function bytePad(binarystr) {\n var padChar = \"0\";\n var pad = new Array(1 + 8).join(padChar);\n return (pad + binarystr).slice(-pad.length);\n}",
"function leftPad(pinCode, targetLength) {\n var count = pinCode.length;\n var output = pinCode;\n\n while (count < targetLength) {\n output =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toZip compress package to zip format argument : package location | function toZip( location ){
var myWorker;
if( os.isWindows ){
/* Windows platform */
var zipItLoaction = studio.extension.getFolder().path + "resources/zipit";
zipItLoaction = zipItLoaction.replace( /\//g, "\\" );
location = location.replace( /\//g, "\\" );
myWorker = new SystemWorker( "cmd /c ... | [
"function archive() {\n var time = dateFormat(new Date(), \"yyyy-mm-dd_HH-MM\");\n var pkg = JSON.parse(fs.readFileSync(\"./package.json\"));\n var title = pkg.name + \"_\" + time + \".zip\";\n\n return gulp\n .src(PATHS.package)\n .pipe($.zip(title))\n .pipe(gulp.dest(\"packaged\"));\n}",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rotate a Vector3 around the zaxis | function rotate_vector3_z(vector, angle_in_degrees) {
var r = deg2rad(angle_in_degrees);
var s = Math.sin(r);
var c = Math.cos(r);
var multMatrix = new Matrix4();
multMatrix.elements = [
c, -s, 0, 0,
s, c, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1];
return multMatrix.multiplyV... | [
"function rotateZ(point, radians) {\r\n\tvar x = point.x;\r\n\tpoint.x = (x * Math.cos(radians)) + (point.y * Math.sin(radians) * -1.0);\r\n\tpoint.y = (x * Math.sin(radians)) + (point.y * Math.cos(radians));\r\n}",
"function rotate_vector3_x(vector, angle_in_degrees) {\n var r = deg2rad(angle_in_degrees);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a random sample of mentions per party, one per topic. Mentions are returned in chronological order. | function sampleMentions() {
return data.parties.map(function(party, i) {
return data.topics
.map(function(d) { return d.parties[i].mentions; })
.filter(function(d) { return d.length; })
.map(function(d) { return d[Math.floor(Math.random() * d.length)]; })
.sort(orderMentions);
})... | [
"function randomTopic()\n{ \n return Math.floor(Math.random()*ribbon_data.length);\n}",
"function getRandom() {\n\tvar l = tweets.length; // grab length of tweet array\n\tvar ran = Math.floor(Math.random()*l); // grab random user\n\n\treturn tweets[ran];\n}",
"function randomPhrase (phrases){\r\n\treturn p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API void StyleColorsDark(ImGuiStyle dst = NULL); | function StyleColorsDark(dst = null) {
if (dst === null) {
bind.StyleColorsDark(null);
}
else if (dst.internal instanceof bind.ImGuiStyle) {
bind.StyleColorsDark(dst.internal);
}
else {
const native = new bind.ImGuiStyle();
... | [
"function StyleColorsLight(dst = null) {\r\n if (dst === null) {\r\n bind.StyleColorsLight(null);\r\n }\r\n else if (dst.internal instanceof bind.ImGuiStyle) {\r\n bind.StyleColorsLight(dst.internal);\r\n }\r\n else {\r\n const native = new bind.Im... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getGoogleSessionManager Shortcut to the google session manager | function getGoogleSessionManager() {
if (this.mObject === undefined) {
this.mObject =
Components.classes["@mozilla.org/calendar/providers/gdata/session-manager;1"]
.createInstance(Components.interfaces.calIGoogleSessionManager);
}
return this.mObject;
} | [
"function getClient() {\n return new googleapis.auth.OAuth2(\n config.clientId,\n config.clientSecret,\n config.redirectUrl\n );\n }",
"function googleOAuthDomain_(name,scope) {\n var oAuthConfig = UrlFetchApp.addOAuthService(name);\n oAuthConfig.setRequestTokenUrl(\"https://www.google.com... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
se termina la funcion newGame y abreanimacionGmOver, que anima el html+css y muestra el puntaje obtenido | function animacionGmOver() {
console.log("Perdiste AMEEEEO!!");
} | [
"function newGame () {\n currentGame = new Game();\n randomColors();\n changeScore();\n $('#level').html(currentGame.level);\n $('.colors-box').css('border', 'none');\n $('.color-1').html('');\n $('.color-2').html('');\n borderReset($('.color-1'));\n borderReset($('.color-2'));\n timer... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a negative integer finishes parsing add it to a stack | exitNegativeInteger(ctx) {
const number = -1 * parseInt(ctx.INT(), 10);
this._stack.push(number);
if (this.DEBUG) {
// eslint-disable-next-line no-console
console.log("Parsed integer", number);
}
} | [
"exitInteger(ctx) {\n const number = parseInt(ctx.INT(), 10);\n this._stack.push(number);\n if (this.DEBUG) {\n // eslint-disable-next-line no-console\n console.log(\"Parsed integer\", number);\n }\n }",
"function parse(stack) {\n var numStack = []; // Number ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the current user from the competition | function removeCurrentUserFromCompetition() {
// Make sure the user is logged in and is on this competition
if (identityService.isAuthenticated() && vm.currentUserIsOnCompetition) {
removingCurrentUser = true;
// Forfeit if they have an active challenge
if (vm.hasActiveChallenge) {
... | [
"function confirmRemoveCurrentUserFromCompetition() {\n swal({\n title: 'Leave Competition?',\n text: 'You will lose your spot and forfeit any active challenges.',\n type: 'error',\n showCancelButton: true,\n confirmButtonText: 'Yes, leave',\n confirmButtonClass: 'btn-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Our Popup React component. For props we expect to receive: isOpen, onClose, message, onConfirm. which we elaborate in the propTypes immediately after. | function Popup(props) {
return (
<Modal show={props.isOpen} onHide={props.onClose}>
<Modal.Header closeButton>
<Modal.Title>{props.title}</Modal.Title>
</Modal.Header>
<Modal.Body> {props.message}
</Modal.Body>
{(props.footer) ? <Mo... | [
"renderPopup() {\n return (\n <div\n className=\"usaf-tooltip__popup\"\n ref={(el) => {\n this._tooltipPopupRef = el;\n }}\n onMouseEnter={this.onPopupMouseEnter}\n onMouseLeave={this.onPopupMouseLeave}\n style={this.getPopperStyle(this.state.data)}\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test: createQueryFromJson(jsonQuery) Creating query for: SHOW | function testCreateQueryFromJsonShow() {
// Call the function to test
var generatedOutput = createQueryFromJson(jsonQueryShow);
var expectedOutput =
'Show Sum of Units for Item from OrderDate 2019-01-06 to 2019-07-12';
// Checking if generated output is same as expected output
assertEquals(expectedOut... | [
"function testCreateQueryFromJsonTopK() {\n // Call the function to test\n var generatedOutput = createQueryFromJson(jsonQueryTopK);\n var expectedOutput = \n 'Find the top-7 Rep with maximum Total where Units is Greater than 50';\n \n // Checking if generated output is same as expected output\n assertEqua... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set texture input/output size Dimensions are converted to integers | hasTextureSize(width, height) {
return {
output: [ width|0, height|0 ]
};
} | [
"reallocate(newSize){\n const gl = this.gl;\n\n if(!!this.tex){\n gl.deleteTexture(this.tex);\n console.log(`Cleared previous texture for atlas (${this.maxSize})`);\n }\n\n this.maxSize = newSize || this.maxSize;\n \n this.tex = gl.createTexture();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function load font and write text on canvas | function loadFontAndWrite(font,text,x,y) {
document.fonts.load(font).then(function () {
ctx.font = font
ctx.fillText(text, x, y)
});
} | [
"function _loadFont(fontname){\n var canvas = document.createElement(\"canvas\");\n //Setting the height and width is not really required\n canvas.width = 16;\n canvas.height = 16;\n var ctx = canvas.getContext(\"2d\");\n\n //There is no need to attach the canvas anywhere,\n //calling fillText is enough to m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This Creates a new Bar chart with the supplied data | function newBarChart(ctx,data){
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: (data["Label"]?data["Label"]:["Red", "Blue", "Yellow", "Green", "Purple", "Orange"]),
datasets: [{
label: (data["Title"]?data["Title"]:'# of Votes'),
data: (data["Data"]?data["Data"]:[12, 19, 3, 5, 2, 3]),
... | [
"function getBarDataset(label, data){\n return [{\n label: label,\n fillColor: \"rgba(151,187,205,0.2)\",\n strokeColor: \"rgba(151,187,205,1)\",\n highlightFill: \"rgba(151,187,205,0.1)\",\n highlightStroke: \"rgba(151,187,205,1)\",\n data: data\n }];\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
run a Haskell IO action synchronously, ignoring the result or any exception in the Haskell code a: the IO action cont: continue async if blocked returns: true if the action ran to completion, false otherwise throws: any uncaught Haskell or JS exception except WouldBlock | function h$runSync(a, cont) {
var t = new h$Thread();
;
h$runSyncAction(t, a, cont);
if(t.resultIsException) {
if(t.result instanceof h$WouldBlock) {
return false;
} else {
throw t.result;
}
}
return t.status === (16);
} | [
"function promiseWhile(condition, action) {\n\treturn new Promise((resolve, reject) => {\n\t\tvar loop = function() {\n\t\t\tif(!condition()) resolve();\t\n\t\t\telse Promise.resolve(action()).then(loop, reject);\n\t\t};\n\t\tprocess.nextTick(loop);\n\t});\t\n}",
"async function cobaAsync(){\n try{\n con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given a page path, render the page | function render_response_page( res, path ){
var path_parts = path.split('/');
if( path_parts[0] == '' ){
path_parts.shift();
}
if( path_parts.length && path_parts[ path_parts.length - 1 ] == '' ){
path_parts.pop();
}
var page_spec = {
path_parts : path_parts,
actual_path : config.content,
title : config... | [
"function route(){\n switch(req.url){\n case '/cats': page = 'cats'; break;\n case '/cars': page = 'cars'; break;\n case '/cars/new': page = 'new'; break;\n default: page = 'error';\n }\n fs.readFile(`views/${page}.html`, 'utf8', render);\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function returns an ObjectId embedded with a given datetime Accepts both Date object and string input | function objectIdWithTimestamp(timestamp) {
// Convert string date to Date object (otherwise assume timestamp is a date)
// if (typeof timestamp == "string") {
// timestamp = new Date(timestamp);
// }
logger.log({ timestamp });
// Convert date object to hex seconds since Unix epoch
var hexSeconds = Ma... | [
"function createDateTimeStringFromID(id) {\n date_ =\n id.substring(0, 4) + \"/\" + id.substring(4, 6) + \"/\" + id.substring(6, 8);\n time_ =\n id.substring(8, 10) +\n \":\" +\n id.substring(10, 12) +\n \":\" +\n id.substring(12, 14);\n console.log(\"date = \" + date_ + \", time =\" + time_);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw most vehicles reservations | function drawVehicleReservations() {
var data = google.visualization.arrayToDataTable([
['Ditet', 'Nr i Makinave', {role: 'style'}],
['E Hene', 1000, 'fill-color: #4285F4'],
['E Marte', 2000, 'fill-color: #DB4437'],
['E Merkure', 3000, 'fill-color: #F4B400'],
... | [
"function drawVehicles() {\n for (i=0;i<vehicles.length;i++) {\n //Left side, right side+image width, top side, bottom side\n if (vehicles[i][0].pos[0] >= (window.innerWidth/2)-(10*tileSize)/2 && vehicles[i][0].pos[0] <= (window.innerWidth/2)+(10*tileSize)/2-vehicles[i][0].image.width*2 && vehicles[i][0].pos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
receive payment from customer, recipient can be unikey or merchant if it is unikey, can just complete payment and update channel if it is merchant, will require to look up channel of merchant, and create condtional payment from UniKey to merchant | async receive_conditional_payment(who, recipient, signed_state) {
this.log(`Receive Conditional Payment from ${who.address} to ${recipient}`)
return new Promise(async ( resolve, reject) => {
let channelID = signed_state.channelID
try {
assert(this.channels[channe... | [
"function executePayment(clientId,secret,price,paymentId,payerId,callback){\n request.post(PAYPAL_URI + '/v1/payments/payment/' + paymentId + '/execute',\n {\n auth:\n {\n user: clientId,\n pass: secret\n },\n body:\n {\n payer_id: payerId,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
translateCtrl Controller for translate | function translateCtrl($translate, $scope) {
$scope.changeLanguage = function(langKey) {
$translate.use(langKey);
$scope.language = langKey;
};
} | [
"translate(text, target, callback){\n\t\t\t\t// Assume that our default language on every JS or HTML template is en_US\n\t\t\t\ttranslates('en_US', target, text, callback);\n\t\t\t}",
"function translate(key) {\n var lang = getLang(),\n text = translations[key];\n\n if (typeof text === 'undefined') {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new RigidBody using the given body type. Defaults to Box2D.BodyType.DYNAMIC. | function RigidBody(bodyType) {
if (typeof bodyType === "undefined") { bodyType = 2 /* Dynamic */; }
_super.call(this, "RigidBody");
/**
* The type of body (Dynamic, Static, or Kinematic) associated with this Collider.
* Defaults to Dynamic.
* The t... | [
"function addBody(){\n\tvar s = time();\n\tvar is_space = false;\n\twhile(!is_space && time()-s<1000){\n\t\tvar x = rand(0, win_w);\n\t\tvar y = rand(0, win_h);\n\t\tvar m = rand(7,30);\n\t\tvar r = m;\n\t\tvar is_space = true;\n\t\tfor(var i = 0, l = bodies.length; i < l && is_space; i++){\n\t\t\tvar b = bodies[i]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts categories into a sorted array for each place it has the values: [categoryNid, category item count, category item ids as an array] | function sortCategories(cats){
var ar = [],
ret = {};
$.each(cats, function(idx, d){
ar.push([idx, d.length, d]);
});
ar = ar.sort(function(a,b) { return b[1] - a[1]; });
return ar;
} | [
"function fillCatPositionsArray() {\n\tcatPositions = new Array()\n\tvar idx = 0;\n\t$('#categories').find('li').each(function() {\n\t\tcatPositions[idx++] = getCategoryId($(this).attr('id'));\n\t});\n}",
"function sortGroceries() {\n let categories = Array.from(new Set(groceryList.map((grocery) => grocery.cat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Slider filter Filters element in slider and reinits swiper slider after | function initSliderFilter(swiper) {
var btns = jQuery('.slider-filter'),
container = jQuery('.slider-filter-container');
var ww = jQuery(window).width(),
wh = jQuery(window).height();
if (btns.length) {
btns.on('click', 'a.cat, span.cat, span.img', function() {
var el = jQuery(this),
f... | [
"function handleFilter () {\n $('.js-checked-filter').on('change', function (){\n let usrInput;\n if( $(this).is(':checked') ) usrInput = 'noCheckedItems';\n else {usrInput = 'noFilter';}\n\n setFilter(usrInput);\n renderShoppingList();\n });\n}",
"function cs_page_composer_filterable(id) {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Close the comments section | function closeComments(){
document.getElementById('commentsOverlay').style.display = 'none';
} | [
"function closeCreateCommentMenu(){\n var createCommentMenu = document.getElementById( 'create-comment-body' );\n createCommentMenu.classList.add( 'closed' );\n clearInputs( \"comment\" );\n}",
"closeFile() {\n\t\tthis.code.closeEditor(this.path);\n\t}",
"close() {\n this.nodes.wrapper.classList.remove(Bl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines a double value for the similarity of two pokemon based on aggregate shades. Should always be called after prepping the raw pokemon data. | function comparePokemon(p1, p2) {
/*console.log(pokeData[p1]);
console.log(p2);
p1 = pokeData[p1].colors;
p2 = pokeData[p2].colors;*/
//get the total pixels in the pokemon so we can work with percentages
var p1Total = 0.0;
var p2Total = 0.0;
for (var i = 0; i < p1.length; i++) {
p1Total += p1[i].count;
}
... | [
"wholePaintingCompare(data){\n let dataColorValues = dataParser(data);\n let matchPercent = 0;\n let matchTotals = 0;\n for (var i = 0; i < dataColorValues.length; i++) {\n let compareValue = this.singleColorCompare(dataColorValues[i].hex);\n if (compareValue != 0) {\n matchTotals++;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sparkline generator with xscale information | function sparkline_xscale(type,selector,formater) {
var sparkline = $(selector);
var data = JSON.parse(sparkline.html());
var xscale = data.reduce(function(x,y,i){
var item = {};
item[i] = formater(y[0]);
return $.extend(x,item)
},{});
var values = data.map(function(x){return x[1]});
sparkline.s... | [
"function sparkline_charts() {\r\n\t\t\t$('.sparklines').sparkline('html');\r\n\t\t}",
"function initSparkline(el, values, opts) {\r\n el.sparkline(values, $.extend(sparkOpts, el.data()));\r\n }",
"function _drawSequenceScale(paper, x, l, w, c, scaleColors)\n{\n var sequenceScaleY = c + 20;\n va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if this video has an equal video in a Videos array | in(videos) {
if(Array.isArray(videos)) {
for(let video of videos) {
if(this.equals(video)) {
return true;
}
}
}
return false;
} | [
"equals(video) {\n if(video && video instanceof Video && video.id === this.id) {\n return true;\n }\n return false;\n }",
"function checkDupeVideo(videoId)\n {\n for (var i = 0; i < videoList.length; i++)\n {\n if (videoId == videoList[i].id)\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is for Group Name text box validation text box accept alphanumeric,space and period first char should not be special char and numeric single space or single period accepted between two word not end with special character | function groupNameValidation(e) {
var ret
var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
if (document.getElementById('groupId').value.length == 0) {
ret = ((keyCode >= 65 && keyCode <= 90)
|| (keyCode >= 97 && keyCode <= 122) || (specialKeys
.indexOf(e.keyCode) != -1 && e.charCode != e.keyCode));
... | [
"function groupNameValid(name) {\n return (typeof name === \"string\" && name.length <= 50 && name.length > 2)\n}",
"function ValidNameField(sender) {\n var id = $(sender).attr('id');\n var nameField = $('#' + id).val();\n var regexpp = /^[a-zA-Z][a-zA-ZéüöóêåÁÅÉá .´'`-]*$/\n var Exp = /^[0-9]+$/;\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hide or show mail attachment link | function showAttLink(view, show) {
if (view) {
if (show) {
view.$el.find('.links.shareAttachments').show();
} else {
view.$el.find('.links.shareAttachments').hide();
}
}
} | [
"function stopAttLink() {\n require(['io.ox/core/extPatterns/links'], function (links) {\n new links.Action('io.ox/mail/compose/attachment/shareAttachmentsEnable', {\n id: 'stop',\n index: 1,\n requires: function (e) {\n try {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterates over all the directives for a node and returns index of a directive for a given type. | function getIdxOfMatchingDirective(node, type) {
var defs = node.view[TVIEW].directives;
var flags = node.tNode.flags;
var count = flags & 4095 /* DirectiveCountMask */;
var start = flags >> 14 /* DirectiveStartingIndexShift */;
var end = start + count;
for (var i = start; i < end; i++) {
... | [
"function _nodeIndex(node) {\n\t\t// \n\t\tif (!node.parentNode) return 0;\n\t\t// \n\t\tvar nodes = node.parentNode.childNodes,\n\t\t\tindex = 0;\n\t\t// \n\t\twhile (node != nodes[index]) ++index;\n\t\t// \n\t\treturn index;\n\t}",
"function findStyleAttributeIndex(attributeType, styleArray) {\n return style... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given a hex string converts it to a big int in the valid private key range | function hex2bigIntKey(s){ return bigInt2bigIntKey(hex2bigInt(removeWhiteSpace(s))); } | [
"function hex2bigInt(s){ return new BigInteger(removeWhiteSpace(s), 16); }",
"function hex2hexKey(s){ return bigInt2hex(hex2bigIntKey(removeWhiteSpace(s))); }",
"function bigInt2bigIntKey(i){ return i.mod(getSECCurveByName(\"secp256k1\").getN()); }",
"function bigInt2ECKey(i){ return new Bitcoin.ECKey(bigInt2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |