query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
let lastCheckMSG = ''; end of block local functions cdn refresh checker | function cdnRefreshChecker(){
if(!isProcessing || retry_time >= 2){//force to start cdn refresh procedure if isProcessing is not set to false after 20 minutes
//refresh cdn resources cached in list
refresh_target_file_from_cache();
// refresh_target_directory_from_cache();
isProces... | [
"function checkForUpdate() {\n executeRequest(\"https://brodaleegitlabplugin.herokuapp.com/?version=last\")\n .then(res => {\n if (res.last_version) {\n if (manifest.version < res.last_version) {\n navigator.getFromStore('lastupdatedate', function (res) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Once the customer has placed the order, the checkUnits function checks if the store has enough of the product to meet the customer's request. | function checkUnits(productList, custProductUnits){
//if the store does have enough of the product, then fulfill the customer's order by updating the SQL database to reflect the remaining quantity.
if(parseFloat(productList[pIndex].stock_quantity) >= parseFloat(custProductUnits)){
price = parseFloat(c... | [
"function checkAvail(order, itemsArray){\n\tprod = parseInt(order.item_ID);\n\tqty = parseInt(order.quantity);\n\n\tfor (var a = 0; a < itemsArray.length; a++) {\n\t\tif (itemsArray[a].ID === prod && itemsArray[a].Qty < qty){\n\t\t\t// if no, let customer know\n\t\t\tconsole.log(\"We are unable to fulfill your orde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a PRTime to a Date object. | function toDate(time) {
return new Date(parseInt(time / 1000));
} | [
"function toPRTime(date) {\n return date * 1000;\n}",
"function createDateObject(time) {\n const date = new Date(time);\n const obj = {\n day: date.getDate(),\n weekday: date.getDay(),\n month: date.getMonth(),\n year: date.getFullYear(),\n milliseconds: date.getTime(),\n };\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks the current lives when a life is gained and calls the appropriate function | function gainingLife() {
switch (lives) {
case 3:
fullLives();
break;
case 2:
twoLives();
break;
case 1:
oneLife();
break;
}
} | [
"live(years){\n this.age = this.age + years;\n if(this.lifeExpectancy < this.age){\n console.log(this.type + \" is now dead.\");\n this.expired = true;\n }else{\n console.log(this.type + \" has successfully lived for an additional \" + years + \" years.\");\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function creates the current scene of the environment based on the get request for a JSON file that contains all of the objects the user had previously placed before. This makes sure that when the user refreshes the environment that the objects they had created before had are still there. | function getCurrScene() {
fetch(url + "scene")
.then(checkStatus)
.then(function(responseText) {
let json = JSON.parse(responseText);
let objects = json["objects"];
if (objects.length !== 0) {
for (let o = 0; o < objects.length; o++) {
placeObj(objects[o]);
}
... | [
"generateSceneJSON() {\n var scene = {\n objects: [],\n lights: [\n // {\n // color: 0xFFFF00,\n // intensity: 0.5,\n // position: {x: 0, y: 0, z: 0},\n // distance: 20,\n // sh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is called whenever we receive data in the question dismissal topic. We need to remove its entry from the list of available clues, and we need to clear data from the question modal. Since we know that we have yet to select another question, we will automatically disable the buzzer if it was still enabled. | function handleQuestionDismiss(topic, data) {
data = JSON.parse(data);
blankOutQuestionBox(data.category, data.value);
hideQuestion(jeopardy.getQuestionDisplayModal());
question.clear();
buzzer.deactivate(jeopardy.getStatusIndicatorElement());
} | [
"function remove_answer_evt(){\n\t\t\tif(confirm('Bạn có chắc chắn ?')){\n\t\t\tdelete answers[id];\t//delete from manager\n\t\t\tcurrent_index--;\n\t\t\tanswers_container.removeChild(main);\n\t\t\treset_answers();\t//reset elements\n\t\t\tif(typeof answer_delete_event=='function') answer_delete_event(data); //call... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply constraints to a point. These constraints are both physical along an axis, and an elastic factor that determines how much to constrain the point by if it does lie outside the defined parameters. | function applyConstraints(point, _a, elastic) {
var min = _a.min, max = _a.max;
if (min !== undefined && point < min) {
// If we have a min point defined, and this is outside of that, constrain
point = elastic ? mix(min, point, elastic) : Math.max(point, min);
}
else if (max !== undefine... | [
"function applyConstraints(point, _a, elastic) {\n\t var min = _a.min, max = _a.max;\n\t if (min !== undefined && point < min) {\n\t // If we have a min point defined, and this is outside of that, constrain\n\t point = elastic ? mix(min, point, elastic.min) : Math.max(point, min);\n\t }\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if argument is a member of the group | has(argument) {
return (this.group.indexOf(argument) == -1) ? false : true;
} | [
"has(num){\n if (this.group.indexOf(num) !== -1){\n return true;\n } \n return false;\n }",
"function isMember( groups ) { \n if ( Array.isArray( groups ) ) {\n const a = new Set( groups.flat( Infinity ) );\n return Array.from( a ).some( isMember );\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes a string that has been preprocessed and stripped of existing tags, an array of terms, and an array of known matches (or empty array if none). it then aggregates all of the matches for all of the terms into a single array, sorts them by the index then collapses any matches that are overlapping, and returns an arra... | function get_term_matches_for_string(str_without_tags, terms, matches) {
// gather up all of the match indices/lengths for all of the terms
for (const term of terms) {
const regex = new RegExp(_.escapeRegExp(term), 'gi');
let match;
do {
match = regex.exec(str_without_tags);
if (match) {
... | [
"_prepareMatches(matchesWithLength, matches, matchesLength) {\n function isSubTerm(currentIndex) {\n const currentElem = matchesWithLength[currentIndex];\n const nextElem = matchesWithLength[currentIndex + 1];\n\n // Check for cases like \"TAMEd TAME\".\n if (\n currentInde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when the user clicks on the pet result, try to navigate to the pet's detail page. if the pet is from petfinder instead of petshelter, then create an entry in the database if necessary. | function visitPet() {
var petfinderShelter;
// if the pet is from petshelter, simply navigate to the details page.
if (vm.pet.source == "PETSHELTER") {
$location.url("/shelter/" + vm.pet._shelter + "/pet/" + vm.pet._id);
} else {
// check ... | [
"function handlePetEdit() {\n var currentPet = $(this)\n .parent()\n .parent()\n .data(\"pet\");\n window.location.href = \"/cms?pet_id=\" + currentPet.id;\n }",
"function submitPet(pet) {\n $.post(\"/api/pets\", pet, function() {\n window.location.href = \"/owners\";\n });\n }",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run the start method of every component | startComponents () {
for (let component in this.components) {
this.components[component].start();
}
} | [
"start() {\n\t\tthis.setupListeners();\n\t}",
"start() {\n\t\tthis.registerListeners();\n\t}",
"start() {\n this.startEntity(scene.entities, this.root);\n this.startedComponents.forEach((component) => {\n component.entitiesReady();\n });\n }",
"function startAll() {\n for (var modName in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PRACTICE II write a function that will convert dog years to human years Formula for conversion Human Age = (Dog Age 2) x 4 + 21 | function dogToHumanYears(dogAge) {
let humanAge = (dogAge - 2) * 4 + 21;
return humanAge;
} | [
"function thisIsAFunctionThatConvertsDogYearsToHumanYears(dogAge){\n let humanAge = (dogAge - 2) * 4 + 21\n return humanAge; \n}",
"function dogToHumanYears(years)\n{\n let humanYears = 0;\n\n //ages 1-3 - 10 human years to dog years\n if (years <= 3)\n {\n humanYears = years * 10;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the receiver list | function cleanReceivers(){
receivers = [];
} | [
"clear() {\n\t\tthis.watchList.forEach((item) => item.removeWatcher());\n\t\tthis.watchList = [];\n\n\t\tchannel.appendLocalisedInfo('cleared_all_watchers');\n\t\tthis._updateStatus();\n\t}",
"clear () {\n for (let i = 0; i < this.listeningIpcs.length; i++) {\n let pair = this.listeningIpcs[i];\n _ip... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SnakeOrLadder represents a snake or ladder object. To create a snake the head value must be greater then the tail value. To create a ladder the head value must be great then the tail value. | function SnakeOrLadder(head, tail){
var snakeOrLadderSelf = this;
var head = Math.abs(head);
var tail = Math.abs(tail);
snakeOrLadderSelf.getHead = function() {
return head;
}
snakeOrLadderSelf.getTail = function() {
return tail;
}
} | [
"function createSnake() {\n //starting x and y position of left snake (4, 4)\n snake1 = new Snake(bit(4,6), RIGHT, \"brown\", \"gray\", \"black\", \"blue\");\n if(no_of_players == 2) {\n snake2 = new Snake(bit(64,6), LEFT, \"orange\", \"yellow\", \"green\", \"purple\")\n }\n }",
"function moveSn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removeUser(id) return the user that was removed | removeUser (id) {
var user = this.getUser(id);
if(user) {
this.users = this.users.filter((user) => user.id !== id);
}
return user;
} | [
"removeUser (id) {\n var user = this.getUser(id);\n\n if (user) {\n this.users = this.users.filter((user) => user.id !== id); // Find the user in userlist\n }\n\n return user;\n }",
"removeUser(id){\n //check if the user exists\n var user= this.getUser(id);\n if(user){\n this.users... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate IBAN and BIC number This function check if the checksum if correct | function isValidIBAN($v)
{
$v = $v.replace(/^(.{4})(.*)$/,"$2$1"); //Move the first 4 chars from left to the right
//Convert A-Z to 10-25
$v = $v.replace(
/[A-Z]/g,
function ($e) {
return $e.charCodeAt(0) - 'A'.charCodeAt(0)... | [
"function isValidIBAN(input) {\n var CODE_LENGTHS = {\n AD: 24,\n AE: 23,\n AT: 20,\n AZ: 28,\n BA: 20,\n BE: 16,\n BG: 22,\n BH: 22,\n BR: 29,\n CH: 21,\n CR: 21,\n CY: 28,\n CZ: 24,\n DE: 22,\n DK: 18,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=========================== Get Universe =========================== | function GetUniverse(){
var Universe="Error";
var ServerName = GetServerName();
switch(ServerName) {
case "ogame312.de":
Universe=1;
break;
case "ogame290.de":
Universe=2;
break;
case "ogame199.de":
Universe=3;
break;
case "ogame235.de":
Universe=4;
break;
case "ogame333.de":
Uni... | [
"static getUniverse() {\n switch (document.location.hostname) {\n case 'orion.pardus.at':\n return 'orion';\n case 'artemis.pardus.at':\n return 'artemis';\n case 'pegasus.pardus.at':\n return 'pegasus';\n default:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Measures the gas resistance (Ohms) and logs it to the console. | async function measureGasResistance() {
try {
const gasResistance = await bme680.gasSensor.read();
console.log(`Gas resistance (Ohms): ${gasResistance}`);
} catch(err) {
console.error(`Failed to measure gas resistance: ${err}`);
}
} | [
"function calculateMetric() {\r\n\tlet litres = 52.28; //Litres is fuel consumed for 500km\r\n\tlet metricEfficiency = litres / 5; //To get fuel consumed for 100km, divide value by 5.\r\n\tconsole.log(\"Your car has a fuel economy of \" + metricEfficiency.toFixed(2) + \" litres per hundred kilometres.\"); //Write v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The dropdown is adjusted when shown but since we use animation classes it creates a weird effect. The following method preadjust the dropdown so when it is shown it is in the correct position. | preAdjustDropdownPosition(dropdown) {
dropdown.style.opacity = "0";
dropdown.style.display = "block";
this.update();
dropdown.style.removeProperty("opacity");
dropdown.style.removeProperty("display");
} | [
"positionDropdown() {\n if (this.settings.dropdownParent !== 'body') {\n return;\n }\n\n var context = this.control;\n var rect = context.getBoundingClientRect();\n var top = context.offsetHeight + rect.top + window.scrollY;\n var left = rect.left + window.scrollX;\n applyCSS(this.dropdown... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pull values from 's' (a list of commaseparated values) that match the regular expression given in 're'. If resulting values should be converted to uppercase, pass true in 'uppercase'. | function captureBase(s, re, uppercase) {
if (s) {
var list;
var rawList = s.split(','); // Break input into array of raw strings
if (rawList && rawList.length) {
list = rawList.map(function(item) {
var m = re.exec(item);
return m ? (uppercase ? m[1... | [
"function toStyleCase(s) \r\n{\r\n\tfor(var exp = toStyleCase.exp; exp.test(s); s = s.replace(exp, RegExp.$1.toUpperCase()) );\r\n\treturn s;\r\n}",
"uppercase_values(obj, filter = null) {\n return this.walk_values(obj, filter, function(val) {\n return typeof(val) === \"string\" ? val.toUpperCas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load test base on configuration | function loadTestWithConfig(path, config) {
} | [
"includeTests() {\r\n let file;\r\n if (this.files.length == 0) {\r\n this.readTests();\r\n }\r\n for (file of this.files) {\r\n delete require.cache[file];\r\n try {\r\n describe('SpiritTests test automatically loaded from ' + \r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function:now(strD) purpose:Get current date parameter:strD String of date return:string of date. format: "mm/dd/yy" | function now(strD)//OK.
{
var dateObj
if (strD == "")
return "";
if(strD == null)
dateObj = new Date();
else
{
dateObj = new Date(strD);
if (isNaN(dateObj))
return "";
}
var strDate = "";
strDate += (dateObj.getMonth()>8)? dateObj.getMonth()+1: "0"+(dateObj.getMonth()+1);
... | [
"function dateTodayStr() {\n\n var today = new Date();\n return dateFmtStr(today);\n}",
"function currentDate() {\n var date = new Date();\n var day = date.getDate() <= 9 ? '0' + date.getDate() : date.getDate();\n var month = (date.getMonth() + 1) <= 9 ? '0' + (date.getMonth() + 1) : (date.getMonth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This class keeps track of all research area changes. (Note: use only public methods to interact with this class.) | function RaChanges() {
/**
* This public method marks the research area as created.
* @param idx - html element id index of the research area to be created
* @param code - the research area code of the research area to be created
* @param parentCode - the parent's research area code of the rese... | [
"function refreshareas() \n{\n\tclearareas();\n\n\t// From loaded observers, create new rectangles\n\tfor (i in observers) {\n\t\tif (observers[i].Map_id == attachedto) {\n\t\t\tvar lattl = observers[i].lat_topleft;\n\t\t\tvar lontl = observers[i].lon_topleft;\n\t\t\tvar latbr = observers[i].lat_botright;\n\t\t\tva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Defer the calculation of a string value to synthesis time Use this if you want to render a string to a template whose actual value depends on some state mutation that may happen after the construct has been created. If you are simply looking to force a value to a `string` type and don't need the calculation to be defer... | static stringValue(producer, options = {}) {
return token_1.Token.asString(new LazyString(producer, false), options);
} | [
"function TSString(value)\n{\n\tTSExpression.call(this);\n\tthis.value = value;\n}",
"StringLiteral() {\n const token = this._eat('STRING');\n return {\n type: 'StringLiteral',\n value: token.value.slice(1, -1).trim(),\n };\n }",
"function stringLiteral(value) {\n return value;\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
utility function to get the length of on object | function len(obj){
return obj.length;
} | [
"function len(objex)\n{\n return objex.length;\n}",
"function len(obj) { return Object.keys(obj).length; }",
"static objectLength(obj) {\n return Object.keys(obj).length;\n }",
"function getObjectLength(object) {\n // YOUR CODE BELOW HERE //\n \n //I: object\n //O: number of key/value pairs i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. Append subfields until MAX_FIELD_LENGTH is exceeded 2. cut at the last subfield 3. Append prefix to the next subfield and check if it exceeds SPLIT_MAX_FIELD_LENGTH If it is, cut at separators or at boundary. Create a new line for each segment 4. Repeat step 3 for the rest of the subfields | function reduceToLines(result, subfield, index, arr) {
let code;
let sliceOffset;
let slicedSegment;
const tempLength = result.temp ? result.temp.length : 0;
if (tempLength + subfield.length <= MAX_FIELD_LENGTH) {
if (tempLength) {
result.temp = concatByteArrays(result.temp, subfield);
} el... | [
"function reduceToLines(result, subfield, index, arr) {\n let code; // eslint-disable-line functional/no-let\n let sliceOffset; // eslint-disable-line functional/no-let\n let slicedSegment; // eslint-disable-line functional/no-let\n const tempLength = result.temp ? result.temp.length : 0;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when the user has chosen to save the current codepad contents. This will create a zip and start a download. | function codepad_save() {
var scene_id = codepad_get_scene();
var scene_name = codepad_get_scene_name(scene_id);
var scripts = codepad_get_scripts(scene_id);
var zip_filename = scene_name.replace(/[^a-z0-9]/gi, '_').toLowerCase();
var zip = new JSZip();
var dir = zip.folder(zip_filename);
... | [
"download() {\n const edCnt = this.$el.find(\"#core .cb-ace\").get(0)\n\n switch (this.$el.find(\"select\")[0].options.selectedIndex) {\n case 0:\n loadScript(\"dist/js/libs/ace/ace.js\", { scriptTag: true }).then(() => {\n var editor;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Distortion effect. Based on the famous TubeScreamer. Requires [[IIRFilter]] | function Distortion (sampleRate) {
var hpf1 = new IIRFilter(sampleRate, 720.484),
lpf1 = new IIRFilter(sampleRate, 723.431),
hpf2 = new IIRFilter(sampleRate, 1.0),
smpl = 0.0;
this.gain = 4;
this.master = 1;
this.sampleRate = sampleRate;
this.filters = [hpf1, lpf1, hpf2];
this.pushSample = function (s) {
... | [
"function LensDistortionFilter(){\n\tthis.name = \"Lens Distortion\";\n\tthis.isDirAnimatable = false;\n\tthis.defaultValues = {\n\t\trefraction : 1.5,\n\t\tradius : 50,\n\t\tcenterX : 0.5,\n\t\tcenterY : 0.5\n\t};\n\tthis.valueRanges = {\n\t\trefraction : {min: 1, max: 10},\n\t\tradius : {min: 1, max: 200},\n\t\tc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to create employee object from input fields | function createEmployeeObject() {
var employee = {
name: $('#name').val(),
position: $('#position').val(),
salary: $('#salary').val()
};
return employee;
} | [
"createEmployee(employee) {\n\n let newEmployee;\n\n const { name, email, role } = employee;\n\n const employeeID = `${role}${this.id++}`;\n\n switch (role) {\n case \"Engineer\":\n const { github } = employee;\n newEmployee = new Engineer(name, e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unselects the suggestion at the given position | function unselect(position) {
$suggestionBox.find("li:eq(" + position + ")").removeClass('selected');
} | [
"unselect() {\n this.selectedMatchIndex = -1;\n }",
"deselect() {\n this.selectItem(-1);\n }",
"unselect() {\n if (this.selected) {\n this.selected = false;\n this.fontColor = this.fontColorUnselected;\n if (this.cursor) {\n this.removeChild(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The final pass of this module. The ledger should be no longer edited, and final actions should be performed here in relation to the data's final state. | finalPass(ledger) {} | [
"function _finalStep() {\n\n\t\t\t// Rendering the last step.\n\t\t\twizard.html(_renderLastStep());\n\n\t\t\t// Preparing the eventual data.\n\t\t\tvar data = {};\n\t\t\t$.each(wizard.settings.steps, function(k, step) {\n\t\t\t\tvar answer = step.given_answer;\n\t\t\t\tvar step_name = step.name;\n\t\t\t\tif(step.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get leaving requests count | static async getLeavingRequestCount(id) {
const count = (
await pool5.query(` select count(*) from getleavea($1) `, [id])
).rows;
return count;
} | [
"get numPendingRequests() {\n let num = 0;\n\n if (this._pendingRequests) {\n for each (let [index, requestObject] in Iterator(this._pendingRequests)) {\n num++;\n }\n }\n\n return num;\n }",
"async function getNetworkRequestCount() {\n return await (await fetch(url + '&get-fetch-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find current index element in circular array | function findCurrentIndexValue(array, index) {
const calcIndex = index % (array.length);
return array[calcIndex];
} | [
"function getNextIdx(currentIdx, array) {\n\tconst jump = array[currentIdx];\t\n\tconst nextIdx = (currentIdx + jump) % array.length; // for \n\treturn nextIdx >=0 ? nextIdx : nextIdx + array.length;\n}",
"function index(curEle) {\n var ary = prevAll(curEle);\n return ary.length;\n }",
"getIndexByCordina... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a function that will search a box of candy bars for the golden ticket. The box is a 2D array that contains false if there is no ticket, and a true if there is one. //Example of a box of candy bars: [[false],[false],[false],[true],[false]] The function should output the index of the candy bar with the golden tick... | function finder(box) {
for (let i = 0; i < box.length; i += 1) {
if (box[i][0] === true) {
return i;
}
}
return "There is no golden ticket!";
} | [
"function find_box(blue_piece_object)\n{\n $(\"#in_function\").html(\"find_box\");\n var return_val=null;\n var extra_space=4;\n\n //iterate through all the div boxes\n $(\"div.box\").each(function(index,value)\n {\n //variables\n var boxL=value.offsetLeft;\n var boxT=value.offsetTop;//-$(\"#checkers... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attach from a map of attachments | attach(attachments) {
this.gl.bindFramebuffer(GL_FRAMEBUFFER, this.handle);
for (const attachment in attachments) {
const object = attachments[attachment];
if (!object) {
this._unattach({attachment});
} else if (object instanceof Renderbuffer) {
this._attachRenderbuffer({attac... | [
"_showAttachments() {\n this._attachments.forEach((a) => {\n if (!this._map.hasLayer(a)) {\n this._map.addLayer(a);\n }\n });\n }",
"attach( attachments, {\n clearAttachments = false\n } = {} ) {\n const newAttachments = {};\n\n // Any current attachments need to be... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
document.cookie username=zs; aaa=zs; bbb=18 | function getCookie(name) {
var str = document.cookie;
var arr = str.split('; ');
for (var i = 0;i < arr.length;i++) {
var arr2 = arr[i].split('=');
// arr2[0] = username arr2[1] = zs
// arr2[0] = bbb arr2[1] = 18
if (name == arr2[0]) {
return arr2[1];
}
}
return null;
} | [
"function recordarUsuario() {\n var eMail = document.getElementById(\"user\").value;\n var psw = document.getElementById(\"passlogin\").value;\n\n setCookie(\"eMail\", eMail);\n setCookie(\"psw\", psw);\n setCookie(\"checked\", \"true\");\n}",
"function createCookie(username) {\n document.cookie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get one piece of data in a prompt and log the result parameter: data, a string of what to prompt for returns a string, the thing the user entered | function collectData(data) {
var answer = prompt('what is your ' + data + '?');
console.log(data + ' is ' + answer);
return answer;
} | [
"function prompt(str) {}",
"function promptAndInput(message){\n var returnData;\n return new Promise(function(fulfill, reject){\n process.stdout.write(message);\n process.stdin.once('data', function(data) {\n returnData = data.toString().trim(); \n fulfill(returnData);\n });\n });\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dissolve arcs that can be merged without affecting topology of layers remove arcs that are not referenced by any layer; remap arc ids in layers. (dataset.arcs is replaced). | function dissolveArcs(dataset) {
var arcs = dataset.arcs,
layers = dataset.layers.filter(layerHasPaths);
if (!arcs || !layers.length) {
dataset.arcs = null;
return;
}
var arcsCanDissolve = getArcDissolveTest(layers, arcs),
newArcs = [],
totalPoints = 0,
arcI... | [
"function pruneArcs(dataset) {\n cleanupArcs(dataset);\n if (dataset.arcs) {\n dissolveArcs(dataset);\n }\n }",
"function cleanupArcs(dataset) {\n if (dataset.arcs && !utils.some(dataset.layers, layerHasPaths)) {\n dataset.arcs = null;\n return true;\n }\n }",
"function cleanArcR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for updateRepositoryPipelineConfig / Update the pipelines configuration for a repository. | updateRepositoryPipelineConfig(incomingOptions, cb) {
const Bitbucket = require('./dist');
let apiInstance = new Bitbucket.PipelinesApi(); // String | The account // String | The repository // PipelinesConfig | The updated repository pipelines configuration.
/*let username = "username_example";*/ /*let rep... | [
"updateRepositoryPipelineKeyPair(incomingOptions, cb) {\n const Bitbucket = require('./dist');\n\n let apiInstance = new Bitbucket.PipelinesApi(); // String | The account // String | The repository // PipelineSshKeyPair | The created or updated SSH key pair.\n /*let username = \"username_example\";*/ /*let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method: compareQueues (oddnumbered group) return true if the queues have the same values in the same order false otherwise important: this is a nondestructive operation! do not modify either queue | compareQueues(queue2) {
if (this.size() != queue2.size()) {
return false;
}
var queue2Runner = queue2.head;
var runner = this.head;
while (queue2Runner != null && runner != null){
if (queue2Runner.value != runner.value){
return false;
... | [
"compareQueues(other_queue) {\n var og_runner = this.head;\n var other_runner = other_queue.head;\n\n if (this.queue_size != other_queue.queue_size) {\n return false;\n }\n\n else {\n while (og_runner != null) {\n if (og_runner.value != other_r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
now I will create a function that creates more than one balloon | function multipleBalloons(number) {
for (let i = 0; i < number; i++) {
addBalloon()
}
} | [
"function createBalloon()\n\t{\n\t\tif (_this.balloons.length < 1) {\n\t\t\tvar balloon = _this.add.sprite(coords.balloons.x, coords.balloons.y, 'balloonsheet', 'b'+balloonStock, _this.gameGroup);\n\t\t\tballoon.x = coords.balloons.x;\n\t\t\tballoon.y = coords.balloons.y;\n\t\t\tballoon.inputEnabled = true;\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to determine an elements width | function elementWidth(el) {
var rect = el.getBoundingClientRect();
return rect.right - rect.left;
} | [
"function getWidth(element) {\n return element[0].offsetWidth;\n }",
"get width() { return domElement.width() }",
"function elementWidth(element) {\n return element.getBoundingClientRect().width || element.offsetWidth;\n }",
"function getWidth(elem) {\n return parseInt(getStyle(el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if...else Write a function addWithSurcharge that adds two amounts with surcharge. For each amount less than or equal to 10, the surcharge is 1. For each amount greater than 10, the surcharge is 2. Example: addWithSurcharge(5, 15) should return 23. | function addWithSurcharge(a, b) {
let surcharge = 0;
if (a <= 10) {
surcharge = surcharge + 1;
} else {
surcharge = surcharge + 2;
}
if (b <= 10) {
surcharge = surcharge + 1;
} else {
surcharge = surcharge + 2;
}
return a + b + surcharge;
} | [
"function addWithSurcharge(a, b) {\n\nlet surcharge = 0;\n\nif (a <= 10) {\n surcharge = surcharge + 1;\n} else if (a >= 10 && a<=20) {\n surcharge = surcharge + 2;\n} else {\n surcharge = surcharge + 3;\n}\n\nif (b <= 10) {\n surcharge = surcharge + 1;\n} else if (b >= 10 && b <= 20) {\n surcharge =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcao para o contador regressivo | function contadorRegressivo(){
segundos--;
if(segundos==-1){ // reinicia a contagem regressiva do segundos
segundos=59;
if(minutos ==1){ // tratamento para os minutos ficarem com duas casas sempre
minutos="0" + 0;
} else if (minutos == "00") { // verifica se o tempo esgotou!!
alert("Tempo Esgotado! :(")... | [
"function Registra(){\n if(attivo == 0)\n {\n attivo = 1; //disalbilito il pulsante se la registrazione è già partita\n registrazione.record(suono); //fa partire la registrazione\n }\n}",
"function irComputadores() {\n // Eliminar la clase Activa de los enlaces y atajos\n eliminarClaseAc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a new validation metadata. | addValidationMetadata(metadata) {
this.validationMetadatas.push(metadata);
} | [
"addConstraintMetadata(metadata) {\n this.constraintMetadatas.push(metadata);\n }",
"addValidation(validation) {\n this._validations.push(validation);\n }",
"function addValidation(field, validation) {\n var data = getData(field) || {};\n data.validations.push(validation);\n setData... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the sum of all items' widths in pixels | getAllItemsWidth() {
return this.items.length * (this.initialItemsWidth / this.initialItemElements.length);
} | [
"totalWidth() {\r\n var t = 0;\r\n this.items.forEach((item) => {\r\n t += item.width;\r\n })\r\n return t;\r\n }",
"function sumOfWidths(elementList) {\n var sum = 0;\n \n for (var i = 0; i < elementList.length; i++) {\n sum += elementList[i].width;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build query string for the http request URL. Called by the buildRequestURL function. Takes userFilters array as arument and returns a URI encoded query string | function buildQueryString(userFilters){
let queryString = '';
// Append a filter to the URL for each filter in the userFilters object
for(let i = 0; i < Object.keys(userFilters).length; i++){
// Get the name of the key of the current filter in the userFilters Object
let filter = Object.keys(userFilters)[i];... | [
"function buildURLArray(filterarray) {\n // Define global variable for the URL filter\n let urlfilter = \"\";\n // Iterate through each filter in the array\n for(var i=0; i<filterarray.length; i++) {\n //Index each item filter in filterarray\n var itemfilter = filterarray[i];\n // Iterate thro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get script obj trigger visibility of lang fields | function showFields(langInd) {
for (var l = 0; l < langAttributes.length; l++) {
if (l === parseInt(langInd))
for (var i = 0; i < langAttributes[l].length; i++)
$(langAttributes[l][i].container).css('display', 'block');
else
for (var a ... | [
"function labelVisibilityInFlash(whichObject) {\n\treturn whichObject.labelVisibilty();\n}",
"function getLang() {\n $.ajax({\n url: GOOGLE_API,\n data: {\n part: \"snippet\",\n videoId: vidId,\n key: YOUTUBE_KEY\n },\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TrainSetupTargets Link all the corners together. | function TrainSetupTargets(ent) {
var entities = FindEntity({ targetName: ent.target });
if (!entities.length) {
log('func_train at' + vec3.str(ent.r.absmin) + 'with an unfound target');
return;
}
ent.nextTrain = entities[0];
var path, start, next;
for (path = ent.nextTrain; path !== start; path = next) {
... | [
"setTargets(targets) {\n for (let i = 0; i < targets.length; i++) {\n this.setTarget(\n targets[i].row,\n targets[i].column,\n targets[i].color,\n targets[i].shape\n );\n }\n }",
"makeTargets() { return this.repeatTargets(this._madeRawTargets()); }",
"function create... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set up default plot for model | function _setDefaultPlot(id) {
plot.switchPlots(id);
gui.render(plot.getInfoForGUI());
} | [
"function init() {\n plot(940);\n }",
"function init(){\n\t//create model class\n\t//plot probs\n}",
"function setupMainPlot() {\n plot = $.plot($(\"#placeholder\"), \n getRecentData(), \n options \n );\n }",
"function initializePlot() {\n initializeAxis(0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decodes a CMD program from the binary. If the binary is not at all a CMD program, returns undefined. If it's a CMD program with decoding errors, returns partiallydecoded binary and sets the "error" field. | function decodeCmdProgram(binary) {
var _a;
let error;
const annotations = [];
const chunks = [];
let filename;
let entryPointAddress = 0;
const b = new teamten_ts_utils_1.ByteReader(binary);
// Read each chunk.
while (true) {
// First byte is type of chunk.
const typ... | [
"function decodeCmdProgram(binary) {\n var _a;\n let error;\n const annotations = [];\n const chunks = [];\n let filename;\n let entryPointAddress = 0;\n const b = new teamten_ts_utils_dist[\"ByteReader\"](binary);\n // Read each chunk.\n while (true) {\n // First byte is type of c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the treemap layout recursively | function layout(d) {
if (d._children) {
treemap.nodes({_children: d._children});
d._children.forEach(function (c) {
c.x = d.x + c.x * d.dx;
c.y = d.y + c.y * d.dy;
c.dx *= d.dx;
c.dy *= d.dy;
c.parent = d;
c.fill = getCo... | [
"function treemapLayout() {\n var x = treemap();\n x.ratio = function(_) {\n var t = x.tile();\n if (t.ratio) x.tile(t.ratio(_));\n };\n x.method = function(_) {\n if (Tiles.hasOwnProperty(_)) x.tile(Tiles[_]);\n else error('Unrecognized Treemap layout method: ' + _);\n };\n return x;\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
private pokeapiUrl = ' // paging private pokeapiUrl = ' // Pokemon detail Local URL private pokeapiUrl = 'assets/pokeapi_151.json'; private pokeapiUrl = 'assets/pokeapi_949.json'; | constructor(http) {
this.http = http;
// ---------- Remote URL
this.pokeapiUrl = 'https://pokeapi.co/api/v2/pokemon/?limit=151';
} | [
"function spitURL(num) {\n return \"http://pokeapi.co/api/v1/pokemon/\" + num + \"/\";\n}",
"function fetchPokeData(pokemon) {\n // The following line of code is assigning the url array value of a Pokemon entry variable within a fetch\n let pokeUrl = pokemon.url\n fetch(pokeUrl)\n .then(functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Number$prototype$lte :: Number ~> Number > Boolean | function Number$prototype$lte(other) {
return typeof this === 'object' ?
lte (this.valueOf (), other.valueOf ()) :
isNaN (this) || this <= other;
} | [
"function Number$prototype$lte(other) {\n return typeof this === 'object' ?\n lte(this.valueOf(), other.valueOf()) :\n isNaN(this) || this <= other;\n }",
"function Number$prototype$lte(other) {\n return typeof this === 'object' ?\n lte(this.valueOf(), other.valueOf()) :\n isNaN(this) &... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the default access policy applied when there is no other rules for roles/commands combinations. | _getDefaultAccessPolicy() {
let p = this.access.defaultAccessPolicy;
switch (p) {
case 'deny': return false;
case 'allow': return true;
case true: return true;
case false: return false;
}
return false;
} | [
"addDefaultPermisionRole() {\n this.handler.addPermission(`${core_1.Names.uniqueId(this)}:Permissions`, {\n principal: new iam.ServicePrincipal('apigateway.amazonaws.com'),\n sourceArn: this.authorizerArn,\n });\n }",
"defaultRole () {\n if (this.roleId) {\n return C... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify password and render admin Page | async open(req, res) {
const db = await Database()
const pass = req.body.password
const AdminPass = await db.get(`SELECT * FROM admin`)
if (AdminPass.adminPassword == pass) {
res.render('admin')
adminLogged = true
} else {
adminLogged = false
res.render('parts/passincorrect',... | [
"function validatePassword() {\n // TODO: Validate password\n\n window.open(`/portal/${getSlug()}`, '_self');\n }",
"function getPasswordHandler (req, res) {\n const returnURL = req.query.returnURL || '/'\n const error = req.query.error\n res.render(getManagementView('password.njk'), { returnURL, error ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lazily sets field code. No batched updates added until write() is called. | setCode(code) {
this.code = code;
this._queued.code = code;
} | [
"setCode(code) {\n\t\tthis.code = code;\n\t}",
"_updateCode(code) {\n\t\tconst id = this.get('model.id');\n\n\t\t// Persist last code changes\n\t\tthis.set(`codeStorage.${id}`, code);\n\t}",
"setCode(newCode){\n this.code = newCode;\n this.run();\n }",
"function data_field_set(field, value) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles the payload for a range edge deletion, which removes the edge from a specified range but does not delete the node for that edge. The config specifies the path within the payload that contains the connection ID. | function handleRangeDelete(writer, payload, config) {
var store = writer.getRecordStore();
var recordID = Array.isArray(config.deletedIDFieldName) ? getIDFromPath(store, config.deletedIDFieldName, payload) : getString(payload, config.deletedIDFieldName);
!(recordID != null) ? process.env.NODE_ENV !== 'produc... | [
"function handleRangeDelete(writer, payload, config) {\n var store = writer.getRecordStore();\n\n var recordID = Array.isArray(config.deletedIDFieldName) ? getIDFromPath(store, config.deletedIDFieldName, payload) : getString(payload, config.deletedIDFieldName);\n\n !(recordID != null) ? process.env.NODE_ENV !== ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the array of most popular courses | function updateMostPopular() {
let clicksArr = [];
// Generate an array containing key - value pairs of array stats
for (let key in stats) clicksArr.push([key, stats[key]]);
// Sort clicksArr by amount of clicks
clicksArr.sort((a, b) => b[1] - a[1]);
// Set mostPopularCourses to be the names of the courses ... | [
"async top30() {\n await College.updateMany(\n { rank: { $lte: 30 } },\n {\n $set: {\n coursesOffered: [\n \"Computer Science\",\n \"Electronics\",\n \"Chemical\",\n \"Data Science\",\n ],\n },\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display projects based on Track [ Preferences ] | function getAvailableProjects(db, tracks, container) {
switch(tracks.value) {
case "AND":
container.innerHTML = "";
optionFiedCreator(andProjects, container);
break;
case "ABND":
container.innerHTML = "";
optionFiedCreator(abndProjects, contain... | [
"function goProjects() {\n setDisplay('work');\n }",
"static showAllProjects() {\n if (allProjects == \"\") {\n return;\n }\n allProjects.forEach((Myproject) => {\n UI.addProject(Myproject);\n });\n }",
"function showProject(index) {\n let project = projects[index]; \n title.tex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read the temperature sensor and return the raw value in units of 1/8th degrees C. This is an uncalibrated relative temperature. | temperature() {
this.setup();
// in order to read multiple bytes the high bit of the sub address must be asserted
return twos_comp(this.i2c_bus.read_word_data(this.addr, TEMP_OUT_L|0x80), 12);
} | [
"temperature() {\n let temp = this.read_temp_raw();\n temp = 27.5 + temp / 16;\n return temp;\n }",
"function readTemperature() {\n var temp = state.enclosureTemp = sensor.readF(state.enclosureProbeId, 4, readProbeCallback);\n if (state.fermenterProbeId != null) {\n temp = state.ferme... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that takes event and uses values to update inventory | function updateInventory(e) {
e.preventDefault();
// Get potions to add and subtract from it potions to subtract
var potionQuantityUpdateValue = (e.target[0].value - e.target[1].value);
// Get arrows to add and subtract from it arrows to subtract
var arrowQuantityUpdateValue = (e.target[2].value - e.targe... | [
"function updateInventory(newInventory) {\n setInventory(newInventory)\n\n }",
"function editInventory(){\n\t\t\t \n\t\t }",
"function processUpdates() {\n // update quantity remaining after order\n\n for (var i = 0; i < inventory.length; i++) {\n //compute the new quantity in stock\n v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to save fee data as a variable and then call functions once the data is saved | function getFeeData() {
$.getJSON('fees.json', function(data) {
feeStructure = data;
}).done(function() {
orderItemCost(orders);
distributions(orders);
});
} | [
"function updateFee() {\n\n\t}",
"updateFee() {\n let entity = this._Transactions.prepareImportanceTransfer(this.common, this.formData);\n this.formData.fee = entity.fee;\n }",
"function updateFee() {\n\t\t// Check for amount errors\n\t\tif(undefined === $(\"#amount\").val() || !nem.utils.helpe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the given object is an instance of KinesisStreamingDestination. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process. | static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === KinesisStreamingDestination.__pulumiType;
} | [
"static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === FirehoseDeliveryStream.__pulumiType;\n }",
"function isStream(obj) {\n return obj instanceof stream.Stream;\n}",
"static isInstance(obj) {\n if (ob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format a color and opacity into an rgba string to be used for CSS coloring | function formatRgba(color, opacity)
{
return "rgba(" + color[0] + "," + color[1] + "," + color[2] + "," + opacity + ")"
} | [
"function rgba(red, green, blue, alpha) {\n return `rgba(${guard(0, 255, red).toFixed()}, ${guard(0, 255, green).toFixed()}, ${guard(0, 255, blue).toFixed()}, ${parseFloat(guard(0, 1, alpha).toFixed(3))})`;\n}",
"function RGBAConvert(red, green, blue, opacity) {\n return `RGBA(${red},${green},${blue},${opacity ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Next paragraph from cell | getNextParagraphCell(cell) {
if (cell.nextRenderedWidget && cell.nextRenderedWidget instanceof TableCellWidget) {
//Return first paragraph in cell.
cell = cell.nextRenderedWidget;
let block = cell.firstChild;
if (block) {
return this.ge... | [
"getNextSelectionCell(cell) {\n if (!isNullOrUndefined(cell.nextRenderedWidget)) {\n if (this.isEmpty || this.isForward) {\n // tslint:disable-next-line:max-line-length\n let block = cell.nextRenderedWidget.childWidgets[cell.nextRenderedWidget.childWidgets.length - 1]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
open high score page while hiding timer | function openHighscorePage() {
hideTimer();
isQuizzing = false;
hidePages();
highscorePage.classList.remove('hide');
} | [
"function showHighScores() {\n clearInterval(timer);\n timeEl.text(\"\");\n questionCardEl.hide();\n welcomeCardEl.hide();\n timeUpCardEl.hide();\n highScoreCardEl.show();\n}",
"function highScorelink() {\n\tactiveDiv.classList.toggle(\"collapse\");\n\tscoreHistoryDiv.classList.toggle(\"collapse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper Functions ////////////////////// Initialize the elevator directions | function initializeElevator(elevator) {
elevator.dir = "up";
setIndicators(elevator);
// This will allow the elevators to be proactive and park themselves somewhere
// else while they wait for the first requests (not from ground)
var chanceOfRandom = Math.floo... | [
"function Elevator(oFloorsManager){\n this.direction=Directions.NONE;\n this.iCurrentFloor=0;\n this.eElevator=null;\n this.arOrders=[];\n this.iDelaySteps=0;\n this.oFloorsManager=oFloorsManager;\n this.oElevatorMovementCoordinator= null;\n}",
"constructor (elevators, floors) {\n this.flo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed. | function addExceptionMechanism(event, newMechanism) {
var _a;
if (!event.exception || !event.exception.values) {
return;
}
var exceptionValue0 = event.exception.values[0];
var defaultMechanism = { type: 'generic', handled: true };
var currentMechanism = exceptionValue0.mechanism;
exc... | [
"function addExceptionMechanism(event, mechanism) {\n if (mechanism === void 0) { mechanism = {}; }\n // TODO: Use real type with `keyof Mechanism` thingy and maybe make it better?\n try {\n // @ts-ignore Type 'Mechanism | {}' is not assignable to type 'Mechanism | undefined'\n // eslint-disa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract only CSS within tags (works for .svelte and .vue files, too) | function extractCssFromHtml(contents) {
// TODO: Replace with matchAll once Node v10 is out of TLS.
// const allMatches = [...result.matchAll(new RegExp(HTML_JS_REGEX))];
const allMatches = [];
let match;
let regex = new RegExp(util_1.HTML_STYLE_REGEX);
while ((match = regex.exec(contents))) {
... | [
"function tidyCSS() {\n return gulp.src(['./assets/styles/full/styles.css'])\n .pipe(postcss([\n purgecss({\n content: [\n './_site/**/*.html',\n ],\n defaultExtractor: content => content.match(/[\\w-/:]+(?<!:)/g) || []\n }),\n ]))\n .pipe(gulp.dest('./assets/styles... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get keys of a storage or of an item of the storage | function _keys() {
var storage = this._type, l = arguments.length, s = window[storage], keys = [], o = {};
// If at least 1 argument, get value from storage to retrieve keys
// Else, use storage to retrieve keys
if (l > 0) {
o = _get.apply(this, arguments);
} else {
... | [
"function _keys ( storage )\n\t\t\t{\n\t\t\t\tvar l = arguments.length,\n\t\t\t\t s = $.customStorage,\n\t\t\t\t a = arguments,\n\t\t\t\t a1 = a[ 1 ],\n\t\t\t\t keys = [],\n\t\t\t\t o = {};\n\t\t\t\t// If more than 1 argument, get value from storage to retrieve keys\n\t\t\t\t// Else, us... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
trasforma le coordinate della webcam in coordinate di threejs | function webcam2space(x, y, z) {
return new THREE.Vector3(
x - capture.videoWidth / 2,
-(y - capture.videoHeight / 2),
-z
);
} | [
"function webcam2space(x,y,z){\n return new THREE.Vector3(\n (x-capture.videoWidth /2),\n -(y-capture.videoHeight/2), // in threejs, +y is up\n - z\n )\n}",
"function getCameraCoordinates() {\n return {\n x: camera.translate()[0],\n y: camera.transl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a RGB color value to the XYZ color space. Formulas are based on assuming that RGB values are sRGB. Assumes r, g, and b are contained in the set [0, 255] and returns x, y, and z. | static rgbToXYZ(r, g, b) {
r /= 255;
g /= 255;
b /= 255;
if (r > 0.04045) {
r = Math.pow((r + 0.055) / 1.055, 2.4);
} else {
r /= 12.92;
}
if (g > 0.04045) {
g = Math.pow((g + 0.055) / 1.055, 2.4);
} else {
g /= 12.92;
}
if (b > 0.04045) {
b = Mat... | [
"function RGBtoXYZ(rgb) {\n var red2 = rgb[0] / 255;\n var green2 = rgb[1] / 255;\n var blue2 = rgb[2] / 255;\n if (red2 > 0.04045) {\n red2 = (red2 + 0.055) / 1.055;\n red2 = Math.pow(red2, 2.4);\n }\n else {\n red2 = red2 / 12.92;\n }\n if (green2 > 0.04045) {\n green2 = (green2 + 0.055) / 1.0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collect the result of the current state. This returns a Bindings per group, and a (possibly empty) Bindings in case the no Bindings have been consumed yet. | collectResults() {
// Collect groups
let rows = Array.from(this.groups, ([_, group]) => {
const { bindings: groupBindings, aggregators } = group;
// Collect aggregator bindings
// If the aggregate errorred, the result will be undefined
const aggBindings = ... | [
"collectResults() {\n // Collect groups\n let rows = [...this.groups].map(([_, group]) => {\n const { bindings: groupBindings, aggregators } = group;\n // Collect aggregator bindings\n // If the aggregate errorred, the result will be undefined\n const aggBin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The select handler. Call the chart's getSelection() method | function selectHandler() {
var selectedItem = chart.getSelection()[0];
if (selectedItem) {
var value = data.getValue(selectedItem.row, selectedItem.column);
alert('The user selected ' + value);
}
} | [
"function selectHandler() {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) {\n var value = data.getValue(selectedItem.row, selectedItem.column);\n showSelectedrow(selectedItem.row)\n // alert('The user selected ' + selectedItem.row);\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
On each tick, display another word. | function tick() {
if (index < 0 || index >= words.length) return;
var item = words[index++];
var x = 5 + Math.random() * 900;
var y = 110 + Math.random() * 640;
var brush = canvas.getContext("2d");
brush.fillText(item, x, y);
if (index >= words.length) clearInterv... | [
"displayWords(word) {\n push();\n fill(0, 255, 90);\n textSize(32);\n textFont('DotGothic16')\n text(word.string, word.x, word.y);\n pop();\n }",
"function displayOne() {\n if (curr < words.length) {\n $(\"output\").innerHTML = words[curr];\n curr++;\n } else... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End JSValidatorFormValidation class. ========================================================================== JSValidatorFormValidationParam is a class which defines a parameter used by a field validation. ========================================================================== | function JSValidatorFormValidationParam() {
var name = null;
var value = null;
this.getName = function() {
return name;
}
this.setName = function(inName) {
name = inName;
}
this.getValue = function() {
return value;
}
this.setValue = function(inValue) {
value = inValue;
}
this.... | [
"function JSValidatorFormValidation() {\n\n var field = null;\n var event = null;\n var type = null;\n var failAction = null;\n var startInvalid = null;\n var params = new Object();\n\n this.getField = function() {\n return field;\n }\n this.setField = function(inField) {\n field = inField;\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Only save if the new score is better than the old one | function shouldSaveNewScore(newScore, oldScore) {
// The user could not answer more than one answer per second, that's cheating!
if ((newScore.endTime - newScore.startTime) <= newScore.answerCount * 1000) {
return false;
}
// eslint-disable-next-line max-len
const betterTime = (newScore.endTime - newScore... | [
"function storeNewScore(score) { \n if (scoreData.score < score) {\n database.ref(\"Scores/\" + userID).update({\n score: score\n })\n }\n}",
"function updateBestScore(currentScore) {\n if (currentScore > bestScore) {\n bestScore = currentScore;\n localStorage.setIt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(Optional): Do Fahrenheit and Celsius values equate at a certain number? The scientific calculation can be complex, so for this challenge just try a series of Celsius integer values starting at 200, going downward (descending), checking whether it is equal to the corresponding Fahrenheit value. | function fEqualsC(){
let num = 200
let f = (9/5)*num+32
let c = (num-32)*5/9
while (f != c){
f = (9/5)*num+32
c = (num-32)*5/9
num--
}
return num+1
} | [
"function equateFahrenheitCelsius()\n{\n for(var i = 200; i > -200; i--)\n {\n var fahrenheit = ((9/5) * i + 32)\n var celsius = (i - 32) / (9/5);\n\n if(fahrenheit === celsius)\n {\n console.log(\"Fahrenheit and Celsius equate at \" + i + \" degrees\");\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion que cambia la foto en la anterior posicion | function retrocederFoto() {
if(posicionActual <= 0) {
posicionActual = IMAGENES.length - 1;
} else {
posicionActual--;
}
renderizarImagen();
} | [
"function retrocederFoto() {\n if(posicionActual <= 0) {\n posicionActual = imagenesp.length - 1;\n } else {\n posicionActual--;\n }\n renderizarImagen();\n }",
"function retrocederFoto() {\r\n // se incrementa el indice (posicionActual)\r\n posic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In the player on Windows Store Apps when CPU architecture is X64. | get WSAPlayerX64() {} | [
"get WSAPlayerX86() {}",
"architecture(){\n return os.arch()\n }",
"function is64BitArch(arch) {\n return SIXTY_FOUR_BIT_ARCHES.includes(arch);\n}",
"set WSAPlayerX86(value) {}",
"function assurePS32() {\n type(\"if ([IntPtr]::Size -ne 4){& $env:SystemRoot\\\\SysWOW64\\\\WindowsPowerShell\\\\v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a the sequelize.fn needed to do a bounding box search on a point. | function pointInBoundingBox(columnName, boundingBox) {
var lonlat1, lonlat2;
if (!Array.isArray(boundingBox)) {
throw Error('boundingBox should be an array of [lon1,lat1,lon2,lat2] or [[lon1,lat1],[lon2,lat2]');
}
if (boundingBox.length === 2 && Array.isArray(boundingBox[0])) {
lonlat1 ... | [
"function searchPOIInBox(req, res) {\n\n const lat1 = req.swagger.params.lat1.value;\n const lat2 = req.swagger.params.lat2.value;\n const lon1 = req.swagger.params.lon1.value;\n const lon2 = req.swagger.params.lon2.value;\n\n console.log(lat1, lat2, lon1, lon2);\n\n const latMax = Math.max(lat1, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for separating a number by a number of jumps depending on user input. the delimiter is provided by the user | function numberDelimited(number, delimiter, jumps){
var string = number.toString();
var length = string.length;
var symbol = delimiter;
var ind1 = length; // for the manipulation of input
var ind2 = ind1-jumps;
var word = "";
if(length%jumps!=0){ // if the number can't be divided exactly by the numb... | [
"function numberDelimited(number,delimiter,jumps){\n\n}",
"function delimiterHandler(delimiter, numbers)\n{\n\t// base delimiters\n\tvar delimiter = /[\\n,]/g;\n\t\n\tif(numbers.includes(\"//\"))\n\t{\n\t\tdelimiter = numbers.substring(2,3);\n\t\tnumbers = numbers.substring(4);\n\t}\n\t\t\n\treturn delimiter;\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Task 2.15 Function maxConSubarray(arr) get array pararmeter return subarray from arr witch sum is maximum, if this array is negative return 0, if no subarray with length more than 2 return max element. | function maxConSubarray(arr){
var i,
len,
tmp = [],
sum = 0,
cash,
cashArr = [],
// If find subarray with length more than 2.
flag = true;
/* To find
positive subarray: posORneg = -1;
negative subarray: posOR... | [
"function largestSub (arr){\n\tlet result = 0;\n\tfor(let i=0; i<arr.length; i++){\n\t\tlet sum=0;\n\t\tfor (let j=0; j<arr[i].length; j++){\n\t\t\tsum += arr[i][j];\n\t\t}\n\t\tif (!i) result = sum\n\t\telse if (sum>result) result = sum;\n\t}\n\treturn result;\n}",
"function getMaxSubSum(arr){\n let prev = 0;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the latest document of User in PersonalStorage of current user if not exist get in the INCLUDES folder | getLatestContentOfDocument(documentName, testerID) {
var getLatestDoc1 = new Promise((resolve, reject) => {
var storageLocation = config.personalStorageLocation + '/' + testerID + '/' + documentName + '-AutoSave' + '.md'
fs.readFile(storageLocation,
{
encoding: 'utf8',
flag: ... | [
"getDocumentsOfSelectedProject(){\n let self = this;\n return new Promise(function(resolve, reject){\n if(!projectService.project){ // if no project selected - request a to select a project first\n console.log(\"Please select first a project before to work on it\".warn);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return a function that maps object keys by mapper (or capitlize keys if key is not exists in mapper) | function mapObject(mapper) {
return function(obj) {
var res = {};
Object.keys(obj).forEach(function(key) {
// map key or capitalize if not exists
var newKey = mapper[key] || key;
res[newKey] = obj[key];
});
return res;
};
} | [
"static mapKeys(obj, func) {\r\n // Get the keys of the this object\r\n const keys = Object.keys(obj);\r\n // Create an output object\r\n const out = {};\r\n // Go through all keys\r\n for (let i = 0; i < keys.length; i++) {\r\n const key = keys[i];\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method returns the Y coordinate of the centre of the radial slider by taking reference from the slider's bounding box. | getSliderCentreY() {
return this.sliderBoundingRect.current.getBoundingClientRect().top + (this.sliderBoundingRect.current.getBoundingClientRect().height / 2);
} | [
"getCenterY() {\n return (this.maxY + this.minY) / 2;\n }",
"alignKnobSliderY() {\n const sliderCentreY = this.getSliderCentreY();\n return sliderCentreY - this.sliderBoundingRect.current.getBoundingClientRect().height * Constants.KNOB_TO_SLIDER_RATIO / 2;\n }",
"getCenter() {\n return (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes the movie data service | function initializeService() {
movieDataDb.ensureIndex({ fieldName: 'imdbID', unique: true }, function (err) {
if (err) {
console.log(err);
}
})
switch (command) {
case 'get':
getMovieData()
break;
case 'get-all':
getAllMovieDat... | [
"function init(){\n \n getMovieList(0);\n \n }",
"init() {\r\n\r\n // Initialize the data object.\r\n data.init();\r\n }",
"function onLoad() {\n OmdbHttpFactory.getSearchedMovieList().then(function (movies) {\n $scope.movies = movies;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call Api rest to create dummy data | async function createDummyData() {
await axios.post(requestURL, hotels)
.then((response) => {
// eslint-disable-next-line no-console
console.log(`
response: ${'Dummy data create successfully'}
`);
})
.catch((error) => {
// eslint-disable-next-line no-console
console.e... | [
"testApi ()\n {\n var bodyData = {}\n this.sendTestApiCall('http://127.0.0.1:8080/api/v1/test',bodyData);\n }",
"apiRestTest(){}",
"async create(data, params) {}",
"createAPI(data) {\n return null;\n }",
"function create () {\n $http.post(API_URL+'services', $scope.service)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes the level of the |userId| to the given |level|. | async setUserLevel(userId, level) {
await server.database.query(PLAYER_BETA_SET_LEVEL, level, userId);
} | [
"function setUserLevel(level) {\n\tvar langData = getLangData();\n\n\tif (level === langData.level) {\n\t\treturn;\n\t}\n\n\tlog({\n\t\tmessage: 'Setting user level',\n\t\tlevel: level\n\t});\n\tlangData.correctAnswers = 0;\n\tlangData.wrongAnswers = 0;\n\tlangData.level = level;\n\tlangData.range = 40;\n\tlangData... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
play one of audio instance of the pool | play(options) {
const { sounds } = this;
const index = this.count++ % sounds.length;
sounds[index].play(options);
} | [
"play (opts) {\n const index = this.playCount % this.sounds.length;\n this.playCount ++;\n const sound = this.sounds[index];\n sound.play(opts);\n }",
"play (opts) {\n const index = Math.floor(Math.random() * this.sounds.length);\n const sound = this.sounds[index];\n sound.play(opts);\n }",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for package.json or npmshrinkwrap.json inside a list of files and expands the list of files to include package dependencies if so. | function expandFiles(files, workingDirectory) {
const promises = [];
files.forEach((file) => {
if (
file.path !== './package.json' && file.path !== './npm-shrinkwrap.json'
) {
promises.push(Promise.resolve(file));
return;
}
findPackageDependencies(workingDirectory, true).forEach((d... | [
"function checkPackageJSONFiles() {\n\tconst packages = getPaths(['package.json'], [], IGNORE_FILE);\n\n\tconst {rules} = getMergedConfig('npmscripts');\n\n\tconst errors = [];\n\n\tif (rules && rules[BLACKLISTED_DEPENDENCY_PATTERNS]) {\n\t\tconst blacklist = rules[BLACKLISTED_DEPENDENCY_PATTERNS].map(\n\t\t\t(patt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A method which is similar to Array.prototyoe.filter but will clear the id if you return tru in callback! | filter(callback) {
let oldData = this.all();
for (let i = 0; i < oldData.length; i++) {
let result = callback(oldData[i].data, oldData[i].ID, i, this);
if (result)
delete oldData[i];
}
this.data = Util_1.default.fromDataset(oldData);
} | [
"runFilter(callback) {\n\n if (callback === '') {\n this.data = this.dataUntouched;\n } else {\n\n const untouched = cloneArrayOfObjects(this.dataUntouched);;\n\n this.data = untouched.filter((e) => callback(e));\n }\n\n this.settings.offset = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate the sidebarWidth based on current touch info | touchSidebarWidth() {
// if the sidebar is open and start point of drag is inside the sidebar
// we will only drag the distance they moved their finger
// otherwise we will move the sidebar to be below the finger.
const { pullRight, open, width } = this.props;
const { touchStartX, touchCurrentX } =... | [
"touchSidebarWidth() {\n // if the sidebar is open and start point of drag is inside the sidebar\n // we will only drag the distance they moved their finger\n // otherwise we will move the sidebar to be below the finger.\n if (this.state.touchStartX < this.state.sidebarWidth) {\n if (this.state.tou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Added by Joseph 2007/7/25 Verify if the MAC address is legal or not Ex: IsLegalMACAddress("00:DD:EE:DF:0F:FE") > return true Ex: IsLegalMACAddress("00:DD:GE:DF:0F:FE") > return false | function IsLegalMACAddress(str) {
var re = new RegExp(/^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}$/);
var legal = re.test(str);
if(legal && (str == "FF:FF:FF:FF:FF:FF" || str == "00:00:00:00:00:00")) {
legal = false;
}
return legal;
} | [
"function isValidMacAddress(macAddress) {\r\n macAddress = $.trim(macAddress);\r\n macAddress = macAddress.toLowerCase();\r\n var c = 0;\r\n var i = 0, j = 0;\r\n if ('ff:ff:ff:ff:ff:ff' == macAddress || '00:00:00:00:00:00' == macAddress) {\r\n return false;\r\n }\r\n\r\n var addrParts =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cancel all existing alarms. | function cancelAllAlarms() {
chrome.alarms.clearAll();
} | [
"function cancelAlarm(alarmName) {\n chrome.alarms.clear(alarmName);\n }",
"function cancellAllSchedules(){\n Notifications.cancelAllScheduledNotificationsAsync().then(()=>console.log('Notifications were cancelled'));\n}",
"function remove_alarms() {\n\tconsole.log('remove_alarm: start.');\n\ttizen.alarm.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Turning tweet links into direct links back to twitter | function processTweetLinks(text) {
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i;
text = text.replace(exp, "<a href='$1' target='_blank'>$1</a>");
exp = /(^|\s)#(\w+)/g;
text = text.replace(exp, "$1<a href='http://twitter.com/hashtag/$2' target='_blan... | [
"function processTweet(text) {\r\n text = text.replace(/http:\\/\\/([\\w\\.\\/]+)\\ ?/ig, '<a href=\"http://$1\" target=\"_BLANK\">http://$1</a>');\r\n return text = text.replace(/@(\\w+)/ig, '<a href=\"http://twitter.com/$1\">@$1</a>');\r\n }",
"function linkify_tweet(html) {\n\tvar tweet = html.rep... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if a conversation link in conversations menu list doesn't exist create a new link with an opposed user's name and prepend it to the list | function newPrivateConvMenuListLink(user, conversation_id, conversation_menu_link) {
if (conversation_menu_link.length == 0) {
var data_attr = '<li id="menu-pc' + conversation_id + '">\
<a data-remote="true"\
rel="n... | [
"function updateUsersLink ( ) {\n\tvar t = aliases.length.toString() + \" user\";\n\tif (aliases.length != 1) t += \"s\";\n\t$(\"#usersLink\").text(t);\n}",
"function getConversationLink(user,conversations){\n // the id we will use to find the conversation for the user\n let userMainId = user.FBinfo.fb_main... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
needs to be moved to a store for each event, calculate 'top' is based on startDate, 'height' is based on duration also, for overlapping events, we need to adjust the 'left' based on the number of overlapping events (use percentage) | styleEvents(events){
const {
day
} = this.props;
const columnEndTimes = [];
return events.map((event) => {
const { startDate, endDate } = event;
const startOfDayUnix = day.startMoment.valueOf();
const endOfDayUnix = day.endMoment.valueOf();
let styles = {
top:`$... | [
"styleEvents() {\n const events = Array.from(this.container.querySelectorAll(this.props.eventSelector));\n const markers = Array.from(this.container.querySelectorAll(this.props.markerSelector));\n\n const containerWidth = this.container.offsetWidth;\n const containerHeight = this.container.offsetHeight;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[String] getPanelObjType([String] objID) Returns the object type as encoded in the object ID. ID is assumed to be of the form: tttaaa, where t is the object type, are numeric characters, and aaa is an optional alphabetic submotor address This function thus returns ttt (e.g. TO450A will return TO) or null if the charact... | function getPanelObjType(objID)
{
var position = objID.search("[0-9]");
if(position != -1)
return objID.substring(0, position);
return null;
} | [
"function getObjType(state, objId) {\n const objType = state.getIn(['opSet', 'byObject', objId, '_init', 'action']);\n return objType === 'makeList' || objType === 'makeText' ? 'list' : 'object';\n}",
"getObjectType(id) {\n var searchId = id.trim();\n for (var i = 0; i < this.reportStructure.lengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |