query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
console.log(users_fields); format users to proper form | function format_users() {
var users_fields = [];
users_data.forEach(function (user) {
var fields = [];
fields.push(user.email);
fields.push(user.user_name);
fields.push(user.name.first);
fields.push(user.name.last);
fields.push("u of t"); //university
fields.push("CS"); // departmnet
fields.push(use... | [
"function setUsersToUserField(fieldName, users) {\n for (var i = 0; i < users.length; i++) {\n if (typeof (users[i]) == 'number') {\n ////user id\n getUserById(users[i], function (user) {\n var userName = user.get_loginName();\n if (userName.indexOf(\"i:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that selects a range in the text object passed as parameter | function selectRange(oText, start, length)
{
// check to see if in IE or FF
if (oText.createTextRange)
{
//IE
var oRange = oText.createTextRange();
oRange.moveStart("character", start);
oRange.moveEnd("character", length - oText.value.length);
oRange.select();
}
else
// FF
if (oText.setSelectionRange)
{
oText.setSelect... | [
"function selectRange(id, start, end, expectedText) {\n var element = document.getElementById(id);\n var startExtent = element.getExtentOfChar(start);\n var endExtent = element.getExtentOfChar(end);\n\n var startPos = element.getStartPositionOfChar(start);\n var endPos = element.getEndPositionOfChar(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove all note icon | function removeAllNoteIcon() {
removeTagsByName('icnote');
} | [
"function removeNote(){}",
"clearIcons() {\n const icons = this.root.querySelectorAll('.icon');\n icons.forEach((icon) => {\n icon.remove();\n });\n }",
"function resetCopyNotes() {\n const $notes = $copy_icons.siblings(COPY_NOTE_SELECTOR);\n toggleHidden($notes, true).text('');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Swap the position of the two items in this list at :itemIndex1: and :itemIndex2: | swapItems(itemIndex1, itemIndex2) {
const items = this.props.items.slice();
const temp = items[itemIndex1];
items[itemIndex1] = items[itemIndex2];
items[itemIndex2] = temp;
this.props.onChange(items);
} | [
"function swap(items, firstIndex, secondIndex) {\n\n var temp = items[firstIndex];\n items[firstIndex] = items[secondIndex];\n items[secondIndex] = temp;\n\n }",
"function swapItems(arr,index1,index2){\n temp=arr[index1];\n arr[index1]=arr[index2];\n arr[index2]=temp;\n return arr;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create Json for delete Space | function deleteSuccessJson(resJson) {
let data = {};
resJson = {
"status": "SUCCESS",
"data": null,
"msg": "Space Deleted Successfully",
"errormsg": "",
}
return resJson;
} | [
"_toDeleteJSON(){\n if(this.characterId){\n return { characterId: this.characterId };\n } else if(this.comicId){\n return { comicId: this.comicId };\n }\n }",
"function deleteSpace (space) {\n var spaceIdParams = { spaceId: space._id };\n return $http.delete('/api... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if the player enters the command KILL SYSTEM | function commandKillcode(game_ID, player_ID, parameter, executeCommand) {
getPlayer(player_ID, function(playerfound) {
let currentRoom = playerfound.room;
let output = null;
if(currentRoom == "/root") {
if(parameter == "SYSTEM") {
output = "SYSTEM SHUTDOWN";
... | [
"kill() {\n this.cmd = KILL;\n return this.send();\n }",
"function killsay() {\r\n if (!UI.GetValue(\"Misc\", \"JAVASCRIPT\", \"Script items\", \"Enable Killsay\")) return;\r\n if (Entity.GetEntityFromUserID(Event.GetInt(\"attacker\")) == Entity.GetLocalPlayer()) {\r\n kill_time = Globals.Real... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getIgnoreKeywordsHash() Get a hash of all keywords to ignore. | function getIgnoreKeywordsHash() {
var ignorekeywords = getIgnoreKeywords();
var ignorekeywordshash = {};
for(i = 0; i < ignorekeywords.length; i++) {
ignorekeywordshash[ignorekeywords[i]] = 1;
}
return ignorekeywordshash;
} | [
"function getSkipWords() {\n\t\tif($('.ignore-common-words').is(':checked')) {\n\t\t\treturn getIgnoreKeywordsHash();\n\t\t}\n\t\t\n\t\treturn {};\n\t}",
"function getIgnoreKeywords_allWords_H_Words() {\n\t\treturn [\n\t\t\t'ha',\n\t\t\t'had',\n\t\t\t'hadn\\'t',\n\t\t\t'half',\n\t\t\t'happen',\n\t\t\t'happened',\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
20 Create a function called evenIndexOddLength that accept an array of strings and return a new array that have the string with odd length in even index var strings= ["alex","mercer","madrasa","rashed2","emad","hala"] Ex: evenIndexOddLength(strings) => ["madrasa"] solve it one time using for loop and another using whil... | function evenIndexOddLength(str){
var arr2=[]
for(i=0;i<str.length;i++){
if(i%2==0){
var length=str[i].length;
if(length%2==1){
arr2.push(str[i])
}
}
}
return arr2;
} | [
"function evenIndexOddLength(str){\n newArray=[];\n newIndex=0;\n for (i = 0; i< str.length ; i++){\n if (str[i].length %2 != 0 && i%2 ==0){\n newArray[newIndex]=str[i];\n newIndex ++;\n }\n} return newArray;\n}",
"function evenIndexOddLength(strArray){\n\tvar len=strArray.length;\n\tv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ESsecstring.prototype.padend / String.prototype.padEnd(maxLength [, fillString]) | padEnd(maxLength, fillString) {
CHECK_OBJECT_COERCIBLE(this, "String.prototype.padEnd");
var thisString = TO_STRING(this);
return thisString + StringPad(thisString, maxLength, fillString);
} | [
"function padEnd(len, fill, str) {\n\tvar l = str.length;\n\tif (l < len) {\n\t\tif (!PAD_CACHE.hasOwnProperty(fill)) {\n\t\t\tPAD_CACHE[fill]={};\n\t\t}\n\t\treturn str + (PAD_CACHE[fill][len-l] || (PAD_CACHE[fill][len-l]=(new Array(len-l+1).join(fill))));\n\t}\n\treturn (l === len) ? str : str.substring(0,len);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The scenes to be included in the build. If empty, the currently open scene will be built. Paths are relative to the project folder (Assets/MyLevels/MyScene.unity). | get scenes() {} | [
"function initScenes() {\n // the hardcoded list of scenes on the server\n sceneDescriptions = [\n \"scenes/scene1.json\",\n \"scenes/scene2.json\",\n \"scenes/normal_map_test.json\"\n ];\n\n // add the scenes stored in the users localStorage\n const keys = Object.keys(localStora... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Atualiza os feiticos conhecidos para uma determinada classe. | function _AtualizaFeiticosConhecidosParaClasse(chave_classe, div_classe) {
var feiticos_classe = gPersonagem.feiticos[chave_classe];
var tabelas_feiticos_classe = tabelas_feiticos[chave_classe];
var div_conhecidos = Dom('div-feiticos-conhecidos-' + chave_classe + '-por-nivel');
AjustaFilhos(
div_conhecido... | [
"function _AtualizaClasses() {\n var classes_desabilitadas = [];\n var div_classes = Dom('classes');\n var divs_classes = DomsPorClasse('classe');\n var maior_indice = divs_classes.length > gPersonagem.classes.length ?\n divs_classes.length : gPersonagem.classes.length;\n for (var i = 0; i < maior_indice;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Static method that allows casting a json object into an object of type User | static convertToUserObject(obj) {
return new User(obj["Gender"], obj["HeightCm"], obj["WeightKg"]);
} | [
"static fromJSON(json) {\n if (typeof json === 'string') {\n // if it's a string, parse it first\n return JSON.parse(json, AlexaResponse.reviver);\n }\n else {\n // create an instance of the User class\n const alexaResponse = Object.create(AlexaRespon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter a parse tree produced by LUFileParsermultiLineAnswer. | enterMultiLineAnswer(ctx) {
} | [
"main(){\n let argv = this.parseString.trim().split(' ');\n let directoryList = new Array();\n let fileList = new Array();\n let openFileList = new Array();\n let currentDirectory = \"\",\n currentFormat = \"\",\n rootPath = this.getRoothPathFromModal();\n\n if (argv.lengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
inner detect Silverlight version | function detectSilverlightVersion() {
try {
var a = ["1.0", "2.0", "3.0"], i = 3, ok,
o = _ie ? new ActiveXObject("AgControl.AgControl")
: navigator.plugins["Silverlight Plug-In"];
while (i--) {
ok = _ie ? o.IsVersionSupported(a[i])
: _float(/\d+\.\d+/.exec(... | [
"function detectSilverlightVersion(ie) {\r\n var rv = 0, obj, check = 3;\r\n\r\n//{{{!mb\r\n try {\r\n if (ie) {\r\n obj = new ActiveXObject(\"AgControl.AgControl\");\r\n while (obj.IsVersionSupported(check + \".0\")) { // \"3.0\" -> \"4.0\" -> ...\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
appendRowsToTable takes the storemane and appends a table row for each store | function appendRowsToTable(storeName) {
var arraySum = 0;
var rowinfo = '<td class="store">' + storeName.storeName + '</td>';
for ( var i = 0; i < storeName.salesByHour.length; i++) {
arraySum = arraySum + storeName.salesByHour[i];
rowinfo = rowinfo + '<td>' + storeName.salesByHour[i] + '</td>';
}
row... | [
"appendRows() {\n const newRows = [];\n for (let i = this.rows.length; i < this.store.data.length; i++) {\n let row = this.createRow(this.store.data[i]);\n this.rows[i] = row;\n this.data[i] = this.store.data[i];\n newRows.push(row);\n }\n this.tbody.append(...newRows);\n }",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialise thyratron rings These hold the pattern of 1s & 0s for each rotor on banks of thyraton GT1C valves which act as a onebit store. | initThyratrons(pattern) {
this.rings = {
X: {
1: INIT_PATTERNS[pattern].X[1].slice().reverse(),
2: INIT_PATTERNS[pattern].X[2].slice().reverse(),
3: INIT_PATTERNS[pattern].X[3].slice().reverse(),
4: INIT_PATTERNS[pattern].X[4].slice().r... | [
"stepThyratrons() {\n let X2bPtr = this.Xptr[1]-1;\n if (X2bPtr===0) X2bPtr = ROTOR_SIZES.X2;\n let S1bPtr = this.Sptr[0]-1;\n if (S1bPtr===0) S1bPtr = ROTOR_SIZES.S1;\n\n // Get Chi rotor 5 two back to calculate plaintext (Z+Chi+Psi=Plain)\n let X5bPtr=this.Xptr[4]-1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the date range for quickfilters | function setDateRangeFor(quickFilter) {
if (quickFilter.value === 'Custom dates') {
quickFilter.dateRange = {};
return;
}
var start = moment().utc().startOf('day');
var end = moment().utc().endOf("day"); //Now
switch (quickFil... | [
"setDateRange(range) {\n this.dateRange = range;\n this.filterLocations();\n }",
"dates_range(dates_range) {\n this.formData.filters[0].items = [\n dates_range.start_date,\n dates_range.end_date\n ];\n }",
"function onDateRangeSet(facet, values) {\n resetFilter(facet, values... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove a specific beta tester's access to test any builds of one or more apps. | function removeBetaTesterAccessToApps(api, id, body) {
return api_1.DELETE(api, `/betaTesters/${id}/relationships/apps`, { body })
} | [
"function removeBetaTestersFromAllGroupsAndAppBuilds(api, id, body) {\n return api_1.DELETE(api, `/apps/${id}/relationships/betaTesters`, { body })\n}",
"function individuallyUnassignBetaTesterFromBuilds(api, id, body) {\n return api_1.DELETE(api, `/betaTesters/${id}/relationships/builds`, {\n body,\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove all data lines | removeDataLines() {
this._linesData = [];
} | [
"removeDataLines() {\n this._linesData = [];\n }",
"removeAllLines() {\n this._linesData = [];\n this._linesAux = [];\n }",
"removeAllLines() {\n this._linesData = [];\n this._linesAux = [];\n }",
"function cleanInterpretLineStructures() {\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds class to the list item that has `h2` tag inside. The function is used for the custom ordered list on the Privacy pages. Styles applies in the `_sass/pages/_privacy.scss` file. | function addOrderedListTitleClass() {
if ($customOrderedList.length) {
const titleListItem = $customOrderedListTitle.parents('li');
titleListItem.addClass('title-list-item');
}
} | [
"function addClassToTitle() {\n let addClass = document.querySelector(\"h2\");\n addClass.className = \"myHeading\";\n}",
"function addClassToListItem() {\n const li = document.querySelectorAll(\".mobile-location-post-card-info ul li, .location-page-post-card-excerpt ul li, .front-page-post-card-excerpt ul l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::Route53RecoveryControl::SafetyRule.AssertionRule` resource | function cfnSafetyRuleAssertionRulePropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnSafetyRule_AssertionRulePropertyValidator(properties).assertSuccess();
return {
AssertedControls: cdk.listMapper(cdk.stringToCloudFormation)(properties.ass... | [
"function CfnSafetyRule_AssertionRulePropertyValidator(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 object... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
STORING THE CUSTOM FX PRESETS IN LOCALSTORAGE | function PK_FX_PRESETS () {
var presets = {};
this.Set = function (filter_id, obj) {
var arr = presets[ filter_id ];
if (!arr) {
arr = [];
presets[ filter_id ] = arr;
}
arr.push (obj);
localStorage.setItem ('pk_presetfx', JSON.stringify (presets));
return (arr);
}
this.Save = func... | [
"function loadPreset () {\n const preset = history[$('#presets').val()]\n $('#shape').val(preset.shape)\n $('#shape2').val(preset.shape2)\n $('#detune1').val(preset.detune1)\n $('#osc1detune').text(preset.detune1)\n $('#detune2').val(preset.detune2)\n $('#osc2detune').text(preset.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Data for a render target | function RenderTarget()
{
var size_;
var frameBuffer_;
var texture_;
var renderBuffer_;
} | [
"render(data) {\n this._renderTargets.forEach(renderTarget => {\n renderTarget.render(data)\n .catch(err => {\n console.error(`Failed to render ${renderTarget.constructor.name}: ${err}`);\n });\n });\n }",
"async getTargetData() {\n\t\tconst res = await targets.get(`/targets/${t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Produces an array of the specified number of bytes to represent the integer value. Default output encodes ints in little endian format. Handles signed as well as unsigned integers. Due to limitations in JavaScript's number format, x cannot be a true 64 bit integer (8 bytes). | function intToBytes_(x, numBytes, unsignedMax, opt_bigEndian) {
var signedMax = Math.floor(unsignedMax / 2);
var negativeMax = (signedMax + 1) * -1;
if (x != Math.floor(x) || x < negativeMax || x > unsignedMax) {
throw new Error(x + " is not a " + numBytes * 8 + " bit integer");
}
var bytes ... | [
"function ba2int(x) {\n assert(x.length <= 8, 'Cannot convert bytearray larger than 8 bytes');\n var retval = 0;\n for (var i = 0; i < x.length; i++) {\n retval |= x[x.length - 1 - i] << 8 * i;\n }\n return retval;\n}",
"function int64_to_bytes(num) {\n\t\tvar retval = [];\n\t\tfor (var i = 0; i < 8; i++)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a PaymentResponse or a PublicKeyCredential into an dictionary. | function objectToDictionary(input) {
let output = {};
if (input.requestId) {
output.requestId = input.requestId;
}
if (input.id) {
output.id = input.id;
}
if (input.rawId && input.rawId.constructor === ArrayBuffer) {
output.rawId = arrayBufferToBase64(input.rawId);
}
if (input.response && (i... | [
"fromDict(data) {\n let id = new Uint8Array(Buffer.from(data['credentialId'], 'base64url'))\n let isResidentCredential = data['isResidentCredential']\n let rpId = data['rpId']\n let privateKey = Buffer.from(data['privateKey'], 'base64url').toString(\n 'binary'\n )\n let signCount = data['sign... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
REST call to delete an issue particluar comment of the given repository and the owner. | function deleteIssueCommentInfoRequest(owner,issue,repo,githubtoken,commentid)
{
var sync = true;
var out = null;
var options = {
url : 'https://github.ncsu.edu/api/v3/repos/' + owner + '/' + repo + '/issues/comments' + commentid,
method: 'DELETE',
... | [
"async deleteComment(pr, context = \"default\") {\n const commentId = await this.getCommentId(pr, context);\n if (commentId === -1) {\n return;\n }\n this.logger.verbose.info(`Deleting comment: ${commentId}`);\n await this.github.issues.deleteComment({\n owne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unregister function to be used by the contained MatSortables. Removes the MatSortable from the collection of contained MatSortables. | deregister(sortable) {
this.sortables.delete(sortable.id);
} | [
"function _removeListeners() {\n MainViewManager.off(\".sort\");\n }",
"clearSorters() {\n const me = this;\n\n me.sorters.length = 0;\n\n me.sort();\n }",
"function removeSortedBy() {\n $('#sorted-by-component').remove();\n }",
"clearSorters() {\n const me = this;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
called when you mouseover a regular link or a separator | function SEDHTMLMenu_MouseOverLINKSEP(menuNum,e)
{
SEDHTMLMenu_OverDIV = "SEDHTMLMenu_" + menuNum + "_DIV";
SEDHTMLMenu_OpenMenu = menuNum;
getMenusToStayOpen(menuNum,true,true);
document.body.onmouseover = SEDHTMLMenu_BodyMouseOver;
cancelEventBubble(e);
return false;
} | [
"function mouseoverLink() {\n growStroke(this);\n animateSourceAndTarget(this, growRadiusWrapper, setTextVisible, \n makeNodeOpaque);\n}",
"function __cscs_mouseover_link() {\n\n $('#cscs-markdown-content').children(\"h1, h2\").each(function(index, element) {\n $(element).hover(\n functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a log item. `id` is optional and if supplied will set the id of the dom element created. | function addLogItem(text, id) {
var doScroll = log.scrollTop > log.scrollHeight - log.clientHeight - 1;
var item = document.createElement("div");
item.innerText = text;
if (id) {
item.id = id;
}
log.appendChild(item);
if (doScroll) {
log.scrollTop = log.scrollHeight - log.cli... | [
"function uiLog_log(event, target, id) {\n // creates an entry\n var entry = new Array();\n entry[\"event\"] = event;\n entry[\"target\"] = target;\n entry[\"id\"] = id;\n entry[\"time\"] = (new Date()).getTime();\n\n // adds all extra parameters to the entry\n var paramNumber = arguments.length-3;\n entry... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes duplicate query results for a particular element. (e.g. multiple `TestElement` instances or multiple instances of the same `ComponentHarness` class. | async function _removeDuplicateQueryResults(results) {
let testElementMatched = false;
let matchedHarnessTypes = new Set();
const dedupedMatches = [];
for (const result of results) {
if (!result) {
continue;
}
if (result instanceof ComponentHarness) {
if (... | [
"function clearResults() {\n results = document.querySelectorAll('.result');\n for(let i = 0; i < results.length; i++) {\n results[i].parentNode.removeChild(results[i]);\n }\n}",
"function discard_stale_results() {\n results = results.filter(function(result) {\n if(element_in_document(resu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
WRITE INFO ABOUT SET | async writeSetInfo(set) {
this.clearBasicAndSetViewUI();
const {
id, title, terms_number, creator,
} = set.dataset;
this.id = id;
setTitle.textContent = title;
for (let i = terms_number; i >= 4; i -= 1) {
setChooseTermsNumber.innerHTML += `
<option value="${i}" class="set-v... | [
"function writeInfo() {\n INFO.innerHTML = `CAMERA: ${JSON.stringify(camera)}<br/>` +\n `MOUSE: ${JSON.stringify(mouse)}`\n }",
"function writeGameInfo() {\r\n if (level >= 0 && level < stages.length - 1) {\r\n $(\"#shift-value\").text(\"Shift... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
move the tetromino right unless it is at the edge or there is a blockage | function moveRight() {
undraw()
const reachedRightEdge = curT.some(index => (curPos + index) % width === width - 1)
if (!reachedRightEdge) curPos += 1
if (curT.some(index => squares[curPos + index].classList.contains('taken'))) {
// if the position has been taken by another f... | [
"function moveRight() {\n undraw();\n\n //check if tetronimo is at the right edge\n const isAtRightEdge = currentTetromino.some(index => (currentPosition + index) % width === width - 1);\n\n //if not at right edge, move right by 1\n if (!isAtRightEdge) currentPosition += 1;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initalise ChromaKey DistyScroll. The scroller is given a ydist, and a background is projected "through" it. Throughout the course of the demo, we scroll through different backgrounds, and the background itself wobbles. So first we have to initalise the scroller, it's ydist, and the various backgrounds. | function scroller() {
SDFont = new image(DEMO_ROOT + "/common/resources/largeFont.png"); // Get the source font image
SDFont.initTile(32,16,32); // Set up the font
scrollScreen = new canvas(640,140); // Set the main scroll screen (after dist)
scrollOffScreen =... | [
"setupScrollingBG() {\r\n this.background.addChild(this.scrollingBG);\r\n }",
"function drawBackgroundScroll () {\n ctx.font = titleSettings.scrollFont\n ctx.fillStyle = titleSettings.scrollColor\n for (let j = 0; j < game.width/10; j++) {\n for (let i = 0; i < letterArray.length; i++) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Identify the most common encodings that are supersets of ascii at the singlebyte level (meaning that bytes in 0 0x7f range must be ascii) (this allows identifying line breaks and other ascii patterns in buffers) | function encodingIsAsciiCompat(enc) {
enc = standardizeEncodingName(enc);
// gb.* selects the Guo Biao encodings
// big5 in not compatible -- second byte starts at 0x40
return !enc || /^(win|latin|utf8|ascii|iso88|gb)/.test(enc);
} | [
"_determineEncoding(usedStrings) {\n const isHangul = c => (c >= 0xac00 && c < 0xd7b0) || (c >= 0x3130 && c < 0x3190)\n // Strings that seem to be Korean\n let korStrings = 0\n // Strings that don't seem to be Korean, but still have non-ASCII chars\n let otherStrings = 0\n // Strings that decode w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set a callback to run when the Google Visualization API is loaded. google.charts.setOnLoadCallback(drawDashboard); Callback that creates and populates a data table, instantiates a dashboard, a range slider and a pie chart, passes in the data and draws it. | function drawDashboard() {
// Create our data table.
_data = new google.visualization.DataTable(_jsonIn);
//data = _jsonIn;
// Create a dashboard.
var dashboard = new google.visualization.Dashboard(
document.getElementById('dashboard_div'));
// Create a range slider, passing some optio... | [
"function drawDashboard() {\n\n \t$.get(\"../statistics/suburb_bushfire_area_chart_2.csv\", function(csvString) {\n \t\tvar arrayData = $.csv.toArrays(csvString, {onParseValue: $.csv.hooks.castToScalar});\n\n \t\tvar data = new google.visualization.arrayToDataTable(arrayData);\n\n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PARA LLAMAR A LA FUNCION : UNION(AUTOMATA1,AUTOMATA2) Interseccion | function Interseccion(AUTOMATA1,AUTOMATA2){
var A1C, A2C, union, AFDUnion, Interseccion
A1C = complemento(AUTOMATA1)
A2C = complemento(AUTOMATA2)
union = Union(A1C,A2C)
AFDUnion = Equivalente(union)
Interseccion = complemento(AFDUnion)
return Interseccion
} | [
"addUnion() {\r\n let optionals = this.createUnion();\r\n this.addApplication(optionals.start);\r\n this.addApplication(optionals.end);\r\n }",
"Union() {\n /**\n * For points and lines, only a single union operation is\n * required, since the OGC model allowings self-intersecti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a new % for a new minmax range based on num's % between 1100 | subtlize(num, min, max) {
// turn number back into percent
let percent = num / 100;
// returns a new number that represents the percent between the min and max numbers
// e.g percent = 50%, min = 1, max = 8, should return 4
return Math.round((max - min) * percent + min);
} | [
"function changeRange(val, n_min, n_max, o_min, o_max){\n //changing the range of the number\n //NewValue = (((OldValue - OldMin) * \n // (NewMax - NewMin)) / \n // (OldMax - OldMin)) + \n // NewMin\n\n return (((val - o_min)*(n_max - n_min))/(o_max - o_min))+ n_min;\n}",
"function mapToRange... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if task has all required fields | function validTask(task) {
return Boolean(task.name && task.due_date);
} | [
"async validateAdditionalTasks() {\n }",
"function checkForMandatoryFields() {\n var recordAdded = false;\n for (var i = 0; i < mainProcess.length; i++) {\n if (mainProcess[i].description) { // main chevron diagram values are added\n recordAdded = true;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the GUID of a task. | function getTaskGuid(index) {
var defer = $.Deferred();
Office.context.document.getTaskByIndexAsync(index, function(result) {
if (result.status === Office.AsyncResultStatus.Failed) {
onError(result.error);
} else {
defer.resolve(result.value);
}
});
return defer.promise();
} | [
"_generateTaskID() {\n return UUID.uuid4();\n }",
"function getGuid() {\n return getUuid();\n}",
"async function getTaskId(){\n var allTasks = await getAllTasks(listID);\n\n taskID = '';\n\n allTasks.forEach(task => {\n if (taskName.includes(task.title.toLowerCase())) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to call in the event that the user drags an existing course into a new position param oldPosition object indicating the absolute position of the course within the sequence required properties: yearIndex, season, courseListIndex param newPosition '' | moveCourse(oldPosition, newPosition){
this.setState((prevState) => {
let courseSequenceObjectCopy = JSON.parse(JSON.stringify(prevState.courseSequenceObject));
let courseToMove = courseSequenceObjectCopy.yearList[oldPosition.yearIndex][oldPosition.season].courseList[oldPosition.courseL... | [
"addCourse(courseObj, newPosition){\n this.setState((prevState) => {\n\n // generate a unique key for the course\n courseObj.id = generateUniqueKey(courseObj, newPosition.season, newPosition.yearIndex, newPosition.courseListIndex, \"\");\n courseObj.isElective = \"false\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find val of index in arr, return ptr /null | function fGetPtr(arr, index, val){
for (var i = 0; i<arr.length; i++){
if (arr[i][index]==val) {return arr[i]}
}
return null;
} | [
"function findIndex(arr, val) {\n\n}",
"function getIndexOfExistVal(val, arr){\r\n return arr.indexOf(val); // return '-1' if not exist\r\n }",
"function arrayFindValue( arr, func, start ) {\n\t\tvar l = arr.length;\n\t\tfor ( var k=(start || 0); k<l; ++k ) {\n\t\t\tif ( func( arr[k] ) ) retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generic global eval which runs the embedded css and scripts | globalEval() {
// phase one, if we have head inserts, we build up those before going into the script eval phase
let insertHeadElems = new ExtDomQuery_1.ExtDomQuery(...this.internalContext.getIf(Const_1.DEFERRED_HEAD_INSERTS).value);
insertHeadElems.runHeadInserts(true);
// phase 2 we ru... | [
"eval(content, filename) {\n const wrapper = Module.wrap(content);\n const compiledWrapper = scriptRunner.runScript(wrapper, filename);\n const dirname = path.dirname(filename);\n const thiz = this;\n\n function NodeRequire(id) {\n return Module._load(id, thiz, false);\n }\n\n NodeRequire.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Speaker Verification methods 1. Start the browser listening, listen for 6 seconds, pass the audio stream to "createVerificationProfile" | function enrollNewTextIndependentVerificationProfile(){
navigator.getUserMedia({audio: true}, function(stream){
console.log('I\'m listening... just start talking for a few seconds...');
console.log('Maybe read this: \n' + thingsToRead[Math.floor(Math.random() * thingsToRead.length)]);
onMediaSuccess(stream, crea... | [
"function startListeningForTextIndependentVerification(){\n\tif (verificationProfile.profileId){\n\t\tconsole.log('I\\'m listening... just start talking for a few seconds...');\n\t\tconsole.log('Maybe read this: \\n' + thingsToRead[Math.floor(Math.random() * thingsToRead.length)]);\n\t\tnavigator.getUserMedia({audi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process one batch of pixels | function processBatch(batches) {
if (!batches.length) return;
const batch = batches.pop();
d3.range(0, batchSize, pixelSize).forEach(x => {
d3.range(0, batchSize, pixelSize).forEach(y => {
processPixel(
batch.x + x,
batch.y + y,
imageData,
... | [
"processPixels() {}",
"processPixels() {\n let x = 0;\n let y = 0;\n let odd = true;\n while (y < this.H) {\n this.pushToBucket(x, y);\n x += this.A;\n if (x > this.W) {\n y += (this.A / 4) * 3;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Swap values of two ranges. | function swap_ranges(first1, last1, first2) {
for (; !first1.equals(last1); first1 = first1.next()) {
iter_swap(first1, first2);
first2 = first2.next();
}
return first2;
} | [
"function iter_swap(x, y) {\r\n var _a;\r\n _a = __read([y.value, x.value], 2), x.value = _a[0], y.value = _a[1];\r\n}",
"_swapIndices(i1: number, i2: number): void {\n const temp = this._values[i1];\n this._values[i1] = this._values[i2];\n this._values[i2] = temp;\n }",
"function getSwapRange(r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the axis is used in the specified grid | function isAxisUsedInTheGrid(axisModel,gridModel,ecModel){return ecModel.getComponent('grid',axisModel.get('gridIndex')) === gridModel;} | [
"function isAxisUsedInTheGrid(axisModel,gridModel,ecModel){return ecModel.getComponent(\"grid\",axisModel.get(\"gridIndex\"))===gridModel}",
"function isAxisUsedInTheGrid(axisModel,gridModel,ecModel){\nreturn axisModel.getCoordSysModel()===gridModel;\n}",
"function isAxisUsedInTheGrid(axisModel, gridModel) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
"global" screenshot file count The default is to save screenshots to the root of your project even though there is a screenshots path in the config object above! ... so we need a function that returns the correct path for storing our screenshots. While we're at it, we are adding some metadata to the filename, specifica... | function imgpath (browser) {
var a = browser.options.desiredCapabilities;
var meta = [a.platform];
meta.push(a.browserName ? a.browserName : 'any');
meta.push(a.version ? a.version : 'any');
meta.push(a.name); // this is the test filename so always exists.
var metadata = meta.join('~').toLowerCase().replace... | [
"getTestScreenshotFilename() {\n let key = this.getKey();\n return `test-screenshot-${key}.png`;\n }",
"function getUniqScreenshotName() {\n //use the current date/time \"now\" variable captured when the program first ran \n //for the folder names\n const todaysDate = dateFormat(now, \"mm_dd_y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if the status toggle is checked. | function checkToggleStatus(status) {
if (status.Description === "Granted") {
is_code_changed = true;
toggle_status.bootstrapToggle('on');
toggle_status.attr('status_id', status.Id);
} else {
toggle_status.bootstrapToggle('off');
toggle_status.attr('status_id', status.Id);... | [
"checkToggle(shouldCheck) {\n this.toggle.checked = shouldCheck;\n }",
"checkToggle(shouldCheck) {\n this.toggle.checked = shouldCheck;\n }",
"toggleCheckOutStatus(){\n return this._isCheckOut == false ? true : false;\n }",
"toggleCheckOutStatus() {\n //negate the va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update cutting pointer position | updateCuttingPointerPosition() {
if (!this.cuttingPointer) {
return;
}
const pivotPoint = this.pivotPoint.get();
const { x: wpox, y: wpoy, z: wpoz } = this.workPosition;
const x0 = wpox - pivotPoint.x;
const y0 = wpoy - pivotPoint.y;
const z0 = wpoz - pivotPoint.z;
... | [
"updateCuttingToolPosition() {\n if (!this.cuttingTool) {\n return;\n }\n\n const pivotPoint = this.pivotPoint.get();\n const { x: wpox, y: wpoy, z: wpoz } = this.workPosition;\n const x0 = wpox - pivotPoint.x;\n const y0 = wpoy - pivotPoint.y;\n const z0 = wpoz - pivotPoin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use either app database or testing database | function getDatabase() {
return(process.env.NODE_ENV === 'test')
? 'piratechicks_test'
: process.env.DATABASE_URL || 'piratechicks';
} | [
"get database() { throw new Error('The database is not available in tests.'); }",
"function getDatabaseUri() {\n return (process.env.NODE_ENV === \"test\")\n ? \"petfinder_test_db\"\n : process.env.DATABASE_URL || \"petfinder_db\";\n}",
"setDBIfNotConfigured() {\n if (!this.constructor.db_a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method must be called after every move checks for winners by checking for 5 in a row checks for sandwiches and removes the centers updates the player turn information (however it is designed) | updateBoard(){
for(let x = 0; x<13; ++x) {
if(this.hasWinner){break;}
for (let y = 0; y < 13; ++y) {
if(this.hasWinner){break;}
if(this.getColor(x,y) !== 0){
this.removeSandwich(x,y);
if (this.hasFiveInARow(x,... | [
"performCastle(side, input) {\n // The row where the king and the rook should be.\n var rankToCheck = (this.moveLog.turn == \"W\" ? \"1\" : \"8\");\n // Stores the tiles that need to be empty in order to rook.\n var spaceNeeded;\n console.log(rankToCheck);\n\n if (side == \"queen\") {\n space... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Makes all elements in the body that have been hidden by `hideApp` visible again to screenreaders. | function showApp() {
if (!isHidden) {
return;
}
Object(external_lodash_["forEach"])(hiddenElements, function (element) {
element.removeAttribute('aria-hidden');
});
hiddenElements = [];
isHidden = false;
} | [
"function showApp() {\n if (!isHidden) {\n return;\n }\n\n Object(external_this_lodash_[\"forEach\"])(hiddenElements, function (element) {\n element.removeAttribute('aria-hidden');\n });\n hiddenElements = [];\n isHidden = false;\n}",
"function showApp() {\n if (!isHidden) {\n return;\n }\n\n Ob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the platform exist in BDMER3 url: BDMER3 url data: the platform which you want to check his existence | function checkPlatformExist(url, data) {
return new Promise(function(resolve, reject) {
let db = new PouchDB(url + "/platforms", {
skip_setup: true
});
db.allDocs({
include_docs: true
})
.then(function(doc) {
let names = [];
for (let row of doc.rows) {
if (
row.id
.toUpperCas... | [
"function check_platform_on_page(url, callback) {\n var domain = get_domain(url);\n\n chrome.storage.local.get(null, function (config) {\n\n console.log('config', config);\n\n if (config.sites && config.sites.indexOf(domain) > -1) {\n callback(true);\n }\n else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
using the fetchIdeas action creator to get an idea from the API | getIdeas() { this.props.fetchIdeas() } | [
"function getIdeas(space_url) {\n\n osapi.jive.corev3.ideas.get({\n fields: '@all',\n count: 50,\n place: space_url\n }).execute(function (response) {\n //console.log(\"Ideas: \"+JSON.stringify(response));\n\n var idea = response.list;\n var postIdea;\n var ide... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a state and (optional) stateParams, returns the inactivated state from the inactive sticky state registry. | function getInactivatedState(state, stateParams) {
var inactiveState = inactiveStates[state.name];
if (!inactiveState) return null;
if (!stateParams) return inactiveState;
var paramsMatch = equalForKeys(stateParams, inactiveState.locals.globals.$stateParams, state.ownParams);
ret... | [
"function getInactivatedState(state, stateParams) {\n var inactiveState = inactiveStates[state.name];\n if (!inactiveState) return null;\n if (!stateParams) return inactiveState;\n var paramsMatch = equalForKeys(stateParams, inactiveState.locals.globals.$stateParams, state.ownParams);\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The omniFrame API abstraction. Instantiates OmniCommFrame iframe embedded in div, to handle data transmission to the server, stores the object in vars.dataFrame, and initiates data transmission. | function dataFrame(options) {
var o = $.extend({
"parent" : 'body',
}, options),
key = makeKey();
$("body").append('<div id="'+dataDivId||'dataDiv'+'"></div>');
// Fix! We'll want to instantiate a secondary frame for secure processing and communications.
// v.dataFrame = new OmniCommFrame({
... | [
"function createOuiseoFrame() {\n var frame = document.createElement('div');\n frame.id = 'ouiseo_frame';\n return frame;\n }",
"function CIfFrame(windowId, left, top, width, height, appearance) {\n\n\n var wleft = left;\n var wtop = top;\n var wwidth = width;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds text to modal | function addModalText(text) {
$('.modal-content').append($('<p>').text(text));
} | [
"function createModal(text) {\n $(\"#modal-content\").text(text);\n $(\"#modal-content\").toggleClass(\"active\");\n }",
"function displayModal(text){\n\t$('#modal p').text(text);\n\t$('#modal').addClass('active');\n}",
"function addText() {\n\n // Add title\n dialogEl.querySelector( '#dialog... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a comment page and adds it to the DOM. | function drawCommentPage(imageId, page) {
var element = document.createElement('div');
element.className = "comment-page";
element.id = "page-" + page;
element.innerHTML=`
<div class="comments-page-title">Comments</div>
<div class="comments... | [
"function createCommentDOM(){\n var commentList = COMMENT_PAGES['page_' + CURRENT_COMMENT_PAGE];\n var $commentContainer = $('#u-comment-container');\n $commentContainer.empty();\n\n // If Page does not exist add an error prompt in DOM\n if(!commentList){\n var $pageNot... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a long (32bit value) to hex. | function toHexLong(value) {
value &= 0xFFFFFFFF;
// Convert two's complement negative numbers to positive numbers.
if (value < 0) {
value += 0x100000000;
}
return value.toString(16).toUpperCase().padStart(8, "0");
} | [
"function toHex32(n) {\n\tif (n > 0xffff)\n\t\treturn \"0x\"+ ((\"00000000\" + n.toString(16)).substr(-8));\n\telse\n\t\treturn \"0x\"+ ((\"0000\" + n.toString(16)).substr(-4));\n}",
"function long2str(long){\n var s = String.fromcharcode(\n //'& 0xff' removes everything except least significant byte\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MODIFIED to cater multiple language To set date format as ddmmmyyyy. Arguments: 1) Date field object. Sample Call: SP_SetDateFormat(oDate); | function SP_SetDateFormat(thisDate)
{
if(thisDate.value.search(' ') <= 0)
return;
var myDate,enteredDate;
enteredDate = thisDate.value.split(' ');
myDate = SP_CreateDateObject(enteredDate);
var day = (myDate.getDate() < 10) ? "0"+myDate.getDate(): myDate.getDate();
var year = myDate.getFullYear();
var mo... | [
"function SP_SetFormatDate(dFormat) {\n\tdateFormat = dFormat;\n}",
"function SP_CheckDateFormat(oField)\n{\n\tvar month,day,year,splitDate;\n\tvar alertMsg = \"\";\n\tvar showErrMsg = false;\n\t\n\tif(oField && SP_Trim(oField.value) != \"\")\n\t{\n\t\t// '-' is must for every date entry\n\t\tsplitDate = oField.v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Keeps the sign fixed on power operations | function signPow(value, p) {
let sign = value / Math.abs(value);
return sign * Math.pow(Math.abs(value), p);
} | [
"function reverseSign() {\n if (calc.inputWindow.indexOf(\"-\") === -1) {\n calc.inputWindow = \"-\" + calc.inputWindow;\n\n if (calc.midOperation) {\n calc.rightOperand = parseFloat(calc.inputWindow);\n } else {\n calc.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take a window and create various helper properties and functions | function makeWindowHelpers(window) {
let {clearTimeout, setTimeout} = window;
// Call a function after waiting a little bit
function async(callback, delay) {
let timer = setTimeout(function() {
stopTimer();
callback();
}, delay);
// Provide a way to stop an active timer
function stop... | [
"function testWindowPropertyValues( windowObject )\n{\n win = windowObject.open( \"windowHelper.html\", win_name, \n \"innerWidth=\"+inner_width+\", innerHeight=\"+inner_height );\n\t\n test( \"closed\", win.closed, false );\n test( \"defaultStatus\",win.defaultStatus, \"\" ); // Not defined\n test( \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets the sidebar scroll | _resetSidebarScroll() {
// sidebar - scroll container
$('.slimscroll-menu').slimscroll({
height: 'auto',
position: 'right',
size: '5px',
color: '#9ea5ab',
wheelStep: 5,
touchScrollStep: 20,
});
} | [
"function resetSidebar() {\r\n o.fixedScrollTop = 0;\r\n o.sidebar.css({\r\n 'min-height': '1px'\r\n });\r\n o.stickySidebar.css({\r\n 'position': 'static',\r\n 'width': '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function is checks if the serverlist exist locally if not it inserts it | function upsertServerList(list) {
var defer = $q.defer();
global.db.transaction(function (tx) {
var query = "select listLocalId, ifnull(deleted, 'N') deleted from list where listServerId = ?";
// check if list exists
var listLocalId;
console.log("aalat... | [
"function addServer() {\r\n\tvar newServer = document.getElementById('txt_addServer').value;\r\n\r\n\tif(GLOBAL_currentServers.indexOf(newServer) == -1) {\r\n\t\tGLOBAL_currentServers.push(newServer);\r\n\t\tsaveServers();\r\n\t} else {\r\n\t\tupdateStatus('That server already exists');\t\r\n\t}\r\n\r\n\treturn fal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: _fnEscapeRegex Purpose: scape a string stuch that it can be used in a regular expression Returns: string: escaped string Inputs: string:sVal string to escape | function _fnEscapeRegex ( sVal )
{
var acEscape = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^' ];
var reReplace = new RegExp( '(\\' + acEscape.join('|\\') + ')', 'g' );
return sVal.replace(reReplace, '\\$1');
} | [
"function _fnEscapeRegex(sVal) {\n\t\t\tvar acEscape = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']',\n\t\t\t\t\t'{', '}', '\\\\', '$', '^' ];\n\t\t\tvar reReplace = new RegExp('(\\\\' + acEscape.join('|\\\\') + ')', 'g');\n\t\t\treturn sVal.replace(reReplace, '\\\\$1');\n\t\t}",
"function _fnEscapeRegex(sVa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
automacaly logs all application throwed errors override this method to put your custom error handle like: callAdministrator(error) updateStatistics(error) | handle(req, res, error, callback) {
this.log.error(error.message, {
path: req.path(),
stack: error.stack,
error
});
// Override this method to put your custom error handle like:
// callAdministrator(error);
// updateStatistics(error);
... | [
"handleAppErrors() {\r\n this.app.on('error', (err, ctx) => {\r\n logger.error(`Application Error: ${ err.name } @ ${ ctx.method }:${ ctx.url }`);\r\n logger.error(err.stack);\r\n });\r\n }",
"function handleError() {}",
"function logErrors() {\n return (error, request, response, next) => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the point value of the given letter | function getLetterScore (letter) {
return 1; // For testing purposes
return config.pointValues[letter.toUpperCase()];
} | [
"function getPoints(letter){\n let index = Letters.indexOf(letter);\n return POINTS[index];\n}",
"function letterScore(letter) {\n return scrabblePointsForEachLetter[letter.toLowerCase()];\n}",
"function position(letter){\n //Write your own Code!\n return \"Position of alphabet: \" + (letter.ch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clearPaint() clear the drawing and move back to center clear(); | function clearPaint() {
$._clearPaint();
} | [
"function ClearPaint () {\n\t\tpaintPositions = new List.<PaintPosition>();\n\t\tpositionLength = 0;\n\t}",
"function reset() {\n myPaintArea.clear();\n}",
"function clearCanvas() {\r\n // Remove all the shapes.\r\n shapes = [];\r\n\r\n currentShape = -1;\r\n \r\n // Update the display.\r\n dr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sends data to the server | sendData(message, data){
this.socket.emit(message, data);
} | [
"function sendData() {\n if (!dataBuffer.isEmpty()) {\n influx.writePoints([{\n measurement: \"sensorData\",\n fields: dataBuffer.reduceValues(mean), // Compute mean of values\n tags: {\n context: contextInput.value,\n subject: subjectInput.va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
14 | pokemon Write a function called pokemon that accepts an array of numbers. Each element in the array represents a day, and the number represents the number of Pokemon caught on that day. i Return an array of the same length that contains the number of total Pokemon caught up to that day. | function pokemon(num_array) {
let num_pokemon = 0;
let array_pokemon = [];
for (let i = 0; i < num_array.length; i++) {
num_pokemon = num_pokemon + num_array[i];
array_pokemon.push(num_pokemon);
}
return array_pokemon;
} | [
"function getNumPokemon() {\n return pokemonData.length;\n}",
"function generatePokemonAry(){\n wildPokemon = []\n\n for (let i = 1; i < 650; i++) {\n wildPokemon.push(i);\n \n }\n return wildPokemon;\n \n}",
"function addPokemon(caughtPokemon)\r\n{\r\n player.didCatchPokemon=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: setUnloadStep3Viewer() Close the popup window when the parent is closed. Page Actions: Step 3 Image Popup Window Document Ready | function setUnloadStep3Viewer() {
$(window).unload( function () { imagePopup.close(); } );
} | [
"close() { grok_Viewer_Close(this.d); }",
"function closeProjectViewer() {\n\tif (projInfo.hasAttribute('data-oldContents')) {\n\t\tprojInfo.innerHTML = projInfo.getAttribute('data-oldContents');\n\t\tprojInfo.removeAttribute('data-oldContents');\n\t}\n\tif (pageHeader.hasAttribute('data-oldContents'))\n\t\tpageH... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a field from the collection by using internal name or title | getByInternalNameOrTitle(name) {
return new Field(this, `getByInternalNameOrTitle('${name}')`);
} | [
"getField(fieldName) {\n var returnField = null;\n this.getFields().forEach(function(field, index) {\n if (field.name === fieldName) {\n returnField = field;\n }\n });\n return returnField;\n }",
"getField(name) {\n return this.fields.find((a) => a.name === name);\n }",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hasRating: triggered after user rate the app request the server to know if actual user has rated the app and then create or edit the rating of him on app, depending of result | hasRating() {
axios.get(APP_URL + '/user/' + this.props.id_user + '/app/' + this.props.item.id_app + '/rating', {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('token')
}
})
.then(response => response.data)
.then(res => {
... | [
"function isRating() {}",
"function rateRecipe(rating) {\n var newRating = {\"public_rating\": rating};\n vm.userRatings = [{current: rating}];\n\n // If the user has already rated, update their current rating\n if (vm.ratingId) {\n // Update the rating in the model\n vm.detail.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolves global import aliases that map a prefix to a Kibana source directory Used for UI: Used for tests: | function resolveKibanaModuleImport(source, kibanaPath) {
debug(`resolveKibanaModuleImport: checking ${kibanaPath} for ${source}`);
const checkPaths = [
path.join(kibanaPath), // ui_framework/components
path.join(kibanaPath, 'src', 'core_plugins', 'dev_mode', 'public'), // ng_mock
path.join(kibanaPath, '... | [
"function resolvePluginsAliasImport(pluginsImport, kibanaPath, rootPath) {\n const { name: packageName } = require(path.resolve(rootPath, 'package.json'));\n const [ pluginName, ...importPaths ] = pluginsImport[1].split('/');\n debug(`resolvePluginsAliasImport: package ${packageName}, plugin ${pluginName}, impor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
determine whether the ball has collided with the slider | function collisionSlider() {
return (
ballX >= 680 &&
ballX <= canvas.width &&
ballY >= rectY &&
ballY <= rectY + 100
);
} | [
"function collided() {\r\n\tfor (let j = 0; j < allGraphic.length; j++) {\r\n\t\tlet ball = allGraphic[j];\r\n\t\tlet dis = Math.sqrt((playerBall.x - ball.x) ** 2 \r\n\t\t+ (playerBall.y - ball.y) ** 2);\r\n\t\tif (dis <= ballRadius) {\r\n\t\t\treturn true;\r\n\t\t};\r\n\t};\r\n\treturn false;\r\n}",
"function co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
level is boolean for being outer loop or not; message is message to display. | function toXLoop(level, instruction, recipient) {
oLoop = level;
iLoop = (recipient ? true : false);
wStep = 0;
wNope = false;
wStay = false;
rStep = 0;
message = {
"recipient": recipient || "",
"content": "",
"type": 1
};
weChatClient.log(3, instruction, -1);
} | [
"function updateLevelStatus(condition, level) {\n const newLevel = level || 0;\n condition.counter = newLevel;\n condition.status = newLevel >= condition.count ? \"Complete\" : \"In progress\"\n}",
"function nextLevelMessage() {\n $('#message-container #next-level').html(level);\n $('#message-container p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a new population of players | function generate(oldPlayers) {
var newPlayers = [];
for (let i = 0; i < oldPlayers.length; i++) {
// Select a player based on fitness
var player = poolSelection(oldPlayers);
newPlayers[i] = player;
}
return newPlayers;
} | [
"function newGeneration(){\n generation++;\n reset();\n normalize(all_player);\n living_player = generate(all_player);\n all_player = living_player.slice();\n}",
"assignPlayers (players) {\n const as = F.sample(players.length, this.countries)\n\n const bs = as.map((country, index) =>\n F... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: setupStatic Sets up this middleware by simply adding the express.js static middleware to the given app. Parameters: (Object) app Express.JS app (Object) config The loaded configuration | function setupStatic(app, config) {
app.use(express.static(path.join(config.srcDir, 'server', 'public')));
app.use(express.favicon(
path.join(config.srcDir, 'server', 'public', 'images', 'favicon.ico')
, { maxAge: 2592000000 }) // 30 days
);
} | [
"function attachStaticRoutes(app) {\n\n // Serve anything in 'static' directory\n app.get('/static/js/require-kernel.js', function (req, res, next) {\n res.header('Content-Type', 'application/javascript; charset: utf-8');\n res.write(minify.requireDefinition());\n res.end();\n });\n app.get('/static/*'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Can be called to explicitly enable event listening for clicks and touches outside of this element. | enableOnClickOutside() {
if (typeof this._wrappedInstance.handleClickOutside !== 'function')
throw new Error('Component lacks a handleClickOutside(event) function for processing outside click events.');
this.boundHandler = this.bindClickHandler();
if (document !== null) {
document.ad... | [
"disableOnClickOutside() {\n if (document !== null) {\n document.removeEventListener('mousedown', this.boundHandler);\n document.removeEventListener('touchstart', this.boundHandler);\n }\n }",
"_bindMouseAndTouchEvents() {\n var self = this;\n\n /* Mouse events */\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the filepath of the caller. Simply replace `.js` with `.yml` to get Fractal YML config filepath. | getFilePath() {
let filePath = callsites()[2].getFileName(); // [0] and [1] return global fractal.config.js.
return filePath.replace('.js', '.yml');
} | [
"function getConfigFilePath(){\n return path.join(getHomeDirectory(), '.rfcli.json');\n}",
"function callerPath () {\n return callsites()[2].getFileName()\n}",
"function _getFile() {\r\n if (msg && msg.client && msg.file && fs.existsSync(\"./jsSourceFiles/\" + msg.file + \".js\"))\r\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears all a11yapplied classes, events and the active DOM element reference | clearActiveElement() {
if (this.activeElement) {
if (this.activeElement !== this.activeRegion && this.activeElement !== this.activeSection) {
this.activeElement.classList.remove(A11yClassNames.ACTIVE);
this.activeElement.dispatchEvent(new Event(A11yCustomEventTypes.DE... | [
"resetActiveElement_() {\n if (!this.activeElement_) {\n return;\n }\n this.activeElement_.classList.toggle(\n 'i-amphtml-autocomplete-item-active',\n false\n );\n this.activeElement_.removeAttribute('aria-selected');\n if (this.activeElement_.getAttribute('id') === 'autocomplete-se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets all the local state on this scope | function resetLocalState() {
$scope.transactionSent = null;
$scope.transactionNeedsApproval = null;
clearReturnedTxData();
} | [
"reset() {\r\n this.state=this.initial;\r\n this.statesStack.clear();\r\n\r\n }",
"function resetLocalState() {\n $scope.transactionSent = null;\n $scope.transactionNeedsApproval = null;\n clearReturnedTxData();\n }",
"reset() {\r\n this.changeSt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is an extension to the readRevocationKeyDataFromFile function. Operations executed: 1. Reads a revocation key related data. 2. Checks if 'prevRevocationKey' data field needs to be normalised. 2.1 Normalises the data field if it is required. 3. Returns correct revocation key data. | async function readRevocationKeyDataAndUpdateKeysStatus (aliasName) {
function _normalisePrevRevocationKey (aliasName, revocationKeyData) {
let revocationKeyData2 = {}
// Check if the 'nextDocData' section is available.
_checkRequiredDataField(revocationKeyData, "nextDocData", REVOCATION_KEY_DATA_FILENAME... | [
"function readRevocationKeyDataFromFile (aliasName) {\n const revocationKeyData = _readDataFromJsonFile(aliasName, REVOCATION_KEY_DATA_FILENAME)\n if (!revocationKeyData) {\n throw new Error(`Missing \"${REVOCATION_KEY_DATA_FILENAME}\" config file.`)\n }\n _checkRequiredDataField(revocationKeyData, \"prevRev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Action creator for changing page size in state. Reloads contacts after. | function changePageSize(limit) {
return function(dispatch) {
dispatch({ type: actionTypes_1.default.CHANGE_PAGE_SIZE, payload: limit });
dispatch(saveSettings());
dispatch(loadContacts());
};
} | [
"function changeSize(pizzaPage, size) {\n currentPizza.setSize(size);\n pizzaPage.updatePizzaUI(currentPizza);\n}",
"_handlePageSizeChange() {\n const sel = this.pageSizeCtrl.getValue();\n if (sel === 'custom') {\n $('.attributeModal').addClass('customPage');\n } else {\n $('.attributeModal')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: move Handles the moving of pieces. Paramaters: i I iterator of array j J iterator of array piece ID of piece (color(b,w), piece ID(r,h,k,p,b,q)) | function move(i,j,piece) {
i = Number(i);
j = Number(j);
console.log(i,j,piece);
if ((piece.charAt(0) == 'b' && isWhite || piece.charAt(0) == 'w' && !isWhite) && !lookupTile(2,i,j).highlighted) {
return;
} else if (lookupTile(2,i,j).highlighted) {
handleSpecialMoveCheck(lookupTile(2,currSelectedPiece.i,currSel... | [
"function move(i,j,piece) {\n\ti = Number(i);\n\tj = Number(j);\n\tconsole.log(i,j,piece);\n\tif ((piece.charAt(0) == 'b' && isWhite || piece.charAt(0) == 'w' && !isWhite) && !lookupTile(2,i,j).highlighted) {\n\t\treturn;\n\t} else if (lookupTile(2,i,j).highlighted) {\n\t\thandleSpecialMoveCheck(lookupTile(2,currSe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOTE: the relation between `beforeParamsRetrieved` and `beforeParamsSet` is a very tricky one! Here is a description on how it works with the respective actions of the macro browser. OPEN: `beforeParamsSet` is called with the currently set macro parameters passed as function params Any customizations of the MB markup h... | function beforeParamsRetrieved(params) {
var $form = $('.he-form');
var isCloseProcedure = $form.hasClass('macrobrowser-opened');
if ($form.length) {
$('.he-item-div:not([data-he-key="cssselector"])').each(function () {
var $container = $(this);
var visibility = $container.attr('data-visibility')... | [
"function editParams(insertIfNoParameters) {\n //whether to insert the macro in the rich text editor when editParams is called and there are no parameters see U4-10537 \n insertIfNoParameters = (typeof insertIfNoParameters !== 'undefined') ? insertIfNoParameters : true;\n //get the macro params... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the currentFilter to the clicked filter | function setFilter(clickedFilter) {
document.querySelectorAll(".filter-dropdown button").forEach((knap) => {
knap.classList.remove("selected");
});
clickedFilter.classList.add("selected");
currentFilter = clickedFilter.dataset.filter;
document.querySelector(".filter-heading p").textContent = `Filter by:... | [
"function selectFilter() {\n const clicledFilter = this;\n setFilter(clicledFilter);\n}",
"function setFilter(newFilter) {\n filter = newFilter;\n }",
"function setFilterSelected(selected) {\n vm.filterButton[0].selected = selected;\n }",
"function setCurrentFilter(currentFilter) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
//////////////////////////////////////////////////////// //////////////////////////////////////////////////////// Make the call to the server with the give id, url and data | function makeCall(id,url,data) {
request=initRequest();
response=null;
request.open("POST",url,false); ... | [
"function loadData(url, data, id) {\n\turl=document.sg.server+'/'+url;\n\t$.ajax(url, {\n\t\tdataType: 'jsonp',\n\t\tdata: data,\n\t\tsuccess: function(data, textStatus, jqXHR) {\n\t\t\tif (data.alert) {\n\t\t\t\tconsole.log('Got alert: '+data.alert);\n\t\t\t\talert(data.alert);\n\t\t\t}\n\t\t\tif (data.goto) {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the template of file. | setTemplate(template) {
this.template = template;
} | [
"function set_template( name ){\n\t\tdocument.body.innerHTML = fs.readFileSync('./test/templates/'+name+'.html');\n\t}",
"template(value) {\n var tag = this.tag;\n var dirname = this.dirname;\n\n var path = nodePath.resolve(dirname, value);\n\n try {\n taglibConfig.fs.statSync(path);\n tag.t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= Description Default keyUp event responder method. Does nothing by default. Extend the keyUp method, if you want to do something when a key is released and the component is active. = Parameters +_keycode+:: The ascii key code of the key that was released. | keyUp(_keycode) {} | [
"keyDown(_keycode) {}",
"function keyUp(event) {}",
"function keyUp(event) {\n inputManager.keyUp(event);\n }",
"function on_key_up(vkey) {}",
"keyUp(key) {\n this.dispatchEvent(new KeyboardEvent(\"keyup\", { key }));\n }",
"function keyReleased() {}",
"keyDown(keyCode) {\n\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Definition for type : SoundControllerBrowser | function SoundControllerBrowser(name, root) {
this.name = name;
this.root = (root === null)? this : root;
this.ready = false;
this.bus = (root === null)? new EventEmitter() : this.root.bus;
this.build(name);
} | [
"function SoundControllerBrowserRND(name, root) {\n\tthis.name = name;\n\tthis.root = (root === null)? this : root;\n\tthis.ready = false;\n\tthis.bus = (root === null)? new EventEmitter() : this.root.bus;\n\t\n\tthis.build(name);\n}",
"constructor(sound) {\n this._sound = sound;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============with an other robot and obstacles===================== | function moveForwardWithAnotherRobotAndObstacles (robot) {
let theRobot;
let otherRobot;
let blockingObstacles = 0;
let blockingRobot = 0;
switch(robot){
case rover1 :
theRobot=rover1;
otherRobot=rover2;
break;
case rover2 :
theRobot=rover2;
otherR... | [
"function Obstacle() {\n\n//this.vide est l'espace entre le milieu (height/2) et une extremité\nthis.vide = random(60, 200);\n//this.distance correspond au vide total entre les 2 obstacles\nthis.distance = int(this.vide *2);\n\n//correspond à la hauteur des 2 obstacles\nthis.hauteurObs = height/2 - this.vide;\n\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepare the task service | async prepareTask() {
this.options.task && (this.task = await this.addService('task', new this.TaskTransport(this.options.task)));
if(!this.task) {
return;
}
if(this.options.task.calculateCpuUsageInterval) {
await this.task.add('calculateCpuUsage', this.options.task.calcu... | [
"async prepareTask() {\n this.options.task && (this.task = await this.addService('task', new this.TaskTransport(this.options.task)));\n\n if(!this.task) {\n return; \n }\n\n if(this.options.task.workerChangeInterval) {\n await this.task.add('workerChange', this.options.task.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Upload the created score image and details | function uploadImage(req, res) {
// title description license duration keysig pages secret parts url
var scoreId;
var userId = req.body.userId;
var username = req.body.username;
var title = req.body.title;
var description= req.body.description;
var lice... | [
"function uploadScore(){\n \n}",
"function uploadScore() {\n var xmlhttp = new XMLHttpRequest();\n var data = [name, avatarDir, score];\n xmlhttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n }\n };\n xmlhttp.open(\"POST\", \"uploadScore.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
displays the player in phaser js | function displayPlayer(player)
{
player.sprite = createPlayer(player.x, player.y, player.key);
player.sprite.scale.setTo(0.25,0.25);
} | [
"showPlayer() {\n this.player.style.display = 'block';\n }",
"function displayPlayer() {\n push();\n noStroke();\n fill(player.color);\n ellipse(player.x, player.y, player.size);\n pop();\n}",
"function showCurrentPlayer()\n{\n // @TODO: Implementeren van het laten zien welke speler aan de beu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shuffles words and globalPool arrays. | static shuffle() {
shuffleWords(words);
shuffleWords(globalPool);
} | [
"function shuffle() {\n for (var i = 0; i < words.length; i++) {\n var temp = words[i];\n var randomNumber = Math.floor(Math.random() * words.length);\n words[i] = words[randomNumber];\n words[randomNumber] = temp;\n };\n }",
"buildAndShuffleWords() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
enforest works over: prev a list of the previously enforest Terms term the current term being enforested (initially null) rest remaining Terms to enforest | enforest() {
let type = arguments.length <= 0 || arguments[0] === undefined ? "Module" : arguments[0];
// initialize the term
this.term = null;
if (this.rest.size === 0) {
this.done = true;
return this.term;
}
if (this.isEOF(this.peek())) {
this.term = new _terms2.d... | [
"function enforest(toks, context, prevStx, prevTerms) {\n assert(toks.length > 0, 'enforest assumes there are tokens to work with');\n prevStx = prevStx || [];\n prevTerms = prevTerms || [];\n if (expandCount >= maxExpands) {\n return {\n result: null,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private method add a contribution | _setContribution(contribution){
this.contributions.push(contribution);
this.currentContribution = this.contributions.length - 1;
this._updateContent(this.contributions[this.currentContribution].content);
} | [
"function addContribution(cacheID, contribution) {\n var contentsRef = cachesRef.child(cacheID).child('contents');\n contentsRef.push(contribution);\n // NOTE: The object structure is the following:\n // - CacheID\n // - contents\n // - ContributionID\n // - contributor\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a SDFObject to a Thing Model | function convert() {
const { fileName: sdfObjectFileName } = utils.getConsoleArguments();
const sdfObject = utils.getDataFromFile(sdfObjectFileName);
const sdfObjectConverter = new SDFObjectConverter(sdfObject);
const thingModel = sdfObjectConverter.convert();
const thingModelJSON = JSON.stringify(thingMode... | [
"function convertObject(obj_in)\n {\n\n }",
"objectToFeature(obj) {\n let feature = {\n type: 'Feature',\n properties: {},\n geometry: {\n type: 'GeometryCollection',\n geometries: []\n }\n }\n\n feature.properties.ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
begin suggestion existing virtuals when name input field is focused | nameFocus(e) {
this.suggestVirtual(e);
} | [
"onFocus() {\n\t\tthis.updateSuggestions();\n\t}",
"function searchAutoComplete() {\n if(self.selectedChoice() == 'name') {\n autoCompleteSource(nameArr);\n } else {\n autoCompleteSource(addrArr);\n }\n}",
"function _onFocus() {\n setShowSuggestions(true)\n }",
"onFocus() {\n if (this.st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |