query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
CLEAN DEPRECATED TAGS; Used in loadHTML, getHTMLBody, getXHTMLBody | function edt_cleanDeprecated()
{
var oEditor=eval("idContent"+this.oName);
var elements;
elements=oEditor.document.body.getElementsByTagName("STRIKE");
this.cleanTags(elements,"line-through");
elements=oEditor.document.body.getElementsByTagName("S");
this.cleanTags(elements,"line-through");
ele... | [
"function cleanHtml() {\n document.querySelectorAll('.clean').forEach(function(elm) {\n var newHtml = parseNode(elm).trim();\n elm.innerHTML = newHtml;\n elm.classList.remove('clean');\n });\n }",
"static cleanUpHTML(element) {\n\t\t// Deal with cases like <b></b>... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fonction de calcul de la position des sommets du polygone formant la route | function avancer_polygone() {
for (var p = 0; p<18; p++) {
polygone[p][1] = polygone[p][1] + vitesse_ver_route; /* on fait avancer le point verticalement */
if (polygone[p][1] > 100) { /* test : si le point est sorti en bas de l'écran, on le redessine en haut */
vitesse_lat_route = vitesse_lat_route + Ma... | [
"route (curPt, pois, options = {}) {\n const includedNearbys = [];\n\n\n // NEW - once we've created the graph, snap the current and nearby panos to the nearest junction within 5m, if there is one\n const snappedNodes = [ curPt, null ];\n if(options.snapToJunction) {\n snapped... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set chat ID Action | setChatID(chatID) {
console.log('useAction: Chat id is being set to ', chatID);
dispatch({type : constants.SET_CHAT_ID, value : chatID})
} | [
"changeOpenChat(newUserID) {\n Dispatcher.handleViewAction({\n type: ActionTypes.UPDATE_OPEN_CHAT_ID,\n userID: newUserID,\n })\n }",
"setChatId(aChatId) {\n this.chat_id = aChatId;\n }",
"set chat(id) {\n this.chat.attr('src', this.embed.replace('{{EMBED}}', 'chat').replace('{{ID}}'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing functions for X Horizontal winner testing function for X | function X_winner_horizontal(expected){
describe("Is X a winner horizontal?", () => {
it("Should return an X (testing X horizontal)", () =>
{
expect(winning.isWinner(expected, "X",0)).toEqual( { "winner": "X"});
});
it("Should return an empty string if inserted O", () =>
{
... | [
"function X_winner_vertically(expected){\n describe(\"Is X a winner vertically?\", () => {\n it(\"Should return an X (testing X vertically)\", () =>\n {\n\t expect(winning.isWinner(expected, \"X\", 0)).toEqual( {\"winner\": \"X\"});\n });\n it(\"Should return an empty string if inserted O... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether a given data node is expanded or not. Returns true if the data node is expanded. | isExpanded(dataNode) {
return this.expansionModel.isSelected(dataNode);
} | [
"isExpanded(dataNode) {\n return this.expansionModel.isSelected(this._trackByValue(dataNode));\n }",
"isExpanded(dataNode) {\n return this.expansionModel.isSelected(this._trackByValue(dataNode));\n }",
"function isExpanded() {\n var expandedItem = d3.select('.expanded');\n if (!expandedItem.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the current 4x4 rotation matrix. | getRotationMatrix4() {
mat4.set(rotationMatrix4, this._m0.gain.value, this._m1.gain.value, this._m2.gain.value, 0, this._m3.gain.value, this._m4.gain.value, this._m5.gain.value, 0, this._m6.gain.value, this._m7.gain.value, this._m8.gain.value, 0, 0, 0, 0, 1);
return rotationMatrix4;
} | [
"getRotationMatrix4() {\n set$1(rotationMatrix4, this._m0.gain.value, this._m1.gain.value, this._m2.gain.value, 0, this._m3.gain.value, this._m4.gain.value, this._m5.gain.value, 0, this._m6.gain.value, this._m7.gain.value, this._m8.gain.value, 0, 0, 0, 0, 1);\n return rotationMatrix4;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
records the mouse click and finds the slope of the line created by the initial position of the ball and the click and initializes the movement direction of the ball | function mouseClicked() {
clickX = mouseX;
clickY = mouseY;
xMove = round((init_ball_x - clickX) / 10);
yMove = round((init_ball_y - clickY) / 10);
} | [
"function click(ev, gl, canvas) {\r\n lastButton = ev.button;\r\n \r\n var x = ev.clientX; //x coord of mouse\r\n var y = ev.clientY; //y coord of mouse\r\n var z = 0; //z coord of mouse\r\n var rect = ev.target.getBoundingClientRect();\r\n\r\n //translates coordinates based on canvas size\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find an exisgting query and update/replace its args | findAndUpdateQuery(fnCriteria, newArgs) {
let target = this.search(fnCriteria);
if (target) {
target.args = newArgs;
return;
}
console.error("Could not find query to delete.");
} | [
"update (queries, modifiers, options = {}) {\n let opts = Object.assign({\n multi: false,\n projections: {}\n }, options),\n cursor = this[Helpers.is(queries, 'String') ? 'findByKey' : 'find'](queries, opts.projections, !opts.multi);\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hidePlayButton hides play/pause button for manual slideshows | function hidePlayButton() {
document.getElementById("buttonPlayPause").style.display = "none";
} | [
"function hidePlay() {\n playBtn.style.display = \"none\";\n pauseBtn.style.display = \"block\";\n}",
"function hidePlay(){\n // hide play \n cp.hide(getElement(\"Play\", \"id\"));\n // show pause\n cp.show(getElement(\"Pause\", \"id\")); \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create chart with all options and data view | function createChart(data, options='')
{
if(options == '')
{
options = {
showPoint: true,
lineSmooth: false,
height: "260px",
fullWidth: false,
plugins: [
Chartist.plugins.tooltip({
tooltipOffset: {
... | [
"function chart( selection ) {\n\n\t\t\tselection.each( function ( data ) {\n\n\t\t\t\t// Standardize the data:\n\t\t\t\tdata = formatData( data );\n\n\t\t\t\t// Get the data domains:\n\t\t\t\tgetDomains( data );\n\n\t\t\t\t// Create the chart base:\n\t\t\t\tcreateBase( this );\n\n\t\t\t\t// Create the chart backgr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
open the edit product window once the edit product button is clicked | function edit() {
$('#productInfo').trigger('close');
show("editProduct");
} | [
"function editProduct() {\n var currentProduct = $(this).data(\"product\");\n $(this).children().hide();\n $(this).children(\"input.edit\").val(currentProduct.text);\n $(this).children(\"input.edit\").show();\n $(this).children(\"input.edit\").focus();\n }",
"function edit(){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Counts all records in the index | function countAll(successCallback, errorCallback) {
let origin = 'Index.countAll()';
logger(origin + logEnum.begin);
let request = _index.count();
request.onsuccess = function (event) {
let message = `${event.target.result} records in index "${_index.name}"`;
requestSuccessAction(event.target.result, o... | [
"resultCount() {\n const res = this.records().length;\n this.logger.log('analyze-all', 'resultCount:', res);\n return res;\n }",
"getCount() {\n return this.indices.length;\n }",
"countDocumentsInIndex(index, type) {\n\t\treturn this.esClient.count({\n\t\t\tindex: index,\n\t\t\ttype: type\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets whether an element is clipped by any of its scrolling containers. | function isElementClippedByScrolling(element, scrollContainers) {
return scrollContainers.some(function (scrollContainerRect) {
var clippedAbove = element.top < scrollContainerRect.top;
var clippedBelow = element.bottom > scrollContainerRect.bottom;
var clippedLeft = element.left <... | [
"function isElementClippedByScrolling(element, scrollContainers) {\n return scrollContainers.some(function (scrollContainerRect) {\n var clippedAbove = element.top < scrollContainerRect.top;\n var clippedBelow = element.bottom > scrollContainerRect.bottom;\n var clippedLeft = element.left < scrollContaine... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collect environment variables from the document and body | function collectEnv_(doc, body, env) {
var doc = doc || DocumentApp.getActiveDocument();
var body = body || doc.getBody();
deleteEvalErrors(doc, body);
// Define the search parameters.
var searchResult = null;
env = env || builtinEnv_();
var lastElement = undefined;
// Search until the paragraph is ... | [
"_loadEnvValues() {\n this.debugLog(`${this.msgPrefix} Load Environmental Variables`);\n const envPrefix = [];\n this.envPrefix.forEach(prefix => {\n envPrefix.push(prefix.toLowerCase())\n });\n\n for (let entry in this.env) {\n const entrylc = entry.toLowerC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Activate Intel AMT to with server (ACM or CCM) | function activeToACM() {
console.log('Starting Intel AMT activation attempt...');
settings.noconsole = true;
// Display Intel AMT version and activation state
mestate = {};
var amtMeiModule, amtMei;
try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { cons... | [
"function activateIntelAmtTlsAcm(dev, password, acminfo) {\n // Check if MeshAgent/MeshCMD can support the startConfigurationhostB() call.\n if ((dev.mpsConnection != null) && (dev.mpsConnection.tag != null) && (dev.mpsConnection.tag.meiState != null) && (typeof dev.mpsConnection.tag.meiState['core-ve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run check of lazy elements after timeout | function timeoutLazyElements() {
if (waitingMode > 1) {
waitingMode = 1;
checkLazyElements();
setTimeout(timeoutLazyElements, options.throttle);
} else {
waitingMode = 0;
}
} | [
"function timeoutLazyElements() {\n\t if (waitingMode > 1) {\n\t waitingMode = 1;\n\t checkLazyElements();\n\t setTimeout(timeoutLazyElements, options.throttle);\n\t } else {\n\t waitingMode = 0;\n\t }\n\t }",
"function waitForFullPageLoad(){\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the has changed to true | setHasChanged() {
this.hasChanged = true;
} | [
"function setHasChanges() {\n if (!HasChanges)\n HasChanges = true;\n}",
"setChanged() {\n this.isChanged = true;\n }",
"setChanged(bool) {\n this.hasChanged = bool;\n\n if (!bool) {\n this.activeEls = [];\n this.loopCompleted = false;\n }\n }",
"function setHasChanges(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
packageName becomes a dependency of every entry in depObj if it exists in the store. | _addDependentsToPackage (packageNode, depObj, type) {
Object.keys(depObj).forEach(dependencyName => {
if (this.packageStore.hasOwnProperty(dependencyName)) {
// packageNode has a dependency of dependencyName - therefore dependencyName is dependent on packageNode
const... | [
"setPersistDependencies () {\n const dependencies = []\n\n this.objectAtrrs.forEach((attr) => {\n const modelResource = new Dependence(attr.type)\n modelResource.resolved = false\n modelResource.addChild(attr.type)\n if (attr.type !== this.name) dependencies.push(modelResource)\n })\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the locale id that will be used for translations and ICU expressions. This is the ivy version of `LOCALE_ID` that was defined as an injection token for the view engine but is now defined as a global value. | function setLocaleId(localeId) {
assertDefined(localeId, "Expected localeId to be defined");
if (typeof localeId === 'string') {
LOCALE_ID = localeId.toLowerCase().replace(/_/g, '-');
}
} | [
"function setLocaleId(localeId) {\n assertDefined(localeId, \"Expected localeId to be defined\");\n\n if (typeof localeId === 'string') {\n LOCALE_ID = localeId.toLowerCase().replace(/_/g, '-');\n }\n }",
"function setLocaleId(localeId) {\n assertDefined(localeId, `Expected localeId to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function menu_click(url, id, obj) | function menu_click(url, sTarget)
{
if(sTarget=="" || sTarget=="_self")window.location.href=url;
else window.open(url);
} | [
"function context_menu_clicked(obj) {\n if (DEBUG) {\n console.log(\"LL: context_menu_clicked(obj) called\\ndump of obj:\");\n debug_dump(obj);\n }\n if (obj.menuItemId == MENU_ITEM_ID) {\n if (current_link) store_link(current_link);\n }\n}",
"function onItemActionClick(event){\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Advances the out, and, if necesary, advances the inning | function advanceOut() {
outs++;
if (outs == 3) {
advanceInning();
return true;
}
return false;
} | [
"function handleOuts(){\n\t\t\tvar inningChanging = false;\n\t\t\tvar pitcher = getPitcher();\n\n\t\t\toutCount++;\n\t\t\tpitcher.inningsPitched = parseFloat((pitcher.inningsPitched + 0.1).toFixed(1)); //needed since JS sometimes generates a bunch of decimals after\n\n\t\t\t//a whole inning was pitched if adding 0.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
query and filter database to show ratio between red and green flags | function showflagdata(url) {
// Create the query to load the last 12 messages and listen for new ones.
var greenflag = 0;
var redflag = 0;
var query = firebase.firestore()
.collection('messages')
.where("url", "==", url)
.get()
.then(function (querySnapshot) {
... | [
"function colorizeQuery(sql) {\n return illuminate(sql);\n}",
"function getUserColor(username) {\n console.log('This will query db for user color');\n}",
"getDominantColor() {\n\n var firstArray = this.firstFilter()\n var secondArray = []\n\n var red = firstArray[0].red\n var green = firstArra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method mimics Observable.fromEvent, but with capture semantics. | function fromEventCapture(element, name) {
return _Observable.Observable.create(subj => {
const handler = function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length > 1) {
subj.next(args);
... | [
"function fromEventCapture(element, name) {\n return Observable.create((subj) => {\n const handler = function (...args) {\n if (args.length > 1) {\n subj.next(args);\n } else {\n subj.next(args[0] || true);\n }\n };\n\n element.addEventListener(name, handler, true);\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the cookiename begins with a casesensitive match for the string "__Host", abort these steps and ignore the cookie entirely unless the cookie meets all the following criteria: 1. The cookie's secureonlyflag is true. 2. The cookie's hostonlyflag is true. 3. The cookieattributelist contains an attribute with an attribu... | function isHostPrefixConditionMet(cookie) {
validators.validate(validators.isObject(cookie));
return (
!cookie.key.startsWith("__Host-") ||
(cookie.secure &&
cookie.hostOnly &&
cookie.path != null &&
cookie.path === "/")
);
} | [
"function isHostPrefixConditionMet(cookie) {\n return !cookie.key.startsWith(\"__Host-\") || cookie.secure && cookie.hostOnly && cookie.path != null && cookie.path === \"/\";\n }",
"function isHostPrefixConditionMet(cookie) {\n return (\n !cookie.key.startsWith(\"__Host-\") ||\n (cookie.secure &&\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a bundle to disk and return a promise to indicate success. | function writeBundleToDisk(sessionPath, bundleName, data, wsConnect) {
var deferred = Q.defer();
// update bundleList
updateBndlListEntry(wsConnect.bndlListPath, {
'name': data.annotation.name,
'session': data.session,
'finishedEditing': data.finishedEditing,
'comment': data.comment
}).then(functi... | [
"function promiseWrite(file, data, options) {\r\n\treturn new Promise((resolve, reject) => {\r\n\t\tFileSystem.writeFile(file, data, options, (e) => {\r\n\t\t\tif (e) reject(e);\r\n\t\t\telse resolve('Successfuly saved ' + file.toString());\r\n\t\t});\r\n\t});\r\n}",
"write(path, bytes) {\n return new Prom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
tarjeta para editar los datos | function editarTarjeta(datos) {
return `
<div class="editar">
<div class="informacion">
<div class="id">${datos.id}</div>
<div class="nombre data">
<input type="text" value="${datos.nombre}"/>
</div>
<div class="fecha data">
<input type="text" value="${datos.fecha}"/>
</div... | [
"function dataToEdit() {\n tableDataForEdit = $this.parent().parent().children();\n var dataToArray = tableDataForEdit.map(function() {\n return $(this).text();\n }).get();\n\n $('#edit-record-id').val(dataToArray[0]);\n $('#edit-artist').val(dataToArray[1]);\n $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
attempt to fit all objects in smallest remaining bin, stacking up to three levels high | function selectBin() {
while (bins.length > 0) {
var contentsB = contents.slice();
//prioritiseTall puts any items with a height of 75%+ of the bin to the front of the array
contentsB = prioritiseTall(bins[0], contents.slice());
var space = [bins[0].length, bins[0].width, bins[0].height];
v... | [
"function create_bin(rectangles, bin, current_bin_level) {\n remaining_rec = []\n bin_height = rectangles[0].height\n bin_width = bin.width\n //current_coord represents the previous rect top_right\n current_coord = [0, 0]\n for (i = 0; i < rectangles.length; i++) {\n rect = rectangles[i]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that is necessary to insert fee info to current container | function insertFeeInto(fee_container, options)
{
var wrap = options.wrap || false;
var prepend = options.prepend || null;
var template = '' +
'<span data-role="heading">' + options.title + '</span>' +
' ' +
'<span data-role="value">' + options.value + '</... | [
"function insertFeeInto(fee_container, options)\n {\n var wrap = options.wrap || false;\n var prepend = options.prepend || null;\n\n var template = '' +\n '<span data-role=\"heading\">' + options.title + '</span>' +\n ' ' +\n '<span data-role=\"value\">' + op... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resets everything INCLUDING walls | function resetWalls() {
wallSet.clear();
reset();
} | [
"function resetWalls() {\r\n wallSet.clear();\r\n reset();\r\n}",
"function resetGame(){\n \n // stop the intervaltimer\n endGame();\n\n // remove all content from canvas\n while (gameCanvas.hasChildNodes()){\n gameCanvas.removeChild(gameCanvas.firstChild);\n }\n\n // clear walls.wal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Receives order, validates it and leaves the store | receiveOrder(_order) {
this.validateOrder(this.order, _order);
if (this.validateOrder(this.order, _order) == true) {
this.mood = CUSTOMER_MOOD.HAPPY;
}
this.state = CUSTOMER_SITUATION.LEAVING;
setTimeout(function () {
KebapHouse... | [
"function validateOrder(order) {\n\tconst schema = {\n\t\tcustomerId: Joi.objectId().required(),\n\t\tfood: Joi.array().required(),\n\t\tstatus: Joi.string()\n\t};\n\treturn Joi.validate(order, schema);\n}",
"function _validateOrder(order)\n {\n return new Promise(function(fulfill, reject)\n { \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function hotswaps the favicon based on the page formatting | function swapFavicon(state) {
// Grab the various favicons to update
// <link rel="icon" type="image/png" sizes="32x32" href="assets/favicon/favicon-32x32.png" id="favicon32">
// <link rel="icon" type="image/png" sizes="16x16" href="assets/favicon/favicon-16x16.png" id="favicon16">
// <link rel="mask-icon" href... | [
"function changeFavicon() {\n let icon = document.querySelector(\"#favicon\");\n if (isRunning) {\n icon.setAttribute(\"href\", \"images/favicon-32x32.png\");\n } else {\n icon.setAttribute(\"href\", \"images/output-onlinepngtools.png\")\n }\n }",
"function cha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when a shape is selected and the copy/paste button is pressed this function gets called. depending on which type of shape is selected and needs to be copied, need to create a new object and set it's values to the same as the shape selected and then reposition it in the centre of the canvas. | function copyShape() {
if (anySelected) {
copy = true;
var shape = previousSelectedShape;
if (shape instanceof Circle) {
//this.radius = Math.sqrt(Math.pow(x2 - this.x1, 2) + Math.pow(y2-this.y1, 2));
// how the radius is calculated
newShape = new Circle(shape.x1, shape.y1, shape.radius , shape.r... | [
"function selectShape(shape) {\n selectedShape = shape;\n}",
"function confirmCopy(){\n\n\tif (currentMode == \"Select\"){\n\tif (!enableCopy){\n\t\tenableCopy = true;\n\t\t\n\tfor(var i= 0 ;i <=drawnShapes.length-1; i++) {\n\t\t\tn = drawnShapes.length;\n\t\t\tif (drawnShapes[i].isSelected){\n\t\t\t\n\t\t\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the bytes of the 'bext' chunk. | getBextBytes_() {
/** @type {!Array<number>} */
let bytes = [];
this.enforceBext_();
if (this.bext.chunkId) {
this.bext.chunkSize = 602 + this.bext.codingHistory.length;
bytes = bytes.concat(
packString(this.bext.chunkId),
pack(602 + this.bext.codingHistory.length, th... | [
"getBextBytes_() {\r\n /** @type {!Array<number>} */\r\n let bytes = [];\r\n this.enforceBext_();\r\n if (this.bext.chunkId) {\r\n this.bext.chunkSize = 602 + this.bext.codingHistory.length;\r\n bytes = bytes.concat(\r\n packString(this.bext.chunkId),\r\n pack$1(602 + this.bext.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle search form submission: get shows from API and display. Hide episodes area (that only gets shown if they ask for episodes) | async function searchForShowAndDisplay() {
const term = $("#searchForm-term").val();
const shows = await getShowsByTerm(term);
$episodesArea.hide();
populateShows(shows);
} | [
"async function searchForShowAndDisplay() {\n const term = $(\"#searchForm-term\").val();\n const shows = await getShowsByTerm(term);\n\n // $episodesArea.hide();\n populateShows(shows);\n}",
"function searchEpisodes(){\n searchBar = document.getElementById(\"searchBar\");\n // allEpisodes = getEpisodes();\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render a component based on the state variable currentComp | render() {
return (
<div>
{this.returnComponent(this.state.currentComp)}
</div>
)
} | [
"render() {\n if (this.props.components !== undefined) {\n return (\n <div>\n {this.props.components[this.state.current]}\n </div>\n );\n } else {\n return null;\n }\n }",
"render() {\n return (\n <div>\n {\n this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Aligns the child elements based on a point | alignChildBasedOnaPoint(child, x, y) {
x += child.margin.left - child.margin.right;
y += child.margin.top - child.margin.bottom;
switch (child.horizontalAlignment) {
case 'Auto':
case 'Left':
x = x;
break;
case 'Stretch':
... | [
"layout() {\n let height = 0;\n this._xpos = 0;\n for (let i = 0; i < this.children.length; i++) {\n const child = this.children[i];\n if (i > 0) {\n this._xpos += this.spacing;\n }\n child.x = this._xpos;\n this._xpos += child.width;\n height = Math.max(height, child.y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the element in the alpha | findElement(element, alpha) {
let j;
for (j = 0; j < alpha.length; j++) {
if (element === alpha[j]) {
break;
}
}
return j;
} | [
"function findElIndex(el) {\n let elIndex;\n for (let i = 0; i < colorBox.length; i++) {\n const element = colorBox[i];\n if (element === el) {\n elIndex = i;\n }\n }\n return elIndex;\n }",
"GetClosestAlpha(x, y) {\n\t\t\t\t\tlet max_distance_squared = -1;\n\t\t\t\t\tlet closes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dispatches all synthetic events on the event queue. | function processEventQueue(simulated){// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue=eventQueue;eventQueue=null;if(!processingEventQueue){return;}if(simulated){forEachAccumulated(processingEventQueue,executeDispatchesAndRele... | [
"function dispatch() {\n \n while( eventQueue.length ) {\n var event1 = eventQueue.pop();\n send( event1.eventClass, event1.eventType, event1.params );\n }\n }",
"function processEventQueue(simulated){// Set `eventQueue` to null before processing it so that we can tel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the cursor or leaf node selection closest to the start of the given document. Will return an [`AllSelection`]( if no valid position exists. | static atStart(doc2) {
return findSelectionIn(doc2, doc2, 0, 0, 1) || new AllSelection(doc2);
} | [
"get documentStart() {\n if (!isNullOrUndefined(this.selectionModule)) {\n return this.selection.getDocumentStart();\n }\n return undefined;\n }",
"function getStartNode(selection) {\n const type = typeof selection;\n if (type === 'string') {\n return document.query... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retorna um number representando a quantidade de faces do dado | getQuantidadeFaces() {
return Faces
} | [
"getNumFaces() {\n //If necessary, default is to enumerate faces and return that.\n return Array.from(this.countFaces().values()).reduce( (accumulator, cur) => {\n return accumulator + cur;\n }, 0);\n }",
"getSize() {\r\n return 6 * this.sides + 6 * this.sides * this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the `DeviceMotion` module instance. | function DeviceMotionModule() {
_classCallCheck(this, DeviceMotionModule);
_get(Object.getPrototypeOf(DeviceMotionModule.prototype), 'constructor', this).call(this, 'devicemotion');
/**
* Raw values coming from the `devicemotion` event sent by this module.
*
* @this DeviceMotionModule
... | [
"function DeviceMotionModule() {\n _classCallCheck(this, DeviceMotionModule);\n\n /**\n * Raw values coming from the `devicemotion` event sent by this module.\n *\n * @this DeviceMotionModule\n * @type {number[]}\n * @default [null, null, null, null, null, null, null, null, null]\n */\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
REDIRECT POSITION OF THE PAGE ALWAYS AT THE TOP | redirectAtTop(){
$(document).ready(function(){
$(this).scrollTop(0);
});
} | [
"static navigateToTopOfPage(): void {\r\n window.scrollTo(0, 0);\r\n }",
"static navigateToTopOfPage(): void {\n window.scrollTo(0, 0);\n }",
"function pageToTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}",
"function goTop() {\n window.scrollTo(0, 0);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse a datetime. DATETIME := ORIGIN (WS ('+'|'') DURATION) ORIGIN := '' | 'now' | 'today' | 'next' DAYOFWEEK DAYOFWEEK := 'monday'..'sunday' | function parseDateTime(str) {
const datespec = str.split(/(?:\s+|^)([+-])/);
let curr = _parseOrigin(datespec.shift());
while(datespec.length) {
const direction = datespec.shift();
const offset = _parseDuration(datespec.shift());
if (direction === "+") {
curr = curr.plus(offset);
}
el... | [
"function alternateXsdatetimeDecoder(xsdatetimeStr) {\n // taken from DashParser - should probably refactor both uses\n var SECONDS_IN_MIN = 60;var MINUTES_IN_HOUR = 60;var MILLISECONDS_IN_SECONDS = 1000;var datetimeRegex = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\\.[0-9]*)?)?(?:(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
You are given a program squaresOnly that accepts an array of natural numbers up to and including 100 (and including 0) of length >= 1, array, and returns a new array containing only square numbers that have appeared in the input array. Refactor the solution to use as few characters as possible. There is a maximum chara... | function squaresOnly(arr) {
return arr.filter(num => Number.isInteger(Math.sqrt(num)));
} | [
"function squareNumbers(array) {\n\n // 3. Go over each value, squaring each value with my square function, and mapping it into a new array.\n \nconst squares = arr.map(square => Math.sqrt(square));\n return squares;\n}",
"function emptySquares() {\n return origBoard.filter(s => typeof s === 'number')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
iOS 7.1 introduced two new bugs: 1) It's possible to open links within a contentEditable area by clicking on them. 2) If you hold down the finger it will display the link/image touch callout menu. | function tapLinksAndImages() {
editor.on('click', function(e) {
var elm = e.target;
do {
if (elm.tagName === 'A') {
e.preventDefault();
return;
}
} while ((elm = elm.parentNode));
});
editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}');
} | [
"function tapLinksAndImages(){editor.on('click',function(e){var elm=e.target;do{if(elm.tagName==='A'){e.preventDefault();return;}}while(elm=elm.parentNode);});editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}');}",
"function tapLinksAndImages() {\n editor.on('click', function (e) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does the given object match the filter supplied? This uses marshall and the JSON to convert the object to string, lowercases it and then compares it to the filter. The filter is converted to lower case and broken up via the " " token. The lowercase string must match all split filters. | matches(filter) {
//Gatecheck the filter before continuing
if (!filter) {
return true;
}
// Converts the input objects into lowercase split items
let tokens = filter.toLowerCase().split(" ");
let text = JSON.stringify(this).toLowerCase().replace(new RegExp("\"... | [
"filter_objects(objarr, filters={}) {\n if (!this.is_array(objarr)) return false;\n var results = [];\n filters = this.lower_props(filters);\n for (var i=0; i < objarr.length; i++) {\n var obj = objarr[i];\n var fields = Object.getOwnPropertyNames(obj);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializing the created array with 0 and borders with 5 | function initArray(matrix, rows, cols) {
for (let i = 0; i < rows; i++) {
for (let j = 0; j < cols; j++) {
/* Conditions used to seperate out the Borders */
if (i == 0 || j == 0 || i == rows - 1 || j == cols - 1) {
matrix[i][j] = 5;
} else {
matrix[i][j] = 0;
... | [
"function createMatrix() {\n\n /* Initializing the created array with 0 and borders with 5 */\n function initArray(matrix, rows, cols) {\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < cols; j++) {\n\n /* Conditions used to seperate out the Borders */\n if (i == 0 || j == 0 || i == ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a list of app resource IDs to which a user on your team has access. | function getAllVisibleAppResourceIDsForUser(api, id, query) {
return api_1.GET(api, `/users/${id}/relationships/visibleApps`, { query })
} | [
"getIdsForApps({ user_id, app_secret, app, page, access_token, }) {\n return this.getUserField({\n field: 'ids_for_apps',\n user_id,\n app_secret,\n app,\n page,\n access_token,\n });\n }",
"getApps () {\n this._checkProfile()\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Work in progress / TODO ======================== still Todo: Write documentation Decoder GUI | function on_draw_gui_decoder()
{
var i;
ScanaStudio.gui_add_ch_selector("ch","Channel to decode","UART");
ScanaStudio.gui_add_baud_selector("baud","BAUD rate",9600);
ScanaStudio.gui_add_new_tab("Output format",true);
ScanaStudio.gui_add_check_box("format_hex","HEX",true);
ScanaStudio.gui_add_ch... | [
"function on_draw_gui_decoder()\n{\n var i,s;\n //Define decoder configuration GUI\n ScanaStudio.gui_add_ch_selector(\"ch_clock\",\"CLOCK line\",\"CLOCK\");\n ScanaStudio.gui_add_ch_selector(\"ch_data\",\"DATA Line\",\"DATA\");\n ScanaStudio.gui_add_new_tab(\"Display options\",false);\n ScanaStudio.gui_add_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `ConfluencePageToIndexFieldMappingProperty` | function CfnDataSource_ConfluencePageToIndexFieldMappingPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected ... | [
"function CfnDataSource_ConfluenceBlogToIndexFieldMappingPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear old people from the array | function clearPeople() {
for (var x = 0; x < people_to_remove.length; x++) {
var remove_id = people_to_remove[x];
for (var i = 0; i < people.length; i++) {
if (people[i].id == remove_id) {
people.splice(i, 1);
break;
}
}
}
peopl... | [
"clear() {\n // this.contacts = {}; // Does this create floating memory packets that take up space or do JavaScript handlers automatically garbage collect this?\n this.contacts.splice(0, this.contacts.length);\n // console.log(this.contacts);\n }",
"function clear() {\n console.log(\"Removing every ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switch the game mode to Idle mode | function switchToIdleMode() {
// Update the high score if the current score is higher
if (score > highScoreIdle) {
highScoreIdle = score;
}
// Reset the score and update the display
score = 0;
updateScore();
// Update the game mode flag
isIdleMode = true;
// Disable the click button during Idle... | [
"function setIdle() {\n clearTimeout(idleTimer);\n stopClock();\n }",
"function manuallMode() {\r\n gManuallyMode = !gManuallyMode\r\n initGame()\r\n}",
"function EnterIdle() {\n console.log(\"Enter Idle\");\n setTimeout(function() {\n SwitchState(BaseEnum.init);\n },1000);\n}",
"resetIdle(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds an additional backslash character to each single and double quotes in the userdefined pattern. | function escapeAllQuotes ( pattern ) {
var escaped_pattern = pattern.replace(/\'/g,"\\'");
return escaped_pattern.replace(/\"/g,'\\"');
} | [
"function _escaped_backslash() { return two_slashes; }",
"function add_slashes(s) {\n return s.replace(/['\"]/g, \"\\\\$&\"); \n}",
"function escapeForDoubleQuotes(text) {\r\n\tvar tmp = text.replace(/(\\\\|\"|\\$)/g,\"\\\\$1\");\r\n\treturn tmp;\r\n}",
"function escapePattern(pattern) {\n return patter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setup Table for ResponseAndMarks | function setupTableForResponseAndMarks(tx){
console.log("before execute sql for ResponseAndMarks Database");
tx.executeSql("CREATE TABLE IF NOT EXISTS responseandmark(row_id INTEGER PRIMARY KEY,teacher_id INTEGER,student_id INTEGER,lesson_id INTEGER,\
exercise_id INTEGER,response,scoremark INTEGER,comment)"... | [
"function setTable(response){\n let duration = milliToMinutes(response.trackTimeMillis);\n\n let output = `\n <tr>\n <td tableHeadData=\"Artist: \">${response.artistName}</td>\n <td tableHeadData=\"Album: \">${response.collectionName}</td>\n <td tableHeadData=\"Track: \">${response.trackName}</t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get something from the socket | function on_socket_get(message) {"use strict"; } | [
"function on_socket_get(message){}",
"function retrieveChat() {\r\n socket.emit(\"retrieveChat\")\r\n}",
"get bytesRead() {return this._socket.bytesRead;}",
"getConnectedSocket() { return this._socket; }",
"function request_data(){\n\tif(connected){\n\t socket.emit('request_data');\n\t}\n}",
"readSo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove this mark from the given set, returning a new set. If this mark is not in the set, the set itself is returned. | removeFromSet(set) {
for (let i = 0; i < set.length; i++)
if (this.eq(set[i]))
return set.slice(0, i).concat(set.slice(i + 1));
return set;
} | [
"removeFromSet(set) {\n for (var i = 0; i < set.length; i++)\n if (set[i].type == this) {\n set = set.slice(0, i).concat(set.slice(i + 1));\n i--;\n }\n return set;\n }",
"removeStoredMark(mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$he... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This class defines the metadata for a record column. index the index i the data array id string id label string label to show to user type for now not used but once we have string or other column types we'll need it missing the missing value forthis field. Probably not needed and isn't used as I think RAMADDA passes in... | function RecordField(props) {
$.extend(this, {
isDate: props.type == "date",
isLatitude: false,
isLongitude: false,
isElevation: false,
});
$.extend(this, props);
$.extend(this, {
isNumeric: props.type == "double" || props.type == "integer",
prop... | [
"function ColumnMeta() {}",
"parseHRecord(data){\n\t\t\n\t\t\tlet datasource = data.substr(0, 1);\n\t\t\tlet subtype = data.substr(1, 3);\n\t\t\tlet title, value;\n\t\t\t\n\t\t\tdata = data.substr(4);\n\t\t\t\n\t\t\tif (data.indexOf(':') > -1){\n\t\t\t\n\t\t\t\tlet datasplit = data.split(':');\n\t\t\t\t\n\t\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
strictEquals(a)(b) Curried function for `===`. | function strictEquals(a) {
return b => a === b;
} | [
"function equals(x) {\n return function(y) {\n return Z.equals (x, y);\n };\n }",
"function _eq (a, b) {\n return a === b\n}",
"function isLooselyEqual(value1, value2) {\n // YOUR CODE HERE\n}",
"function makeEqualsFunction(fn) {\n if (typeof fn === 'function') {\n return fn;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function used to draw the green line below the score | function scoreLine() {
const moveTo = canvas.width <= 560 ? 77 : 87;
const lineTo = canvas.width <= 560 ? 80 : 90;
ctx.strokeStyle = "#" + 458107;
ctx.lineWidth = 3;
ctx.beginPath();
ctx.moveTo(0, moveTo);
ctx.lineTo(canvas.width, lineTo);
ctx.stroke();
} | [
"function drawScore() {\n\n textAlign(LEFT);\n noStroke();\n fill(0);\n textSize(50);\n text(score, 10, 50);\n }",
"scoreDisplay() {\n fill(this.colorRed, this.colorGreen, this.colorBlue);\n rect(this.scoreX, this.scoreY, width / 3, height);\n }",
"drawGreen() {\n stroke(0, 255, 0)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
testInfo() is used to add extra info to results. | function testInfo(name, value){
activeSuite.info[name] = value;
} | [
"function _renderTestsInfo() {\n\n // ...\n\n }",
"function displayInfo(returnedInfo){\n\t// Print the results to the page:\n\twriteit(returnedInfo,\"trackInfo\");\n}",
"function showUnitTestDetails(num, source_url, sparql_url)\n{\n var jldExtractorUrl = getJldExtractorUrl();\n var n3ExtractorUrl = \"ht... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to calculate the overall rating on the Modify page | function calculateOverallRatingModify() {
var foodQuality = parseFloat($("#BAFoodQualityModify").val());
var service = parseFloat($("#BAServiceModify").val());
var value = parseFloat($("#BAValueModify").val());
var overall = (foodQuality + service + value) / 3 ;
$("#BARatingsModify").val(overall);
... | [
"getAvgRating() {\n var ratingSum = 0;\n this.ratings.forEach(mySum);\n function mySum(item) {\n ratingSum += item.rating;\n }\n return ratingSum / this.ratings.length;\n }",
"getAverageRating() {\r\n\r\n }",
"function updateRating(place) {\n\tvar overallRating ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the provided searchValue is found in this URLBuilder, then replace it with the provided replaceValue. | replaceAll(searchValue, replaceValue) {
if (searchValue) {
this.setScheme(replaceAll(this.getScheme(), searchValue, replaceValue));
this.setHost(replaceAll(this.getHost(), searchValue, replaceValue));
this.setPort(replaceAll(this.getPort(), searchValue, replaceValue));
... | [
"function replace(input, searchValue, replaceValue) {}",
"static replaceAll(input, searchValue, replaceValue) {\n return input.split(searchValue).join(replaceValue);\n }",
"function replaceAll(value, searchValue, replaceValue) {\n return !value || !searchValue ? value : value.split(searchValue).joi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var regexpNormalizer_simple = ftrs.RegexpNormalizer( JSON.parse(fs.readFileSync(__dirname+'/knowledgeresources/SimpleNormalizations.json'))); output: only intent and only single labeled or null output shoud be prepared for train(input and output) and test(input) sentence is a hash and not an array lemma and pos are req... | function getRule(text)
{
/* if (!('tokens' in sen))
{
console.vlog("DEBUGRULE: for some reason tokens is not in the sentence " + JSON.stringify(sen, null, 4))
throw new Error("DEBUGRULE: for some reason tokens is not in the sentence " + JSON.stringify(sen, null, 4))
}
*/
// var sentence = JSON.parse(JSON.strin... | [
"function TextPreprocesser(article, userTokens, userTokensSplit) {\n \n // Fucntion to clean up anything with the article that is passed in.\n this.cleanArticle = function (article) {\n \n // Regex to remove two or more spaces in a row.\n return article.replace(/[ ]+(?= )/g, \"\");\n \n }\n \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For each message from the provider, check for a match in the local db. If any changes, get its _id and _rev to update the record instead of inserting a new one. But if no changes, just discard the record from the update batch. If no match, just insert the record asis. | function detectUpdates (fetched, existing) {
const existingByProviderId = keyBy(existing, 'key')
return fetched.map((msg) => {
const match = existingByProviderId[msg.providerId]
if (match) {
if (msg.status !== match.value.status) {
// Changes detected (we only care about status at the moment)... | [
"function updateMessages() {\n var messages = app.messages;\n while (unprocessedMessages.length > 0) {\n // Get first unprocessed message in queue\n var msg = unprocessedMessages.shift();\n // Search for an existing message in the table\n var msgFound = false;\n for (var i =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compone la prte di stringa fixed corrispondente al campo | function _build_fixed(value, field) {
if (field.length < 1) field.length = 1;
const str = '' + value;
if (str.length > field.length) {
return str.substr(0, field.length);
} else if (str.length < field.length) {
return u.pad(str, field.length, field.align, ' ');
} else {
return str;
}
} | [
"function formataAgenciaConta(campo){\r\n\tcampo.value = filtraCampo(campo);\r\n\tvr = campo.value;\r\n\ttam = vr.length;\r\n\tif ( tam <= 1 )\r\n\t\tcampo.value = vr;\r\n\tif ( tam > 1 ) \r\n\t\tcampo.value = vr.substr(0, tam-1 ) + '-' + vr.substr(tam-1, tam); \r\n}",
"function formataAgenciaConta(campo){\n\tcam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. montar array apenas com os nomes exemplo de retorno ['bulbasaur', 'charmander', 'squirtle', etc...] retorna um array dos nomes de todos pokemons | function pokemonsNames() {
const mapResult = data.map(({ name }) => name);
// nessa caso utilizamos direto o destructuring
// mas poderíamos também fazer dessa forma
// const mapResult = data.map((pokemon) => pokemon.name);
return mapResult;
} | [
"function getNames(){\n let allPokemonName = [];\n \n for(let i=0; i < allPokemon.length; ++i){\n let pokemonName = allPokemon[i].Name;\n allPokemonName.push(pokemonName);\n }\n \n return allPokemonName;\n}",
"function nameListNoMap() {\n let names = []\n for (let i = 0; i < poke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
component wrapper for new comment form and comments associated with current main video found in state | function VideoComments({comments, onComment, onDelete, onCommentLike, convertTime}) {
// form handler which invokes the comment handler passed through props and passes the header and newComment objects as arguments
const handleCommentSubmit = (e, form, onComment) => {
e.preventDefault()
const he... | [
"function Comments({currentVideo, submitHandler}){\n let currentComments = currentVideo.comments;\n let firstThree = currentComments.slice(0, 3)\n let restOfComments = currentComments.slice(3)\n let firstThreeReversed = firstThree.slice().reverse();\n let concatComments = firstThreeReversed.concat(re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allows for creation of, and subscription to, any custom events on the individual store. Pass any data you want as the second arg. It will be received by the subscribers along with the state. | notify(eventName, eventData) {
stateEventEmitter.emit(`${storeName}-${eventName}`, eventData);
} | [
"subscribe(name, event, callback) {\n _stores[name].on(event, callback);\n }",
"mapStoreEvents() {\n\t\tconst events = this.handleStoreEvents();\n\t\tfor (const eventType in events) {\n\t\t\t/* eslint-disable no-prototype-builtins */\n\t\t\tif (events.hasOwnProperty(eventType)) {\n\t\t\t\tthis.storage.o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform a space separated string into a string suitable to be used as a css class, e.g. "constructor method" > "Constructormethod". | static toStyleClass(str) {
return str
.replace(/(\w)([A-Z])/g, (_m, m1, m2) => m1 + "-" + m2)
.toLowerCase();
} | [
"function genClassName(str) {\n return str.trim().replace(/\\s+/g, '-').toLowerCase();\n}",
"function genClassName(str) {\n return str.replace(/\\s+/g, '-').toLowerCase();\n}",
"function makeClassName(text) {\n\treturn text.toLowerCase().replace(' ', '_');\n}",
"function createClassName(text)\n{\n\n // En... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function: remove first sentence ending with period | function cut_first_sentence(string) {
let index = string.indexOf(".");
return string.substring(index + 1, string.length).trim();
} | [
"function correctSentence(text) {\n text = text.charAt(0).toUpperCase().concat(text.substr(1));\n if(!text.endsWith('.')){\n return text.concat('.');\n } \n return text;\n}",
"function removeLeadingDot(dotName)\r\n{\r\n var index = dotName.indexOf(\".\");\r\n if (0 != index)\r\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
runs on every frame, as long as there are media sources (img, video, canvas, etc.) to check, dirty target nodes or pre/post callbacks to run. any sources that are updated are set to dirty, forcing all dependent nodes to render | function renderDaemon() {
var i, node, media,
keepRunning = false;
rafId = null;
if (preCallbacks.length) {
keepRunning = true;
for (i = 0; i < preCallbacks.length; i++) {
preCallbacks[i].call(seriously);
}
}
if (sources && sources.length) {
keepRunning = true;
for (i = 0;... | [
"update () {\n let hasChanged = false\n for (let i = 0, l = this.sources.length; i < l; i++) {\n const source = this.sources[i]\n if (!source || source.lastChanged < this._lastRendered) continue\n source.update()\n hasChanged = true\n }\n if (!hasChanged) return\n this._lastRender... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the index of the first day of a given day array | function firstDay (dayArray) {
for (var i = 0; i <= dayArray.length - 1; i++) {
day = dayArray[i];
if (day) {
return i;
}
}
return -1;
} | [
"firstDayIdx(month, year) {\r\n return new Date(year, month, 1).getDay();\r\n }",
"function dayAsIndex(day) {\n\treturn days.indexOf(day);\n}",
"function findFirstDay(data) {\n\tlet curDate = new Date(dateonly(new Date()) - (daysToShow-1) * msPerDay);\n\tlet start;\n\tfor (start = 0; start < data.length... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns array of path to key, or empty array if doesn't exist | function path(arr, key) {
const pathArr = [];
let keyIndex = arr.indexOf(String(key));
if (keyIndex === -1) {
return [];
}
while (keyIndex !== 0) {
pathArr.push(arr[keyIndex]);
const parentIndex = Math.floor((keyIndex - 1) / 2);
keyIndex = parentIndex;
}
path... | [
"function getPath(key) {\n return typeof key == 'string' ? key.split('.') : [ String(key) ]\n}",
"function keyToArray(key){\n if (!key) return [];\n if (typeof key != \"string\") return key;\n return key.split('.');\n }",
"getPathNames() {\n return Object.keys(paths)\n }",
"function keyTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtiene la humedad de un determinado Shape referenciado por el ID | function fgetHum(id){
return this.shapes[id].hum;
} | [
"getId(shape) {\n for (var i = 0; i < shape.length; i++) {\n for (var j = 0; j < shape[i].length; j++) {\n if (shape[i][j] != 0) {\n return shape[i][j]\n }\n }\n }\n }",
"function removeShapeByID(id) {\n var shape = this[id];... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to remove icons(classes) from cards | function eraseCards() {
// create array of i elements which represents cards
const cardsList = document.querySelectorAll(".entire-card .fas");
// remove icon-class for each i element
for (let i = 0; i < cardsList.length; i++) {
cardsList[i].classList.remove(...cardsDeck);
}
} | [
"function removeClasses() {\r\n for (const index in cards) {\r\n cards[index].classList.remove(\"match\", \"open\", \"show\");\r\n };\r\n}",
"function remove_hide_Cards() {\n\tlistOfOpenCards.map(x => x.className = 'card');\n\tlistOfOpenCards = [];\n}",
"removeIconClass() {\n let list = this.icon.cl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This CliContextualizer class is the child class of its abstract base Contextualizer, and is designed to process the incoming command line request, and add contextualized data into the passedin CliiAction object based on the command line arguments in order to complete the following processing. | function CliContextualizer () {
/* inheritance */
this.super();
} | [
"function HttpContextualizer () {\n /* inheritance */\n this.super();\n }",
"function ctxArgsAdjust() {\n // adjust arg vars\n opt = msg;\n msg = type;\n type = context;\n }",
"function ActionContext(opts) {\n\n var c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that the input values array have a correct type for the port in the same position. Returns values or throw. | function validateInput(ins, values) {
angular.forEach(ins, function(port, i) {
validateValueForPort(port, values[i]);
});
return values;
} | [
"function checkElementType(array)\n{\n for(let i=0;i<array.length-1;i++)\n {\n if(typeof array[i] !== typeof array[i+1])\n {\n throw `Insert same type of data`;\n }\n\n }\n return array;\n}",
"_verifyValueAssignment(values) {\n if (values.length > 1 && !this._mul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change all square color to the selected color | function changeAllSquare(){
for(var i=0;i<6;i++){
squares[i].style.background = selectedColor ;
}
} | [
"function changeColorAllSquares(color) {\n\t// Loop Through All Squares\n\tfor (var i = 0; i < squares.length; i++) {\n\t\t// Change Each Color to Match Picked Color\n\t\tsquares[i].style.background = color;\n\t}\n}",
"function changeColors(color){\n//loop thru all squares\nfor (var i=0;i<squares.length;i++){\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given options, attachSql1 will produce the correct SQL to attach a database file in sqlite3. This is for the first database file. | function attachSql1(options) {
console.log("attachSql1:options="+JSON.stringify(options));
// @todo possibly use something other than dbtable1
let retSql = "attach database '" + options.cwd1 + options.dbfile1 + "' " + 'AS' + ' ' + options.dbtable1;
return retSql;
} | [
"function attachSql1(options) {\n debug(\"attachSql1:options=\"+JSON.stringify(options));\n // @todo possibly use something other than dbtable1\n let retSql = \"attach database '\" + options.cwd1 + options.dbfile1 + \"' \" + 'AS' + ' ' + options.dbtable1;\n return retSql;\n}",
"function attachSql0(opt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Buffer.from function, if present(usually in node.js environment) | function getBufferFromIfPresent() {
return root.Buffer && root.Buffer.from && root.Buffer.from.bind(root.Buffer);
} | [
"testBufferFrom() {\r\n\t\tconst str = 'Stand and deliver.';\r\n\t\tconst raw = Buffer.from(str);\r\n\t\tconst buf = BufferWrapper.from(str);\r\n\r\n\t\tassert.strictEqual(buf.byteLength, raw.byteLength, 'Size of Buffer.from() and BufferWrapper.from() do not match');\r\n\t\tassert.strictEqual(buf.offset, 0, 'Non-ze... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to reset trophies, debug only | function resetTrophies() {
localStorage.trophies = 0;
localStorage.removeItem('trophiesObtained');
localStorage.kills = 0;
localStorage.roomsSurvival = 0;
localStorage.roomsNormal = 0;
localStorage.sandbag = 0;
localStorage.collector = 0;
localStorage.dabbler = 0;
localStorage.resets = 0;
f... | [
"function reset() {\n clearBoard();\n\n\n resetRack();\n newGame = 1;\n gameScore = 0;\n tiles = [...default_tiles];\n initialSetUp();\n updateIndicators();\n }",
"function resetTourVars() {\n self.running = false;\n self.count = 0;\n self.t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
xParent, Copyright 20012007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL | function xParent(e, bNode)
{
if (!(e=xGetElementById(e))) return null;
var p=null;
if (!bNode && xDef(e.offsetParent)) p=e.offsetParent;
else if (xDef(e.parentNode)) p=e.parentNode;
else if (xDef(e.parentElement)) p=e.parentElement;
return p;
} | [
"function SpawnChild(Content, ChildName, Width, Height, Centered, NSx, NSy, IEx, IEy, Resizable, ScrollBars, MenuBar, ToolBar, StatusBar){\n\tif (window.child && !(window.child.closed))\twindow.child.close();\n\tvar URL=Content;\n\tvar Name=ChildName;\n\tvar WindowWidth=parseInt(Width);\n\tvar WindowHeight=parseInt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
all components should extend from the componenet class | constructor() {
super(); // loading the parent component methods and properties
return this.buildComponenent(); // this function should always be called, it returns the object to render
} | [
"function CustomComponents() { }",
"function Component() {}",
"function Component() {\n}",
"function VeroldComponent() {\n }",
"constructor (){\n super()\n //every class component must have a render method\n }",
"setComponent() {\n this.component = this._baseClass.getComponent(this);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scrape wikipedia history based on being pased a url go to wiki page find and click view history button on history page click the '500' button click the 'oldest' button select the 'pagehistory' ul save url to an array or urls for each url get screenshot and save to folder | async function getUrls(url) {
const x = Xray();
url = url ? url : 'https://en.wikipedia.org/w/index.php?title=Trinidad'
try {
const urls = await x(`${url}&dir=prev&limit=100&action=history`, 'ul#pagehistory', [
'li .mw-changeslist-date@href'
]).paginate('.mw-prevlink@href').limit(4)
console.log(... | [
"function lastPagesInBookmark() {\n\n const lpv = loadLPVFromLS();\n\n $('.series_grp .title .noexpand').map((i, el) => {\n\n const lpvImg = $('<img src=\"https://mangafox.me/favicon.ico\">');\n\n const mangaUrl = $(el).next().attr('href');\n const mangaName = mangaUrl.match(/^\\/\\/manga... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Part Views from a Part's DOM node | function getPartViewsFromDomNode(domNode, partType) {
let viewDomNodesInfo, viewInfoArray, viewInfoHash;
viewDomNodesInfo = findWithClassThatStartsWith(domNode, PART_CLASSNAME_PREFIX + partType + '-');
viewInfoArray = viewDomNodesInfo.map((entry) => {
return {
name: entry.after,
domNode: ... | [
"getViewItems() {\n return this.rootNode.querySelectorAll('[view-item]');\n }",
"elemOfPart(_partName) {\n const _elemId = this._getMarkupElemIdPart(_partName, 'HView#elemOfPart');\n if (this.isntNull(_elemId)) {\n return ELEM.get(_elemId);\n }\n else {\n return '';\n }\n }",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Evaluates whether quantity > 0 | static evalQuantityGreaterThanZero(dict) {
let qty = libCom.getControlValue(dict.QuantitySim).toString();
if (qty.includes(',')) {
qty = qty.replace(',', '.');
}
return (Number(qty) > 0);
} | [
"static evalQuantityGreaterThanZero(context, dict) {\n return (libLocal.toNumber(context, dict.QuantitySim.getValue()) > 0);\n }",
"function validQuantity(value, res){\n res(value>0)\n}",
"static validateQuantityGreaterThanZero(pageClientAPI, dict) {\n\n //Quantity > 0?\n if (libThis.ev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
it checks two clusters index1 and index2 for overlap based on the distance between their representatives | checkOverlapTwoClusters ( clusters, c1, c2, variableSizeIcon ) {
let cluster1 = clusters.clusters[c1];
let cluster2 = clusters.clusters[c2];
let minDist = this.params.distMerge; // threshold in pixel
let point1 = {
x: cluster1.represent[0],
y: cluster1.represent[1],
}
let point2 = {
x: cluster2.re... | [
"function isSameCluster(input_seq_start, input_seq_end, input_cluster_seq_start,\n input_cluster_seq_end) {\n//console.log('is same cluster args: ' + [input_seq_start, input_seq_end,\n//input_cluster_seq_start,\n//input_cluster_seq_end].join('||') );\n\n//copy arrays so they can be modified\n var seq_start = in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates a single cell with it's new class and additional options if applicable | function setNewAttr($cell, responseCell){
$cell.removeClass().addClass(responseCell.attr)
//if cell is empty show how many mines are nearby
if ($cell.attr('class').slice(0,5) === 'empty'){
var noOfMines = $cell.attr('class').slice(-1);
if (noOfMines !== '0'){
$cell.text(noOfMines);
... | [
"function setCellClasses(rowIndex, columnIndex, className) {\n var cell = wpdtEditor.getCellMeta(rowIndex, columnIndex),\n newClassName, arrayOfClasses,\n hAlignClases = ['wpdt-align-left', 'wpdt-align-right', 'wpdt-align-center', 'wpdt-align-justify'],\n vAli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the storage where images are captured. It will be resources/app nam/device name | get storageByDeviceName() {
return this._args.storageByDeviceName;
} | [
"function _getStorage() {\n let storage = multer.diskStorage({\n destination: (req, file, cb) => {\n cb(null, UPLOAD_LOCATION)\n },\n filename: (req, file, cb) => {\n cb(null, `${Date.now()}-${file.originalname}`)\n }\n })\n\n return storage\n}",
"function getImgUrl() {\n return loadF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs on every task complete | _taskComplete() {
//
} | [
"function tasksComplete() {}",
"_onTasksDone() {\n // meant to be implemented by subclass if needed\n }",
"taskCompleted() {\n if (--this.numTasks === 0) {\n this.onCompletion();\n }\n }",
"_handle_allDone() {\n this._collector.allDone();\n }",
"_impl_allDone() {\n this._emit('allDone... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to display left pagination. | function displayLeftPagination(){
var ul,li=[],pagesHidden,nextToDisplay=1;
var pagination = document.getElementById("customPagination");
if(pagination){
ul = document.getElementById("ulPagination");
if(ul){
li = ul.getElementsByClassName("customLink");
}
}
for(i=li.length-1;i>=0;i--){
if(li[i].style.d... | [
"function updateLeftPagination() {\n if (leftTotalItems.length > 30) {\n maxPageLeft = Math.ceil(leftTotalItems.length / 30);\n } else {\n maxPageLeft = 1;\n }\n\n resourceCall('debugMessage', 'Max page left: ' + maxPageLeft + ' ' + leftTotalItems.length);\n\n $('#paginationCounterLeft'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds responder matchRegExp is the regular expression that matches the anchor part of the uri callBack is the component that will receive hide/show calls activate is a flag that tells the view to be immediately activate (and the previous one to deactivate) | addResponder(_matchRegExp, _callBack, _activate) {
const _urlMatcher = new RegExp(_matchRegExp);
this.urlMatchers.push(_urlMatcher);
this.urlCallBacks.push(_callBack);
if (this.isString(_activate)) {
window.location.href = _activate;
}
const _matchStr = this.value;
if (_urlMatcher.test... | [
"delResponder(_matchStr, _callBack) {\n const _urlMatcher = new RegExp(_matchStr);\n if (this.prevCallBacks.includes(_callBack)) {\n this.prevCallBacks.splice(this.prevCallBacks.indexOf(_callBack), 1);\n this.prevMatchStrs.splice(this.prevMatchStrs.indexOf(_matchStr), 1);\n }\n for (let i = 0;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the given token to the pretty printed results. | function addToken(token, write) {
if (token.type.label == "string") {
write("'" + sanitize(token.value) + "'",
token.loc.start.line,
token.loc.start.column);
} else if (token.type.label == "regexp") {
write(String(token.value.value),
token.loc.start.line,
... | [
"function appendToken(token)\n\t\t{\n\t\t\t// We want the name of an id not its value\n\t\t\tif(currentToken.kind === TOKEN_ID)\n\t\t\t\texprString += currentToken.name; // Id\n\t\t\telse\n\t\t\t\texprString += currentToken.value; // Integers, ops, and anything else\n\n\t\t\t// Increment to get the next token\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets the a11y navigation controller, active region/section/element, clears focus and resets user interraction states | cancelNavigation() {
this.clearActiveRegion();
this.setCurrentFocus();
this.resetInterractionStates();
} | [
"clearActiveRegion() {\n if (this.activeRegion) {\n this.activeRegion.classList.remove(A11yClassNames.ACTIVE);\n this.activeRegion.dispatchEvent(new Event(A11yCustomEventTypes.DEACTIVATE));\n this.activeRegion.removeEventListener(A11yCustomEventTypes.UPDATE, this.handleActive... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decode the "CB" prefix (bit instructions). | function decodeCB(z80) {
const inst = fetchInstruction(z80);
const func = decodeMapCB.get(inst);
if (func === undefined) {
console.log("Unhandled opcode in CB: " + z80_base_1.toHex(inst, 2));
}
else {
func(z80);
}
} | [
"function bdecode(x) { \n try { \n var a = decode_func[x.charAt(0)](x, 0); \n var r = a[0]; var l = a[1]; \n } catch(e) { \n throw(\"not a valid bencoded string\"); \n } \n if (l != x.length) { \n throw(\"invalid bencoded value (data after valid prefix)\"); \n } \n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOTE: isSelectOrder = true = use walletbalance template and selection name NOTE: isSelectOrder = false = use walletgroup template and lang name NOTE: isSelectOrder = undefined = main wallet only | function init(isSelectOrder, selector) {
if (_.isUndefined(selector)) {
selector = "wallets";
}
if (_.isUndefined(isSelectOrder)) {
getMainWallet(selector);
}
else {
getWallets(isSelectOrder, selector);
}
} | [
"function selectCoinWallet(selectType){\n \n withdrawCoinSet.addr.val('');\n withdrawCoinSet.request.val('');\n withdrawCoinSet.pay.val('0.00000000');\n eventDom.btnWithdrawCoin.attr(\"disabled\", true);\n \n withdrawCoinSet.otp_result = false;\n withdrawCoinSet.otp.val('');\n \n if( s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call whenever renderType has to be changed | setRenderMode(renderType){
switch (renderType){
case WordbookScreen.RENDERTYPE_WORDBOOK:
this.setState({
flatListRenderType: WordbookScreen.RENDERTYPE_WORDBOOK,
});
break;
case WordbookScreen.RENDERTYPE_WORDBOOKMODIFY:
... | [
"set renderMode(value) {}",
"function changeTypeOfView(newValue){\n\t\tviewType = newValue;\n\t\tisChangedViewType = true;\n\t}",
"function onTypeChanged () {\n // Clear out old clicks and start fresh\n clickList = []\n\n // Deselect any scene shape and disable transformation controls\n $('#shapeSelect')[0]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initialise user pools (SAML/sessionCookiebased authentication) | function initUserPools(cb) {
logger.info('initUserPools');
if (Conf.samlDelegation) {
Conf.samlDelegation.log = logger[Conf.samlDelegation.loglevel];
wssclient = new WSS.client(Conf.samlDelegation);
}
userPools = {};
setInterval(cleanupUserPools, Conf.userpool.CLEANUP_INTERVAL * 1000); // setup periodic clea... | [
"initUserPool() {\n\t var poolData = {\n\t \"UserPoolId\" : \"us-east-2_0HlnZbskF\", // Your user pool id here\n\t \"ClientId\" : \"68ol44e7n6t83jdk8j0sqjsh9g\" // Your client id here\n\t };\n\t return new AmazonCognitoIdentity.CognitoUserPool(poolData);\n\t}",
"function init() {\r\n\tcons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handle the incoming messsages from the worker the worker perform atomic operation (sorts one element at a time) and asks the UI whether to CONTINUE or to PAUSE to handle the a new number so it will check if the number stack is empty ('CONTINUE') or there is a number to be added before continue on sorting | function handleMessage(message) {
const {type, data, id} = message.data;
let workerShouldPause = numStack.length > 0;
switch (type) {
case CHECK:
if (workerShouldPause) {
sendMessage({type: ADD_NUMBER, data: numStack.pop()});
} else {
sendMessage({type: CONTINUE});
}
b... | [
"function startSorting() {\n state.arrayToSort = initArray(100000);\n preSortStart();\n sortingWorker.postMessage({ message: 'SORT', state: state });\n randomNumberGenerate = createRandomNumberDurationInstance(randomNumberDurationInput.value);\n stopRandomNumberGenerationButton.disabled = false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
provided an object with table definition (see ./model/dbTables.js) will generate a query string for the table creation | function tableToQuery({ name, columns, keys: { primary, foreign = [] }, unique = [] }) {
const formatted = [];
// format columns
for (const column in columns) {
formatted.push(`${column} ${columns[column]}`);
}
// format primary keys
if (primary) {
formatted.push(`PRIMARY KEY (${primary})`);
}
... | [
"createQuery(columns, ifNot, like) {\n const createStatement = ifNot\n ? 'create table if not exists '\n : 'create table ';\n const columnsSql = ' (' + columns.sql.join(', ') + this._addChecks() + ')';\n let sql =\n createStatement +\n this.tableName() +\n (like && this.tableNameLi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |