query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
ActionReference function to select a layer by name | function selectLayerName(name)
{
var idslct = charIDToTypeID( "slct" );
var desc5 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
ref1.putName( idLyr, name );
desc5.putReference( idnull, ref1... | [
"layer(name) {\n this._ensureIsInLayeredMode()\n\n return this.setCanvas(this.getLayer(name).getElement())\n }",
"function touchUpLayerSelection() {\n try {\n // Select all Layers\n var idselectAllLayers = stringIDToTypeID(\"selectAllLayers\");\n var desc252 = new ActionDescriptor();\n var idn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getAccessToken Get the Spotify ID for the artist. That's needed to search related artists later on API Guide on general searches: Authorization type: Bearer access token Input: bearer access token, artist name Output: object including artist id | async function getArtistId(bearerAccessToken, artistName) {
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer " + bearerAccessToken);
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
retur... | [
"async function getArtistId(bearerAccessToken, artistName) {\n let myHeaders = new Headers();\n myHeaders.append(\"Authorization\", \"Bearer \" + bearerAccessToken);\n\n let requestOptions = {\n method: 'GET',\n headers: myHeaders,\n redirect: 'follow'\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new encryption key and place it both in the encryption and decryption key databases Check if there is a default key in palce, and if not, make this key the default encryption key too. | function DISABLEgenerate_encryption_key_4() {
console.debug("navigate-collection.js: generate_encryption_key_4.begin");
// get default private key
var signing_key_jwk;
var encryption_key_jwk;
var signing_key_obj;
var encryption_key_obj;
var defaultEncryptionKeyId;
var privateKeyJwk;
... | [
"function encryption() {\n var DES_key = document.getElementById(\"payment_password\").value;\n if (DES_key.length != 0) {\n var encrypted_des_key = RSA_encryption(DES_key);\n document.getElementById(\"payment_password\").value = encrypted_des_key;\n }\n }",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that removes the page arg from the url | function wppbRemovePageFromUrl( link, page ){
link = link.replace( '/'+page+'/', '/' );
link = wppbRemoveURLParameter( link, 'page' );
return link;
} | [
"function stripInternalParams(url) {\n url.search = url.search.replace(/([?&])(_pjax|_)=[^&]*/g, '').replace(/^&/, '')\n return url.href.replace(/\\?($|#)/, '$1')\n }",
"function removeUrlAnchor(url){\n return url.split('#')[0];\n}",
"function get_UrlArg() {\n var loc = $(locati... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateTeamPlayers : fill the appropriate table with the team players players : array of all the teams players isHome : are we filling the 'Home' or 'Away' players | function updateTeamPlayers(players, isHome) {
var row;
var week = $('#week').val();
if(players.length != 0) {
if(isHome) {
$('#homePlayers tbody').empty();
$('#homeNumPlayers').val(players.length);
} else {
$('#awayPlayers tbody').empty();
$('#awayNumPlayers').val(players.length);
}
$.each(pla... | [
"function fillTeamPlayers(isHome) {\n\tvar team = isHome ? $('#homeTeam').val() : $('#awayTeam').val();\n\n\t$.getJSON(\n\t\t'/getPlayersByTeam',\n\t\t{ \n\t\t\tteam : team,\n\t\t\tsort : 'number'\n\t\t},\n\t\tfunction(data) {\n\t\t\tupdateTeamPlayers(data, isHome);\n\t\t}\n\t);\n}",
"function populateLeaderboard... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This defines the class AlertGroup | function AlertGroup(type, groupID, heading, count){
this.type = type; //danger, warning, or caution
this.groupID = groupID; //the alerts will refer to this id
this.heading = heading; //heading text for the group
this.count = count = 0; //total number of alerts within this group
} | [
"function createAlertGroupContainer(group){\n\t\t\tvar containerHtml = \"<li class='ANDI508-alertGroup-container ANDI508-display-\"+group.type+\"' id='ANDI508-alertGroup_\"+group.groupID+\"'>\\\n\t\t\t\t\t\t\t <h4><a href='#' class='ANDI508-alertGroup-toggler' tabindex='0' aria-expanded='false'>\"+group.heading... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Description: Given rows of zip codes and related info, parse out the desired fields and populate an array with the data and an array with those zip codes. | function populateDataArrays(rows, category, zipsArray, dataArray) {
//Depending on category, parse that field from data and add to arrays
switch (category)
{
case "Inquiry":
rows.forEach(function(r){
r.Inquiry = parseInt(r.Inquiry);
r.Zipcodes = parseInt(r.Zipcodes);
... | [
"function getZipCodes(res, mysql, context, complete){\r\n mysql.pool.query(\"SELECT ZIP_CODE, LOCATION_ID FROM LOCATION ORDER BY LOCATION_ID\",\r\n\t\tfunction(error, results, fields){\r\n if(error){\r\n res.write(JSON.stringify(error));\r\n res.end();\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new regimen or updates an existing one | function upsertRegimen(req, res, next){
var card = req.body.regimen;
var pat = parseInt(req.params.pat_id);
var card_id = req.body.test2;
// if updating a card
if (card_id) {
req.app.get('db').regimens.update({id: card_id, card: card}, function(err, result){
if (err) {
console.log("C... | [
"function registerStudent(req,res){\n \n let instanceStudents = new modelStudents({\n id_student : req.body.id_student,\n name : req.body.name,\n nip : req.body.nip,\n group : req.body.group\n \n });\n \n instanceStudents.save(err =>{\n if (err) res.status(50... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom type guard for Overlay. Returns true if node is instance of Overlay. Returns false otherwise. Also returns false for super interfaces of Overlay. | function isOverlay(node) {
return node.kind() == "Overlay" && node.RAMLVersion() == "RAML10";
} | [
"static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === MountTarget.__pulumiType;\n }",
"hasInheritance(node) {\n let inherits = false;\n for (let i = 0; i < node.children.length; i++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stem Tracking Utility. A stem is a widget insertion button. It signifies a potential widget. The tracking utility manages the absolute positioning of these stems, as well as their addition and removal from the DOM. | function StemTracker(editor, onClick) {
var me = this;
var stems = [];
this.editorElem = editor.currentElem();
this.containerElem = this.createDom();
this.reposition();
/** Listen for changes in content and update. */
editor.addListener({
onContent: function () {
updateStems( this.editorElem )... | [
"function StemTracker(editor, exclusions, onClick) {\n var me = this;\n var stem;\n\n if (typeof exclusions === 'function') {\n onClick = exclusions;\n exclusions = [];\n }\n\n this.editorElem = editor.currentElem();\n this.containerElem = this.createDom();\n this.reposition();\n this.exclusions = exc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new BinaryFileAssetTask object | function BinaryFileAssetTask(/**
* Defines the name of the task
*/name,/**
* Defines the location of the file to load
*/url){var _this=_super.call(this,name)||this;_this.name=name;_this.url=url;return _this;} | [
"function TextureAssetTask(/**\n * Defines the name of the task\n */name,/**\n * Defines the location of the file to load\n */url,/**\n * Defines if mipmap should not be generated (default is false)\n */noMipmap,/**\n * Defines if texture must be inverted on Y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shows a search bar and if given the prop for countriesMatchedLoading, shows a Spinner side by side horizontally, using Flexbox CSS layout | render() {
return (
<div id="search-box">
<form autoComplete="off" id="search-box-form-div">
<input autoComplete="false" name="hidden" type="text" style={{ display: "none" }}></input>
<input
id="search-box-form-div-input"
placeholder="Enter a country to get ... | [
"function searchBar() {\n var inp = document.getElementById('input-id').value; \n inp = inp.replace(/^(.)|\\s(.)/g, function($1){ return $1.toUpperCase( );});\n \n console.log(\"INPUT \"+ inp);\n var test = '<g id=\"' + inp + '\"/>';\n \n $('.map').append(test);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A SelectableItem is the abstract base class for any noncontainer data that has an associated model item in the trace model (possibly itself). Subclasses must provide a selectionState property (or getter). | function SelectableItem(modelItem) {
this.modelItem_ = modelItem;
} | [
"isSelected(item)\n {\n return this._selectedItems.hasOwnProperty(item.id);\n }",
"get selectable() { return true }",
"handleSelectedEdited(item){\n\n\t\t//if this is the currently selected object, let's fire our change event\n\t\tif(item.ID == this.selectedClassItem)\n\t\t\tthis.eventSelectionEdit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ColorContext will wrap the button since it may change the color through its className | render(){
return(
<ColorContext.Consumer>
{ (color) => this.renderButton(color) }
</ColorContext.Consumer>
);
} | [
"function ColorButton(desc_id, col, flags = 0, size = ImVec2.ZERO) {\r\n return bind.ColorButton(desc_id, col, flags, size);\r\n }",
"function useColorMode() {\n return React.useContext(ColorModeContext);\n}",
"_setColor() {\n this._container.classList.remove(\n `alert--${this._data.colo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getName("ajay") .then(nm => hobbies(nm)) .then(hobby => console.log(hobby)) | async function get(){
const nm = await getName("ajay")
const hobby = await hobbies("nm")
console.log(hobby)
} | [
"async function callwithPromise(){\n const fullName = await call.withPromise('Isai', 'Reyes')\n console.log(fullName);\n }",
"function makeCoffee(){\n\tgetCoffee().then(coffee=>{\n\t\tconsole.log(coffee);\n\t});\n}",
"async function printNames2() {\n console.log(\"Before\");\n\n const promise1 = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a loan repayment history | static async getRepaymentRecords (req, res) {
const loanID = parseInt(req.params.loanId, 10);
const { rows } = await repayment.findOne(loanID);
if (rows.length === 0) {
return res.status(404).send({
status: res.statusCode,
error: "Repayment history not found"
})
}
... | [
"function myLoansPrevLoan() {\n \n // TO DO\n // move to the previous loan\n \n}",
"function otherLoansPrevLoan() {\n \n // TO DO\n // move to the previous loan\n \n}",
"function payLoan() {\n totalOutstandingLoan -= totalPay;\n totalPay = 0;\n\n updateTotalOutstandingLoan();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display game and hide gametype | function displayGame(){
gameType.style.display ='none';
gamePlay.style.display ='block';
} | [
"function displayGameScreen()\n{\n\t\n\tdisplayResourceElement();\n\t\t\t\n\tdisplayInfoElement();\n\t\n\tdisplayMapElement();\n\t\n\tjoinGame();\n\t\n\tif(player.onTurn == true)\n\t{\n\t\tdisplayEndTurnElement(\"salmon\");\n\t\t\n\t\tdisplayTurnCounterElement(\"lightGreen\");\n\t}\n\telse\n\t{\n\t\tdisplayEndTurnE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
REQUIRED Stop visualization method. Unbind ANY recurring visualization methods so other visaulzations can fire on the audio tag. | function stopVisualization(){
window.cancelAnimationFrame(request_animation);
amplitude_container.innerHTML = '';
} | [
"async disable () {\n // Disconnect everything\n this.mic.disconnect()\n this.scriptNode.disconnect()\n\n // Stop all media stream tracks and remove them\n this.media.getAudioTracks().forEach(\n (element) => {\n element.stop()\n this.media.removeTrack(element)\n }\n )\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
APP VIEW FULL LAYOUT | function appViewLayout(){
var appViewStatus = Number(document.getElementById("appsViewStatusOp").value);
if(appViewStatus === 0){
// Size of HTML document (same as pageHeight/pageWidth in screenshot).
var indention = 65;
var totalWidth = Number(document.documentElement.clientWidth) - indention;
docume... | [
"function setFullSize() {\r\n\tappContainer_Fs.css({\r\n\t\t'width' : appContainerWidth_Fs,\r\n\t\t'height' : appContainerHeight_Fs,\r\n\t\t'margin-top': appContainer_marginTop_Fs\r\n\t});\r\n\tappContent.css({\r\n\t\t'width' : appContentWidth,\r\n\t\t'height' : appContentHeight,\r\n\t});\t\r\n}",
"function choos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initial step in the waterfall. This will kick of the ConfirmLookIntoStep step If the confirmSendEmailStep flag is set in the state machine then we can just end this whole dialog If the confirmLookIntoStep flag is set to null then we need to get a response from the user If the user errors out then we're going to set the... | async initialStep(stepContext) {
// Get the user details / state machine
const unblockBotDetails = stepContext.options;
// This sets the i18n local in a helper function
setLocale(stepContext.context.activity.locale);
// DEBUG
// console.log('DEBUG UNBLOCKBOTDETAILS:'... | [
"async finalStep(stepContext) {\n // If the child dialog (\"bookingDialog\") was cancelled or the user failed to confirm, the Result here will be null.\n if (stepContext.result) {\n const result = stepContext.result;\n // Now we have all the booking details.\n\n consol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Defend When the player decides to defend (run away), he/she gets hit at half strength of the opponent's weapon. | handleDefence(weaponDamage) {
// When player chooses to defend themselfves,
// they get hit at half strength of opponnent's weapon
this.health = this.health - (weaponDamage / 2);
} | [
"function PrisonFightPoliceEnd() {\n\tCommonSetScreen(\"Room\", \"Prison\");\n\tSkillProgress(\"Willpower\", ((Player.KidnapMaxWillpower - Player.KidnapWillpower) + (PrisonPolice.KidnapMaxWillpower - PrisonPolice.KidnapWillpower)) * 2);\n\tif (!KidnapVictory) {\n\t\tCharacterRelease(PrisonPolice);\n\t\tInventoryRem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws the Xaxis and label. | addXAxis(ypos, label) {
this.image.drawLine(this.left, ypos, this.right, ypos, BLACK);
if (label) {
// draw the x-axis label
this.addText(label, 16, this.left, ypos + 8, this.width, this.padding - 8);
}
} | [
"function drawAxis() {\n svg.select('.x-axis-group .axis.x')\n .attr('transform', `translate(0, ${chartHeight})`)\n .call(xAxis);\n\n svg.select('.y-axis-group .axis.y')\n .call(yAxis);\n }",
"function createXAxis() {\n $(element + \" ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
its between 37 and 40 so I'll need to just have a switch to reutrn a different number | function randomNumber(){
return Math.floor(Math.random()*(40-37+1)+37);
} | [
"function setNumber() {\n\tsecretNumber = Math.ceil(Math.random() * 99);\n}",
"function generateNumberToMatch() {\n return Math.floor(Math.random() * 102) + 19;\n}",
"function computerGuessGen() {\n\treturn Math.floor(Math.random() * 101) + 19;\n}",
"function rndmNumberStart () {\n rndmNumber = Math... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the next node in the LNode tree, taking into account the place where a node is projected (in the shadow DOM) rather than where it comes from (in the light DOM). If there is no sibling node, this function goes to the next sibling of the parent node... until it reaches rootNode (at which point null is returned). | function getNextOrParentSiblingNode(initialNode, rootNode) {
var node = initialNode;
var nextNode = getNextLNodeWithProjection(node);
while (node && !nextNode) {
// if node.pNextOrParent is not null here, it is not the next node
// (because, at this point, nextNode is null, so it is the pare... | [
"function followingNonDescendantNode(node) {\n if (node.ownerElement) {\n if (node.ownerElement.firstChild) return node.ownerElement.firstChild;\n node = node.ownerElement;\n }\n do {\n if (node.nextSibling) return node.nextSibling;\n } while (node = node.parentNode);\n return null;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sample map data: ['AB1', 'BC2'] create network of Node and Vertex objects from the map data return nodes array | createNodes(mapData) {
mapData.forEach((data) => {
const [tempStartNodeName, tempEndNodeName, tempNodeDistance] = data;
const tempStartNode = this.addNode(tempStartNodeName)
|| this.getNode(tempStartNodeName);
const tempEndNode = this.addNode(tempEndNodeName... | [
"convertDataToGraph() {\n let graph = {nodes: [], links: [], nodeLabelsMap: {}}\n\n if (this.state.data == null) {\n return graph;\n }\n // To ensure we do not render duplicates, we build sets of nodes, relationships and labels.\n let nodesMap = {}\n let nodeLabe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: _fnAddColumn Purpose: Add a column to the list used for the table with default values Returns: Inputs: object:oSettings dataTables settings object node:nTh the th element for this column | function _fnAddColumn( oSettings, nTh )
{
var iCol = oSettings.aoColumns.length;
var oCol = {
"sType": null,
"_bAutoType": true,
"bVisible": true,
"bSearchable": true,
"bSortable": true,
"asSorting": [ 'asc', 'desc' ],
"sSortingClass": oSettings.oClasses.sSortable,
"sSortingClass... | [
"function addNewColumn(tableList, tableName, column) {\r\n\tvar index = searchList(tableList, \"tableName\", tableName);\r\n\tif (searchList(tableList[index].tableColumns, \"columnName\", column.columnName) == -1)\r\n\t\ttableList[index].tableColumns.push(column);\r\n}",
"function _addColumn(){\n self._visitin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls both updateListStart and updateListEnding in the correct order | updateBeginningAndEndingItems(method) {
this.updateListStart();
this.updateListEnding(method);
} | [
"updateList() {\n console.log(\"$$$$$$$$ updateList\");\n this.forceUpdate();\n }",
"moveItem(start, end) {\n let list = this.state.currentList;\n\n // WE NEED TO UPDATE THE STATE FOR THE APP\n start -= 1;\n end -= 1;\n if (start < end) {\n let temp = list.item... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does row filtering for ui grid. List of params is compatible with uigrid condition function format :param terms: array of selected 'terms' :returns: True if val is equal to at least one of the terms. False otherwise | function multiselectConditionFn(terms, val, row, col) {
if (typeof(terms) == 'undefined') return true
if (terms.length === 0) return true
// Check if we already have comipler predicates for given `terms`
if (terms != termsCacheKey) {
termsCacheKey = terms
predicatesCache = compilePredicates... | [
"checkIfSearchFiltered(oneRecipe) {\n if (searchFilter[0]) {\n let fullString =\n JSON.stringify(oneRecipe.name) +\n JSON.stringify(oneRecipe.description) +\n JSON.stringify(\n oneRecipe.ingredients.map((el) => el.ingredient)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to add a constraint to simulation requires restarting simulation after | function createConstraint(constraint) {
const leftIndex = nodes.map(v => v.id).indexOf(constraint.leftID);
const rightIndex = nodes.map(v => v.id).indexOf(constraint.rightID);
if (leftIndex === -1 || rightIndex === -1) {
console.warn("Cannot create constraint, Node does not exist.", ... | [
"addActivityConstraint(name, newConstraint) {\n let {activities} = this.state;\n let activity = activities[name];\n if (!activity) {\n throw new Error('No activity to add a constraint to for the given activity name: ' + name);\n }\n const constraints = Object.assign({}, activity.constraints);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback, creazione root con chiave valore | function root(k, v) { //k = menu, v = voci menu
// creo ul
var parent = $("#menu");
// ho fratelli?
// si : chiamo a, no : fine ciclo
$.each(v, function (key, val) {
//richiamo a per ogni voce del menu
addNodo(val, parent);
});
} | [
"async function fillRoot() {\n const fill = [];\n for (var i = 0; i < rand(1); i++) {\n fill.push(await makeSimpleTx());\n }\n\n // Produce a seperate root with this transaction.\n const filltxs = [...fill];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds the picker panel | buildPickerPanel() {
let options = this.buildOptions();
// Picker modal
let pickerModal = document.createElement("div");
pickerModal.classList.add("picker-modal");
// Picker panel
let pickerPanel = document.createElement("div");
pickerPanel.className = "picker-p... | [
"function buildUI(thisObj){\n\n\t\t\t// ----- Main Window -----\n\t\t\tvar w = (thisObj instanceof Panel) ? thisObj : new Window(\"palette\", scriptName);\n\t\t\t\tw.alignChildren = ['fill', 'fill'];\n\n\t\t\t\tw.add(\"statictext\", undefined, \"Use the + button to add a project, or use the ? button to access the s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(TEMP) This temporary utility generates a specific JSON test string given a set of student data | function test_utility_logSortedData(studentData) {
var formattedTestString = "[";
for (var i = 0; i < studentData.length; ++i){
formattedTestString += `{ "_id": "${studentData[i].id}", "name": "${studentData[i].name}", "grade": ${studentData[i].grade} } `
if (i != studentData.length - 1) {
... | [
"function fillStudentInfo(studentJson) {\n var firstName = studentJson.etudiant.prenom;\n var lastName = studentJson.etudiant.nom;\n var academicYear = studentJson.monAnnee.anneeAcademique;\n var programTitle = studentJson.monAnnee.monOffre.offre.intituleComplet;\n $(\"#student_name\").append(\"<br>\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a new ``bytes5`` type for %%v%%. | static bytes5(v) { return b(v, 5); } | [
"static bytes25(v) { return b(v, 25); }",
"static bytes15(v) { return b(v, 15); }",
"static bytes23(v) { return b(v, 23); }",
"static bytes(v) { return new Typed(_gaurd, \"bytes\", v); }",
"static bytes6(v) { return b(v, 6); }",
"static bytes8(v) { return b(v, 8); }",
"static bytes9(v) { return b(v, 9);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks to see if event selected is empty and not disabled | function isReady(){
if( events.length > 1 ){
alert("Bitte nur eine auswählen");
return
}
if( selectedEvent.status === "disabled" ){
alert("Eintrag ist disabled und kann nicht erstellt werden");
return
}
if( selectedEvent.status != "" ){
alert("Eintrag hat bere... | [
"function check_selection(){\n\n console.log(\"here\")\n\n var slected = $('#TradingStrategiesList').find('.selected');\n console.log(slected.length)\n if(slected.length!==0){ // Which strategy was originally selected\n\n $(\"#editStrategy\").prop(\"disabled\",false)\n }\n}",
"function chec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets grammatical accent (U = udatta, I = independent svarita, = unaccented) of each vowel in input | function getAccents(input) {
var line = String(input);
var udatta = ["á", "í", "ú", "é", "ó", "Á", "Í", "Ú", "Ṙ", "ṙ", "Ḻ", "ḻ", "Ý", "Ẃ"];
var indSvarita = ["à", "ì", "ù", "è", "ò", "À", "Ì", "Ù", "Ṝ", "ṝ", "Ḹ", "ḹ", "Ỳ", "Ẁ"];
var unaccented = ["a", "i", "u", "e", "o", "A", "I", "U", "Ṛ", "ṛ", "Ḽ", "ḽ", "Y", ... | [
"function ipa_adjust_doubleVowel(graphemes) {\n\n var doubleVowel = {\n \"\\u0069\":\"\\u0069\\u02D0\", // LATIN SMALL LETTER I to I with IPA COLON\n \"\\u0251\":\"\\u0251\\u02D0\", // LATIN SMALL LETTER ALPHA to ALPHA with IPA COLON\n \"\\u0075\":\"\\u0075\\u02... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Database of target images | function TargetImageDatabase(directory) {
this.directory = directory;
this.targetsByIndex = [];
this.targetsByName = {};
var filenames = fs.readdirSync(directory);
for (var i = 0; i < filenames.length; i++) {
//Image files only
var ext = filenames[i].slice(-4);
if (ext == '.png' || ext == '.jpg') {
var fu... | [
"function getAllImages() {\n return Images().select();\n}",
"function get_img(i,f){var b,a=__CONF__.img_url+\"/img_new/{0}--{1}-{2}-1\",g=__CONF__.img_url+\"/img_src/{0}\",c=\"d96a3fdeaf68d3e8db170ad5\",d=\"43e2e6f41e3b3ebe22aa6560\",k=\"726a17bd880cff1fb375718c\",j=\"6ea1ff46aab3a42c975dd7ab\";i=i||\"0\";f=f||{... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the relationship string in the specified language | function getRelationshipString(person, lang){
var rel = person.relationship;
if(rel === 'child'){
if(person.person.gender.type === 'http://gedcomx.org/Male'){
rel = 'son';
} else if(person.person.gender.type === 'http://gedcomx.org/Female'){
rel = 'daughter';
} else {
r... | [
"getTranslationString(type) {\n let userString;\n let tts = this.get('typeToString');\n userString = tts[type];\n\n if (userString === undefined) {\n for (let ts in tts) {\n if (type.toLowerCase().indexOf(ts) !== -1) {\n userString = tts[ts];\n break;\n }\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[18] UnionExpr::= PathExpr | UnionExpr '|' PathExpr | function unionExpr(stream, a) { return binaryL(pathExpr, stream, a, '|'); } | [
"function Union() {\n var alternatives = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n alternatives[_i] = arguments[_i];\n }\n var match = function () {\n var cases = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n cases[_i] = arguments[_i];\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exits the process if gulp is running with a node version lower than the required version. This has to run very early to avoid parse errors from modules that e.g. use let. | function checkMinVersion() {
const majorVersion = Number(process.version.replace(/v/, '').split('.')[0]);
if (majorVersion < NODE_MIN_VERSION) {
$$.util.log('Please run Subscribe with Google with node.js version ' +
`${NODE_MIN_VERSION} or newer.`);
$$.util.log('Your version is', process.version);
... | [
"function checkNodeVersionRequiredByLinode() {\n // Versions of Node.js that are recommended for these tests.\n const recommendedNodeVersions = [14];\n\n const versionString = process.version.substr(1, process.version.length - 1);\n const versionComponents = versionString\n .split('.')\n .map((versionComp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion para obtener los asesores | async obtenerAsesores(req,res){
await this.personaDAO.getAsesores(req,res);
} | [
"function getAthletes() {\n // get athletes owned by logged in user\n console.log(\"In getAthletes, OwnerId:\", OwnerId);\n $.get(\"/api/athletes/team/\"+OwnerId, function(data) {\n initializeRows(data);\n });\n // get unowned athletes\n $.get(\"/api/athletes/team/1\", function(data) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
arrange the id of all slides the new set of id will start from MIN_ID | arrangeId() {
const rootNode = this.parent.contentDom.documentElement;
let id = SlideSet.MIN_ID;
for (let { slideId } of this.selfElement.items()) {
const oriId = slideId.id;
const relElements = rootNode.xpathSelect(`.//*[local-name(.)='sldId' and @id='${oriId}']`);
... | [
"function reorderPlus(id){\n x= id, y= id-1;\n yourtourids[x] = yourtourids.splice(y, 1, yourtourids[x])[0];\n updateTour();\n}",
"function addId(){ //Add ID to events, calendar and list\n var cal = document.getElementsByClassName(\"JScal\");\n var eventList = document.getElementsByClassName(\"JS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
res_web.js /////////////////////////////////////////////////////////////////////////// RES in web pages. Make canvas for all hieroglyphic. | function ResWeb() {
var canvass = document.getElementsByTagName("canvas");
for (var i = 0; i < canvass.length; i++) {
var canvas = canvass[i];
if (canvas.className.match(/\bres\b/))
ResWeb.makeSometime(canvas);
}
} | [
"function mCreateCanvas() {\n createCanvas(...[...arguments]);\n pixelDensity(1);\n mPage = createGraphics(width, height, WEBGL);\n\tmPage.pixelDensity(1);\n}",
"function WebGlRenderUtility() {\n}",
"function dce_setup_canvas(cwidth, cheight) {\n\n\tctx = null;\n\tcanvas = null;\n\tcanvas_container = n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO(mmalerba): This is technically out of sync with what's really rendered until a render cycle happens. I'm being careful to only call it after the render cycle is complete and before setting it to something else, but its error prone and should probably be split into `pendingRange` and `renderedRange`, the latter ref... | getRenderedRange() {
return this._renderedRange;
} | [
"function defaultCellRangeRenderer(_ref) {\n var cellCache = _ref.cellCache,\n cellRenderer = _ref.cellRenderer,\n columnSizeAndPositionManager = _ref.columnSizeAndPositionManager,\n columnStartIndex = _ref.columnStartIndex,\n columnStopIndex = _ref.columnStopInd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utilities Returns true if user is signedin. Otherwise false and displays a message. | function checkSignedInWithMessage() {
// Return true if the user is signed in Firebase
if (isUserSignedIn()) {
return true;
}
showAlert('You must sign-in first');
return false;
} | [
"function loggedInCheck() {\n // ajax call to check that user has a valid, i.e. non-expired, login cookie\n // if cookie is valid, show logged in user controls\n var loggedIn = true;\n if ( loggedIn ) {\n showUserControls();\n }\n else {\n hideUserControls();\n }\n}",
"isUserAuthenticated() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates the audio play button | function createAudioButton() {
// creating the 'play' button
var playButton1 = document.createElement("button");
playButton1.classList.add("play-button");
playButton1.innerText = "PLAY";
selectParentDiv.appendChild(playButton1);
playButton1.addEventListener("click", playAudio);
} | [
"function playButtonSound() { \nsound.src = 'music/click.mp3'\nsound.play() }",
"function togglePlaying(){\n if (!song.isPlaying()){\n song.loop();\n song.setVolume(1);\n button.html(\"pause\");\n } else{\n song.pause();\n button.html(\"play\");\n }\n}",
"function playTrack() {\n\n curr_tra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add structlines to every monomial corresponding to the given offset vector. For instance, if there is a generator called | addStructline(slice_offset_vector, stem_offset, callback){
slice_offset_vector = this._ring.getElement(slice_offset_vector);
for(let k of this){
let s1 = k[1];
let s2 = this.get(k[0].multiply(slice_offset_vector));
if(s2 !== undefined){
for(let s... | [
"addStructline(offset_vector, callback){\r\n offset_vector = this._ring.getElement(offset_vector);\r\n for(let k of this){\r\n let c1 = k[1];\r\n let c2 = this.get(k[0].multiply(offset_vector));\r\n if(c2 !== undefined){\r\n let sline = this.sseq.addStru... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
task1() /Task 2: what and why console logs? Answer: 1. false, because Rabbit.prototype.constructor is Animal To prevent this, set constructor explicitly Rabbit.prototype.constructor = Rabbit (incorrect: result is true, because constructor not used equality checking only prototype: remember for future) 2. true, see answ... | function task2 () {
function Animal() {}
function Rabbit() {}
Rabbit.prototype = Object.create(Animal.prototype);
var rabbit = new Rabbit();
console.log( rabbit instanceof Rabbit ); //true
console.log( rabbit instanceof Animal ); //true
console.log( rabbit instanceof Object ); //true
} | [
"static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === Backup.__pulumiType;\n }",
"produceOffspring() {\n game.animals[game.selectedAnimal].readyToProduceOffspring = 0;\n let typeOfAnimal = (game.animals[ga... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if there is an acceptable contrast ratio between the background and foreground colors based on the provided compliance level. | function isContrastCompliant(background, foreground, compliance) {
if (compliance === void 0) { compliance = "normal"; }
var ratio;
switch (compliance) {
case "large":
ratio = exports.LARGE_TEXT_CONTRAST_RATIO;
break;
case "normal":
ratio = exports.NORMAL_... | [
"function checkContrast(color, text) {\n // get the brightness of the div background.\n const luminance = chroma(color).luminance();\n if (luminance > 0.3) {\n text.style.color = '#303130';\n } else {\n text.style.color = '#efe4f1';\n }\n}",
"function matchMessageBoardColorTo(riskLeve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uses the readline library to start a command line interface. The interface can be used to interact with the bot directly. This returns immediately, as the interface is eventdriven. Note that if you implement this, all registered commands must be ready to receive messages from the command line. CLI messages do not imple... | start() {
if (this._cli !== null)
return;
this._cli = readline.createInterface({
input: process.stdin, output: process.stdout
});
this._cli.on('line', (line) => {
// Parse the command line.
let args = parseArgs(line);
// CLI commands override bot commands, so treat this as ... | [
"static createReadLine() {\r\n iface = rl.createInterface({\r\n input: process.stdin, output: process.stdout\r\n });\r\n //@ts-ignore\r\n iface.on(\"SIGINT\", () => process.emit(\"SIGINT\") );\r\n }",
"getCommand() {\n return __awaiter(this, void 0, void 0, functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
suma XOR a doua matrici de dimensiuni identice: suma este 0 daca ele au aceleasi elemente pe aceleasi pozitii | function XORSum(width, height, arr1, arr2) {
var xorsum = 0;
for (var i = 0; i < height; i++) {
for (var j = 0; j < width; j++) {
if (arr1[i][j] != arr2[i][j]) {
xorsum++;
}
}
}
return xorsum;
} | [
"function XOR() {\n for (var _len15 = arguments.length, values = Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {\n values[_key15] = arguments[_key15];\n }\n\n return !!(FLATTEN(values).reduce(function (a, b) {\n if (b) {\n return a + 1;\n }\n return a;\n }, 0) & 1);\n}",
"function inv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: displayHelpMsg Display a message in the help panel. Parameters: msg: String containingin the message to display. Returns: None. | function displayHelpMsg(msg) {
Ext.getCmp('helpIframe').el.update(msg);
} | [
"function displayHelp() {\n\tlet helpText = require('../html/help.html.js');\n\tcreateDialog('show-dialog', 'Help', helpText['helpDialog'], undefined, true);\n}",
"function update_display_msg(msg) {\n\tupdate_Display(msg, 0);\n}",
"function messageWithHelpLink(alertObject,message){\n\t\treturn \"<a href='\"+ he... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
xf is an XF, see parse_XFExt for xfext | function update_xfext(xf, xfext) {
xfext.forEach(function(xfe) {
switch(xfe[0]) { /* 2.5.108 extPropData */
case 0x04: break; /* foreground color */
case 0x05: break; /* background color */
case 0x07: case 0x08: case 0x09: case 0x0a: break;
case 0x0d: break; /* text color */
case 0x0e: break; /* font ... | [
"parseXML(rawText) {\n // TODO: different code paths for XLIFF 1.2 vs. 2.0 (this is the only way to support both)\n // Document.init();\n // Working - just return the Document object from this function\n const deferred = $q.defer();\n const self = this;\n\n // <xliff xmlns=\"urn:oasis:nam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the default wallets inside a new account. | async function createDefaultWallets (account: EdgeAccount, fiatCurrencyCode: string, dispatch: Dispatch) {
// TODO: Run these in parallel once the Core has safer locking:
await safeCreateWallet(account, 'wallet:bitcoin', s.strings.string_first_bitcoin_wallet_name, fiatCurrencyCode, dispatch)
await safeCreateWalle... | [
"function createWallet( sn, keys ) {\n if (!keys)\n return se( sn, 'stat', \"Create key(s) first\" );\n var w = new Bitcoin.Wallet();\n w.addKeys( keys );\n se( sn, 'stat', \"\" );\n return w;\n }",
"createAccount()\n {\n account = this.web3.eth.accounts.create();\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for the criteria on the given collection and trigger callback(err, docs). | function findCollectionByX(collection, criteria, callback) {
connectToDb(function onConnect(err, db) {
if (err) {
callback(err);
} else {
db.collection(collection).find(criteria).toArray(function onResult(err2, data) {
db.close();
callback(err2, data);
});
}
});
} | [
"function mongoFindAll(collection, field, value, extra, callback){\n\t\tvar searchobj = {};\n\t\tsearchobj[field] = value;\n\t\t\n\t\tdbo.collection(collection).find(searchobj).toArray(function(err, result){\n\t\t\tif (err) throw err;\n\t\t\tcallback(result, extra);\n\t\t});\n\t}",
"getEmails(callback) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load city census data tables from Census Reporter, pass to callback function. onloaded_all_data called with list of Tract objects. | function load_tract_data(original_tracts, onloaded_all_data)
{
var output_tracts = [],
source_tracts = original_tracts.slice();
load_more_data();
function load_more_data()
{
var request_tracts = [];
while(request_tracts.length < CR_API_PAGE && source_tracts.length)
{
... | [
"function loadCities() {\n\td3.csv(\"data/City_Coordinates.csv\").then(function(data) {\n\t\tif (data == undefined) {\n\t\t\tconsole.log(\"Failed to load file\");\n\n\t\t\treturn;\n\t\t}\n\t\tdata.forEach(function(d) {\n\t\t\tif (records[d.RegionName] != undefined) {\n\t\t\t\trecords[d.RegionName][\"latitude\"] = d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles the Bulb section. | function addBulb() {
const type = qlcPlusPhysical.Bulb[0].$.Type;
if (type !== `` && getOflPhysicalProperty(`bulb`, `type`) !== type) {
physical.bulb.type = type;
}
const colorTemp = parseFloat(qlcPlusPhysical.Bulb[0].$.ColourTemperature);
if (colorTemp && getOflPhysicalProperty(`bulb`, `colo... | [
"updateBB() {\n this.lastWorldBB = this.worldBB;\n this.worldBB = new BoundingBox(\n this.pos.x, this.pos.y, this.dim.x, this.dim.y);\n }",
"function renderBBAND(bband) {\n\n //remove selected\n removeSelect('bband',12);\n\n //table\n document.getElementById('BBAND').style.display=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a new instance of each plugin, on the jotted instance | function init() {
var _this = this;
this._get('options').plugins.forEach(function (plugin) {
// check if plugin definition is string or object
var Plugin = undefined;
var pluginName = undefined;
var pluginOptions = {};
if (typeof plugin === 'string') {
pluginName = plugin;... | [
"async function registerPlugins() {\n const pathToPlugins = global.FLINT.pluginPath;\n const pluginFolders = await readdirAsync(pathToPlugins);\n\n pluginFolders.forEach(async (directoryName) => {\n const Class = require(path.join(pathToPlugins, directoryName)); // eslint-disable-line\n\n const pathToIcon ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Simple routing. If the user is authenticated (isAppReady) show the HomeScreen, otherwise show the AuthScreen | render () {
console.log("IAMHERE")
if (this.state.isAppReady) {
return (
<HomeScreen
logout={() => this.setState({ isLoggedIn: false, isAppReady: false })}
/>
)
} else {
return (
<AuthScreen
login={this._simulateLogin}
... | [
"render(){\n\n if(this.state.isLoggedIn){\n return(\n <Router>\n <div>\n <Navigation isLoggedIn={this.state.isLoggedIn} isAuthenicated={this.isAuthenicated.bind(this)}/>\n <Switch>\n <Route exact path=\"/\" component={Home} />\n\n <Route exac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
in our Card component we pass some props properties, and these properties are coming from App.jsx. Ant this is name, img, tel, email. We pass our properties from App to Card, then from Card to Avatar. | function Card(props) {
return (
<div className="card">
<div className="top">
<h2 className="name">{props.name}</h2>
<Avatar img={props.img} />
</div>
<div className="bottom">
<Details detailInfo={props.tel} />
<Details detailInfo={props.email} />
</div>
... | [
"render() {\n const {image, link, name} = this.props\n return(\n <a className={styles.link} href={link}>\n <div className={styles.PromotionContainer} >\n <div className={styles.PromotionCard}>\n <div className={styles.PromotionWrapper... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
seeLess method loops over topSongsItems array and hides any items with an index greater then 2 | seeLess(){
let i = 0;
for(i=0; i<topSongsItems.length; ++i){
if(i>2){
helper.hideOrShow(topSongsItems[i], true);
}
}
//Add class used to determine buttons state
seeMoreBtn.classList.add('see-more-js');
//Swap text out on button
seeMoreBtn.innerHTML = 'See More';
} | [
"seeMore(){\n let i = 0;\n for(i=0; i<topSongsItems.length; ++i){\n helper.hideOrShow(topSongsItems[i], false);\n }\n //Remove class used to determine buttons state\n seeMoreBtn.classList.remove('see-more-js');\n //Swap text out on button\n seeMoreBtn.innerHTML = 'See Less';\n }",
"stat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for notifying a users followers of a new review | function reviewNotify(userObj){
// Loop over all users followers
console.log("In reviewNotify");
console.log(userObj);
for(let i = 0; i < userObj.followers.length; i++){
let userToNotify = users[userObj.followers[i].id];
let msg = userObj.username + " has created a new review.";
sendNotif(m... | [
"function askToReview(){\n\tchrome.runtime.sendMessage({method: \"reviewNotify\",\n\t\ttitle:'',\n\t\tmessage:'',\n\t\tdecay:'-1',\n\t\tonClick: ''\n\t}, function() {});\n}",
"function followUser() {\n UserService\n .followUser(vm.uid, vm.loggedInUser)\n .then(function (re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function sets email fields to content in parameters | setEmailFields(el, subject, body){
el.find('#email-subject').val(subject);
el.find('#email-body').val(body);
} | [
"function setupEmail() {\n var short = $attrs['checkEmail'];\n var shorts = short ? short.split('|') : [];\n var message = nls._(shorts[0] || $attrs['checkEmailMessage'] || 'message_email');\n field.checks.regexp = {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to handle a score object being removed; just removes the corresponding table row. | function handleNewNightTerrorRemoved(scoreSnapshot) {
var removedScoreRow = htmlForPath[scoreSnapshot.key()];
removedScoreRow.remove();
delete htmlForPath[scoreSnapshot.key()];
} | [
"function removePlayer(){\n\n\tvar exiledPlayer = document.getElementById(\"deletePlayer\").value;\n\nvar i = scoreBoardHistory.length\n\nwhile(i--){\n\tif (scoreBoardHistory[i].playerID == exiledPlayer){\n\t\tscoreBoardHistory.splice(i,1);\n\t}\n}\n//scoreBoardHistory.push({\"playerID\": exiledPlayer, \"score\": -... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create() Creates the canvas, adds transformed g element. Adds titles and pie arcs | create() {
this.scaleColor = d3.scaleOrdinal().range(getColor(this.color));
this.canvas = this.mainCanvas();
this.transformGroup = this.transformGroup();
this.addTitles(this.data.title, this.data.subtitle);
this.addPieArcs(this.data.percentages);
this.addSideStrokes();
... | [
"_createSVGCanvas () {\n var p = this._props;\n // create canvas - `svg` element to draw in\n this._canvas = document.createElementNS(p.ns, 'svg');\n // create the element shape element and add it to the canvas\n this.el = document.createElementNS(p.ns, p.tag);\n this._canvas.appendChild( this.el ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function for use with Array.prototype.filter() Sort logic for a supplied criterion (i.e. "Age", "Sex", "Nationality") | function sort_by(sort_criterion){
return function(x,y){
return (x[sort_criterion] < y[sort_criterion]) ? -1 : (x[sort_criterion] > y[sort_criterion]) ? 1 : 0;
}
} | [
"function sort() {\n var sortBy = sortOptions.value;\n\n if (sortBy === \"lname\") sortByLname();\n else if (sortBy === \"gender\") sortByGender();\n else if (sortBy === \"region\") sortByRegion();\n else sortByFname();\n}",
"function byAge(arr){\nreturn arr.sort((a, b) => a.age - b.age)\n}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getting venue information from API. Ajax call. | function getVenue(id) {
$.ajax({
url: `https://api.songkick.com/api/3.0/venues/${id}.json?apikey=${myApi}`,
method: "GET"
}).done(function(response) {
$d.trigger("venue:loaded", response.resultsPage.results.venue);
});
} | [
"getVenues() {\n const endpoint = \"https://api.foursquare.com/v2/venues/explore?\"\n const client_id = \"FDAMFVN2CLVPRFZSHTJCWLYP34V0FZ1U2N0EU3TO4QUDMBHZ\"\n const client_secret = \"1I1TBKGC1CI5Z5LMTCJJRUCFLK5AWPANS4QHHEGMDQXEMJWY\"\n const near = \"Hartford\"\n const query = \"live music\"\n con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
It will return you token It will internally call acquireTokenSilentAsync of azure ad authentication context Note: One time logged in required | getTokenAsync (resourceUrl: String, loginHint: String) {
return RNAzureAdal.acquireTokenSilentAsync(resourceUrl, loginHint);
} | [
"async acquireToken(/*scopes = ['user.read']*/) {\r\n this.waitingOnAccessToken = true\r\n // Override any scope\r\n let scopes = this.defaultScope()\r\n if (!msalApp) {\r\n return null\r\n }\r\n\r\n // Set scopes for token request\r\n const accessTokenRequest = {\r\n scopes,\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Manage NDEF message writing | function writeMessage() {
nfc.ontagfound = function(event) {
tagWriteOnAttach(event.tag);
};
nfc.ontaglost = writeOnDetach;
nfc.onpeerfound = function(event) {
peerWriteOnAttach(event.peer);
};
nfc.onpeerlost = writeOnDetach;
nfc.startPoll();
} | [
"_send(type, data) {\n this._midiOutput.send(type, _.extend(data, { channel: this._midiChannel } )); \n }",
"writeToDevice(address, message, encoding) {\n let data = Buffer.isBuffer(message)\n ? message\n : Buffer.from(message, encoding);\n return this._nativeModule.writeTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the date is NATURAL | function checkIfNatural(dateString){
var valid = new Date(dateString).getTime() > 0;
return valid;
} | [
"check_date(date){\n \n if(typeof(date) == 'undefined' || date == null)\n return false;\n \n return moment(date, 'YYYY-MM-DD').isValid();\n }",
"function ISDATE(value) {\n return value && Object.prototype.toString.call(value) == '[object Date]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Official list of reserved words | function getReservedWords() {
return [
'fn', 'caseof', 'match', 'if', 'default', 'catch',
'for', 'in', 'when', 'var', 'const', 'let', 'while',
'switch', 'function', 'with', 'else', 'super',
'enum', 'break', 'extends', 'new', 'class',
'try', 'continue', 'typeof', 'delete', 'return',
'static', '... | [
"visitNon_reserved_keywords_in_12c(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitNon_reserved_keywords_pre12c(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function getKeywords(){\n return gKeywords\n}",
"function isTermAllowed(term) {\n\n const value = term.toUpperCase();\n\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks render type of the engine and call the right function, is used multiple times inside render() and only in render(). | function renderByType() {
switch(templateEngineRequire.renderType()) {
case 'string':
renderStringFromFile(templateEngineRequire, viewPath, view.data, function(err,data) {
callback(err,data);
});
break;
case 'file':
renderFile(templateEngineRequire, viewPath, view.data, ... | [
"onRender() {}",
"_render() {\n if (this._connected && !!this._template) {\n render(this._template(this), this, {eventContext: this});\n }\n }",
"onRender()\n {\n /* var templateResourceType = _.template($('#template-resourcetype_collection_item').html());\n var resourceTypeCollectio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to retrieve the public path of the vendor used for chunking and apps specific assets | function getVendorPublicPath() {
return `${baseURL}/vendor/`;
} | [
"function setAssetPaths() {\n if (window.location.hostname == 'thedataface.com') {\n return 'https://thedataface.com/data/parental_leave/'\n } else if (window.location.hostname == 'the-dataface.github.io') {\n return 'https://the-dataface.github.io/parental-leave/data/'\n } else {\n return '/data/'\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a sizing item with the given stretch factor. | function createSizingItem(stretch) {
var item = new SizingItem();
item.stretch = stretch;
return item;
} | [
"stretchToMatch(ratio, integer = true) {\n let width = this.width;\n let height = this.height;\n let round = (x) => x;\n\n // To get integers, each dimension must at least be divisible by its ratio.\n if (integer) {\n round = Math.ceil;\n width += (ratio.width - width % ratio.width) % ratio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that is used to evaluate the movement of ball within the court boundary | function moveBall()
{
// evaluating boundary conditions for court, paddle and ball
var court = document.getElementById("court");
boundary = court.getBoundingClientRect();
var paddle = document.getElementById("paddle");
paddleBoundary = paddle.getBoundingClientRect();
var ball = document.g... | [
"function ballBoundary(){\n ballX = ballX + directionX;\n ballY = ballY + directionY;\n if (ballY >= (windowHeight - 5) || ballY <= 45){\n directionY = directionY * -1;\n }\n}",
"move() {\n //this.xVel += xVel;\n this.x = this.x + this.xVel;\n this.y = this.y + this.yVel;\n this.checkWalls();\n this.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the head of list if the list is not empty, or use `default` otherwise | function head_2(xs, default0) /* forall<a> (xs : list<a>, default : a) -> a */ {
return (xs != null) ? xs.head : default0;
} | [
"function minimum(xs, default0) /* (xs : list<int>, default : ?int) -> int */ {\n var _default_22229 = (default0 !== undefined) ? default0 : 0;\n return (xs == null) ? _default_22229 : foldl(xs.tail, xs.head, min);\n}",
"function maybe_5(xs) /* forall<a> (xs : list<a>) -> maybe<a> */ {\n return (xs == null) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the available tiles as an array of associated char values. | function getTileArray () {
var tileArray = $(".mdl-card__title-text").toArray();
var result = [];
tileArray.forEach(function (item) {
result.push($(item).text().charCodeAt(0));
});
return result;
} | [
"function extractBoardToArray()\n{\n // Clear board array\n initBoardArray();\n\n // Board tiles have these properties : div class=\"board_pusher\" id=\"pusher_x_y\" (0..N-1)\n var tileNodes = document.querySelectorAll('[id*=pusher_]');\n if (tileNodes != null)\n {\n\n for(var i = 0; i < ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shadow.Object.extend Get the shadow ui attributes from an element. | function getShadowAttributes($element) {
var elementNode = $element[0]
var attributes = {}
;[].slice.call(elementNode.attributes).forEach(function(attr) {
var attrName = attr.name
if ( attrName.match(/^data-ui-/) ) {
var attrValue = $element.data(attrName.replace(/^data-/, ''))... | [
"attribs(arg) {\n let argtype = _Util_main_js__WEBPACK_IMPORTED_MODULE_1__.default.getType(arg).toUpperCase();\n switch (argtype) {\n case \"OBJECT\":\n this._elem.attribs(arg);\n return this;\n case \"UNDEFINED\":\n return this._elem.attribs();\n default:\n throw ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepare the browser instance, spawn a new page and set the default viewport and configurations | async prepare() {
const {
debug,
launchArgs
} = this.options;
const launchOpts = {
headless: !debug,
slowMo: debug ? 1000 : 0,
args: launchArgs
};
// Launch the browser instance
this.browser = await puppeteer.launch(launchOpts);
// Get the default about:blank ... | [
"async function instance(){\n const browser = await puppeteer.launch({\n headless: false\n })\n\n const page = await browser.newPage()\n return {page, browser}\n}",
"function createWindow(nodeint) {\r\n\treturn new BrowserWindow({\r\n\t\twidth: 800,\r\n\t\theight: 600,\r\n\t\twebPreferences: {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when back button is clicked after successful submission of feedback set state of feedSub to false | goBack() {
sessionStorage.setItem("feedsub",false)
this.setState({
feedSub:false
})
} | [
"feedSubmit() {\n sessionStorage.setItem(\"feedsub\",true);\n this.setState({\n feedSub: true\n })\n }",
"function showBackBt() {\n if (_historyObj.length > 1) {\n return true;\n } else {\n return false;\n }\n }",
"_togglePostCard() {\n this.setState({\n isSubmited: fa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that check uncompleted page | function checkUncompletedPage(userId) {
return new Promise((resolve, reject) => {
let query = 'SELECT ' + table.SUBMIT_LIST + '.* ' +
'FROM ' + table.SUBMIT_LIST +
' WHERE uid = ?'
db.query(query, [userId], (error, rows, fields) => {
if (error) {
reject({ message: message.... | [
"function checkPageDone(page) {\n var isDone = _.every(page.differences, function(d) { return d.state != \"in_use\"; });\n if (isDone) {\n console.log(\"Marking page as done:\", page._id);\n page.state = \"done\";\n page.saveAsync();\n }\n return isDone;\n}",
"function validatePage_NoStatus(objPageNo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the active tab id. | function getCurrentTabId(callback) {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
callback(tabs[0].id);
});
} | [
"function getSelectedTab(tabs) {\n const childId = window.location.hash.split(\"=\")[1];\n return tabs.find(tab => tab.get(\"actor\").includes(childId));\n}",
"focusedTabIndex() {\n\t\tvar index = this.tabs.findIndex(function(tab) {\n\t\t\treturn tab === document.activeElement;\n\t\t});\n\n\t\treturn (index ===... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Index CategoryUser by userid and category id. | static index(userId, categoryId, shouldUpdate = true){
let kparams = {};
kparams.userId = userId;
kparams.categoryId = categoryId;
kparams.shouldUpdate = shouldUpdate;
return new kaltura.RequestBuilder('categoryuser', 'index', kparams);
} | [
"static index(id, shouldUpdate = true){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\tkparams.shouldUpdate = shouldUpdate;\n\t\treturn new kaltura.RequestBuilder('category', 'index', kparams);\n\t}",
"static update(categoryId, userId, categoryUser, override = false){\n\t\tlet kparams = {};\n\t\tkparams.catego... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : checkPortSpeedIfMatch AUTHOR : Marlo Agapay DATE : January 8, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS : | function checkPortSpeedIfMatch(leftObjPath,rightObjPath){
var d = rightObjPath.split(".");
var rightDevicePath = d[0];
var leftSpeed = "";
var rightSpeed ="";
var rightDeviceName = "";
var condition = true;
if(globalInfoType == "JSON"){
var pathArr = leftObjPath.split(".");
var pathArr2 = rightObjPath.split(... | [
"function checkAvPortForConnect(lineConnectedDevice, toConnectDevice,lineLocation,srcObj,devObj){\n\tif(globalInfoType == \"JSON\"){\n\t\tvar pathArr = lineConnectedDevice.split(\".\");\n \tvar prtArr = getAllPortOfDevice(pathArr[0]);\n }else{\n var prtArr= portArr;\n \t}\n\tvar portTempArr = prtArr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If we want to get all the Playlists | function getPlaylists() {
return axios.get(endpoints.playlist)
} | [
"function getPlaylist(callback){\n if(playlists.length == 0){\n loadPlaylists(callback);\n }\n else{\n callback(playlists);\n }\n}",
"async loadPlaylists(url) {\n\t\tlet response = await utils.apiCall(url, this.props.access_token);\n\t\tthis.setState({ playlists: response.items, nplaylis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes the zero tracking threshold value. When this threshold is larger than zero, any measure under the threshold will automatically be ignored and the zero compensation will be updated. Remember to call the saveToFlash() method of the module if the modification must be kept. | set_zeroTracking(newval)
{
this.liveFunc.set_zeroTracking(newval);
return this._yapi.SUCCESS;
} | [
"function resetThresholds() {\n \taccumDiff = 0;\n \taccumAmp = 0;\n \tsampleReadRemaining = sampleDecisionThreshold;\n}",
"function setThreshold({threshold, campaignId}) {\n return db.updateById(TABLE, KEY, campaignId, {swap_threshold: threshold})\n}",
"get threshold() {\n return (0, _Conversions.gai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
major_name = major name start_semester = int 0,1,2 start_year = int, year semesters = [semester, semester, ...] course_bank = [course, course, ...] | constructor(major_name, start_season, start_year) {
this.major = MAJORS.find(major => major.major_name == major_name);
console.log(this.major);
this.semesters = [];
this.course_bank = [];
this.transfer_bank = [];
this.fill_course_bank_w_req_classes();
for (var i = 0; i < 4; i++) {
//Makes 8 semester o... | [
"function semesterStart(year,sem) {\n var test;\n switch(year) {\n case \"2014-2015\": {\n //11-8-2014 & 12-1-2015\n if(sem==\"1\")\n test = moment(\"11082014\",\"DDMMYYYY\");\n else if(sem==\"2\")\n test = moment(\"12012015\",\"DDMMYYYY\");\n else if(sem==\"3\")\n test... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ChoiceTable constructor Creates a new instance of ChoiceTable | function ChoiceTable() {
var that;
that = this;
/**
* ### ChoiceTable.table
*
* The HTML element triggering the listener function when clicked
*/
this.table = null;
/**
* ### ChoiceTable.choicesSetSize
*
* How many ... | [
"function TableList() {\n this.tableList = {};\n }",
"function SectionTable(sectionList) {\n this._sectionList = sectionList;\n}",
"function generateTable() {\n emptyTable();\n generateRows();\n generateHead();\n generateColumns();\n borderWidth();\n}",
"createTable(x, y, z) {\n\t\t'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================== Auxiliary Bittering Compounds (nonIAA) compute loss factor for nonIAA based on pH Note: the actual effect of pH on nonIAA might be the same for all nonIAA (oAA, oBA, and hopPP), or it might be limited to the effect of pH on oAA. In other wor... | function compute_LF_oAA_pH(ibu) {
var LF_pH = 1.0;
var pH = ibu.pH.value;
var preBoilpH = 0.0;
var preOrPostBoilpH = ibu.preOrPostBoilpH.value;
if (ibu.pHCheckbox.value) {
// If pre-boil pH, estimate the post-boil pH which is the
// one we want to base losses on.
if (preOrPostBoilpH == "preBoilpH... | [
"function compute_LF_IAA_pH(ibu) {\n var LF_pH = 1.0;\n var pH = ibu.pH.value;\n var preBoilpH = 0.0;\n var preOrPostBoilpH = ibu.preOrPostBoilpH.value;\n\n if (ibu.pHCheckbox.value) {\n // If pre-boil pH, estimate the post-boil pH which is the\n // one we want to base losses on.\n if (preOrPostBoilpH... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Admitted Student Functions ALL ADMITTED count the number of admitted students | static async countAdmitted(){
const result=await pool.query('SELECT COUNT(studentid) AS count FROM admitted');
return result[0].count;
} | [
"function countStudents(arrayOfStudents) {\n const counts = {\n Gryffindor: 0,\n Slytherin: 0,\n Hufflepuff: 0,\n Ravenclaw: 0\n };\n arrayOfStudents.forEach(student => {\n counts[student.house]++;\n document.querySelector(\".gryffindorenlisted span\").innerHTML =\n counts.Gryffindor;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decompress an LZWencoded string | function lzw_decode(s) {
var dict = {};
var data = (s + "").split("");
var currChar = data[0];
var oldPhrase = currChar;
var out = [currChar];
var code = 256;
var phrase;
for (var i=1; i<data.length; i++) {
var currCode = data[i].charCodeAt(0);
if (currCode < 256) {
... | [
"function makeLZString()\n{\n //This software is copyrighted to Pieroxy (2013) and all versions are currently licensed under the very popular WTFPL.\n return function(){function o(o,t){if(!n[o]){n[o]={};for(var r=0;r<o.length;r++)n[o][o.charAt(r)]=r}return n[o][t]}var t=String.fromCharCode,r=\"ABCDEFGHIJKLMNOPQRS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register request and response bindings to the container | $registerRequestResponse() {
this.$container.bind('Adonis/Core/Request', () => Request_1.Request);
this.$container.bind('Adonis/Core/Response', () => Response_1.Response);
} | [
"register() {\n this._container.instance('expressApp', require('express')())\n\n //TODO: add Socket.io here @url https://trello.com/c/KFCXzYom/71-socketio-adapter\n\n this._container.register('httpServing', require(FRAMEWORK_PATH + '/lib/HTTPServing'))\n .dependencies('config', 'expressApp')\n .s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a form used to enter new book suggestions. Fixes | function makeBooksForm(service_email, user_name) {
var temp_str = user_name + "'s Book Suggestion Input";
var input_form = FormApp.create(temp_str);
input_form.setTitle(temp_str);
temp_str = "New book title";
var temp_question = input_form.addTextItem();
temp_question.setTitle(temp_str);
temp_question.... | [
"function createFormHandler(e) {\n e.preventDefault()\n// Add innerHTML apending to Brainstormer in this section\n const characterInput = document.querySelector(\"#user-edit-character\").value\n const setupInput = document.querySelector(\"#user-edit-setup\").value\n const twistInput = document.querySelector(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this.modelNew is the "more recent" of the two models involved in the upgrade process. It is the model we are upgrading the JSON object to. The upgradeMap is "forward looking" from the perspective of the "less recent" (or "current") model in that it shows the path from the less recent model to the "more recent". | getUpgradeMap(model) {
let upgradeMap = {};
for (let newTableName in model.tables) {//this gets the STRING name of the property into 'table'
let newTableObject = model.tables[newTableName];//this on the other hand, gets the whole table object
for (let newColumnName in newTableObject.columns)
... | [
"stateVersionUp (originalState, currentState) {\n if (originalState.version !== currentState.version) {\n const newVersionState = this.clone(originalState, currentState)\n const versionUpTasks = (newVersion, id) => {\n newVersion[id] = {}\n for (const i in originalState.tasks['format']) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trigger the attack/decay portion of the ADSR envelope. | triggerAttack(time, velocity = 1) {
this.log("triggerAttack", time, velocity);
time = this.toSeconds(time);
const originalAttack = this.toSeconds(this.attack);
let attack = originalAttack;
const decay = this.toSeconds(this.decay); // check if it's not a complete attack
const currentValue = this... | [
"update() {\n this.checkRange();\n if (!this.target)\n return;\n this.timeToNextAttack--;\n if (this.timeToNextAttack === -1)\n this.attemptAttack();\n }",
"fight(d){\n // check player range\n if(this.canAttack(30,50,d)){\n damagePlayer(attackD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create an EBML block from an identifier and a list of Uint8Array parts. Return a single Uint8Array. | function createDataBlock(identifier, parts)
{
identifier = new Uint8Array(identifier);
let dataSize = totalSize(parts);
let encodedDataSize = encodeLength(dataSize);
let result = new Uint8Array(identifier.byteLength + encodedDataSize.byteLength + dataSize);
let pos = 0;
result.set(new Uint8Arra... | [
"function createBlock(text) {\n let block = {};\n const currBlock = Blockchain.blocks.length;\n const prevBlock = currBlock - 1;\n block.index = currBlock;\n block.prevHash = Blockchain.blocks[prevBlock].hash\n block.data = text;\n block.timestamp = Date.now();\n block.hash = blockHash(block);\n return blo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Example matrix = [[1, 2, 1], [2, 2, 2], [2, 2, 2], [1, 2, 3], [2, 2, 1]] the output should be differentSquares(matrix) = 6. | function differentSquares(matrix) {
let matrices = [];
for(let i = 0; i < matrix.length - 1; i++){
let grid = '';
for(let j = 0; j < matrix[0].length - 1; j++){
grid = matrix[i][j].toString() + matrix[i][j+1] + matrix[i+1][j] + matrix[i+1][j+1];
// push ... | [
"function sumSquareDifference(n) {\n const sum = (total, value) => total += value;\n const values = Array.from(new Array(n), (x, i) => x = i + 1);\n const squareOfSums = values.reduce(sum) ** 2;\n const sumOfSquares = values.map((value) => value ** 2).reduce(sum);\n return squareOfSums - sumOfSquares;\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
?? vl2s length2sq 0 3 vMath.length2(A) FL_R FL_V A A vMath.zeroV() | static length2sq(it) { return (it.x*it.x)+(it.y*it.y); } | [
"static length3sq(it) { return (it.x*it.x)+(it.y*it.y)+(it.z*it.z); }",
"function vectorLength([[x1, y1],[x2, y2]]){\n return Math.sqrt(Math.pow((x1-x2),2) + Math.pow((y1-y2),2))\n}",
"lengthSquared(a) {\n return quat.squaredLength(this);\n }",
"static length3(it) { return Math.sqrt( (it.x*it.x)+(it.y*it... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
expects a table row element, appends a newly created td element from the value | function appendTd(tr, value) {
let newTd = document.createElement('td');
newTd.innerText = value;
tr.append(newTd);
} | [
"function addCell(tr, x) {\n var td = document.createElement(\"td\");\n\n td.innerHTML = x;\n\n tr.appendChild(td);\n}",
"function addCell(sel, value) {\r\n $(sel).append(\"<td>\" + value + \"</td>\");\r\n}",
"function createCell(row, content) {\n // insert cell at the end of the row\n var cel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is used to revoke waiting gif | function revokeWaitingGIF() {
// Richfaces.hideModalPanel('loadingPanel');
// document.body.style.cursor = 'default';
revokeWaitingGIfForSave();
} | [
"function loadingGif( _status ){\n\tif( _status == 'on')\n\t\t$('#icon-loading').css('visibility','visible')\n\telse\t\n\t\t$('#icon-loading').css('visibility','hidden')\n}",
"function closeGif() {\n $chosenGif.hide();\n}",
"function gifControl() {\n var state = $(this).attr('data-state');\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to change the UV Index background based on severity | function uvIndexBackground(uviNum) {
let uvi = $("#uvi");
console.log("uvi", uviNum);
// let uvIndP = $("#uvIndexPara");
if (uviNum >= 0 && uviNum < 3) {
uvi.css("background", "greenyellow");
} else if (uviNum >= 3 && uviNum <= 5) {
uvi.css("background", "yellow");
} else if (uviNum ... | [
"function uvStyles(uvIndex){\r\n\r\n \r\n if(uvIndex > 0 && (uvIndex < 3)) {\r\n \r\n cityUv.className = \"low\";\r\n \r\n }\r\n \r\n if(uvIndex > 3 && (uvIndex < 6)){\r\n \r\n cityUv.className = \"medium\";\r\n \r\n }\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |