query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
END of function for Scoial twist returns chart details popup html text | function getChartDetailsPopupHtml(chartName,chartDescrition,chartTags,chartAuthor,chartCopyright,ichartLogoPath,chartWidth,chartHeight)
{
var tmpStr= "<div style='font-family:Arial,Helvetica Neueu,Helvetica;font-size:11px;font-weight:bold'>";
tmpStr += "<a id='popupChartClose' class='popupChartClose' onClick='show... | [
"function showDetails() {\n\n var z = wrap.style('zoom') || 1\n\n if (z === 'normal') {\n z = 1\n } else if (/%/.test(z)) {\n z = parseFloat(z) / 100\n }\n\n var x = d3.mouse(this)[0] / z\n var tx = Math.max(0, Math.min(options.width + options.margin.left, x))\n\n var i = d3.bisect(li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Truncate the projectattribute table so we while performing insertions we can correctly track the number of rows before and after the insertions. | async truncate() {
await utils.cmd(`
mysql --defaults-file="./.my.cnf" -e "TRUNCATE projectary_tests.projectattribute;"
`, 'Truncated table projectattribute', 'Failed to truncate table projectattribute');
} | [
"async insertProjectAttributes() {\n try {\n var rowsCount;\n\n await this.connection.query('SELECT * FROM projectary_tests.projectattribute;', await function (error, results, fields) {\n rowsCount = results.length;\n });\n\n // mysqltest\n try {\n await utils.execPromise(`... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
require("termcolor").define; sam2sv call SVs from a sam file of clipping sequences | function sam2sv(samfile) {
var sam = new SR(fs.createReadStream(samfile));
sam.on('alignment', function(aln) {
/**
* get the original breakpoint which generated this clipped sequence
**/
var bp = BPInfo.parse(aln.name);
var rev = aln.flags.reversed;
var unmapped = aln.flags.unmapped... | [
"function initSLE() {\n\tvar ta = arguments[0];\n\ttextOut(ta, \"1\\t1\\t1\\t1\\t1\\t15\\n\");\n\ttextOut(ta, \"2\\t-1\\t1\\t1\\t2\\t17\\n\");\n\ttextOut(ta, \"1\\t3\\t1\\t-2\\t4\\t22\\n\");\n\ttextOut(ta, \"5\\t-4\\t-3\\t2\\t1\\t1\\n\");\n\ttextOut(ta, \"3\\t2\\t1\\t-1\\t-2\\t-4\\n\");\n}",
"function draw_sequen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recuperamos los datos del fichero XML xml/preguntas.xml xmlDOC es el documento leido XML. | function gestionarXml(dadesXml){
xmlDoc = dadesXml.responseXML; //Parse XML to xmlDoc
//NUMBER
//Recuperamos el título y la respuesta correcta de Input, guardamos el número secreto
var tituloInput=xmlDoc.getElementsByTagName("title")[0].innerHTML;
ponerDatosInputHtml(tituloInput);
numeroSecreto=parseInt(xmlDoc.g... | [
"function gestionarXml(dadesXml){\n\txmlDoc = dadesXml.responseXML; //Parse XML to xmlDoc\n\tvar tipo = \"\";\n\tvar txt = \"\";\n\tvar numeroCajaTexto = 0;\n\tfor (i = 0; i<10; i++) {\n\t\ttipo = xmlDoc.getElementsByTagName(\"type\")[i].innerHTML;\n\t\tswitch(tipo) {\n\t\t\tcase \"select\":\n\t\t\t\tcrearDivPregun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filtra los AR y devuelve su idUsuario si este acepta recepcion del tipo de notificacion dado | async function filtrarARPorPreferencias(idsUsuariosAR, tipoNotificacion) {
let idsUsuariosAceptan = [];
for (const idUsuarioAR of idsUsuariosAR) {
await AdultoResponsable.findOne({ idUsuario: idUsuarioAR }).then(
(adultoEncontrado) => {
let aceptaNotificacion = adultoEncontrado.preferenciasPush.so... | [
"function filtrarCorreo(arreglo) {\n // Filtrar el arreglo por correo\n let usuariosCorreo = arreglo.filter(function (usuario) {\n return usuario.correo.includes(\"email.com\");\n });\n\n // Constancia de informacion\n console.log(\"Usuarios con dominio 'email.com': \")\n console.log(usuari... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FAVOURITES FUNCTION show 'no favourites' div if no features are favourited | function noFav() {
if (numberOfFav === 0) {
$('#no-fav').show();
} else {
$('#no-fav').hide();
}
} | [
"function viewFavourites(){\n\tif(profile.favouritePrograms.length == 0){\n\t\tremoveClass(\"noFavouritesError\", \"hidden\");\n\t}else{\n\t\tswitchView(\"favouritesPage\");\n\t\tloadFavourites();\n\t}\n}",
"function showFavoriteStories() {\n console.debug(\"showFavoriteStories\");\n //Empty the list of stories... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets if the provided structure is a JSDocStructure. | static isJSDoc(structure) {
return structure.kind === StructureKind_1.StructureKind.JSDoc;
} | [
"static isJSDocable(structure) {\r\n switch (structure.kind) {\r\n case StructureKind_1.StructureKind.Class:\r\n case StructureKind_1.StructureKind.Constructor:\r\n case StructureKind_1.StructureKind.ConstructorOverload:\r\n case StructureKind_1.StructureKind.GetAc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that evaluates if the output is valid | function isValidOutput(){
for (const iterator of outputTiles) {
if(iterator === "")
{
errorMessage = " -1 (No solution exist)";
return false;
}
}
return true;
} | [
"function verifyResult(result) {\n\t//check for multiple values for the same stat\n\t//(including contradicting nature)\n\tfor(const ev1 of result) {\n\t\tif(result.find(ev2 => ev1.stat === ev2.stat &&\n\t\t\t\t\t\t(ev1.nature !== ev2.nature ||\n\t\t\t\t\t\tev1.ev !== ev2.ev))) {\n\t\t\treturn false;\n\t\t}\n\t}\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set value for nth slot. | set_value(n, value) {
this.slots[n * 2 + 1] = value;
} | [
"public setValue(index : number, val : number) : void {\n this.values[index] = val;\n }",
"setAt(idx, val) {\r\n this.nodes[idx].val = val;\r\n }",
"function SetMachineSlotValue(index,value){\n Machine[index] = value;\n}",
"setAt(idx, val) {\n let node = this._get(idx);\n node.val = val... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LD (mm), SP Save SP to given address 0x08 | LDmmSP() {
var addr = MMU.rw(regPC[0]);
regPC[0] += 2;
MMU.ww(addr, regSP[0]);
return 20;
} | [
"function ldSPnn() {\n return function(registers, mmu) {\n registers.sp = mmu.readWord(registers.pc);\n registers.pc += 2;\n registers.m = 3;\n };\n}",
"function ldNNsp() {\n return function(registers, mmu) {\n const address = mmu.readWord(registers.pc);\n mmu.writeWord(address, registers.sp);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
insert :: forall a . Object > String > a > Object Inserts a keyVal pair into an object (purely). | function insert(newKey,newVal,object){
var result = {};
for (var key in object)
result[key] = object[key];
result[newKey] = newVal;
return result;
} | [
"function insertSafe(obj,key,item) {\n console.log(\"inserting into \"+key+\": \"+JSON.stringify(item))\n if(!obj[key]) obj[key] = new Array();\n obj[key].push(item);\n}",
"function objectInsert(object, path, value) {\n var root = path.pop();\n\n path.forEach(function (entry) {\n if (!object.hasOwnP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unbinds the copy function from the object prototype | function deregister() {
if (Object.prototype.copy === boundCopy) {
Object.prototype.copy = ocopy;
ocopy = undefined;
}
} | [
"function deregister() {\n if (Object.prototype.clone === boundClone) {\n Object.prototype.clone = oclone;\n oclone = undefined;\n }\n }",
"resetCopied() {\n this.set('copied',false);\n this.set('copyClass', null);\n }",
"function withoutFunctions(obj) {\n\t\tvar cl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function dengan nama dataHandling2 fungsi splice untuk memodifikasi variabel | function dataHandling2(array, gender, education){
return array.splice(4,1,gender,education)
} | [
"function dataHandling2 (data){\r\n\tdata.splice(1,1, \"Roman Alamsyah Elsharawy\");\r\n\tdata.splice(2,1, \"Provinsi Bandar Lampung\");\r\n\tdata.splice(4,1, \"Pria\", \"SMA Internasional Metro\");\r\n\treturn data;\r\n}",
"function panggilsplice(){\n\tvar kota = ['jakarta','makassar','bandung','aceh','mabado','... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function which set or get attribute: accept node target node; attribute which get or set; value of attribute for set; | function setGetAttr(node, atr, value) {
if (arguments.length === 2) {
return node.getAttribute(atr);
} else if (arguments.length === 3) {
return node.setAttribute(atr, value);
}
} | [
"function setAttribute(node,attributeName,attributeValue){node.setAttribute(attributeName,attributeValue);}",
"function attr(node, attribute, value) {\n\t if (value) node.setAttribute(attribute, value);\n\t else return node && node.getAttribute && node.getAttribute(attribute);\n\t}",
"function attr( node, att... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FolderLookupService maintains an index of folders and provides lookup by folder URI. | function FolderLookupService() {
if (gCreated) {
throw Components.Exception("", Cr.NS_ERROR_ALREADY_INITIALIZED);
}
this._map = new Map();
gCreated = true;
} | [
"_mapFolder(aFolder) {\n let folderURI = aFolder.URI;\n if (folderURI in this._folderByURI) {\n return this._folderByURI[folderURI];\n }\n\n let folderID = this._nextFolderId++;\n\n // If there's an indexingPriority stored on the folder, just use that.\n // Otherwise, fall back to the default... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialized the `PaymentRequest` object. | async initPaymentRequest() {
if (!this.stripe) return;
const stripePaymentRequestOptions = this.getStripePaymentRequestOptions();
const paymentRequest = this.stripe.paymentRequest(stripePaymentRequestOptions);
const canMakePayment = await paymentRequest.canMakePayment();
await this.set({ paymentRequ... | [
"createPaymentRequest() {\n var _this = this;\n var methodData = [{\n supportedMethods: 'basic-card',\n data: {\n supportedNetworks: Array.from(this.allowedCardNetworks, (network) => network.toLowerCase())\n }\n }];\n\n var details = {\n total: {\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts the new control to the left of the existing control. | function insertAtLeft(newControl, dropControl, dropControlIsField) {
insertControl(newControl, containers.horizontal, true, dropControl, dropControlIsField);
return true;
} | [
"function AddLeft() {\r\n\tif (!CheckData() || CheckIntermitate()) return;\r\n\tvar newElement = document.createElement(\"div\");\r\n\tGlobal.queue.unshift(newElement);\r\n\tnewElement.className += \"output\";\r\n\tnewElement.style.height = Global.number.value + \"px\";\r\n\tnewElement.style.left = parseInt(Global.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define option with `flags`, `description` and optional coercion `fn`. The `flags` string should contain both the short and long flags, separated by comma, a pipe or space. The following are all valid all will output this way when `help` is used. "p, pepper" "p|pepper" "p pepper" Examples: ```ts // simple boolean defaul... | option(flags, description, fn, defaultValue) {
const option = new _option.default(flags, description);
const optionName = option.name();
const name = option.attributeName(); // default as 3rd arg
if (typeof fn !== 'function') {
if (fn instanceof RegExp) {
const regex = fn;
fn = (... | [
"function option(_a) {\n var _b = _a === void 0 ? {} : _a, optionName = _b.name, flag = _b.flag, placeholder = _b.placeholder, toggle = _b.toggle, type = _b.type, required = _b.required, validator = _b.validator, validators = _b.validators, defaultValue = _b.default, description = _b.description;\n assert(!fl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To enable logging for this class. Set `Vex.Flow.TextDynamics.DEBUG` to `true`. | function L(...args) {
if (TextDynamics.DEBUG) Vex.L('Vex.Flow.TextDynamics', args);
} | [
"function L() { if (TextDynamics.DEBUG) Vex.L(\"Vex.Flow.TextDynamics\", arguments); }",
"static debug(message) {\n this.write('DEBUG', message);\n }",
"function L() {\n\t\t for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t\t args[_key] = arguments[_key];\n\t\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new instance of the ImageSearchClient class. | function ImageSearchClient(credentials, options) {
var _this = _super.call(this, credentials, options) || this;
_this.images = new ImagesOperations(_this);
return _this;
} | [
"function ImageLoaderClient() {\n /**\n * Hash array with active tasks.\n * @type {Object}\n * @private\n */\n this.tasks_ = {};\n\n /**\n * @type {number}\n * @private\n */\n this.lastTaskId_ = 0;\n\n /**\n * LRU cache for images.\n * @type {ImageLoaderClient.Cache}\n * @private\n */\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
15.01.2018 funcion que cuenta el numero de filas de una tabla html jquery | function getRowNumber(nombTabla){
var numFilas=$("#"+nombTabla+" >tbody >tr").length;
return numFilas+1;
} | [
"function numberingList_jumlah_bahanBaku(){\n\t\t$('#tabel_jumlah_bahanBaku tbody tr').each(function (index) {\n\t $(this).children(\"td:eq(0)\").html(index + 1);\n\t });\n\t}",
"function countTableRow() \n{\n $(\"#imgCount\").html(\"<i class='fa fa-images'></i> \" + $(\"#ImageUploadTable tbody tr\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
bytesize of block to read "srcdata" Set this values, by value of bitlength of modulus n. | function set_lengths( // Set lengths of blocks to read-write
n_bitlength //bitlength of modulus n from KeyFile
)
{
//set this values:
SubtractBytes = 1; //select how many bytes need to subtract from each block. Default - 1 byte.
BlockSizeToWrite = ( //BlockS... | [
"calcEncodedLength ( data, length ) {\n if ( data || length === undefined )\n length = MakeDataView( data ).byteLength;\n return ~~Math.ceil( length * 1.25 );\n }",
"metaDataLength() {\n return this.bb.readInt32(this.bb_pos + 8);\n }",
"metaDataLengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the 5x6 grid with each cell given a number, text, and checks to see if it should be absorbed by the player. | makeGrid() {
// Create cells of a grid, store them in a grid, and give them the data that they need.
gameState.grid = [];
for (let x = 0; x < gameState.GRID_WIDTH; x++) {
gameState.grid[x] = [];
for (let y = 0; y < gameState.GRID_HEIGHT; y++) {
let newCell... | [
"function displayGrid() {\n for (let y = 0; y < rows; y++) {\n for (let x = 0; x < cols; x++) {\n if (interactingGrid[y][x] === 1) {\n fill(125);\n rect(x * cellSize, y * cellSize, cellSize, cellSize);\n }\n else {\n fill(255);\n rect(x * cellSize, y * cellSize, cellSi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Counts of selected molecules. | function NumSelected()
{
var nsel = 0;
for (var n = 1; n <= num_molecules; n++) if (IsMoleculeSelected(n)) nsel++;
return nsel;
} | [
"@computed\n get countSelectedAnnotations() {\n return uiState.selectedAnnotationIds.length;\n }",
"updateNumSelectedDescriptors() {\n let count = 0;\n for (const key in this.selectedDescriptors) {\n if (this.selectedDescriptors[key]) {\n ++count;\n }\n }\n\n this.numSelectedDesc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes an automatic value for slotLabelInterval | function computeLabelInterval(slotDuration) {
var i;
var labelInterval;
var slotsPerLabel;
// find the smallest stock label interval that results in more than one slots-per-label
for (i = STOCK_SUB_DURATIONS.length - 1; i >= 0; i -= 1) {
labelInterval = createDuration... | [
"get labelInterval() {\n return this.i.b0;\n }",
"get labelInterval() {\n return this.i.bu;\n }",
"get labelInterval() {\n return this.i.b9;\n }",
"function computeLabelInterval(slotDuration) {\n var i;\n var labelInterval;\n var slotsPerLabel;\n // find the smallest ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE TODO LIST numberToDelete = 1 is a default value, you have to say it | function deleteTodo(index, numberToDelete = 1){
todoList.splice(index, numberToDelete);
displayTodos();
} | [
"function delToDo(l, i) {\n mainList.arr[l].todoList.splice(i, 1);\n saveLS(mainList.arr);\n}",
"deleteIt(note_id) {\n\t \tlet indexCheck = this.list[note_id];\n\t \tif(indexCheck > -1) {\n\t \t\tthis.list.splice(indexCheck, 1);\n\t \t}\n\t }",
"function deleteButtonPressed(todo) {\n myPouchDb.remove(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fix any row that has some information wrong Requires the user to specify the row to update | function fixRow() {
var s = SpreadsheetApp.getActiveSpreadsheet();
var sheet = s.getSheetByName('Data');
var row = getInfo('correct_row');
if(!row) {
return;
}
var matchId = sheet.getRange(row , getSheetTranslationIndex('Match Id')).getValue();
if(matchId) {
populate([matchId], row, true); // true... | [
"function updateRow(data){\n\t event.preventDefault();\n\t $(\".error-msg\").text(\"\");\n\t $(\".form-control\").css(\"border\",\"\");\n\t var checkQuestion = validate(\"#question\", \"#error_question\");\n\t var checkOptiona = validate(\"#optiona\", \"#error_optiona\");\n\t var checkOptionb = validate(\"#optionb\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Emit a key if it hasn't been emitted before. | function emit(key, callback) {
// Check for key in local cache before checking S3. Don't emit if it's there.
if (emitted.get(key)) return callback();
var opts = {
Bucket: options.bucket,
Key: path.join(emittedpath, key + '.emitted')
};
s3.headObject(opt... | [
"function emit(key, value) {\n _emitted.push([key, value]);\n _num_emitted += 1;\n \n if(_num_emitted >= settings.max_emitted) {\n _flush_emitted();\n }\n }",
"stageEmit(cacheKey,valueToEmit){{assert$1(this._phase===CacheAccessorPhase.CACHE_ACCESSOR_PHASE_PUTS_COMM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Populates restaurant details section | populateDetails() {
const { restaurantHoursContainer } = this.pageElements;
const { operating_hours: operatingHours } = this.restaurant;
restaurantHoursContainer.appendChild(generateHoursHtml(operatingHours));
} | [
"appendRestaurantDetails(restaurant) {\n this.content.insertAdjacentHTML('beforeend',`<h2>${restaurant.name}</h2>`);\n\n this.content.append(this.getFigure(restaurant));\n\n this.content.append(this.getCuisineAndFavoriteDiv(restaurant));\n\n this.content.insertAdjacentHTML('beforeend', `<address>${resta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find a parent that has a size set against it. | function findSizedParent(element) {
var parent = element.parent();
while (parent && parent.width() === 0) {
parent = parent.parent();
}
return parent;
} | [
"function _contextResolveSize(contextNodeOrId, parentSize) {\n\t var contextNode = _contextGet.call(this, contextNodeOrId);\n\t if (!contextNode) {\n\t return this;\n\t }\n\t var size = contextNode.renderNode.getSize(true);\n\t if (!size) {\n\t size = context... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to build the mighty config window :) | function buildConfigWin (body, head) {
var create = config.create,
fields = config.fields,
configId = config.id,
bodyWrapper = create('div', {id: configId + '_wrapper'});
// Append the style which is our default style plus the user style
head.appendChild(
... | [
"function buildConfigWin (body, head) {\r\n var frameBody = body,\r\n create = config.create,\r\n fields = config.fields,\r\n configId = config.id;\r\n\r\n // Append the style which is our default style plus the user style\r\n head.appendChild(\r\n create('style', {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: _fnAddData Purpose: Add a data array to the table, creating DOM node etc Returns: int: >=0 if successful (index of new aoData entry), 1 if failed Inputs: object:oSettings dataTables settings object array:aData data array to be added Notes: There are two basic methods for DataTables to get data to display a JS... | function _fnAddData ( oSettings, aDataSupplied )
{
/* Sanity check the length of the new array */
if ( aDataSupplied.length != oSettings.aoColumns.length &&
oSettings.iDrawError != oSettings.iDraw )
{
_fnLog( oSettings, 0, "Added data (size "+aDataSupplied.length+") does not match known "+
"numb... | [
"function _fnAddData ( oSettings, aDataSupplied )\n {\n var oCol;\n \n /* Take an independent copy of the data source so we can bash it about as we wish */\n var aDataIn = (typeof aDataSupplied.length == 'number') ?\n aDataSupplied.slice() :\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test whether a kernel message is a `'comm_close'` message. | function isCommCloseMsg(msg) {
return msg.header.msg_type === 'comm_close';
} | [
"function isCommOpenMessage(msg) {\n return msg.header.msg_type === \"comm_open\";\n}",
"function isClosedMessage(e) {\n return e.data !== null && e.data.indexOf('CLOSED') !== -1;\n }",
"function isCommOpenMsg(msg) {\n return msg.header.msg_type === 'comm_open';\n }",
"function isClosin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Receive event from aux clicks on results table When on bookmark item, this opens the bookmark in a new tab e is of type MouseEvent (click) | function resultsAuxHandler (e) {
let target = e.target; // Type depends ..
let className = target.className;
//console.log("Result aux event: "+e.type+" button: "+e.button+" shift: "+e.shiftKey+" phase: "+e.eventPhase+" target: "+target+" class: "+className);
// Be careful, button 2 (contextmenu) also ends up her... | [
"function bkmkAuxHandler (e) {\n let target = e.target; // Type depends ..\n let className = target.className;\n//console.log(\"Bookmark aux event: \"+e.type+\" button: \"+e.button+\" shift: \"+e.shiftKey+\" phase: \"+e.eventPhase+\" target: \"+target+\" class: \"+className);\n\n // Be careful, button 2 (context... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
server_client represents the server's network connection to a client. sender is an object whose send method accepts an ArrayBuffer of data to send. One of these should be created for each client connected to a server, and passed to server_net.addClient. | function server_client(sender) {
this.sender = function(data) { sender.send(data); };
this.netconn = new netconn();
// If set, inform the client that this is their avatar.
this.clientThing = null;
// The last input ID this client sent.
var lastReceivedInputID = -1;
// Game states sent to cl... | [
"function client_net(sender, input_type) {\n function sender_send(data) {\n sender.send(data);\n }\n this.netconn = new netconn();\n // Last time reported by the server.\n this.serverTime = 0;\n // If set, the thing that represents this client's avatar.\n this.self = null;\n // The loc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a Gif using the Send API. | sendGifMessage( recipientId ) {
var messageData = {
recipient: {
id: recipientId
},
message: {
attachment: {
type: "image",
payload: {
url: envVars.SERVER_URL + "/assets/pikachu.gi... | [
"function sendGifMessage(recipientId){var messageData={recipient:{id:recipientId},message:{attachment:{type:\"image\",payload:{url:SERVER_URL+\"/assets/instagram_logo.gif\"}}}};callSendAPI(messageData);}",
"function sendGif(username, botreply, gifUrl){\n //finally emit the chat message! client side will ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to update song slider | function updateslider() {
if (!isNaN(track.duration)) {
surfsong.value = (track.currentTime / track.duration) * 100;
// console.log(track.currentTime);
}
playnextsong();
} | [
"function update()\n\t\t{\n\t\t\tdocument.getElementById('songTime').innerHTML = millisToMins(player.currentTime);\n\t\t\tslider.value = player.currentTime;\n\t\t}",
"function amplitude_handle_song_sliders(){\n\tamplitude_set_song_position( this.value );\n}",
"function updateSeek() {\n let currentPos = (audio.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the title and year from the page and calls getRating to find the results | function newRatings(){
if(pageType=="LIST"){
title=$(".bobMovieHeader").children(".title").text();
year=$(".bobMovieHeader").children(".year").text().split('-')[0];
if(lastTitle!=title){
lastTitle=title
getRating(title,year)
}
else{
setResults(imdbRating,tomatoMeter,imdbId);
}
}
else... | [
"function retrieveReviews(title) {\n // replaces all spaces in title with underscores\n title = title.replace(/ /g, \"_\");\n\n // uses OMDb api to get ratings for the moves and TV shows\n // uses XML HTTP Request to get data from omdbapi.com\n var xhr = new XMLHttpRequest();\n var url = \"https://www.omdbapi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add video metrics to the HTML5 video elements by loading in video module, and assigning to videos. | function addVideoTracking1() {
// Add in the video files.
// These are 3 different codecs due to different browser specifications ; we recommend you have all 3 filetypes.
var srcNode = document.createElement('source');
srcNode.setAttribute('type', 'video/webm');
srcNode.setAttribute('src', Enabler.getUrl('vid... | [
"function initializeVideo() {\n const duration = Math.round(videoEl.duration);\n seekEl.setAttribute('max', duration);\n progressBarEl.setAttribute('max', duration);\n const time = formatTime(duration);\n videoDurationEl.innerText = `${time.minutes}:${time.seconds}`;\n videoDurationEl.setAttribute... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a parser that targets the given schema, using the given parsing rules. | constructor(schema, rules) {
this.schema = schema;
this.rules = rules;
this.tags = [];
this.styles = [];
rules.forEach((rule) => {
if (rule.tag)
this.tags.push(rule);
else if (rule.style)
this.styles.push(rule);
});
this.normalizeLists = !this.tags.some((r) => {
... | [
"function parse(schema, opts) {\n var attrs = loadSchema(schema);\n return attrs.protocol ?\n protocols.createProtocol(attrs, opts) :\n schemas.createType(attrs, opts);\n}",
"function parse(schema, opts) {\n var attrs = files.load(schema);\n return attrs.protocol ?\n protocols.createProtocol(attrs, o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Here I will create a prompt for the user to ask how many stars would they rate the USABILITY and LOGIC of the page | function addStarToDocument() {
var userResponse = prompt("From 5 stars being Great and 1 star being Poor, How many Stars would you like to give this page?");
return userResponse;
} | [
"function rate(){\nalert(\"Rate connects quantities of different kinds eg speed(km/hr) connects distance with time.Rate is mostly connected with time.It usually refers to change of a quantity with time.\");\nalert(\"For example a bus travels 40km in 10 minutes.Find the speed in km/hr.Lets use simple proportion ie 4... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Always add these CORS headers to the response | function addCORSHeaders(res) {
res.setHeader("Access-Control-Allow-Headers","accept, Authorization, origin, sd-connection-string, Content-Type");
res.setHeader("Access-Control-Allow-Methods","OPTIONS, GET, PUT, POST, DELETE");
res.setHeader("Access-Control-Allow-Origin","*");
} | [
"function addCORSHeaders(resp) {\n var res = resp;\n res.header(\"Access-Control-Allow-Origin\", \"*\");\n res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');\n res.header(\"Access-Control-Allow-Headers\", \"X-Requested-With,Content-Type,Cache-Control\");\n return (res);\n}",
"sta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
i changed this code a little from what we made in class so it checks against the entire top half of the nugget/mouth | checkCollision(nugget, mouth) {
// simple AABB checking
if (nugget.x < mouth.x + mouth.width &&
nugget.x + nugget.width > mouth.x &&
mouth.y + mouth.height/2 <= nugget.y + nugget.height/2 &&
mouth.y + mouth.height/2 >= nugget.y) {
return true;
... | [
"function checkWin(n) {\n var hz = west(n) + east(n) + 1;\n var vt = south(n) + 1;\n var dg = northwest(n) + southeast(n) + 1;\n var ad = northeast(n) + southwest(n) + 1;\n\n // Un-comment to see how close the target piece is to causing a win in each direction.\n // documen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
changeSearchPhraseStyle adjusts searchphrase tag's style similarly to searchsuggestion tags (MG on the left) and include image of 'X' symbol. | function changeSearchPhraseStyle() {
console.log ("##f()## changeSearchInputStyle function execution");
let searchBarInput = document.getElementById('search-phrase-input');
searchBarInput.style.marginBottom = '10px';
searchBarInput.style.order= '1';
searchBarInput.style.marginLeft = '0px';
... | [
"function changeSearchPhraseStyleReverse() {\r\n console.log (\"##f()## changeSearchPhraseStyleReverse function execution\");\r\n let searchBarInput = document.getElementById('search-phrase-input');\r\n searchBarInput.style.marginBottom = '13px';\r\n searchBarInput.style.order= '0';\r\n searchBarInpu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
searches for a drink by its name, returns a list of drinks with similar names | function searchByName(name) {
const searchURL = 'https://www.thecocktaildb.com/api/json/v1/1/search.php?s=' + name
fetch(searchURL).then(resp=>resp.json()).then(json=>json.drinks.forEach(element=>renderSearch(element)))
} | [
"function search (animals, name) {\n for (var i = 0; i < animals.length; i++) {\n if (animals[i].name.toLowerCase() === name.toLowerCase()) {\n return animals[i];\n }\n }\n return null;\n \n}",
"function matchName(drivers, names){\n return drivers.filter( infor ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns "Fahrenheit" or "Celcius" depending on the setting of the Temperature selection toggle | function getTemperatureUnitSelection() {
var retval = "Celcius";
if ($("#temperature-unit-select").prop("checked") == true) retval = "Fahrenheit";
return retval;
} | [
"function farenheitToCelcius(){\n if (tempUnits == \"celsius\"){\n tempUnits = \"farenheit\";\n document.getElementById(\"buttonFC\").innerHTML = \"Temperature in Celcius\";\n }\n else if (tempUnits == \"farenheit\"){\n tempUnits = \"celsius\";\n docu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to check if a party stood in a given constituency | function checkInConstituency(party, results) {
contained = false;
for (x=0;x<results.length;x++) {
if (party == results[x]["party"]) {
contained = true;
break;
}
}
return contained;
} | [
"function party_is_in(){\n\n\treturn this.party ? true: false;\n}",
"function checkWinner(constituency) {\n\tvar results = constituency[\"results\"];\n\tvar top = 0;\n\tvar winner = \"\";\n\tfor (var j=0;j<results.length;j++) {\n\t\tif (results[j][\"votes\"] > top) {\n\t\t\ttop = results[j][\"votes\"];\n\t\t\twin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
weatherFormat formats all the weather data from the API | function weatherFormat(weather){
var htmlString = "";
htmlString += "<div class='col-md-4'" +
"<p>" + "<strong>" + convertTime(weather.dt) + "</strong>" + "</p>" +
"<p>" + weather.temp.max + "°" + " / " + weather.temp.min + "°" + "</p>" +
"<p>" + "<img src='http://openweathermap.org/img/w/" + weather.weath... | [
"function formatWeatherData(resp) {\n return {\n cityName: resp.name,\n temperature: {\n kelvin: Math.round(resp.main.temp * 100) / 100,\n deg: Math.round((resp.main.temp - 273.15) * 100) / 100,\n fahren: Math.round((resp.main.temp - 273.15) * 9/5 + 32 * 100) / 100, \n },\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return balanced version of current BST | getBalancedBST() {
const balancedBST = new BST(
this.rootX,
this.rootY,
this.rootDeltaX,
this.rootDeltaY
);
const inorderNodes = this.inorderNodes();
let n = inorderNodes.length;
if (!n > 0) return;
const q = [];
let lo = 0;
let hi = n - 1;
q.pu... | [
"balance() {\n // inorder traversal on bst returns a sorted sequence\n const values = this.inorder();\n // make the middle element the new root\n const root = new TreeNode(values[Math.floor(values.length / 2)]);\n // contruct the tree from root and return\n return this.bala... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws a new decile block based on provided the data and dimensions. | function drawBlock(svg, articles, lowerBound, upperBound, percentileMedian, width, height) {
var blockMargin = 2;
var axisStart = 39;
var axisWidth = 7;
svg.append("path")
.attr("class", "axis")
.attr("d", "M " + axisStart + " " + blockMargin + " " +
"L " + (axisStart + axis... | [
"function drawBlockData() {\n blocks.forEach(block => {\n push();\n fillColor(block.index);\n rect(block.x, block.y, block.w, block.h);\n pop();\n });\n}",
"CreateDirtBlock(x, y) {\n const position = Fracker.TileToWorld(x, y);\n const bd = new b2.BodyDef();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove clusters and insert tiles | function resolveClusters() {
// Check for clusters
findClusters();
// While there are clusters left
while (clusters.length > 0) {
// Remove clusters
removeClusters();
// Shift tiles
shiftTiles();
... | [
"function resolveClusters() {\n // Check for clusters\n findClusters();\n \n if (clusters.length > 1) {\n \n context.drawImage(imgArray2[11], 50, 65);\n\n }\n // While there are clusters left\n while (clusters.length > 0) {\n console.log(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assign value to the next activity | function assignValueToNextActivity(returnValue) {
if (!returnValue){
return;
}
L5.setCP("nextActDefUniqueId", returnValue.actDefUniqueId);
L5.setCP("nextActOrganIds", returnValue.organId);
L5.setCP("nextActOrganNames", returnValue.organName);
return "true";
} | [
"_assignValue(value) {\n // We may get some incoming values before the model was\n // assigned. Save the value so that we can assign it later.\n if (this._model) {\n this._assignValueToModel(value);\n this._pendingValue = null;\n }\n else {\n this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO(2Pac): Rethink this UI for partially disabled matchmaking | renderMatchmakingDisabledOverlay() {
if (!IS_ELECTRON) return null
const matchmakingStatus = this.props.matchmakingStatus.types.get(MatchmakingType.Match1v1)
return (
<MatchmakingDisabledOverlay
open={this.state.matchmakingDisabledOverlayOpen}
anchor={this._findMatchButtonRef.current}... | [
"function solidRematch(){\n rematchButton.removeClass('disabled');\n rematchButton.prop('disabled', false);\n}",
"function enableUnmatched(){\n Array.prototype.filter.call(deckOfCards, function(card){\n // removes disabled class from card div\n card.parentElement.classList.remove('disabled');\n })... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
specify and amount and a list of addresses to send to, fund distribution may be specified, otherwise funds are equally distributed by default | async simpleSend (amount, addresses, distribution, confirm = true, feeRate = 0.000004, fees) {
const balance = await this.getBalance()
if (amount > balance) throw new Error('insufficient funds.')
// if distribution is unspecified, equally distribute funds to addresses
distribution = distribution || []... | [
"async function send({ address, amount, tokenAddress }) {\n assert(senderAccount != null, 'Please provide SENDER_ACCOUNT in .env file if you send')\n if (tokenAddress) {\n const erc20ContractJson = require('./build/contracts/ERC20Mock.json')\n erc20 = new web3.eth.Contract(erc20ContractJson.abi, tokenAddres... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns previous sibling node that is not a blank text node | function _getPreviousSiblingThatIsNotBlank(node) {
var previousSibling = node.previousSibling;
while (previousSibling && _isBlankTextNode(previousSibling)) {
previousSibling = previousSibling.previousSibling;
}
return previousSibling;
} | [
"function _getPreviousSiblingThatIsNotBlank(node) {\n\t\tvar previousSibling = node.previousSibling;\n\t\twhile(previousSibling && _isBlankTextNode(previousSibling)) {\n\t\t\tpreviousSibling = previousSibling.previousSibling;\n\t\t}\n\t\treturn previousSibling;\n\t}",
"function prev(n){\n while((n = n.prev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tracker:18081 MAINTAIN USER'S PLACE ON THE SCREEN AFTER ADDING, DELETING, SORTING AND COPYING POM CODES This function could be used to persist the scroll height, after any process is executed. Usually if loadWorkarea function is called after process execution, screen would be repainted and shown at top of the scren, so... | function _showWorkArea_scroll(objAjax)
{
try
{
var scrlTop = 0;
/* Tracker#: 20026 - FIT EVAL SCROLL POSITION NOT MAINTAINED AFTER SAVE WHEN SECTION IS COLLAPSED
* Taking into account that sections above the detail section can be collapsed, which causes
* the work area scrolltop t... | [
"function _multipomWorkArea_scroll(objAjax)\r\n{\t\r\n try\r\n {\r\n \tvar scrlTop = 0;\r\n \tvar divDataWrkArea = document.getElementById(_const_divDataWorkArea);\r\n //alert(\"_showWorkArea_scroll \");\r\n if(objAjax && divDataWrkArea)\r\n {\r\n //alert(\"_showWorkArea:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends store information to all selected recipients | function broadcastStores(stores, recipients) {
if (debug) {
console.log("Sending stores:")
console.log(stores)
console.log("To:")
console.log(recipients)
}
for (var i = 0; i < recipients.length; i++) {
io... | [
"_sendMailToSelectedPeople() {\n const recipients = this.state.selectedPeople.map((r) => {\n return {\n EmailAddress: {\n Address: r.secondaryText\n }\n }\n });\n this.sdkHelper.sendMail(recipients, (err, toRecipients) => {\n if (!err) {\n this.setState({\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return an array containing the available languages passed as props in the constructor | getAvailableLanguages() {
if (!this.availableLanguages) {
this.availableLanguages = [];
for (let language in this.props) {
this.availableLanguages.push(language);
}
}
return this.availableLanguages;
} | [
"getAvailableLanguages() {\n if (!this._availableLanguages) {\n this._availableLanguages = [];\n for (let language in this._props) {\n this._availableLanguages.push(language);\n }\n }\n return this._availableLanguages;\n }",
"getValidLanguage... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
for and select a place. The sample then displays an info window containing the place ID and other information about the place that the user has selected. This example requires the Places library. Include the libraries=places parameter when you first load the API. For example: <script src=" / We used this code on code p... | function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {
lat: 53.3498,
lng: -6.2603
},
zoom: 13
});
var input = document.getElementById('pac-input');
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.bindTo('bounds', map);
map.controls... | [
"function select_area(){\n let area = $('#selectPlace option:selected').val();\n\n if(area === \"moon\"){\n draw_maptype();\n }\n else{\n\n console.log(\"select_place__________area_______:\",area);\n mapOptions.zoom = areaInfo[area].zoom;\n map = new google.maps.Map(document.getElementById('my_map')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine if the choice request is valid | function adlNavRequestValidChoice(_target) {
return "unknown";
} | [
"function isValidChoice(choice) {\n return VALID_CHOICES.has(choice);\n}",
"function checkForChoiceAtt(data) {\n\t\t\t\tif (typeof data == \"undefined\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (Object.keys(data).length < 1) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (\"Choice_1\" in data) {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_set(idx, val): set node val at specified idx. | _set(idx, val) {
let count = 0;
let currNode = this.head;
while (count != idx && currNode !== null) {
++count;
currNode = currNode.next;
}
currNode.val = val;
} | [
"setAt(idx, val) {\n let node = this._get(idx);\n node.val = val;\n }",
"setAt(idx, val) {\n\n const currNode = this.positionToIdx(idx);\n currNode.val = val;\n\n }",
"setAt(idx, val) {\r\n this.nodes[idx].val = val;\r\n }",
"setAt(idx, val) {\n this._set(idx, val);\n }",
"setAt(idx, v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
D methods Draws the graphic of progress | _drawProgressGraphic() {
if (this.hasDrawGraphicHandler()) {
this._drawGraphicHandler(this);
}
} | [
"function _drawProgressBar() {\n\t\tcanvasContext.fillStyle = _progressColor;\n\t\tcanvasContext.beginPath();\n\t\tcanvasContext.rect(_progressBar.getLeft(), _progressBar.getTop(), _progressBar.width, _progressBar.height);\n\t\tcanvasContext.closePath();\n\n\t\tcanvasContext.fill();\n\t}",
"draw() {\n if (this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
real height of graph | function getGraphHeight() {
return (height - yOffset - yGraphOffset);
} | [
"getHeight() {\n return Math.abs(this.edgeValues.maxY - this.edgeValues.minY);\n }",
"function getHeight() {\n\treturn height;\n}",
"function getHeight() {\n return height;\n }",
"get height() {\n return this.scale.y * this.getLocalBounds().height;\n }",
"height () {\n\tfor (var i=0 ; i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rosetta Code: 100 doors There are 100 doors in a row that are all initially closed. You make 100 passes by the doors. The first time through, visit every door and 'toggle' the door(if the door is closed, open it; if it is open, close it). The second time, only visit every 2nd door(i.e., door 2, 4, 6, ...) and toggle it... | function getFinalOpenedDoors(numDoors) {
const doors = []
for (let door = 0; door < numDoors; door++) {
doors.push(false)
}
for (let pass = 0; pass < numDoors; pass++) {
for (let door = pass; door < numDoors; door += pass + 1) {
doors[door] = doors[door] == false
}
}
const results = []
... | [
"function getFinalOpenedDoors(numDoors) {\n // Assigned an empty array for printing the \"open\", \"close\" value.\n var arr = [];\n // for loop for initializing every elemnts as \"closed\".\n for (var i = 0; i < numDoors; i++) {\n // initializing each element as \"closed\"\n arr[i] = \"closed\";\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows a loading overlay (only for page components) | showLoadingOverlay() {
if (this.getParentComponent() != null) {return;/*We cannot show a loading overlay for a sub component*/}
this.is_showing_loading_overlay = true;
let overlay_html = '<div id="'+this.getUid()+'_LoadingOverlay" class="loading-overlay"><div' +
' class="loading-overlay-animation"><div class="... | [
"function showLoadingOverlay() {\n toggleHidden(getLoadingOverlay(), false);\n }",
"function showLoadingView() {\n $loader.css(\"display\", \"block\");\n }",
"function displayLoadingScreen(){\r\n updateContent( getLoadingContent() );\r\n}",
"function showPage() {\n\n $(loadingSpinner).css(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
collect the current activeComputation as a subscriber meaning that it depends on this dependency. | depend() {
if (Dep.activeComputation) {
this.subs.add(Dep.activeComputation)
}
} | [
"function wrappedCb() {\n Dep.activeComputation = wrappedCb\n cb()\n Dep.activeComputation = null\n }",
"notify() {\n /*\n We iterate through the subscribing functions, notifying each of them.\n */\n [...this.subscriptions].forEach(([subscribed, subscription]) => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To ensure date entry in selected format. Arguments: 1) Date field object. Sample Call: SP_CheckDateFormat(theField); | function SP_CheckDateFormat(oField)
{
var month,day,year,splitDate;
var alertMsg = "";
var showErrMsg = false;
if(oField && SP_Trim(oField.value) != "")
{
// '-' is must for every date entry
splitDate = oField.value.split('-');
if(splitDate.length != 3)
{
if(typeof message == "object")
{
al... | [
"function arq_isDate(fieldId, fieldAlias, formatPattern)\r\n{\r\n var fieldObject = document.getElementById(fieldId);\r\n var msg = \"El campo \" + fieldAlias + \"no contiene una fecha valida. (\" + formatPattern + \")\";\r\n\r\n if (fieldObject && fieldObject.value && fieldObject.value.length > 0)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates all non border walls. These are custom placed, as it turns out that completely randomizing them with our selfmade collision system can create unwinnable situations where the gap is too small to get through. | function createHorizontalWalls()
{
// Material to clone into all wall shapes
let v = getWall(); v.rotateY(Math.PI/0);
v.position.x = -50;
v.position.z = -85;
v.scale.x = 3;
addWall(v);
let h1 = getWall();
h1.position.x = -77
h1.position.z = -72;
h1.scale.x = 3;
... | [
"function create_wall() {\r\n\t\t/*wall = {\r\n\t\tx: Math.round(Math.random()*(w-cw)/cw),\r\n\t\ty: Math.round(Math.random()*(h-cw)/cw),\r\n\t\t};*/\r\n\t\tvar p,\r\n\t\tq,\r\n\t\tr,\r\n\t\ts;\r\n\t\tvar interseca = false;\r\n\t\tvar length = 10; //\r\n\t\twall_array = []; //Empty array to start with\r\n\r\n\t\tva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show an initial location on the map if the map is not already showing. | function showMap(initialPosition, initialLevel) {
if (mapShowing) return;
if (!initialPosition) initialPosition={
// Seattle - my favorite city
lat: 47.604317,
lng: -122.329773
};
if (initialLevel) map.setZoom(initialLevel);
map.setLocation(initialPosition);
setTileLayer('street');
// Show tiles
mapS... | [
"function showMap(initialPosition, initialLevel) {\n\tif (mapShowing) return;\n\tif (!initialPosition) initialPosition={\n\t\t// Seattle - my favorite city\n\t\t//lat: 47.604317, \n\t\t//lng: -122.329773\n\t\tlat:0, lng: 0\n\t};\n\tif (initialLevel) map.setZoom(initialLevel);\n\tmap.setLocation(initialPosition);\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================ sign and verify messaging ================================================== signMessage: ["address", "message"], verifyMessage: ["address", "signature", "message"], | function signMessage(params) {
return new Promise((resolve, reject) => {
var response;
var addresses = params.address;
var messages = params.message;
multichain.signMessage({
"address": addresses,
"message": messages
},
(err, res) => {
console.log(res)
if (err == ... | [
"function signMessage(params) {\n return new Promise((resolve, reject) => {\n var response;\n var addresses = params.address;\n var messages = params.message;\n multichain.signMessage({\n \"address\": addresses,\n \"message\": messages\n },\n (err, res) => {\n if (err == null) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get students of teacher | static async getStudents(teacher_username) {
const res = await db.query(
`SELECT username, full_name, email
FROM students
WHERE teacher_username = $1 ORDER BY username`,
[teacher_username]
);
if (!res.rows[0]) {
throw new ExpressError(`No students`, 404);
}
const students = res.rows.map(s => n... | [
"static async getTutorialStudents(req: Request, res: Response): Promise<void> {\n let result = await Container.getCourseAndTutorialOrFailById(req.params.course_id, req.params.tutorial_id);\n let users = await result.tutorial.getAllStudents('-attributes -__v');\n res.send(users);\n }",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This runs a violent nighttime event, resulting in at least one death. | function violentNightEvent(id) {
} | [
"function daygame(){\n\tvar i;\n\twhile (HvZData.hour<8){\n\t\tfor (var j in Zombie){\n\t\t\tdecideifinfect(j);\n\t\t}\n\t\tHvZData.hour++;\n\t}\n\tfor (var j in Zombie){\n\t\tZombie[j].todayinfected=0;\n\t}\n\tif (HvZData.day==HvZData.missions[0]){\n\t\tHvZData.missions.reverse();\n\t\tHvZData.missions.pop();\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ensure no menu item is active. This unsets the active item if there is one. | clearActive() {
this.handleMenuItemChange("active");
} | [
"ClearActiveItem() {\n var el = this.ActiveItem;\n if (el) {\n tp.RemoveClass(el, tp.Classes.Active);\n }\n }",
"function removeIsActiveFromMenu(){\n\t\t\tmenuItems.parent().removeClass( 'is-active' );\n\t\t}",
"function removeActive() {\n if(vm.activeElement != nul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resets page data deselect | function resetDataDeselect() {
console.log("resetDataDeselect()");
resetBoolean();
} | [
"function resetDataDeselect() {\n\t\t\tconsole.log(\"resetDataDeselect()\");\n var saveRefsKey = vm.apiDomain.refsKey;\n var saveJnumId = vm.apiDomain.jnumid;\n var saveJnum = vm.apiDomain.jnum;\n var saveShortCit = vm.apiDo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rewrites word ranges: [azAZ_09] > \w Thus, the ranges may go in any order, and other symbols/ranges are kept untouched, e.g. [az_\dAZ$] > [\w$] | function rewriteWordRanges(path, hasIFlag, hasUFlag) {
const {node} = path;
let numberPath = null;
let lowerCasePath = null;
let upperCasePath = null;
let underscorePath = null;
let u017fPath = null;
let u212aPath = null;
node.expressions.forEach((expression, i) => {
// \d
if (isMetaChar(expre... | [
"function rewriteWordRanges(path, hasIFlag, hasUFlag) {\n var node = path.node;\n\n\n var numberPath = null;\n var lowerCasePath = null;\n var upperCasePath = null;\n var underscorePath = null;\n var u017fPath = null;\n var u212aPath = null;\n\n node.expressions.forEach(function (expression, i) {\n // \\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build the card for the student data. | function createCard(url, firstName, lastName, userEmail, joinDate) {
//Creating all the elements to build a complete card of student details.
const li = buildElements('LI',{className: 'student-item cf'});
const studentDetails = buildElements('DIV', {className: 'student-details'});
const avatar = buildElemen... | [
"function buildCardStructure() {\n let CardOuter = document.createElement('div');\n CardOuter.id = \"card-outer-container\";\n let HeaderRow = document.createElement('div');\n HeaderRow.id = \"card-header-row\";\n let ContentBox = document.createElement('div');\n ContentBox.id = \"card-content-box\";\n CardO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a function to detect if the tooltip is going off the screen vertically. If so, switch to the opposite! | function dontGoOffScreenY(switchTo, switchFrom) {
// if it goes off the top off the page
if(((proxy.offset.top - $(window).scrollTop() - tooltipHeight - offsetY - 12) < 0) && (switchFrom.indexOf('top') > -1)) {
practicalPosition = switchTo;
}
// if it goes ... | [
"function dontGoOffScreenY(switchTo, switchFrom) {\n // if it goes off the top off the page\n if(((proxy.offset.top - $(window).scrollTop() - tooltipHeight - offsetY - 12) < 0) && (switchFrom.indexOf('top') > -1)) {\n practicalPosition = switchTo;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the 2d Canvas and calls drawAtoms2D | drawScene2D(context2d) {
context2d.clearRect(0, 0, context2d.canvas.width, context2d.canvas.height);
this.drawAtoms2D(context2d);
this.drawBonds2D(context2d);
} | [
"function clearDistanceCanvas() {\n let ctx = distanceCanvas.node().getContext(\"2d\");\n ctx.clearRect(0, 0, distanceImageSize * distanceCanvasScale, distanceImageSize * distanceCanvasScale);\n}",
"function clear() {\n context2.fillStyle = 'rgba(170,170,178,0.4)';\n context2.fillRect(0, 0, canvas.width, canv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compresses data with GZIP | function gzipSync(data, opts) {
if (!opts)
opts = {};
var c = crc(), l = data.length;
c.p(data);
var d = dopt(data, opts, gzhl(opts), 8), s = d.length;
return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;
} | [
"function gzip(input,options){options = options || {};options.gzip = true;return deflate(input,options);}",
"function gzip(input,options){options=options||{};options.gzip=true;return deflate(input,options)}",
"function gzip(input,options){options=options||{};options.gzip=true;return deflate(input,options);}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sort id a and id b by a given attribute with (if given) ranking for that attribute | function attributeSort(a, b, attribute, rank) {
var itemA = visible.items[a];
var itemB = visible.items[b];
var attributeA, attributeB;
if (attribute === visible.ATTR_NAME) {// case-insensitive
attributeA = itemA.name.toLowerCase();
attributeB = itemB.name.toLowe... | [
"function attributeSort(a, b, attribute, rank) {\r\n var itemA = visible.items[a];\r\n var itemB = visible.items[b];\r\n var attributeA, attributeB;\r\n\r\n if (attribute === visible.ATTR_NAME) {// case-insensitive\r\n attributeA = itemA.name.toLowerCase();\r\n attr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function invoked when user confirms to delete the selected post pointer events are set to normal to enable clicking on various elements of the form selected post deleted after the confirmation delete modal window closed remaining posts are rearranged such that if there are odd number of posts left then the last one is ... | function deleteConfirm(){
pointerRef=document.getElementsByName("pointerRef");
for(let item of pointerRef){
item.style.pointerEvents="auto"; //pointer events set to auto
};
var p = document.getElementById("postClicked");
var postToDelete=document.getElementById(p.innerHTML); //... | [
"function markDeleted(e) {\n // open confirm modal\n const row = e.currentTarget.parentNode.parentNode.parentNode;\n modal.style.display = 'flex';\n modal.style.position = 'fixed';\n modal.querySelector('.message-body').innerHTML =\n 'please confirm that you wish to <strong>delete</strong> this donation.';\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mark the documents as cached, then gets all the HTML content and send to the service worker using a `PUT` request into `./renderstore/` URL. You could be wondering we need to send the URL for the cached content but this info is implicitly added as the `referrer` property of the request. | function cache() {
document.documentElement.dataset.cached = true;
var data = document.documentElement.outerHTML;
fetch('./render-store/', { method: 'PUT', body: data }).then(function() {
console.log('Page cached');
});
} | [
"function cache () {\n document.documentElement.dataset.cached = true;\n var data = document.documentElement.outerHTML;\n fetch('./render-store/', {\n method: 'PUT',\n body: data\n }).then(function () {\n console.log('Page cached');\n });\n }",
"function cacheDocument() {\r\n\tvar d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Request Journey Episodes Data | function loadJourneyEpisodesData()
{
var objRequest = {
acrq: 'load-journey-episodes',
journey_id: $scope.objJourney.id
};
$scope.objJourneyEpisodes = Array();
var $p = JourneyEpisodesPageService.get(objRequest,
function success(response) {
logToConsole(response);
//check for er... | [
"function loadJourneyEpisodesData()\n\t{\n\t\tvar objRequest = {\n\t\t\tacrq: 'load-journey-episodes',\n\t\t\tjourney_id: $scope.objJourney.id\n\t\t};\n\t\t\n\t\t$scope.objJourneyEpisodes = Array();\n\t\tvar $p = JourneyEpisodesPageService.get(objRequest, \n\t\t\tfunction success(response) {\n\t\t\t\tlogToConsole(r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ENCODE ====== var encoded_data = encode('path'); | function encode(path) { return encodeURIComponent(path); } | [
"function encode(path) { return encodeURIComponent(path) }",
"function encodePath (path) {\n return encode(path, TYPE.PATH);\n}",
"function encodeURL(path)\n {\n return encodeURIComponent(path).replace(/%2F/g,'/');\n }",
"function encode(path) {\r\n var result = '';\r\n for (var i = 0; i <... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
prepareAddModel wraps options in a closure around addModel | function prepareAddModel(options) {
var serverAlias = options.serverAlias
return function addModel(Model) {
exports.globalModels[serverAlias] = exports.globalModels[serverAlias] || {
byServicePath: {}
}
var name = Model.modelName || Model.name
if (exports.globalModels[serverAlias][name] && opt... | [
"function extendModel(metamodel, options) {\t\r\n}",
"add(model) {\n this.models.push(model);\n return this;\n }",
"function prepare(model) {\n\t\t\tvar definer, emitter;\n\n\t\t\tif (!prepared(model)) {\n\t\t\t\t// create a function responsible for defining properties and registering\n\t\t\t\t// those... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the position of 4 teams and 1 ball in the order of team0: player1[x,y], player2[x,y] team1: player1[x,y], player2[x,y] team2: player1[x,y], player2[x,y] team3: player1[x,y], player2[x,y] ball: x,y | getAllPosition() {
var position =
[ [[],[]], [[],[]], [[],[]], [[],[]], [] ];
this.teams.forEach((team, i) => {
team.getChildren().forEach((player, j) => {
position[i][j][0] = player.x;
position[i][j][1] = player.y;
});
});
position[4][0] = this.ball.x;
position[4][... | [
"_computePlayerClosestToBall() {\n\n\t\tconst ball = this.ball;\n\t\tconst players = this.children;\n\n\t\tlet closestDistance = Infinity;\n\n\t\tfor ( let i = 0, l = players.length; i < l; i ++ ) {\n\n\t\t\tconst player = players[ i ];\n\n\t\t\tconst distance = player.position.squaredDistanceTo( ball.position );\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test if a rule is enabled for this node. | ruleEnabled(ruleId) {
return !this.disabledRules.has(ruleId);
} | [
"isRuleEnabledOnLine(ruleName, line) {\n // Need not ensure that line > this.lastLine. This func's purpose is only to determine whether\n // given rule is disabled on given line, regardless of whether line is within bounds or not.\n if (typeof ruleName !== \"string\" || ruleName.length < 1) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets stop and go classes if time is invalid assigns valid input from time24 into time12 | function test12HourTime(time12input,time24input){
var time12 = $(time12input);
var time24 = $(time24input);
var value12 = time12.val();
var timeMatch = /^(\d{1,2}):*(\d{2})*([ap]m)?$/i
if(value12.match(timeMatch) != null){
time12.removeClass("stop");
var hours = RegExp.$1;
var mins ... | [
"static from12(time12, time24 = new Time()) {\n var hours24 = time12.hours;\n var minutes = time12.minutes;\n if (!time12.pm && hours24 == 12) {\n hours24 = 0;\n }\n if (time12.pm && hours24 < 12) {\n hours24 = hours24 + 12;\n }\n time24.date.se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Async method, it will resolve with a number which denotes no of scans in the given image. | noOfScan() {
return new Promise(async (resolve, reject) => {
let imgBytes = await this.toIntegerArray();
let scanCount = 0;
let SOS = this.SOS;
let imgBytesLength = imgBytes.length;
//0xFFDA
for (let i = 0; i < imgByte... | [
"function num_recog_munual(imagedataPath) {\n return new Promise(function (resolve, reject) {\n Recog_Size(imagedataPath).then((value) => {\n pixels_sum(imagedataPath,value).then((flag) => {\n if (flag == 1) {\n console.log('Recognized true');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `SSESpecificationProperty` | function CfnSimpleTable_SSESpecificationPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
errors.collect(cdk.propertyValidator('sseEnabled', cdk.validateBoolean)(properties.sseEnabled));
return erro... | [
"function TableResource_SSESpecificationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('sseEnabled', cdk.requiredValidator)(propertie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Any command that implemented registryrelated feature should support `r` / `registry` option | async setRegistry() {
const cacheKey = ''
if (this._registries[cacheKey]) {
return this._registries[cacheKey]
}
let registry
if (await shouldUseTaobao(this.bin)) {
registry = registries.taobao
} else {
try {
if (!regist... | [
"notifyCmdsRegistry() {\n const busClient = require('xcraft-core-busclient').getGlobal();\n if (!busClient.isConnected()) {\n return;\n }\n\n const registry = this._commander.getFullRegistry();\n busClient.events.send('greathall::bus.commands.registry', {\n registry,\n token: this._tok... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get balance from client | async getBalance () {
await this.update()
return this.client.getBalance()
} | [
"async function getBalance() {\n // const mnemonic = walletInfo.mnemonic\n // const rootSeed = BITBOX.Mnemonic.toSeed(mnemonic)\n // const masterHDNode = BITBOX.HDNode.fromSeed(rootSeed, \"testnet\")\n // const account = BITBOX.HDNode.derivePath(masterHDNode, \"m/44'/145'/0'\")\n // const change = BITBOX.HDNod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. createAboutScreenButtons function is being called from the function loadAboutScreen 2. Purpose of this function is to create UI of the about screen 3. It takes no arguments 4. Usage Example: 5. Function Call createAboutScreenButtons() 6. Data returned No data returned | function createAboutScreenButtons() {
//creates a wrapper div and assign an id to it
var aboutButtonDiv = createElement("div", "", "level-btn-div", "");
//creates main menu button
var homeButton = createMainMenuButton();
homeButton.classList.add('btnLevels');
aboutButtonDiv.appendChild(homeButt... | [
"function setUpPage() {\n //2.5\\\\function creates the events for my page buttons\n createEventListeners();\n ///3\\\\\\function starts out with the introduction\n startingIntro();\n}",
"function createWelcomeScreen()\n{\n //Clear the previous UI\n document.body.innerHTML=\"\";\n var welcome_ul_div=crea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to generate random price between 1 and 100. | function randomPrice(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
} | [
"function makeRandomPrice(){\n return '$' + Math.round((Math.random()*100)) + '.00'\n}",
"function getRandPrice() {\n return getRand(10, 0.5, false).toFixed(2);\n}",
"function randomPrice(min, max) {\n return Math.floor(Math.random() * (max - min)) + min;\n}",
"function randomStartPrice() {\n\t var rand... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a brisk route instance for a given URL pattern | on(pattern) {
const briskRoute = new BriskRoute_1.BriskRoute(pattern, this.matchers);
const openedGroup = this.getRecentGroup();
if (openedGroup) {
openedGroup.routes.push(briskRoute);
}
else {
this.routes.push(briskRoute);
}
return briskRo... | [
"function findMatchingRoute(urlPath,options){options=options||{};const useCache=options.useCache===undefined?true:options.useCache;if(useCache&&urlPathsCache[urlPath]){return urlPathsCache[urlPath];}let pathRegExps;if(useCache&&pathRegExpsCache){pathRegExps=pathRegExpsCache;}else{pathRegExps=createPathRegExps(_cont... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
__$helperMethod__ For methods of Resources returns parent resource. For methods of ResourceTypes returns null. | function parentResource(method) {
if (method.parent() instanceof RamlWrapperImpl.ResourceImpl) {
return method.parent();
}
return null;
} | [
"static get RESOURCE_TYPE() {\n return (RESOURCE_TYPE);\n }",
"getResourceType() {\n return super.getAsNullableString(\"resource_type\");\n }",
"static get __resourceType() {\n\t\treturn 'Resource';\n\t}",
"function determineResourceType(data) {\n var resource = resourceType.unknown;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function removes the DB old Chart | function removeOldChart() {
var oldChart = document.getElementById('DB')
if (oldChart != undefined) {
var parent = oldChart.parentNode
parent.removeChild(oldChart)
}
} | [
"function removeChart() {\n chart.destroy();\n }",
"function removeChart() {\n monte_vis.chart.destroy();\n // reset chart sizing\n chart_container.style = \"\";\n }",
"static deleteChart(){\n document.querySelector('#myChart').remove();\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Binds event listeners to the cart icon. | bindEventListeners()
{
this.icon.onclick = function(e) {
e.preventDefault();
this.toggleCartPreview();
}.bind(this);
EventManager.subscribe('cart.product.added', function(attributes) {
this.openCartPreview();
this.addItem(attributes);
this.reloadCartPreview();
}.bind(this));
Eve... | [
"function bindCartUpdates() {\n const items = Array.from(document.querySelectorAll('product-item'));\n items.forEach(item => {\n item.addEventListener('addedToCart', () => { addToCart(item.json.id) });\n item.addEventListener('removedFromCart', () => { removeFromCart(item.json.id) });\n });\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
restore cookie to allNotes array | function restoreAll() {
var saveString = getCookieValue('jscn');
if (saveString.length == 0) {
return;
}
allNotes = atob(saveString).split(',');
for (var i = 0; i < allNotes.length; i++) {
allNotes[i] = decodeURIComponent(allNotes[i]);
}
} | [
"function restoreAll() {\n var saveString = getCookieValue('jscn');\n if(saveString.length == 0) {\n return;\n }\n\tallNotes = atob(saveString).split(',');\n\tfor(var i = 0; i < allNotes.length; i++) {\n \tallNotes[i] = decodeURIComponent(allNotes[i]);\n }\n}",
"function saveAll() { \n if(allNotes.length... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves a new message containing an image in Firebase. This first saves the image in Firebase storage. | function saveImageMessage(file) {
// 1 - We add a message with a loading icon that will get updated with the shared image.
firebase.firestore().collection('messages').add({
name: getUserName(),
imageUrl: LOADING_IMAGE_URL,
profilePicUrl: getProfilePicUrl(),
timestamp: firebase.fi... | [
"function saveImageMessage(file) {\n // Posts a new image as a message.\n firebase.firestore().collection('messages').add({\n imageUrl: LOADING_IMAGE_URL,\n }).then(function(messageRef) {\n // 2 - Upload the image to Cloud Storage.\n var filePath = firebase.auth().currentUser.uid + '/' + messageRef.id +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |