query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
load the Buyer User Experience | function loadBuyerUX ()
{
// get the html page to load
let toLoad = 'buyer.html';
// if (buyers.length === 0) then autoLoad() was not successfully run before this web app starts, so the sie of the buyer list is zero
// assume user has run autoLoad and rebuild member list
// if autoLoad not yet ru... | [
"function load(req, res, next, userId) {\n _models.Professional.get(userId).then(function (professional) {\n req.professional = professional;\n return next();\n }).catch(function (e) {\n return next(e);\n });\n}",
"async show({ params: { companyId, purchaseId }, request, response, vi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
select parcel from the feature layer by creating a query to look for the input parcel id _______. _______ __ _______ ______ .___________..______ ___ .______ ______ _______ __ / || ____|| | | ____| / || || _ \ / \ | _ \ / || ____|| | | (`| |__ | | | |__ | ,'`| |`| |_) | / ^ \ | |_) | | ,'| |__ | | \ \ | __| | | | __| | ... | function selectParcel(parid) {
if (parid) {
var query = new Query('https://ags.agdmaps.com/arcgis/rest/services/MonongaliaWV/MapServer/' + parcelLayerIDX);
query.where = "dmp = '" + parid.replace(/^0/,'') + "'";
query.outFields = ['*'];
query.returnGeometry = true;
query.outSpatialReference = map.spat... | [
"function selectShapeById( shapeId )\r\n{\r\n\tif( source != undefined && selectController != undefined )\r\n\t{\r\n\t\tvar feature = source.getFeatureById( shapeId );\r\n\t\t\r\n\t\tselectController.getFeatures().clear();\r\n\t\tselectController.getFeatures().push( feature );\r\n\t}\r\n}",
"function selectByCoor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Selects all checkboxes for current page. | function do_select_all() {
var baseurl = document.getElementById('selfurl');
// Make asynchronous call to self page with flag to select all for current page
YUI().use("io-base", function(Y) {
var uri = baseurl.value + "&do_select_all=1";
var cfg = {
method: 'POST',
sy... | [
"function do_deselect_all() {\n var baseurl = document.getElementById('baseurl');\n // Make asynchronous call to end point to deselect all for current page\n YUI().use(\"io-base\", function(Y) {\n var uri = baseurl.value + \"&action=bulk_checkbox_selection_deselectall\";\n var cfg = {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
everything necessary to be displayed when movies.html is loaded | function setMoviesPage() {
// display movie genres list
listMovieGenres();
// display movie year list with forwarded range data
listMovieYears(2000, 2021)
// display popular movies at page startup
displayPopularMovies();
} | [
"displayMovieFromLS() {\n const movies = this.getMovieFromLS()\n movies.forEach(movie => {\n this.addMovieToUI(movie)\n })\n }",
"function populateMyMoviesPage() {\n\tgetjson('https://user-enter-luke.firebaseio.com/users.json')\n\tp.then(function(data) {\n\t\tmoviesAdded = [];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Triangle. 5 points. Write a function that draws a right triangle on the canvas. The triangle should be outlined only, not filled. You'll need to prompt the user for the lengths of each of the sides. By default, position your triangle so that its leftmost and topmost points have X and Ycoordinates of 10. When drawing yo... | function drawTriangle() {
let sides = [Number(prompt("Side 1: ")), Number(prompt("Side 2: ")), Number(prompt("Side 3: "))];
sides.sort(function(a, b){return a-b});
const canvas = document.getElementById("canvas4");
const context = canvas.getContext("2d");
context.clearRect(0, 0, canvas.width, canvas.height);
... | [
"function triangleArea() {\n var a = parseInt(document.getElementById('side1').value);\n var b = parseInt(document.getElementById('side2').value);\n var c = parseInt(document.getElementById('side3').value);\n\n var s = ((a + b + c) * 0.5);\n area = Math.sqrt(s * (s - a) * (s - b) * (s - c));\n area = area.toF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace this with element | replace (element) {
element = makeInstance(element);
this.node.parentNode.replaceChild(element.node, this.node);
return element
} | [
"replaceChild() {\n if (this.el) {\n this.el.innerHTML = \"\";\n }\n\n this.isDomified = false;\n this.contents = [];\n this.atts = [];\n this.props = [];\n\n this.appendChild.apply(this, arguments);\n }",
"setHtml(element, html){\n element.html(html);\n }",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds the province selector | function buildProvince (countryNodeElement, provinceNodeElement, selectedValue) {
var selectedOption = getOption(countryNodeElement, selectedValue);
var provinces = JSON.parse(selectedOption.getAttribute('data-provinces'));
provinceNodeElement.options.length = 0;
if (provinces.length) {
buildOptions(provi... | [
"function selectProvinceAndDistrict(value){\n\t// if the inpput which should be select is province . means when country is changed\n\tif(value == \"province\"){\n\t\tvar country = document.getElementById(\"country\").value;\n\t\tvar province = document.getElementById(\"province\");\n\t\tvar district = document.getE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or sets the opacity to use for the underline ripple element. | get underlineRippleOpacity() {
return this.i.cm;
} | [
"set opacity(value) {\n this._opacity = value;\n }",
"function opacity(elm) {\r\n var v = elm.style.opacity || elm.currentStyle.opacity;\r\n\r\n _style.setOpacity(elm, _float(v) || 1.0);\r\n}",
"set strokeOpacity(num) {\n var stroke = SLD.stroke(this._symbolizer)\n stroke.setOpacity(ST... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================================================================== Processes a new input file and return its compressed length. This function does not perform lazy evaluationof matches and inserts new strings in the dictionary only for unmatched strings or for short matches. It is used only for the fast compres... | function deflate_fast() {
while (lookahead !== 0 && qhead === null) {
var flush; // set if current block must be flushed
// Insert the string window[strstart .. strstart+2] in the
// dictionary, and set hash_head to the head of the hash chain:
INSERT_STRING();
// Find the longest match, discarding th... | [
"function compression(str){\n \n let output = '';\n let count = 0;\n for(let i = 0; i < str.length; i++) {\n count++;\n if(str[i] != str[i + 1]) {\n output += str[i] + count;\n count = 0;\n }\n }\n return output; \n }",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Layer mask constant to select ignore raycast layer. | static set IgnoreRaycastLayer(value) {} | [
"static set DefaultRaycastLayers(value) {}",
"function hideLayers(evt) {\r\n dialogLayer.style.display = \"none\";\r\n maskLayer.style.display = \"none\";\r\n }",
"function hasLayerMask() {\n var hasLayerMask = false;\n try {\n var ref = new ActionReference();\n var keyUserMaskEnabled = app... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
35.Write a function called findFactors which accepts a number and returns an array of all of the numbers which it is divisible by starting from 1 and going up to the number. | function findFactors(num){
let result=[];
for(let i=1; i<=num; i++){
if (num%i === 0) result.push(i);
}
return result;
} | [
"function getFactors(num)\n{\n const numArray = [];\n \n for (i = 1; i < num; i++)\n if (isFactor(num, i))\n numArray.push(i);\n return numArray;\n}",
"function prime_factors(num) {\n function is_prime(num) {\n for (let i = 2; i <= Math.sqrt(num); i++)\n {\n if (num % i =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets up a key manager to listen to keyboard events on the overlay panel. | _initKeyManager() {
this._keyManager = new _angular_cdk_a11y__WEBPACK_IMPORTED_MODULE_6__["ActiveDescendantKeyManager"](this.options)
.withTypeAhead(this._typeaheadDebounceInterval)
.withVerticalOrientation()
.withHorizontalOrientation(this._isRtl() ? 'rtl' : 'ltr')
... | [
"function enableKeyEvents() {\n lumx.isFocus = true;\n $document.on('keydown keypress', _onKeyPress);\n }",
"function loadEventListeners() {\n addKeyCallback(Phaser.Keyboard.ONE, changeState, 1);\n}",
"function InputManager(){\n\t/**\n\t * @var private attr\n\t */\n\tvar prv={};\n\n\t/**\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ADD WATCHED VIDEOS TO ARRAY AND SAVE AND UPDATE ARRAY IN LOCAL STORAGE | function pushVideosToWatchedList(title_content, image_url, video_url) {
recently_watched_videos.push({ title: title_content, image: image_url, video: video_url });
localStorage.setItem('watchedVideosArray', JSON.stringify(recently_watched_videos));
} | [
"function checkWatchedVideos(title_content, image_url, video_url) {\n recently_watched_videos = JSON.parse(localStorage.getItem('watchedVideosArray'));\n\n if (recently_watched_videos.length == 0) {\n // ADD FIRST VIDEO TO JSON\n pushVideosToWatchedList(title_content, image_url, video_url);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle streamspecific frames (stream id !== 0). | _handleStreamFrame(streamId, frame) {
switch (frame.type) {
case _RSocketFrame.FRAME_TYPES.CANCEL:
this._handleCancel(streamId, frame);
break;
case _RSocketFrame.FRAME_TYPES.REQUEST_N:
this._handleRequestN(streamId, frame);
break;
case _RSocketFrame.FRAME_TYPES.REQU... | [
"streamHandshakeHandler(msg) {\n\n // Also his only role is to receive the message and log it. It doesn't even\n // do anything useful with it. Gods what a stupid handler.\n console.log(JSON.parse(msg.data));\n\n let start_msg = {\n \"client_id\": this.id,\n \"rover... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Execute to test "getFileNameIdMap()". | function run_getFileNameIdMap() {
var fileNameIdMap = getFileNameIdMap();
Logger.log(fileNameIdMap);
} | [
"function getShipMapKeyFromFileName(filename)\r\n{\r\n return \"_\" + filename.match(/-(.*)Shipyard/)[1]\r\n}",
"function mockedExecFile(util, args, doneCallback) {\n let outputFileName = args[args.length - 1];\n\n copyTestFile(outputFileName, function(copyTestFile) {\n doneCallback();\n });\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create ThreesFives() that adds values from 100 and 4000000 (inclusive) if that value is evenly divisible by 3 or 5 but not both. Display the final sum in the console. | function ThreesFives()
{
var sum = 0;
for(var i = 100; i <= 4000000; i++)
{
if((i % 3 == 0 || i % 5 == 0) && (i % 15 !== 0))
{
sum += i;
}
}
console.log(sum);
} | [
"function multipleOfThree() {\n for (let i = 1; i <= 100; i++) {\n if (i % 3 == 0 && i % 5 == 0) {\n console.log(\"CSC225 RULES I LOVE JAVASCRIPT\");\n } else if (i % 3 == 0) {\n console.log(\"CSC225 RULES\");\n } else if (i % 5 == 0) {\n console.log(\"I LOVE JAVASCRIPT\");\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if running in Android Tablet device | function isAndroidTablet() {
if (navigator.userAgent.match(/iPad/i) != null)
return true;
else
return false;
} | [
"function chkMobile() {\r\n\treturn /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);\r\n}",
"function useTouch() {\n return isNativeApp() || $.browser.mobile || navigator.userAgent.match(/iPad/i) != null;\n}",
"function deviceHasTouchScreen() {\n let hasTouchScreen = false;\n if (\"maxTouchPoints\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return div with class accountname | function accName(name) {
let temp = document.createElement("DIV");
temp.className = "account-name";
temp.innerHTML = `<a href="#">${name}</a>`;
return temp;
} | [
"function getNickName() {\r\n \r\n return $(\"#loggedin\").text().substring(9);\r\n \r\n \r\n }",
"function orksSpecificClansStratagems() {\r\n var orks_clan_name = orksClanName();\r\n return document.getElementById('orks').getElementsByClassName... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize a Blockly workspace, and add a change listener to update the display of generated code. Called from index.html when the page initially loads. | function start() {
// Create main workspace.
workspace = Blockly.inject('blocklyDiv', {
toolbox: toolbox,
});
workspace.addChangeListener(event => {
const code = javascript.javascriptGenerator.workspaceToCode(workspace);
document.getElementById('generatedCodeContainer').value = code;
});
} | [
"function init() {\n // Render the HTML.\n document.body.innerHTML = Puzzle.html.start(\n {lang: BlocklyGames.LANG,\n html: BlocklyGames.IS_HTML});\n\n BlocklyInterface.init(BlocklyGames.getMsg('Games.puzzle', false));\n\n const rtl = BlocklyGames.IS_RTL;\n const blocklyDiv = BlocklyGames.getElement... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
js functoin to remove row of param when onlick event is fired. onclick="removeParam(this)" if we put it inside angular app module, it does not work cus para element is dynamic unless we frequently compile it every time we add/remove param so that angular knows what it is | function removeParam (element) {
$(element).closest('tr').remove ();
} | [
"function para_del(name) {\n\tif (confirm(\"Do you want to delete this parameter?\")) {\n\t\tpara.remove(\"task='\" + document.getElementById('task').value + \"' and name='\" + name + \"'\");\n\t\tpara_fetch();\n\t\t$('#' + name.replace(/[^a-zA-Z 0-9]+/g, '').replace(/\\s+/g, \"\")).remove();\n\t\ttot();\n\t}\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Window_ModPatchConfig Collection of Windows together let a user set parameters; Contains a Window_Selectable, 3 buttons, a confirm window, a Window_Textbox for input, and a help window | function Window_ModPatchConfig() {
this.initialize.apply(this, arguments);
} | [
"function Window_ModPatchCreate() {\r\n this.initialize.apply(this, arguments);\r\n}",
"function createPluginsGui() {\n\n var widgets = [],\n toggles = {type:'panel', layout: 'vertical', label: false, alphaStroke: 0, widgets:[], width:200, contain: false, innerPadding: false, padding: 0},\n fa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to update bar chart | function drawUpdateBar(){
d3.select("#bar-cover #bar-chart").selectAll("svg").remove();
drawBar();
} | [
"function updateTotalBarChart() {\n\n // variable\n let xValues = [];\n let yValues = [];\n\n // to get total number of favourites for each skill for x-axis and y-axis values\n for (let i = 0; i < total_list.length; i++){\n xValues.push(total_list[i][0]);\n yValues.push(total_list[i][1]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used for sorting Android targets, example strings to sort: android19 androidL Google Inc.:Google APIs:20 Google Inc.:Glass Development Kit Preview:20 The idea is to sort based on largest "suffix" number meaning the bigger the number at the end, the more recent the target, the closer to the start of the array. | function sort_by_largest_numerical_suffix (a, b) {
let suffix_a = a.match(suffix_number_regex);
let suffix_b = b.match(suffix_number_regex);
// If no number is detected (eg: preview version like android-R),
// designate a suffix of 0 so it gets moved to the end
suffix_a = suffix_a || ['0', '0'];
... | [
"function sortNumberedArrayByName(stringArray)\n{\n stringArray.sort((elem1, elem2) =>\n {\n strippedElem1 = elem1.substr(elem1.indexOf(' ') + 1);\n strippedElem2 = elem2.substr(elem2.indexOf(' ') + 1);\n return strippedElem1.localeCompare(strippedElem2);\n });\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
More efficient than the previous two methods if you need children AND staff because it only calls the API once | getAllChildrenAndStaff() {
var users = JSON.parse(this.getAllUsers()).data;
var staff = [];
var children = [];
users.forEach(user => {
if (['lowStaff', 'upStaff', 'sysOverseer'].includes(user['permission'])) {
staff.push(user);
} else {
... | [
"children(person) {\n return person.sons;\n }",
"_setChildren(item, data) {\n // find all children\n const children = data.filter((d) => item.id === d.parent);\n item.children = children;\n if (item.children.length > 0) {\n item.children.forEach((child) => {\n // recursively call... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove pin (and attachments) from map | removeFrom(map) {
if (map.hasLayer(this.marker)) {
map.removeLayer(this.marker);
}
if (this.type === PIN_TYPE.MORTAR || this.type === PIN_TYPE.FOB) {
this._removeAttachments(map);
}
} | [
"function eraseMap() {\n document.body.removeChild(map);\n }",
"function removeAddress(){\n\tif(activeCounter >0){\n activeCounter--;\n\t\tif(markers[counter] != null){\n\t\t\tmarkers[counter].setMap(null);\n\t\t\tmarkers[counter] = null;\n if(activeCounter ==0){\n //if no active markers anymor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bring heading into focus for AT announcements | function focusHeading () {
let heading = document.querySelector('h1, h2, h3, h4, h5, h6');
if (!heading) return;
if (!heading.hasAttribute('tabindex')) { heading.setAttribute('tabindex', '-1'); }
heading.focus();
} | [
"_expandHeading(heading) {\n heading.expanded = true;\n }",
"function changeHeading1() {\n let h1, newHeading;\n newHeading = document.getElementById(\"textInput\").value;\n if (newHeading.trim() == \"\") {\n alert(\"Please enter a heading\");\n } else {\n h1 = document.getElemen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter a parse tree produced by Java9ParserexceptionType. | enterExceptionType(ctx) {
} | [
"visitException_declaration(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitTryStatement(node){\r\n var key = this.addToCFG(node);\r\n this.node_stack[this.current_class][this.current_function].push(key);\r\n this.visit(node.block);\r\n this.catch_clauses[this.current_class][t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that adds the shake class to all images for .5 seconds, then removes | function shake() {
const allImgs = document.querySelectorAll('.img-thumbnail');
for (let i = 0; i < allImgs.length; i++) {
allImgs[i].classList.add('shake');
}
setTimeout(function() {
for (let i = 0; i < allImgs.length; i++) {
allImgs[i].classList.remove('shake');
}
}, 500);
} | [
"function removeShake() {\n document.getElementById('input').classList.remove('shake')\n}",
"function shakeAdd(){\n openCards[0].classList.add('shake');\n openCards[1].classList.add('shake');\n}",
"function upAndDownShake() {\n \t\tif (counter < numberOfShakes) {\n\n \t\t//Reset the element's positio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `BucketEncryptionProperty` | function CfnBucket_BucketEncryptionPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but receiv... | [
"function CfnStorageLens_EncryptionPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hide playing pieses for class=pieces1 and class=pieces2 | function hidePlayingPieces() {
document.querySelectorAll('.pieces1').forEach(function(el) {
el.style.display = 'none';
});
document.querySelectorAll('.pieces2').forEach(function(el) {
el.style.display = 'none';
});
const hidePlayAgainButton = document.qu... | [
"function displayPlayingPiecesTwo() {\n document.querySelectorAll('.pieces2').forEach(function(el) {\n el.style.display = 'grid';\n });\n displayPlayAgainButton();\n }",
"function displayPlayingPiecesOne() {\n document.querySelectorAll('.pieces1').forEach(function(el) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is passed into actions when they are "warmed up". If the action decides that it has its result, without the need to await anything else, then it can call this function to force "early termination". When early termination occurs, all actions which were queued prior to the terminator will be skipped. If the... | function early(m, terminator){
cancel();
cold.clear();
if(async && action !== terminator){
action.cancel();
while((it = queue.shift()) && it !== terminator) it.cancel();
}
settle(m);
} | [
"function maybeHalt() {\n taskEnding();\n maybeExit();\n return null;\n}",
"function Sequence$cancel(){\n\t cancel();\n\t action && action.cancel();\n\t while(it = nextHot()) it.cancel();\n\t }",
"nextActionWithoutRetry() {\n this._actionRetryStatus = false;\n }",
"function next () {\n v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Boost damage by specified percentage | boostDamage(duration, percentage) {
if (!this._isActive)
return
util.log("player " + (this.id + 1), "damage +" + percentage + "% for " + duration + " seconds")
this.game.add.existing(new FadingText(this.game, this, "+" + percentage + "% damage\n(" + duration + " sec)"))
thi... | [
"_setDamagePercentage(percentage) {\n this.primaryWeapon.setDamagePercentage(percentage)\n this.secondaryWeapon.setDamagePercentage(percentage)\n }",
"receiveDamage(damage) { \n this.health = this.health - damage ;\n }",
"getAverageDamage() {\n const avgAttacks = (this.minAttacks... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: dwscripts.queueDocEditsForParticipant DESCRIPTION: ARGUMENTS: RETURNS: | function dwscripts_queueDocEditsForParticipant(partName, paramObj)
{
extPart.queueDocEdits("", partName, paramObj, null); // no group name or sbObj
} | [
"function extPart_queueDocEdits(groupName, partName, paramObj, sbObj)\n{\n var location = extPart.getLocation(partName);\n \n // NOTE: This only updates the location for insertion.\n // Finds will need to be done separately, if they\n // rely on this new location.\n if (paramObj.MM_location != nul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return whether given city can build given unit; returns FALSE if unit is obsolete. | function can_city_build_unit_now(pcity, punittype)
{
return (pcity != null && pcity['can_build_unit'] != null
&& pcity['can_build_unit'][punittype['id']] == "1");
} | [
"function can_city_build_unit_direct(pcity, punittype)\n{\n /* TODO: implement*/\n return true;\n}",
"function city_has_building(pcity,\n\t\t pimprove)\n{\n /* TODO: implement. */\n return false;\n}",
"function is_valid_ucum_unit(unit) {\n if (unitValidityCache[unit] != null) {\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Response to the client asking to show hot seat question text. | showHostShowHotSeatQuestionText(socket, data) {
this.currentSocketEvent = 'showHostShowHotSeatQuestionText';
Logger.logInfo(this.currentSocketEvent);
// Get a new hot seat question, because this is the first we so of it.
this.serverState.hotSeatQuestion = this.hotSeatSession.getNewQuestion(
this.... | [
"showHostRevealHotSeatQuestionVictory_Continuation() {\n this.serverState.setCelebrationBanner({\n header: '',\n text: MONEY_STRINGS[this.serverState.hotSeatQuestionIndex]\n });\n this.serverState.resetHotSeatQuestion();\n\n // If the hot seat player won the million, the next option should be ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines the circle's stroke width, based on the provided diameter. | function getStroke(diameter) {
return $mdProgressCircular.strokeWidth / 100 * diameter;
} | [
"get strokeWidth() {\n var stroke = SLD.stroke(this._symbolizer);\n return Number(stroke.getWidth());\n }",
"function determineDiameter() {\n var height = square_div_array[0].clientHeight;\n var width = square_div_array[0].clientWidth;\n // how to return most correct size circle?\n return (le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate the 100 P(x|f(x)) for a given range [x1; x2] | function applyFunction(x1, x2, f){
var data = [];
for (var i = 0, x; i <= 100; ++i) {
x = x1 + i * (x2 - x1) / 100;
data.push([x, f(x)]);
}
return data;
} | [
"function probabilityGenerator(n, probabilities){\n //plan\n // generate a random int between 0 and 100\n // if int is probability[i] + all previous proababilies times 10\n // return n[i]\n\n}",
"function computeEachPoint(min, max, fx)\n{\n let xData = [];\n let yData = [];\n const step = 0.1;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returnPrefixStr: se 'condition' e' vera, ritorna 'prefixStr'+'inputStr', altrimenti solo inputStr; | function returnPrefixStr(inputStr,condition,prefixStr)
{
return ((eval(condition))?prefixStr:"")+inputStr;
} | [
"function returnPostfixStr(inputStr,condition,postfixStr)\n{\n \treturn inputStr+((eval(condition))?postfixStr:\"\");\t\t\n}",
"function getPrefixFromConf(prefix) {\n\n var values = Object.keys(prefixList).map(function(key) {\n return prefixList[key];\n });\n\n var position = valuePosition(prefix... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
call filterRectangle or filterCircle depending on the values of rx and ry | function returnFilteredRectangleOrCircle(rect) {
if (rect.rx.baseVal.value == 0 && rect.ry.baseVal.value == 0) { // no values that define a radius
return filterRectangle(rect);
} else {
return filterCircle(rect);
}
} | [
"function rayXcircle(rx, ry, dx, dy, cx, cy, r, type){\n\n\tvar xx = cx - rx; \n\tvar yy = cy - ry; \n\tvar b = ( xx * dx + yy * dy );\n\tvar c = xx * xx + yy * yy - r * r;\n\tif ( b * b - c > 0 ){\n\t\n\t\tvar q = Math.sqrt( b * b - c );\n\t\t\n\t\tif ( type != 2 )\n\t\t\tif ( b - q >= 0)//Outside of circle\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Execute the sort using the input array and a second buffer as work space. Returns one of those two, containing the final result. | function exec(arr, comp) {
if (typeof(comp) !== 'function') {
comp = function (a, b) {
return String(a).localeCompare(b)
};
}
// Short-circuit when there's nothing to sort.
var len = arr.length;
if (len <= 1) {
return arr
}
// Rather than dividing input, simply it... | [
"function sortOn(arr) {\n var comparators = [];\n for (var i=1; i<arguments.length; i+=2) {\n comparators.push(getKeyComparator(arguments[i], arguments[i+1]));\n }\n arr.sort(function(a, b) {\n var cmp = 0,\n i = 0,\n n = comparators.length;\n while (i < n && cmp === 0) {\n cmp = com... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts the relevant hints for this ancestor from a module locatio;n | getLocationHints(location) {
if (location.hints) {
// Get the hints targeted to this ancestor type
const hints = location.hints[this.ancestorName] || {};
// If there is a path ID node for this ancestor's child in the hints, return it
const thisPath = this.get... | [
"diagnosticDetectDuplicateAncestorScriptImports() {\n var _a, _b;\n if (this.xmlFile.parentComponent) {\n //build a lookup of pkg paths -> FileReference so we can more easily look up collisions\n let parentScriptImports = this.xmlFile.getAncestorScriptTagImports();\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
exports canvases as JPEGs for upload to API | function exportImages() {
let frontImage = frontCanvas.toDataURL({format: 'jpeg'});
let backImage = backCanvas.toDataURL({format: 'jpeg'});
clearGuides();
console.log('Exporting canvases as images...');
// return front and back images
return(
{
'front' : frontImage,
... | [
"function convertCanvastoImage(){\n var filename=document.getElementById(\"filename\").value;\n var canvas=document.getElementById(\"canvasID\"+pageCanvas);\n canvas.toBlob(function(blob){\n\t saveAs(blob, filename +\".jpg\");\n }, \"image/jpg\");\n $(\"#configPopUp\").dialog('destroy');\n\treturn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get all courses in the course bin alreadytaken list | function getTakenCourses() {
var courseNodes = document.getElementById("alreadyTaken").children;
var courses = new Array;
for ( i = 0; i < courseNodes.length; i++) {
//courses[courseNodes[i].id]=courseNodes[i].innerText;
courses.push(courseNodes[i].id);
}
return courses;
} | [
"findStudentCourses(courseArray){\r\n \tlet studentCourseList = [];\r\n \tfor(let courseName of courseArray){\r\n studentCourseList.push(this.courses.get(courseName));\r\n\t\t}\r\n\t\treturn studentCourseList;\r\n\t}",
"function getAllCourses(callback) {\n var url = createUrl(\"core_enrol_get_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display Chapter with a dynamic hyperlink to rules | function Chapter ({rule}){
return <Link href={'/rules/' + rule.id} key={rule.id} >
<a className={styles.single}>
<h3>{ rule.id }) { rule.text }</h3>
</a>
</Link>;
} | [
"function displayChapter(chapter, idChapter) {\n return function() {\n initDisplay();\n\t\n /**\n * Changing the style of the curretn chapter in summary\n\t \t */\n for (var i = 0; i < chaptersListArray.length - 1; i++) {\n\t document.getElementById(\"chapter\" + i).style.background = \"#120D16\";\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a function which can verify the return type for a function. | function createFunctionReturnGuard (path: NodePath, context: VisitorContext): void {
const {node, scope} = path;
let annotation = node.returnType;
if (annotation.type === 'TypeAnnotation') {
annotation = annotation.typeAnnotation;
}
if (isGeneratorAnnotation(annotation)) {
annotation = a... | [
"giveExpressionHasCorrectReturnType(expression, func) {\n const giveType = expression === null ? null : expression.type;\n const returnType = func.returnType;\n doCheck(\n (expression === null && returnType === null) ||\n this.typesAreEquivalent(giveType, returnType),\n `Expected function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset all highlighted squares to their normal colors (i.e., black or white). | function removeOldHighlights() {
var i, div;
// Reset the colors
for (i = 0; i < squaresWithHighlights.length; ++i) {
div = document.getElementById(squaresWithHighlights[i].pos);
div.style.backgroundColor =
chess.board.isWhiteSquare(squaresWithHighlights[i].pos) ?
... | [
"function clearColor(){\n for (var i = 0; i < squares.length; i++) {\n squares[i].bgColor = 'white';\n }\n}",
"function resetDrawingHighlights() {\n abEamTcController.resetDrawingHighlights();\n}",
"function resetColours() {\n\tvar circles = document.getElementsByClassName('round-button-circle_1');\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given only the CID of the root of the HashMap, load it and print its contents | async function dump (rootCid) {
const map = await load(store, rootCid, { blockHasher, blockCodec })
console.log('ENTRIES ===========================')
for await (const [key, value] of map.entries()) {
console.log(`[${key}]:`, value)
}
console.log('STATS =============================')
console.log('size:... | [
"function display_All()\n{\n\t\t\ti = 0;\n\t\t\twhile (i < trueNodeids.length) {\n\t\t\t\tconsole.log(trueNodeids[i].id);\n\t\t\t\ti++;\n\t\t\t}\n}",
"load(){\n const file_name = \"hashdumpyard.json\"\n const fs = require('fs')\n const dumped = fs.readFileSync(file_name)\n this.primary... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ZzFX Zuper Zmall Zound Zynth v1.1.8 By Frank Force 2019 ZzFX Features Tiny synth engine with 20 controllable parameters. Play sounds via code, no need for sound assed files! Compatible with most modern web browsers. Small code footprint, the micro version is under 1 kilobyte. Can produce a huge variety of sound effect ... | function zzfx() {
return ZZFX.play.apply(ZZFX, arguments);
} // zzfx object with some extra functionalty | [
"function texttoMusic(string) {\n \n //There are three different synths users can choose.\n switch (selectedSound) {\n case 1:\n var synth = new Tone.SimpleSynth().fan(waveform).toMaster();\n break;\n\n case 2:\n var synth = new Tone.MonoSynth().fan(waveform).toMaster();\n break;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method called to initialize the provider. Each derived class should provide their own implementation. | initializeProvider() {
if (this.graphProxyUrl !== undefined) {
this.provider = new ProxyProvider(this.graphProxyUrl);
Providers.globalProvider = this.provider;
}
} | [
"setProvider(provider) {\n this.provider = provider;\n }",
"constructor() { \n \n ComputeInfoProtocol.initialize(this);\n }",
"async initialize() {\n this.loadEnv();\n this.loadConfiguration();\n }",
"constructor() { \n \n S3StorageConfig.initialize(th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is called when user clicks on search button when changing the office | function searchChangeOfficeDetails() {
var strPinCode = $("#txtChangeOfficeBookingSearchPinCode").val().trim();
var strAreaName = $("#txtChangeOfficeBookingSearchAreaName").val().trim();
var strCityName = $("#txtChangeOfficeBookingSearchCityName").val().trim();
// Validating if user entered atleast one searc... | [
"function search() {\n\t\tvar searchVal = searchText.getValue();\n\n\t\tsources.genFood.searchBar({\n\t\t\targuments: [searchVal],\n\t\t\tonSuccess: function(event) {\n\t\t\t\tsources.genFood.setEntityCollection(event.result);\n\t\t\t},\n\t\t\tonError: WAKL.err.handler\n\t\t});\n\t}",
"async function searchButton... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PRIVATE: last Y coordiante of a touch add a click to the gcb_clickPointX/Y array. if nopop is specified, no timeout is set to clear the click. | function gcb_addClick ( x, y, nopop )
{
gcb_clickPointX.push (x);
gcb_clickPointY.push (y);
if (!nopop)
{
setTimeout (gcb_popClick, 5000);
}
} | [
"function clickOnPoint() {\n var x = 58,\n y = 275;\n _DygraphOps[\"default\"].dispatchMouseDown_Point(g, x, y);\n _DygraphOps[\"default\"].dispatchMouseMove_Point(g, x, y);\n _DygraphOps[\"default\"].dispatchMouseUp_Point(g, x, y);\n }",
"function mouseApasat(ev) {\n x1 = my_canv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Normalize `value` with patterns. | function normalize(value, patterns) {
var index = -1
while (++index < patterns.length) {
value = value.replace(patterns[index][0], patterns[index][1])
}
return value
} | [
"function normalize(value, patterns) {\n var length = patterns.length;\n var index = -1;\n var pattern;\n\n while (++index < length) {\n pattern = patterns[index];\n value = value.replace(pattern[0], pattern[1]);\n }\n\n return value;\n}",
"function normalizeToMask(value, length) {\n if (length > 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function serves as a resolution handler for our current future. It will tell the current action that the future resolved, and it will settle the current tick with the action's answer to that. | function resolved(x){
if(async) context = cat(future.context, cat(asyncContext, context));
settle(action.resolved(x));
} | [
"function rejected(x){\n\t if(async) context = cat(future.context, cat(asyncContext, context));\n\t settle(action.rejected(x));\n\t }",
"function updateFutureFlag(treeModel) {\n let found = false;\n forEach(treeModel.actionLog, (actionItem) => {\n actionItem.future = found;\n if (action... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper function to write transaction entries to file | function writeTransactionToFile(filepath, filename, transaction, errorCallback) {
// check if file exists
if (!fs.existsSync(filepath)) {
fs.mkdirSync(filepath);
}
if (!fs.existsSync(filepath + filename)) {
fs.appendFileSync(filepath + filename, process.env.TRANSACTIONS_FILE_HEADER + '\n');
}
// w... | [
"function writeInventory(){\n var inventoryText = '';\n for(var i = 0; i < inventory.length-1; i++){\n inventoryText += inventory[i] + '\\n';\n }\n inventoryText += inventory[inventory.length-1];\n var blob = new Blob([inventoryText], {type: \"text/plain;charset=utf-8\"});\n console.log(inven... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
decides whether to display the "There are no items" text based on how many items there are. also decides whether to animate the height the invisible div, so we don't have an uncomfortable jerky motion | function decideNoItems() {
//getting number of items and deciding what to do.
var numberofitems = $container.find(".active").size();
console.log("no. items: " + numberofitems);
//if the number of items is zero, show the message and smooth scroll
if(numberofitems <= 0) {
//showing the message
... | [
"function revealEnd() {\n this.index = this.items.length;\n for (var i=0; i<this.items.length; i++) {\n var para = this.items[i];\n para.style.visibility = \"visible\";\n }\n}",
"function showEmptyWarning() {\n\tif(!$(\"ul\").has(\"li\").length) {\n\t\t$('#emptyWarning').show();\n\t\t$('#em... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find id of current note being displayed | function findCurrentNote() {
return $("#current-note-display")[0].getAttribute("data-id");
} | [
"function getNoteByID(id) {\n let db = note.notes\n for (let i = 0; i < db.length; i++) {\n let nte = db[i]\n if (nte._id == id) {\n return nte\n }\n }\n}",
"function selectNote() {\r\n selectedNote = this;\r\n}",
"function firstNote() {\n var firstTimeButtons ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get an array of numbers, one per cell, that reflect the meta field contents and an object with some info about the field. call onDone(arr, metaInfo) when done. Keep all compressed arrays in metaCache; Numerical meta data (int/float) is discretized, binning info is written to metaInfo.binInfo and the original data is ad... | function onMetaDone(comprBytes, metaInfo) {
self.metaCache[metaInfo.name] = comprBytes;
var ArrType = cbUtil.makeType(metaInfo.arrType);
var bytes = comprBytes; // some Apache/InternetBrowser combinations silently uncompress
var comprView = new Uint8Array(comprBytes);
... | [
"function metaFieldData(xmlObj)\n{\n var app = xmlObj.app; // top level is the app\n\n console.log(app);\n\n if(!app.hasOwnProperty('metaData')) {\n\treturn(null);\n }\n \n var metaFields = app.metaData[0].field; // array of field objects\n\n var fields = [];\n\n for(v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
De functie rightArrowKey is in het geval je de rechter pijl drukt om de volgende image te zien. Wanneer de event property gelijk is aan de keycode van de rechterpijl wordt er eerst gekeken of hij al in de zoom mode is. Dit om veilig te zijn zodat hij het alleen uitvoert in de zoom mode. Daarna wordt eerst de popup verw... | function rightArrowKey(e) {
if (e.keyCode === RIGHTARROW_KEY) {
if (zoomedIn === true) {
document.body.removeChild(document.getElementById('popup'));
fillZoom(nextImage);
}
}
} | [
"function leftArrowKey(e) {\n if (e.keyCode === LEFTARROW_KEY) {\n if (zoomedIn === true) {\n document.body.removeChild(document.getElementById('popup'));\n fillZoom(previousImage);\n }\n }\n}",
"displayRight2() {\n image(arrowImg[0], this.arrowRightX, this.arrowRightY... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given GitHub's slightly odd link parameter response for pagination, extract the data into a usable "metadata" format. | function getMetaData(linkHeader) {
if(!linkHeader) return null;
var metadata = {
first_page: 1,
last_page: null,
next_page: null,
prev_page: null
};
var linkArr = linkHeader.split(',');
_.each(linkArr, function (link) {
var start_pos = link.indexOf('<') + 1;
var end_pos = link.inde... | [
"extractMetadata(content) {\n const metadata = {};\n const both = this.splitHeader(content);\n\n // if no content returned, then that means there was no header, and both.header is the content\n if (!both.content) {\n if (!both.header) {\n return { metadata, rawContent: content };\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end main function ///// manage brand keywords function | function manageBrandKeywords() {
//create selector for keywords labeled with brand keyword label
var labelSelector = AdWordsApp.labels()
.withCondition("Name = 'brand-keyword'");
//create iterator for label
var labelIterator = labelSelector.get();
Logger.log('the number of labels is: ' + la... | [
"function labelBrandedKeywords() {\n var keywordSelector = AdWordsApp.keywords()\n //only select enabled campaigns\n .withCondition(\"CampaignStatus = ENABLED\")\n //only select brand named campaigns\n .withCondition(\"CampaignName CONTAINS_IGNORE_CASE 'Brand'\")\n //ignore display campaig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extended Resource Settings storeOffline: true, resourceName: openmrs.provider usesEncryption: true, primaryKey : "uuid" queryFields : all (for now) | function getResource() {
r = $resource(OpenmrsSettings.getContext() + "/ws/rest/v1/provider/:uuid",
{uuid: '@uuid', v: v},
{query: {method: "GET", isArray: false}}
);
return new dataMgr.ExtendedResource(r,true,resourceName,false,"uuid",null);
} | [
"function getResource() {\n var v = \"custom:(uuid,username,systemId,roles:(uuid,name,privileges))\";\n r = $resource(OpenmrsSettings.getContext() + \"/ws/rest/v1/user/:uuid\",\n {uuid: '@uuid', v: v},\n {query: {method: \"GET\", isArray: false}}\n );\n return new dataMgr.ExtendedR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test if potential opening or closing delimieter Assumes that there is a "$" at state.src[pos] | function isValidDelim(state, pos) {
var prevChar, nextChar,
max = state.posMax,
can_open = true,
can_close = true;
prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;
nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;
// Check non-whitespace conditions for ope... | [
"function isValidDelim(state, pos) {\n let max = state.posMax, can_open = true, can_close = true;\n const prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1, nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;\n // Check non-whitespace conditions for opening and closing, and\n // check ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Swarm input node will return the most recent checkin since the node has been initialized. The node will only populate msg.payload with the JSON of the checkin if a new checkin has been made within the polling interval. | function SwarmInNode(n) {
RED.nodes.createNode(this, n);
var node = this;
var credentials = RED.nodes.getCredentials(n.foursquare);
var credentialsOk = checkCredentials(node, credentials);
if (credentialsOk) {
var repeat = 900000; // 15 minutes
var now = M... | [
"function SwarmQueryNode(n) {\n RED.nodes.createNode(this, n);\n var node = this;\n this.request = n.request || \"get-most-recent-checkin\";\n var nodeCredentials = RED.nodes.getCredentials(n.foursquare);\n checkCredentials(node, nodeCredentials);\n this.on(\"input\", funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the left frustum plane transformed by the transform matrix | static GetLeftPlaneToRef(transform, frustumPlane) {
const m = transform.m;
frustumPlane.normal.x = m[3] + m[0];
frustumPlane.normal.y = m[7] + m[4];
frustumPlane.normal.z = m[11] + m[8];
frustumPlane.d = m[15] + m[12];
frustumPlane.normalize();
} | [
"static GetRightPlaneToRef(transform, frustumPlane) {\n const m = transform.m;\n frustumPlane.normal.x = m[3] - m[0];\n frustumPlane.normal.y = m[7] - m[4];\n frustumPlane.normal.z = m[11] - m[8];\n frustumPlane.d = m[15] - m[12];\n frustumPlane.normalize();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write the new string into the range provided without modifying the size of arr. If the size of arr changes, then ranges from the parsed code would be invalidated. Since str.length can be shorter or longer than the range it is overwriting, write str into the first position of the range and then fill the remainder of the... | function write(arr, str, range) {
const offset = range[0];
arr[offset] = str;
for (let i = offset + 1; i < range[1]; i++) {
arr[i] = undefined;
}
} | [
"function clearRange(value, start, end) {\n return value.substring(0, start) + value.substring(end);\n }",
"function addStr(arr, str) {\n let newStr = []\n for(const item of arr){\n {\n newStr.push(item + \" \" + str)\n }\n }\nr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the y coordinate (top) position given parent window and child window height. the returned y value is used to center child window. | function aeGetCenterTop(aParentWindow, aChildHeight)
{
var y = 0;
var parentH = aeGetWindowHeight(aParentWindow);
if (parentH > 0)
{
var top = aParentWindow.screenTop ? aParentWindow.screenTop : aParentWindow.screenY;
y = top + (parentH - aChildHeight)/2;
}
return y;
} | [
"function findAbsolutePosY(obj)\n{\n var curtop = 0;\n if (document.getElementById || document.all)\n {\n while (obj.offsetParent)\n {\n curtop += obj.offsetTop;\n if (obj.offsetParent != document.body)\n curtop -= obj.offsetParent.scrollTop;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for getV3ProjectsIdRepositoryTree | getV3ProjectsIdRepositoryTree(incomingOptions, cb) {
const Gitlab = require('./dist');
let defaultClient = Gitlab.ApiClient.instance;
// Configure API key authorization: private_token_header
let private_token_header = defaultClient.authentications['private_token_header'];
private_token_header.apiKey = 'YOUR... | [
"function getProjectbyId(project_id){\n\n}",
"function ReposOwnerRepoGitTreesTree() {\n _classCallCheck(this, ReposOwnerRepoGitTreesTree);\n\n ReposOwnerRepoGitTreesTree.initialize(this);\n }",
"function getProjectbyID() {\n vm.showProjectLoading = true;\n projectsSvc.getProjectByOr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a view mask with Vue | mask (id, options) {
if (!MVC.ComponentJS.plugin("vue"))
throw new Error("mask: requires ComponentJS Vue plugin")
if (typeof MVC.jQuery.markup !== "function")
throw new Error("mask: requires jQuery Markup")
let opts = Object.assign({
te... | [
"function getMaskViewport({\n bounds,\n viewport,\n width,\n height\n}) {\n if (bounds[2] <= bounds[0] || bounds[3] <= bounds[1]) {\n return null;\n } // Single pixel border to prevent mask bleeding at edge of texture\n\n\n const padding = 1;\n width -= padding * 2;\n height -= padding * 2;\n\n if (vie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
top 5 crime players function | function getTopCrimePlayers() {
$.get('http://nflarrest.com/api/v1/player', function(data) {
//console.log(data)
// compare function of array object properties to sort by arrest_count
function compare(a,b) {
if (a.arrest_count < b.arrest_count) {
return 1;
} else if (a.arrest_count > b.ar... | [
"function getTopCrimeTeams() {\r\n\t\t$.get('http://nflarrest.com/api/v1/team', function(data) { \r\n\t\t\t//console.log(data);\r\n\t\t\t\r\n\t\t\t// create compare function to sort by arrest_count\r\n\t\t\tfunction compare(a,b) {\r\n\t\t\t\tif (a.arrest_count < b.arrest_count) {\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Requests that a new user be added to the database via POST. The user's username and password are fetched from the DOM. | function addUser() {
const username = document.getElementById('usernameUserSection').value;
const password = document.getElementById('password').value;
const dataToSend = JSON.stringify({username: username, password: password});
const url = `${URL_BASE}/add/user`;
const request = new XMLHttpRequest... | [
"async function createUser() {\n const response = await fetch(`/api/users/`, {\n method: 'POST',\n body: JSON.stringify(userData),\n headers:{\n 'Content-Type': 'application/json'\n }\n });\n\n if (response.status !== 200) {\n // A server side error occured. Display the\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get array of unique series from two arrays | function getUniqueSeries(arrayA, arrayB) {
var uniqueSeries = (arrayA || []).concat(arrayB || [])
.reduce(function (acc, cur) {
acc[cur.name + cur.index] = cur;
return acc;
}, {});
return Object.keys(uniqueSeries).map(function (ix) {
return uniqueSeries[ix];
});
} | [
"function mergeUnique(arr1, arr2) {\n return arr1.concat(arr2).filter((element, index, array) => array.indexOf(element) === index)\n //return Array.from(new Set(concat(arr1, arr2))\n}",
"function removeDuplicatesNoHash(arr1, arr2) {\n let answer = [];\n\n for(let i=0; i < 6; i++) {\n let start = 0;\n le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function for combining behaviors to fill in a config / object from an array of provided configs. Will, by default, error / when a field gets two values that aren't ===equal, but you can / provide combine functions per field to do something else. | function combineConfig(configs, defaults, // Should hold only the optional properties of Config, but I haven't managed to express that
combine = {}) {
let result = {};
for (let config of configs)
for (let key of Object.keys(config)) {
let value = config[key], current = result[key];
... | [
"function combineConfig(configs, defaults, // Should hold only the optional properties of Config, but I haven't managed to express that\n combine = {}) {\n let result = {};\n for (let config of configs)\n for (let key of Object.keys(config)) {\n let value = config[key], current = re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adding list in appdata | function addListToAppData(e, list){
const newList = {
id: list.getAttribute('data-id'),
title: 'New List',
tasks: []
};
appData.lists.board.push(newList)
} | [
"function setAppData(appData) {\n self.LApp.data = appData;\n $log.debug('success storing application data');\n }",
"function saveRealmList() {\n \"use strict\";\n window.gmSetValue(\"realmList2\", realmList);\n}",
"addList(list) {\r\n this.#listList.set(list.listId, li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renew a FIO Address on the FIO blockchain. | renewFioAddress(fioAddress, maxFee, technologyProviderId = null) {
const renewFioAddress = new SignedTransactions.RenewFioAddress(fioAddress, maxFee, this.getTechnologyProviderId(technologyProviderId));
return renewFioAddress.execute(this.privateKey, this.publicKey, this.returnPreparedTrx);
} | [
"renewFioDomain(fioDomain, maxFee, technologyProviderId = null) {\n const renewFioDomain = new SignedTransactions.RenewFioDomain(fioDomain, maxFee, this.getTechnologyProviderId(technologyProviderId));\n return renewFioDomain.execute(this.privateKey, this.publicKey, this.returnPreparedTrx);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for wrapping a value as an ElementaryValueProper WARNING: this function does not check its inputs! Please check before using! How to use: numbers may be BN, number, or numeric string strings should be given as strings. duh. bytes should be given as hex strings beginning with "0x" addresses are like bytes; chec... | function wrapElementaryValue(value, definition) {
let dataType = types_1.Types.definitionToType(definition, null); //force location to undefined
switch (dataType.typeClass) {
case "string":
return new StringValueProper(dataType, value);
case "bytes":
... | [
"static bytes22(v) { return b(v, 22); }",
"static bytes23(v) { return b(v, 23); }",
"static bytes21(v) { return b(v, 21); }",
"static bytes(v) { return new Typed(_gaurd, \"bytes\", v); }",
"function createInputElement(actorShader, propertyName, value) {\n// always4 ja columns\n \"use strict\";\n var type ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when a project information is fully loaded | function projectInfoLoaded(id, projectName, contributors) {
projects.push({ name : projectName, id : id, contributors : contributors});
// Waits for all the project to be loaded before sending the data back to client //
if (projects.length == nbProject) {
sendData(client, "listProject", p... | [
"function loadProjects() {\n API.getProjects()\n .then((res) => setProjects(res.data))\n .catch((err) => console.log(err));\n }",
"function loadProject() {\n\t\t/*\n\t\t//use temp project stubs here \n\t\tvar project = project1;\n\t\tfor (var i = 0; i <= project.tasks.length - 1; i++) { \n\t\t\taddT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw all the labels around the circle | function draw_labels() {
//Calculate some of the mid and endpoints of lines to get rough positions for the labels
var bottomThetaX = ((inverseWavelength/6) + 6) * Math.cos(degToRad(0.5 * theta))
var bottomThetaY = ((inverseWavelength/6) + 6) * Math.sin(degToRad(0.5 * theta))
var topThe... | [
"function _drawDiagramLabels(paper, label)\n{\n // main label on the top\n paper.text(10, 26, label).attr({\"text-anchor\": \"start\", \"font-size\": \"12px\", \"font-family\": \"sans-serif\"});\n\n // label for y-axis\n var yAxis = paper.text(-27, 100, \"# Mutations\").attr({\"text-anchor\": \"start\",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
region Roll box UI | _showBox () {
if (Renderer.dice._$wrpRoll.css("display") !== "flex") {
Renderer.dice._$minRoll.hide();
Renderer.dice._$wrpRoll.css("display", "flex");
Renderer.dice._$iptRoll.prop("placeholder", `${Renderer.dice._getRandomPlaceholder()} or "/help"`);
}
} | [
"rollBet() {\n\t\tthis.startRoll();\n\t\tshowBetButtons();\n\t}",
"function createLockLevelPopUp(){\n\t\t\t\t\t\t\tvar levelChoose=new lib.levelChooseBoard();\n\t\t\t\t\t\t\tlevelChoose.x=myStage/2-levelChoose.nominalBounds.width/2;\n\t\t\t\t\t\t\tlevelChoose.y=myStage/2-levelChoose.nominalBounds.height/2;\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserfield_spec. | visitField_spec(ctx) {
return this.visitChildren(ctx);
} | [
"function extractField(depth, prefix, fields) {\n const width = 50;\n for (const f in fields) {\n\n // deal with arrays\n if (Array.isArray(fields[f])) {\n view_sql += ` -- enumerating array ${f} ...\\n`;\n view_sql += ` , val... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Writes data streams to a sheet. | function writeGA4StreamsToSheet() {
const selectedProperties = getSelectedGa4Properties();
const streams = listSelectedGA4Streams(selectedProperties);
writeToSheet(streams, sheetNames.ga4.streams);
} | [
"async function exportResults(data) {\n // new excel doc\n let day = new Date().getDate()\n let month = new Date().getMonth()\n let year = new Date().getFullYear()\n let hour = new Date().getHours()\n let minutes = new Date().getMinutes();\n let date = `${month + 1}-${day}-${year}_${hour}-${min... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
, "J.S") Check If objOne Is Equal to objTwo | function isEqual(objOne, objTwo) {
// console.log(objOne);
return JSON.stringify(objOne) === JSON.stringify(objTwo) ? true : false;
} | [
"function isEqualPass(obj1,obj2){\r\n\t var pw1 = obj1.value;\r\n\t var pw2 = obj2.value;\r\n\t \r\n\t if(pw1.length ==0 || pw2.length ==0){\r\n\t\t return true;\r\n\t }\r\n\t if(pw1 == pw2){\r\n\t\t return false;\r\n\t }\r\n\t \r\n\t return true;\r\n }",
"function equivalent(x,y){\n\tif(JSON.stringify(clone(x)) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Have the function TrappingWater(arr) take the array of nonnegative integers stored in arr, and determine the largest amount of water that can be trapped. The numbers in the array represent the height of a building (where the width of each building is 1) and if you imagine it raining, water will be trapped between the t... | function TrappingWater(arr) {
let area = 0;
for (let i = 1, m = Math.max(...arr); i < m + 1; i ++) {
for (let i2 = 0, gate = false; i2 < arr.length; i2 ++) {
let freeSpace = arr[i2] < i;
if (!freeSpace)
gate = true;
else if (gate)
area ++;
}
}
return area;
} | [
"function waterArea(heights) {\n const maxes = new Array(heights.length).fill(0)\n let leftMax = 0;\n for (let i = 0; i < heights.length; i++) {\n const height = heights[i];\n maxes[i] = leftMax;\n leftMax = Math.max(leftMax, height);\n }\n let rightMax = 0;\n // find the righ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the indexth row of the current matrix to the vector4 values | setRow(index, row) {
return this.setRowFromFloats(index, row.x, row.y, row.z, row.w);
} | [
"setat(row,column,value)\n\t{\n\t\tif (row >= 0 && row < 4 && column >= 0 && column < 4 )\n\t\t\tthis._data[row][column] = value;\n\t}",
"normalize(){\n for (var column = 0; column < 4; column++){\n for(var row = 0; row < 4; row++){\n this.matArray[column][row]\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======================================================================== startApp This is the last step in the launch. Check the servant for validity, mixed content and certificate. The servant is up and running, so load the Results Analytics HTML ======================================================================== | function startApp(adviseLaunchInfo) {
$simjq.when(checkServantURLValidity(adviseLaunchInfo))
.then(function(token){
if (token.length > 0){
if(!adviseLaunchInfo.noServant){
showLoadingMessage(adviseLaunchInfo.translator.translate('LAUNCH_READING_DATA'),
... | [
"async function launchStartScreen() {\n\t\ttry {\n\t\t\t// console.trace();\n\t\t\tlet _tally_meta = await store(\"tally_meta\"),\n\t\t\t\tpageToShow = \"/get-anonyname\";\n\n\t\t\t// don't launch in development\n\t\t\tif (T.options.localhost) return;\n\n\t\t\t// don't launch if !server\n\t\t\tif (!_tally_meta.serv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API bool IsItemVisible(); // is the last item visible? (aka not out of sight due to clipping/scrolling.) | function IsItemVisible() { return bind.IsItemVisible(); } | [
"function areChildrenVisible(item) {\n // we do not want to populate item with \n if (typeof item.ChildrenVisible != \"undefined\") {\n return item.ChildrenVisible;\n } else {\n return true;\n }\n }",
"itemCanBeRendered(index) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a constraint div so map can't be dragged out of view. | function createConstraint()
{
constraint.css({
left : -(map.width()) + viewport.width(),
top : -(map.height()) + viewport.height(),
width : 2 * map.width() - viewport.width(),
height : 2 * map.height() - viewport.height()
});
// Check if map is currently out of bounds, revert to closest posit... | [
"addMinimapCutout(posX, posY, minimapWidth, minimapHeight) {\n let cutout = new Phaser.GameObjects.Graphics(this);\n cutout.fillRect(posX, posY, minimapWidth, minimapHeight);\n // let mask = new Phaser.Display.Masks.GeometryMask(this, cutout);\n let mask = new Phaser.Display.Masks.Bitmap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hack to get the HTML of a jquery object as a string. | function jQueryToString(jq) {
return $(document.createElement("div")).append(jq).html();
} | [
"get html() {\n return (this._htmlElement || this._element).innerHTML;\n }",
"function $Html(id, value){\n\n if (typeof value != 'undefined'){\n $O(id).innerHTML = value\n }\n return $O(id).innerHTML\n}",
"get html() {\n return this.element.innerHTML;\n }",
"function copyObjectJQu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
move the user's map marker | function moveMarker(latitude, longtitude)
{
map.setCenter({ lat: latitude, lng: longtitude });
userMarker.setPosition({ lat: latitude, lng: longtitude });
} | [
"function changeMarker(location) {\n\tmyMarker.setPosition(location);\n\tmyMap.setCenter(location);\n\t$( \"#user_pos\" ).text( \"User Position: \" + location.toUrlValue() );\n}",
"function moveSouth() {\n currentLatPoint -= 0.00050\n console.log(currentLatPoint)\n map.setView([currentLatPoin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Group Solution: Alicia, Noi, Shauna Facilator: Lo write a function that takes in an array of the 05 of the people in the friend group and then based on who says they're interested, return an array of the people who will actually go to the movies. Write the Suedo Code in order of the | function movieNight (names) { // create an function that accepts an array
let attending =[]; // a place where the attendee will go
//if David is in the name array, add David to the attending array
if (names.includes('David')) {
attending.push('David');
console... | [
"function getPersonWorks(p){\r\n let works = [];\r\n \r\n //console.log(p); \r\n for(let i = 0; i < p.directed.length; i++){\r\n let movieId = p.directed[i];\r\n\r\n if(!works.includes(movies[movieId]))\r\n works.push(movies[movieId]);\r\n }\r\n\r\n for(let i = 0; i < p.written.length; i++){\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ensure the certificate and key provided are valid and if not throw an easy to debug error | function validateKeyAndCerts({ cert, key, keyFile, crtFile, }) {
let encrypted;
try {
// publicEncrypt will throw an error with an invalid cert
encrypted = crypto_1.default.publicEncrypt(cert, Buffer.from('test'));
}
catch (err) {
logger_1.default.error `The certificate path=${cr... | [
"if (keystorePassword === null || keystorePassword === undefined) {\n throw new RequiredError('keystorePassword','Required parameter keystorePassword was null or undefined when calling sslSetup.');\n }",
"function checkAPIKey() {\n if (mashapeAPIKey == null) {\n console.error('ERROR:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method clicks on the "Orders" link in the header | clickOrders() {
return this
.waitForElementVisible('@ordersLink', 10000, (res) => {
if (res.value == true) {
if (res.status !== undefined) {
this
.click('@ordersLink');
} else {
this
.api.execute((selector) => {
do... | [
"clickPayByCheckLink() {\n this.lnkPayByCheck.click();\n }",
"clickConfirmMyOrder() {\n this.waitUtil.waitForElementToBeClickable(\n this.btnConfirmMyOrder,\n 15000,\n \"Confirm My Order\"\n );\n this.btnConfirmMyOrder.click();\n }",
"clickCart() {\n cy.get(CART_LINK_CSS)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a student (li element's ID, ex: "cu_1") to the supplied team list (ul element's ID, ex "team_1_0") | function addStudentToTeam(studentId, teamId) {
$("#" + studentId).slideUp('slow', function () {
$('#' + teamId).find('.TeamSortable').append($("#" + studentId));
$("#" + studentId).slideDown('slow');
});
} | [
"function createTeam(evt, teamName) {\n var divId = \"teamDiv_\" + teamCounter + \"_0\";\n var listId = 'team_' + teamCounter + \"_0\";\n if (teamName == undefined) {\n teamName = \"Team \";\n\n //Add leading zero as requested in CodePlex ticket #695\n if (teamCounter < 10) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a list of directive indices and minified input names, sets the input properties on the corresponding directives. | function setInputsForProperty(inputs, value) {
for (var i = 0; i < inputs.length; i += 2) {
ngDevMode && assertDataInRange(inputs[i], directives);
directives[inputs[i]][inputs[i + 1]] = value;
}
} | [
"function setInputAttributes(element, attributes) {\n for (let key in attributes) {\n element.setAttribute(key, attributes[key]);\n }\n }",
"function addInputNames() {\n $( '#mp-cc-num' ).attr( 'name', 'mp_cc_num' );\n $( '#mp-cc-exp' ).attr( 'name', 'mp_cc_exp' );\n $( '#mp-cc-cv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check the current time and compare it to the note due time, converts the current time to yyyy/mm/dd check every note in the local storage for date calls new_note function | function checkOutTime(){
const json = localStorage.getItem("array");
const notee = JSON.parse(json);
const nowtime = new Date();
const convertime = nowtime.toISOString();
for (let i=0; i < array.length; i++){
const notetimendate = array[i].fdate + "</br>" + array[i].ftime;
if (notetimendate > conv... | [
"function checkForNote() {\n fetch(`/api/notes/${dateNow}`, {\n method: \"GET\",\n headers: { \"Content-Type\": \"application/json\" },\n })\n .then((response) => response.json())\n .then((data) => {\n if (data.length != 0) {\n const replace = `<a href=\"/day/${dateNow}\"><span class=\"uk-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
after registering an extensible extension root f, f(currentMark) is called at the start of each gc invocation and is expected to return an array with Haskell heap objects to be treated as extra roots. | function h$registerExtensibleRetentionRoot(f) {
h$extensibleRetentionRoots.push(f);
} | [
"createExtensionManager() {\n const coreExtensions = this.options.enableCoreExtensions\n ? Object.values(extensions)\n : [];\n const allExtensions = [...coreExtensions, ...this.options.extensions].filter(extension => {\n return ['extension', 'node', 'mark'].includes(ex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detects which sanitizer to use for URL property, based on tag name and prop name. The rules are based on the RESOURCE_URL context config from `packages/compiler/src/schema/dom_security_schema.ts`. If tag and prop names don't match Resource URL schema, use URL sanitizer. | function getUrlSanitizer(tag, prop) {
if ((prop === 'src' && (tag === 'embed' || tag === 'frame' || tag === 'iframe' ||
tag === 'media' || tag === 'script')) ||
(prop === 'href' && (tag === 'base' || tag === 'link'))) {
return ɵɵsanitizeResourceUrl;
}
return ɵɵsanitizeUrl;
} | [
"formatUrls(props) {\n this.href = props.href && typeof props.href === 'object' ? format(props.href) : props.href;\n this.as = props.as && typeof props.as === 'object' ? format(props.as) : props.as;\n }",
"getUrl (name) {\n name = name.name ? name.name : name\n return this.urls[name]\n }",
"vaidat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update total hits given log timestamp | updateTotalHits (timestamp) {
const currentTimestamp = this._getTimestamp()
if (timestamp < currentTimestamp) {
console.log(`Skipping since log timestamp ${timestamp} is older than current timestamp ${currentTimestamp}`)
return
}
const slot = timestamp % this.TOTAL_HITS_INTERVAL
// In... | [
"function addKeyHit(key) {\n if (debug)\n console.log('varcache: Recorded hit on key: \"' + key + '\".');\n\n hitCount++;\n\n if (typeof hitLog[key] === 'undefined')\n hitLog[key] = [];\n\n hitLog[key].push(new Date());\n}",
"entryTimeTotal({ commit }, data) {\n let time = [];\n\n data.forEach(ele... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get local fs path from WFS URL. This checks protocol/fsid/outoffs problems. | function getPathFromUrl(wfsUrl) {
var wfsUrlObj = URI(wfsUrl);
//logger.debug('getPathFromUrl parsed url', wfsUrlObj);
if (wfsUrlObj.protocol() !== 'wfs') {
logger.info('Invalid protocol', wfsUrlObj);
return null;
}
var fsid = wfsUrlObj.host();
if (!fsid) {
logger.info('I... | [
"function normalizePathnameForWindows(url) {\n const windowsDriveRegex = /\\/[a-zA-Z]{1}:\\//;\n const { pathname = '' } = url;\n\n if (windowsDriveRegex.test(pathname)) {\n const driveMatch = pathname.match(windowsDriveRegex)[0];\n\n return pathname.replace(driveMatch, driveMatch.replace('/', ''));\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function changes the distortion level to a specific amount | distortionLevel(amt) {
if (!this.isTransitioning) {
this.isTransitioning = false;
TweenLite.to(this.settings, 1, {
transition: amt,
speed: this.currentMap.speed,
dispScale: this.currentMap.scale,
ease: Power2.easeInOut,
onComplete: () => {
this.isTransit... | [
"function abilityModifier(ability){\n return Math.floor((ability - 10)/2)\n}",
"function updateStats(level) {\n that.level = level\n that.image = MyGame.constants.towers.assets[that.type][that.level];\n that.radius = MyGame.constants.towers.stats[that.type][that.level].range;\n that... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This compares two automobiles based on their type. The ordering from "greatest" to "least" is as follows: roadster, pickup, suv, wagon, (types not otherwise listed). It should be case insensitive. If two cars are of equal type then the newest one by model year should be considered "greater". | function typeComparator(auto1, auto2) {
// converting to lowercase to avoid case sensitivity
var t1 = auto1.type.toLowerCase();
var t2 = auto2.type.toLowerCase();
// first case is equal models that must resort to yr comparison
if (t1 == t2) {
if (auto1.year > auto2.year) {
return... | [
"function typeComparator(auto1, auto2)\n{\n /************************************************************************************\n * orderType *\n * This function takes an automobile object as a parameter and then checks the type *\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |