query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Unclip all clipped elements and remove itself | remove() {
// unclip all targets
this.targets().forEach(function (el) {
el.unclip();
}); // remove clipPath from parent
return super.remove();
} | [
"remove() {\n // unclip all targets\n this.targets().forEach(function (el) {\n el.unclip()\n })\n\n // remove clipPath from parent\n return super.remove()\n }",
"remove(){// unclip all targets\nthis.targets().forEach(function(el){el.unclip()});// remove clipPath from parent\nreturn super.remo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a valid Realm user access token to authenticate requests | async function getValidAccessToken() {
if (!app.currentUser) {
// If no user is logged in, log in an anonymous user
await app.logIn(Realm.Credentials.anonymous());
} else {
// The logged in user's access token might be stale,
// Refreshing custom data also refreshes the access token
... | [
"async function getValidAccessToken() {\n // Guarantee that there is a logged in user with a valid access token\n if (!app.currentUser) {\n await app.logIn(Realm.Credentials.anonymous());\n } else {\n // An already logged in user's access toekn might be stale, to guarantee that the token\n // is valid, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the command needed to activate the conda env. | async getActivationCommandsForInterpreter(pythonPath, targetShell) {
const envInfo = await this.condaService.getCondaEnvironment(pythonPath);
if (!envInfo) {
return;
}
// Algorithm differs based on version
// Old version, just call activate directly.
// New ve... | [
"detectCondaEnvironment(interpreter) {\n return interpreter.type === contracts_1.InterpreterType.Conda ||\n (interpreter.displayName ? interpreter.displayName : '').toUpperCase().indexOf('ANACONDA') >= 0 ||\n (interpreter.companyDisplayName ? interpreter.companyDisplayName : '').toUpper... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================= Functions to clear the tables================================== Clears the Environment table | function clearEnvTables() {
$('tr.env-param-row').each(function(i) {
$(this).empty();
// console.log("Env",i);
});
} | [
"function clearTables() {\n\ttables = [];\n\twaitList = [];\n\tdata = true;\n}",
"clear() {\n this._tables = {}\n }",
"clearTable() {\n\t\t// Reset both arrays\n\t\tthis.mTableCards = [];\n\t\tthis.mTableBuilds = [];\n\t}",
"function clearTable() {\r\n\t\ttable = [];\r\n\t\tfor( var row = 1; row <= tableS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The URL for fetching the verification certificate should have the same domain as the XSUAA. So if the UUA domain is "authentication.sap.hana.ondemand.com" the URL should be like so the host should end with the domain. | function checkDomainVerificationKeyURL(verificationKeyURL, uaaDomain) {
var jkuDomain = url.parse(verificationKeyURL).hostname;
if (!uaaDomain || !jkuDomain || !jkuDomain.endsWith(uaaDomain)) {
throw new Error("The domains of the XSUAA and verification URL do not match. The XSUUA domain is '" + uaaDomai... | [
"static get APP_CERT_URL() {\r\n return `${window.location.href}cert/FPSAC.cer`;\r\n }",
"function verifyCert(){\n\t//const cert = Verifier.Certificate.parseJson(data); // in the next two lines we are verifying the certificate inside the console.\n\t//console.log(cert);\n\tsetTimeout(alert(\"Verified!\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion region Methods Setup shader logic | setup() {
if (this.compile()) {
let shaderManager = GameManager.activeGame.getShaderManager();
if (shaderManager) {
shaderManager.useShader(this);
} else {
this._gl.useProgram(this._program);
}
// cache some script locations:
this.cacheUniformLocations(Object.key... | [
"start()\n {\n // set the shader..\n }",
"setup() {\n if (this.compile()) {\n let shaderManager = GameManager.activeGame.getShaderManager();\n if (shaderManager) {\n shaderManager.useShader(this);\n } else {\n this._gl.useProgram(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the guest information panel for incall only | function guestInfo(){
xapi.command('UserInterface Extensions Panel Save', {
PanelId: 'guest_info'
},
`<Extensions>
<Version>1.5</Version>
<Panel>
<Type>InCall</Type>
<Icon>${adhocUI_Details.buttonIcon}</Icon>
<Order>2</Order>
<Color>${adhocUI_Details.buttonColor}</Color>
<Name>${... | [
"function displayAdditionalInfoForGuest() {\n\tvar arg0 = '<a href=\"javascript:void(0)\" class=\"blue_link\" onclick=\"showTermsUrl()\">';\n\tvar arg1 = '</a>';\n\tclearFormData('additional_info_box_fields');\n\t$(\"#chkoutMobErrorMsgDiv\").hide();\n\t/* Show the check box for marketing Opt in */\n\tcreateOptInMsg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Analyze a data pipeline, add needed operators. | function analyze(data, scope, ops) {
// POSSIBLE TODOs:
// - error checking for treesource on tree operators (BUT what if tree is upstream?)
// - this is local analysis, perhaps some tasks better for global analysis...
var output = [],
source = null,
modify = false,
generate = false,
up... | [
"function analyze(data, scope, ops) {\n // POSSIBLE TODOs:\n // - error checking for treesource on tree operators (BUT what if tree is upstream?)\n // - this is local analysis, perhaps some tasks better for global analysis...\n\n var output = [],\n source = null,\n modify = false,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::KafkaConnect::Connector.ProvisionedCapacity` resource | function cfnConnectorProvisionedCapacityPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnConnector_ProvisionedCapacityPropertyValidator(properties).assertSuccess();
return {
McuCount: cdk.numberToCloudFormation(properties.mcuCount),
... | [
"function cfnConnectorCapacityPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnConnector_CapacityPropertyValidator(properties).assertSuccess();\n return {\n AutoScaling: cfnConnectorAutoScalingPropertyToCloudFormation(properties.auto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
for check track2 data is available in swipe string :AJ Accepted Payment | function hasTrack2(trackData) {
var i = trackData.indexOf(";");
return (i >= 0 && trackData.indexOf("?", i + 1) >= 0);
} | [
"function fieldInspectionPayment() {\r\n var thisCapId = capId;\r\n var paid = true;\r\n\r\n if (arguments.length == 1)\r\n thisCapId = arguments[0]; // use cap ID pecified in args\r\n var vBoardASI = AInfo[\"Board\"];\r\n var boardCode = lookup(\"BOARDS\", vBoardASI);\r\nif(boardCode==\"GF\"){\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
concat all templates to on | function concatTemplates(basePath) {
'use strict';
var templates = [],
tasks = [],
i = 0,
concatedContent = '';
return new Promise(function (resolve, reject) {
if (!basePath) {
return reject('missing_basepath');
}
fs.stat(basePath, function (statE... | [
"function loadTemplates() {\n // This loop will spit out all the template\n for (num = 0; num < templates.length; ++num) {\n var source = $(templates[num][\"templatesource\"] + \"\").html();\n var handlebarscompile = Handlebars.compile(source);\n \n // Determine if we are rendering the template at the b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom Characteristic for Volume | function makeVolumeCharacteristic() {
VolumeCharacteristic = function () {
Characteristic.call(this, 'Volume', '91288267-5678-49B2-8D22-F57BE995AA93');
this.setProps({
format: Characteristic.Formats.INT,
unit: Characteristic.Units.PERCENTAGE,
maxValue: 100,
minValue: 0,
minStep: ... | [
"function makeVolumeCharacteristic() {\n\n VolumeCharacteristic = function() {\n Characteristic.call(this, 'Volume', '91288267-5678-49B2-8D22-F57BE995AA00');\n this.setProps({\n format: Characteristic.Formats.INT,\n unit: Characteristic.Units.PERCENTAGE,\n maxValue:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read default file and write its content to actualused file | function readDefaultContentAndAddToActualFile() {
// read default file
var data = fs.readFileSync(usersStorageDefaultFilePath, "utf8");
// write default content
fs.writeFileSync(usersStorageFilePath, data);
} | [
"readin () {\n this.content = readFile(this.path);\n }",
"function createDefaultConfig() {\n // Copy over the example file to the actual file, then read it again\n fs.writeFileSync(FILENAME, fs.readFileSync(EXAMPLE_FILENAME));\n exports.readFile();\n}",
"async function repairFile(defaultPath,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add the url_css file to the page | function addStyleSheet(url_css) {
$("head").append('<link rel="stylesheet" href="' + url_css + '" />');
} | [
"loadCSS() {\n var fileRef = document.createElement(\"link\");\n fileRef.setAttribute(\"rel\", \"stylesheet\");\n fileRef.setAttribute(\"type\", \"text/css\");\n fileRef.setAttribute(\"href\", Util.concatenateUrl(this.integrationModel.getPath(), '/core/styles.css'));\n document.ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
attach event handling to the notification after the notification is fully loaded | function attachNotificationHandler() {
notification.find('.call_notification_button_reject').click(function () {
media.reject(BBMEnterprise.Messenger.Media.CallEndReason.REJECT_CALL);
removeNotification(notification);
});
media.on('disconnected', function () {
... | [
"onNotification(notification) {}",
"function _onloaded() {\n // Update flag\n isAttentionLoaded = true;\n _inCall = true;\n // Execute CB\n callback();\n }",
"function notificationEvents() {\n notifications[eNotificationType.InstrumentEdited] = new delegate();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We manually override the effects of pasting into the document in order to keep the highlighting and internal state consistent. | paste (event) {
event.preventDefault();
event.stopPropagation();
this.replaceText(this.selection.start, this.selection.end, event.clipboardData.getData("text"));
} | [
"handlePaste() {\n this._pasting = true;\n }",
"function mypasteSpecialChange() {\r if (copy_paste_req.readyState == 4) { // Complete\r if (copy_paste_req.status == 200) { // OK response\r var paste = '[' + copy_paste_req.responseText + ']'\r var con = getContextURL();\r ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws a card from the targeted deck 'tarDeck' and adds it to the player's hand. It then checks if the new value of the hand would cause the player's turn to end. Returns true if the player's turn has not ended, and false if it has ended. | hit(tarDeck){//returns false if the drawn card causes the player's turn to end, either by hitting 21 or going bust, or by hitting 5 cards.
this.hand.push(tarDeck.shift());//removes a card from the top of the deck into the entity's hand.
let total = this.calulateHandValue();//I know i should probably hav... | [
"function check_draw_card() {\n\tif (players[cur_player_index].human && !player_drawn_this_turn) {\n\t\tplayer_drawn_this_turn = true;\n\t\tdraw_card(3, 1);\n\t}\n}",
"get playHasEnded(): boolean {\n return (this.currentBoard.cards.length == 52);\n }",
"function repeatCard(number, suit){\n\tfor (var i = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onChangeYear method e is the event coming back when it's invoked setState updating our state or object for storing | onChangeYear(e){
this.setState({
Year: e.target.value
});
} | [
"onYearChange(date) {\n let { value } = this.state;\n value.setFullYear(date.getFullYear());\n this.onChange(value);\n }",
"function setYear(evt) {\r\n var year = evt.detail;\r\n\r\n currentYear = year;\r\n }",
"onChangeMovieYear(e) {\n //when the valuse changes - update state\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates state exists and is only alphabetic | function validateState(e) {
var re = /^[a-zA-Z]+$/;
var test1 = re.test(e);
// compare lower case states to lower case input
var test2 = $.inArray(e.toLowerCase(), statesLower) > -1;
return test1 && test2;
} | [
"function validState(state){\r\n var stateArray = new Array(\"AL\", \"AK\", \"AZ\", \"AR\", \"CA\", \"CO\", \"CT\", \"DE\", \"FL\", \"GA\", \"HI\",\r\n \"ID\", \"IL\", \"IN\", \"IA\", \"KS\", \"KY\", \"LA\", \"ME\", \"MD\", \"MA\", \"MI\",\r\n \"MN\", \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions Calculates the cost of the Html books | function calcCostOfHtml (htmlQ) {
console.log("In CostofHtml");
htmlCost = htmlQ * 75.99;
htmlCost = htmlCost.toFixed(2);
document.getElementById("htmlBookCost").innerHTML = "Total: $" + htmlCost;
} | [
"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 finalCostCalculation() {\n\tfinalCost = base + memoryParseCost + strogeParseCost + deliveryParseCost;\n\ttotalCost.innerText = f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shuffle x elements of the array | function shuffle(a,x){
let len=Math.min(a.length,x);
for(let i=0;i<len;i++){
let index=parseInt(Math.random()*a.length);
swap(a,i,index);
}
return a.slice(0,x);
} | [
"function shuffleArray(array) {\n\n}",
"function shuffleElements (arr) {\n\n\tfor (var i = 0; i <64; i++) {\n\t\tvar a = Math.floor(Math.random()*arr.length);\n\t\tvar b = Math.floor(Math.random()*arr.length);\n\t\tvar temp = arr[a];\n\t\tarr[a] = arr[b];\n\t\tarr[b] = temp;\n\t}\n\n\treturn arr;\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update the nodes positions on screen | function updateNodePositions() {
// set node positions
rect.attr('transform', function (d) {
return 'translate(' + d.x + ',' + d.y + ')';
});
} | [
"updateNodePositions() {\n const x = this._descent.x[0], y = this._descent.x[1];\n let o, i = this._nodes.length;\n while (i--) {\n o = this._nodes[i];\n o.x = x[i];\n o.y = y[i];\n }\n }",
"function updateNodes(){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
invoke drawLetter for each letter in s | function drawLetters(s, sr, sc, dynamic_color = true){
len = s.length;
for(let x = 0; x < len; ++x){
drawLetter(s[x], sr, sc + x, dynamic_color);
}
} | [
"function draw() {\n for (var i = 0; i < letters.length; i++) {\n letters[i].update();\n letters[i].display();\n }\n}",
"writeCorrectLetter(letter) {\n let drawnLetters = [];\n if (!drawnLetters.includes(letter)) {\n drawnLetters.push(letter);\n for (let i = 0; i < this.secretWord.length; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function processes the proposal responses for invokes and deployRequest returns the number of good proposals | function handleProposalResponses(proposalResponses) {
var goodProposals = 0;
proposalResponses.forEach(function(proposalResponse) {
if (proposalResponse &&
proposalResponse.response &&
proposalResponse.response.status === 200) {
goodProposals++;
console.log('Successfully sent Proposal an... | [
"function pendingProposalsReceived(){\n let proposals = JSON.parse(this.responseText)\n \n if(Array.isArray(proposals) && proposals.length != 0){\n proposals.forEach( function(proposal){\n lastProposal = proposal.proposalId\n proposalsCount++\n proposals_pending.forE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse each two character block. | parseEachTwoCharactersBlock($number, $index, $length) {
const $geez_number = this.getGeezNumberOfTheBlock($number, $index);
const $bet = this.getBet($length, $index);
const $geez_separator = this.getGeezSeparator($bet);
return this.combineBlockAndSeparator($geez_number, $geez_separator, $index);
} | [
"twoCharToken(c, two, one) {\n this.makeToken(this.matchChar(c) ? two : one);\n }",
"function badCharacterInformationSeparatorTwo$1(context) {\n const charCode = 30;\n return {\n character({ chr, i }) {\n if (chr.charCodeAt(0) === charCode) {\n context.report({\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all chatboxes for the user function | async function getChatboxes({ userId }) {
try {
// Check if the user exists
const existedUser = await users.findOne({
cognito_id: userId,
});
if (!existedUser) {
throw 'User does not exist';
}
// Fetching al... | [
"get allChatters() {\n return shared_utils_1.flatten(Object.values(this._data.chatters));\n }",
"function listChat (channel) {\n document.querySelector(\"#chat_div\").innerHTML = \"\";\n channel.forEach(e => {\n const user = e.user;\n const message = e.message;\n const date = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns cookies set during 'login' process. If bool_url_specific_cookies is not defined or is 'true', it will return all 'DURING' cookies. If bool_url_specific_cookies is 'false', it will return only cookies that will get sent when 'current_url' is requested by the browser. | function get_account_cookies(current_url, bool_url_specific_cookies) {
var domain = get_domain(current_url.split("/")[2]);
var cs = pii_vault.aggregate_data.session_cookie_store[domain];
var account_cookies = {};
bool_url_specific_cookies = (bool_url_specific_cookies == undefined) ? false : bool_url_sp... | [
"function detect_account_cookies(current_url, \n\t\t\t\tcookie_names, \n\t\t\t\topt_config_cookiesets,\n\t\t\t\topt_config_forceshut,\n\t\t\t\topt_config_skip_initial_states,\n\t\t\t\topt_start_params,\n\t\t\t\topt_open_new_window) {\n // This returns an object with keys: domain + path + \":\" + cookie_name and\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
all the functions ends here these empty each succesful combo box whenever change is beign made /when hostel is changed it empty block space room | function changehostel()
{
/*** empty the Block room space when one change the hostel ****/
document.getElementById("blockSelect").innerHTML='';
document.getElementById("roomSelect").innerHTML='';
document.getElementById("spaceSelect").innerHTML='';
/*** Add a default options to them (Block... | [
"function clearDropdownbox() {\n\t\t\t\t\t\tvar fromadd = $('dialogAddCurrencyExchange').find('txtFrom');\n\t\t\t\t\t\tvar fromedit = $('dialogEditCurrencyExchange').find('txtFrom');\n\t\t\t\t\t\tvar toadd = $('dialogAddCurrencyExchange').find('txtTo');\n\t\t\t\t\t\tvar toedit = $('dialogEditCurrencyExchange').find... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2. HTTP Create a function named `lessContent` that will initiate the `Show Less` link after clicking on it. | function lessContent(){
//var less = document.getElementById("less"); same concept of why not needed as last problem
less.style.display = "none";
//you could also do less.HTML = ""; or
} | [
"function showLess() {\n\tdocument.getElementById('readMore').innerHTML =\n\t\t'<a href=\"javascript:showMore()\" class=\"not-tab\" id=\"readMore\">Read More</a>';\n\tdocument.getElementById('more').classList.add('hidden-text');\n}",
"function lessContent(){\n less.style.display = 'none';\n}",
"function less... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For the given pipeline, put the values in the script and json form fields. | function writeOutChanges(pipeline, formFields) {
var generatedScript = wf.toWorkflow(pipeline, steps);
formFields.script.val(generatedScript);
formFields.json.val(stringify.writeJSON(pipeline));
console.log(generatedScript);
} | [
"function pipelineData(pipeline) {\n if (pipeline._embedded.instances[0]) {\n pipeline.is_building = pipeline._embedded.instances[0]._embedded.stages.some(stageIsBuilding);// ? true : false\n pipeline._embedded.instances[0].latest_stage_state_text_class = BUILD_STATE_TEXT_CLASSES[pipeline._embedded.instances... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback to remove customer | function on_customer_remove(username) {
console.debug("Removing: " + username);
var ret = afrimesh.customers.remove(username, function(error, result) {
if (error) {
return console.error("Could not remove customer: " + customer + " - " + error);
}
console.debug("Removed: " + ret... | [
"onRemoveCustomer(customer) {\n this.customerService.removeCustomer(customer).then(() => {\n // refresh our grid\n this.refreshGridDataSource();\n this.updateStateVariables();\n });\n }",
"function removeCustomer(e)\n\t{\n\t\tvar Clients=Pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validateKeys should return true if object has all of the keys from expectedKeys, and no additional keys. It should return false if one or more of the expectedKeys is missing from the object, or if the object contains extra keys not in expectedKeys. | function validateKeys(object, expectedKeys) {
// if the enumerable properties of object is not the same as expectedKeys, return false
if (Object.keys(object).length !== expectedKeys.length) {
return false;
}
// Loop through expectedKeys
for(let i = 0; i < expectedKeys.length; i++) {
// While loop thr... | [
"function vaildateKeys(obj, expectedKeys) {\r\n\r\n //console.log(Object.entries(obj));\r\n //console.log(typeof expectedKeys);\r\n \r\n for (let i=0; i < expectedKeys.length; i++) {\r\n if(!obj.hasOwnProperty(expectedKeys[i])){\r\n \r\n return false;\r\n }\r\n }\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an element and a list of style names, saves the current values of each style, along with a reference to the element. | function saveElementStyles(elem, styles) {
lastElem = elem;
lastElemStyle = getStyleList(elem, styles);
} | [
"styleElement(elem, style) {\r\n let element = elem;\r\n for (let i = 0; i < elem.length || i < 1; i ++) {\r\n if (elem.length) element = elem[i];\r\n for (let key in style) {\r\n element.style[key] = style[key];\r\n }\r\n }\r\n }",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the position of the suggestion box | function setSuggestionBoxPosition() {
var borders = getCssValue(context, 'border-bottom-width') + getCssValue(context, 'border-top-width');
var padding = getCssValue(context, 'padding-bottom') + getCssValue(context, 'padding-top');
context.show();
$suggestionBox.css({
... | [
"_position_autocomplete() {\n const editor = this._expression_editor;\n const last_span = this._expression_editor._edit_area.lastChild;\n\n if (editor.offsetWidth === 250) {\n this._autocomplete._container.removeAttribute(\"style\");\n this._autocomplete._container.classLi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lookup a url in the manifest for this card | function cardManifestUrl(cardManifest, url) {
if (cardManifest && cardManifest.assets && cardManifest.assets[url]) {
return cardManifest.assets[url];
}
} | [
"function getManifestUrl (url) {\n const parsed = urlParse(url);\n if (!(/^itms-services:$/).test(parsed.protocol)) {\n return null;\n }\n const query = qsParse(parsed.query);\n if (!(/^download-manifest$/).test(query.action)) {\n return null;\n }\n return query.url;\n}",
"function loadPhotoCardBased... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render data for products | function renderProductData () {
fetch(`http://localhost:3001/api/products/allBySeller/${dt._id}`).then(res => {
return res.json()
}).then(data => {
setProducts(data)
})
} | [
"function renderProduct(data, product){\n\t$.extend( product, JSON.parse( data.productdata ));\n\tif(product.db_id == null){ product.db_id = data.id };\n\t// makeSideSwitchMenu( product ); \n\tloadImage( product );\n\tloadGrid( product );\n\tloadOptionalImages( product );\n}",
"static renderProducts() {\n\t\tlet ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the first journey to the map | setupJourney(journey, greenWave) {
this.mapJourneys.push(new MapJourney(journey, greenWave));
} | [
"function move_to_start_of_map() {\r\n\r\n\tmap_window_current_x = 0;\r\n\t\r\n\tredraw_map_canvas();\r\n\t\r\n\tredraw_map_position_canvas();\r\n\r\n\treturn;\r\n}",
"function setMarkerFirst(){\n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(map);\n };\n }",
"function setViewToFirs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Undefined$prototype$equals :: Undefined ~> Undefined > Boolean | function Undefined$prototype$equals(other) {
return true;
} | [
"function Nothing$prototype$equals(other) {\n return other.isNothing;\n }",
"function Null$prototype$equals(other) {\n return true;\n }",
"function Boolean$prototype$equals(other) {\n return typeof this === 'object' ?\n equals (this.valueOf (), other.valueOf ()) :\n this === other;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function is called when a card is pulled & released to either direction | function release() {
if (pullDeltaX >= decisionVal) { //if card is released to the right
$card.addClass("to-right");
countCardSwipes();
} else if (pullDeltaX <= -decisionVal) { //if card is released to the left
$card.addClass("to-left");
numOfCards--;
}
if (Math.abs(pullDeltaX... | [
"function holdCardToggle(event) {\n // determine which card was clicked based on the event arguments.\n var pos = event.data.pos;\n\n // flash the card\n display.flashButton($(\"#handCardDisplay\" + pos), \"#eee\");\n\n if (pos >= 0 && pos < hand.length && !handOver && !gameOver) {\n var card ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets the iterator to it initial state. Sets the current property to the first child of list. | reset() {
this.current = this.list.firstChild;
} | [
"setFirstItem() {\n if (this.circular_ && this.head_) {\n this.first_ = this.head_;\n this.last_ = this.head_.prev;\n }\n }",
"reset() {\n this._cur = this._start;\n this.next = this._next;\n this.prev = this._done;\n this.n = -1;\n }",
"resetIterator() {\n this.store.idx = 0;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function which checks if all the items of the array are the same data type. | function dataTypeChecker(arr) {
let dataType = typeof arr[0];
let same = true;
for (let i = 0; i < arr.length; i++) {
if (dataType !== typeof arr[i]) {
return (same = false);
}
}
return same;
} | [
"function checkIfSameDataType(array) {\n\n // loop through array items\n for (let i = 0; i < array.length; i++) {\n\n // for each array item i, compare its type with the type of the items that come after (to avoid double comparisons)\n for (let j = i + 1; j < array.length; j++) {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
BlankArgument is a marker that the argument wasn't typed but is there to fill a slot. Assignments begin with their arg set to a BlankArgument. | function BlankArgument() {
this.text = '';
this.prefix = '';
this.suffix = '';
} | [
"function FalseNamedArgument() {\n this.text = '';\n this.prefix = '';\n this.suffix = '';\n}",
"function IArgument() {\n _classCallCheck$d(this, IArgument);\n }",
"function hasArgumentPlaceholder(node) {\n return node.arguments.some(arg => t.isArgumentPlaceholder(arg));\n }",
"clearArguments() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mutates body objects by modifying them to be suitable for passing to our template | function _mutateBodyObjects(bodyObjects) {
bodyObjects.forEach(function (obj) {
if (obj.time_first) {
obj.time_first = obj.time_first * 1000;
}
if (obj.time_last) {
obj.time_last = obj.time_last * 1000;
}
if (obj.zone_time_first) {
obj.zo... | [
"setBody(body) {\n this.body = body;\n }",
"function addToBody() {\n state.body = state.body || {};\n // ignore if we already have a value\n if (state.body[key] == null) {\n state.body[key] = val;\n }\n }",
"function updateBodypart(bodyObj) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback function for the camera tilt up button. Starts tilting the camera upward at a fixed rate until the button is released. | tiltCameraUp() {
if (APP.conference.isDominantSpeaker) {
this.tiltCamera(1);
}
} | [
"tiltCameraDown() {\n if (APP.conference.isDominantSpeaker) {\n this.tiltCamera(-1);\n }\n }",
"function turnUp(){\n curDirection = 0;\n floorArray[xPos][yPos].src = u_turtle;\n curDirBtn.classList.toggle('selected');\n upBtn.classList.toggle('selected');\n curDirBtn = upBtn;\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compare A with Memory Direct Page Indirect Long 0xC7 | function _cmpADPIndirectLong() {
this.name = "Compare A with Memory Direct Page Indirect Long"
this.argCount = 0;
this.size = Size.MEMORY_A;
this.addrMode = AddressingMode.DIRECT_PAGE_INDIRECT_LONG;
this.mnemonic = 'CMP'
} | [
"function _cmpADPIndirectLongY() {\n\tthis.name = \"Compare A with Memory Direct Page Indirect Long Indexed Y\"\n\tthis.argCount = 0;\n\tthis.size = Size.MEMORY_A;\n\tthis.addrMode = AddressingMode.DIRECT_PAGE_INDEXED_INDIRECT_LONG_Y;\n\tthis.mnemonic = 'CMP'\n}",
"function _cmpADPIndirect() {\n\tthis.name = \"Co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
focus current location of a box or its trajectory, if optional `trajectory` GeoJSON linestring is provided | function focusSelectedBox (trajectory) {
var currentLoc = [
vm.box.currentLocation.coordinates[1],
vm.box.currentLocation.coordinates[0]
];
var bounds = trajectory && trajectory.geometry.coordinates.length
? L.geoJSON(trajectory).getBounds()
: [currentLoc, currentLoc];... | [
"function focusLocation() {\n if ($scope.view.selectedPlace !== undefined & $scope.view.selectedPlace !== '') {\n var location = _.result(_.find($scope.view.places, function (x) { return x.place_id === $scope.view.selectedPlace; }), 'geometry.location');\n if (location !== u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
move task to old task | function moveToOld(currentTasks, newid) {
var now = new Date().getTime();
var spendedTime = now - currentTasks.current.date;
var moveToOld = {
id : currentTasks.current.id,
name : currentTasks.current.name,
date : currentTasks.current.date,
totalSpended : spendedTime,
removed: ... | [
"function moveTask(fromStatusInx, fromTaskInx, toStatusInx, toTaskInx) {\n var task = projects[currentProjectId].status[fromStatusInx].tasks[fromTaskInx];\n projects[currentProjectId].status[fromStatusInx].tasks.splice(fromTaskInx, 1);\n if (toTaskInx == -1) {\n // toTaskInx == -1 means place task a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bind the events on the armband | bind() {
this.armband.on(this.options.triggerEvent, this.snapHandler.bind(this));
} | [
"function bindEvents() {\n\t\t\t//events\n\t\t}",
"function bindEvents() {}",
"bindEvents() {\n\t}",
"_bindEvents()\n {\n \n }",
"bindEvents () {\n\t\t//Bind to any events we need to react to\n\t}",
"function bindEvents() {\n bindSatchelEvent(selectSquare, 'click');\n bindSatchelEvent(highl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets movie review from nyt | function getMovieReview() {
var searchTitle = document.getElementById('title');
var searchTerm = searchTitle.value;
var queryURL =
'https://api.nytimes.com/svc/movies/v2/reviews/search.json?query=' +
searchTerm +
'&api-key=AGFM7Bkp4YHthCReyXQ2KGqDWUyAaMLW';
$.ajax({
url: queryURL,
method: 'GET'
}).then(f... | [
"function retrieveReviews(title) {\n // replaces all spaces in title with underscores\n title = title.replace(/ /g, \"_\");\n\n // uses OMDb api to get ratings for the moves and TV shows\n // uses XML HTTP Request to get data from omdbapi.com\n var xhr = new XMLHttpRequest();\n var url = \"https://www.omdbapi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
20.3.1.2 Day Number and Time within Day | function Day(t) {
typeof t === "number";
return Math.floor(t / msPerDay);
} // 20.3.1.2 Day Number and Time within Day | [
"function getTimeDay() {\n let date = new Date();\n let hours = date.getHours();\n if (hours >= 6 && hours < 12){\n return \"morning\";\n }\n else if (hours >= 12 && hours < 18) {\n return \"day\";\n }\n else if (hours >= 18 && hours < 24) {\n return \"evening\";\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createRows() / /Create the rows for the content. Each row needs an id no. | function createRows() {
/** Create the header row of the table. **/
var h1 = '<thead><tr><th>Sunday</th><th>Monday</th><th>Tuesday</th>';
var h2 = '<th>Wednesday</th><th>Thursday</th><th>Friday</th>';
var h3 = '<th>Saturday</th></tr></thead>';
$('#weeks').append(h1+h2+h3);
/** Create the Body of the t... | [
"function initializeRows() {\n noteContainer.empty();\n var notesToAdd = [];\n for (var i = 0; i < notes.length; i++) {\n notesToAdd.push(createNewRow(notes[i]));\n }\n noteContainer.append(notesToAdd);\n $(document).trigger('appendCompleted');\n }",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Flips card and changes img url animation function | function flipCard(element) {
element.toggleClass("card-front card-back");
setTimeout(function(){
if (element.hasClass("card-front")) {
element.attr("src", images[element.attr("id").slice(3)]);
} else if (element.hasClass("card-back")) {
element.attr("src", "images/lotus.png");
}
},... | [
"function flipper() {\n //flip current card back over\n event.target.style.backgroundImage = cards[0].pic;\n //flip first card back over\n firstFlipped.style.backgroundImage = cards[0].pic;\n \n //also ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test to create a new friendship between two users | function test_create_friendship(user_id_one, user_id_two){
user_model.create_friendship(user_id_one, user_id_two);
} | [
"function createFriendship(newFriend){\n\tBot.post('friendships/create', {user_id: newFriend},\n\t\tfunction (err, data, response){\n\t\t\tif(!err){\n\t\t\t\tconsole.log(\"It worked! You followed a new user: \" + newFriend);\n\t\t\t} else {\n\t\t\t\tconsole.log(\"Nobody new, nobody in the queue. \" + err)\n\t\t\t}\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a cancellation token for the active instance. | function getCancellationToken() {
throw 'Method not implemented';
} | [
"token() {\n return new CancellationToken(this);\n }",
"createCancelToken() {\n const { CancelToken } = axios;\n return CancelToken.source();\n }",
"function getCancelToken(callbackCancel = (cancel) => null) {\n const CancelToken = axios.CancelToken;\n\n return new CancelToken(function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
==================================== Before Step =================================== endregion region After Step ==================================== After Step =================================== | afterStep() {
this.useItems();
this.handleSlimeExplosion();
this.handleBullets();
this.checkHealth();
this.cleanup();
this.spawnMonster();
this.comparePosition();
this.checkProgress();
} | [
"onFinishStep()\n\t\t{\n\t\t}",
"getLastFireStep() {\n return;\n }",
"step() {\n }",
"function DummyStepWrapper() {}",
"function prepare_step_test() {\r\n done = false;\r\n step_count = 0;\r\n}",
"function doStep() {\n step(returnable());\n data = [];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Purpose: This Function is used to open and close the Left NavBar on the screen. Achieved: Addint this functionality makes the panel to dissapear and appear whener the user clicks the customize button on screen. | function triggerNav() {
/*
* navopen var stores the info that the user wants to show the navbar or to hide it.
* navopen is a boolean variable that switches the boolean variable from true to false or vice versa
*/
navopen = !navopen;
/*
* If the navopen is true that means User wants to show t... | [
"function showLeftNav() {\n\t$(\"#p-logo\").removeAttr(\"class\");\n $(\"#pageWrapper\").removeAttr(\"class\");\n\t$(\"#buttonShowHideLeftNav\").html(\"Hide Navigation\");\n}",
"function _leftNavClose() {\r\n\t\t\t$mdSidenav('MyLeftNav').close()\r\n\t\t\t.then(function () {\r\n\t\t\t\t$log.debug(\"close My... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
run given function between beforeCommand and afterCommand | wrapCommand(fn) {
return function() {
this.beforeCommand();
fn.apply(this, arguments);
this.afterCommand();
};
} | [
"function preExecute(commandId, event) {}",
"shouldCall(command) { return false }",
"function AfterSelfExec() {\n}",
"configureCommand() {\n }",
"beforeApply() {}",
"beforeAndAfterRoutine(specificAttack) {\n this.updatePenTestStatus({state: \"running\", description: \"Starting AWS instance\"});\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
restroom object to keep track of restrooms in Distance Matrix as related to Rails objects | function Restroom(attr) {
this.id = attr.id;
this.address = attr.address;
this.duration = attr.duration;
this.distance = attr.distance;
} | [
"function buildRepsObject() {\n\n\n}",
"function populateRestrooms(restRooms) {\n restRooms.forEach(function(marker) {\n\n for (i = 0; i < marker.length; i++) {\n\n var el = document.createElement('div');\n el.className = 'otherMarker';\n\n new mapboxgl.Marker(el)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the feature is unselected, it removes the popup | function onFeatureUnselect(feature) {
clearMapPopup();
selectedFeature=null;
} | [
"function onFeatureUnSelect(evt) {\n feature = evt.feature;\n if (feature.popup) {\n popup.feature = null;\n map.removePopup(feature.popup);\n feature.popup.destroy();\n feature.popup = null;\n }\n}",
"function onPopupClose(evt) {\n selectFeaturesControl.unselect(selectedFe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End Get make list /Get FnGetDeviceTypeList | function FnGetDeviceTypeList(VarFlag){
var VarMake = $('#deviceMake').val();
if(VarFlag == 1){
GblEditDeviceType = '';
GblEditModel = '';
GblEditProtocol = '';
GblEditVersion = '';
$('#deviceType').html('<option value="">Select device type</option>');
$('#deviceModel').html('<option value="">S... | [
"function getdevicelist (dev, callback)\n{\n if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null)\n {\n if (typeof (dev) === 'undefined' || dev === null || dev.length < 1) dev = '-12';\n webphone_api.plhandler.GetDeviceList(dev, callback);\n }\n}",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hides the route summary pane, e.g. when no route is available | function hideRouteSummary() {
$('#routeSummaryContainer').hide();
} | [
"function _hideRouteDetails() {\n if ( initialized && detailsEl ) {\n _dom.removeChild( detailsEl );\n detailsEl = null;\n }\n }",
"hideRouteButtonOnInfo() {\n this._showRouteButton = false;\n this._generateInfoContent();\n }",
"function hideRouteInstructions() {\n\t\t\t$('#rou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implementation of KMeans Clustering | function KMeans() {
this.points = [];
this.clusters = [];
} | [
"function cluster() {\n const options = {\n k: slider.value(),\n maxIter: 100,\n threshold: 0.9,\n };\n // Using the ml5.js library to calculate kmeans;\n kmeans = ml5.kmeans(data, options, clustersCalculated);\n}",
"function cluster(k) {\n var Centroids = this.createCentroids(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
makeUpperLeftForest() Purpose: returns an Object3D containing several trees placed in the northwest corner of the hidden world origin: lower left corner (aligns with the left edge of the hidden world) Parameters: width (number): the length along the xaxis of the triangle that encloses the forest height (number): the le... | function makeUpperLeftForest (width, height) {
var frame = new THREE.Object3D();
//create a curve that defines the border of the forest
//this curve is not added to the frame in any way, it is just used to place the trees
var borderPoints = [new THREE.Vector3(0, 0, 0),
new THREE.Vector3(0.5*width + 2*h... | [
"function makeLowerLeftForest (width, height, numPoints, oscillation, radius) {\n\tvar frame = new THREE.Object3D();\n\n\t//River\n\t//find the length of the river from the given width and height\n\tvar riverStart = new THREE.Vector3(0, 0, 0);\n\tvar riverEnd = new THREE.Vector3(width, 0, height);\n\tvar length = r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Push portfolio summaries to users | function pushSummaries() {
buttonwood.getPortfolioSummaries().then(function(portfolioSummaries) {
_.each(portfolioSummaries, function(portfolioSummary) {
var botInstance = bot.botManager.getBot(portfolioSummary.applicationPlatformEntity);
botInstance.sendPrivateMessage(portfolioSummary);
});
});... | [
"function postPortfolio(request,response, next) {\n\tconsole.log(\"hit post portfolio\")\n\tvar id = request.params.id;\n\tdb.User.findById(id)\n\t.exec(function(err,foundUser){\n\t\tconsole.log(foundUser);\n\t\tfoundUser.stocks.push({name: request.body.name});\n\t\tfoundUser.save(function(err){\n\t\t\tresponse.jso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display Builder Object and Display methods // DisplayBuilder assists in creating output strings for display methods | function DisplayBuilder() {
this.p = "<p>",
this.cp = "</p>"
this.ul = "<ul>",
this.cul = "</u>",
this.li = "<li>",
this.cli = "</li>",
this.div = "<div>",
this.cdiv = "</div>",
this.h3 = "<h3>",
this.ch3 = "</h3>"
} | [
"display() {\n console.log(\"Title: \" + this.title);\n console.log(\"Author: \" + this.author);\n console.log(\"Price: \" + this.price);\n }",
"function Display(options) {\n this.document = options.document || document;\n this.window = this.document.defaultView;\n this.autoHide = false... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pem_format function to restore a public key stored to PEM format for the verification to parse correctly | function pem_format( inkey ) {
var sectionsize = 64;
var st = 0;
var end = 0;
//quick function to restorm PEM format for verification in case it was changed at the storage procedure
// this is not how I like to do this. This is a temp workaround due to time constraints - potential problem that needs to be alter... | [
"get from_pub_pem() {\n let buffer = '-----BEGIN PUBLIC KEY-----\\n';\n\n for (let i = 0; i < this.from_pub.length; ++i) {\n buffer += this.from_pub[i];\n if ((i + 1) % 64 == 0) {\n buffer += '\\n';\n }\n }\n\n buffer = buffer.trim() + '\\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
middleware for matching Dish Id | function dishIdMatch(req,res,next) {
const {dishId} = req.params;
const { data: {id} = {} } = req.body;
if (dishId === id || !id ) {
return next();
}
next({
status: 400,
message: `Dish id does not match route id. Dish: ${id}, Route: ${dishId}.`
});
} | [
"function dataIdMatchesDish(req, res, next) {\n const { dishId } = req.params;\n const { data: { id } } = req.body;\n if (id === dishId || !id) {\n return next();\n } else {\n return next({\n status: 400,\n message: `Dish id does not match route id. Di... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Skip the next token if it is an operator, otherwise die | function skip_op(op) {
if (is_op(op)) {
input.next();
} else {
input.croak(`Expected operator: "${op}"`);
}
} | [
"function skip_op(op) {\n if (is_op(op)) input.next();\n else input.croak(\"Expecting operator: \\\"\" + op + \"\\\"\");\n }",
"function skip_op(op) {\n if (is_op(op)) input.next();\n else input.croak('Expecting operator: \"' + op + '\"');\n }",
"function isOperator(token) {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start a socketio client connection to the primary running server. | function startClient() {
self.log(
'Restarting into client mode due to server already bound to port.');
ioClient = require('socket.io-client')(
self.common.isRelease ? 'http://localhost:8020' : 'http://localhost:8021',
{path: '/www.spikeybot.com/socket.io/control/'});
clientSocketCon... | [
"function startClient() {\n const client = require('socket.io-client');\n if (self.common.isSlave) {\n const host = self.common.masterHost;\n const port = host.host === 'localhost' ?\n (self.common.isRelease ? 8020 : 8021) :\n host.port;\n ioClient = client(`${host.protocol}//... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this._dumpRanges(); Logs the current ranges for debug purposes. | _dumpRanges() {
var text = "Ranges:";
for (var i = 0; i < this.__selectedRangeArr.length; i++) {
var range = this.__selectedRangeArr[i];
text += " [" + range.minIndex + ".." + range.maxIndex + "]";
}
this.debug(text);
} | [
"function debugShowRanges(ranges) {\n console.debug('showing ' + ranges.length + ' ranges');\n $('#all_ranges').append('<hr />');\n for (i in ranges) {\n var uid = ranges[i].user_id;\n var li = '<li>from ' + ranges[i].begin + ' to ' + ranges[i].end + ', by '\n + global_users_by_id[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clean up all the instances that are to be removed from the world e.g. dead monster, bullets | cleanup() {
this.physicsEngine.cleanup(this.toClean);
const gameInstance = this;
this.toClean.forEach(function (name) {
if (typeof gameInstance.objects[name] !== 'undefined') {
delete gameInstance.objects[name];
}
});
this.physicsEngine.cle... | [
"cleanUp() {\n // clear activeEnemies\n this.activeEnemies.forEach(function(enemy) {\n enemy.cleanUp();\n });\n // clear active players\n this.activeObjects.forEach(function(object) {\n object.cleanUp();\n });\n // stop game loop\n this.animation.forEach(functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If a new game starts gamid get +1 | function newGameNumber(){
var gameid = localStorage.getItem("gameID");
gameid++;
localStorage.setItem("gameID", gameid);
} | [
"function getNewGameId(){\r\n let gameId = nextGameId;\r\n nextGameId++;\r\n return gameId;\r\n}",
"function getNextGameId() {\n lastGameId += 257;\n return lastGameId;\n}",
"increaseCurrentGame() {\n this.currentGameNumber = this.currentGameNumber + 1;\n }",
"getNextGameId() {\n\t\treturn this.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reverses the cols of the matrix | _reverseCols() {
this.forEach(arr => {
arr.reverse();
});
} | [
"reverseRows() {\r\n const result = [];\r\n for (let i = 0; i < row; i++) {\r\n result.push(Array(col).fill(0));\r\n }\r\n for (let i = 0; i < row; i++) {\r\n for (let j = 0; j < col; j++) {\r\n result[row - i - 1][j] = this.grid[i][j];\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load dataset to the classifier | function loadDataset() {
knnClassifier.load("./myKNN_kosan.json", updateCounts);
} | [
"function loadDataset() {\n knnClassifier.load('./myKNNDataset.json', datasetLoaded);\n}",
"function loadDataset() {\n knnClassifier.loadDataset('./myKNNDataset.json', updateExampleCounts);\n}",
"async load() {\n this.dataset = new dl.XhrDataset(mnistConfig);\n await this.dataset.fetchData();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
declarations : (VAR (variable_declaration SEMI)+) (procedure_declaration | function_declaration) | empty | declarations() {
const startToken = this.currentToken;
try {
let decls = [];
if (this.currentToken.type === Lexer.TokenTypes.VAR) {
this.eat(Lexer.TokenTypes.VAR);
let nextDecls;
do {
try {
nextDecls = this.variable_declaration();
for (var ... | [
"declarations() {\n let declarations = []\n while (this.token.type === UniqueTokens.VAR.type) {\n this.eat('VAR')\n do {\n declarations = declarations.concat(this.variableDeclarations())\n this.eat('SEMI')\n } while (this.token.type === UniqueTokens.ID.type)\n }\n\n while (t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the pixel location that a col starts at current zoom level | function getRelativeColStart(col) {
var loc = new Point(sets.columns[col],0);
var offset = getRelativePoint(loc);
return offset.x;
} | [
"function firstInColumnLocation(col) {\r\n\t\tvar sets = $['mapsettings'];\r\n\t\tvar point = new Point(sets.columns[col],0);\r\n\t\tvar offset = getRelativePoint(point);\r\n\t\treturn offset.x;\r\n\t}",
"function offset_from_location(row, col){\n\t\tvar offset = $('.tile-board').offset();\n\t\toffset.left += (co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draw the size of the current dataset | function drawSetSize() {
ctx.fillStyle = "white";
let size = data != null ? data.length : 0;
ctx.fillText("TRAINING SET SIZE : " + size, 30, 310);
} | [
"updateSize() {\n this._plotData();\n }",
"onUpdateChartSize() {\n this.render_();\n }",
"determineLabelSize() {\n let width = 0;\n let height = 0;\n for (let k = 0; k < this.lines.length; k++) {\n const line = this.lines[k];\n\n if (line.width > width) {\n wi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new platform instance for the AppleTV plugin. | function AppleTvPlatform(log, config, api) {
const platform = this;
// Saves objects for functions
platform.Accessory = api.platformAccessory;
platform.Categories = api.hap.Accessory.Categories;
platform.Service = api.hap.Service;
platform.Characteristic = api.hap.Characteristic;
platform.UUIDGen = api.h... | [
"function init() {\n\n // setting platform properties\n console.log('setting platform values');\n mcs.MobileBackendManager.platform.model = Device.brandModel;\n mcs.MobileBackendManager.platform.manufacturer = Device.brandName;\n mcs.MobileBackendManager.platform.osName = Device.d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(experimental) Import an existing HTTP Authorizer into this CDK app. | static fromHttpAuthorizerAttributes(scope, id, attrs) {
class Import extends core_1.Resource {
constructor() {
super(...arguments);
this.authorizerId = attrs.authorizerId;
this.authorizerType = attrs.authorizerType;
}
bind() {
... | [
"_attachToApi(restApi) {\n if (this.restApiId && this.restApiId !== restApi.restApiId) {\n throw new Error('Cannot attach authorizer to two different rest APIs');\n }\n this.restApiId = restApi.restApiId;\n const deployment = restApi.latestDeployment;\n const addToLogic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ths method calculate man_cropper boundary start /this method print the selected part of image into a canvas start | function print_to_canvas(){
var img_original_width = man_settings.man_crop_cliped_img.naturalWidth,
img_original_height = man_settings.man_crop_cliped_img.naturalHeight,
img_current_width = man_settings.man_crop_cliped_img.offsetWidth,
img_current_height = man_settings.man_crop_cliped_img.offsetHeight,
image_... | [
"function setBoundary(){\n\tvar cropper_left = man_settings.man_cropper.offsetLeft,\n\t\tcropper_top = man_settings.man_cropper.offsetTop,\n\t\tcropper_width = man_settings.man_cropper.offsetWidth,\n\t\tcropper_height = man_settings.man_cropper.offsetHeight;\n\n\t// left boundary set start------------------\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funnction to take two input and show the relation using =, > or 12 | function relation(a, b) {
if (a < b) {
console.log(a + "<" + b);
}
else {
if (a > b) {
console.log(a + ">" + b);
}
else {
console.log(a + "=" + b);
}
}
} | [
"function relation(a,b) {\n console.log(`${a} == ${b} : ${a == b}`);\n console.log(`${a} > ${b} : ${a > b}`);\n console.log(`${a} < ${b} : ${a < b}`);\n }",
"function getRelationship(x, y) {\n var xIsNum = isNaN(x); //local variable to test if x is a number\n var yIsNum = isNaN(y); //local variabl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter_TableRows ========= ShowTableRow ==================================== PR20200817 | function ShowTableRow(tblRow, tblName_settings) {
// only called by Filter_TableRows
//console.log( "===== ShowTableRow ========= ");
let hide_row = false;
if (tblRow){
// show all rows if filter_name = ""
if (!isEmpty(filter_dict)){
for (let i = 1, el_fldNam... | [
"function Filter_TableRows() {\n //console.log( \"===== Filter_TableRows ========= \");\n\n\n //for (let i = 0, tblRow, show_row; tblRow = tblBody_datatable.rows[i]; i++) {\n // tblRow = tblBody_datatable.rows[i]\n // show_row = t_Filter_TableRow_Extended(filter_dict, tblRow);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts a transaction into the file (while keeping it ordered) | insertTransaction(transaction)
{
// splice it in front of the first element, that is greater
for (let i = 0; i < this.transactions.length; i++)
{
if (transaction.compare(this.transactions[i]) == -1)
{
this.transactions.splice(i, 0, transaction)
... | [
"function transaction() {}",
"function insertTransactions (repo) {\n if (repo.slug in translators) {\n insertCoins(exportTranSymbols(repo))\n translators[repo.slug].insertTransactions(CTX, repo)\n } else {\n // console.debug(`No transactions for repository (${repo.name})`)\n }\n}",
"addTransactionIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a balanced string s, split it in the maximum amount of balanced strings. Return the maximum amount of split balanced string. | function balancedStringSplit(s){
let counter = 0
let res = 0
for(let i = 0; i < s.length; i++) {
if(s[i] === "R") {
counter++
} else {
counter--
}
if(counter === 0) {
res++
}
}
return res;
} | [
"function balancedStringSplit(s) {\n let rCount = 0;\n let lCount = 0;\n let result = 0;\n for (let i = 0 ; i < s.length ; i++) {\n if (s[i] === 'R') rCount += 1;\n if (s[i] === 'L') lCount += 1;\n if (rCount === lCount) {\n result += 1;\n rCount = 0;\n lCount = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs a filter if it exists. You should only ever pass 1 argument to be filtered. The only rule is that the first argument must always be the filter. | function applyFilters()
/* filter, filtered arg, arg2, ... */
{
var args = slice.call(arguments);
var filter = args.shift();
if ('string' === typeof filter) {
return _runHook('filters', filter, args);
}
return MethodsAvailable;
} | [
"function filter( /* filter, filtered arg, arg2, ... */ ) {\n var args = Array.prototype.slice.call( arguments );\n var filterName = args.shift();\n\n if( typeof filterName === 'string' ) {\n return _runHook( 'filters', filterName, args );\n }\n\n return MethodsAvailable;\n }",
"function appl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tabs element focus/blur event handler | _tabsFocusHandler(event) {
const that = this;
if (event.type === 'focus') {
that.bringToFront();
that.setAttribute('focus', '');
}
else {
that.removeAttribute('focus');
}
} | [
"function onFocusableClick () {\n\n\t\t$activeTabElement = $(this);\n\n\t}",
"function listenTabFocus() {\n const navEls = document.querySelectorAll(\"#nav li button\");\n navEls.forEach(function (navEl) {\n navEl.addEventListener('focus', function () {\n navEl.addEventListener('keydown', ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A telemetry processor that handles Azure specific variables. | function azureRoleEnvironmentTelemetryProcessor(envelope, context) {
if (process.env.WEBSITE_SITE_NAME) {
envelope.tags[context.keys.cloudRole] = process.env.WEBSITE_SITE_NAME;
}
} | [
"initializeVariables() {\n this.enabled = this.evaluateEnabled();\n if (this.enabled) {\n const credentials = this.serverless.providers.aws.getCredentials();\n credentials.region = this.serverless.providers.aws.getRegion();\n this.serverless.providers.aws.sdk.config.up... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create home category div and tell how their colors change | function create_home_cate(cate_type, color) {
var blog_grid = document.getElementsByClassName("blog-home-category-grid");
var out_grid = document.createElement("div");
out_grid.setAttribute("class", "col-md-4 " + cate_type + "-grid-out");
out_grid.style.margin = "30px 0px 20px 0px";
blog_grid[0].ap... | [
"function setCategoryColors(category) {\n var color;\n switch (category) {\n case 'football':\n case 'nfl':\n case 'ncaaf':\n case 'nflncaaf':\n category = 'football';\n break;\n case 'basketball':\n case '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will run when the calculate force button is clicked | function onCalculateForce() {
// This function will get all the value when calculate button was clicked
getForceCalculationValue();
// First check if input value contains 2 input
// If the input is empty the variable will contain empty string ""
const onlyForceEmpty = force == "" && mass != "" && accelerati... | [
"function Calculate(){}",
"calculateHandler() {\n\t\tlet formula = this.m_formulaMenu.value;\n\t\tlet formulaFields = this.m_formulaFields.elements;\n\t\tswitch(formula) {\n\t\t\tcase \"PVNRT\":\n\t\t\t\tfor(let i = 0; i < formulaFields.length; i++) {\n\t\t\t\t\tthis.unHighlight(formulaFields[i].id);\n\t\t\t\t}\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initTwilio is currently not used, but I kept it in here for when I want to expand the app to consume this properly. | async initTwilio() {
const { token } = await twilioToken();
const TwilioDevice = await Twilio.Device.setup(token);
return TwilioDevice;
} | [
"function init() {\n read({prompt: 'First time?', default: 'yes'}, (err, yes_no) => {\n if (yes_no == 'yes') {\n console.log('Dope! Lets get you started')\n configureChannels()\n } else if (yes_no == 'no') {\n // send the key to authenticate through twilio\n console.log('Starting up....')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wait for the axis & title to finish rendering before continuing positioning TODO: why are we redrawing multiple times now with this? I guess autoMargin doesn't like being postpromise? | function positionCB() {
var bb;
var innerThickness = thickPx + outlinewidth / 2;
if (ticklabelposition.indexOf('inside') === -1) {
bb = Drawing.bBox(axLayer.node());
innerThickness += isVertical ? bb.width : bb.height;
}
titleEl = titleCont.select('text');
var titleWidth = 0;
var... | [
"function onMeasure() {\n viz_title.attr(\"x\", viz.width() / 2);\n}",
"_positionTitles () {\n\n\t\t// Position to horizontal centre in the middle of the plot area.\n\t\tlet centred = this.plotLeftOffset + (this.plotAreaWidth / 2);\n\n\t\tlet titleBox = getBox(this.titleElement);\n\t\tsetTransform(this.titleEl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
nl.js: Colection of many utilities which are required in different services, directives and controllers | function module_init() {
angular.module('nl.nl', [])
.service('nl', Nl);
} | [
"function utilitiesService() { \r\n var vm = this;\r\n \r\n vm.GetDeviceId = function(){\r\n //Does this can contain error? \r\n monaca.getDeviceId(function(id){\r\n alert('Device ID: ' + id);\r\n \r\n return id;\r\n });\r\n };\r\n \r\n vm.Show... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ONLY AVAILABLE IN NODE.JS RUNTIME. Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed. | async function readStreamToLocalFile(rs, file) {
return new Promise((resolve, reject) => {
const ws = fs__namespace.createWriteStream(file);
rs.on("error", (err) => {
reject(err);
});
ws.on("error", (err) => {
reject(err);
});
ws.on("close", re... | [
"function streamFile(readStream, location, dataListener) {\n return new Promise((resolve, reject) => {\n fs_extra_1.open(location, 'w')\n .then((fd) => {\n /**\n * Create write stream and reject promise on error\n * event\n */\n const wr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the file read stream | getReadStream(fileId, file){
throw new Error('getReadStream is not implemented');
} | [
"readableStream() {\n return fs.createReadStream(this.filePath);\n }",
"getReadStream() {\n const ret = fs.createReadStream(this.fileObj.versions[this.versionName].path)\n return ret;\n }",
"getReadStream() {\n }",
"getStream(location) {\n return this._file(location).createReadStream();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add field to select priority of an item. | function createPriorityField($tr) {
$div = $tr.find('.sitemapitem-priority');
$input = $priorityField.clone();
$input.val($div.data('value'));
$div.html('');
$div.append($input);
$input.on('change',
function() {
... | [
"add(item,priority){\n this.priorities.set(item,priority); \n super.add(item);\n return this;\n }",
"function changePriority(item) {\n\n var p = 0;\n\n if (item.priority <= 0)\n item.priority++;\n else\n item.priority = -1;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wait until syncing completes to scan/setup filters. | function syncWait() {
self.augur.rpc.eth("syncing", {}, function (syncing) {
if (syncing.error){
console.log("RPC error:", syncing.error);
setTimeout(syncWait, 30000);
return;
... | [
"function syncWait() {\n try {\n var syncing = self.augur.rpc.eth(\"syncing\");\n var peers = parseInt(self.augur.rpc.net(\"peerCount\"));\n if (self.debug) console.log(\"syncWait:\", syncing, peers);\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
22 Write a function called scoreInUniversty that takes 1 parameters and returns the alpabet in the unevirsty A => 95100 B => 8594 C => 7084 D=> 5069 F=> 049 Ex: scoreInUniversty(96) => "A" Ex: scoreInUniversty(3) => "F" Ex: scoreInUniversty(71) => "C" | function scoreInUniversty(num) {
if (0 <= num && num <= 49) {
return console.log("F");
} else if (50 <= num && num <= 69) {
return console.log("D");
} else if (70 <= num && num <= 84) {
return console.log("C");
} else if (85 <= num && num <= 94) {
return console.log("B");
} else if (9... | [
"function scoreInUniversty(num)\n {\n if(num>=95&& num<=100)\n \treturn \"A\";\n else if(num>=85&& num<=94)\n \treturn \"B\";\n else if(num>=70&& num<=84)\n \treturn \"C\";\n else if(num>=50&& num<=69)\n \treturn \"D\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch reviews from network | static fetchReviewsFromNetwork(callback) {
const url = "http://localhost:1337/reviews";
return fetch(url).then((response) => {
return response.json();
}).then((reviews) => {
if(reviews) {
callback(null, reviews);
}
}).catch(e => {
const error = (`Request failed. Returned statu... | [
"function getReviews() {\n $http({\n url: api + '/reviews/contract/' + $scope.contract._id,\n method: \"GET\"\n }).then(function(response) {\n // success\n $scope.reviews = response.data\n console.log(response.data)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate eneterd data in contact form | function validateContact() {
var valid = true;
$(".info").html("");
if (
!$("#userName").val() ||
!$("#userEmail").val() ||
!$("#contactReason").val() ||
!$("#content").val()
) {
$("#mail-status").html("<p class='mailError'>All fields required!</p>");
$("#mail-status"... | [
"function validarFormularioContacto(e) {\r\n e.preventDefault();\r\n var nombre = document.getElementById('formNombre').value;\r\n if (nombre.length < 4) {\r\n alert(\"No ha escrito un nombre correcto\");\r\n return false;\r\n }\r\n var apellido = document.getElementById('formApellido').value;\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set Loading Indicator Visibility | _setLoadingIndicatorVisibility() {
const that = this;
if (that.displayLoadingIndicator) {
that.$.loadingIndicatorContainer.classList.remove('jqx-visibility-hidden');
return;
}
that.$.loadingIndicatorContainer.classList.add('jqx-visibility-hidden');
} | [
"_setLoadingIndicatorVisibility() {\r\n const that = this;\r\n\r\n if ( that.appearance.displayLoadingIndicator ) {\r\n that.$.loadingIndicatorContainer.classList.remove( 'lw-visibility-hidden' );\r\n return;\r\n }\r\n\r\n that.$.loadingIndicatorContainer.classList.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |