query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Start the count down. Every N ticks save the spent time to the server And update the timeSpent, taskTimeSpent variables to reflect the changes | startTimerInterval() {
const intervalConfig = 250;
const checkPointConfig = intervalConfig * 4 * 10;
this.set('isCountingDown', true);
var lastTick = Date.now();
let intervalId = setInterval(function() {
// This can get really fun if the user starts moving th... | [
"function run() {\n timeRemaining = setInterval(countDown, 1000);\n }",
"async function countDown()\n{\n var timeTotal = TIME_LIMIT;\n // send timer do all client\n do {\n io.sockets.emit('broadcast', timeTotal);\n timeTotal--;\n // sleep 1 second\n await sleep(1);\n } ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal: Strip internal query params from parsed URL. Returns sanitized url.href String. | function stripInternalParams(url) {
url.search = url.search.replace(/([?&])(_pjax|_)=[^&]*/g, '')
return url.href.replace(/\?($|#)/, '$1')
} | [
"function stripInternalParams(url) {\n url.search = url.search.replace(/([?&])(_pjax|_)=[^&]*/g, '').replace(/^&/, '')\n return url.href.replace(/\\?($|#)/, '$1')\n}",
"function stripInternalParams(url) {\n url.search = url.search.replace(/([?&])(_pjax|_)=[^&]*/g, '').replace(/^&/, '');\n return url.href.repl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
attacks an other if they are next to the given bot | function attack(bot) {
for (var i = 0; i < others.length; i++) {
if (nextTo(bot.x, bot.y, others[i].x, others[i].y)) {
bot.attack(others[i]);
console.log(bot + " has attacked " + others[i]);
return true;
}
}
return false;
} | [
"function attackEnemy() {\n\tvar enemy = hero.findNearestEnemy();\n\tif (enemy) {\n\t\thero.attack(enemy);\n\t}\n}",
"function AttackNextPlayer() {\n Orion.Ignore(self);\n var target = Orion.FindType(\"-1\", \"-1\", \"ground\", \"human|near|live|ignorefriends\", 18, \"gray|criminal|orange|red\");\n if (t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var res = stylesheet.run(css) console.log(res) var flattenedcssast = transpileSassAst(res.result) console.log(flattenedcssast) console.log(csstree2string(flattenedcssast)) | function transpileSassAst(ast) {
return ast.flatMap(rs => flatten(rs));
} | [
"function ssrCodegenTransform(ast, options) {\n\t const context = createSSRTransformContext(ast, options);\n\t // inject SFC <style> CSS variables\n\t // we do this instead of inlining the expression to ensure the vars are\n\t // only resolved once per render\n\t if (options.ssrCssVars) {\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
process a material chunk from .bwo file, return one material/group | function get_matgroup(uc) {
var om = {};
var cn;
var ct;
var chi;
om.color = {"x":1,"y":1,"z":1,"w":1};
while(chi = uc.getchunkheader()) {
if (chi.ct==uc.chunktypeenum.KID_ENDCHUNK) {
break;
} else if (chi.numele && chi.ct==uc.chunktypeenum.KID_I8) {
switch(chi.cn) {
case uc.chunknameenum.UID_NAME:
... | [
"function readBVFile(text, groupInfo) {\r\n var input, cur, patches, kind, name, order, orderU, orderV, cp, groupNames;\r\n input = text.split(/\\s+/);\r\n cur = 0;\r\n\r\n\r\n function readCP(n, rational) {\r\n\t\tvar i, j, l, b;\r\n\t\tl = rational ? 4 : 3;\r\n\t\tb = new Float32Array(n * 4);\r\n\t\tf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The iterator for a FilteredMenu Once you understand the iterable and iterator protocols: this is as simple as can be. We just keep track of the index and increment it upon each call to .next() until we run out of items. | function FilteredMenuIterator(filteredMenu) {
this.index = 0;
this.next = function () {
const item = filteredMenu.index(this.index);
if (typeof item === "undefined") {
return {done: true};
} else {
this.index++;
return {done: false, value: item};
... | [
"iterator() {\n\t\treturn new Iterator(this.list);\n\t}",
"function listIterator(iterator, max) {\n // get the first iteration\n var result = it.next();\n\n // iterate the max number of times\n var i = 0;\n while (i < max && !result.done) {\n // render this one, assume it is synchronous\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= Description Replaces the contents of the view's DOM element with custom html. = Parameters +_html+:: The HTML (stringformatted) to replace the content with. = Returns +self+ | setHTML(_html) {
ELEM.setHTML(this.elemId, _html);
return this;
} | [
"setHTML(html) {\n this.html = html;\n document.body.innerHTML = this.html;\n }",
"setHtml(html = \"\"){\n\t \tif(html.length < 1) \n\t \t\treturn false;\n\t \tfor(let i=0; i<this.items.length; i++){\n\t \t\tthis.items[i].innerHTML = text;\n\t \t}\n\t \treturn this;\n\t }",
"setInnerHTML(html) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function limit selectbox users | function selectlimit(){
var a = window.location.pathname;
var locat = a.split('/');
var limit = $('#activelimit').val();
if(locat[2] == "users.php" ){
$('body').on('click', 'div .bootstrap-switch', function(){
setTimeout(function(){
var checked = parseInt($('td input:checkbox:not(":checked")').length);
... | [
"function setlimit() {\n limit = $(this).attr('value');\n }",
"function draugiemSelectFriends(limit, callback) {\n\tdraugiemLoadUrl({'action': 'selectusers', 'limit': limit}, callback);\n}",
"function selectionLimit(limit, id) {\n const el = document.getElementById(id);\n if (el) {\n el.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Protected properties Set accessor for the base endpoint | set baseEndpoint(baseEndpoint) {
this._baseEndpoint = baseEndpoint;
if (this._baseEndpoint.startsWith('/') === false) {
this._baseEndpoint = '/' + this._baseEndpoint;
}
if (this._baseEndpoint.endsWith('/') === false) {
this._baseEndpoint = this._baseEndpoint + '/'... | [
"get baseEndpoint() {\n return this._baseEndpoint;\n }",
"setEndpoint() {\n this.endpoint = this.getEndpoint();\n }",
"get endpoint () {\n\t\treturn this._endpoint;\n\t}",
"function getSetMethod(){\n const baseObject = (function(){\n let _prop1 = 1987;\n return{\n pro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_.size tra ve chieu dai cua mang _.first tra ve mang con | function first(){
var numbers=[1,2,3,4,5];
var first=_.first(numbers,3);
console.log(first);
} | [
"first(){ return this.bones[0].idx; }",
"get firstItem() {\n if (this._totalItems === 0) {\n return -1;\n }\n if (this.size === 0) {\n return 0;\n }\n return (this.current - 1) * this.size;\n }",
"function takeFirst(collection){\n if(!(collection.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns true if pacman is hit by a ghost | hitPacman(ghostPos){//takes in p5.Vector
return (dist(ghostPos.x, ghostPos.y, this.pos.x, this.pos.y)<10);//change to <25 for 1080p
} | [
"function isPacmanCollideWithGhost(gh) {\n return (pacman.y == gh.y && pacman.x == gh.x);\n}",
"function contact(pacManX, pacManY, ghostX, ghostY, ghostSize, pacManRadius){\n if((pacManX + pacManRadius > ghostX && pacManX < ghostX + ghostSize) &&(pacManY + pacManRadius > ghostY && pacManY < ghostY + gho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check wether to display or not left arrow | function displayLeftArrow() {
if(page == 0) {
document.getElementById('leftArrow').setAttribute('style', 'opacity: 0; cursor: default; pointer-events: none;');
} else {
document.getElementById('leftArrow').setAttribute('style', 'opacity: 1; cursor: pointer; pointer-events: auto;');
}
} | [
"function check_arrows() {\n // if it's up is the pipeline_root the up arrow should be hidden.\n if ( this.node.up.id == 'pipeline_root' ) {\n getObject(this.id + '_arrow_up').style.display = 'none';\n getObject(this.id + '_arrow_up_disabled').style.display = 'inline';\n } else {\n get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the position of the element as a [ x, y ] tuple | getPosition(_id) {
const _elem = this._elements[_id];
let [x, y] = [0, 0];
if (this._isSVGElem(_elem)) {
const _rect = _elem.getBoundingClientRect();
[x, y] = [_rect.left, _rect.top];
}
else if (_elem) {
[x, y] = [_elem.offsetLeft, _elem.offsetTop];
}
else {
console.w... | [
"function getElementPosition(elt)\n{\n var x = 0;\n var y = 0;\n var currentElt = elt;\n while(currentElt)\n {\n x += currentElt.offsetLeft;\n y += currentElt.offsetTop;\n currentElt = currentElt.offsetParent;\n }\n return [x, y]; \n}",
"function getPos(svg, elem) {\n var matrix, position;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read the selected SVG image and store the radius, x and y coordinates into an array | function readSVG() {
$.ajax({
type: "GET",
url: "img/prize-"+allReady+".svg",
dataType: "xml",
success: function(xml) {
var i = 0;
offsetSVG = (canvasWidth/2) - (parseInt($(xml).find('svg').attr('width'), 10) / 2);
$(xml).find(... | [
"function getSVGInfo() {\n var fileNode = document.getElementById('file');\n if (!fileNode) {\n return null;\n }\n \n var url;\n if (hasAnnotation()) {\n url = fileNode.childNodes[0].childNodes[0].childNodes[0].href;\n } else {\n url = fileNode.childNodes[0].href;\n }\n var imgNode = fileNode.getE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create 'Rest day' element | function add_rest(day){
var workouts = $('#wo_list');
var html = `<!-- restday --!>
<li class="to_sort"><div><table class="table is-fullwidth">
<thead style="text-align:center">
<th class="wo_day_disp">${day}</th>
<th> Rest </th>
<th>
<span class="js-remove" st... | [
"rest(day){\n\t\tstopAnimate(tID);\n\t\t//First check for food, could be starving.\n\t\tthis.setFood();\n\t\t//Get a random rest value and the current food consumption rate\n\t\tvar rest_val = 1 + Math.floor(Math.random() * 4);\n\t\tvar ration_val = this.mapRationToHealth();\n\t\t//For each member of the caravan, a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates overview help for a multicommand cli | function multiCommandCliHelp(args) {
let { config } = args;
let { commands } = config;
let defaultCommand = commands["index"];
let options = {
...(defaultCommand && defaultCommand.meta.options),
help: helpFlag,
version: versionFlag,
};
function createSubCommandsHelp() {
return Object.keys(co... | [
"_showHelp() {\n const sections = [\n {\n header: 'HMR_ReduxMapper',\n content: 'This is a module which generates a [italic]{global} and [italic]{component specific} mapping file ' +\n 'which should eliminate the need to manually list all reducers needed to render a given route when u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the newProblem Dialog box. | function initializeNewProblemDialog() {
/** tab initialisation * */
jQuery(".tabContent").hide();
jQuery("ul.tabNavigation li:first").addClass("selected").show();
jQuery(".tabContent:first").show();
jQuery('ul.tabNavigation li').click(function() {
jQuery("ul.tabNavigation li").removeClass("selected");
j... | [
"function initProblem()\n\t{\n\t\tif (reloading)\n\t\t{\n\t\t\tapp.loadingBox(app.style.probCreateText, app.style.probCreateBg, app.style.probCreateTime);\n\t\t\treloading = false;\n\t\t}\n\t\telse\n\t\t\tapp.loadingBox();\n\n\t\tpromise = view.assignmentManager();\n\t\tprobId = view.getProbId();\n\t}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public function `includes`. Returns true if `data` contains `value`, false otherwise. | function includes (data, value) {
var iterator, iteration, keys, length, i;
if (! assigned(data)) {
return false;
}
if (haveSymbols && data[Symbol.iterator] && isFunction(data.values)) {
iterator = data.values();
do {
iteration = iterator.next();
if (iteration.value... | [
"function includes (data, value) {\n var iterator, iteration;\n\n if (not.assigned(data)) {\n return false;\n }\n\n try {\n if (typeof Symbol !== 'undefined' && data[Symbol.iterator] && isFunction(data.values)) {\n iterator = data.values();\n\n do {\n iteration = iterato... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that loops through the horoscopes and compares them to the previous highest ranked horoscopes on firebase and saves their similarities also saves the mood type and moodscore of the horoscopes | findingSimilarty(){
this.resultsWithSim.length = 0;
this.highestPrevious = "";
//saving the highest previously ranked horoscope
//have to add only comparing it to the highest scored horoscope to avoid calling the API to many times
for(let p of this.previo... | [
"function setTopTrophy(user, userTrophies) {\n var topTrophy = \"None\";\n var topCost = 0;\n trophiesRef.once('value', function(trophies) {\n userTrophies.forEach(function(trophy) {\n var cost = trophies.child(trophy.key() + '/cost').val();\n if (cost !== null && cost > topCos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates the "Feed me" button changes the text in the popover depending on the current price and hunger | function DONEbuttonUpdate(){
// goalPrice = parseInt(goalPrice);
// totalPrice = parseInt(totalPrice);
$('#elem').popover('hide')
//console.log("hunger: " + totalHunger + ", goal: " + goalPrice +", Total$: " + totalPrice);
if(totalHunger < 60){
$(".btn").attr("data-original-title", "I'm s... | [
"_updatePrices(){\n document.getElementById('final-price').textContent = TipHandler.final_price;\n document.getElementById('tip-price').textContent = TipHandler.tip_price;\n }",
"function showPullQuote(){\n\t\t$pullQuoteDisplay.text( pullQuote );\n\t}",
"updateButtons(){\n // Checks if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load words from a CSV file into an array using an extract function and optional filter function. | function loadWordList(fileName, list, extractFunc, filterFunc) {
var parser, value;
parser = csv({ trim: true }, function(err, data) {
//console.log("Words record: " + JSON.stringify(data));
data.forEach(function(record) {
if (!filterFunc || filterFunc(record)) {
value = extractFunc(record);
... | [
"function read_csv_data(options, fullData) {\n d3.csv(options.path, function (error, data) {\n data.forEach(function (d) {\n var obj = {'word': d.word,\n 'count': d.count};\n fullData.push(obj);\n });\n \n if (options.wordSort) {\n f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO The Synergism cost formula seems more complicated than this | cost(x) {
return Decimal.pow(4, x).mul(500)
} | [
"function calcCost() {\r\n\t\t\t\tvar TSA = calcTSA();\r\n\t\t\t\tvar Time = calcTime();\r\n\t\t\t\tvar glue = calcGlue();\r\n\t\t\t\treturn ((TSA*Time*Glue)*1.1)\r\n\t\t\t}",
"function getCost(a, b) {\n const delta = Math.abs(a - b);\n if (part === 1) return delta; // PART... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Indexes 1d array like 2d array. | function index2dArray(x, y, w, h) {
return x + y * w;
} | [
"function indexesOnly (array) {\n // TODO: your code here \n}",
"idx(element, array) {\n return array.indexOf(element);\n }",
"function indexMap (arr) {\n\n var indexArr = [];\n\n for(var i = 0; i < arr.length; i++) {\n indexArr.push(arr[i] * arr.indexOf(arr[i]))\n }\n\n return indexArr;\n\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getCurrentPosition() return the current position as an object with x, y, and orientation getCurrentPosition(); | function getCurrentPosition() {
return $._getCurrentPosition();
} | [
"function getPosition() {\n navigator.geolocation.getCurrentPosition(getCoordinates);\n}",
"get position() {\n\t\t\treturn {x: this.x, y: this.y};\n\t\t}",
"getPosition() {\n return {\n x: this.cordinateX,\n y: this.cordinateY,\n direction: this.direction,\n };\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Look for linux executables in 2 ways 1. Look into the directories where .desktop are saved on gnome based distro's 2. Look for googlechromestable & googlechrome executables by using the which command | function linux() {
let installations = [];
// 2. Look into the directories where .desktop are saved on gnome based distro's
const desktopInstallationFolders = [
path.join(require('os').homedir(), '.local/share/applications/'),
'/usr/share/applications/',
];
desktopInstallationFolders.forEach(folder =... | [
"function linux() {\n let installations = [];\n // 1. Look into CHROME_PATH env variable\n const customChromePath = resolveChromePath();\n if (customChromePath) {\n installations.push(customChromePath);\n }\n // 2. Look into the directories where .desktop are saved on gnome based distro's\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
key paths to uploaded data items to migrate these items will have a url, and maybe a resize url () => [ ['data', contentType, itemKey, controlKey, gridIndex, gridControl, galleryIndex], ['data', contentType, itemKey, controlKey, gridIndex, gridControl], ['data', contentType, itemKey, controlKey, galleryIndex], ['data',... | function dataItems () {
return Object.keys(valueForKeypath(backup, [ 'data' ]))
.map(function (contentType) {
if (valueForKeypath(backup, [ 'contentType', contentType, 'oneOff' ])) {
return Object.keys(valueForKeypath(backup, [ 'data', contentType ]))
.map(function (controlKey) {... | [
"processUploadImages(uploadData){\n mediaItems = []\n for (i = 0; i < uploadData.length; i ++){\n mediaItems.push({\n \"description\": uploadData[i].description,\n \"simpleMediaItem\": {\n \"uploadToken\": uploadData[i].uploadToken\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sendMessage function: parameters: Away team, Home team, and Game time. tells the bot to send a message | function sendMessage(away, home, time) {
var options = {
url: 'https://api.groupme.com/v3/bots/post',
method: 'POST',
form: { 'bot_id':'123456789abcdevghijklmnop', // !IMPORTANT! enter your GroupMe Bot ID here!
'text':away +
' @ ' +
home +
' ' +
time +
' ' +
emoji... | [
"function action_bot_join(bot, robot, data, team_name)\n{\n\tbot.postMessage(data.channel, \"Hi, I'm MSABot. I can assist you to look out the service you're developing and maintaining. \\n Use @MSABot help to figure out how to use me! \\nRemember to setting server urls before using me!\");\n}",
"function sendToOp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set up temp user when user arrives to page | function setTemp() {
if (localStorage.getItem("userId") === null) {
// Create temp user
var tempUser = {
name: "temp",
password: ""
};
localUser.name = tempUser.name;
console.log(tempUser);
// User post
API.createUser(tempUser);
} else ... | [
"function assignTempUser() {\n //Replace with local user id\n new Fingerprint2().get(function(result) {\n console.log(result);\n $rootScope.tempuser = result;\n updateData($rootScope.tempuser);\n });\n }",
"fillLoggedUserData() {\n this.loggedUser = this.res.locals[co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shift out the process | function shift() {
// check if we can run an other process
if(
tasks.length > 0 &&
active < concurrency &&
true === next()
) {
// Retrieve the process
var process = tasks.shift();
// Execute the task
if('fu... | [
"function shift() {\n // check if we can run an other process\n if( \n tasks.length > 0 &&\n active < concurrency &&\n true === next()\n ) {\n // Retrieve the process\n var process = tasks.shift();\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shifts event times by specified value | function shiftEventTimes() {
var times = $(".fc-event-time");
for (var t = 0; t < times.size(); t++) {
var oldTimes = $(times[t]).parent().html();
var newTimes = oldTimes;
if (newTimes) {
for (var i = 1; i < 13; i++) {
var up = i+shift;
if (up ... | [
"changeTimeValue(e, timeValue) {\n if (e.target.textContent === '+') {\n timer[timeValue]++;\n ui.updateUiElement(ui[timeValue], timer[timeValue])\n console.log(timer[timeValue]);\n } else {\n timer[timeValue]--;\n if (timer[timeValue] < 1) {\n timer[timeValue] ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parse Github URL text | function parseGithubURL(url_input) {
var data = { 'user': '', 'repo': '', 'path': '', 'name': '' };
if (url_input == null) {
return data;
}
// attempt a single file match
// example: https://github.com/tiggerntatie/brython-student-test/blob/master/hello.py
// ... | [
"function parseGithubUrl(urlStr) {\n let match;\n for (const pattern of githubPatterns) {\n match = urlStr.match(pattern);\n if (match) {\n break;\n }\n }\n if (!match)\n throw new Error(invalidGithubUrlMessage(urlStr));\n let [, auth, username, reponame, treeis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getFirstChecked(tblName) return the first Checked row index | function getFirstChecked(tblName)
{
for (var i=1; i<tblName.rows.length; i++)
{
if (tblName.rows(i).cells(0).firstChild.checked) return i;
}
return -1;
} | [
"function getFirstCheckedId(tblName)\n\t{\n\t\tfor (var i=1; i<tblName.rows.length; i++)\n\t\t{\n\t\t\tif (tblName.rows(i).cells(0).firstChild.checked) return tblName.rows(i).cells(0).firstChild.name;\n\t\t}\n\t\treturn null;\n\t}",
"function getChecked(tblName, rowIndex)\n\t{\n\t\treturn tblName.rows(rowIndex).c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
log an input error to console | function logInputErr(err) {
console.log(chalk.red(err));
} | [
"function getInputError() {\n console.log(`> Hey ${process.env['USERNAME']}, make sure your input is one of the following: \"${userArgs.twitter}\", \"${userArgs.spotify}\", \"${userArgs.omdb}\", \"${userArgs.do}\".`);\n space();\n read.close();\n}",
"function seeError(command, input){\n logMsg(\"You'v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset the line style to default. | reset() {
super.reset();
// Override default line style color
this.color = 0x0;
/**
* The width (thickness) of any lines drawn.
*
* @member {number}
* @default 0
*/
this.width = 0;
/**
* The alignment of any lines draw... | [
"reset()\n {\n super.reset();\n\n // Override default line style color\n this.color = 0x0;\n\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @default 0\n */\n this.width = 0;\n\n /**\n * The... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
notify any observers on observer_id of the event related to job_id | notify_observers(job_event, job_id, observer_id) {
var self = this;
// If this run request includes an observer id, notify all
// related endpoints that the new job has been started.
if (_.has(self._observers, observer_id)) {
logger.debug('Sending ' + job_event + ' for obser... | [
"notify() {\n this.#observers.map((observer) => {\n observer.notify();\n });\n }",
"notifyAllObservers() {\n for (let i = 0; i < this.observers.length; i++) {\n this.observers[i].notify(i);\n }\n }",
"notifyObservers(arg) {\n for (let observer of this.observers) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MySQL checking pool connection | async function checkMySQLPoolConnection() {
let isConnected = false;
const conn = await pool.getConnection();
try {
console.info(config.info(`Pinging database...`));
await conn.ping();
isConnected = !isConnected;
}
catch (err) {
console.error((config.error(`Cannot pin... | [
"createConnPool() {\n return new Promise(function(resolve,reject) {\n //Create a connection pool\n this.pool = mysql.createPool({\n connectionLimit:50,\n host: this.host,\n user: this.user,\n password: this.password,\n database: this.database\n })\n\n this.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bend/stretch arm to a length | bendArm( arm, length ) {
var ret = true;
var upperArm = this.skeleton.bones[arm.upper];
var lowerArm = this.skeleton.bones[arm.lower];
var scaling = this.rootMesh.scaling.x;
if ( length > arm.lowerLength + arm.upperLength ) {
length = arm.lowerLength + arm.upperLength
ret = false;
}... | [
"set armStretch(value) {}",
"function stretch(t, from, to) {\r\n return (t * (to - from)) + from;\r\n}",
"function stretch(t, from, to) {\n return t * (to - from) + from;\n }",
"function stretch(t, from, to) {\n return (t * (to - from)) + from;\n}",
"function downRamp() {\n c.clearRect(55, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build a list with the region name, and which party has majority there, plus the percentage | function createMajorityList(data) {
majParty = [];
var k = 0;
var listIndex = 0;
while (k < data.length) {
var majority = data[k].parti;
var votePerc = parseFloat(data[k].procent);
var region = formatString(data[k].region, true);
for (var i = k; i < k+11; i++) {
if(parseFloat(data[i].proce... | [
"function updatePercentOccupancy(regions, totalPeople) {\n for (var r in regions) \n if (totalPeople > 0) \n regions[r].pct_occupancy = regions[r].count / totalPeople; \n else\n regions[r].pct_occupancy = 0. \n}",
"function votesWithPartyCalc(array) {\n // get the list of p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handleDeliveryStatus The main routine for handling delivery status messages from xMatters If an message is delivered successfully, a comment is added to the worklog of the Remedy Incident ticket quoting the user and device that was targeted If an message delivery fails, a comment is added to the worklog of the Remedy I... | function handleDeliveryStatus(msg)
{
if ( ANNOTATE_DELIVERY && msg.deliverystatus ) {
switch (String(msg.deliverystatus).toLowerCase()) {
case "delivered":
addAnnotationToIncidentWorkInfo( getIncidentID(msg), notePrefix + "Notification delivered successfully to " + msg.recipient + " | " + msg.d... | [
"function handleDeliveryStatusCallback(msg) {\n IALOG.debug(\"Enter - handleDeliveryStatusCallback\");\n\n var incidentId = msg.additionalTokens.incident_id;\n var responder = msg.recipient;\n var xmDeliveryStatus = msg.deliverystatus;\n var xmDevice = msg.device;\n\n // Create an annotation for the successfu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the helper method to render the TLS config for a listener. | function renderListenerTlsOptions(scope, listenerTls) {
const tlsValidation = listenerTls?.mutualTlsValidation;
return listenerTls
? {
certificate: listenerTls.certificate.bind(scope).tlsCertificate,
mode: listenerTls.mode,
validation: tlsValidation
? ... | [
"async generateTlsConfig () {\n\t\tconst filenames = [\n\t\t\tPath.join (App.DATA_DIRECTORY, App.TlsKeyFilename),\n\t\t\tPath.join (App.DATA_DIRECTORY, App.TlsCertFilename)\n\t\t];\n\t\ttry {\n\t\t\tawait FsUtil.statFiles (filenames, (filename, stats) => {\n\t\t\t\treturn (stats.isFile () && (stats.size > 0));\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
refreshes GistList element of HTML, creating HTML elements from Gist object array | function updateList() {
var list = document.getElementById('gistlist');
clearNode(list);
GistList.filter(listFilter).forEach(function(gist) {
list.appendChild(GistListItem(gist));
});
} | [
"function generateList() {\n var gistList = document.getElementById('gistList');\n gistList.innerHTML = '';\n\n for (var i = 0; i < fetchedGist.length; i++)\n \tgistList.appendChild(createListItem(fetchedGist[i], i, false));\n}",
"function generateGistList(JSONArray) {\n\tvar descriptions = document.getEleme... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new AttachmentArchiveItemReadable. Metadata for an item in an attachment archive. | constructor() {
AttachmentArchiveItemReadable.initialize(this);
} | [
"function AttachmentArchiveImpl() {\n _classCallCheck(this, AttachmentArchiveImpl);\n\n AttachmentArchiveImpl.initialize(this);\n }",
"function AttachmentMetadata() {\n _classCallCheck(this, AttachmentMetadata);\n\n AttachmentMetadata.initialize(this);\n }",
"function getMetadataFromItem(dir, item... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
counterclockwise rotate 2D vector, xy, by angle (in degrees) [original CKOG uses clockwise rotation] | function rotate(xy, angle) {
var xynew = [0, 0];
if (angle === -60) {
xynew[0] = xy[0] * CK.cos60 + xy[1] * CK.sin60;
xynew[1] = -xy[0] * CK.sin60 + xy[1] * CK.cos60;
} else if (angle === -120) {
xynew[0] = -xy[0] * CK.cos60 + xy[1] * CK.sin60;
xynew[1] = -xy[0] * CK.sin60 - xy[1] *... | [
"function rotateAroundPoint(xy1, xy2, degree){\n let radian = degreeToRadian(degree);\n return vec2(Math.cos(radian) * (xy1[0] - xy2[0]) - Math.sin(radian) * (xy1[1] - xy2[1]) + xy2[0], \n Math.sin(radian) * (xy1[0] - xy2[0]) + Math.cos(radian) * (xy1[1] - xy2[1]) + xy2[1]);\n}",
"function rotate2d(oldx,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns all of the IDs that have been issued new IDs in the order in which they were issued new IDs. | getOldIds() {
return [...this._existing.keys()];
} | [
"async function getFilteredIBSAlarmIds(newIds, currentIds) {\n\n /**\n * array for alarm ids which are \n * not available in the store/state\n */\n let filteredIdArray = [];\n\n //Find values that are in newAlarms but not in currentAlarms\n filteredIdArray = newIds.filter(function (val) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds address information using the given hostname, port, protocol and proxyinfo. | getAddrStr(hostName, port, protocol, proxyInfo) {
let host = hostName.trim();
// If it is IPV6 format address then remove the enclosing '[' and ']'
if (host.startsWith("[") && host.endsWith("]"))
host = host.substring(1, host.length - 1);
return `(ADDRESS=(PROTOCOL=${protocol})(HOST=${host})(PORT=... | [
"function buildUrl(protocol, ip, port) {\n var url = protocol + '://' + ip + ':' + port;\n if(protocol !== 'http'){\n url += '/mqtt';\n }\n return url;\n }",
"_buildAddress(name, addr1, addr2, city, state, zip) {\n var completeAddr = name + '\\n' + addr1 + '\\n';\n if (addr2 == '')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get cell under cursor | function cursorCell() {
return cellAt(cursor.y, cursor.x);
} | [
"function getUnderlyingCell() {\n\t\tvar col = parseInt((mouseX - offset) / (cellSize + 1));\n\t\tvar line = parseInt(mouseY / (cellSize + 1));\n\t\t\n\t\tvar doDraw = false;\n\t\tif (line != activeLine || col != activeCol) {\n\t\t\tdoDraw = true;\n\t\t}\n\t\t\n\t\tactiveLine = line;\n\t\tactiveCol = col;\n\t\t\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load city admin panel | function loadAdmin() {
var city = getSelectedCity();
loadNews(city);
} | [
"function initial_load_city_optional() {\n\n\t\ttoggle_city_class_elements_visibility('hideComponent');\n\t\ttoggle_city_color_visibility('hideComponent');\t\t\n\t\ttoggle_city_visibility('showComponent');\t\t\n\t\ttoggle_city_original_visibility('showComponent');\n\t\ttoggle_city_panels_visibility('hideComponent')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Request: load groums for repo | load_groums(repoId) {
console.log(`Loading groums...`);
var reposRequest = $.ajax({
type: 'get',
url: window.location.protocol +
'//' + window.location.host + "/get_groums",
data: {url : this.props.config.getGroumsUrl,
app_key : repoId}
});
reposRequest.fail(func... | [
"function loadGroceries() {\n\n\n}",
"function loadNodesCollectionRepository(containerClass) {\n var filterAssigned = $('input[name=\"assigned\"]:checked').val();\n var filterPublished = $('input[name=\"published\"]:checked').val();\n\n var sortFilter = $('select[name=\"sort-by\"]');\n var sort = (sor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
eventManager receives events from the browser and passes them on to things on the canvas which registered rectangular areas they cared about. | function eventManager(canvasManager)
{
var self=this; // We get called in other context, so remember us
this.id=0; // Bump this by one for each listen
this.queues=new Object();
// So far, we only use this to get canvas, so why don't we just pass the
// canvas? I suspect that later we migh... | [
"registerEvents() {\n // Mouse\n this.canvas.addEventListener('mousedown' , this.eventsHandler.handleStart , false);\n this.canvas.addEventListener('mousemove' , this.eventsHandler.handleMove , false);\n this.canvas.addEventListener('mouseup' , this.eventsHandler.handleEnd , f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: startMelting Called when the user clicks the Start button Performs all setup/initialization that needs to occur at the beginning of every experiment, and then begins the execution of the experiment. | function startMelting() {
// Reset experiment to the beginning (ex. unmelt ice cubes, move blocks back to their starting location, etc.) just
// in case the user re-starts the experiment without explicitly clicking the Reset button first
if (experimentStarted) {
pauseMelting();
return;
}
resetExperiment();
... | [
"function startMelting() {\n\t// Reset experiment to the beginning (ex. unmelt ice cubes, move blocks back to their starting location, etc.) just\n\t// in case the user re-starts the experiment without explicitly clicking the Reset button first\n\tif (experimentStarted) {\n\t\tpauseMelting();\n\t\treturn;\n\t}\n\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CAM732 Test to check DFR record length with continuous FR Trigger within oplimit. | function CAM_732()
{
try
{
Log.Message("Start:-Test to check DFR record length with continuous FR Trigger within oplimit.")
var dataSheetName = Project.ConfigPath +"TestData\\CAM_732.xlsx"
//Step0.Check whether device exists or not in the topology.
if(DeviceTopologyPage.ClickonDevice(CommonMetho... | [
"function CAM_729_730_731_733()\n{\n try\n {\n Log.Message(\"Start:-Test to check limit DFR record length feature when FR trigger(Pre+Oplimit+Post fault time) is within Maximum record length.\")\n var dataSheetName = Project.ConfigPath +\"TestData\\\\CAM_729_730_731_733.xlsx\"\n //Step0.Check whether dev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return a list of all the tags of a specific user | function listUsersTags(user_id) {
return db('tags').where({user_id}).first();
} | [
"function getUserTags(username) {\n\tvar query = \"SELECT Content.id, username_tagger, username_taggee, Tag.timest \" +\n\t\t\t\t\"FROM Tag, Content WHERE Tag.id = Content.id AND username_taggee = ? AND status IS false\";\n\treturn new Promise((resolve, reject) => {\n\t\tconnection.query(query, username, (err, rows... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
will display the edit form for the id that is specified. | function displayEditForm(id) {
const item = reviews.find(item => item["entityId"] === id.toString()); // finds the item that the id is associated with.
document.getElementById('edit-id').value = item.entityId // sets the table id value equal to the value specified.
document.getElementById('edit-message').... | [
"function edit(edit_id) {\n open_form(APP_STATE.current_function, 'UPDATE', edit_id);\n}",
"function showEditForm() {\n showEditContactView()\n\n editfName.value = db[this.id].name1;\n editlName.value = db[this.id].name2;\n editNumber.value = db[this.id].tel;\n editeMail.value = db[this.id].mail;\n keyEd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loads a key from a circularjson persisted object | function loadKey( root ) {
var fileText;
var filePath = root + "key.json" ;
if ( typeof Ti !== "undefined" ) {
fileText = Ti.Filesystem.getFile(filePath).read().text;
} else {
fileText = require('fs').readFileSync(filePath, 'utf8' );
}
var key = CircularJSON.parse( fileText );
key.url = root;
var rehydrate... | [
"getObject(key) {\n const v = this.get(key);\n if (v === undefined) {\n return undefined;\n }\n try {\n return JSON.parse(v);\n }\n catch (err) {\n throw new ConfigTypeError(this.fullKey(key), v, \"JSON object\");\n }\n }",
"load... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add fields to the output clause | output (fields) {
if ('string' === typeof fields) {
this.outputs.push(`INSERTED.${this._sanitizeField(fields)}`);
} else {
fields.forEach((f) => {
this.outputs.push(`INSERTED.${this._sanitizeField(f)}`);
});
}
} | [
"generateOutputFields(fields, level) {\n const {keysList} = this.state;\n return fields.map((field) => {\n let obj = {\n name: field.name || field.outputFieldName ,\n type: field.type || this.getReturnType(field.functionName, ProcessorUtils.getKeyList(field.args,keysList)),\n optiona... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the right List price based on the Part No., Billing Country, Order Date, Quantity Billing Country, Order Date are defined globally Part No., Quantity are passed in as parameters on each line item call Returns : List price (currency( or null if not found | function getListPriceForItemQuantity(itemCode, quantity)
{
var returnListPriceObj = new Object();
returnListPriceObj.price = -1.00;
returnListPriceObj.quantity = 0;
returnListPriceObj.name = 'Not found';
var listPriceTrace = '';
var ItemCountryCode = itemCode + ':' + billingAddressCountryID;
// Order U... | [
"function getCurrencySpecificPrice(itemId, priceLevel, currency, flContractListRate, flContractQty) {\n var MSG_TITLE = 'getCurrencySpecificPrice';\n nlapiLogExecution('DEBUG', MSG_TITLE, 'Start');\n nlapiLogExecution('DEBUG', MSG_TITLE, 'itemId: ' + itemId + ', priceLevel: ' + priceLevel +\n ',... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an object with issued property containing the issued event and transferEvents property if issued property is set and kard has transferred before | getKardHistory(kardId) {
console.log("Getting kard history for kardId: " + kardId);
let node = 'kard_store_node'; //TODO: change me maybe? might not hard code this in future
let config = Promise.all(this.getConfig(node));
return config.then( response => {
let web3 = response[... | [
"get issued () {\n\t\treturn this._issued;\n\t}",
"lockupEvents () {\n return this.contract.events.Transfer({\n filter: {\"_to\": this.lockupAccountPk }\n });\n }",
"diff() {\n this.update();\n if (!this.actionQueue.length) {\n return null;\n }\n const event = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return true if midnight (local time) has passed since data was last fetched | function getShouldFetchNewMovieData() {
if (!_gLastMovieDataFetchDate) {
return true;
}
// getDate() returns day of month as number
var midnightHasPassedSinceLastFetch = (new Date().getDate() != _gLastMovieDataFetchDate.getDate());
return midnightHasPassedSinceLastFetch;
} | [
"function isCurrent(fetchTime: number, ttl: number): boolean {\n return fetchTime + ttl >= Date.now();\n}",
"function isCurrent(fetchTime, ttl) {\n return fetchTime + ttl >= Date.now();\n}",
"function timeToUpdate(){\n let lastUpdate = Number(sessionStorage.getItem(constants.LATESTUPDATE_STORAGE));\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper method to check the token object for legal tokens. IN: checkToken, a string to be looked up in the object. OUT: the token as string if it is in the table, otherwise return undefined. | _checkSymbol(checkToken) {
for (let token in this._validTokens) {
if (token == this.match(checkToken)) {
return token;
}
}
return undefined;
} | [
"function checkToken (token) {\n return true\n }",
"function checkToken (token) {\n return true;\n }",
"checkExceptions(checkToken) {\n for (var token in this.reservedTokens) {\n if (this.reservedTokens[token] == checkToken) {\n return token;\n }\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Highlight all multiples of the given divisor in the table | function highlight_multiples(divisor) {
$('td').each(function() {
if ($(this).data('value') % divisor == 0) {
$(this).addClass('highlight');
}
});
} | [
"formatPrime(x, y){\n\t\tvar cell = this.tbl.rows[y].cells[x]\n\t\tif(this.primes.includes(parseInt(cell.innerHTML))){\n\t\t\tcell.style.backgroundColor = \"blue\"\n\t\t\tcell.style.color = \"white\"\n\t\t}\n\t}",
"function displayNumbers(numbers){\n let templateRows = \"\";\n for (let index = 0; index < nu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the default project for new time entries | function setDefaultProject() {
e.preventDefault();
alert('Set default project');
} | [
"function newDefaultProject() {\n const defaultProject = Project(\"Create a repo\", \"Steps to create new git repository\");\n\n defaultProject.addTodo(\n \"Create a new folder\", \n \"Open your terminal and \\\n enter the command 'mkdir new_project'\",\n \"Normal\",\n \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets all calendars for this location and save to calendars collection. | async function populateCalendars(location) {
log(`--- Populating calendars for location ${location} on airbnb --- `);
let currentDate = new Date();
currentDate.setDate(currentDate.getDate() + 1);
// Airbnb allows accessing a listing's calender only up to 3 months in the past;
// (I added one day ex... | [
"async getCalendars() {\n const resp = await Q.nfcall(gcal.calendarList.list, {\n auth: this.oauth.client\n });\n const data = resp[0];\n return data.items;\n }",
"function listCalendars(){\n let request = gapi.client.calendar.calendarList.list();\n\n request.execute(function(resp)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get sheet_target all data | function getSheetTargetData(sheet_name) {
var wb = xlsx.readFile(path_target);
var listSheetNames = wb.SheetNames;
console.log('all sheetName is ...', listSheetNames);
// list_sheet_name.forEach(function(sheet_name) {
// get sheet
var wsheet = wb.Sheets[sheet_name];
// console.log('wsheet .... | [
"function makeSelectedSheetsTargetSheetReferenceList() {\n //Create an action refernece containing all of the sheets we want to export\n var targetSheetsRef = new ActionReference();\n targetSheetsRef.putEnumerated(PSKey.LayerKey, PSKey.OrdinalKey, PSKey.TargetEnum);\n\n // Put the reference containing t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Options to make changes to departments | function editDepartmentOptions() {
inquirer.prompt({
name: "editDeps",
type: "list",
message: "What would you like to update?",
choices: [
"Add A New Department",
"Remove A Department",
"Return To Main Menu"
]
}).then(responses => {
... | [
"onChangeDepartments() {\n this.editedItem.selectProvince = { code: \"default\", name: \"default\" };\n this.editedItem.selectDistrict = { code: \"default\", name: \"default\" };\n var selected = this.editedItem.selectDepartment;\n var found = this.departments.find(function(element) {\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update a playlist (city) in the playlist database | async function updatePlaylistInMongo(city) {
return new Promise(((resolve, reject) => {
PlaylistsSchema.findOneAndUpdate({ name: city.name }, city, { upsert: true }, (error, data) => {
if (error) {
console.log('An error occurred updating a playlist to the database', error);
reject(error);
... | [
"function save (zoneId, playlist) {\n\n\t\tdatabases\n\t\t\t.playlists\n\t\t\t.update(\n\t\t\t\t{ zone: zoneId }, \n\t\t\t\t{ zone: zoneId, playlist: playlist }, \n\t\t\t\t{ upsert: true },\n\t\t\t\tfunction(err, response) {\n\n\t\t\t\t}\n\t\t\t);\n\t}",
"async function editPlaylist(game_name, playlist_id)\n{\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set Item Invoice header | function setItemInvoiceHeader(data) {
try {
disableInvoiceNo();
// if (mode == 'I') {
// $('.TXT_fwd_no').val('');
// $('.TXT_fwd_no').attr('disabled', true);
// $('.TXT_fwd_no').parent().addClass('popup-fwd-search');
// $('.popup-fwd-search').find('.btn-search').attr('disabled', true);
// parent.$... | [
"setInvoiceModalHeader(id, name){\n $(\"#receipt-dt-name\").text('Buyer : ' + name);\n $(\"#receipt-dt-id\").text('Receipt id # ' + id);\n }",
"function invoiceHeader()\r\n{\r\n\r\n\r\n\tinvoiceRecord = nlapiCreateRecord(\"invoice\");\r\n\t\r\n\t// set internal ID for Optegra form 137\r\n\tinvoic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detects the trackinformation from the video title and temporarily saves it | function getTrackInfo(){
var feedback;
if ((us_getTempData("artist")!=0) || (us_getTempData("track")!=0)) {
feedback = "found";
} else {
//Retrive trackinformation from database
if (getDatabaseData()==true) {
feedback = "found";
trackInfoFromDB = true;
} else {
//New detection of trackinfo... | [
"function handleTrack(info){\n setInfoTracks(info)\n }",
"function processCurrenttrack (data) {\n setSongInfo(data)\n mopidy.playback.getStreamTitle().then(function (title) {\n setStreamTitle(title)\n }, console.error)\n}",
"function saveMediaTracks(tarcks) {\n tarcks.forEach(function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The repository main class refreshes automatically the TTL of accessed entries, letting only unaccessed entries expire But tokens' TTL must remain the same than their expiration time, refreshing a token entry has no meaning. So we need to override the TTL autorefresh function to disable it | refreshCacheTTL() {
// This comment is here to please Sonarqube. It requires a comment
// explaining why a function is empty, but there is no sense
// duplicating what has been just said in the JSDoc.
// So, instead, here are the lyrics or Daft Punk's "Around the world":
//
// Around the world, ... | [
"$$refreshToken() {\n if (this.$timeouts.refresh !== undefined) {\n clearTimeout(this.$timeouts.refresh);\n }\n\n if (this.$timeouts.expired !== undefined) {\n clearTimeout(this.$timeouts.expired);\n }\n\n const timeToExpiration = (this.profile.userInfo.exp * 1000) - Date.now();\n\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate loader string to be used with extract text plugin | function generateLoaders(loaders) {
var sourceLoader = loaders
.map(function(loader) {
var extraParamChar;
if (/\?/.test(loader)) {
loader = loader.replace(/\?/, '-loader?');
extraParamChar = '&';
} else {
loader = loader + '-loader';
extraParamC... | [
"function generateExtractLoaders (baseLoader) {\n // Ignore the style loader (the first item), extractText doesn't need it\n var loaders = baseLoader.split('!').slice(1)\n\n // Get their plugin names and source maps\n return loaders.map(function (loader) {\n return loader + '-loader' + (SOURCE_MAP ? '?source... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
disconnectedCallback Implementation of the disconnectedCallback. | disconnectedCallback() {
// Attach callback:
this._pipeCallback('onDisconnect');
} | [
"disconnectedCallback() {\n this._disconnect();\n }",
"disconnectedCallback () {\n // Unsubscribe to event listeners\n this.unsubscribeListeners()\n }",
"disconnectedCallback() {\n super.disconnectedCallback();\n this.isAttached = false;\n this.detached();\n }",
"disconnectedCallb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Price format check takes an input string and returns a boolean that indicates whether the string contains a number to two decimal places. | function priceFormatCheck(input) {
var i = 0;
do {
if (i === input.length) {
return false;
}
i++;
} while (input.charAt(i) != '.');
return 2 === input.length - (i + 1);
} | [
"function containsDecimals(amount) {\n return amount.split('.').length === 2;\n}",
"function isPrice(str) {\n var price = parseFloat(str.trim());\n if (isNaN(price)) return false;\n return (price >= 0 && price <= 999999);\n }",
"function checkIfOnlyPrice(field) {\n if (/^[0-9]+\\.?[0-9... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that is mainly responsible for the PDF creation. Calls a nested function in itself while ensuring that a specific amount of "TIME LIMIT" has been surpassed. The TIME LIMIT is extremely crucial. | function timeLoop(){
setTimeout(function () {
/**
* I added this alert to avoid the awkwardness of the "wait" feeling.
* You will get a better understanding of this when you will reach the TIME LIMIT section.
*/
alert("An Executive PDF will be generated.");
/**
... | [
"function delay(email1,email2,email3) {\n \n // add 5 minute delay before calling pdf/email function\n Utilities.sleep(300 * 1000);\n \n dataIntoPDF(email1,email2,email3);\n}",
"function generatePDF(mode) {\n // Page start drawing from here...\n resetTotalImagesCaptions();\n var isMobile = {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define a custom context for ballot | createContext() {
return new BallotContext();
} | [
"function ballot() {\n var bal = {},\n // Settable options\n container,\n candidates = [],\n votes = [],\n title = 'Example ballot card',\n withCard = false,\n showCard = false,\n shouldFadeIn = {\n candida... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Manage `isopaque` state for `headernav` | function toggleIsOpaque() {
var scrollTop = window.scrollY;
if (scrollTop > 0) {
headerNav.classList.add("is-opaque");
} else {
headerNav.classList.remove("is-opaque");
}
} | [
"function isHeaderTransparent() {\n return $('header').hasClass('is-transparent') ? true : false;\n }",
"function setHeaderTransparent() {\n $header.addClass('is-transparent');\n $searchBlock.removeClass('is-active');\n $txtSearch.blur();\n }",
"function setHeaderTransparen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns false if service capacity definitions are not valid, otherwise returns a well formed set of service capacity definitions using data as given in Services Capacity reference lookup | async _validateCapacities(capacityDef) {
const setOfValidatedCapacities = [];
let setOfValidatedCapacitiesInvalid = false;
// need the set of all services capacities defined and available
if (this._allCapacities === null || !Array.isArray(this._allCapacities)) return false;
for (let thisCapacity o... | [
"availableRooms(start, end, features, capacity){\n let output = [];\n for (const [name, room] of Object.entries(this._roomList)){\n if (room.capacity >= capacity){\n if (room.available(start, end)){\n if (room.hasFeatures(features)){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Debounces a function. Returns a function that calls the original fn function only if no invocations have been made within the last quietMillis milliseconds. | function debounce(quietMillis, fn) {
var timeout;
return function() {
window.clearTimeout(timeout);
timeout = window.setTimeout(fn, quietMillis);
};
} | [
"function debounce(quietMillis,fn,ctx){ctx=ctx||undefined;var timeout;return function(){var args=arguments;window.clearTimeout(timeout),timeout=window.setTimeout(function(){fn.apply(ctx,args)},quietMillis)}}",
"function debounce(quietMillis, fn, ctx) {\n ctx = ctx || undefined;\n var timeout;\n return fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns weekly high scores | function getHighScores(callback) {
pool.getConnection(function(err, connection) {
var weekAgo = moment().subtract(7, 'days').format('YYYY-MM-DD HH:mm:ss');
var query = `
SELECT DISTINCT *
FROM scores
WHERE date > '${weekAgo}'
ORDER BY score DESC
LIMIT 5
`;... | [
"async get_weekly_scores(req, res, next) {\n const Matchup = this.models.get('Matchup')\n\n const current_week = await this.sports_data.current_play_week()\n const weekly_data = []\n\n // Convert all of the matchup instances to API format for each week\n for ( let i = 1; i <= curr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
insertRecipe async function that takes in as argument an array with recipe name and description and resolves the inserted ID in db | async function insertRecipe(recipe) {
return new Promise(function(resolve, reject) {
let sql_query = "INSERT INTO `Recipe` (`Name`, `Description`) VALUES (?, ?)";
mysql.pool.query(sql_query, recipe, function(err, result) {
if (err) {
next(err);
return;
}
resolve(result.insert... | [
"function addRecipe(recipe) {\nreturn db('recipe')\n .insert(recipe)\n .then(ids => ({ id: ids[0] }));\n}",
"insertRecipe(db, ingredients, newRecipe, recipeIngredients) {\n let newRecipeId;\n return (\n db\n // using a transaction with async/await in order to ensure proper order of data su... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper function to create and populate header row in table with categories | function populateHeadersInGameTable(array) {
for (let i = 0; i < array.length; i++) {
let $generatedGameTableCategoriesHTML =
$(`<td class=" category-card category ${i}">${String(array[i].title)}</td>`)
$gameCategoryRow.append($generatedGameTableCategoriesHTML);
}
} | [
"function createCategoryHeader(cat) {\n var top = $(\"<h1>\", {\n text: cat.name,\n class: \"top\",\n });\n var columnHeaders =\n '<div class=\"grid\">\\n\\t\\t\\t<div class=\"column-header name\">'\n .concat(\n text.columnHeaders.activity,\n '</div>\\t\\n\\t\\t\\t<div class=\"column-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display Google Map on screen with selected hotel Author: ChienTX | function showHotelMap(hotelId){
//check if the map has been loaded
//if (map != null){
//return;
//}
$("#map_canvas").html("");
$("#map_canvas").mask("Loading...");
//send request to get location of current hotel and other places around it
$.ajax({
url: hotelServiceUrl,
data: {'hotelId' : hotelId},
t... | [
"function showAllHotelMap(){\n\t\n\tvar array_hotels = [];\n\tvar array_links = {};\n\t$(\"a.map-link\").each(function(i,e){\n array_hotels.push($(e).attr(\"tab\"));\n\t});\n\t$(\"span.bold-blue-text a\").each(function(i,e){\n var href = $(e).attr(\"href\");\n var h_key = href.match(/\\d+\\?/)[0].match(/\\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate the data block only consisting of id & CreatedAt for rendering as options in Select box | function generateSelectListData(spatialSpanActivities){
var listData = [];
spatialSpanActivities.forEach(function(instance){
listData.push({id: instance.id, CreatedAt: instance.CreatedAt});
});
return listData;
} | [
"function renderCreatorList(data) {\n if(!data.length) {\n window.location.href = \"/users\";\n }\n $(\".hidden\").removeClass(\"hidden\");\n var rowsToAdd = [];\n for(var i = 0; i < data.length; i++) {\n rowsToAdd.push(createMemerRow(data[i]));\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if the triple "subject predicate object" is already in the editor, remove it otherwise, add it | function swapTriple(subject, predicate, obj) {
if (subject != '' && predicate != '' && obj != '') {
var content = hxleditor.getValue();
var triple = getTriple(subject, predicate, obj);
//check if triple is already there:
if (content.indexOf(triple) == -1) {
// not... | [
"function revertDeletion(subject) {\n let index = removedSubjects.findIndex((obj) => obj.name === subject.name);\n if (index >= 0) {\n removedSubjects.splice(index,1);\n selected_subjects.push(subject);\n updateViz();\n }\n}",
"function MSTUDSUBJ_AddRemoveSubject(mode) {\n con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
executes multiple requests to each of the internship links | async function dataRetriever() {
var $ = await rp(options);
var count = 0;
$('.individual_internship').each(async function () {
var link = $(this).children('.button_container').children('a').attr('href');
links.push(link) //making array of all the internship links on the page
cou... | [
"function executeURLS() {\n\n for(var i = 0, len = documentsURL.length; i < len; i++) {\n (function () {\n var aux = i, endChecker = false;\n\n request(documentsURL[i], function (error, response, body) {\n if (!error) {\n if(a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DISCRETE HORIZONTAL SLIDER EXTENDS HORIZONTAL SLIDER | function DiscreteHorizSlider (params) {
if (!params.numBins) {
throw 'discrete horizontal slider needs an integer number of bins';
}
this.numBins = params.numBins
this.binSize = Math.floor(params.width / this.numBins);
this.lineWidth = 4;
this.renderWidth = this.binSize - this.lineWidth;
... | [
"function ControlSlider(name, group, weight, locked, flipped, topLevel, theme){\r\n if (group === undefined){\r\n group = false;\r\n };\r\n if (weight === undefined){\r\n weight = 0;\r\n };\r\n if (locked === undefined){\r\n locked = false;\r\n };\r\n if (flipped === undefined){\r\n flipped = fal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor for 64bit length bit array This data structure represents a bit array that can contain up to 64 bits represented in such way that the most significant bit is the first one and the least significant one is the last one. The basic constructor takes two 32bit numbers, that represent the higher and the lower pa... | function BitArray64(high, low) {
this._low = low;
this._high = high;
} | [
"static fromBits(lowBits, highBits, unsigned) {\n return new Long(lowBits, highBits, unsigned);\n }",
"function int_64(msint_32, lsint_32)\n{\n\tthis.highOrder = msint_32;\n\tthis.lowOrder = lsint_32;\n}",
"function int64(h, l) {\n this.h = h;\n this.l = l;\n //this.toString = int64toSt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UpdateMotion() Update position and rotation of objects over interval t (in seconds) | function UpdateMotion(t)
{
var i, obj;
for (i in ph_objects)
{
obj = ph_objects[i];
// Update position
vec2.scaleAndAdd(obj.pos, obj.pos, obj.vel, t);
// Update rotation
obj.rot += obj.rot_vel * t;
}
// TODO: Check if this works with splice below
for (i ... | [
"updateMotion() {\n this.acc.add(this.force.div(this.genes.mass.val)); // a = f/m\n this.acc.limit(this.genes.maxAcc.val);\n this.vel.add(this.acc);\n this.vel.limit(this.genes.maxVel.val);\n this.pos.add(this.vel);\n }",
"startMotion(){\n Matter.Body.setStatic(this.body, false)\n this.posit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find PCs in room | function pcsByRoom (id) {
var roomPCs = [];
for (var i = 0; i < PCs.length; i++) {
if (PCs[i].roomid === id) {
roomPCs.push(PCs[i]);
}
}
return roomPCs;
} | [
"function pcByCharacterName (name) {\n for (var i = 0; i < PCs.length; i++) {\n if (name.toLowerCase() === PCs[i].name.toLowerCase()) {\n return PCs[i];\n }\n }\n\n return false;\n\n}",
"function find_matches() {\n for (var section of sections.keys()) {\n var section_times = sections.get(secti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
replace all parent selectors inside `inSelector` by content of `context` array resulting selectors are returned inside `paths` array returns true if `inSelector` contained at least one parent selector | function replaceParentSelector(paths, context, inSelector) {
// The paths are [[Selector]]
// The first list is a list of comma separated selectors
// The inner list is a list of inheritance separated selectors
// e.g.
// .a, .b {
// .c {
// }
// }
... | [
"function replaceParentSelector(paths, context, inSelector) {\n // The paths are [[Selector]]\n // The first list is a list of comma separated selectors\n // The inner list is a list of inheritance separated selectors\n // e.g.\n // .a, .b {\n // .c {\n // }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the firmware device status from the server Praneesh 28 Jan 2015 | function GetActualFirmwareDownloadStatusAndUpdateUI(progressIntervalId, currentProgressPercent) {
var deviceIds = new Array();
deviceIds.push(self.Id);
datacontext.getfwupgradeStaus(deviceIds).done(function (jResult) {
if (jResult.Success) {
if (jR... | [
"function getFirmwareVersion() {\n if (verbose) {\n log(`Getting firmware version...`);\n const buf = Buffer.from(`VER\\n`, 'ascii');\n vpro.write(buf, (err) => {\n if (err) {\n logError(`Failed to get firmware version`);\n return;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the current stream preview element | function removePreview() {
$("#streamPreview").remove();
} | [
"function removePreview() {\n\t\t$( this ).siblings( '.rwmb-embed-media' ).html( '' );\n\t}",
"function hidePreview() {\n let span = this.querySelector('.preview');\n span.parentNode.removeChild(span);\n}",
"_destroyPreview() {\n if (this._preview) {\n removeNode(this._preview);\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reloads browsers that are using browsersync | function browserSyncReload(done) {
browserSync.reload();
done();
} | [
"function browserSyncReload(done) {\n browsersync.reload();\n done();\n}",
"function browsersyncReload(cb) {\n browsersync.reload();\n cb();\n}",
"function browserSyncReload(callback) {\n browserSync.reload();\n callback();\n}",
"function reload() {\n browserSync.reload();\n}",
"function reload... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the divElement style attribute with all properties in styleObject. | function addStyleProperties(divElement, styleObject) {
for (key in styleObject) {
if (styleObject.hasOwnProperty(key)) {
divElement.style[key] = styleObject[key];
}
}
} | [
"function addStyleProperties(divElement, styleObject) {\r\n for (key in styleObject) {\r\n if (styleObject.hasOwnProperty(key)) {\r\n divElement.style[key] = styleObject[key]; \r\n }\r\n }\r\n }",
"function addStyleProperties(divElement, styleObject) {\n for (key in styleObject) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
READ grab all tickets for a student | function find(studentid) {
return db("tickets as t")
.join("userTickets as u", "u.ticketId", "t.id")
.where("studentId", studentid)
} | [
"async getNotesListByStudent ( p_auth, p_course, p_studentId ) {\n const AUTHORIZATION = `${p_auth.token_type} ${p_auth.access_token}`\n const PATH = 'Med_get_obser_alumno'\n const result = await fetch( `${ BASE_API_URL }${ BASE_PATH_URL }${ PATH }?p_grcu_sec=${ p_course }&p_fial_sec=${ p_stude... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Choose the first valid path. If `workspace` is undefined then either a workspace or a directory are acceptable. Otherwise it must be a file if a workspace or a directory otherwise. | async getFirstValidPath(startPaths) {
const logger = this.services.get(log_1.ILogService);
const cwd = process.env.VSCODE_CWD || process.cwd();
for (let i = 0; i < startPaths.length; ++i) {
const startPath = startPaths[i];
if (!startPath) {
... | [
"function getWorkspace(workspace) {\n switch (typeof workspace) {\n case 'function': return workspace()\n case 'number': return getWorkspaceByIndex(workspace)\n default: return workspace\n }\n}",
"static getPrimaryWorkspaceFileSystemPath() {\r\n if (!vscode.workspace.workspaceFol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Peaks Divide an array into the maximum number of samesized blocks, each of which should contain an index P such that A[P 1] A[P + 1]. Time complexity: O(N log(log(N))) medium anti slow(performance failed) | function solution(A) {
const N = A.length;
let peaks = [];
if(N < 3) return 0;
// If A's length(N) is prime number and has peak, return 1
function isPrime(num) {
let result = false;
for(let i = 2; i <= Math.floor(Math.sqrt(num)); i++) {
if(num % i === 0){
result = false;
bre... | [
"function allBlocksHavePeak(peaksIndex, numberOfElements, A){\n let allPeakIndex = peaksIndex.slice() // new array\n // console.log(\"ABHPn: \", numberOfElements, allPeakIndex)\n \n let hasPeak = true\n let loopLength = A.length/numberOfElements\n for(let i = 0; i < loopLength; i++){\n // c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send data of a widget | send_widget_data$(app_id, widget_id, data) {} | [
"send(e, data) {\n this.mainWindow.webContents.send(e, data);\n }",
"function sendDataToElm(action, data) {\r\n app.ports.dataForElm.send({ action: action, data: data });\r\n}",
"function sendData (client, method, data) {\n\t\tvar packet = { methodName : method, data : data };\n\t\t\n\t\tclient.fn.send(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Output: "123" 3 Turn an array of voter objects into a count of how many people voted. Note: You don't necessarily have to use reduce for this, so try to think of multiple ways you could solve this. | function totalVoters(arr){
const result = arr.reduce(function(total, voters){
if (voters.voted){
return total += 1;
}
return total;
},0);
return result;
} | [
"function totalVotes(arr) {\n return voters.reduce(function (final, voter){\n if(voter.voted){\n final++\n }\n return final\n }, 0) \n }",
"function totalVoters(arr) {\n return arr.reduce(function(x, y){\n\n return x + y.voted } , 0);\n }",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HELPER FUNCTIONS Sets padding on the content based on navbar height On smaller screens navbar displays in two lines and doubles in size. The function sets body paddingtop equal to the navbar height | function setTopPadding() {
var padding = $('#main-nav.navbar div.container').css('height');
$content.css('padding-top', padding );
} | [
"function settleBodyPadding(){\n var Body = document.getElementById(\"myFullBody\");\n var NavBar = document.getElementById(\"myNavBar\");\n Body.style.paddingTop = (NavBar.clientHeight+10)+\"px\"; // Assigning the top padding to the client height (height + vertical padding) of the Nav-Bar.\n return 0;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function to change days in a date | function changeDays(days, date) {
const result = new Date(date);
result.setDate(result.getDate() + days);
return result;
} | [
"function date_change(date, num) {\n date.setDate(date.getDate() + num);\n}",
"function translateSweepDate(days){\n let thisDate = new Date('12/31/1899');\n thisDate.setDate(thisDate.getDate() + days);\n let outVal = thisDate.toLocaleDateString('en-US', {month: '2-digit', day: '2-digit'});\n return o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Upload VCL snippets to the Fastly service | function uploadVcl()
{
let activate_vcl_flag = false;
if ($('#fastly_activate_vcl').is(':checked')) {
activate_vcl_flag = true;
}
$.ajax({
type: "POST",
url: config.vclUploadUrl,
... | [
"function swift_container_main_lib_upload(token){\n console.log(\"Uploading Main Library Files\");\n res1.write(\"Uploading Main Library Files<br>\");\n //upload to swift container\n fs.createReadStream('public/uploads/'+mainLibFileName).pipe(request.put({\n url: swift_url+'/scripts/'+mainLibFile... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |