query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Returns the number of vampires away from the original vampire this vampire is | get numberOfVampiresFromOriginal() {
let numberOfVampires = 0;
let currentVampire = this;
// climb "up" the tree (using iteration), counting nodes, until no boss is found
while (currentVampire.creator) {
currentVampire = currentVampire.creator;
numberOfVampires++;
}
return numberOfVa... | [
"get numberOfVampiresFromOriginal() {\n let numberOfVampsAway = 0;\n let currentVampire = this;\n\n while (currentVampire.creator) {\n currentVampire = currentVampire.creator;\n numberOfVampsAway++\n } return numberOfVampsAway;\n }",
"get numberOfVampiresFromOriginal() {\n let numberOfVa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Flattens the object to XML | function flatten(obj, root) {
function flattenObj(obj) {
var str = "";
for (i in obj) {
if (typeof obj[i] !== 'object') {
str += "<" + i + ">" + obj[i] + "</" + i + ">";
}
else {
str += flatte... | [
"function obj_to_xml(obj) {\n let xml_str = \"\";\n for (let item in obj) {\n console.log(`${item}: ${obj[item]}`);\n xml_str += `<${item}>${obj[item]}</${item}>\\n`\n }\n xml_str = `<data>\\n${xml_str}</data>`\n return xml_str;\n}",
"function object2xml(name, obj) {\n var xmlstr =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the certificate viewer dialog by wiring up the close button, substituting in translated strings and requesting certificate details. | function initialize() {
cr.ui.decorate('tabbox', cr.ui.TabBox);
const args = JSON.parse(chrome.getVariableValue('dialogArguments'));
getCertificateInfo(args);
/**
* Initialize the second tab's contents.
* This is a 'oneShot' function, meaning it will only be invoked once,
* no matter ho... | [
"function initSelectCertificate(username,txtCertificate)\n {\n var selCertificate = getDefaultCertificate(username);\n if(selCertificate!=null)\n {\n txtCertificate.value = selCertificate.GetInfo(CAPICOM_INFO_SUBJECT_SIMPLE_NAME);\n txtCertificate.hash = selCertificate.Thumbprint;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds a waypoint at the given index. if no index is given, the waypoint is appended at the end of the list | function addWaypoint(index) {
if (index) {
waypointsSet.splice(index, 0, false);
requestCounterWaypoints.splice(index, 0, 0);
} else {
waypointsSet.push(false);
requestCounterWaypoints.push(0);
}
} | [
"function addWaypoint(index) {\n if (index) {\n waypointsSet.splice(index, 0, false);\n requestCounterWaypoints.splice(index, 0, 0);\n } else {\n waypointsSet.push(false);\n requestCounterWaypoints.push(0);\n }\n }",
"async addUserWaypoint(waypoi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
$('body').append('look at me! now is ' + moment().format() + ''); | function time() {
$('span').html(moment().format());
} | [
"function currentDate() {\n let date = moment().format(\"dddd MMMM Do YYYY \");\n $(\"#date\").html(\"<h5>\" + date + \"</h5>\");\n }",
"function displayDate(){\n //Get current date \n currentDateElement.text(moment().format('dddd, MMMM Do YYYY'));\n}",
"function displayToday() {\n var today = m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Currently, this is only rendering in the client logo portion of the screen. Need to make another Component that renders the details. ClientLogos component also INCOMPLETE. | render(){
return(
<div>
<h2> Our Current Clients Page </h2>
<ClientLogos/>
<ClientDescription/>
</div>
)
} | [
"function displayLogo(){\n const logoText = logo(\n {\n name: \"Employee Tracker\",\n lineChars: 20,\n padding: 2,\n margin: 2,\n borderColor: 'yellow',\n logoColor: 'bold-green',\n }\n ).render();\n console.log(logoText);\n}",
"renderCompanyLogo() {\n if (this.props.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize all available addons. | _initAddons() {
// Invoke "before" hook.
this.trigger('initAddons:before');
for (let addon in Mmenu.addons) {
Mmenu.addons[addon].call(this);
}
// Invoke "after" hook.
this.trigger('initAddons:after');
} | [
"initializeAddons() {\n if (this._addonsInitialized) {\n return;\n }\n this._addonsInitialized = true;\n this._didDiscoverAddons = false;\n\n logger.info('initializeAddons for: %s', this.name());\n\n this.discoverAddons();\n\n this.addons = instantiateAddons(this, this, this.addonPackages)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Execute a command in a shell (/bin/sh) An optional object can be passed with options for runCommand With one argument, this is like C's system function | function system(command, opts) {
var options = opts || {};
runCommand("/bin/sh", "-c", command, options);
} | [
"ShellExecute(string, Variant, Variant, Variant, Variant) {\n\n }",
"function sh(cmd) {\n var result = execSync(cmd, {\n encoding: 'utf8'\n });\n console.log(result);\n}",
"function shawn(script, options = {}) {\n const shell = options.shell || '/bin/bash'\n\n // regarding detached, see https://stack... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create prompts from template extra configuration and assign user answers to the template | customizeTemplateTask(template) {
return __awaiter(this, void 0, void 0, function* () {
const extraPrompt = this.createQuestions(template.getExtraConfiguration());
const extraConfigAnswers = yield inquirer.prompt(extraPrompt);
const extraConfig = this.parseAnswers(extraConfig... | [
"function promptQuestions() {\n prompt.get([{\n name: 'analytics',\n description: 'Do you want to enable Firebase Analytics? (y/n)',\n default: 'y'\n }, {\n name: 'firestore',\n description: 'Are you using Firestore? (y/n)',\n default: 'n'\n }, {\n name: 'realtimedb',\n description: 'Are ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print service info to the console (in dev mode) | printServicesInfo() {
let endPoints = listEndpoints(this.app);
logger.debug("Endpoints are : ", endPoints);
} | [
"function printServerInfo() {\n\tconsole.info('Server Details:');\n\tconsole.info();\n\tconsole.info('Server: ',configuration.url);\n\tconsole.info('Port: ',configuration.port);\n\tconsole.info('DB Name:',configuration.mongo.db);\n\tconsole.info('DB Host:',configuration.mongo.host);\n\tconsole.info('DB Port:',con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the cue wrapped into a span specifying its linePadding. | function applyLinePadding(cueHTML, cueStyle) {
// Extract the linePadding property from cueStyleProperties.
var linePaddingLeft = getPropertyFromArray('padding-left', cueStyle);
var linePaddingRight = getPropertyFromArray('padding-right', cueStyle);
var linePadding = linePaddingLeft.conc... | [
"function applyLinePadding(cueHTML, cueStyle) {\n // Extract the linePadding property from cueStyleProperties.\n var linePaddingLeft = getPropertyFromArray('padding-left', cueStyle);\n var linePaddingRight = getPropertyFromArray('padding-right', cueStyle);\n var linePadding = linePadding... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper Functions //////////////////////////////////////////////// Walk the ast tree | function walk_tree(ast) {
var walker = {
"assign" : function() {
var assign_expr = new assign_expression();
assign_expr.type = "assign_expr";
assign_expr.left_expr = walk_tree(ast[2]);
assign_expr.right_expr = walk_tree(ast[3]);
assign_expr.name = ... | [
"function traverseASTTree(node, func){\n func(node);\n\t for(var key in node){\n var child = node[key];\n if(typeof child === \"object\" && child !== null){\n if(Array.isArray(child)){\n child.forEach(function(node) {\n traverseASTTree(node, func);\n });\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FORM: SUBMIT METHOD handleSubmit below: See form lesson for details. Once the form is sumbited, two things need to happen: set the state of pilot to the input value. Then, set the value of the input back to an empty string. Enter your code below: | handleSubmit(event){
event.preventDefault()
this.setState({
pilot:'',
value:this.state.pilot
})
} | [
"handleSubmit(event){\n event.preventDefault();\n this.setState({pilot: this.state.value});\n this.setState({value: ''});\n }",
"handleSubmit(e) {\r\n e.preventDefault()\r\n this.setState({\r\n pilot: this.pilotName\r\n })\r\n\r\n }",
"constructor(props) {\n super(props);\n\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================================================== Folding Multi Wiki Tabs (experimental) ================================================== | function foldingTabsMulti() {
var len = 0;
ftsets = getElementsByClassName(document, 'div', 'foldtabSet'); //global object array thingy
if (ftsets.length == 0) return
for (var i = 0; i < ftsets.length; i++) {
ftsets[i].head = getElementsByClassName(ftsets[i], 'div', 'foldtabHead')[0];
f... | [
"function foldingTabsMulti() {\n var len=0;\n ftsets = getElementsByClassName(document, 'div', 'foldtabSet'); //global object array thingy\n if(ftsets.length==0) return\n\n for(var i=0;i<ftsets.length;i++) { \n ftsets[i].head = getElementsByClassName(ftsets[i], 'div', 'foldtabHead')[0];\n ftsets[i].link... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the Ajax loading icon, and add a link to turn it off. 'where' should be empty to center on screen, or a DOM element to serve as the center point. 'exact' is an optional array of two numbers, indicating a top/left offset to be applied on top of where's. e.g., show_ajax($notif_button, [0, 20]) will show the Ajax p... | function show_ajax(where, exact)
{
// We're delaying the creation a bit, to account for super-fast AJAX (e.g. local server, caching, etc.)
window.ajax = setTimeout(function ()
{
var offs = $(where).offset();
$('<div id="ajax">')
.html('<a title="' + (we_cancel || '') + '"></a>' + we_loading)
.click(hide_aj... | [
"function showAjaxLoadingIcon(){\r\n $('#hits').html(\"<img src='images/ajax-loader.gif'></img>\");\r\n }",
"function hideAjaxLoading() {\n // let XenForo create element if needed\n if ($ajaxProgressWrapper === null || !$ajaxProgressWrapper.length) {\n // as it is only created w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sum of all numbers here is 750 /function takes a multi dimensional array as a parameter, loops through the outer (index) and inner indexes (j), while keeping track of sum. then returns sum. | function sumIndexes(arrayParam){
//local variable to sumIndexes function defining and assignment to keep track of the total
var sum = 0;
//outer for loop
for(index = 0; index < arrayParam.length; index++){
//inner for loop
for(j=0; j < arrayParam[index].length; j++){
sum += arrayParam[inde][j];
... | [
"function sumOfSums(arr) {\n return arr.reduce(function(sum, current, index) {\n return sum + arr.slice(0, index + 1).reduce(function(innerSum, innerElem) {\n return innerSum + innerElem;\n });\n });\n}",
"function sumTo(a, i) {\n\tvar sum = 0;\n for (var j = 0; j < i; j++) {\n sum += a[j];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for input of manager | function enterManager (){
inquirer.prompt([
{
type: "input",
name: "name",
message: "What is the name of your team's manager",
validate: catchEmpty
},
{
type: "input",
name: "id",
message: "what is their empl... | [
"function getManagerAction() {\n // Get command from user\n inquirer.prompt([\n { \n type: \"list\",\n name: \"choice\",\n message: \"What would you like to do?\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\", \"Exit\"] \n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Any 3 Face card | function threeFaceCard (player) {
if (player.allPictures) {
return '3 Pictures'
} else {
// console.log('no 3 face cards');
return threeSameSuit(player)
}
} | [
"function showThreeCards(){\n \n\n}",
"function showCardFace(cardEle) {\n cardEle.classList.add('flipped');\n cardEle.firstChild.textContent = cardEle.dataset.prototype;\n}",
"show3D(player,perspective){\n stroke(this.colour);//Sets the outline of shapes to colour of face\n fill(this.colour);//Se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Positions preview on screen | function movePreview() {
$("#preview")
.css("top", (30) + "px")
.css("left", (30) + "px")
.css("position", "fixed");
} | [
"function updatePreviewPosition(evt) {\n\n\t\tmouseX = evt.pageX\n\t\tmouseY = evt.pageY\n\n\t\tif(mouseX < (canvasWidth + canvasX) && mouseX > canvasX && mouseY < (canvasHeight + canvasY) && mouseY > canvasY) {\n\t\t\tdragPreview.css({ opacity: 1.0 }).find('span').show()\n\t\t\thoverArea.addClass('dragging-on-top'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a restartable DOM visibility map. | static preserve() {
// Initialize map
let states = [];
// Find all elements
let elements = document.getElementsByTagName("*");
// Loop over all elements
for (let element of elements) {
// Make sure the element has an ID
if (element.id.length === 0)... | [
"static preserve() {\n // Initialize map\n let state = [];\n // Find all elements\n let elements = document.getElementsByTagName(\"*\");\n // Loop over all elements\n for (let element of elements) {\n // Make sure the element has an ID\n if (element.id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Represents a house ingame takes PIXI.Container: STAGE | constructor(STAGE) {
this.stage = STAGE;
// Signals if the house is active or not
this.lightOn = true;
this.assetloader = new Loader();
this.assetloader.add("house.png");
// "house" is actually a container holding building and light
... | [
"function House (size, bedrooms, stories, bathrooms, value) {\n this.size = size;\n this.bedrooms = bedrooms;\n this.stories = stories;\n this.bathrooms = bathrooms;\n this.value = value;\n}",
"function OogaahGraveyard() {\n\tOogaahPile.apply(this, null); // construct the base class\n\t\n\tthis.mCa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dumps the queue to the channel for debugging | function queueDump(res) {
res.send(JSON.stringify(queue.get(), null, 2));
} | [
"print() {\n console.log(this.queue);\n }",
"printdeq() {\n console.log(this.queue);\n }",
"print() {\n console.log('');\n console.log('Printing queue:', this.name);\n for (let i = 0; i < this.items.length; i++) {\n console.log(this.items[i]);\n }\n }",
"toString() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Invert all checkboxes at once by clicking a single checkbox. | function invertAll(oInvertCheckbox, oForm, sMask)
{
$(oForm).find('input[type=checkbox]').each(function () {
if (this.name && !this.disabled && (!sMask || this.name.indexOf(sMask) === 0 || this.id.indexOf(sMask) === 0) && this.checked != oInvertCheckbox.checked)
this.click();
});
} | [
"function selectInvert()\r\n\t\t{\r\n\t\t\tvar $checked = $(\":checkbox:visible:checked\");\r\n\t\t\tvar $unchecked = $(\":checkbox:visible:not(:checked)\");\r\n\t\t\t\r\n\t\t\t$unchecked.prop(\"checked\",true)\r\n\t\t\t\t\t\t .each(function(index, element){GM_setValue(this.id, true)});\r\n\t\t\t$checked.prop(\"che... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transfer sounds to public | function sounds() {
return src(source + 'sounds/*.mp3')
.pipe(dest(destination + 'sounds'));
} | [
"publishLocalAudio() {\n TWVideoModule.publishLocalAudio();\n }",
"function sounds(){\n //Sound on correct\n correct = new Audio();\n correct.src = 'assets/sounds/correct.mp3';\n //sound on wrong\n wrong = new Audio();\n wrong.src = 'assets/sounds/wrong.wav';\n //sound on game start\n begin = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the setting modal | function loadSettingModal(modalSelector, setting) {
var container = $(modalSelector);
// remove active class from all fields
container.find('.form-group[class*="setting-"].active, .row[class*="setting-"].active').removeClass('active');
// set type
container.find('.setting-type').val(setting.type);
// set... | [
"function cargarConfiguracion(){\n\t\t$('#myModal').modal(); \n\t}",
"showSettingsModal() {\n return Modals.contentSettings(this);\n }",
"function initAccountSettingsModal() {\n const template = require('./user-accounts-modal-settings.html');\n $uibModal\n .open({\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate positions for all sessions | function calc_session_positions (storyline, jsessions) {
// STEP 1. read position from dot graph
var digraph = json2dot(jsessions);
var inputgraph = Viz(digraph, format="dot", engine="dot", options=null);
var graph = graphlibDot.read(inputgraph);
var sessionPos = d3.map();
var charnodePos = d3.m... | [
"function getPositions() {\n displayPositions();\n}",
"calculatePositions(){\n \n let numX = Math.floor(this.texture.width / this.tileWidth);\n let numY = Math.floor(this.texture.height / this.tileHeight);\n\n for(let y=0; y<numY; y++){\n \n for(let x=0; x<numX... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a list of buckets between two date objects. This is used to figure out how many bucket increments exist between the start and end date. | function bucketDiff(startDate, stopDate) {
const minutes = Math.floor((stopDate.getTime() - startDate.getTime()) / 1000) / 60;
const increments = minutes/5;
let dateBuckets = [];
for(let i = 1; i <= increments; ++i) {
startDate.setUTCMinutes(startDate.getUTCMinutes() + 5);
dateBuckets.... | [
"function monthBuckets(start, end, dateStart /* 1-31 */) {\n start = moment(valueToDate(start));\n end = moment(valueToDate(end));\n\n dateStart = dateStart || start.date();\n \n if(dateStart > start.date()) {\n start.subtract(1, 'months').date(dateStart);\n } else {\n start.date(dateStart); \n }\n \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create new content type | function createContentType(req,res,template,block,next) {
calipso.form.process(req,function(form) {
if(form) {
var ContentType = calipso.lib.mongoose.model('ContentType');
var c = new ContentType(form.contentType);
c.ispublic = form.contentType.contentType.ispublic === "Yes" ? true : false;... | [
"add(id, name, description = \"\", group = \"Custom Content Types\", additionalSettings = {}) {\r\n const postBody = jsS(Object.assign(metadata(\"SP.ContentType\"), {\r\n \"Description\": description,\r\n \"Group\": group,\r\n \"Id\": { \"StringValue\": id },\r\n \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
outcome/ This function will update the user profile it will commit the state as store user | updateProfile(state) {
axios.get('api/account/profile').then(({ data }) => {
state.commit('storeUser', data.user);
})
} | [
"function updateProfile() {\n\t\t\tvar _profileData = { displayName: account.user.displayName };\n\n\t\t\tif (account.user.displayName) {\n\t\t\t\t// Set status to Saving... and update upon success or error in callbacks\n\t\t\t\taccount.btnSaveText = 'Saving...';\n\n\t\t\t\t// Update the user, passing profile data ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
copy events from App to Paydown event array | copyEvents (array_ref) {
var i = 0
var obj = {}
for (i = 0; i < this.props.events.length; i++) {
if( this.props.events[i].hasOwnProperty('included') ) {
if (this.props.events[i].included === false) {
continue
}
}
if (this.props.events[i].date) {
obj.date =... | [
"addAllEvents() {\n this.webhook.events = [].concat(this.events);\n }",
"function appendEvents(events){\n for (var i = 0; i < events.length; i++) {\n service.events.push(events[i]);\n }\n }",
"addEvent(events) {\r\n for (const event of events) { this.events.push(even... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `AssetPropertyValueProperty` | function CfnDetectorModel_AssetPropertyValuePropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, b... | [
"function CfnAsset_AssetPropertyPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a Prt (partition) object given a volume lable or id. | function vl2Prt(l) {
// Get the id.
l = l2id(l);
// Now look for the Prt object in the available disks.
for (var i = 0; dsks != null && i < dsks.length; i++) {
var pt = dsks[i].pt;
for (var j = 0; pt != null && j < pt.length; j++) {
if (l == pt[j].id) { return pt[j]; }
... | [
"function getPartitionObjectById(partition_id){\n \tvar partition_object=null;\n \t//gets the list of all partitions in this simulation\n \tvar partition_list=getAllPartitionObjects();\n \tfor (var i=0; i<partition_list.length;i++){\n \t\t//find the partition with the same id in the list\n \t\tif(partition_list[i].... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a sparse array of arrays, segs grouped by their dayIndex | function groupSegsByDay(segs) {
var segsByDay = []; // sparse array
var i;
var seg;
for (i = 0; i < segs.length; i += 1) {
seg = segs[i];
(segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))
.push(seg);
}
return segsByDay;
... | [
"function groupSegsByDay(segs) {\n let segsByDay = []; // sparse array\n let i;\n let seg;\n for (i = 0; i < segs.length; i += 1) {\n seg = segs[i];\n (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))\n .push(seg);\n }\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if player has lost | function hasLost(){
if (total_score > targetNumber){
loss++;
$(".loss").text(loss);
$(".reset_game").show();
$(".clickImg").off();
console.log("you lost");
return true;
}
else{
return false;
}
} | [
"function checkLoss(player) {\n if (player.stash.length === 0 && player.hand.length === 0) {\n $('.live').addClass('hidden');\n $('.stack').addClass('hidden');\n $('.winAlert').removeClass('hidden');\n $('.draw').off();\n $(window).off();\n if (player == playerOne) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a DockerCredential for one or more ECR repositories. NOTE All ECR repositories in the same account and region share a domain name (e.g., 0123456789012.dkr.ecr.euwest1.amazonaws.com), and can only have one associated set of credentials (and DockerCredential). Attempting to associate one set of credentials with o... | static ecr(repositories, opts) {
try {
jsiiDeprecationWarnings.aws_cdk_lib_pipelines_EcrDockerCredentialOptions(opts);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, this.ecr);
... | [
"async prepareEcrRepository(repositoryName) {\n var _a, _b;\n const ecr = await this.props.sdk.ecr(this.props.environment.account, this.props.environment.region, credentials_1.Mode.ForWriting);\n // check if repo already exists\n try {\n logging_1.debug(`${repositoryName}: che... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
printMovieDetail() Afficher les details du film | function printMovieDetail() {
if (movie.bkgimage != null) {
bkgImageElt.css('background-image', `url(${movie.bkgimage})`);
}
else {
bkgImageElt.css('background-image', `linear-gradient(rgb(81, 85, 115), rgb(21, 47, 123))`);
}
titleElt.text(movie.title);
modalTitle.text(movie.tit... | [
"function displayMovie(movie){\n console.log(movie.title + \" by \" + movie.director +\". Released in \" + movie.year + \". Length in Minutes: \" + movie.lengthOfFilm +\". Rating: \" + movie.rating + \".\")\n}",
"function printMovieData(movie) {\n console.log(\"\\n------------------- Movie Info --------------... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detach from the San component. | detach() {
delete this._component;
} | [
"detach() {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::detach() can only be called on the root');\n }\n if (!this[OPTIONS].attachTo) {\n throw new Error('ReactWrapper::detach() can only be called on when the `attachTo` option was passed into `mount()`.');\n }\n this[RENDE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if message compression is being skipped. | get skip_compression() {
return this._skip_compression;
} | [
"get isSkipped() { return (this.flags & 2 /* Skipped */) > 0; }",
"isSkipped() {\n return this.status === constants_1.STATUS_SKIPPED;\n }",
"getEmitSkipped() {\r\n return this._skippedFilePaths.length > 0;\r\n }",
"get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if they type something else prompt again for r p or s. once a selection is made have computer randomly generate either r p or s. | function validateChoice() {
if (userChoice !== "r" && userChoice !== "p" && userChoice !== "s") {
alert("pick a either r, p , or s")
getUserChoice();
} else {
generateComputerChoice();
compareAnswer();
}
} | [
"function randomChoice() {\n\tvar rand = Math.floor(Math.random() * 3);\n\tif (rand === 0) {\n\t\treturn playerTwoChoice ='r';\n\t} else if (rand === 1) {\n\t\treturn playerTwoChoice = 's';\n\t} else {\n\t\treturn playerTwoChoice = 'p';\n\t}\n}",
"function computer() {\n var computerChoice = ['R', 'P', 'S'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Spriteset_Map The set of sprites on the map screen. | function Spriteset_Map() {
this.initialize.apply(this, arguments);
} | [
"createSpriteset() {\r\n this._spriteset = new Sprite_Map();\r\n\r\n Haya.Map.Viewport = new PIXI.extras.Viewport({\r\n screenWidth: Graphics.width,\r\n screenHeight: Graphics.height,\r\n worldWidth: Haya.Map.current.width || Graphics.width,\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HideElement: Hides the specified element type if it is found under the calendar div. Required for IE6 (and lower) to hide Select objects Input: strElement The tag of the elements to hide (Usually "SELECT" or "APPLET") strID The ID of the elementthatis being shown above the strElement elements Example: HideElement('APPL... | function HideElement(strElement, strId)
{
if( ie )
{
if (strId == null)
strId = calid;
var e = document.getElementById(strId);
for(i = 0; i < document.all.tags(strElement).length; i++)
{
obj = document.all.tags(strElement)[i];
if(!obj || !obj.offsetParent)
{
continu... | [
"function hideElement(elementId) {\n console.debug('hiding element ' + elementId);\n if (elementId) elementId.style.display = 'none';\n}",
"function hideElementByID(elementID) {\n var realID = checkIfID(elementID);\n $(realID).hide();\n }",
"function hideElement(elementId)\n{\n var element... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets the 32 bit string dword at the address | setDword(address, dword) {
const dwordStart = address * 8;
this.checkBounds(dwordStart);
let k = this.storage.split("");
k.splice(dwordStart, 32, dword);
this.storage = k.join("");
} | [
"function caml_string_set32(s,i,i32){\n return caml_bytes_set32(s,i,i32);\n}",
"setWord (addr, value) {\n // make sure that the address is within bounds\n addr = Memory.wrap(addr, this.SIZE);\n value = Memory.wrap(value, this.WORD_SIZE);\n // publish a store event\n this.events.store.dispatch(ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getPrincipalPropertySetURI searchPrincipal searchCalendarHome Retrieves the principals location (/dav/principals, /principals/users, etc.) calendarUri : the calendar on which the request should be run opListener : The result/error handler | function getPrincipalPropertySetURI(calendarUri, opListener) {
// The selected calendar
let uri = calendarUri.clone();
// Ensure trailing slash
uri = uri.mutate().setPathQueryRef(addTrailingSlash(uri.pathQueryRef)).finalize();
if (gPropertySetUrisCache[uri.pathQueryRef]) {
opListener.onResult(gProp... | [
"function searchCalendarHome(calendarUri,home,opListener) \n{\n\n let uri = calendarUri.clone();\n uri = uri.mutate().setPathQueryRef(home).finalize(); \n let resultHandler = {};\n \n // Prepare the request \n let xmlQuery = '<D:propfind xmlns:D=\"DAV:\">\\n'+\n ' <D:prop>\\n'+\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The probability that any two uniformly sampled integers are coprime is ~60%. pick a random integer within the desired range and test its GCD with the original number and loop (resampling it) if they are not coprime. Uses a heuristic, if heuristic fails you'll get NaN. it's random, so feel free to test returned value an... | function coprime(n)
{
if (n == NaN)
return NaN;
var MAX_ATTEMPTS=500;
for(var i=0;i<MAX_ATTEMPTS;i++)
{
candidate = randInt(n-1);
if(gcd(candidate,n)== 1)
return candidate;
}
return NaN;
} | [
"function gcd(int1, int2) {\n let intMin = Math.min(int1, int2);\n let intMax = Math.max(int1, int2);\n\n for (let div = intMin; div > 0; div--) {\n // console.log(intMin, intMax, div);\n if ((intMin % div === 0) && (intMax % div === 0)) return div; // a common divisor found\n }\n}",
"function isCoprime... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Patch Azure SDK methods. | init() {
module_utils.patchModule(
'@azure/storage-blob',
'upload',
blobUploadWrapper,
Clients => Clients.BlockBlobClient.prototype
);
module_utils.patchModule(
'@azure/storage-blob',
'download',
blobDownloadWrap... | [
"resolveMethods(endpoints,parentPath){if(endpoints){const methods=new Map(Object.entries(endpoints));methods.forEach((settings,methodName)=>{const{scope,...restSettings}=this.getSettings(settings);Object.defineProperty(this,methodName,{value:this.createApiCallExecutor(restSettings,[parentPath])});Object.definePrope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove title from current active icon | removeTitle() {
this.title.classList.add(this.workingClass);
} | [
"activeRemoveIcon() {\n if (this.ptr == 0) {\n throw \"this is disposed\";\n }\n instance().exports.RunEditor_active_remove_icon(this.ptr);\n }",
"function unannotateToolbarIcon() {\n $(\".toolbar-icon-tooltip\").remove();\n}",
"function action_removeIcon(story) {\r\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Injects some common dependencies into a module returned by require(). | static prepareDependencies (module) {
if (!(module instanceof MiddlewareEngine)) { return module; }
module.requires().forEach(requirement => {
let dependency;
switch (requirement) {
case `MessageObject`: dependency = MessageObject; break;
case `sharedLogger`: dependency = sharedLogger; break;
... | [
"function wrapRequire() {\n const originalRequire = Module.prototype.require;\n Module.prototype.require = function (moduleName) {\n // Inject workspace node_modules directory\n this.paths.unshift(workspaceModulesDir);\n\n const moduleInfo = getModuleInfo(moduleName);\n\n try {\n return originalR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Event Fetching/Rendering TODO: going forward, most of this stuff should be directly handled by the view | function refetchEvents() { // can be called as an API method
fetchAndRenderEvents();
} | [
"function manageClasses_eventsInitialRender() {\n //populate subject dropdown\n manageClasses_fillSubjectDropdown();\n //load events based on subject\n manageClasses_loadSubjectEvents();\n}",
"onRender(){}",
"function refetchEvents() { // can be called as an API method\n\t\tfetchAndRenderEvents();\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks which data attributes are defined | function checkDataAttributes(el) {
$.each(customSettings, function (index, attribute) {
if (el.data(attribute) != undefined) {
settings[attribute] = el.data(attribute);
} else {
settings[attribute] = $(defaults).attr... | [
"function checkDataAttributes(obj) {\n $.each(customSettings, function (index, attribute) {\n if (obj.data(attribute) != undefined) {\n customSettingsObj[attribute] = obj.data(attribute);\n } else {\n customSettingsOb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get index of user data array for socket | function getUserIndex(currentGame, socket) {
if(currentGame && socket) {
const userIndex = currentGame.users.map(user => user.userId).indexOf(socket.id);
return userIndex;
}
else {
return -1;
}
} | [
"function getIndexOf(socketID){\n\n\tvar index;\n\tvar found = false;\n\tfor(var i = 0; i < users.length; i++){\n\t\tif(users[i].id === socketID){\n\t\t\tindex = i;\n\t\t\tfound = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn (found) ? index : -1;\n}",
"function socketIdToUserIdx(socketId, usres) {\n\tfor (var i = 0;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
$val lesson ID $idfavorite favorite ID $type="BROWSEPAGE/COURSEDETAIL/VIDEOPAGE" $object object to pass | function addFavoriteCourseToJson($val, $idfavorite, $type, $object) {
if ($type == "BROWSEPAGE") {
getUpdateData($val);
/*
* obj=learningContentData;//json var of browsebage var newobj=new
* Object(); for( var x in obj) { $tmpVal=obj[x].id; if( $tmpVal ==
* $val){ newobj.i... | [
"function PickNewVideo(iVideoInfo, iAutoPlay, iQuote, iPageObjectIds)\r\r\n{\r\r\n DebugLn(\"PickNewVideo\");\r\r\n if (isObject(iVideoInfo))\r\r\n {\r\r\n DebugLn(\"iVideoInfo.Description = \" + iVideoInfo.Description);\r\r\n DebugLn(\"iVideoInfo.Link = \" + iVideoInfo.Link);\r\r\n \r\r\n if (iVideoIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
changing isWindowFocused to true on focus event | function focusHandler(){
isWindowFocused = true;
} | [
"function onWindowFocus() {\n if (document.activeElement == elWithFocusRing) addFocusRingClass(elWithFocusRing);\n\n elWithFocusRing = null;\n }",
"function onWindowFocus() {\n if (document.activeElement == elWithFocusRing) {\n addFocusRingClass(elWithFocusRing);\n }\n }",
"setFocusedTr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Short alias for Object.getOwnPropertyDescriptor | function getPropDescriptor (o, k) {
return Object.getOwnPropertyDescriptor(o, k)
} | [
"getOwnPropertyDescriptor(target, prop) {\n return Reflect.getOwnPropertyDescriptor(target._scopes[0], prop);\n }",
"function Reflect_getOwnPropertyDescriptor(target, propertyKey) {\n // Step 1.\n if (!IsObject(target))\n ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, DecompileArg(0, target));\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes screen layer active class and status flag. | setInactive () {
this._active = false;
this.$element.removeClass('screenlayer-active');
} | [
"__removeActiveState() {\n var EventHandler = qx.ui.mobile.core.EventHandler;\n EventHandler.__cancelActiveStateTimer();\n var activeTarget = EventHandler.__activeTarget;\n if (activeTarget) {\n qx.bom.element.Class.remove(activeTarget, \"active\");\n }\n EventHandler.__activeTa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render a ReactElement to its initial HTML. This should only be used on the server. See | function renderToString(element,options){var renderer=new ReactDOMServerRenderer(element,false,options);try{var markup=renderer.read(Infinity);return markup;}finally{renderer.destroy();}} | [
"function RenderDOM(ReactElement) {\n\tconst domNode = document.createElement(\"div\")\n\tReactDOM.render(ReactElement, domNode)\n\treturn domNode.childNodes[0] // NOTE: Breaks document fragments.\n}",
"function renderToString(element) {\n var renderer = new ReactDOMServerRenderer(element, false);\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Restarts the carousel timer. | function restartCarouselTimer() {
clearInterval(carouselTimer);
carouselTimer = setInterval(autoIncrementCarouselSlide, carouselTimerDelay);
} | [
"function restartTimer() {\n\tclearInterval(CONFIG.carouselTimer);\n\tstartCarousel();\n}",
"restartTimer() {\n this.stopTimer();\n this.startTimer();\n }",
"function restart() {\n clearInterval(timerInterval);\n started = false;\n runInterval();\n }",
"function resetInterval() {\n // Clears... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find a suitable display candidate for definitions where the DI does not correctly specify one. | function findDisplayCandidate(definitions) {
return find$1(definitions.rootElements, function(e) {
return is$4(e, 'bpmn:Process') || is$4(e, 'bpmn:Collaboration');
});
} | [
"function findDisplayCandidate(definitions) {\n return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"find\"])(definitions.rootElements, function (e) {\n return is(e, 'bpmn:Process') || is(e, 'bpmn:Collaboration');\n });\n}",
"function findDisplayCandidate(definitions) {\n return Object(min_dash__WE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for switching to saved card | function savedCard() {
$('.add-card').hide();
$('.saved').show();
} | [
"function saveCardForLater() {\n terminal.readReusableCard().then(function(result) {\n if (result.error) {\n // Placeholder for handling result.error\n setStatus('error - ' + result.error.message);\n } else {\n // Placeholder for sending result.paymentMethod.id to your backend.\n setStatu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change hemisphere data format | function changeHemisphere(hemisphere) {
if (window.value.hemisphere === hemisphere) {
// Already displaying this hemisphere data
return;
}
window.value.hemisphere = hemisphere;
if (isNorthernHemisphere()) {
$("body").css('background-color', NORTHERN_HEMISPHERE_BACKGROUND_C... | [
"get hemisphere() {\n return this._hemisphere;\n }",
"function printHemisphere(property, center, scale) {\n\t//cleaning the output\n\tvar outputTEXT = $(\"#result\").empty();\n\t\n\t//Formating central meridian\n\tvar lon = Math.round(center.lng * 100.) / 100., lonStr, latStr;\n\t\n\t//Formating central... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modifies state. Sets capsLockOn state to null, simulating the situation when an HTML doc has loaded for the first time and the Caps Lock key state is indeterminate. | function reset() {
capsLockOn = null;
} | [
"function toggleCapsLockState() {\n if (typeof capsLockOn === 'boolean') capsLockOn = !capsLockOn;\n return capsLockOn;\n }",
"set capsLock(value) {}",
"toggleCap(e) {\n let caps_lock_on = e.getModifierState(\"CapsLock\");\n if (caps_lock_on === true) {\n this.setState({\n toggl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move all the cells to the bottom of the grid. Returns true if cells were moved. | function moveAllToBottom() {
var moved = false;
for (var c = 0; c < 4 ; c++ ) {
var s = 3;
for (var r = 3; r >= 0 ; r-- ) {
if (!isCellEmpty(r, c)) {
if (r != s) {
moved = true;
setGridNumRC(s, c, grid[r][c]);
setEmptyCell(r, c);
}
s--;
}
}
}
return moved;
} | [
"function checkBottomCollision() {\n var isBottomCollided = false;\n for (var i = shape.length-1; i >= 0; i--) {\n if(gameGrid[(shape[i].row) + 1][shape[i].col] === 1) {\n gameGrid[shape[i].row] = gameGrid[shape[i].row]\n isBottomCollided = true;\n return isBottomCollided;\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the state of the reset button interrupt. | resetButtonInterrupt(state) {
if (state) {
this.nmiLatch |= RESET_NMI_MASK;
}
else {
this.nmiLatch &= ~RESET_NMI_MASK;
}
this.updateNmiSeen();
} | [
"function pressReset(){\n events.emit('resetBtn', true);\n }",
"function doResetButton(e) {\n state = 'paused';\n theRunButton.innerHTML = \"Run\";\n clearInterval(timer);\n outputDiv.textContent = \"\";\n init();\n}",
"reset() {\n this.setIrqMask(0);\n this.setNmiMask(0);\n this.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns if the given httpMethod should send a csrftoken with the request. | function shouldSendCSRF(httpMethod) {
return !(['GET', 'HEAD', 'OPTIONS', 'TRACE'].includes(httpMethod))
} | [
"function csrfSafeMethod(method) {\n // these HTTP methods do not require CSRF protection\n return /^(GET|HEAD|OPTIONS|TRACE)$/.test(method)\n}",
"function csrfSafeMethod(method) {\n // these HTTP methods do not require CSRF protection\n return /^(GET|HEAD|OPTIONS|TRACE)$/.test(method);\n}",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render an [output spec]( to a DOM node. If the spec has a hole (zero) in it, `contentDOM` will point at the node with the hole. | static renderSpec(doc2, structure, xmlNS = null) {
if (typeof structure == "string")
return { dom: doc2.createTextNode(structure) };
if (structure.nodeType != null)
return { dom: structure };
if (structure.dom && structure.dom.nodeType != null)
return structure;
let tagName = structure... | [
"function screenOutput( content ) {\n\tlet container = document.querySelector( '.xml-content' );\n\tcontainer.outerHTML = content;\n}",
"function HTML2DOM(content) {\r\n\r\n var dummyDiv = document.createElement('div');\r\n dummyDiv.innerHTML = content;\r\n\r\n return dummyDiv;\r\n}",
"function render(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes window and key events (ew and ek) and assigns key events to windows. Returns the total number of keys pressed in every window. Uses a mergesortlike strategy | function computeKeyStats(ew, ek) {
var key_stats = {};
var i = 0;
var j = 0;
var ewn = ew.length;
var ekn = ek.length;
var cur_window = '';
// merge sort, basically
while(i<ewn && j<ekn) {
var popw; // pop window event?
if(i>=ewn) { popw = false; }
else if(j>=ekn) { popw = true; }
els... | [
"function computeHackingStats(ew, ek, hacking_titles) {\n\n var hacking_stats = {};\n var hacking_events = [];\n\n var i = 0;\n var j = 0;\n var ewn = ew.length;\n var ekn = ek.length;\n var cur_window = '';\n var hacking_title = false;\n var hacking_counter = 0;\n var hacking_reset_counter = 0;\n var ha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns black or white based on what color text would belong on a color, rgb (which should be run through hexToRgb before use) | function get_black_or_white(rgb) {
if ((rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114) > 186) return "black"; else return "white";
} | [
"function guess_text_color (rgb, threshold, op) {\n\tvar vals = typeof rgb !== \"string\" ? rgb : hexToRgb(rgb);\n\top = typeof op !== \"undefined\" ? op : 1;\n\t//move up and down to adjust level at which text switches to white\n\tthreshold = typeof threshold !== \"undefined\" ? threshold : 128;\n\tvar\tluminosity... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called by "detectColor"> After the clicks have been register and test, it removes the event click. | omitEventsClick(){
this.color.cyan.removeEventListener('click',this.detectColor)
this.color.violet.removeEventListener('click',this.detectColor)
this.color.orange.removeEventListener('click',this.detectColor)
this.color.green.removeEventListener('click',this.detectColor)
} | [
"removeClickDetection() {\n if (this.referenceClickDetection) {\n this.elements.input.removeEventListener(\"click\", this.referenceClickDetection);\n this.referenceClickDetection = null;\n }\n }",
"function unclickBillionaire() {\n\t\tconsole.log('adsad');\n\t\tselectedBilli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the place is already in the location array | function isLocationExisted(place, locations, callback) {
if(locations.length == 0) {
if(typeof callback === "function") {
callback(null);
}
return;
} else {
for (var i = 0; i < locations.length; i++) {
if (locations[i].place_id == place.place_id && !locati... | [
"positionIsTaken(arrPos) {\n const [x, y] = arrPos\n return Object.values(this.placedPieces)\n .some(piece => piece.x == x && piece.y == y)\n }",
"function validLocationID(locID){\n for(var i=0;i<places.length;i++){\n if(places[i].id===locID){\n return true;\n }\n }\n return false;\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FIXME: This calls the forEach function with the values Map and not with the ModelCollection as the third argument | forEach(...args) {
return this.valuesContainerMap.forEach.call(
this.valuesContainerMap,
...args
)
} | [
"forEach(callback) {\n this._values.forEach(entry => callback(this.get(entry), entry));\n }",
"function processCollection(){\n _(this.models).each(function(room){\n var modelId = room.get('id');\n if(!modelId) return;\n if(roomModelsCache[modelId]){\n return roomModelsCache[modelId].set(room.to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end of function to grab zip code start of zip code to city converter API | function zipCodeConverter() {
var zipConvertURL = "https://maps.googleapis.com/maps/api/geocode/json?address=" + zipCode +"&sensor=true"
$.ajax ({
url: zipConvertURL,
method: "GET"
}).then(function(convertedZip){
var cityName = convertedZip.results["0"].address_components[1].long_na... | [
"function zipToLocation() {\n\n var queryURL = 'https://maps.googleapis.com/maps/api/geocode/json?address=' + myZip + ',US'\n $.ajax({\n url: queryURL,\n method: \"Get\"\n }).then(function (response) {\n console.log(response)\n enteredLat = response.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate math statistic function value by using 'JavaScript Statistics Library' stored in /thirdparty/javascriptStats1.0.1.js file | function calculateMathStatistics(mathStatisticFunctionName, vector) {
if (typeof jsStats != "undefined"
&& typeof jsStats[mathStatisticFunctionName] != "undefined"
&& vector.length > 0) {
var isTimeValue = isTime(vector[0]);
vector = execFuncOnRow(vector, conver... | [
"function Statistics(){}",
"function GT_Math()\n{\n}",
"static get_statistics() {\n var url = this.root + \"get_statistics.php\";\n var result = this._makeRequest(url);\n if(result) {\n return result;\n } else {\n throw \"Error getting statistics\";\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render cloud images table. | function _renderImagesTable() {
Logger.logDebug('Rendering image table.');
$imagesTable.empty();
let sortedKeys = [];
Utils.safeKeyValueEach(imagesData, function(key, value) {
sortedKeys.push(key);
});
sortedKeys.sort();
$j.each(sortedKeys, functio... | [
"function displayImages(){\r\n var imageString = \"<tr>\";\r\n\r\n for(i = 0; i < imgArr.length; i++){\r\n imageString += \"<td><img src='\" + imgArr[i].src + \"'></td>\";\r\n\r\n if(((i+1) % 3) == 0) imageString += \"</tr><tr>\"\r\n }\r\n imageString += \"</tr>\";\r\n\r\n $(\"image_tab... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Import as asName from "importFrom"; If the import is already present, just return the identifier. If the import is not present, create the import statement and call `addStatementFn`. Does not check for collisions. | function ensureNamespaceImportPresent(currentFile, asName, importFrom, addStatementFn) {
const all = findNamespaceImports(currentFile), match = all.find(ni => ni.as === asName && ni.from === importFrom);
if (match) {
return match.as;
}
const statementToAdd = createNamespaceImport(asName, importF... | [
"function visitImportDeclaration(node) {\n if (!node.importClause) {\n // Do not elide a side-effect only import declaration.\n // import \"foo\";\n return node;\n }\n // Elide the declaration if the import clause was elided.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks the MaxLength of the Textarea | function checkTextAreaMaxLength(textBox, e) {
var maxLength = parseInt($(textBox).data('length')),
counterValue = $('.textarea-counter-value'),
charTextarea = $('.char-textarea');
if (!checkSpecialKeys(e)) {
if (textBox.value.length < maxLength - 1) textBox.value = textBox.value... | [
"function textarea_max(Object, MaxLen) {return (Object.value.length <= MaxLen);}",
"function checkTextAreaValLength(textAreaValue, limit)\n{\t\n\treturn textAreaValue.length < limit;\n}",
"function checkTextAreaMaxLength(textBox, e) {\n var maxLength = parseInt($(textBox).data('length')),\n counterV... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the bind needs to be a Model 'IS' in it, like 'GENERAL|message IS vmodel') or 'GENERAL|message IS model') | parseModel(storeLocationObject) {
const bind = storeLocationObject.bind;
if (bind.includes("IS")) {
const argumentArray = bind.split("IS");
const cleanArgumentArray = argumentArray.map(item =>
item.replace(/\s/g, "")
);
storeLocationObject.bind = cleanArgumentArray[0];
// Q... | [
"modelIsSelected(model) {\n if (this.state.models && model) {\n const newModelStr = modelToStr(model);\n return this.state.models.includes(newModelStr);\n }\n return false;\n }",
"function _isBinder(content) {\n return content.indexOf('{') > -1 && content.lastIndexOf('}') > -1;\n }",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the user IP address that corresponded with the post. | getIpAddress() {
const userIp = this.event.headers["X-Forwarded-For"] || ``;
return userIp;
} | [
"getUserIP() {\n return this._httpMessage.headers['x-real-ip'] || this._httpMessage.remoteAddress || null;\n }",
"function getUserIPAddress(req) {\n var ip = req.headers['x-forwarded-for'] ||\n req.connection.remoteAddress ||\n req.socket.remoteAddress ||\n req.connection.socket.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unsafely promote a string to a TrustedScript, falling back to strings when Trusted Types are not available. | function trustedScriptFromString(script) {
var _a;
return ((_a = getPolicy()) === null || _a === void 0 ? void 0 : _a.createScript(script)) || script;
} | [
"function trustedScriptFromString(script) {\n var _a;\n\n return ((_a = getPolicy()) === null || _a === void 0 ? void 0 : _a.createScript(script)) || script;\n }",
"function trustedScriptFromString(script) {\n var _a;\n return ((_a = getPolicy()) === null || _a === void 0 ? void 0 : _a.createSc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adding style to a box based on the given parapeters and index | function addStyle(box, p, i) {
// add hover animation to the box
if (hoverCheckbox.checked)
box.classList.toggle("hover");
// add random periodic scaling to the box
if (scaleCheckbox.checked) {
let scale = ((Math.random() + 1.5) * 0.5 * Math.abs(Math.sin(i * p.step + p.offset)));
... | [
"function updateBox (rgba, i) {\n BDO.terms[i].boxElement.style.backgroundColor = rgba;\n //document.getElementById(boxId).style.backgroundColor = rgba;\n}",
"static styleElement(element, index){\n element.style.padding = \"15px\";\n element.style.width = \"100%\";\n element.style.borderRad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HELPER: h_updateFuckCounter function:player did a mistake fuckcounter++ if too high sanction player | function h_updateFuckCounter()
{
fuckCounter=fuckCounter+1;
switch(fuckCounter)
{
case 5:
var n = noty({text: '<p><i class="fa fa-tachometer"></i> Fuck Counter</p>Dude ... your fuck counter is on 5 - next time it will cost you heavily'});
break;
case 6:
var n = noty({text: '<p><i class="fa fa-tachomet... | [
"function guessCount () {\n\t\tcount++;\n\t}",
"function incrementTries() {\n player.tries++;\n}",
"function counterAttack() {\n rpgGame.gameCharacters[rpgGame.currentCharacter].hp -= rpgGame.gameCharacters[rpgGame.currentOpponent].counter;\n }",
"function gameCountIncrement() {\n gameCount++;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
middleware for checking description | function bodyHasDescription (req, res, next) {
const { data : {description} = {}} = req.body;
if(description && description != ""){
return next();
}
next({
status: 400,
message: "Dish must include a description",
});
} | [
"function dishDescCheck(req, res, next) {\n const { data: { description } = {} } = req.body;\n if (description) {\n return next();\n }\n next({\n status: 400,\n message: \"Dish must include a description\"\n })\n}",
"function descriptionPropertyExists(req, res, next) {\n const... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an empty array with the necessary dimensions. | _returnEmptyArray() {
const that = this,
emptyArray = [];
let current = emptyArray;
if (that.dimensions > 1) {
for (let i = 1; i < that.dimensions; i++) {
current[0] = [];
current = current[0];
}
}
return empty... | [
"function createEmptyArray() {\n}",
"function createBlankData(){\n\tvar result = [];\n\n\tfor (var i=0; i<DIMENSION; i++){\n\t\tresult[i] = [];\n\t\tfor (var j=0; j<DIMENSION; j++){\n\t\t\tresult[i][j] = null;\n\t\t}\n\t}\n\treturn result;\n}",
"static GetEmptyMatrix(dimensions) {\n const output = [];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assuming that h is red and both h.left and h.left.left are black, make h.left or one of its children red. | function moveRedLeft(h) {
// assert (h != null);
// assert isRed(h) && !isRed(h.left) && !isRed(h.left.left);
flipColors(h);
if (isRed(h.right.left)) {
h.right = rotateRight(h.right);
h = rotateLeft(h);
flipColors(h);
}
return h;
... | [
"function flipColors(h) {\n // h must have opposite color of its two children\n // assert (h != null) && (h.left != null) && (h.right != null);\n // assert (!isRed(h) && isRed(h.left) && isRed(h.right))\n // || (isRed(h) && !isRed(h.left) && !isRed(h.right));\n h.color = (h.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Equip an item to a slot. | function EquipItem(i:Item,slot:int)
{
if(i.itemType == ArmorSlotName[slot]) //If the item can be equipped there:
{
if(CheckSlot(slot)) //If theres an item equipped to that slot we unequip it first:
{
UnequipItem(ArmorSlot[slot]);
ArmorSlot[slot]=null;
}
ArmorSlot[slot]=i; //When we find the slot we set ... | [
"function equipItem(itemId, slot) {\n print(\"Requesting \" + itemId + \" to be equipped on slot \" + slot);\n\n var item = Maps.findMobileById(itemId);\n\n if (!item)\n return;\n\n dialogCritter.equip(item, slot);\n }",
"equip() {\n\t\tlet temporarySlot = this.equipped;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests if this element or a parent element has role="presentation". Dynamic values yields `false` just as if the attribute wasn't present. | function isPresentation(node) {
if (node.cacheExists(ROLE_PRESENTATION_CACHE)) {
return Boolean(node.cacheGet(ROLE_PRESENTATION_CACHE));
}
let cur = node;
do {
const role = cur.getAttribute("role");
/* role="presentation" */
if (role && role.value === "presentation") {
... | [
"[ignoreRole](role) {\n if (!role || !['none', 'presentation'].includes(role)) {\n return false;\n }\n if (this.node[focusable]) {\n return true;\n }\n return this[hasGlobalAttribute]();\n }",
"function isElementDecorative(element, elementData){\n\t\tif($(element).attr(\"aria-hidden\") =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test if any complete rules has been defined for current command or its subcommands. | hasCompletionRules() {
function isEmptyRule({
options,
args
}) {
return Object.keys(options).length === 0 && Object.keys(args).length === 0;
}
return !(isEmptyRule(this._completionRules) && this.commands.every(({
_completionRules
}) => isEmptyRule(_completionRules)));
} | [
"function _checkRules() {\n\tvar autorules = rules.getRules();\n\tlogger.debug('_checkRules');\n\n\tfor (var i in autorules) {\n\t\tvar rule = autorules[i];\n\t\tlogger.info('Check Rule: ' + rule.description);\n\t\tif (!rule.isActive()) {\n\t\t\tlogger.info('rule is not active');\n\t\t\tcontinue;\n\t\t}\n\t\tif (!r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start a named worker named workers are unique Use "" or 'undefined' for a nameless worker. | function spawn_named(name, url, base, args) {
// Return the existing worker_id if already running.
if (name && named_worker_ids[name]) {
return named_worker_ids[name];
}
base = base || config.base_worker_src;
if(!base) {
throw("Can't spawn worker, no data-base-worker-src attribute se... | [
"function createWorker()\n {\n var childWorkerId = workerPool.createWorkerFromUrl('js/'+WORKER_FILENAME);\n workerPool.sendMessage([\"3..2..\", 1, {helloWorld: \"Hello world!\"}], childWorkerId);\n }",
"function startWorker(param) {\n\n console.log(param);\n scheduler.push(param);\n document.getE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reads and writes to the provided characteristic 1000 times | function readWrite(characteristic, peripheral, i=10) {
if (i > 0) {
characteristic.write(data, true);
characteristic.read((error, resp) => {
if (error) {
console.warn('error: ' + error);
return;
}
readWrite(characteristic, peripheral, i - 1);
});
} else {
con... | [
"async doCharacteristicWrite(op) {\n try {\n const char = new Characteristic(op.characteristicUUID, op.serviceUUID);\n char.value = op.characteristicValue;\n await this.bluetoothAdapter.writeCharacteristicValue(op.deviceAddress, char);\n this.mqttFacade.reportChara... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes existing files and symlinks them if they exist. Symlinks folders: www, merges, hooks Symlinks file: config.xml (but only if it exists outside of the www folder) If config.xml exists inside of template/www, COPY (not link) it to project | function linkFromTemplate (templateDir, projectDir) {
var linkSrc, linkDst, linkFolders, copySrc, copyDst;
function rmlinkSync (src, dst, type) {
if (src && dst) {
fs.removeSync(dst);
if (fs.existsSync(src)) {
fs.symlinkSync(src, dst, type);
}
... | [
"async function removeTemplateSymlinks() {\n const templatePath = (relativePath) =>\n path.join(templateFolder, relativePath);\n\n // Directories cannot be \"unlinked\" so they must be removed\n await fs.promises.rm(templatePath(\"node_modules\"), {\n force: true,\n recursive: true,\n });\n}",
"async... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the linkType used for storing the desired page type across throughout site navigation | setLinkType(x) {
this.data.linkType = x
this.save_session_data()
} | [
"function LinkTypeHelper() {\n}",
"function changeLinkType() {\n var link = Graph.selectedLink;\n if(!isLinkTypeCompatible(link.source, link.target, $(this).val())) {\n alert(\"Impossible to apply this link type between these nodes.\");\n $(this).val(link.type);\n return;\n }\n li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Data structure that stores rules, health checks, and other state about a service | function ServiceMonitor(service_id) {
this.service_id = service_id;
this.rules = [];
this.healthChecks = {};
this.serviceState = new ServiceState();
this.serviceStateHistory = new ServiceState();
this.heartbeatTimers = {};
} | [
"function update() {\n\n // TODO - these methods should return promises, but they\n // don't so use our own promises\n var servicesDeferred = $q.defer();\n var healthCheckDeferred = $q.defer();\n\n servicesService.update_services(function(top, mapped){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a curve sk represented as a hex string when given an sk | function convertSkToCurve (sk) {
const skBuf = _ensureBuffer(sk)
const curveSkBuf = Buffer.allocUnsafe(sodium.crypto_box_SECRETKEYBYTES)
try {
sodium.crypto_sign_ed25519_sk_to_curve25519(curveSkBuf, skBuf)
} catch (e) {
throw new Error('Could not convert given secret key to curve secret key.')
}
ret... | [
"function dec2hex(s) { return (s < 15.5 ? '0' : '') + Math.round(s).toString(16); }",
"static serializedPoint(curve, p) {\n switch (curve) {\n case Slip10Curve.Secp256k1:\n return encoding_1.fromHex(secp256k1.g.mul(p).encodeCompressed(\"hex\"));\n default:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run a TRS80 program. The exact behavior depends on the type of program. | runTrs80File(trs80File) {
if (trs80File instanceof trs80_base_1.CmdProgram) {
this.runCmdProgram(trs80File);
}
else if (trs80File instanceof trs80_base_1.Cassette) {
if (trs80File.files.length === 1) {
this.runTrs80File(trs80File.files[0].file);
... | [
"runTrs80File(trs80File) {\n this.ejectAllFloppyDisks();\n switch (trs80File.className) {\n case \"CmdProgram\":\n this.runCmdProgram(trs80File);\n break;\n case \"Cassette\":\n if (trs80File.files.length === 1) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enables search button if there is something in the search bar. | function enableSearch() {
if (id("search-term").value.trim() !== "") {
id("search-btn").disabled = false;
id("search-btn").addEventListener("click", searchPosts);
}
} | [
"function UpdateSearchButton(){\n\tif (QueryField != null && QueryField != undefined){\n\t\tSearchButton.disabled = QueryField.value.length <= 0 && !RequestInProgress;\n\t}\n}",
"function searching() {\n $('#CDSSearchButton').prop( \"disabled\", true );\n $('#CDSSearchBox').prop( \"disabled\", true ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
count digits of a number | function digits(num) {
var ctr = 0;
while (num) {
ctr += 1;
num = Math.floor(num / 10);
}
return ctr;
} | [
"function countDigit(number){\n return number.toString().length;\n}",
"function countDigit(num) {\n\treturn num.toString().length;\n}",
"function digits_count(n){\n var count = n.toString().length;\n return count;\n}",
"function countDigits(num) {\n return num.toString().length;\n}",
"function digits_co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loop through all tracked earthquakes and update the alpha and age values. Remove quakes that are considered too old | function updateEarthquakeData() {
for (let i = 0; i < quakes.length ; i ++) {
let quake = quakes[i];
quake.alpha -= QUAKE_DECAY_RATE;
quake.age ++;
if (quake.age > QUAKE_DURATION) {
quakes.splice(i, 1);
i --;
}
}
} | [
"function drawEarthquakes(earthquakes) {\n generalEqInfo.minimumMagnitude = earthquakes[0].magnitude.magnitude;\n generalEqInfo.maxMagnitude = earthquakes[earthquakes.length - 1].magnitude.magnitude;\n var difference = earthquakes.length - points.length;\n var count;\n var isEnough;\n\n //more poi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show the filebox show the filebox show the filebox /echo the item echo the item echo the item echo the item echo the item /echo the item:Function | function show_item_filebox(){
/*start start start start start*/
// xmlhttp=$.ajax({
// //set the request url
// url:PROJECTDIR+"filebox/picture/show_public.php?action=filebox_show",
// //set the request way
// type:'GET',
// //set return data type
// dataType:'html', ... | [
"function show_item_filebox(){\n\t \t /*start start start start start*/\t\t\t\t\t\t\t\t\t\t\t \t \n\t\t xmlhttp=$.ajax({\n\t\t \t//set the request url\n\t\t \turl:PROJECTDIR+\"filebox/picture/show_source.php?action=filebox_show\",\n\t\t \t//set the request way\n\t\t \ttype:'GET',\n\t\t \t//set return data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add words to wordsection | function addWords() {
// clear existing word-section
var wordSection = $("#word-section")[0];
wordSection.innerHTML = "";
for (var i = 350; i > 0; i--) {
var words = shuffle(wordList);
var wordSpan = "<span>" + words[i] + "</span>";
wordSection.innerHTML += wordSpan;
}
/... | [
"function addWords() {\r\n // Clear existing word-section\r\n const wordSection = $$(\"#word-section\")[0];\r\n wordSection.innerHTML = \"\";\r\n $$(\"#typebox\")[0].value = \"\";\r\n\r\n for (let index = 0; index < wordList.length; index++) {\r\n const wordSpan = `<span>${wordList[index]}</span>`;\r\n w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all of the latest department data.. | function getCurrentDepartments(){
connection.query(`SELECT * FROM department_table`, (err, res) => {
// If error log error
if (err) throw err;
// Set the current departments array equal to an array of department objects returned in the response
... | [
"function fetchDepartmentData() {\n \treturn DS.find('department', '')\n }",
"function departmentList() {\n return new Promise(function(resolve, reject) {\n connection.query(`SELECT * FROM department`, function(error, data) {\n if (error) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Down Vote Comment Operation Works by just adding the user id to the Down votes list i.e number of Down votes is just a count of the number of users in the Down votes array | function dvComment(req, res) {
//input from client
var input = req.params;
var body = req.body;
//models responsible
var Comment = DB.model('Comment');
var Product = DB.model('Product');
var User = DB.model('User');
//queries
var userQuery = {userId:input.userId};
var commentQu... | [
"async function addUserToDownVoteList(votes, voterId, postId){\n // Get DownVotes List\n let downVotesList = votes[0].downVotes;\n // Adding the voting user id to the list\n downVotesList.push(voterId);\n\n winston.log(`User ${voterId} downvoted Post ${postId}`);\n return votes;\n}",
"downvote(u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Example Params owner = "1aba488300a9d7297a315d127837be4219107c62c61966ecdf7a75431d75cc61"; value = '6' type = '0' viewKey = "1aba488300a9d7297a315d127837be4219107c62c61966ecdf7a75431d75cc61"; salt = "c517f646255d5492089b881965cbd3da"; isSmart = '0'; Return = [noteHash[2], noteValue, noteType, splittedNoteOwner[2], spli... | function getNoteParams(owner, amount, type, viewKey, salt, isSmart) {
const paddedO = _toPadedObject(owner, amount, type, viewKey, salt, isSmart);
const { noteOwner } = paddedO;
const { splittedNoteOwner } = paddedO;
const { noteValue } = paddedO;
const { noteType } = paddedO;
const { noteViewKey } = padded... | [
"function inflateNote(version, mgr, note, sub) {\n return {\n \"note\": TBUtils.htmlDecode(note.n),\n \"time\": inflateTime(version, note.t),\n \"mod\": mgr.get(\"users\", note.m),\n \"link\": self._unsquashPermalink(sub, note.l),\n \"type\": mgr.get(\"w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |