query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
helper function to record solution/hint requests | function recordHintRequest (index) {
thiz.$recordEvent(label, 'exercise_hint', {
type: solution !== null ? 'solution' : 'hint',
index: index
})
} | [
"function solveRequest() {\n\n }",
"function logAndRespond(currAnswer, currQuestion, input, res) {\r\n log = log + `${userName}: ${input}<br>`;\r\n log = log + `Eliza: ${currAnswer}<br> Eliza: ${currQuestion}<br>`;\r\n respond(currAnswer, currQuestion, res);\r\n}",
"handleHint() {\n console.log(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changing item description from js file | function descItem(item){
exec("py description.py " + item[0] + " " + item[1] + " " + item[2]);
} | [
"function get_description() {\n\treturn \"Description Goes here\";\n}",
"function ajaxProjectDescription(description) {\n let descriptionObject = document.getElementById('description');\n if (description) {\n descriptionObject.textContent = description;\n }\n}",
"function updateDesc(newDesc) {\r\n $(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is a noop as file detectors are not supported by this implementation. | setFileDetector() {} | [
"setFileDetector() { }",
"function makeFileDetector() {\n const eidSet = {}; // to prevent duplicates // TODO: is this still useful, now that we de-duplicate in toDetect ?\n return function detectMusicFiles(url, cb, element) {\n const [fileName, ext] = url.split(/[/.]/).slice(-2);\n if (ext !== 'm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pops MS and stores the result as the current modelMatrix | function gPop() {
modelMatrix = MS.pop();
} | [
"function gPop() {\n modelMatrix = MS.pop();\n}",
"function gPop() {\n modelMatrix = MS.pop() ;\n}",
"function mvPopMatrix() {\n if (mvMatrixStack.length == 0) {\n throw \"No 'model-view' matrix to pop!\";\n }\n mvMatrix = mvMatrixStack.pop();\n}",
"function popMatrix() {\n modelview = ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate HTML for hyperlinks. | function formatHyperlink(text, url) {
return `<a href="${url}">${text}</a>`;
} | [
"getHyperlink() {\n return ((this.href && this.href.length !== 0) ?\n h(\"a\", { class: \"hyperlink\", href: this.href, \"aria-label\": this.accessibility, title: this.heading }, this.heading)\n :\n h(\"a\", { class: \"hyperlink disable\", \"aria-label\": this.accessibili... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clear output xlsx obj | function clear() {
return this.sheet
} | [
"excelClear() {\n const that = this;\n\n that.tree.select('0');\n that.filterObject.clear();\n that.cachedFilter = that.tree.selectedIndexes.slice(0);\n }",
"function clearExcelData() {\n\tfor (var row = 0; row < staffCollection.length; row++) { \n\t\tstaffCollection = generateStaff... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the payload type for a GraphQL mutation. Uses the provided output fields and adds a `clientMutationId` and `query` field. | function createMutationPayloadGqlType(buildToken, config) {
return new graphql_1.GraphQLObjectType({
name: utils_1.formatName.type(config.name + "-payload"),
description: "The output of our `" + utils_1.formatName.field(config.name) + "` mutation.",
fields: utils_1.buildObject([
... | [
"function mutationWithClientMutationId(config) {\n\t var name = config.name;\n\t var inputFields = config.inputFields;\n\t var outputFields = config.outputFields;\n\t var mutateAndGetPayload = config.mutateAndGetPayload;\n\t\n\t var augmentedInputFields = function augmentedInputFields() {\n\t return _extend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the AWS access id. | getAccessId() {
return super.getAsNullableString("access_id") || super.getAsNullableString("client_id");
} | [
"get customerAwsId() {\n return this.getStringAttribute('customer_aws_id');\n }",
"getAccessId() {\n return super.getAsNullableString(\"access_id\")\n || super.getAsNullableString(\"client_id\");\n }",
"get awsAccountId() {\n return this.getStringAttribute('aws_account_id')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns logs for requested assessment id | getLogs(aId) {
check(aId, String)
return Logger.find({ aId }).fetch()
} | [
"getLog(id) {\n return axios.get(`/api/logs/${id}`);\n }",
"function GetEventsLog(id) {\n try {\n var data = { \"ID\": id };\n var ds = {};\n ds = GetDataFromServer(\"EventRequests/GetEventsLog/\", data);\n if (ds != '') {\n ds = JSON.parse(ds);\n }\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the CRC for the data bytes. | getDataCrc() {
// Bit endian.
const index = this.dataIndex + this.getLength();
return (this.getByte(index) << 8) + this.getByte(index + 1);
} | [
"computeDataCrc() {\n let crc = 0xFFFF;\n const index = this.dataIndex;\n const begin = index - 4;\n const end = index + this.getLength();\n for (let i = begin; i < end; i++) {\n crc = CRC_16_CCITT.update(crc, this.getByte(i));\n }\n return crc;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the dict of allowed headers for a given request | function getAllowedHeaders(req) {
const request = req.azuriteRequest;
if (req.azuriteOperation === Operations.Account.PREFLIGHT_BLOB_REQUEST) {
if (request.httpProps[N.ACCESS_CONTROL_REQUEST_HEADERS] === undefined) {
return {};
} else {
return request.httpProps[N.ACCESS_CONTROL_REQUEST_HEADERS]
... | [
"get headers(){\n\t\tvar result={};\n\t\ttry{\n\t\t\tvar headerNames = Myna.JavaUtils.enumToArray($server.request.getHeaderNames());\n\t\t\theaderNames.forEach(function(name){\n\t\t\t\t//try to detect date headers\n\t\t\t\ttry {\n\t\t\t\t\tresult[name] = new Date($server.request.getDateHeader(name));\n\t\t\t\t} cat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Colour object, should take its name, primary colour (500 on material colour chart) and a secondary colour (50 on material colour chart). Just add said object to colours array and it can be used within the web app itself. | function Colour(name, primary, secondary)
{
this.name = name;
this.primary = primary;
this.secondary = secondary;
} | [
"function makeColourObject(cName) {\r var myCol = new CMYKColor();\r var def = c_colourLookup[cName];\r\t\tif (typeof def === 'undefined') {\r\t\t\tdef = c_failsafeColour;\r\t\t}\r myCol.black = def.k;\r myCol.cyan = def.c;\r myCol.magenta = def.m;\r myCol.yellow = def.y;\r return myCol;\r}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This init happens some time after the constructor is called. It's intended to be called whenever a tool is added to a subwindow. This late init is intended for catching events after construction. | subwindowInit() {} | [
"function init() {\n this._wm_tracker = Shell.WindowTracker.get_default();\n\n this._overviewHidingSig = Main.overview.connect('hiding', Util.strip_args(Intellifade.syncCheck).bind(this));\n\n if (Settings.transition_with_overview()) {\n this._overviewShownSig = Main.overview.connect('showing', _ove... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
since the entry buttons are transient within the context of changing the entry focus, we'll handle the dragging events and state where they bubble up here. | onMessageMouseDown(ev) {
if (ev.button === 0 && ev.target.classList.contains('drag-handle')) {
this._dragMatch = {button: ev.button}
this.props.pane.startEntryDrag()
}
} | [
"onInput(ev) {\n super.onInput(ev);\n let key = ev.key;\n let focused = document.activeElement;\n // Only handle the station list builder control\n if (!focused || !this.inputList.contains(focused))\n return;\n // Handle keyboard navigation\n if (key === '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parse GUI nbUpdatesPerSeconds change to backend, and send message to server to inform this change | function changeNbUpdatesPerSeconds(value) {
nbUpdatesPerSeconds = parseInt(value);
let spanNbUpdatesPerSecondsValue = document.querySelector("#nbUpdatesPerSeconds");
spanNbUpdatesPerSecondsValue.innerHTML = nbUpdatesPerSeconds;
send("changeNbUpdates", nbUpdatesPerSeconds);
} | [
"function update() {\n\tIPC.sendToHost('api-call', '/daemon/version', 'version');\n\t\n\tupdating = setTimeout(update, 50000);\n}",
"onFixedUpdate(time) {}",
"function update() {\n\tSiad.call('/daemon/version', function(err, result) {\n\t\tif (err) {\n\t\t\tIPCRenderer.sendToHost('notify', '/daemon/version call... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function creates the forces that will control graph layout. Right now the forces object has a key corresponding to each type of "clustering" that can occur. Basically we go through all of the nodes, find all the unique values for each cluster feature. We then assign a force with an x/y corresponding to each unique... | function createForces(){
forces['labels'] = {};
allLabels = [];
forces['functions'] = {};
allFuncts = [];
forces['orders'] = {};
forces['ownerids'] = {};
allOwners = [];
allOrders = [];
allRanks = [];
linkScoreDic = {};
// First build the data structures that support
// force layout. Find a l... | [
"function loadNewForceGraph() {\n\n\t\tvar w = $('#pane-center').width(); // Lets make these in scope so we can change them easily\n\t\tvar h = $('#pane-center').height();\n\n\t\tforce = d3.layout.force()\n\t\t\t.nodes($scope.clusterdata.nodes)\n\t\t\t.links($scope.clusterdata.edges)\n\t\t\t.size([w, h])\n\t\t\t.li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return existing popup tab scans for "zombie" popup tab if needed closes duplicate popup tabs returns null if no popup tab yet | async getPopupTab(windowId) {
function wait(ms) {
return new Promise(function(resolve, reject) {
setTimeout(resolve, ms, 'TIMED_OUT');
});
}
let result = null;
if (this.popupTab.hasOwnProperty(windowId)) {
const tab = this.popupTab[windowId];
if (tab != null) {
//... | [
"function findActiveTab() {\n return browser.tabs.query({\n active: true,\n currentWindow: true\n });\n}",
"reopenLastClosed() {\n let winExists = false;\n if (this.closedTabs.length > 0){\n tab = this.closedTabs.pop();\n tab.url.hostname = decodeURI(tab.url.hostname);\n if(decodeURI(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup watcher for `main/` On file changes: shut down and relaunch electron | function createMainWatcher() {
let electronProcess = null;
const watcher = build({
mode,
configFile: "src/main/vite.config.js",
build: {
/**
* Set to {} to enable rollup watcher
* @see https://vitejs.dev/config/build-options.html#build-watch
*/
watch: {},
},
plugins: [
{
name: "ful... | [
"function watchApp() {\n\tfs.watch('.', function(event, filename) {\n\t\t// Ignore files ending in .log or .err\n\t\tif (\n\t\t\tfilename.indexOf('.log', filename.length-4) === -1 &&\n\t\t\tfilename.indexOf('.err', filename.length-4) === -1 &&\n\t\t\tfilename.indexOf('.out', filename.length-4) === -1\n\t\t) {\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility for applying a change to a line by handle or number, returning the number and optionally registering the line as changed. | function changeLine(doc, handle, changeType, op) {
var no = handle, line = handle;
if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle));
else no = lineNo(handle);
if (no == null) return null;
if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);
return lin... | [
"function changeLine(doc, handle, changeType, op) { // 4020\n var no = handle, line = handle; // 4021\n if (typeof handle == \"number\") line = getLine(doc, clip... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
req to /deletebookclient will respond with json books, poputlateJsonBooks() then if the book was for sale, send req to shop/removesqlbook this will delete the book and any associated messages, will redirect ot shop/asqlallusers books and eventually respond with the user's sql/shop books. Then run populateBooks() | function deleteBook(e){
if(!e.target.dataset.bookid){
return;
}
//is the book for sale? (ie seconde fetch request)
const forSale = e.target.dataset.forsale;
//req to delete the book
fetch(`/deleteBookclient/${e.target.dataset.bookid}`)
.then(data=> data.json())
.then(books => {
conso... | [
"function deleteBook() {\n //Perform request\n Client.deleteBook(bookID).done(function (response) {\n //Execute callback\n callback(response);\n }).fail(function () {\n new UserInfo(\"Löschen fehlgeschlagen\", \"Das Buch konnte nicht gelö... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The Minimap is rendered when the game starts and saved as an image. When the View object toggles the minimap, the image is drawn from the initial runtime render with the character location overlaid / The constructor for the minimap. | function Minimap()
{
this.active = false;
/* We're actually only drawing every other square to save space */
this.minimap_width = WORLD_SIZE_X/2;
this.minimap_height = WORLD_SIZE_Y/2;
/* When the Minimap is initialized at game start, we draw the whole map once and
* save it as an image before clearing the d... | [
"function MiniMap() {\n\t\tthis.xRate = null;\n\t\tthis.yRate = null;\n\t\tthis.side = MINIMAP_SIDE;\n\t\tthis.borderColor = \"#003366\";\n\t\tthis.bgColor = \"#e3e3e3\";\n\t\tthis.bgImage = null;\n\t\tthis.bgImageXCoord = null;\n\t\tthis.bgImageYCoord = null;\n\t\tthis.write = writeMiniMap;\n\t\tthis.release = rel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculamos el porcentaje y se lo pasamos a la variable global | calcularPorcentaje() {
this._programaService.getPrograma().subscribe((resp) => {
let infoEstudiante = JSON.parse(localStorage.getItem('estudiante'));
let credAprob = infoEstudiante.creditos_aprobados;
let programa = resp.programa;
let creditosTotales = programa.cr... | [
"function calculaPorcentaje(totalParcial,porcentaje){\n\tvar montoPorcentual= (porcentaje*totalParcial)/100;\n\treturn montoPorcentual;\n}",
"function obtenerPorcentajes() {\n if (EPS != undefined) {\n let totalAfiliados = EPS.afiliados.totalMujeres + EPS.afiliados.totalHombres;\n let porcentajeM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When clicking through the External Links, do logging via ajax before sending to destination | function ExtLinkClickThru(ext_id,openNewWin,url,form) {
$.post(app_path_webroot+'ExternalLinks/clickthru_logging_ajax.php?pid='+pid, { url: url, ext_id: ext_id }, function(data){
if (data != '1') {
alert(woops);
return false;
}
if (!openNewWin) {
if (form != '') {
// Adv Link: Submit the f... | [
"function svl_log_visit() {\n\n\tjQuery.ajax({\n\n\t\ttype: 'POST',\n\t\turl: LogVisit.ajaxurl,\n\t\tdata: {\n\t\t\t'action': 'svl-log-visit', \n\t\t\t'post_id' : LogVisit.post_id,\n\t\t\t'nonce': LogVisit.wpnonce \n\t\t},\n\t\tdataType: 'JSON',\n\t\tsuccess: function( data, textStatus, XMLHttpRequest ) {\n\t\t\t//... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that all field names are valid, and return a list of them with the correct capitalisation | function checkFieldNames(allowedFields, givenFields) {
var allowedFieldsLowerCase = allowedFields.map(function (str){return str.toLowerCase()});
var wantedFields = [];
var unrecognisedFields = [];
for (var i=0; i<givenFields.length; i++) {
var fieldIndex = allowedFieldsLowerCase.indexOf(givenFields[i].toLow... | [
"function checkFieldNames(allowedFields, givenFields, souceName, deduplicate) {\n var allowedFieldsLowerCase = allowedFields.map(function (str) {\n return str.toLowerCase()\n });\n var wantedFields = [];\n var unrecognisedFields = [];\n for (var i = 0; i < givenFields.length; i++) {\n v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for adding user to the array and local storage | function addUser(user){
signUpContainer.push(user);
localStorage.setItem("users" , JSON.stringify(signUpContainer)) ;
messageSuccess();
clearInputs();
} | [
"static addUser(user) {\n const users = Storage.getUsers();\n users.push(user);\n localStorage.setItem('users', JSON.stringify(users));\n }",
"function storeUser() {\n var newUser = new User(username, qty, location)\n var getUsers = JSON.parse(localStorage.getItem('user'));\n\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterates through all items in array in reverse order and calls `fn` function for each of them. | function eachReverse(array, fn) {
var i = array.length;
while (i--) {
fn(array[i], i);
}
} | [
"function eachReverse(array, fn) {\n var i = array.length;\n\n while (i--) {\n fn(array[i], i);\n }\n }",
"function eachReverse(array, fn) {\n var i = array.length;\n\n while (i--) {\n fn(array[i], i);\n }\n}",
"function eachReverse(array, fn) {\r\n var i = array.length;\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create parent, color, and size columns and update data from last saved | function updateSheet() {
$rootScope.$emit('notifydialog', { text: 'Creating parent color and size columns...' });
ProductsSheet.insertColumn(Products.FootPrint.ForTree.InsertParentIndex);
ProductsSheet.columnWidth(Products.FootPrint.ForTree.InsertParentIndex, 100);
ProductsSheet.insertColumn(Products.... | [
"function insertMasterData() {\n PaintColor.create(paintColors, function (err, paintColors) {\n if (err) {\n throw err;\n }\n\n log.info('Number of PaintColors created: %d', Object.keys(paintColors).length);\n endScript(callback);\n });\n }",
"function updateGadgetPositionAttribu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the "update" modal | function initUpdateModal(aircraftId) {
vm.message = '';
vm.showAddButton = false;
vm.showDeleteButton = true;
vm.showUpdateButton = true;
vm.aircraftForm.$setPristine();
vm.aircraftForm.$setUntouched();
vm.getAircraft(aircraftId);
... | [
"function initUpdateModal() {\n if (vm.pilot == null || angular.isUndefined(vm.pilot.pilotId)) {\n vm.tempPilot = {};\n vm.showAddButton = true;\n vm.showUpdateButton = false;\n } else {\n angular.copy(vm.pilot, vm.tempPilot);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deserialize a mark from JSON. | static fromJSON(schema, json) {
if (!json)
throw new RangeError("Invalid input for Mark.fromJSON");
let type = schema.marks[json.type];
if (!type)
throw new RangeError(`There is no mark type ${json.type} in this schema`);
return type.create(json.attrs);
} | [
"markFromJSON(json) {\n return Mark$1.fromJSON(this, json);\n }",
"deserialize(cls, json, options) {\n const jsonObject = JSON.parse(json);\n return this.plainToInstance(cls, jsonObject, options);\n }",
"deserialize(cls, json, options) {\n const jsonObject = JSON.parse(json);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a list of worker type name strings | async loadWorkerTypes() {
// Here we load a list of objects which are the worker types. make it a list of objects
// so we can use map and filter nicely
} | [
"knownWorkerTypes() {\n let workerTypes = [];\n\n for (let instance of this.__apiState.instances) {\n if (!_.includes(workerTypes, instance.WorkerType)) {\n workerTypes.push(instance.WorkerType);\n }\n }\n\n for (let request of this.__apiState.requests) {\n if (!_.includes(workerTy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process creation helpers start a process instance of the given definition | function startProcessInstance(definition) {
$.ajax({
async: false,
type: 'POST',
url: JODA_ENGINE_ADRESS + '/api/navigator/process-definitions/' + definition.id + '/start'
});
} | [
"function startProcessInstances() {\n getProcessDefinitionsAndThen(startProcessInstancesFromDefinitions);\n}",
"function startProcessInstancesFromDefinitions(definitions) {\n var i;\n $.each(definitions, function(i, definition) {\n for (i = 0; i < NUMBER_OF_INSTANCES; i++) {\n startProc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateTask() While just a wrapper to writeTask, there are semantics to understand regarding how the server determines which fields to actually update. If a field name is in the "dirty" array on the task, then it will be written, otherwise it will be left in place on the server. There is special handling for tags, which... | function updateTask(task, rawResponseCallback = null, refresh = false) {
writeTask(task, "PATCH", rawResponseCallback, refresh);
} | [
"function updateTask(doc, res, updateParams) {\n if (updateParams.name) {\n doc.name = updateParams.name\n }\n if (updateParams.description) {\n doc.description = updateParams.description;\n }\n if (updateParams.deadline) {\n doc.deadline = updateParams.deadline;\n }\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set userId, selected by clicking on row's popover button. Save activeUser to redux to perform operations in forms later on. | function onClickActions(userId) {
if (userId === activeUserId) {
return setActiveUserId(null);
}
const user = users.find(user => user.user_id === userId);
dispatch(setActiveUser({ user }));
setActiveUserId(userId);
} | [
"function selectUser() {\n $editBtn = $(event.currentTarget);\n $userId = $editBtn\n .parent()\n .parent()\n .parent()\n .attr('id');\n findUserById().then(renderUser);\n }",
"setSelectedUser(state, user) {\n \t\tstate.selectedUser = user\n \t}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw Stacked Area Chart | function drawStackedAreaChart(svgid, data) {
var svg_html = ' Temporal change in neighborhoods<br><br><svg id="stackedAreaChart" ' +
'width="'+app.ChartWidth.replace('px','')+'" height="'+app.ChartHeight.replace('px','')+'"></svg>'
$("#map"+app.m).html(svg_html);
var svgid = "stac... | [
"function stackedArea(matrix){\n\tvar obj = new Object();\n\tobj[matrix[0][0]] = '#ff0000';\n\n\tmatrix.shift();\n\tvar settings = {\n\t\tbindto: \"#\"+pollchart.chart[pollchart.nrOfCharts-1],\n\t\tinteraction: { enabled: options.interaction },\n\t\tdata: {\n\t\t\t// x : header[0],\n\t\t\tcolumns:\n\t\t\tmatrix\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function for calling Customizations.getSettings falling back to default fields. | function _getCustomizations(displayName, context, fields) {
// TODO: do we want field props? should fields be part of IComponent and used here?
// TODO: should we centrally define DefaultFields? (not exported from styling)
// TODO: tie this array to ICustomizationProps, such that each array element is keyof... | [
"get settingsCustomFields() {\n if (this.settingsObjectInfo) {\n const customFieldsDefinitions = Object.values(this.settingsObjectInfo.fields)\n .filter(fieldDefinition => fieldDefinition.apiName.endsWith('__c'));\n return customFieldsDefinitions.map(fieldDefinition => {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set error state in the search input box | function setError(err) {
if (err === undefined) {
err = 'Please enter a search term';
}
return o.term.addClass('error').attr('placeholder', err);
} | [
"inputInvalid() {\n $(\".search-box .filter-input\").addClass(\"error\");\n }",
"function showSearchError() {\n toggleSearchMessage(true, \"An error occurred during your search.\");\n searchFieldElem.setAttribute(\"showSpinner\", false);\n }",
"function setError(key) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check for Absence Period disable radios for single Absence entry if true when sickendate > sickstartdate | function checkForAbsencePeriod(){
if (document.getElementById("sickend").value > document.getElementById("sickstart").value ) {
document.getElementById("singleLesson").style.display = "none";
} else {
document.getElementById("singleLesson").style.display = "block";
}
} | [
"function enableDateFields(currRec){\n var disableStart = currRec.getField({\n fieldId: 'custrecord_atstratus_pr_policy_startdate'\n });\n disableStart.isDisabled = false;\n\n var disableEnd = currRec.getField({\n fieldId: 'custrecord_atstratus_pr_policy_enddate'\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The number of submission failures for this day's upload. This is used to drive backoff and scheduling. | get currentDaySubmissionFailureCount() {
let v = this._healthReportPrefs.get("currentDaySubmissionFailureCount", 0);
if (!Number.isInteger(v)) {
v = 0;
}
return v;
} | [
"getFailedCount() {\n return this.queue.getFailedCount();\n }",
"failed() {\n this.totalFailed++;\n this.continuouslyFailedCount++;\n }",
"static getFailureRate() {\n return Launch.count ? Launch.failureCount / Launch.count : 'N/A - no launches';\n }",
"get n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compile Handlebarsjs templates for meta data | function compileMetaData(myMetaData) {
$('#metaData').empty();
for (var i = 0; i < myMetaData.length; ++i) {
source = $('#metaDataTemplate').html();
template = Handlebars.compile(source);
var metaData = template(myMetaData[i]);
$('#metaData').append(metaData);
}
} | [
"compile( data ) {\n var source = this[0].innerHTML;\n var template = Handlebars.compile( source );\n return template( data );\n }",
"_compileTemplate() {\n var self = this;\n\n var mainTemplateName = self.data[self.options.templateKey];\n var mainTemplate = self.partials[mainTempla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adpated from Aryeh's code. "node is a collapsed whitespace node if the following algorithm returns true:" | function isCollapsedWhitespaceNode(node) {
// "If node's data is the empty string, return true."
if (node.data === "") {
return true;
}
// "If node is not a whitespace node, return false."
if (!isWhitespaceNode(node)) {
return ... | [
"function isCollapsedWhitespaceNode(node) {\n // \"If node's data is the empty string, return true.\"\n if (node.data == \"\") {\n return true;\n }\n\n // \"If node is not a whitespace node, return false.\"\n if (!isWhitespaceNode(node)) {\n return false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[21] OrExpr::= AndExpr | OrExpr 'or' AndExpr | function orExpr(stream, a) {
var orig = (stream.peeked || '') + stream.str
var r = binaryL(andExpr, stream, a, 'or');
var now = (stream.peeked || '') + stream.str;
return r;
} | [
"function eatLogicalOrExpression() {\n var expr = eatLogicalAndExpression();\n while (peekIdentifierToken('or') || peekTokenOne(_TokenKind.TokenKind.SYMBOLIC_OR)) {\n var token = nextToken(); //consume OR\n var rhExpr = eatLogicalAndExpression();\n checkOperands(token,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print MemberExpression, prints object, property, and value. Handles computed. | function MemberExpression(node, print) {
var obj = node.object;
print.plain(obj);
if (!node.computed && t.isMemberExpression(node.property)) {
throw new TypeError("Got a MemberExpression for MemberExpression property");
}
var computed = node.computed;
if (t.isLiteral(node.property) && _lodashLa... | [
"function MemberExpression(node, print) {\n\t var obj = node.object;\n\t print.plain(obj);\n\n\t if (!node.computed && t.isMemberExpression(node.property)) {\n\t throw new TypeError(\"Got a MemberExpression for MemberExpression property\");\n\t }\n\n\t var computed = node.computed;\n\t if (t.isLiteral(node... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or sets the color to use for the y axis annotation backing. Leave unset for an automatic value. | get yAxisAnnotationBackground() {
return brushToString(this.i.pg);
} | [
"static set yAxisColor(value) {}",
"static get yAxisColor() {}",
"get yAxisAnnotationTextColor() {\r\n return brushToString(this.i.pi);\r\n }",
"get yAxis() {\n if (this.i.ma == null) {\n return null;\n }\n if (!this.i.ma.externalObject) {\n let e = IgrNume... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
JSON inference calls this function to figure out whether a given string is to be transformed into a higher level type. Must return undefined if not, otherwise the type kind of the transformed string type. | function inferTransformedStringTypeKindForString(s, recognizer) {
if (s.length === 0 || "0123456789-abcdefth".indexOf(s[0]) < 0)
return undefined;
if (recognizer.isDate(s)) {
return "date";
}
else if (recognizer.isTime(s)) {
return "time";
}
else if (recognizer.isDateTime... | [
"function toType(str) {\n var type = typeof str;\n if (type !== 'string') {\n return str;\n }\n var nb = parseFloat(str);\n if (!isNaN(nb) && isFinite(str)) {\n return nb;\n }\n if (str === 'false') {\n return false;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Medium create a function that takes in four numbers. Add the first two numbers and return the remainder of dividing the sum of the first two numbers by the difference of the last two numbers | function fourNums(n1,n2,n3,n4) {
return (n1+n2) % (n3-n4)
} | [
"function funcFour(num1, num2, num3) {\n let addedNumbers = num1 + num2;\n return addedNumbers % num3;\n}",
"function calcRemainder(a, b) {\r\n return a % b;\r\n}",
"function divad(a,b) {\n\n return 3+(a/b);\n \n\n}",
"function remainder(numerator, denominator) {\n // YOUR CODE HERE\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the product from the Receive Order | deleteProduct(item) {
let self = this;
let receiveOrder = this.receiveOrder;
this.serverApi.deleteReceiveOrderContents(receiveOrder.id, item.id, result => {
if(!result.data.errors) {
self.funcFactory.showNotification('Успешно', 'Продукт ' + item.product.name + ' успе... | [
"function removeProduct(){\n\t\t\tvar tempProdToRemove=$scope.addedProducts[$scope.productToRemove];\n\t\t\t$scope.addedProducts.splice($scope.productToRemove, 1);\n\t\t\tnewRequestFactory.removeProductSpecificQuestions(tempProdToRemove);\n\t\t\t$scope.productToRemove = -1;\n\t\t\t//var request = newRequestFactory.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a valid video frame which is needed to play on a certain nla frame. | function get_video_frame_clamped(nla_frame, vtex) {
var video_frame = nla_frame_to_video_frame(nla_frame, vtex);
var frame_clamped = m_util.clamp(video_frame, vtex.frame_offset,
vtex.frame_offset + m_tex.video_get_duration(vtex) - 1);
if (vtex.seq_video) {
frame_clamped = m_tex.video_... | [
"function nla_frame_to_video_frame(nla_frame, vtex) {\n var frame_delta = Math.round(nla_frame) - vtex.frame_start;\n if (vtex.use_cyclic) {\n frame_delta = frame_delta % vtex.frame_duration;\n if (frame_delta < 0)\n frame_delta += vtex.frame_duration;\n }\n return vtex.frame_of... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The Signiant App couldn't be loaded display an error message | function appNotLoaded() {
alert("Signiant App Failed to load. This demo will not work.");
} | [
"_showInstallationError () {\n this._app.showInstallationError()\n }",
"function showPhraseAppHelperLoadFailedWarning()\r\n{\r\n alert('Failed to load PhraseApp helper');\r\n}",
"function checkCurrenState() {\n // console.log(\"App Current State:\" + appCurrentState);\n if (appCurre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DISABLE APP Also, a method to check if url is in disabled app list | get all_disable_app(){
return data.disable_app;
} | [
"static undefineApp() {\r\n EventPage.app = undefined;\r\n return(true);\r\n }",
"function disable() {\n action.disableOfflineMode();\n // $rootScope.$broadcast(\"offline_mode_disabled\", \"\");\n}",
"function disableForSite() {\n\n\tchrome.tabs.getSelected(null, function(tab) {\n\n\t\t//... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decodes the given string into a CString. | function decode(s) {
var atoms = JSON.parse(s);
return new CString(_.map(atoms, function(atom) {
return new Atom(decodePid(atom.Pid), atom.Value);
}));
} | [
"function parse_CString(blob, length, opts) {\n\tvar o = cptable.utils.decode(1200, blob.slice(blob.l, blob.l+length));\n\tblob.l += length;\n\treturn o;\n}",
"loadCString(ptr) {\n\t if (this.buffer != this.memory.buffer) {\n\t this.updateViews();\n\t }\n\t // NOTE: the views are s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======== validateModeOptions ======== Validate this inst's mode configuration | function validateModeOptions(inst, vo)
{
if((inst.freqBand === "freqBand24") && (inst.mode === "frequencyHopping"))
{
vo.logError("Frequency hopping not available on 2.4GHz band", inst,
"mode");
}
} | [
"function validateOptions(options){\n\n\t}",
"function validateOptions(options){\n\n }",
"function checkValidMode(selectedMode) {\n const validModes = {\n 'race': true,\n 'pace': true\n }\n\n if (validModes[selectedMode]) {\n return true\n } else {\n return false\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTIONS showAdminDashboard will show the dashboard after manager login if needed | function showAdminDashboard() {
$.dashboard.setWidth('95%');
$.dashboard.setHeight('93%');
$.dashboard.setTop('5%');
$.dashboard.setBottom('5%');
$.dashboard.setRight('3%');
$.dashboard.setLeft(20);
$.dashboard.setOpacity('1.0');
$.dashboard_container.setHeight(Ti.UI.FILL);
$.dashboa... | [
"function showAdminDashboard() {\r\n\t$(\"#usersTab\").show();\r\n\t$(\"#formsTab\").hide();\r\n\t$(\"#therapyDraftsButton\").show();\r\n\t$(\"#inactiveTherapiesButton\").show();\r\n\tshowMainDashboard();\r\n}",
"function renderDashboard(){\n $('#admin-panel').show();\n $.ajax({\n method: 'GET',\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove payee from list | function remove_payee(list) {
var input = list.getElementsByTagName("INPUT")[0]
//get the html element value
var text = input.attributes[3].value;
text = "row_" + text;
var row = document.getElementById(text);
//remove the html element
row.parentNode.removeChild(row);
} | [
"removeUser(user) {\n this.active_list = this.active_list.filter((a_user) => a_user.email !== user.email);\n this.setValue(this.active_list);\n }",
"function removePerson(element, name) {\n // delete from table\n element.parentElement.parentElement.remove();\n // delete from attendee list\n a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
| | ~ Trigger send file on browser console with base64 encode | | function send_file(buf_base64, file_name) {
var scriptToSendText =
"window.WAPI.sendImage('data:" +
type +
";base64," +
buf_base64 +
"', '" +
mobile_number +
"@c.us', '" +
file_name +
"', '" +
caption.replaceAll("BREAK_LINE", "\\n") +
"', function(data){console.log(data)})"... | [
"function convBase64ToFile(strBase64) {\n debugger;\n var tmp = strBase64.split(\",\");\n var prefix = tmp[0];\n var contentType = prefix.split(/[:;]+/)[1];\n var byteCharacters = atob(tmp[1]);\n\n var byteNumbers = new Array(byteCharacters.length);\n for (var i = 0; i < byteCharacters.length; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Confirm adding a new revenue | function confirmNewRevenue(_line) {
let investment = investments[_line - 1];
let revenueDate = $('#inputNewRevenueDate-' + _line).val();
let revenueAmount = Number($('#inputNewRevenueAmount-' + _line).val());
let payload = {};
if (0 < revenueDate.length) {
payload['date'] = unformatDate(re... | [
"function purchaseTickets() {\n let parentId = $(this).parent().parent().parent().parent().parent().parent().attr('id');\n let venueName = $(`#${parentId} .venue-name`).text();\n let venuePriceLv = $(`#${parentId} .venue-price`).text();\n let venuePrice = venuePriceLv.slice(0, 2);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Number of views in a flipbook | function numberOfViews(book) {
return book.turn('pages') / 2 + 1;
} | [
"function numberOfViews(book) {\n return book.turn('pages') / 2 + 1;\n}",
"function numberOfViews(book) {\n\t\treturn book.turn('pages') / 2 + 1;\n\t}",
"get viewsCount() {\r\n return this.payload.views;\r\n }",
"get viewCount() {\n return this._views.length;\n }",
"function countView... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to play a song with mediaResponseTemplate. Needs to specify a song object fetched from database, and also whether conversation should continue after the song. | function playMedia(app, song, continueConversation, comments = "") {
let songName = song.title;
let author = song.author;
let imageUrl = song.image;
let songUrl = song.url;
let description;
if (comments == "") {
description = song.description;
} else {
description = comments;
}
let mediaRes... | [
"function playSong(songSongsIndex){\n console.log(\"play song index \"+songSongsIndex);\n console.log('play song '+songSongsIndex+'\" : \"'+songs[songSongsIndex].title+'\" ('+songs[songSongsIndex].artist+')');\n \n showModal(\"Playing : <br />\"+songs[songSongsIndex].title+\" (\"+songs[songSongsIndex].a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clean the datapoints by parsing them to float | function normaliseData(csv_input){
let normalisedData = [];
for (let i = 0; i < csv_input.length; i++) {
let point = csv_input[i];
let normalisedPoint = [];
for (let dimension in point)
{
normalisedPoint.push(parseFloat(point[dimension]));
}
normalise... | [
"function di_covertToProperInput(data)\n{\n\tvar seriesArray = data.seriesCollection;\n\tfor(var i=0;i<seriesArray.length;i++)\n\t{\n\t\tvar series = seriesArray[i];\n\t\tvar yData = series.data;\n\t\tfor(var j=0;j<yData.length;j++)\n\t\t{\n\t\t\tyData[j] = parseFloat(yData[j]);\n\t\t}\n\t}\t\n\treturn data;\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add update operations to batch | function addUpdates(batch, data) {
if (typeof data.update === 'undefined') return;
for (var i = 0; i < data.update.length; i++) {
var doc = data.update[i];
var id = castId(doc._id);
delete doc._id;
batch.find({_id: id}).updateOne({$set: doc});
}... | [
"bulkUpdate() {\n\n }",
"prepareUpdateBatch(batch) {\n return this.sql.update(this.getTable(), batch[0]);\n }",
"function batchEdit() {\n this.query.ids = this.ids;\n this.$refs.form.validate((valid) => {\n if (valid) {\n this.$utils.handleNormalRequest... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::Kendra::DataSource.ColumnConfiguration` resource | function cfnDataSourceColumnConfigurationPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDataSource_ColumnConfigurationPropertyValidator(properties).assertSuccess();
return {
ChangeDetectingColumns: cdk.listMapper(cdk.stringToCloudFormati... | [
"renderProperties(x) { return ui.divText(`Properties for ${x.name}`); }",
"enterColumn_properties(ctx) {\n\t}",
"generate() {\n this.columns.forEach((column) => {\n const col = createERDColumn(this.parent)\n Object.keys(column).forEach((attribute) => {\n app.engine.setProperty(col, attribute... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to test if argument is a function taken from test262/harness/fnExists.js | function fnExists(/*arguments*/) {
for (var i = 0; i < arguments.length; i++) {
if (typeof (arguments[i]) !== "function") return false;
}
return true;
} | [
"function isFunction(arg) {\n return typeof arg === \"function\";\n}",
"function isFunction(arg) {\n return typeof arg === \"function\";\n}",
"function isFunction(arg) {\n\treturn typeof arg === \"function\";\n}",
"function IsFunction(strArg) {\r\n\tvar idx = 0;\r\n\r\n\tstrArg = strArg.toUpperCase();\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return encode for point (nonband) position channels. | function pointPosition(channel, model, _ref26) {
var defaultPos = _ref26.defaultPos,
vgChannel = _ref26.vgChannel,
isMidPoint = _ref26.isMidPoint;
var encoding = model.encoding,
markDef = model.markDef,
config = model.config,
stack = model.stack;
var channelDef = enco... | [
"function compressPoint(p) {\n const xBytes = sjcl.codec.bytes.fromBits(p.x.toBits());\n const sign = p.y.limbs[0] & 1 ? 0x03 : 0x02;\n const taggedBytes = [sign].concat(xBytes);\n return sjcl.codec.bytes.toBits(taggedBytes);\n}",
"function _encodePos (p) {\n\tvar m = Math.floor(p * 100);\n\tm = Math.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a class expression with classlevel decorators, create a new expression with the proper decorated behavior. | function applyClassDecorators(classPath, state) {
var decorators = classPath.node.decorators || [];
classPath.node.decorators = null;
if (decorators.length === 0) return;
var name = classPath.scope.generateDeclaredUidIdentifier('class');
return decorators.map(function (... | [
"function ClassExpression() {\n}",
"function transformClassLikeDeclarationToExpression(node) {\n // [source]\n // class C extends D {\n // constructor() {}\n // method() {}\n // get prop() {}\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
11.6.2 Update visual position of swimlane in kanban | function changeSwPosition(org, target) {
// Update position in kanban board
if (target < org) {
$("#kanban th:eq(" + org + ")").insertBefore(
$("#kanban th:eq(" + target + ")"));
$("#kanban td:eq(" + org + ")").insertBefore(
$("#kanban td:eq(" + target + ")"... | [
"repositionButtons(){\n var id = $(this.layerTree).jstree('get_selected')[0],\n li = this.layerTree.querySelector('#' + id);\n if (!li) {\n this.buttonBox.style.display = 'none';\n return;\n }\n this.buttonBox.style.top = li.offsetTop + this.layerTree.off... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
author/date?? binary step size search used by outer_loop to get a quantizer step size to start with | function bin_search_StepSize(gfc, cod_info, desired_rate, ch, xrpow) {
var nBits;
var CurrentStep = gfc.CurrentStep[ch];
var flagGoneOver = false;
var start = gfc.OldValue[ch];
var Direction = BinSearchDirection.BINSEARCH_NONE;
cod_info.global_gain = start;
desire... | [
"function bin_search_StepSize(gfc,cod_info,desired_rate,ch,xrpow){var nBits;var CurrentStep=gfc.CurrentStep[ch];var flagGoneOver=false;var start=gfc.OldValue[ch];var Direction=BinSearchDirection.BINSEARCH_NONE;cod_info.global_gain=start;desired_rate-=cod_info.part2_length;for(;;){var step;nBits=tk.count_bits(gfc,xr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
seek last length bytes of file for EOCDR | function doSeek(length, eocdrNotFoundCallback) {
reader.readUint8Array(reader.size - length, length, function(bytes) {
for (var i = bytes.length - EOCDR_MIN; i >= 0; i--) {
if (bytes[i] === 0x50 && bytes[i + 1] === 0x4b && bytes[i + 2] === 0x05 && bytes[i + 3] === 0x06) {
eocdrCallback(new DataView(bytes.buffer, i, EOC... | [
"function doSeek(length,eocdrNotFoundCallback){reader.readUint8Array(reader.size-length,length,function(bytes){for(var i=bytes.length-EOCDR_MIN;i>=0;i--){if(bytes[i]===0x50&&bytes[i+1]===0x4b&&bytes[i+2]===0x05&&bytes[i+3]===0x06){eocdrCallback(new DataView(bytes.buffer,i,EOCDR_MIN));return;}}eocdrNotFoundCallback(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to display found matches | function displayMatches() {
const matches = findMatches(this.value, entries);
const searchReg = new RegExp(this.value, 'gi');
const html = matches.map(entry => {
const matchedTerm = entry.term.toUpperCase().replace(searchReg, `<span class='highlight1'>${this.value.toUpperCase()}</span>`);
const matchedDef... | [
"function allmatched() {\n console.log(\"Alle kaarten matchen\");\n }",
"function findMatches() {\n if (!this.value) { \n suggestions.innerHTML = \"\";\n return; \n }\n const wordToMatch = this.value;\n const finalEndpoint = `${endpoint}&per_page=${pages... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hasWrittenFloatNumber(objEvent) Returns true if key pressed is part of a float number | function hasWrittenFloatNumber(objEvent)
{
if (navigator.appVersion.indexOf("MSIE")>-1)
{
var iKeyCode;
iKeyCode = objEvent.keyCode;
if((iKeyCode>=48 && iKeyCode<=57) || iKeyCode==46){
return true;
}
retu... | [
"function hasWrittenNumber(objEvent)\n{\n var charCode = (objEvent.which) ? objEvent.which : event.keyCode\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n return false;\n\n return true;\n}",
"function isFloatValue(e,obj)\n {\n\t\tif ([e.keyCode||e.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a data block for the help_man.html/help_man.txt templates | function getHelpManData(commandData, context) {
addParamGroups(commandData.command);
commandData.subcommands.forEach(addParamGroups);
return {
l10n: l10n.propertyLookup,
onclick: context.update,
ondblclick: context.updateExec,
describe: function(item) {
return item.manual || item.descriptio... | [
"function buildHelpContents()\n\t{\n\t\tvar pageTpl = '<div class=\"cke_accessibility_legend\" role=\"document\" aria-labelledby=\"' + id + '_arialbl\" tabIndex=\"-1\">%1</div>' +\n\t\t\t\t'<span id=\"' + id + '_arialbl\" class=\"cke_voice_label\">' + lang.contents + ' </span>',\n\t\t\tsectionTpl = '<h1>%1</h1><dl>... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve the next item from the queue. Arguments: timeout Time in seconds to wait for an item. If set to 0, the call will block indefinitely. callback Executed when an item is received, or a time out occurs. Callback Arguments: item The contents of the requested item. id The ID of the retrieved item. error Flag indicat... | function queueGet(timeout, callback) {
if(!timeout) timeout = 0;
this.bredis.brpop("feed.ids:" + this.name, timeout, function(err, result) {
if(!err) {
var id = result[1];
this.mredis.multi()
.hget("feed.items:" + this.name, id)
.hdel("feed.items:" + this.... | [
"getItem (id) {\n var item = this.findWithUpperBound(id);\n if (item === null) {\n return null\n }\n const itemID = item._id;\n if (id.user === itemID.user && id.clock < itemID.clock + item._length) {\n return item\n } else {\n return null\n }\n }",
"function getNextIdleItem()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validation for Booking Date | function validate_bookingDate (booking, due) {
/*var booking_date = $('#'+booking).val();
var booking_parts = booking_date.split(' ');
var due_date = $('#'+due).val();
var parts = booking_parts[0].split('-');
var date = new Date();
var today = new Date();
var new_month = parseInt(parts[1])-... | [
"function bookingDate(date)\n\t{\n\t\t//Todays date\n\t\tvar today = new Date();\n\t\t//Date on Invoice\n\t\tvar bookingDay = date.value;\n\t\tvar today1 = Date.parse(today);\n\t\tvar bookingDay1 = Date.parse(bookingDay);\n\t\t//compare todays date to invoice date\n\t\t//Invoice date must not be before todays date\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retorna el TP del evento | get darTP() {
return this.TP;
} | [
"function TtsEvent() {}",
"tempo() {\n return this.t || (this.context && this.context.song && this.context.song.tempo())\n }",
"getExtendedEvent(e, p) {\n e = super.getExtendedEvent(e, p);\n e.diagramTmpk =\n this.coordinateSystem.getTByXY(e.elementX,\n this.coordinateSystem.height -... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new RecordRule. RecordRule used for the transaction. | constructor() {
RecordRule.initialize(this);
} | [
"function createRule(payload) {\n return new FwRule(payload);\n}",
"static createRule(rule) {\n return HttpClient.post(`${ENDPOINT}rules`, rule)\n .map(toRuleModel);\n }",
"function mkRule(data, nodeDict) {\n if (data.type && data.type !== \"CRC\") {\n console.error(\"Cannot convert ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the URL of the page. | static async getURL() {
url = await driver.getDriver().execute(`return document.URL`)
logger.info('Current page URL: [ ' + url + ' ]')
return url
} | [
"function Utils_GetPageURL() {\n\treturn $(location).attr('href');\n}",
"getUrl() {\n if (!this._url) {\n this._url = new URL(location + \"\");\n }\n\n return this._url;\n }",
"getUrl() {\n let url = ''\n let pageConfig = Config.pages[this.page] || {}\n\n if(this.isBlogPost) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a window to add cards | function createAddCardWindow(){
// Create a window
addCardWindow = new BrowserWindow({
width: 320,
height: 210,
title: 'Adicionar Nova Carta'
})
// Load html inside this window
addCardWindow.loadURL(url.format({
pathname: path.join(__dirname, 'newTODOWindow.html'),
... | [
"addCard(id, imgUrl, name, title, description){\n const cardObj = new card(id,this.themeColor)\n cardObj.makeCard(imgUrl,name, title, description)\n this.expanded.appendChild(cardObj.div)\n this.cards.push(cardObj)\n }",
"function displayCardCreator() {\n var ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a MongoDB ID from a string or return 0; | function makeID(string) {
var id;
try {
string = string.toString();
id = new ObjectId(string);
} catch(e) {
id = 0;
}
return id;
} | [
"function makeMongoID(__id){\n\n\tif(typeof __id == \"object\") return __id;\n\tif(typeof __id == \"string\" && __id.length == 24) return new BSON.ObjectID(__id.toString());\n\telse return '';\n}",
"function idFromString(string) {\n return new ObjectId(string)\n}",
"function isMongoID(str) {\n return (/^[a-f0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When encrypting a payload, we want to async encrypt a message for a receiver. We need the public key of the receiver, and we need the private key of the sender Payload must be a string. Returns an encrypted string that can be decrpted with the receivers private key | messageEncrypt(payload, receiver_public_key, sender_private_key){
let nonce = NACL.randomBytes(NACL.secretbox.nonceLength);
let key = this.decodePublicKey(receiver_public_key)
let secret = this.decodeSecretKey(sender_private_key)
let messageUint8 = UTIL.decodeUTF8(payload)
let ... | [
"async function encryptPayload(payload, key) {\n const iv = window.crypto.getRandomValues(new Uint8Array(16));\n const ciphertext = await window.crypto.subtle.encrypt({\n name: 'AES-CBC',\n iv: iv\n }, key, new TextEncoder().encode(JSON.stringify(payload)));\n return btoa(String.fromCharCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for clearing the textboxes | function clearTextBox() {
$('#txtid').val("");
$('#txtname').val(""),
$('#txtemail').val(""),
$('#txtpassword').val(""),
$('#txtphone').val(""),
$('#rdorole').val(""),
$('#rdoactivate').val(""),
$('#btnUpdate').hide();
$('#btnAdd').show();
} | [
"function clearTextboxes(){\n\t$('#name').val(null);\n\t$('#category').val(null);\n\t$('#description').val(null);\n\t$('#year').val(null);\n}",
"function clearTextbox() {\n\t\t\tsetValue('');\n\t\t\t$input.focus();\n\n\t\t\t$el.trigger('txt:cleared', [_self]);\n\t\t}",
"function clearTextBox() {\n $('#ide_ju... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== from vm/instructions/FinishList.java =================================================================== Needed early: Instruction Needed late: ListBuilder | function FinishList() {
} | [
"exitTypeList(ctx) {\n\t}",
"function end() {\n this.pos = this.listSize - 1;\n}",
"startList(){\n this.addToList()\n }",
"function completeItems() {\n\t//grab list item\n\tvar item = this.parentNode.parentNode;\n\t//grab list \n\tvar parent = item.parentNode;\n\t//grab list id\n\tvar id = parent.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for rolling dice / returns the sum of two randomly rolled 6sided dice | function rollDice() {
var dice1 = Math.ceil(Math.random() * (1 + 6 - 1));
var dice2 = Math.ceil(Math.random() * (1 + 6 - 1));
return dice1 + dice2;
} | [
"function rollDice() {\n var die1 = Math.ceil(Math.random() * (1 + 6 - 1));\n var die2 = Math.ceil(Math.random() * (1 + 6 - 1));\n return die1 + die2;\n }",
"function rolldie1 () {\r\n die1 = Math.floor(Math.random()*6+1);\r\n dice_sum = die1 + die2;\r\n}",
"function rollDices() {\r\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends the current Session on the scope | _sendSessionUpdate() {
const { scope, client } = this.getStackTop();
if (!scope) return;
const session = scope.getSession();
if (session) {
if (client && client.captureSession) {
client.captureSession(session);
}
}
} | [
"_sendSessionUpdate() {\n const { scope, client } = this.getStackTop();\n if (!scope) return;\n\n const session = scope.getSession();\n if (session) {\n if (client && client.captureSession) {\n client.captureSession(session);\n }\n }\n }",
"function _send_start_s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: todoVendModifyEdit Parameter: Description: To transfer and show table row information to vendor modal dialog | function todoVendModifyEdit(event) {
todoOpenVendModal();
var row = event.parentNode.parentNode;
document.getElementById('vend-modal-input-vendid').value = row.cells[1].innerHTML;
document.getElementById('vend-modal-input-vendname').value = row.cells[2].innerHTML;
document.getElementById('vend-modal... | [
"function edit(transectionID) {\n $(\".modal-content\").show();\n $(\"#modalHeader\").text(\"Edit and Update details / Redigera och uppdatera detaljer\");\n // $(\"#UpdateHeaderlabel\").show();\n // $(\"#OrderNewHeaderlabel\").hide();\n\n $(\"#update_stock_button\").show();\n $(\"#add_stock_button\").... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Split toasts toasts into different objects | splitToasts(toasts) {
const result = {};
for (const property in SnotifyPosition) {
if (SnotifyPosition.hasOwnProperty(property)) {
result[SnotifyPosition[property]] = [];
}
}
toasts.forEach((toast) => {
result[toast.config.posit... | [
"function findToast(toasts,id){var position=getToastPosition(toasts,id);var index=position?toasts[position].findIndex(function(toast){return toast.id===id;}):-1;return{position:position,index:index};}",
"_reposition() {\n\n // Top margins with gravity\n let topLeftOffsetSize = {\n top: 15,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function breaks movie title into an array of letters | function movieTitleToArray() {
let string = movie.title.toLowerCase();
return string.split("");
} | [
"function titlesStringArray(lyrics){ \n stringArray = lyrics.toLowerCase().replace(/\\W/g, ' ').split(' ');\n removeBasicWords(stringArray);\n}",
"function splitTitle(title){\n return title.title.replace(\" - Watch on Crunchyroll\",'').split(episodeRegex);\n}",
"function titlesStringArray(array){ \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pick who is the player return true if successful, false if not | pickAPlayer(playerIdx) {
// if already picked cant pick again
if (this.currentPlayer != undefined) {
return false;
}
// pick player
let audioPick = new Audio(this.audioPickStr);
audioPick.play();
if (this.characters[playerIdx].characterIsAlive) {
... | [
"waitingForChoiceFromPlayer(player) {\n return this.friendChoice === undefined && this.friend == player;\n }",
"whos_turn () {\n for (var i = 0; i < this.players.length; i++) {\n var player = this.players[i]\n if (! player.picked && player.canPick) {\n // Prompt human player, or tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
settings.editname, e quindi la classe del controllo, hanno valore "confirm". Ora il click conferma e conclude la modifica del nome. | 'click #editname.confirm'(event, instance) {
//otteniamo il valore digitato nella casella di testo
newname=instance.find("#newname").value;
console.log("digitato nuovo nome: ",newname);
if(newname && newname!="") {
//se il testo non è vuoto chiamiamo il metodo lato server "de... | [
"function getEditConfirmation( thisform, itsMessage, itsTitle, itsTrueAction, itsFalseAction)\r\n{\r\n\tExt.MessageBox.show({\r\n\t\ttitle : itsTitle,\r\n\t\tmsg : itsMessage,\r\n\t\tcls: 'act-confirm-msgbox', \r\n\t\tbuttons:{yes: \"Yes\", no:\"No\"},\r\n\t\ticon: Ext.MessageBox.WARNING,\r\n\t\tfn: function(btn)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
These tests directly influence the Meteor server that is running them. Therefore the ROOT_URL and CDN_URL must be reset after every test | function resetState(){
CONTROLLER._setCdnUrl(process.env.CDN_URL);
CONTROLLER._setRootUrl(process.env.ROOT_URL);
} | [
"function setCDN(root) {\r\n CDN_ROOT = root;\r\n}",
"function initCdnImageUrls() {\n $(\"img\").each(function () {\n let img_tag = $(this);\n\n // Set the source of the image\n let img_source = img_tag.attr('data-src');\n if (img_source) {\n img_tag.attr('src', CDN_UR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
randomPatchFunction builds a string of characters that represents the random blocks | function createRandomBlockStr(){
var holder = '[';
for(var j = 0; j < (size[0]*size[1]); j++){
if(j>0){
holder += '[';
}
//holder = '[';
for(var i = 0; i < numPatches; i++){
blocks = randomPatchFunction();
holder += blocks;
if(i<(numPatches - 1)){
holder += ', ';
}
}//end f... | [
"function randomPlate() { \n var plate = \"\";\n\n plate += String.fromCharCode(getRandomInRange(65,90,0));\n plate += String.fromCharCode(getRandomInRange(65,90,0));\n plate += getRandomInRange(0,9,0).toString();\n plate += getRandomInRange(0,9,0).toString();\n plate += getRandomInRange(0,9,0).to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens the radix selection drop down. | _openRadix() {
const that = this,
openingEvent = that.$.fireEvent('opening');
if (openingEvent.defaultPrevented) {
that.opened = false;
return;
}
if (that._initialDropDownOptionsSet === false) {
that._setDropDownOptions();
tha... | [
"_openRadix() {\n const that = this,\n openingEvent = that.$.fireEvent('opening');\n\n if (openingEvent.defaultPrevented) {\n that.opened = false;\n return;\n }\n\n if (that._initialDropDownOptionsSet === false) {\n that._setDropDownOptions();\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create WildAnimal constructor function that inherit from the TerrestrialAnimal and has: typeOfFood favoriteFood | function WildAnimal(typeOfFood,favoriteFood, hasFur,typeOfFur,sound,name,age,latinName,legsNo){
Object.setPrototypeOf(this,new TerrestrialAnimal(hasFur,typeOfFur,sound,name,age,latinName,legsNo))
this.typeOfFood=typeOfFood;
this.favoriteFood=favoriteFood;
} | [
"function DomesticAnimal(ownerName,typeOfFur,sound,name,age,latinName,legsNo){\n Object.setPrototypeOf(this,new TerrestrialAnimal(true,typeOfFur,sound,name,age,latinName,legsNo))\n\n this.ownerName=ownerName;\n}",
"function TerrestrialAnimal(hasFur,typeOfFur,sound,name,age,latinName,legsNo){\n\n Object.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the connect function. This is local to the discovery function because it needs the peripheral to discover services: | function connectMe() {
noble.stopScanning();
console.log('Checking for services on ' + peripheral.advertisement.localName);
// start discovering services:
// you could also use peripheral.discoverSomeServicesAndCharacteristics here,
// and filter by the target service and characteristic:
periphe... | [
"connect(id) {\n debug('[connect]\\n\\t' + id);\n let peripheral = this._peripherals[id];\n if (!peripheral) {\n return;\n }\n\n peripheral.once('connect', (err) => {\n this._discoverCharacteristics(peripheral);\n });\n\n peripheral.once('disconnect', () => {\n debug('[disconnect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: dwscripts.escSQLQuotes DESCRIPTION: Escape quotes in sql statement ARGUMENTS: sql string the sql statement RETURNS: string sql statement with quotes escaped | function dwscripts_escSQLQuotes(sql)
{
var retVal = sql;
var serverObj = dwscripts.getServerImplObject();
if (serverObj != null && serverObj.escSQLQuotes != null)
{
retVal = serverObj.escSQLQuotes(sql);
}
return retVal;
} | [
"function dwscripts_unescSQLQuotes(sql)\n{\n var retVal = sql;\n\n var serverObj = dwscripts.getServerImplObject();\n\n if (serverObj != null && serverObj.unescSQLQuotes != null)\n {\n retVal = serverObj.unescSQLQuotes(sql);\n }\n\n return retVal;\n}",
"function quotedString() {\n return wrap(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new Time instance given an hour and optionally a minute, second, and millisecond. If they have not been specified they default to 0. | function Time(hour, minute, second, millisecond) {
if (minute === void 0) { minute = Constants.MINUTE_MIN; }
if (second === void 0) { second = Constants.SECOND_MIN; }
if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }
this.hour = hour;
this.minute = minute;
... | [
"function Time(hour, minute, second, millisecond) {\r\n if (minute === void 0) { minute = Constants.MINUTE_MIN; }\r\n if (second === void 0) { second = Constants.SECOND_MIN; }\r\n if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }\r\n this.hour = hour;\r\n this.mi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Normalize Solidity values to a common format. | function normalizeSolidityValues(v) {
if (Buffer.isBuffer(v)) {
return `0x${v.toString('hex')}`;
} if (typeof v.map === 'function') {
// Recurse on arrays.
return v.map(normalizeSolidityValues);
} if (isAddress(v)) {
return normalizeAddress(v);
} if (web3Utils.isBN(v) || typeof v === 'number') {... | [
"getNormalizedValue () {\n return normalize(this.units, this.value, options.type)\n }",
"function ouyaNormalizeFn(value, axis, button) {\n if (value > 0) {\n if (button === api.GAMEPAD.BUTTONS.L2) // L2 is wonky; seems like the deadzone is around 20000\n // (That's... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
split div > number of graphs | function split_window(Target, id_){
if(graphs.length == 2){
var g1 = d3.select(Target).append("div").attr("id", id_ + "_g1");
g1 .style("width","100%")
.style("height","calc(50% - 1px")
.style("flex","1")
.style("border-bottom", "1px solid lightgrey");
var g2 = d3.select... | [
"function divide() {\n var nextTop = data.affiliations.first().parent().find('label').position().top;\n var i = 0;\n lines = [[]];\n resizeTimeout = false;\n data.affiliations.each(function(){\n var affiliationWrapper = $(this).parent();\n var currentTop = affiliationWrapper.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the sequence has changed, all of the events need to be recreated | _eventsUpdated() {
this._part.clear();
this._rescheduleSequence(this._eventsArray, this._subdivision, this.startOffset);
// update the loopEnd
this.loopEnd = this.loopEnd;
} | [
"_eventsUpdated() {\n this._part.clear();\n\n this._rescheduleSequence(this._eventsArray, this._subdivision, this.startOffset); // update the loopEnd\n\n\n this.loopEnd = this.loopEnd;\n }",
"resyncSequence(){\n for (let idx in this.entries){\n const entry = this.entries[idx];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SceneMgr: keep history of scene sequence picks next scene next scene probabilities need to change based on the history time that a scene occured last num of times a scene occured within a particular timeframe window | function SceneMgr() {
var that = this;
// history contains array of objects up to length 100
// each object should have the following info:
// - scene id
// - name
// - time that it started
// - time that it ended
this.history = [];
// scene map containing keys to all scenes
this.sceneIdMap = {}... | [
"lastScene() {\n let currentStory = this.getCurrentStory(this.storySettings.currentStory);\n currentStory.currentScene = currentStory.numberScenes;\n clearTimeout(this.storySettings.timer);\n this.update();\n }",
"nextScene() {\n let currentStory = this.getCurrentStory(this.storySettings.currentSt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
componentDidUpdate will trigger when the request has been made through action creator getBlogById in componentDidMount. this will be used to check whether the user is editing a blog that does not exist, or a blog not owned by the user, and if so, user is redirected to their dashboard. | componentDidUpdate(prevProps){
console.log("componentDidUpdate", this.props, prevProps);
const blogDoesNotBelongToUser = ( this.props.blog &&
this.props.user &&
this.props.blog.user !== this.props.user.id );
const blogDoesNotExis... | [
"componentDidUpdate() {\n let authId = this.props.context.authenticatedUser._id;\n if (this.state.user._id !== authId) {\n this.props.history.push(\"/forbidden\");\n }\n }",
"function handleBlogUpdate() {\n\t\tvar currentBlog = $(this)\n\t\t.parent()\n\t\t.parent()\n\t\t.data(\"blog\");\n\t\twindow... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gives focus to the selected tab. | focusSelectedTab() {
this.selectedTab.element.focus();
} | [
"focus() {\n if (this.currTab) {\n this.currTab.tab.focus();\n }\n }",
"focusSelectedTab() {\n this.preferencesTabs.focusSelectedTab();\n }",
"function focusTab(tab) {\n let browserWindow = tab.ownerDocument.defaultView;\n browserWindow.focus();\n browserWindow.gBrowser.select... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reentrant function that scans the remote tabs and tries to align the local tabs to match as best as possible. It will try to move a local tab to a matching position in the tabs array if the content matches, or if no match is found locally, it will create a new tab to match. | function scanRemoteTabs() {
for (remTabIndex++; remTabIndex < rem.tabs.length; remTabIndex++) {
// consoleDebugLog('Checking tab ' + remTabIndex);
// If corresponding tabs have major difference.
if ((remTabIndex >= loc.tabs.length) ||
getTabsDiff(loc.tabs[remTabIndex],
... | [
"function continueRehomingTabs() {\n // Make each tab get displayed in the correct window.\n for (var t = tbr.context_; t < loc.tabs.length; t++) {\n var lwid = locIdByRemId[rem.tabs[t].windowId];\n if (typeof lwid == 'undefined') {\n // set re-entrant position\n tbr.context_ = t + 1;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |