query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Check if the user has the right the permissions in the study. | static checkPermissions(study, user, permissions) {
if (!study || !user || !permissions) {
console.error(`No valid parameters, study: ${study}, user: ${user}, permissions: ${permissions}`);
return false;
}
// Check if user is the Study owner
const studyOwner = stu... | [
"permissionCheck() {\n var patients = intercomponentData.getPatients(); // get current user's array of patients\n if (patients.filter(includesPat => includesPat.patient_id === this.state.patient_id).length) {\n return true;\n } else {\n return false;\n }\n }",
"function CheckP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update product variant title based on selected variant ============================================================ | function updateVariantTitle(variant) {
$('#buy-button-1 .variant-title').text(variant.title);
} | [
"function updateVariantTitle(variant) {\n $('#ext-product .variant-title').text(variant.title);\n }",
"function updateProductTitle(title) {\n $('#ext-product .product-title').text(title);\n }",
"function setSelectedVariant(variant, isBundle) {\n \n \t// update the elements\n\t\t$('#price').tex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns player to last position. Used when trying to move to an illegal space. | returnToLastPos() {
if (this.previousPos) {
this.x = this.previousPos.x
this.y = this.previousPos.y
}
} | [
"function assignLastPosition() {\n lastPosition.row = playerPosition.row;\n lastPosition.column = playerPosition.column;\n}",
"get_move_back() {\n let dir = cw(cw(this.dir));\n let pos = get_next_position(this.pos, dir);\n return pos;\n }",
"movePlayer() {\n if (this.getChainLengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks mCurrentFocus in dumpsys output to determine if Keyguard is activated | function isCurrentFocusOnKeyguard(dumpsys) {
var m = /mCurrentFocus.+Keyguard/gi.exec(dumpsys);
return m && m.length && m[0] ? true : false;
} | [
"function isCurrentFocusOnKeyguard (dumpsys) {\n let m = /mCurrentFocus.+Keyguard/gi.exec(dumpsys);\n return (m && m.length && m[0]) ? true : false;\n}",
"get has_key_focus() {\n var stage = this._get_stage_internal();\n if (!stage) { return false; }\n return (stage.get_key_focu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the number for the next poll. | static getNextNumber(server) {
let dir = `./polls/${server}`;
if (!fs.existsSync(dir))
fs.mkdirSync(dir);
let fileList = fs.readdirSync(dir);
for (let i = 0; ; i++) {
if (!fileList.includes(`${i}.json`))
return i;
}
} | [
"async function NextPrNumber(){\n try {\n let nextPr = await controller.MaxID(\"PullRequests\");\n return nextPr + 1;\n } catch (error) {\n next(error);\n }\n}",
"function getdocnum() {\n NWF$().SPServices({\n operation: \"GetListItems\",\n async: false,\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trade Log accessor methods | function getTradeLogUnits(){return tradeLogUnitsField().value} | [
"function getLog() {\n return log;\n}",
"function getLog(){\n return userLog;\n }",
"getLog() {\n return _log;\n }",
"function Log () {\n this._entries = [];\n this._commitIndex = 0;\n this._lastApplied = 0;\n this._startIndex = 0;\n this._startTerm = 0;\n}",
"function TravelLog(){\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return whether an item is in the player's campground | function haveInCampground(item) {
return Object.keys((0, _kolmafia.getCampground)()).map(i => Item.get(i)).includes(item);
} | [
"function haveInCampground(item) {\n return Object.keys(kolmafia_1.getCampground()).map(function (i) {\n return Item.get(i);\n }).includes(item);\n}",
"function haveInCampground(item) {\n return Object.keys((0,kolmafia__WEBPACK_IMPORTED_MODULE_0__.getCampground)()).map(function (i) {\n return Item.get(i)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a knex instance connected to postgres | function makeKnexInstance() {
return knex({
client: "pg",
connection: process.env.TEST_DB_URL
});
} | [
"function makeKnexInstance() {\n\treturn knex({\n\t\tclient: 'pg',\n\t\tconnection: process.env.TEST_DATABASE_URL || 'postgresql://dunder_mifflin@localhost/koigoalkeeper-test'\n\t});\n}",
"function create() {\n const config = connections[NODE_ENV]\n if (NODE_ENV === 'test') {\n config.connection.database = '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reference: OBBOBB Intersection in RealTime Collision Detection by Christer Ericson (chapter 4.4.1) | intersectsOBB(obb, epsilon = Number.EPSILON) {
// prepare data structures (the code uses the same nomenclature like the reference)
a.c = this.center;
a.e[0] = this.halfSize.x;
a.e[1] = this.halfSize.y;
a.e[2] = this.halfSize.z;
this.rotation.extractBasis(a.u[0], a.u[1],... | [
"checkForCollision(gameObjectOneKey, gameObjectTwoKey, velocity) {\n let gameObjectOne = this.objects[gameObjectOneKey];\n let gameObjectTwo = this.objects[gameObjectTwoKey];\n\n if (!(gameObjectOne && gameObjectTwo)) {\n debugger;\n console.log(`[checkForCollision] Warning: Game object with key ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an opacity keyframe animation rule and returns its name. Since most mobile Webkits have timing issues with animationdelay, we create separate rules for each line/segment. | function addAnimation (alpha, trail, i, lines) {
var name = ['opacity', trail, ~~(alpha * 100), i, lines].join('-')
, start = 0.01 + i/lines * 100
, z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
, prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerC... | [
"function addAnimation(alpha, trail, i, lines) {\n\t var name = ['opacity', trail, ~~(alpha * 100), i, lines].join('-'),\n\t start = 0.01 + i / lines * 100,\n\t z = Math.max(1 - (1 - alpha) / trail * (100 - start), alpha),\n\t prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NEXTPROMPT function this will keep allowing the user to guess until game is over | function nextprompt() {
console.log("---------------------------------------");
console.log("NEXT ROUND: Choose a letter:");
prompt.get(['letter'], function (err, result) {
// Log the results.
//console.log(' --> You chose: ' + result.letter);
//convert to lowercase
lowercaseinput = result.letter.toLowerCas... | [
"function NextPrompt() {\n let ind = RandomIndex();\n // promptIndex++;\n if (promptsLeft > 0) {\n promptItem = parseObj[ind];\n $(\"#promptHere\").text(promptItem.prompt);\n }\n else {\n $(\"#promptHere\").text(\"all prompts completed, thanks for playing\");\n // hide next button\n }\n SetCurren... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
rooter.execute(...$route) Method that imports one module (avoiding the usual cache of `node`) from the parts of its path and from the `rooter.ROOT` path. It works the same as `require`, but it will avoid nodejs default caching. | execute(...route) {
return importFresh(this.resolve(...route));
} | [
"require(...route) {\n\t\treturn require(this.resolve(...route));\n\t}",
"loadModules(route){\r\n }",
"loadInNode(path) {\n const filePath = require('path').resolve(__dirname, path);\n if ($global.decache) {\n decache(filePath);\n }\n return require(filePath);\n }",
"function ex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove extra underscore from escaped identifier. See | function unescapeIdentifier(identifier) {
return identifier.startsWith('___') ? identifier.substr(1) : identifier;
} | [
"function unescapeLeadingUnderscores(identifier){var id=identifier;return id.length>=3&&id.charCodeAt(0)===95/* _ */&&id.charCodeAt(1)===95/* _ */&&id.charCodeAt(2)===95/* _ */?id.substr(1):id;}",
"function unescapeIdentifier(identifier){return identifier.startsWith('___')?identifier.substr(1):identifier;}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save the camera user preference setting | function saveSettingCamera()
{
if ( ($( '#autoCamera' ).is( ":checked" )) == true )
{
localStorage.setItem( 'autoCamera_L' , '1' );
}
else
{
localStorage.setItem( 'autoCamera_L' , '' );
}
// console.log( localStorage.getItem( 'autoCamera_L' ) );
} | [
"savePreferences() {\r\n\t\tthis.storage.set(\"vnext-prefs\", this.preferences);\r\n\t}",
"function save(){\n\tchrome.storage.sync.set({'currentView': currentView}, function() {\n\t\tconsole.log('Settings saved');\n });\n}",
"function saveCamera() {\n cameraStore = getCameraCoordinates();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the list of all exposure models. | all() {
return this._models
} | [
"function getModels() {\n return standaloneServices_1.StaticServices.modelService.get().getModels();\n }",
"function getModels() {\n return standaloneServices_StaticServices.modelService.get().getModels();\n}",
"describeModels () {\n\t\treturn this.modules.reduce((models, module) => {\n\t\t\treturn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A check for making sure the path starts in a circle and ends in a circle: | function pathEndPointsChecker() {
var p = paths.length-1;
var begpt = paths[p].length / 1;
var endpt = paths[p].length / paths[p].length;
var begxy = paths[p].getPointAt(begpt);
var endxy = paths[p].getPointAt(endpt);
var begcheck = 0;
var endcheck = 0;
for (var i in circles) {
b... | [
"isPointOnArc (center, radius,) {}",
"function isCircularPath(path) {\n let firstNode = path[0]\n let lastNode = path[path.length-1]\n if (firstNode.x === lastNode.x & firstNode.y === lastNode.y) {\n return true\n } else {\n return false\n }\n}",
"function checkPath(type, start, end... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function modifies blocks in the playerLevelEnvironment.listOfBlocksInThePlayingArea in case there was a full line | function modifyListOfBlocksInThePlayingAreaBecauseOfFullLine(fullLineIndex) {
let newBlockMap;
let x;
let y;
// go thru the blocks one by one in playerLevelEnvironment.listOfBlocksInThePlayingArea
// (we iterate backwards, so when we remove an item reindexing the array will not... | [
"function drawAllBlocksToPlayArea(ctx) {\n\n // go thru the blocks one by one in playerLevelEnvironment.listOfBlocksInThePlayingArea\n for (let i = 0; i < playerLevelEnvironment.listOfBlocksInThePlayingArea.length; i++) {\n\n // draw the block\n const xModifierInSquares = playerL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates the file list | async function generateFileList(files) {
let list = document.getElementById('fileList');
list.textContent = ""
for (let i = 0; i < files.length; i++) {
let item = document.createElement('li');
item.id = files[i].Name
let link = 'file-manager.html?location=' + path + "/" + files[i].Path;
if (files[... | [
"function buildFileList() {\n var fileList = document.getElementById(\"input-file-list\");\n clearFileList(fileList);\n\n for (const [name, midiFile] of Object.entries(midiFiles)) {\n addEntryToFileList(fileList, midiFile, name, true)\n }\n for (const [name, midiFile] of Object.entries(hiddenMidiFiles)) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
displays the current inventory | function btn_displayInventory() {
var msg = "Inventory: " + inventory;
updateDisplay(msg);
} | [
"showInventory() {\r\n let arrItems = this.showInventoryNames();\r\n super.showInfo(\"Currently available at the Store\", arrItems);\r\n }",
"function showInventory() {\n if (player.inventoryIsEmpty()) {\n exportLog('<p>You are not carrying anything.</p>');\n return;\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move ALL tiles upward | function moveTilesUp() {
for (var column = 3; column >= 0; column--) {
for (var row = 1; row <= 3; row++) {
if (checkAbove(row, column) && tileArray[row][column] != null) {
moveTileUp(row, column);
}
}
}
} | [
"function moveTilesUp() {\n var moved = false\n var captured = false\n for (var column = 0; column < grid_size; column++) {\n for (var row = 0; row < grid_size; row++) {\n if (row > 0) {\n var ind = index(row,column)\n if (tiles[ind] != null) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that is preparing and adding dom elements for auto complete | function showAutoComplete(results){
var autocomplete = document.getElementById("autocomplete-div");
autocomplete.innerHTML = '';
for(var i = 0; i < results.length; i++){
var element = document.createElement("li");
element.setAttribute('onclick','addCityToInput(this);');
element.inner... | [
"_buildDOMElements() {\n let containerElement = document.createElement('div');\n containerElement.id = this.id;\n containerElement.className = 'seelect-container';\n this.containerElement = containerElement;\n\n let selectedElement = document.createElement('div');\n selecte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handles beginning of view change event | function onViewChangeStart() {
_clearLabels();
} | [
"function EventViewChange(){}",
"onViewChange() {\n \n }",
"changeView() {\n\n }",
"_viewEvent(view) {\n\t if (view !== this._view) {\n\t // Action for different view - ignore it\n\t return;\n\t }\n\t // Change visible view if it doesn't match view.\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find_word_frame: Given a letter, its HTU position and its direction work out the pattern of letters already used in the given direction. | function find_word_frame(lett, HTU_number, direction){
console.log("find_word_frame("+lett+',HTU:'+HTU_number+',direction'+direction+')');
var this_word = new Array(7);
if(direction == 'A') {
HTU0 = HTU_number;
minicube0 = mini_cubes[HTU0];
this_word[0] = minicube0.cube_letter;
HTU1 = HTU0 + 1;
minicube1 =... | [
"function find_word_frame(lett, HTU_number, direction){\n//\tconsole.log(\"find_word_frame(letter: \"+lett+',HTU:'+HTU_number+',direction'+direction+')');\n\tif(direction == 'A') {\n\t\tHTU0 = HTU_number;\n\t\tminicube0 = mini_cubes[HTU0];\n\t\tletter0 = minicube0.cube_letter;\n\n\t\tHTU1 = HTU0 +49;\n\t\tminicube1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exercise 5 Write a function countCharacters that, when given a string as an argument, returns an object containing counts of the ocurrences of each character in the string | function countCharacters(string){
const temp = {}
const tempStringArray = string.split("");
tempStringArray.forEach((item) =>{
temp.hasOwnProperty(item) ? temp[item] += 1 : temp[item] = 1;
})
return temp;
} | [
"function countCharacters(input){\n var characterCounts = {};\n\n for(var i = 0; i < input.length; i++){\n var c = input[i];\n\n if(characterCounts[c] === undefined) {\n characterCounts[c] = 1;\n }\n\n else {\n characterCounts[c] += 1;\n }\n }\n\n return characterCounts;\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the centre position of the canvas | function getCanvasCentrePosition() {
var canvas = document.getElementById("myCanvas");
return {
x: canvas.width / 2,
y: canvas.height / 2
};
} | [
"_getCanvasCenter() {\n const canvasRect = this.container.getBoundingClientRect();\n\n return {\n x: canvasRect.x + (canvasRect.width / 2),\n y: canvasRect.y + (canvasRect.height / 2),\n };\n }",
"function getCenter() {\n var center = {\n x : this.width / 2,\n y : ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checkStateCode (TEXTFIELD theField [, BOOLEAN emptyOK==false]) Check that string theField.value is a valid U.S. state code. For explanation of optional argument emptyOK, see comments of function isInteger. | function checkStateCode (theField, emptyOK)
{ if (checkStateCode.arguments.length == 1) emptyOK = defaultEmptyOK;
if ((emptyOK == true) && (isEmpty(theField.value))) return true;
else
{ theField.value = theField.value.toUpperCase();
if (!isStateCode(theField.value, false))
return w... | [
"function checkZIPCode (theField, emptyOK)\r\n{ if (checkZIPCode.arguments.length == 1) emptyOK = defaultEmptyOK;\r\n if ((emptyOK == true) && (isEmpty(theField.value))) return true;\r\n else\r\n { var normalizedZIP = stripCharsInBag(theField.value, ZIPCodeDelimiters)\r\n if (!isZIPCode(normalized... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the child elements of a popper element | function getChildren(popper) {
return {
tooltip: popper.querySelector(TOOLTIP_SELECTOR),
backdrop: popper.querySelector(BACKDROP_SELECTOR),
content: popper.querySelector(CONTENT_SELECTOR),
arrow: popper.querySelector(ARROW_SELECTOR) || popper.querySelector(ROUND_ARROW_SELECTOR)
};
} | [
"function getInnerElements() {\n return [instance.popperChildren.tooltip, instance.popperChildren.backdrop, instance.popperChildren.content];\n }",
"function getInnerElements() {\n return [instance.popperChildren.tooltip, instance.popperChildren.backdrop, instance.popperChildren.content];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a `rmHtmlTags` function to remove HTML tags from string. We may use RegExp Also add type checks and throw an error if param is not string; ```javascript rmHtmlTags('Content') // Content ``` | function rmHtmlTags(str){
if(typeof str !== 'string'){
throw new Error("parameter should be a string");
}
let regex= /<[a-zA-Z/]*>/g;
return str.replace(regex, "");
} | [
"function delHtmlTag(str) {\n return str.replace(/<[^>]+>/g, \"\");\n}",
"function removeHtmlTag(html)\n{\n return html.replace(/<[^<>]+?>/g, '');//删除所有HTML标签\n}",
"function removeHTMLTags (s) {\r\n \r\n var r = s.replace(delRe, \"\").replace(tagRe,\"\").replace(spaceRe, \" \");\r\n \r\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Refetches the spreadsheet originally linked to the Fusion table took ~40 secs to refetch 120K records of data | function refetch() {
try {
TABLE_ID = PropertiesService.getScriptProperties().getProperty("TABLE_ID");
if (!TABLE_ID) {
throw new Error("Add table ID under File > Project properties > Script Properties");
}
}
catch (e) {
Logger.log(e.message);
//Browser.m... | [
"function fetchData() {\n var data,\n baseRow = 2,\n baseColumn = 1,\n dateNow = new Date(),\n today = dateNow.getDate() + \".\" + (dateNow.getMonth()+1) + \".\" + dateNow.getYear() + \":\" + dateNow.getHours(),\n sprintId = sheet.getRange(5, sprintInfoColumn).getValue();\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
unfocusWindows() Releases focus from all windows | function unfocusWindows() {
$(".window:not(.windowunfocussed)").addClass("windowunfocussed");
closeModuleDrawer();
} | [
"unfocusAllWindows () {\n this._windows.forEach(function (element) {\n element.isNotFocused()\n })\n }",
"function ActionSkill_DeactivateAllWindows() {\n\t\tActionSkill.Window_Party.active = false;\n\t\tActionSkill.Window_SkillSelector.active = false;\n\t\tActionSkill.Window_ConfirmPrompt.active = fal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Increasing Notification Counter By One | function increaseNotificationCounter(sender) {
client_configuration['notifications_counter']++;
$('.notifications').html(client_configuration['notifications_counter']).fadeIn(200);
if (!client_configuration.notifications_map['user_' + sender]) {
client_configuration.notifications_map['user_' + send... | [
"_incNotifCounter(notif) {\n let knownSeverity = notif.knownSeverity;\n this._notifCounters[knownSeverity]++;\n\n if (knownSeverity !== Severity.UNDEFINED &&\n (this._highestSeverity === Severity.UNDEFINED || this._highestSeverity > knownSeverity)) {\n this._highestSeverit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decode the base (unprefixed) instructions. | function decode(z80) {
const inst = fetchInstruction(z80);
const func = decodeMapBASE.get(inst);
if (func === undefined) {
console.log("Unhandled opcode " + z80_base_1.toHex(inst, 2));
}
else {
func(z80);
}
} | [
"function decode(){\n\t// Separate opCode (equivalent to opCode = IR % 100\n\topCode = IR.charAt(1);\n\t// Separate operand\n\toperand = IR.substring(2,4);\n\treturn 0;\n}",
"decode () {\n let opcode_byte = this.mem8[segIP(this)];\n\n // Retrieve the operation from the opcode table\n let instruction = th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switch the theme between a dark and light background | function changeTheme(){
if(DARK_MODE)
$("body").css("background-color", "#DCDCDC");
else
$("body").css("background-color", "#2e324c");
DARK_MODE = !DARK_MODE;
} | [
"function setInitialTheme() {\n const containerEl = $('.container');\n const isDarkEl = $('#dark');\n if(isDarkEl.attr('media') === \"all\") {\n containerEl.removeClass('bg-light');\n } else {\n containerEl.addClass('bg-light');\n }\n}",
"function switchTheme() {\n console.log('Dark... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function responsible for get the _turn value | get turn() {
return this._turn;
} | [
"getTurn(){\r\n\t\tlet currentTurn = new PlayerColor(this.turn.getColor());\r\n\t\tthis.turn.flipColor();\r\n\t\treturn currentTurn;\r\n\t}",
"function whoseTurn () {\n\tif (turnFlag % 2 === 0) {\n\t\tturnDecision = \"X\";\n\t} else if (turnFlag % 2 === 1) {\n\t\tturnDecision = \"O\";\n\t}\n\treturn turnDecision;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the player has fallen off the screen | function offScreen() {
// Check if the y is greater than canvas height
if (playerRect.y > cHeight) {
// Die
die();
}
} | [
"offScreen() {\n let x = this.body.position.x;\n let y = this.body.position.y;\n let radius = this.body.circleRadius*2;\n let offX = ((x + radius) < 0 || (x - radius) > playfieldWidth);\n let offY = (((y + radius) < -playfieldHeight*4) || ((y - radius) > playfieldHeight));\n if(offY) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the FOV by focal length in respect to the current .filmGauge. The default film gauge is 35, so that the focal length can be specified for a 35mm (full frame) camera. Values for focal length and film gauge must have the same unit. | setFocalLength( focalLength ) {
/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */
const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;
this.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );
this.updateProjectionMatrix();
} | [
"setFocalLength(focalLength){/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */const vExtentSlope=0.5*this.getFilmHeight()/focalLength;this.fov=RAD2DEG*2*Math.atan(vExtentSlope);this.updateProjectionMatrix();}",
"setFocalLength( focalLength ) {\n\n\t\t\t/** see {@link http://www.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a scale (array of integers) and a root (e.g. "C"), and returns the appropriate names for the other notes in the scale (determines whether e.g. C, represented as an int 1 in the scale, should be called "C" or "Db"). Flats and sharps get returned in unicode. | function scaleDict(scale,root) {
root = root.replace(/b/g,'\u266D');
root = root.replace(/#/g,'\u266F');
var test = root;
var out = {};
out[scale[0]] = root;
for(var i=1;i<scale.length;i++) {
out[scale[i]] = getLet(scale[i],test);
test += ","+out[scale[i]];
}
return out;
function getLet(n,str) {
switch... | [
"printName(scaleNotes, scaleChords) {\n if (!scaleNotes || !scaleChords) { console.log(\"Error in Chord.printName()- please provide scaleNotes & scaleChords.\") }\n\n let baseName = `${scaleNotes[this.root - 1]}${scaleChords[this.root - 1].name}`\n\n if (!this.notes.includes(3)) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update player cards tables | function updateCardTables()
{
console.log("update card tables");
var i, j, playerNum, table, d;
// update suspect table
table = document.getElementById("suspectTable").rows; // get player suspect card table, collection of rows
for(i = 2; i < 8; i++) // iterate through rows, row header at row 0, suspect names at ro... | [
"function updateCard(player) {\n // The playe's name\n var name = player.getAttribute(\"name\");\n\n // The card element\n var card = $(\".card[player='\"+ name +\"']\");\n\n // The table row containing all the informations needed\n var row = $(\"tr[name='\" + name + \"']\");\n\n // The total a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
selectEventTarget() select the element that the event was originally triggered on | function selectEventTarget(event) {
if (!event) {
return false;
}
var idParts, target = event.findElement();
// IE wigs out when the mouse hovers the scroll bar or border
try {
if (!target ||
!target.id ||
target.id == 'mentionme_popup' ||
target.id == 'mentionme_spinner') {
... | [
"selectionChangeHandler (event) {\n const target = this.activeElement\n const handler = target && domData.get(target, selectionChangeHandlerName)\n if (handler) { handler(event) }\n }",
"function mousedown(event) {\r\n activeElement = event.target;\r\n }",
"function mousedown(event) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
====================================================================== Creates a container for triangle list indices. | function TriIndices() {
/**
* The list of triangle indices.
* @private
* @type {Array}
*/
this._indicesTris = [];
} | [
"function buildTriangleIndices(indicesList,startVertice){\n\n\t// front face\n\tindicesList[j++]=startVertice+0;\n\tindicesList[j++]=startVertice+2;\n\tindicesList[j++]=startVertice+1; \n\n\t// back face\n\tindicesList[j++]=startVertice+3;\n\tindicesList[j++]=startVertice+4;\n\tindicesList[j++]=startVertice+5; \n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the reference object that this Location object belongs to | set referenceObject(obj) {
this._referenceObject = obj;
} | [
"set ObjectReference(value) {}",
"set location(value){\n this._location = value;\n }",
"function setReference() {\n log('Setting reference frame...', 'always');\n\n // take snapshot\n exec(snapshotcmd, function() {\n setref = true;\n });\n}",
"set location(location){\n this._location =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
showComputerHand(), Shows the computers hand | showComputerHand(computer) {
// Blank Card Image
var blankCard = "images/others/blank_card.png";
// Set all card slots to the blank image
document.getElementById("c_card_1").src = blankCard;
document.getElementById("c_card_2").src = blankCard;
document.getElementById("c_card_3").src = blankCard;
document... | [
"displayHumanHand(hand) {\r\n let promptString = \"\";\r\n if (this.errorString) {\r\n promptString += this.errorString + \"\\n\\n\";\r\n this.errorString = \"\";\r\n }\r\n promptString += \"Your hand: \" + hand.toString() + \"\\n\"; \r\n promptString += this.topCardString + \"\\n\";\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check is exsit callback | function _isExsitCallback ( fn ) {
if ( "function" !== typeof (_callback=fn) ) _callback = undefined;
} | [
"function checkCallback() {\n if (scriptOk) return;\n delete CallbackRegistry[callbackName];\n onError(url);\n }",
"function checkCallback() {\n if (typeof callback !== 'function') {\n callback = function () { };\n }\n }",
"function guardCallback( err, result ) {\n if ( ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make Background / This is the background on the canvas, | function Background() {
ctx.beginPath();
ctx.rect(0, 0, 1140, 600);
ctx.fillStyle = "black";
ctx.fill();
} | [
"function drawBackground() {\r\n context.drawImage(backgroundCanvas, 0, 0);\r\n }",
"function drawBackground() {\n background(bg);\n}",
"function createBackground() {\n\n\t \tbackground(0);\n\t \tdrawOutline();\n\t \tdrawMilkyWay();\n\t\tstars.draw(); \n\n\n}",
"function createrBG() {\n cont... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the focus status of the element that should now have focus | setCurrentFocus() {
this.clearCurrentFocus();
if (!this.focusedElement) {
return;
}
// set focus on the element that should have focus if needed
if (document.activeElement !== this.focusedElement) {
this.focusedElement.focus();
}
// apply... | [
"_updateFocus() {\n\t\tif ( this.isFocused ) {\n\t\t\tconst editable = this.selection.editableElement;\n\n\t\t\tif ( editable ) {\n\t\t\t\tthis.domConverter.focus( editable );\n\t\t\t}\n\t\t}\n\t}",
"updateFocusElement_() {\n this.updateFocusableElement();\n if (this.focusElementIndex_ >= 0) {\n this.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SINGLE IMAGE LOOP/CIRCLES FUNCTION | function mb_imageLoop() {
var currentImage = mb_imageSlides[mb_counter];
var currentDot = mb_circles[mb_counter];
currentImage.classList.add('mb_visible');
mb_removeDots();
currentDot.classList.add('mb_dot');
mb_counter++;
} | [
"function imgLoop() {\n for (var a = 0; a < 4; a++) {\n newImg();\n };\n }",
"function imageLoop() {\n var currentImage = imageSlides[counter];\n var currentDot = circles[counter];\n currentImage.classList.add('visible');\n removeDots();\n currentDot.classList.add('dot');\n counter++;\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function loops each object from the input and maps channel id with hasTagId from licenseDetails and prepares licenseDetails obj for each obj in the array | function populateLicenseDetailsByName (contents, inputfields, cb) {
let licenseDetails = []
let licenseSearchQuery = {
'request': {
'filters': {
'objectType': 'License'
},
'limit': 100
}
}
let tryFromCache = true
async.waterfall([
// intially fetch all the licenses till t... | [
"AssignTypeOfLicences(businessListfromchild){\n\n console.log('assign method:::'+JSON.stringify(businessListfromchild));\n console.log('List of Business lIcenses' + JSON.stringify(this.ListBusLicenses));\n\n let mapOfLicense= [];\n let listOfLicenses = [];\n for(let i=0 ; i<businessListfromchild.leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for flights in the array with minSeats<=classSeats getFlights within a certain date if 3 arguments return 2 way trip if 2 arguments return 1 way trip | function getFlightsWithDates(array, originDate, classs, seats, destinationDate) {
var count = 0;
//console.log(classs);
var res = {
"outgoingFlights": []
};
var resRT = {
"outgoingFlights": [],
"returnFlights": []
};
//console.log(array.length);
for (var n = 0; n < array.length; n++) {
... | [
"function searchFlight(flights, flightNumber) {\n for(var i = 0; i < flights.length; i++) {\n if(flights[i].flight == flightNumber) {\n return flights[i]\n }\n }\n return null;\n}",
"function scan_flight_data() {\n let trip_summaries = $(\".flight-details-summary\");\n for (let i =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Taken from sp.js, checks the supplied permissions against the mask | hasPermissions(value, perm) {
if (!perm) {
return true;
}
if (perm === PermissionKind.FullMask) {
return (value.High & 32767) === 32767 && value.Low === 65535;
}
perm = perm - 1;
let num = 1;
if (perm >= 0 && perm < 32) {
... | [
"function permissions(mask, value, callback) {\n var async = typeof callback == 'function';\n if(!async) {\n try {\n stats = stat(value, false, false, null);\n }catch(e) {\n return false;\n }\n return bitmask(stats, mask);\n }\n stat(value, false, false, function(err, stats) {\n if(err)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
search operator string seek search suffix match prefix true %iffound string false%ifnotfound | function $search(str, seek) {
if (!(str instanceof Uint8Array)) {
str = $s(str);
}
var ls = str.length;
// Virtually all uses of search in BWIPP are for single-characters.
// Optimize for that case.
if (seek.length == 1) {
var lk = 1;
var cd = seek instanceof Uint8Array ? seek[0] : seek.charCodeAt... | [
"function $search(str, seek) {\n if (!(str instanceof Uint8Array)) {\n str = $s(str);\n }\n var ls = str.length;\n\n // Virtually all uses of search in BWIPP are for single-characters.\n // Optimize for that case.\n if (seek.length == 1) {\n var lk = 1;\n var cd = seek instanc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get string from function arguments | function getArgStr(args) {
if (!args) return '';
return Object.values(args);
} | [
"function getArgString(len)\n {\n if (arg_strings[len] !== undefined)\n return arg_strings[len];\n\n var arg_string = \"a\";\n for (var i = 1; i < len; i++)\n arg_string += \", \" + arg_names[i];\n arg_string += \" \";\n arg_strings[len] = arg_string;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Give the slider box dynamic moving/resizing capability (div class="tl_sldr_box") | function moveSliderBox_onClick() {
//get JSON object that has all CSS phase information
//phaseSliderBoxCSS = phaseSliderBox;
//load panels for intro and end
$( '#tl_phases_wrapper .tl_phase_0,#tl_phases_wrapper .tl_phase_7' ).click( function() {
stopAnimation();
loadIntroEndPanels($(this).index());
});
... | [
"function onSizeChange(){\n\t\t\t\n\t\tplaceSlider();\n\t\t\t\t\n\t}",
"function changeSliderSize() {\n\t\t\twrapperA.css({\n\t\t\t\twidth: itemsA.length * (sliderWidth + 2 * sliderMargin) + \"vw\",\n\t\t\t\tmarginLeft: getWrapperMargin() + \"vw\"\n\t\t\t});\n\t\t\t\n\t\t\titemsA.css({\n\t\t\t\twidth: sliderWidth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to check the unselected tablet details | function checkUnselectedTablet() {
var countEmptyTab = $("#tabletTank tr.even.isUpdatedTablet.isEmptyTablet").length;
var countEmptyCheckbox = $("#tabletTank tr.even.isUpdatedTablet.isEmptyTablet").find('input[name=tabletSync]:checked').length;
if(countEmptyTab != 0 && countEmptyTab == countEmptyCheckbox) {
... | [
"function checkDeviceIsSelected() {\n var flag = false;\n $(\"input[name='mobile-platform-checkbox']:checked\").each(function () {\n $(this).parents(\"tr\").find(\"input[for='mobile-version-checkbox']:checked\").each(function () {\n var device = $(this).parents(\"td\").find(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns all arrows displayed in arrowlist as an array | static getAllArrows() /*: Array<number> */ {
return $('#arrow-list li').toArray().map( (list_item /*: HTMLLIElement */) => parseInt(list_item.getAttribute('arrow')) );
} | [
"function allArrowheads(container){\n var i,\n s;\n // if a dom element is passed in, add appropriate arrowheads\n // to every arrowhead selector in the container\n if(container) {\n var arrowLines = container.querySelectorAll('[data-arrowhead]');\n for(i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tamanho aleatorio do borboleta (1 classe para cada tamanho) | function tamanhoAleatorio() {
var classe = Math.floor(Math.random() * 3)
// alterar a classe do elemento (borboleta)
switch(classe) {
case 0:
return "borboleta1"
case 1:
return "borboleta2"
case 2:
return "borboleta3"
}
} | [
"function tamanhoAleatorio() {\n\tvar classe = Math.floor(Math.random() * 3)\n\n\tswitch(classe) {\n\t\tcase 0:\n\t\t\treturn 'mosquitoNormal'\n\t\tcase 1:\n\t\t\treturn 'mosquitoGrande'\n\t\tcase 2:\n\t\t\treturn 'mosquitoGigante'\n\t}\n}",
"function tamanhoAleatorio() {\n\tvar classe = Math.floor(Math.random() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reduces height of shallow copied config | function _configReducedHeight(config) {
var newConfig = {};
Object.keys(config).forEach(function(c) {
newConfig[c] = config[c];
});
if (typeof newConfig.maxHeight === 'number') {
newConfig.maxHeight -= 1;
} else {
newConfig.maxHeight = 0;
... | [
"setHeight(newHeight) {this.height = newHeight;}",
"function restoreCustomHeights() {\n land.forEach(function(l) {\n if (!l.pit) return;\n l.height = Math.trunc(l.height - l.pit * 2);\n if (l.height < 20) l.height = 20;\n });\n }",
"resetHeight()\n\t{\n\t\tthis.height = this.layer.naturalH... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a random boolean | function randomBool()
{
return (randomInt(0, 1) === 1);
} | [
"function randBool() { return (Math.random() * 2) >= 1 }",
"function randBoolean() {\n return Math.round(Math.random()) <= 0;\n}",
"function randomBit() {\n return randBool()? 1 : 0;\n }",
"random_bool(p) {\n return this.random_dec() < p;\n }",
"function randomBit () {\n return randBool() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
intersectBox checks for intersections between ray and bounding box adapted from scratchapixel, the nonoptimized code | function intersectBox(ray, node){
var tmin = (node.boundmin.x - ray.point.x)/ray.vector.x;
var tmax = (node.boundmax.x - ray.point.x)/ray.vector.x;
if (tmin > tmax){
old_tmin = tmin;
old_tmax = tmax;
tmin = old_tmax;
tmax = old_tmin;
}
var tymin = (node.boundmin.y -... | [
"intersectWithBox(box) {\n // minimum of right edges\n const minx = Math.min(this.right, box.right);\n // maximum of left edges\n const maxx = Math.max(this.x, box.x);\n // minimum of bottom edges\n const miny = Math.min(this.bottom, box.bottom);\n // maximum of top edges\n const maxy = Math... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
expect an array of userObj as input add a new row to the table for each user object | function addUser(userObj) {
let newRow = document.createElement('tr');
newRow.innerHTML = `
<td>${userObj.studentNo}</td>
<td>${userObj.name}</td>
<td>${userObj.age}</td>
<td>${userObj.studentNo > 0}</td>
`;
document.getElementById('table-content').appendChild(newRow);
} | [
"function fill_table(users) {\n table.find(\"tr:gt(0)\").remove();\n $.each(users, function(i, elem) {\n table.append(ROW.format(i, elem));\n })\n}",
"function printUsers() {\n for(let i = 0; i < users.length; i++) {\n const row = '<tr><td>'+users[i].name+'</td><td>' + users[i].email + '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Figure out how much actual space the brain region data takes up. Important for setting the bounds of the interpolator that converts from region coordinate space to canvas space | calcRegionSizeGlobal() {
// this should only get done once
// scanCol is the column that has the data we care about putting in the color fill
// this returns a summary object that knows things about the size of the brain json dimensions and also the min and max of hte scan data
//!! shou... | [
"get useWorldRectForZoomBounds() {\n return this.i.nn;\n }",
"experimentRenderBounds(){\n return [this.camera.pos[0], this.camera.pos[1], EXP_BOUNDS[2], EXP_BOUNDS[3]];\n }",
"worldBounds() {\n const heights = [];\n const dimensions = [];\n this.canvases.forEach((canvas) => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset breadcrumbs in modal | function resetModalBreadcrumbs() {
$('.bc-groups .bc-item a, .bc-collections .bc-item a').show();
$('.bc-groups .bc-item select, .bc-collections .bc-item select').remove();
} | [
"function clearBreadCrumb() {\n showBreadcrumbs(\"\");\n}",
"function clearCrumbs(){\n $('li.crumb').remove();\n }",
"clearBreadCrumb() {\n this.bcRestaurant.innerHTML = '';\n }",
"function setBreadcrumbs() {\n if (arguments[0] === undefined) {\n console.log('No breadcrumbs su... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start Plato inspector and visualizer | function startPlatoVisualizer() {
log('Running Plato');
var files = glob.sync('toastr.js');
var options = {
title: 'Plato Inspections Report'
};
var outputDir = './report/plato';
plato.inspect(files, outputDir, options, platoCompleted);
function platoCompleted(report) {
v... | [
"function startPlatoVisualizer() {\n log('Running Plato');\n\n var files = $.glob.sync(paths.projectjs);\n var excludeFiles = /\\app\\/.*\\.spec\\.js/;\n\n var options = {\n title: 'Plato Inspections Report',\n exclude: excludeFiles\n };\n var outputDir = paths.report + 'plato';\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles 'paste into span' glitch in Firefox. | function handle_paste_glitch(obj) {
if (obj.children('span').eq(2).is(':visible')) {
document.execCommand('undo',false,null);
if (typeof(_clip) !== 'undefined') document.execCommand('insertText',false,_clip);
}
} | [
"paste (event) {\n event.preventDefault();\n event.stopPropagation();\n this.replaceText(this.selection.start, this.selection.end, event.clipboardData.getData(\"text\"));\n }",
"function handle_paste_glitch(obj) {\n\tif (obj.children('span').eq(2).is(':visible')) {\n\t\tdocument.execCommand('undo',false... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generateRandomState will try to generate a 128bits random value from a secure pseudo random generator. It will fallback on Math.random if it cannot find such generator. | function generateRandomState() {
var buffer = void 0;
if (typeof window !== 'undefined' && typeof window.crypto !== 'undefined' && typeof window.crypto.getRandomValues === 'function') {
buffer = new Uint8Array(StateSize);
window.crypto.getRandomValues(buffer);
} else {
try {
buffer = __we... | [
"function generateRandomState() {\n let buffer\n if (\n typeof window !== 'undefined' &&\n typeof window.crypto !== 'undefined' &&\n typeof window.crypto.getRandomValues === 'function'\n ) {\n buffer = new Uint8Array(StateSize)\n window.crypto.getRandomValues(buffer)\n } else {\n try {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Notifies the jQuery provider that we've loaded the jQuery library. | function loaded() {
loadedjQuery = jQuery.noConflict(true);
notifyCallbacks();
} | [
"function loadjQuery() {\n if (!jQueryLoaded) {\n jQueryLoaded = true;\n callback(window.jQuery.noConflict(true));\n }\n }",
"function onJQuery() {\n\t\t$ = window.jQuery;\n\t\tcreateModules();\n\t}",
"function onJqueryReady () { var FN = '`onJqueryReady()` ', fns, nm\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::CodeDeploy::DeploymentGroup.GreenFleetProvisioningOption` resource | function cfnDeploymentGroupGreenFleetProvisioningOptionPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDeploymentGroup_GreenFleetProvisioningOptionPropertyValidator(properties).assertSuccess();
return {
Action: cdk.stringToCloudFormation(... | [
"function CfnDeploymentGroup_GreenFleetProvisioningOptionPropertyValidator(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... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to start the async get request for the large image on the display page | function load_image(){
var url_string = window.location.href
var url = new URL(url_string);
var nasa_id = url.searchParams.get("nasa_id");
var query = "https://images-api.nasa.gov/asset/" + nasa_id;
var result = httpGetAsync(query, large_image);
} | [
"function requestImage() {\n $.get(URL).done(displayImage);\n}",
"async function fetchimageurl(url) {\n\tconst request = new Request(url)\n\tvar res = await request.loadImage();\n\treturn res;\n}",
"async function fetchimageurl(url) {\n const request = new Request(url)\n var res = await request.loadImage()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A wrapper for generating scrollTo behavior when children text is matched with url path's last part. | function ScrollTo({ component: Tag = "div", location, children, match, disableAnchorLink, ...rest }) {
const wrapperRef = React.useRef();
const lastPathPartials = location.pathname.split("/").pop();
let hasLink = false;
let linkStr;
if (typeof children === "string") {
linkStr = children
.replace(/[\... | [
"scrollIntoView() {\n if (DomUtils.getSelectionType(this.selection) !== \"None\") {\n const elementWithFocus = DomUtils.getElementWithFocus(\n this.selection,\n this.getDirection() === backward,\n );\n if (elementWithFocus) return Scroller.scrollIntoView(elementWithFocus);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the number of columns within the layer. Note: Assumes the number of columns are equal within each row. | getNumCols() {
return this._tiles[0].length;
} | [
"columnCount() {\n return TileKey.columnsAtLevel(this.level);\n }",
"getNumOfColumns() {\n\t\treturn this.numOfTileColumns;\n\t}",
"function getColumnsCount() {\r\n}",
"function countColumns() {\n return GRID[0].length;\n }",
"function YDataStream_get_columnCount()\n {\n if (this._nC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
is the tournament battle valid? | function isValidTourBattle(src,dest,clauses,mode,team,destTier,key,challenge) { // challenge is whether it was issued by challenge
try {
var srcindex = tours.tour[key].players.indexOf(sys.name(src).toLowerCase());
var destindex = tours.tour[key].players.indexOf(sys.name(dest).toLowerCase());
... | [
"isTournamentOver() {\n return this.players.length === (this.donePlayers.length + this.badPlayers.length);\n }",
"function isValidTourBattle(src,dest,clauses,mode,team,destTier,key,challenge) { // challenge is whether it was issued by challenge\n\ttry {\n\t\tvar srcindex = tours.tour[key].players.indexOf(sys.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the report for products in the system | getProductReports(id){
return Api().post('/emailproducts/'+id)
} | [
"function viewProductsForSale() {\n\t\n\t\tprintProductsReportHeader();\n\t\tconnection.query(\"SELECT item_id, product_name, price, stock_quantity FROM products\", function(err, res) {\n\t\t\tif (err) throw err;\n\t\n\t\t\tfor (const product of res) {\n\t\t\t\tconsole.log(\n\t\t\t\t\tproduct.item_id.toString().pad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RemoveObserver removes the observer from the notification list for the specified notification type | function RemoveObserver (observer, name: String) {
var notifyList: List.<Component> = notifications[name];
// Assuming that this is a valid notification type, remove the observer from the list.
// If the list of observers is now empty, then remove that notification type from the notifications hash. Thi... | [
"_removeObserver(observer) {\n const i = this._observers.indexOf(observer);\n\n if (i !== -1) {\n this._observers.splice(i, 1);\n }\n }",
"removeObserver(observer) {\n this.handlers = this.handlers.filter(\n function(item) {\n if (item !== observer) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function that shuffles keys of an object an results in a array | function shuffleWords(inputObject){
shuffledWords = Object.keys(inputObject);
shuffledWords.sort(function() { return 0.5 - Math.random() });
} | [
"function mapObjToArray(obj){\n let arr=[];\n let usedNumbers=[];\n\n Object.keys(obj).map((el)=>{\n \n let randomOrder=Math.floor(Math.random()*9)\n while (usedNumbers.indexOf(randomOrder)>-1){\n randomOrder=Math.floor(Math.random()*10)\n }\n usedNumbers.push(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save the restore data for a given widget. | async save(widget) {
return this._pool.save(widget);
} | [
"save(widget) {\n const injected = Private.injectedProperty.get(widget);\n if (!this._restore || !this.has(widget) || injected) {\n return;\n }\n const { state } = this._restore;\n const widgetName = this._restore.name(widget);\n const oldName = Private.namePrope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a function that is used as a submit event handler on form elements that have children affected by this polyfill | function makeSubmitHandler(form) {
return function () {
// Turn off placeholders on all appropriate descendant elements
disablePlaceholders(form);
};
} | [
"attachSubmitHandler(form){\n if( !this._xhrSubmit ) return;\n\n //if not passed, get it from this object\n if( typeof form === \"undefined\" ) {\n form = this.getForm();\n }else {\n form = dom.getElement(form);\n }\n\n if( !form ) throw `Form element ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List all tasks under project | function listAllTasksAndProject(){
return db(table)
.leftJoin('task as t', `${table}.id`, 't.proj_id')
.select(`${table}.name as project`, 't.*');
} | [
"function listTasks() {\n const query = datastore.createQuery('Task').order('created');\n\n datastore\n .runQuery(query)\n .then(results => {\n const tasks = results[0];\n\n console.log('Tasks:');\n tasks.forEach(task => {\n const taskKey = task[datastore.KEY];\n console.log(tas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET SQUARE CUSTOMER ID VIA SQUARE MERCHANT ID | async function GetCrmMerchIdViaSqMrchId(sq_merchant_id) {
// NOTIFY PROGRESS
//console.log('CRM/GetCrmMerchIdViaSqMrchId: getting Merchent id from square merchant id: ', sq_merchant_id);
// 1. COLLECT MERCHANT ID
return await Firebase.get.crmMerchIdviaSqMrchId(sq_merchant_id);
} | [
"function getCustId() {\n\t\tvar customerId = \"3fd76661-6529-48bf-879e-5f5e126f0d98\"; // need to change this.\n\t}",
"function getCustomerId(){\n var me = AdminDirectory.Users.get(Session.getEffectiveUser().getEmail())\n Logger.log(me.customerId)\n return me.customerId\n}",
"function getUserID() {\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
xSelect, Copyright 20042007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL | function xSelect(sId, fnSubOnChange, sMainName, sSubName, bUnder, iMargin) // Object Prototype
{
// Private Event Listener
function s1OnChange()
{
var io, s2 = this.xSelSub; // 'this' points to s1
// clear existing
for (io=0; io<s2.options.length; ++io) {
s2.options[io] = null;
}
... | [
"function xSelect(sId, fnSubOnChange)\n{\n //// Properties\n\n this.ready = false;\n\n //// Constructor\n\n // Check for required browser objects\n var s0 = xGetElementById(sId);\n if (!s0 || !s0.firstChild || !s0.nodeName || !document.createElement || !s0.form || !s0.form.appendChild)\n {\n return;\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
embed report to page | function embedReport(report, accessKey, workspaceCollectionName, workspaceId) {
var embedUrl = report.embedUrl;
var name = report.name;
var reportId = report.id;
var webUrl = report.webUrl;
var token = getAccessToken(accessKey, workspaceId, reportId, workspaceCollectionName);
var embedConfigurat... | [
"function printReportOutput() {\n try {\n var iframeObj = document.createElement(\"iframe\");\n iframeObj.setAttribute(\"display\", \"none\");\n document.body.appendChild(iframeObj);\n\n var printWindow = iframeObj.contentWin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read config from the config folder. This function will check for 'name.hostname.cfg' and if not present, it will read 'name.cfg'. This allows user to create a custom local config file without distrupting the main config. | function get_config(name) {
var host_filename = __dirname + '/config/'+name+'.'+os.hostname()+'.cfg';
var filename = __dirname + '/config/'+name+'.cfg';
var data = undefined;
if(fs.existsSync(host_filename)) {
data = fs.readFileSync(host_filename);
console.log("Reading config:",host_fil... | [
"loadLocalConfigFile() {\n let configData = {};\n try {\n configData = this.readFileSync(this.configFilePath);\n\n // validate based on config file version\n if (configData.version > 1) {\n configData = Validator.validateV2ConfigData(configData);\n } else {\n switch (configDa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the number of points a component has with the given selected marks | function calculateMarksPoints(c_index) {
c_index = parseInt(c_index);
var component = getComponent(c_index);
var lower_clamp = component.lower_clamp;
var current_points = component.default;
var upper_clamp = component.upper_clamp;
var arr_length = component.marks.length;
var any_selected=fal... | [
"function countSelectedPathPoints(path){\r\n var i = 0;\r\n var count = 0;\r\n\r\n for (i=0; i<path.pathPoints.length; i++) {\r\n if (path.pathPoints[i].selected == PathPointSelection.ANCHORPOINT) {\r\n count++\r\n }\r\n }\r\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if stateId is in stateArray | function checkState(stateId) {
if (stateId === undefined || stateId === null)
return false;
for (var i=0; i < stateArray.length; i++) {
if (stateArray[i] == stateId)
return true;
}
return false; // not found
} | [
"isInStateMap(element, value, stateMap){\n return element && stateMap && stateMap[value] && stateMap[value].length && stateMap[value].indexOf(element) > -1;\n }",
"function isStateExist(stateName) {\r\n var states = $state.get();\r\n var isExist = false;\r\n if (states instanc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save all items from allNotes array in a cookie | function saveAll() {
if (allNotes.length == 0) {
deleteAllCookies();
return;
}
var allNotesTemp = allNotes.slice();
for (var i = 0; i < allNotesTemp.length; i++) {
allNotesTemp[i] = encodeURIComponent(allNotesTemp[i]);
}
var saveString = btoa(allNotesTemp.toString());
allNotesTemp = ... | [
"function saveAll() { \n if(allNotes.length == 0) {\n deleteAllCookies();\n\t\treturn;\n\t}\n var allNotesTemp = allNotes.slice();\n\tfor(var i = 0; i < allNotesTemp.length; i++) {\n \tallNotesTemp[i] = encodeURIComponent(allNotesTemp[i]);\n }\n var saveString = btoa(allNotesTemp.toString());\n allNotesTem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the AWS resource ARN. When it sets the value, it automatically parses the ARN and sets individual parameters. | setArn(value) {
super.put("arn", value);
if (value != null) {
let tokens = value.split(":");
this.setPartition(tokens[1]);
this.setService(tokens[2]);
this.setRegion(tokens[3]);
this.setAccount(tokens[4]);
if (tokens.length > 6) {
... | [
"getArn() {\n let arn = super.getAsNullableString(\"arn\");\n if (arn)\n return arn;\n arn = \"arn\";\n let partition = this.getPartition() || \"aws\";\n arn += \":\" + partition;\n let service = this.getService() || \"\";\n arn += \":\" + service;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the settings object. Don't copy/store this object, you won't get updates. | function get() {
return settings;
} | [
"function get() {\n return settings;\n }",
"function getSettings(){\n\t\tif( ! settings ){\n\t\t\tsettings = load();\n\t\t}\n\t\treturn settings;\n\t}",
"function getSettings() {\n\t\treturn data.settings;\n\t}",
"getSettings (settings) {\n extend(settings, this.defaultSettings)\n this.setting... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Logartihmic scale (inverse exponential) | function logScale(val) {
let minv = 0.000000001
let maxv = 1
// Clamp number between minv and maxv
return Math.min(Math.max(1 / (Math.exp(val) - 1), minv), maxv);
} | [
"function logScale(position, minp_, maxp_, minv_, maxv_) {\r\n var minp = minp_;\r\n var maxp = maxp_;\r\n var minv = Math.log(minv_);\r\n var maxv = Math.log(maxv_);\r\n\r\n var scale = (maxv-minv) / (maxp-minp);\r\n return Math.exp(minv + scale*(position-minp));\r\n}",
"function log_rescale(x,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
rotate a cartesian vector axis is 0 (x), 1 (y), or 2 (z) angle is in degrees | function rotateCartesian(vector, axis, angle) {
var angleRads = angle * radians,
vectorOut = vector.slice(),
ax1 = (axis === 0) ? 1 : 0,
ax2 = (axis === 2) ? 1 : 2,
cosa = Math.cos(angleRads),
sina = Math.sin(angleRads);
vectorOut[ax1] = vector[ax1] * cosa - vect... | [
"function rotateCartesian(vector, axis, angle) {\n var angleRads = angle * radians;\n var vectorOut = vector.slice();\n var ax1 = (axis === 0) ? 1 : 0;\n var ax2 = (axis === 2) ? 1 : 2;\n var cosa = Math.cos(angleRads);\n var sina = Math.sin(angleRads);\n\n vectorOut[ax1] = vector[ax1] * cosa -... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Action handler. Takes an action object as a paramter, checks action type to ensure that this store is concerned with the action. In this case, confirms it is a 'receive_tweet' type, and then calls private functions that mutate data and notifiy components who are listenting. Are side effects eliminated? I think so. | function handleAction(action) {
if (action.type === 'receive_tweet') {
setTweet(action.tweet)
emitChange()
}
} | [
"dispatch(action) {\n if(action.type != \"STOP_TIME_TRAVEL\"\n && action.type != \"TIME_TRAVEL\"\n && action.type != \"APPLY_DELTAS\"\n && this.localState.timeTravel) {\n console.log(\"Ignoring action because we are time traveling.\")\n } else {\n MPL.Store.prototype.dispatch.ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In this challenge, we learn about ifelse statements. Check out the attached tutorial for more details. Task Complete the getGrade(score) function in the editor. It has one parameter: an integer, score, denoting the number of points Julia earned on an exam. It must return the letter corresponding to her grade according ... | function getGrade(score) {
let grade;
// Write your code here
if (score > 25 && score <= 30) {
grade = 'A';
} else if (score > 20 && score <= 25) {
grade = 'B';
} else if (score > 15 && score <= 20) {
grade = 'C';
} else if (score > 10 && score <= 15) {
grad... | [
"function letterGrade(score){\n\tif (score > 90 ) {\n\t\tconsole.log(\"Score: \" +score+ \". Grade: A\");\n\t} else if (score > 80) {\n\t\tconsole.log(\"Score: \" +score+ \". Grade: B\");\n\t} else if (score > 70) {\n\t\tconsole.log(\"Score: \" +score+ \". Grade: C\");\n\t} else if (score > 60) {\n\t\tconsole.log(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for calculating net worth | function calculateNetWorth() {
let finalAssets = calculateAsset();
let finalLiabilities = calculateLiabilities();
let netWorth = finalAssets - finalLiabilities;
netWorth = netWorth.toFixed(2);
if (!isNaN(netWorth)) {
document.getElementById('showNetWorth').innerHTML = "N"+ netWorth... | [
"function getNet() {\n net = gross - totalTax;\n return net;\n}",
"function computePlayerNetRevenue() {\r\n // Money + Programs per cycle\r\n player.moneyPerCycle = player.buildings[0].payout() + player.buildings[3].payout();\r\n player.programsPerCycle = player.buildings[1].payout();\r\n player... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render ============== summary: display some elements depending of the result of the conditionals. first conditional checks if there's data inside the questionInfo object(generated by getQuestion function) if true, it display the question information + answer buttons. if false, it displays a button to get a random quest... | render(){
return(
<div className='question-component'>
{
this.state.questionInfo ?
<div className='data'>
<h1 className='score'>Score: {this.state.currentScore}</h1>
<div className='question-div'>
<div className='key'>Question: </div>
... | [
"function renderQuestion() {\n \n // If there are still more questions, render the next one\n if (trueOrFalseQuestionsIndex <= (trueOrFalseQuestions.length - 1)) {\n // update the id tag question with the next question in the array\n document.querySelector(\"#question\").inner... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Canonicalizes a single prop according to the following cases: on function props are all replaced with a single function, since it is fairly safe to assume that they are event handlers, which don't affect rendering. If that is not the case, the user can always pass a custom canonicalization function to diffReact directl... | function canonicalizeProp(renderedElement, prop, value) {
// TODO(who): Add back support for StyleSheet.flatten() for style props.
if (prop && typeof value === 'function' && prop.substr(0, 2) === 'on') {
return SENTINEL_HANDLER;
} else if (Array.isArray(value)) {
return value.map(function (item, ii) {
... | [
"function canonicalizeProps(renderedElement, props, defaultCanonicalizePropFn) {\n var newProps = {};\n for (var _prop in props) {\n var newValue = defaultCanonicalizePropFn(renderedElement, _prop, props[_prop]);\n if (newValue !== undefined) {\n newProps[_prop] = newValue;\n }\n }\n return newPro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the balance factor | balanceFactor () {
const leftH = this.left ? this.left.height : 0
const rightH = this.right ? this.right.height : 0
return leftH - rightH
} | [
"balanceFactor() {\n const leftH = this.left ? this.left.height : 0\n , rightH = this.right ? this.right.height : 0\n return leftH - rightH;\n }",
"get bendFactor() {}",
"calculateBalance(x) {\n switch(x) {\n case -3:\n return 82;\n case -2:\n return 243;\n case -1:\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RegExp$prototype$equals :: RegExp ~> RegExp > Boolean | function RegExp$prototype$equals(other) {
return other.source === this.source &&
other.global === this.global &&
other.ignoreCase === this.ignoreCase &&
other.multiline === this.multiline &&
other.sticky === this.sticky &&
other.unicode === this.unicode;
} | [
"function isRegExp(value) {\n\treturn getObjectType(value) === '[object RegExp]'\n}",
"isRegExp (value) {\n\t\treturn typeChecker.getObjectType(value) === '[object RegExp]'\n\t}",
"function isRegExp(value) {\n\treturn (Object.prototype.toString.call(value) === '[object RegExp]');\n}",
"function testRegExp() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch the kernel specs. Notes Uses the [Jupyter Notebook API]( | function getKernelSpecs(options) {
if (options === void 0) { options = {}; }
var baseUrl = options.baseUrl || utils.getBaseUrl();
var url = utils.urlPathJoin(baseUrl, KERNELSPEC_SERVICE_URL);
var ajaxSettings = utils.copy(options.ajaxSettings || {});
ajaxSettings.method = 'GET';
ajaxSettings.dat... | [
"get specs() {\n return this.manager.services.kernelspecs.specs;\n }",
"function getKernelSpec(kernel, baseUrl, ajaxSettings) {\n var url = utils.urlPathJoin(baseUrl, KERNELSPEC_SERVICE_URL, encodeURIComponent(kernel.name));\n ajaxSettings = ajaxSettings || {};\n ajaxSettings.dataTy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We build up content (minus line prefixes), and dispatch that content appropriately (as body or tags). | function flushContent(content) {
if (content === '') return;
if (body === null && !IS_TAG_LINE.test(content)) {
body = content;
} else {
tags = tags.concat(parseTag(content));
}
} | [
"function preContent() {\n doPageGraphic();\n doPageCategory();\n doNavLinks();\n beginContent();\n}",
"function processNode(node) {\n if (node.tagName !== 'BR' && node.tagName !== 'HR' && node.tagName !== 'IMG' && node.innerHTML.length === 0)\n setContent(node, '');\n else if (node.tagName === 'P'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the netmask value associated with the address | setNetmask (netmask) {
if (typeof netmask != "string") {
return;
}
const match = netmask.match (/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/);
if (match == null) {
return;
}
this.netmaskOctets = [ ];
for (let i = 1; i < 5; ++i) {
const num = parseInt (match[i], 10);
if (isNaN (num)) {
return... | [
"set mask(value) {\n this._mask = value;\n }",
"setMask(mask) { this.maskBits |= mask; }",
"function setNetworkIpAddress(ipAddrId, snetMaskId){\n var nwAddrOct1, nwAddrOct2, nwAddrOct3, nwAddrOct4;\n var networkAddrObj = document.getElementById(ipAddrId);\n if (!networkAddrObj) {\n //alert(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if the page id is successfully pushed onto the website's pages array then resolve the promise with the newly created page | function resolvePromise(numUpdated) {
deferred.resolve(newPage);
} | [
"async newPage() {}",
"function createPage(websiteId, page) {\n var pageId = Math.random(); // random value between 0 and 1\n pageId = pageId * 999; // random rational between 0 and 999\n pageId = Math.floor(pageId);\n\n if (uniqueId(pageId)) {\n var toAdd = {\n \"_id\": pageId... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define getSurfaceArea() method and make the body of said method throw an error | getSurfaceArea() {
throw new Error("Abstract method must be overwritten by subclass!")
} | [
"surfaceArea() {\n return (\n 2 *\n (this.length * this.width +\n this.length * this.height +\n this.width * this.height)\n );\n }",
"getSurfaceArea() {\n const surfaceArea = 4 * Math.PI * Math.pow(this.radius, 2);\n return +surfaceArea.toFixed(3);\n }",
"surfaceA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configures the specified package, its entrypoint and its examples. | function configureEntryPoint(pkgName, entryPoint) {
var name = entryPoint ? pkgName + '/' + entryPoint : pkgName;
var examplesName = 'material-examples/' + name;
pathMapping['@angular/' + name] = srcRunfilePath + '/' + name;
pathMapping['@angular/' + examplesName] = srcRunfilePath + '/' + examplesName;
packa... | [
"function configureEntryPoint(pkgName, entryPoint) {\n var name = entryPoint ? pkgName + '/' + entryPoint : pkgName;\n var examplesName = 'components-examples/' + name;\n\n pathMapping['@angular/' + name] = srcRunfilePath + '/' + name;\n pathMapping['@angular/' + examplesName] = srcRunfilePath + '/' + examplesN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |