query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
When game call load, init World. | load () {
this.world = new window.World(this.game.ressources['map'])
} | [
"load() {\n log.debug('Entities - load()', this.game.renderer);\n this.game.app.sendStatus('Lots of monsters ahead...');\n\n if (!this.sprites) {\n log.debug('Entities - load() - no sprites loaded yet', this.game.renderer);\n this.sprites = new Sprites(this.game.renderer);\n\n this.sprites.o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tracks opening of product image gallery. | function trackProductGalleryOpen() {
var event_data = {
event: 'UniversalEvent',
eventCategory: 'User Interaction | Lightbox',
eventAction: 'open',
eventLabel: document.documentElement.getAttribute('data-product-name'),
eventValue: 0,
eventNonInteraction: false
};
shopAna... | [
"openGallery_() {\n // Build gallery div for the first time\n if (!this.gallery_) {\n this.findOrBuildGallery_();\n }\n this.lightboxCaption_.toggleOverflow(false);\n this.mutateElement(() => {\n this.container_.setAttribute('gallery-view', '');\n toggle(dev().assertElement(this.carous... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Picks value 112 var gemRandomValue = Math.floor(Math.random() 12) + 1; Loops through array to assign values to items | function crystValues(){
for (i = 0; i < gemArray.length; i++) {
gemArray[i] = Math.floor(Math.random() * 12) + 1;
}
//prints values of each item
//console.log(gemArray);
} | [
"function gemValueGenerator(selector) {\n // Here we generate a random number for each Gem\n var gemValue = Math.floor(Math.random() * 12) + 1;\n // This takes the gemValue variable, targets the \"value\" property, \\\n //and writes that variable onto it.\n $(selector).attr(\"valu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert an SVG path into a string, so that it's smaller when JSONified. This function is used by json(). | function svg_path_to_string(path) {
var str = '';
for (var i = 0, n = path.length; i < n; i++) {
var point = path[i];
if (point[0] !== 'Z') {
str += point[0] + point[1] + ',' + point[2];
} else {
str += 'Z';
... | [
"function _getSVGPath(coord, options) {\n let path\n , subpath\n , x\n , y\n , i\n , j\n ;\n\n path = '';\n for (i = 0; i < coord.length; i++) {\n subpath = '';\n for (j = 0; j < coord[i].length; j++) {\n [x, y] = _transform(coord[i][j], options);\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LocalAssociation: Simplified local object for the association resource. | function LocalAssociation(resource, connection) {
/**
* Constructor for the LocalAssociation local object.
*
* @param {object} resource BigML cluster resource
* @param {object} connection BigML connection
*/
var association, self, fillStructure;
this.resourceId = utils.getResource(resource);
if ... | [
"function Association(props) {\n return __assign({ Type: 'AWS::SSM::Association' }, props);\n }",
"static get(name, id, state, opts) {\n return new EipAssociation(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }",
"function PortfolioProductAssociation(props) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
turn the distortion on and off using the options.transistion variable | toggleDistortion() {
if (this.isDistorted) {
this.distortionLevel(1);
this.isDistorted = false;
} else {
this.distortionLevel(8);
this.isDistorted = true;
}
} | [
"function deOptimize() {\n\n\t\t// There is already no optimization occuring\n\t\tif ( params.level == 0 ) {\n\n\t\t\treturn\n\n\t\t// enable FXAA\n\t\t} else if ( params.level == 1 ) {\n\n\t\t\trenderer.setPixelRatio( window.devicePixelRatio );\n\t\t\tparams.level = 0 ;\n\n\t\t// set pixel ratio to the default dev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show loading icon inside element identified by 'selector'. | function showLoading(selector) {
var html = "<div>";
html += "<img src='imagens/ajax-loader.gif'></div>";
insertHtml(selector, html);
} | [
"function showLoadingStatus() {\n console.log(\"[menu_actions.js] Showing loading status\");\n showElementById(\"loading-status\");\n}",
"function add_loading_spinner(selector) {\n\t$(selector).bind('keyup', function(){\n\t\tif ($(this).val().length >= 1) {\n\t\t\t$(this).addClass(\"inputloading\");\n\t\t} else... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configured for github App | get githubAppId () {
return process.env.GITHUB_APP_ID
} | [
"function _buildAuthUrl(){\n return 'https://github.com/login/oauth/authorize?client_id=' \n + github_config.client_id \n + '&scope=repo&redirect_uri=' \n + github_config.callback_url\n }",
"function ghAuthenticate(){\n app.DB.authWithOAuthPopup(\"github\", function(er... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets an item's descendants | getItemDescendants(item, depth) {
return this.composer.getItemDescendants(item, depth);
} | [
"getItemChildren(item) {\n return this.composer.getItemChildren(item);\n }",
"getItemAncestors(item) {\n return this.composer.getItemAncestors(item);\n }",
"get subMenus() {\n\t\tconst slot = this.shadowRoot.querySelector('slot[name=\"sub-menu\"]');\n\t\treturn slot.assignedElements();\n\t}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Blocks clicks on the page. | function _blockClick()
{
if (clickBlockCount > 0)
throw new Error("Click over blocked");
clickBlockCount += 1;
} | [
"function unblockClick()\n{\n\tif (clickBlockCount === 0)\n\t\tthrow new Error(\"Click unblocked.\");\n\tclickBlockCount -= 1;\n\tif (clickBlockCount == 0 && \n\t\tbootstrap_alert.timeout == null && \n\t\tbootstrap_alert.closeOnTimeout)\n\t\tbootstrap_alert.close();\n}",
"function jsClickOnPage(e){\n if(jsIs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set west panel size | function setWestSize(pp){
if (pp.length == 0) return;
pp.panel('resize', {
width: pp.panel('options').width,
height: cpos.height,
left: 0,
top: cpos.top
});
cpos.left += pp.panel('options').width;
cpos.width -= pp.panel('options').width;
} | [
"function setSouthSize(pp){ \n\t\t\tif (pp.length == 0) return; \n\t\t\tpp.panel('resize', { \n\t\t\t\twidth: cc.width(), \n\t\t\t\theight: pp.panel('options').height, \n\t\t\t\tleft: 0, \n\t\t\t\ttop: cc.height() - pp.panel('options').height \n\t\t\t}); \n\t\t\tcpos.height -= pp.panel('options').height; \n\t\t}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handled automatically sends the specified status to all logged in friends | function sendStatus(status) {
friends.emit("sendStatus", status);
} | [
"handleAddUser() {\n this.props.searchedFriends.forEach((friend) => {\n if (friend.selected) {\n // console.log(this.props, 'THISTHSIHAF;SAFJDKS;FAJK;DLKS');\n this.props.addFriendRequestToDB(friend.id);\n socketActions.sendFriendRequest(this.props.userInfo.user, friend);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Map messages encrypted content to ASN.1 objects. | function _encryptedContentToAsn1(ec) {
return [
// ContentType, always Data for the moment
asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,
asn1.oidToDer(forge.pki.oids.data).getBytes()),
// ContentEncryptionAlgorithmIdentifier
asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [... | [
"encodeTBS()\n\t{\n\t\t//region Create array for output sequence\n\t\tconst outputArray = [];\n\t\t\n\t\tif((\"version\" in this) && (this.version !== Certificate.defaultValues(\"version\")))\n\t\t{\n\t\t\toutputArray.push(new asn1js.Constructed({\n\t\t\t\toptional: true,\n\t\t\t\tidBlock: {\n\t\t\t\t\ttagClass: 3,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Just tries to play the video and logs any errors. The play call is only made is the video is not already playing. | static tryPlayVideo(videoElement){return __awaiter$1(this,void 0,void 0,function*(){if(videoElement===null||videoElement===void 0?void 0:videoElement.ended){console.error('Trying to play video that has ended.');return false;}if(BrowserCodeReader$1.isVideoPlaying(videoElement)){console.warn('Trying to play video that is... | [
"play() {\n // rewind when user clicks play on ended scene\n this.goToStartIfEnded();\n this.disablePlayButtonUntilPlaybackStarts();\n this.waitForCanPlayAll().then(() => {\n this.videoElements.forEach(e => e.play());\n });\n }",
"static isVideoPlaying(video){retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a planet name as an input and returns its (array position) number | function planetToNumber(planet) {
let planetNum = 0;
switch (planet) {
case 'mercury':
planetNum = 0;
break;
case 'venus':
planetNum = 1;
break;
case 'earth':
planetNum = 2;
break;
case 'mars':
pl... | [
"function getPlanetsWorldPosition(planetNum) {\r\n\tif (planetNum !== 0){\r\n\t\tvar planetSin = Math.sin(planetOrbitAngle[planetNum - 1] * Math.PI / 180);\r\n\t\tvar planetCos = Math.cos(planetOrbitAngle[planetNum - 1] * Math.PI / 180);\r\n\t\tvar planetDistance = planetOrbitDistance[planetNum - 1] * globalOrbitDi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stops audio playback and empties the queue | stop() {
this.queueLock = true;
this.queue = [];
this.audioPlayer.stop(true);
} | [
"function stopAudio() {\n for (var key in audioSrcList) {\n if (audioSrcList.hasOwnProperty(key)) {\n audioSrcList[key][0].pause();\n audioSrcList[key][0].currentTime = 0;\n }\n }\n}",
"function clearAudio() {\n\t$(shell.audio.playerDiv).jPlayer(\"clearMedia\");\n}",
"function stopMusic() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle changes to the notebook model content. Notes The default implementation emits the `modelContentChanged` signal. | onModelContentChanged(model, args) {
this._modelContentChanged.emit(void 0);
} | [
"function updateContent() {\n var objData = _buildDataObject(vm.modelContent, 'updateContentBasic');\n objData.content._id = vm.modelContent._id.toString();\n\n return CioContentService.updateContent(objData,\n function(objErr, objResult, objPendingEvent) {\n \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new EarningsCallTranscripts. | function EarningsCallTranscripts() {
_classCallCheck(this, EarningsCallTranscripts);
EarningsCallTranscripts.initialize(this);
} | [
"static from(offerCreate) {\n var _a, _b, _c, _d;\n // takerGets and takerPays are required fields\n const takerGetsCurrencyAmount = (_a = offerCreate.getTakerGets()) === null || _a === void 0 ? void 0 : _a.getValue();\n if (!takerGetsCurrencyAmount) {\n throw new __1.XrpError... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
idx > collImg / tileDictImg image of pixels corresponding to tileImgs or the dictionary itself tileImgs list of drawable objects representing tiles or spritesheet | constructor(tileDictImg, tileImgs, tw=32, th=32, tileCollImgs) {
if (tileImgs instanceof Image) tileImgs = spriteSheetImg2ImgArray(tileImgs, tw, th);
this.tileImgs = tileImgs;
if (tileCollImgs != null) {
if (tileCollImgs instanceof Image) tileCollImgs = spriteSheetImg2ImgArray(tileCo... | [
"createCollisionMap(pixelImg) {\n let matrix;\n if (pixelImg instanceof Image) matrix = img2Matrix(pixelImg, this.tileDict);\n else matrix = imageData2Matrix(pixelImg, this.tileDict);\n let canvas = document.createElement(\"canvas\");\n let ctx = canvas.getContext(\"2d\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the rating and the release date from the result. | function getDates(result) {
var currentTime = new Date(),
rDate,
opened,
releaseDate;
if (result.release_dates.theater) {
rDate = result.release_dates.theater.split("-");
opened = new Date(rDate[0], rDate[1] - 1, rDate[2], 0, 0, 0);
... | [
"function ratings_obj() {\n this.fi;\n this.vendor;\n this.audit_category;\n this.rating;\n this.date;\n }",
"async getRatings() {\n try {\n if (!this.API || !this.issueR || this.isLoadingComments)\n return;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
builds a dom string with explicit HTML structure param product takes the product object | function buildDomString(product) {
domString = "";
domString += '<section class="product">'
domString += '<div class="title">'
domString += '<h2>'+product.name+'</h2>'
domString += '</div>'
domString += '<div class="image">'
domString += '<img src="'+product.imagePath+'"'
domString ... | [
"function printProductArraytoDom(productArray) {\n\n for (var i = 0; i < productArray.length; i++) {\n \tvar currentProduct = productArray[i]\n var productDomString = buildDomString(currentProduct);\n productContainer.innerHTML += productDomString;\n }\n}",
"function getProductOptionsHtml(products) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method to out child components | outChildComponents() {
if(Array.isArray(this.props.loopedComponents)) {
this.props.loopedComponents.forEach((component) => {
if(Array.isArray(component.renderedComponents)) {
Array.from(component.renderedComponents).forEach(comp => {
comp.o... | [
"render() {\n return Children.only(this.props.children);\n }",
"render() {\n const properties = Memory.getObject(allProperties, this);\n if (properties.recycle) {\n properties.recycle = false;\n if (properties.component && properties.component.canRecycle(properties.state)) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 736 Given an array of 10 numbers, return the maximum possible total made by summing just 5 of the 10 numbers. | function maxTotal(nums) {
return nums.sort((a, b) => b - a).slice(0, 5).reduce((x, i) => x + i);
} | [
"function maxSubarraySum(arr, number) {\n\tif(arr.length < number) {\n\t\treturn null;\n\t}\n\tlet endPos = arr.length - number;\n\tlet sum = 0, tempSum = 0;\n\tfor(let i = 0; i < number; i++) {\n\t\tsum = sum + arr[i];\n\t}\n\ttempSum = sum;\n\tfor(let i = 1; i <= endPos; i++) {\n\t\ttempSum = tempSum - arr[i - 1]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create debug canvas for `Faceapi` markers | createDebugCanvas() {
this.debugCanvas = faceapi.createCanvasFromMedia(this.video);
this.body.append(this.debugCanvas);
faceapi.matchDimensions(this.debugCanvas, this.getVideoSize());
this.hasDebugCanvas = true;
} | [
"function setupPlaceholder() {\n previewContext.fillStyle = 'rgb(200, 200, 200)';\n previewContext.fillRect(0, 0, previewCanvas.width, previewCanvas.height);\n previewContext.fillStyle = 'rgb(150, 150, 150)';\n previewContext.font = '16px Helvetica';\n previewContext.fillText('PREVIEW', 120, 150);\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pull random color from colorObj | function getRandomColor(obj) {
const keys = Object.keys(obj);
return obj[keys[Math.floor(keys.length * Math.random())]];
} | [
"function colorTarget() {\n let colorPicked = Math.floor(Math.random() * colors.length);\n return colors[colorPicked];\n}",
"function randomColor(){\n\tlet selectedColor = content[Math.floor(Math.random()*(content.length-1))];\n\tlet line = selectedColor.split(',');\n\tlet hexCode = line[1].trim();\n\t// co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initialize the table with comments data | function initCommentTable(data){
var table = $('#tabComments').DataTable({
"data" : data,
"columns" : [ {
"data" : "date"
}, {
"data" : "comment"
} ]
});
} | [
"createCommentsTable() {\r\n const sql = `\r\n CREATE TABLE IF NOT EXISTS comments (\r\n CommentID integer primary key,\r\n comment text,\r\n time integer,\r\n date integer,\r\n is_Admin integer)`\r\n return this.DB.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onLoggedIn event will set the state to the user variable | onLoggedIn(user) {
this.setState({
user
});
} | [
"SET_LOGGED_IN(state, value) {\n state.user.loggedIn = value;\n }",
"function userLoggedIn() {\n let username = sessionStorage.getItem('username');\n $('#spanMenuLoggedInUser').text(`Welcome, ` + username + '!');\n $('#viewUserHomeHeading').text(`Welcome, ` + username + '!')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update item stock from the 1st tab (pending & revert order) | updateItemsStock(id, stock) {
return this.database
.executeSql("UPDATE items SET stock = ? WHERE items_id = ?", [stock, id])
.then((_) => {
this.loadItems();
});
} | [
"function changeInventory(id, currentQuantity, addOrSubtract){\n\tvar newQuantity = currentQuantity + addOrSubtract;\n\tvar updateText = \"UPDATE Products\\\n\t\tSET StockQuantity = ?\\\n\t\tWHERE id = ?\";\n\tconnection.query(updateText, [newQuantity, id], function(error, results){\n\t\tif(error){throw error};\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the number of turns that have passed since the last instance of the given passage occurred within the story history or `1` if it does not exist. If multiple passages are given, returns the lowest count (which can be `1`). | function lastVisited(/* variadic */) {
if (arguments.length === 0) {
throw new Error('lastVisited called with insufficient parameters');
}
if (State.isEmpty()) {
return -1;
}
const needles = Array.prototype.concat.apply([], arguments);
const played = State.passages;
const uBound = played.length ... | [
"function currentRoundIndex(gameSnap) {\n return completedRounds(gameSnap).length;\n}",
"incrementturnCount() {\n let currentturnCount = this.state.currentturnCount;\n let maxturnCount = this.state.maxturnCount;\n return currentturnCount < maxturnCount ? currentturnCount + 1 : -1;\n }",
"function cou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Refect .spEdit : width / height | function f_refectSpEditWidthHeight(){
var w = $('#sp-taginfo-width');
var h = $('#sp-taginfo-height');
// set .spEdit css
fdoc.find('.spEdit').css('width',w.val()+'px').css('height',h.val()+'px');
} | [
"function airsliderSetSlidesEditingAreaSizes() {\n var width = parseInt($('.air-admin #air-slider-settings .air-slider-settings-list #air-slider-startWidth').val());\n var height = parseInt($('.air-admin #air-slider-settings .air-slider-settings-list #air-slider-startHeight').... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================================================================================ Delegate to access longterm storage ================================================================================ Create the delegate object to handle the database (longterm storage) access | function StorageDelegate() {
} | [
"constructor(DBPath){\n this.db = level(DBPath);\n }",
"function WrapperHandler (){\n\t//settings parameters \n\tthis.database = \"http://tdk3.csf.technion.ac.il:8890/sparql\";\n\tthis.graph_uri = \"http://dbpedia.org\";\n\t//create api\n\tthis.api = new ApiHandler(this);\n\t//setup wrapper\n\tthis.setup();\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create New API Key | async createApiKey (obj, args, context) {
try {
return {
key: await WIKI.models.apiKeys.createNewKey(args),
responseResult: graphHelper.generateSuccess('API Key created successfully')
}
} catch (err) {
return graphHelper.generateError(err)
}
} | [
"static generateKey(){\n\t\tlet kparams = {};\n\t\treturn new kaltura.RequestBuilder('playready_playreadydrm', 'generateKey', kparams);\n\t}",
"function createSSHKey(key, apiToken) {\n\tvar data = {\n\t\tname: 'vmscustom_' + moment().toISOString() + '_' + _.random(0, 999999)\n\t};\n\tvar ii = 'public_key';\n\tda... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Closes an opened dialog or does nothing if already closed | @action closeDialog() {
if (this.dialog) this.dialog.opened = false;
} | [
"close() {\n this.showModal = false;\n\n this.onClose();\n }",
"closeDeleteExerciseDialog()\n {\n this.deleteDialog.MaterialDialog.close();\n }",
"cancel () {\n this.close();\n this._reject(new Error('User closed dialog.'));\n }",
"closeAl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::AppMesh::VirtualGateway.VirtualGatewayLogging` resource | function cfnVirtualGatewayVirtualGatewayLoggingPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnVirtualGateway_VirtualGatewayLoggingPropertyValidator(properties).assertSuccess();
return {
AccessLog: cfnVirtualGatewayVirtualGatewayAccessLog... | [
"function cfnVirtualGatewayLoggingFormatPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_LoggingFormatPropertyValidator(properties).assertSuccess();\n return {\n Json: cdk.listMapper(cfnVirtualGatewayJsonFormatRefPrope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
provide user feedback visually indicating moles were whacked and calls function to return to standby | function whacked() {
if (timeLeft > 0) {
this.classList.remove("mole");
this.removeEventListener("click", giveMePoints, true);
this.classList.add("whacked");
setTimeout(resetWhacked, 250);
}
} | [
"function enableMarbles() {\n\tgameObject.BroadcastMessage(\"enableMarble\");\n}",
"function gameLose() {\n gameState.active = false;\n gameReset();\n var startBtn = \"Retry\";\n var startText = \"<div class=\\\"splashtext\\\">You died :(</div>\";\n gamescreen(startBtn, startText);\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if overlay is doing opening or closing transition | get transitioning() {
return this._fullyOpened === OpenedState.OPENING || this._fullyOpened === OpenedState.CLOSING;
} | [
"shouldToggleByCornerOrButton() {\n if (this._animationInProgress)\n return false;\n if (this._inItemDrag || this._inWindowDrag)\n return false;\n if (!this._activationTime ||\n GLib.get_monotonic_time() / GLib.USEC_PER_SEC - this._activationTime > OVERVIEW_ACTI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the preorder position of the given node in the tree, or 1 if the node is not in the tree. | treePosition(node) {
var found, pos;
pos = 0;
found = false;
this.foreachTreeNode(this.document(), function(childNode) {
pos++;
if (!found && childNode === node) {
return found = true;
}
});
if (found) {
return pos;
... | [
"getInorderSuccessor(node) {\n if(node == null || node.left == null)\n return node;\n return this.getInorderSuccessor(node.left);\n }",
"isPreceding(node) {\n var nodePos, thisPos;\n nodePos = this.treePosition(node);\n thisPos = this.treePosition(this);\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funktion, um alle Texturen eines Nutzers auf einer Website/Domain zu bekommen (schon geladene Texturen werden nicht erneut geladen). Bspw. fuer Zeitstrahl. Funktion gibt Promise zurueck. | function getAllTexturesOfOneWebsiteForOneUser(user, website, args = null) {
//Rueckgabeparameter wird als leeres Objekt initialisiert.
let texturesOfOneWebsiteForOneUser = {};
//Alle Namen von Bildern werden in imageNames gespeichert
let imageNames = {};
//iteriere ueber alle Webseiten bzw. Webseite... | [
"function getAllTexturesOfAllUser() {\n //Rueckgabeparameter wird als leeres Objekt initialisiert.\n let texturesOfAllUsers = {};\n //iteriere ueber alle Nutzer und lade alle Texturen fuer diesen Nutzer\n const promises = Object.keys(window.importedData.allUsers).map(key => {\n let user = window.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All); // a: upperleft, b: lowerright | AddRectFilled(a, b, col, rounding = 0.0, rounding_corners_flags = ImDrawCornerFlags.All) {
this.native.AddRectFilled(a, b, col, rounding, rounding_corners_flags);
} | [
"AddRect(a, b, col, rounding = 0.0, rounding_corners_flags = ImDrawCornerFlags.All, thickness = 1.0) {\r\n this.native.AddRect(a, b, col, rounding, rounding_corners_flags, thickness);\r\n }",
"AddRectFilledMultiColor(a, b, col_upr_left, col_upr_right, col_bot_right, col_bot_left) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the transform on all children of this container for rendering | updateTransform()
{
this._boundsID++;
this.transform.updateTransform(this.parent.transform);
// TODO: check render flags, how to process stuff here
this.worldAlpha = this.alpha * this.parent.worldAlpha;
for (let i = 0, j = this.children.length; i < j; ++i)
{
... | [
"function updateTransform() {\n scope.style.transform = 'translate(0,' + current + 'px)';\n }",
"childrenChanged() {\n if (true === this.adjustGroupWhenChildrenChange) {\n this.adjustChildrenVertically();\n this.adjustChildrenHorizontally();\n }\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch the bib and authority attribute definitions | function vlFetchBibAttrDefs(postcomplete) {
bibAttrDefs = [];
fieldmapper.standardRequest(
['open-ils.permacrud', 'open-ils.permacrud.search.vqbrad'],
{ async: true,
params: [authtoken, {id:{'!=':null}}],
onresponse: function(r) {
var def = r.recv().cont... | [
"fetchAttributes() {\n let result = {};\n Object.values(this.attributes).map(attribute => {\n result[attribute.type] = Utility.getInstance().clone(attribute);\n })\n this.traits.map(trait => {\n Object.values(trait.fetchAttributes()).map(attribute => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints the code point (or end of file reference) at a given location in a source for use in error messages. Printable ASCII is printed quoted, while other points are printed in Unicode code point form (ie. U+1234). | function printCodePointAt(lexer, location) {
const code = lexer.source.body.codePointAt(location);
if (code === undefined) {
return _tokenKind.TokenKind.EOF;
} else if (code >= 0x0020 && code <= 0x007e) {
// Printable ASCII
const char = String.fromCodePoint(code);
return char === '"' ? "'\"'" : `... | [
"function show_char(c) /* (c : char) -> string */ {\n var _x24 = (((c < 0x0020)) || ((c > 0x007E)));\n if (_x24) {\n if ((c === 0x000A)) {\n return \"\\\\n\";\n }\n else {\n if ((c === 0x000D)) {\n return \"\\\\r\";\n }\n else {\n if ((c === 0x0009)) {\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
makes a kernel from a list of arrays; used to parse the convolve filter parameter | function makeKernel(data) {
let rows = data.length;
let cols = data[0].length;
let unrolled = [];
for (let r = 0; r < rows; ++r) {
let el = data[r];
for (let c = 0; c < cols; ++c) {
if (c >= el.length) {
unrolled[unrolled.length] = 0;
} else {
... | [
"function GaussianFilter(arr, w, h){\n\t\tvar k = 3,\n\t\t\tsigma = 1,\n\t\t\tg_filter = fspecial('gaussian', k, sigma),\n\t\t\td = Math.floor(k/2),\n\t\t\tnewArr = [];\n\n\t\tnewArr = arr;\n\n\t\tfor (var x = d; x < w-d; x++) {\n\t\t\tfor (var y = d; y < h-d; y++) {\n\t\t\t\tvar i = getPixel(x, y, w),\n\t\t\t\t\ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Within the accordion body function, we now create the city menu | function buildCityMenu(country) {
const menu = document.createElement('ul');
menu.classList.add('list-group-flush');
country.cities.forEach((city) => {
const item = document.createElement('li');
item.classList.add('list-group-item');
item.classList.add('city');
item.innerText = city... | [
"function populateCityList() {\r\n var cityIds = new Object();\r\n cityIds[WME_ADD_UNKNOWN] = \"No City\";\r\n for (var cit in wazeModel.cities.objects) {\r\n var city = wazeModel.cities.get(cit);\r\n if (city && cityIds[city.id] == null && city.name != null && city.name.length > 0) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Language: Prolog Description: Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics. | function prolog(hljs) {
const ATOM = {
begin: /[a-z][A-Za-z0-9_]*/,
relevance: 0
};
const VAR = {
className: 'symbol',
variants: [
{
begin: /[A-Z][a-zA-Z0-9_]*/
},
{
begin: /_[A-Za-z0-9_]*/
}
],
relevance: 0
};
const PARENTED = {
begin: ... | [
"function codeLove() { //function that does exactly what it looks like it does.\n return \"I love code\";\n}",
"function greetings(name, language){\n if(language === \"French\"){\n console.log(`Bonjour, ${name}!`)\n }\n else if(language === \"Spanish\"){\n console.log(`Hola... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called in Admin.php to set up the edit page to add a new database entry for a Program | function addProgram() {
location = "EditPage.php?mode=add&what=program";
} | [
"function editProgram() {\n\tvar getID = document.getElementById(\"programDropdown\").selectedIndex;\n\tlocation = \"EditPage.php?mode=edit&what=program&id=\"+ getID;\n}",
"function saveProgram() {\n var programName=programNameField.value;\n if (programName==\"\") {\n\talert(\"Enter a program name first\");... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handler for completed bakes | bakingComplete() {
this.setBakingStatus(false);
let duration = Date.now() - this.bakeStartTime;
duration = duration.toLocaleString() + "ms";
const progress = this.getBakeProgress();
if (progress.total > 1) {
let width = progress.total.toLocaleString().length;
... | [
"function dispatchingFilesFinished() {\n // NOTE: ignoring possible error because processOneFile never passes error to async\n if (this.errors.length > 0) {\n callback(this.errors);\n } else {\n callback(null, this.stats);\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear the reminder input box. | function clearReminderInput() {
$('#reminder-input').val('');
} | [
"function clearVacationDaysScreen(){\n\t$(\"#vacationDaysInput\")[0].value = \"\";\n\t$(\"#vacationDaysInput\").blur();\n}",
"_clearDate() {\n this.value = undefined;\n this.display = '';\n }",
"function clear(event) {\n\tevent.preventDefault();\n\tfirstInput.value = null;\n}",
"_onClearButtonCli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw background of canvas using a tile from the style sheet Args: pen, a context from the canvas object | function drawBG(pen) {
let tile = new Image();
tile.src = "pictures/sprite_sheet.png";
let tileLen = 10; //tile is a 10x10 square
let x = 0, y = 0;
for(x=0; x<64; x+=1) {
for(y=0; y<64; y +=1) {
//to use drawImage() with sprite sheet, it takes 9 args:
//1. imgName, 2. x of sprite cutout 3. y of sprite cuto... | [
"paint() {\n var ctx = this.canvas.getContext(\"2d\");\n ctx.fillStyle = this.backgroundColor;\n ctx.fillRect(0,0,this.canvas.width,this.canvas.height);\n this.draw(ctx);\n }",
"function _renderBackground () {\n\t_ctx.fillStyle = _getColor(\"background\");\n _ctx.fillRect(0, 0, _ct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate player winning percentage data | calculatePercentage(player) {
player.percentage = (parseFloat(player.wins) / parseFloat(player.games)).toFixed(3);
} | [
"function batspergame (player) {\n\treturn player.atbats / player.games;\n}",
"function calcPercent(outcome) {\n // substring because the first 16 characters are based from the assoc_id and will stay the same\n var seed = parseInt(outcome.substr(16), 16);\n var x = Math.sin(seed) * 10000;\n return x -... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
s Task 2 Create a AddableExamResultSet constructor that takes no arguments, and inherits getHighest and getLowest and getAverage from ExamResultSet. It should also have the following function: add() that takes a number as the argument, and adds this number to the result set. So: const set = new AddableExamResultSet(); ... | function AddableExamResultSet(){
this.examNumbers = [];
} | [
"function RatingMovingAverage(){\n this.prototype = new MovingAverage(); \n\n\t/* Superclass Function Prototypes */\n // these functions are defined in the superclass and used in the subclass\n\tthis.getCorrelationsFor = this.prototype.getCorrelationsFor;\n\tthis.setName = this.prototype.setName;\n\tthis.getN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getOriginal Returns the number as it was passed in, which may include nonnumber characters. This function is new in v1.0.2 | function getOriginalNF()
{
return (this.numOriginal);
} | [
"function getOriginalNF()\n{\n return (this.numOriginal);\n}",
"function getUnformattedNumber(number){\n \n // Remove anything but digits and decimal points\n \n number = number.toString().replace(/[^0-9.]/g, '');\n \n // Remove any decimal points after the first decimal point\n \n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an object containing the latest velocity of every MotionValue on a VisualElement | function getVelocity(visualElement) {
var velocity = {};
visualElement.forEachValue(function (value, key) { return (velocity[key] = value.getVelocity()); });
return velocity;
} | [
"updateVelocity(newVelocity) {\r\n this.v = newVelocity;\r\n }",
"getVelocity() {\n return this.model ? this.model.getVelocity() : null;\n }",
"function updateVelocity() {\n for (let i = 0; i < ballArray.length; i++) {\n let ball = ballArray[i];\n\n //velocity affected by acceleration\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the content ID in the component's state. | handleUpdateContentId(event) {
this.setState({ contentId: event.target.value });
} | [
"function updateContent() {\n var objData = _buildDataObject(vm.modelContent, 'updateContentBasic');\n objData.content._id = vm.modelContent._id.toString();\n\n return CioContentService.updateContent(objData,\n function(objErr, objResult, objPendingEvent) {\n \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a new delivery to the "master" object in local storage. | function addNew() {
const retrievedMaster = localStorage.getItem(`master`);
const retrievedMasterParsed = JSON.parse(retrievedMaster);
retrievedMasterParsed.push([
active.fields[0].e.value,
active.fields[1].e.value,
active.fields[2].e.value,
... | [
"function addDelivery () {\n\tvar settings = [];\n\tsettings.from = lastFrom = (widget.preferenceForKey('store')) ? \n\t\twidget.preferenceForKey('store') : 'www.amazon.com';\n\n\teditingDelivery = new Delivery(settings);\n\tupdateEditForm(editingDelivery.from);\n\tfillEditForm(editingDelivery,true);\n\tswitchToVie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tela menor 1000px background do ".shareup" virar azul escuro | function myBackground() {
document.getElementById("myShareupback").classList.toggle("show2");
} | [
"function bgSway() {\n var bg = $('#bg');\n TweenMax.to(bg, 12, {x:64, ease:Sine.easeInOut});\n TweenMax.to(bg, 12, {x:-64, ease:Sine.easeInOut, delay: 12, onComplete:bgSway});\n}",
"function switchBackground() {\n owner = publicPhotos[index].owner;\n photoURL = mapU... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For each network interface, create a multicastcapable socket and add it to our list. | function setupInterfaceList()
{
let interfaces = os.networkInterfaces();
if(interfaces)
{
for(let interfaceName in interfaces)
{
interfaces[interfaceName].forEach((addressInfo) =>
{
if(addressInfo.internal == false && addressInfo.family == 'IPv4' &&
(!sockets.hasOwnProperty(interfaceName) || soc... | [
"initSockets() {\n // TODO: figure out the correct events\n // that need to be broadcasted\n this.nameswaps.on('witness', (data) => {\n const sockets = this.channel('nameswaps');\n\n if (!sockets)\n return;\n\n // TODO: think about the channels here\n this.to('nameswaps', 'new wi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates progress bars on asset cards. | updateOfflineProgress_() {
for (const card of this.assetCards_) {
card.updateProgress();
}
} | [
"function updateProgress()\n{\n /* Set the width of the progress bars */\n for (const e of progressElts)\n e.style.width = 100 * curslide.b6slidenum / numslides + \"%\";\n\n /* Set the content of .slidenum elements to the current slide number */\n for (const e of slidenumElts)\n e.textContent = curslide.b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function to clear a node. | function clearNode(node) {
setTextContent(node, "");
} | [
"clear() {\n this.name = '';\n this.adj.clear();\n this.node.clear();\n clear(this.graph);\n }",
"function docClear (node)\n{\n\twhile (node.firstChild)\n\t\tnode.removeChild(node.firstChild);\n\tnode.innerHTML = \"\";\n}",
"removeNode(node) {\n if (this.graph[node]) {\n delete th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the first message header in a folder. | firstMsgHdr(folder) {
let enumerator = folder.msgDatabase.EnumerateMessages();
let first = enumerator[Symbol.iterator]().next();
return first.done ? null : first.value;
} | [
"getMsgHdrN(folder, n) {\n let i = 0;\n for (let next of folder.msgDatabase.EnumerateMessages()) {\n if (i == n) {\n return next;\n }\n i++;\n }\n return null;\n }",
"_firstHeading() {\n const headings = this._allHeadings();\n return headings[0];\n }",
"get header... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private function: Instantiates the fs.watchFile interface or binds listeners to an existing one covering the same file system entry path string, path to be watched fullPath string, absolute path options object, options to be passed to fs.watchFile handlers object, container for event listener functions Returns close fu... | function setFsWatchFileListener(path, fullPath, options, handlers) {
var listener = handlers.listener;
var rawEmitter = handlers.rawEmitter;
var container = FsWatchFileInstances[fullPath];
var listeners = [];
var rawEmitters = [];
if (
container && (
container.options.persistent < options.persiste... | [
"function FileSystemWalker() {\r\n\r\n\t\t\t/**\r\n\t\t\t * Keeps a record of all listed files.\r\n\t\t\t * @field\r\n\t\t\t * @private\r\n\t\t\t */\r\n\t\t\tvar listedFiles = {};\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Custom initialization for the FileSystemWalker class.\r\n\t\t\t * @method\r\n\t\t\t * @private\r\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
keyDown Capture keys when enableCursorHotkey toggle pane if hotkey pressed | function keyDown (evt) {
if (!evt) return true;
var code = evt.keyCode;
if (code < 33) return true; // ignore special keys: ENTER, TAB, etc
var
PANE = {
38: "north" // Up Cursor
, 40: "south" // Down Cursor
, 37: "west" // Left Cursor
, 39: "east" // Right Cursor
}
, isCursor... | [
"keyControl() {\n\n if (keyIsDown(this.activateKey)) {\n this.bossManipulation = true;\n } else {\n this.bossManipulation = false;\n }\n }",
"function setHotKeys() {\n\tdocument.onkeydown = function(ev) {\n\t\tev = ev||window.event;\n\t\tkey = ev.keyCode||ev.which;\n\t\tif (key == 18 && !ev.ct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The first step of rotating one of the user's uploaded images 90 degrees to the left. param imageName: The name of the image to rotate. | async prepareRotateImage(imageName) {
let imageURL = await GetImageURLByName(this.state.imageUrls, imageName);
this.setState({
toRotateInfo: { imageName: imageName, imageURL: imageURL },
showRotateModal: true
});
this.drawImageOnCanvasFromImgUrl(imageURL, true);... | [
"rotateImage(left) {\n //Rotate the canvas\n RotateImage90Degrees(this.canvasRef.current, left);\n\n //Draw the new image\n this.drawImageOnCanvasFromImgUrl(this.state.toRotateInfo.imageURL, false);\n }",
"function privatePrevious() {\n\t \timageCurrent--;\n\t \tif (imageCurrent < 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes in a file string, returns array of event objects that were files changes, not publish events | function fileVersionArray(file) {
return historyArray.filter((version) => {
if (file) {
if (file[0] !== '/') file = '/' + file;
return version.changed === file && version.files.includes(file);
}
});
} | [
"filter (file) {\n return file.name.includes(\"watch\");\n }",
"function inputChanged(e) {\n var files = e.target.files;\n var attachments = [];\n for (var i = 0; i < files.length; i++) {\n pushAttachment(files.item(i));\n }\n bugChanged();\n}",
"function handleFileEvent(touchedFile) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to get an eventId from a tournament | async function get_event_id(tournament_name, event_name, token) {
let variables = {"tourneySlug": tournament_name};
let response = await run_query(t_queries.EVENT_ID_QUERY, variables, token);
return filters.event_id_filter(response.data, event_name);
} | [
"async getInvitationsByEventId(req, res) {\n const userAuth = jwt_decode(req.token);\n const { event_id } = req.params;\n\n try {\n const user = await User.findOne({ cognito_id: userAuth.sub });\n\n // Check if user exist\n if (!user) {\n return r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ACTION: Counts all guests, displays values and hides stuff if empty. | function guestCount() {
let attendingGuests = 0;
let unconfirmedGuests = 0;
let totalGuests = 0;
const filterCheckboxArea = document.querySelector('.filterArea');
for (let i = 0; i < ul.children.length; i += 1) {
const guestStatus = ul.children[i].className;
if (guestStatus == htmlT... | [
"function updateNumberOfGuests() {\n \tcontainer.find(\"#numberOfGuests\").html(model.getNumberOfGuests());\n }",
"function showCount() {\n count.textContent = 'Showing '+ employees.length + ' employees';\n}",
"function updateCountDisplays() {\n\tdocument.getElementById(\"watcherCount\").innerHTML ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
:: bool True if this is a textblock type, a block that contains inline content. | get isTextblock() { return false } | [
"function isInlineTex(content) {\n\t return content[0] !== '\\n';\n\t}",
"isBlock(editor, value) {\n return Element$1.isElement(value) && !editor.isInline(value);\n }",
"get type() {\n return typeof this._content == 'number'\n ? BlockType.Text\n : Array.isArray(this._content)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
foto de um dos membros da banda | function getImgMembro(b, m) {
var banda = docXML.getElementsByTagName("banda")[b].getElementsByTagName("membros")[0];
return "img/" + banda.getElementsByTagName("membro")[m].getAttribute("foto");
} | [
"function getImgAlbum(b, a) {\n var banda = docXML.getElementsByTagName(\"banda\")[b].getElementsByTagName(\"discografia\")[0];\n return \"img/\" + docXML.getElementsByTagName(\"album\")[a].getAttribute(\"imagem\");\n}",
"function getPicturesques() {\n //\n //\n //Picturesques.list(); listPicturesque\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
"Aircraft 2 shooting cannon" update function | function aircraft2sc_update() {
slowMove_update.call(this);
if (this.frameCounter % 20 === 0) {
var enemy = new Enemy(this.middleX, this.middleY, blinkyTracer_dimension, meteor2_update, meteor_render);
enemyList.addElement(enemy, false);
displayList.addElement(enemy, false);
}
} | [
"function aircraft3sc_update() {\n slowMove_update.call(this);\n if (this.frameCounter % 20 === 0) {\n var enemy = new Enemy(this.middleX, this.middleY, blinkyTracer_dimension, blinkyTracer_update, blinkyTracer_render, blinkyTracer_damage());\n enemyList.addElement(enemy, false);\n displa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an unsorted array containing numbers and a number 'k', find the first 'k' missing positive numbers in the array. Example: input: nums = [3, 1, 4, 5, 5] , k = 3 output: [1, 2, 6] input: nums = [2, 3, 4] , k = 3 output: [1, 5, 6] input: nums = [2, 3, 4] , k = 2 output: [1, 2] Function finds 'k' smallest missing pos... | function findMissingNums(nums, k){
const missingNums = [];
const extraNums = new Set(); // remember extra numbers seen in nums
const n = nums.length;
// Sort array in place with cyclic sort
let i = 0;
while (i < n){
const j = nums[i] - 1;
if (nums[i] > 0 && nums[i] <= n && nums[i] !== nums[j]){
... | [
"function findMissing(array){\n\t// edge cases\n\tif(array[0] != 1) return 1;\n\tif(array[array.length - 1] != array.length + 1) return array.length + 1;\n\tfor(var i = 1; i < array.length; i++){\n\t\t\t// if next element is greater by more than 1, missing number is it minus 1.\n\t\t\tif(array[i] - array[i-1] > 1) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle the CSS direction class for the given widget. | function toggleDirection(widget, dir) {
widget.toggleClass(LEFT_TO_RIGHT_CLASS, dir === 'left-to-right');
widget.toggleClass(RIGHT_TO_LEFT_CLASS, dir === 'right-to-left');
widget.toggleClass(TOP_TO_BOTTOM_CLASS, dir === 'top-to-bottom');
widget.toggleClass(BOTTOM_TO_TOP_CLASS, dir ==... | [
"function setTextDirection(direction) {\n document.body.setAttribute('dir', direction);\n}",
"setSide (side) {\n this.reversed = (side === 'b')\n }",
"toggleFlag() {\n\t\tif (this.isFlagged) {\n\t\t\tthis.element.classList.remove('flag');\n\t\t\tthis.isFlagged = false;\n\t\t} else {\n\t\t\tthis.element.cla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
renders each pebbel animation in a sequence of still images saved ina png file. The use needs to enter the nodeIndex of the pebbel to be rendered | function PNGSequence() {
p5.clear(255);
if (!DataWrangler.table) {
p5.text("No data loaded yet", 100, 100)
} else if (nodeIndex) {
pebbles[nodeIndex].displayRow(pG, data.rows[nodeIndex].obj);
// render image
let fctr = pG.width / pG.height;
... | [
"function renderNPCSprites(aDev,aGame)\n{\n ////this makes a temp object of the image we want to use\n //this is so the image holder does not have to keep finding image\n tempImage1 = aDev.images.getImage(\"orb\")\n tempImage2 = aDev.images.getImage(\"fireAmmo\")\t\n for (var i = 0; i < aGame.gameSp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Author: HK Name: _sortGroups Description: sorts groups switch their positions Params: 2 groups to compare Return: integer | function _sortGroups(first, second) {
var firstGroup = CockpitHelper.hashedGroupList[first];
var secondGroup = CockpitHelper.hashedGroupList[second];
return firstGroup.position - secondGroup.position;
} | [
"function compareGroups(participant1, participant2) {\n if (participant1.group.number < participant2.group.number) {\n return 1;\n }\n if (participant1.group.number > participant2.group.number) {\n return -1;\n }\n return 0;\n}",
"function applyGrouping(groups) {\n var orde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replaces a matched string in a file | function replaceInFile(filePath, matcher, replacement) {
let data = fs.readFileSync(filePath, 'utf8');
data = data.replace(matcher, replacement);
fs.writeFileSync(filePath, data, 'utf8');
} | [
"function replaceSave(oldFile, newFile, oldStr, newStr) {\r\n\tvar fr = File.OpenTextFile(oldFile, ForReading);\r\n\toldText = fr.ReadAll();\r\n\tfr.close();\r\n\t\r\n\tnewText = oldText.replace(new RegExp(oldStr, \"g\"), newStr);\r\n\t\r\n\tvar fw = File.OpenTextFile(newFile, ForWriting, true);\r\n\tfw.Write(newTe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The current progress of the loop interval. Returns 0 if the event is not started yet or it is not set to loop. | get progress() {
if (this._loop) {
const ticks = this.context.transport.ticks;
const lastEvent = this._state.get(ticks);
if (lastEvent !== null && lastEvent.state === "started") {
const loopDuration = this._getLoopDuration();
const progress = (ticks - lastEvent.time) % loopDurat... | [
"get percent() {\n return Math.max(0, (SongManager.player.currentTime - this.startPoint) / (this.endPoint - this.startPoint));\n }",
"function updateProgressValue() {\n progressBar.max = song.duration;\n progressBar.value = song.currentTime;\n document.querySelector('.currentTime').innerHTML = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
navigates the user to a view element with given name if the element not found in the compiled markup, the same is searched in the available dialogs in the page | goToElementView(viewElement, viewName, pageName, variable) {
let $el, parentDialog;
const activePage = this.app.activePage;
if (viewElement.length) {
if (!this.app.isPrefabType && pageName === activePage.activePageName) {
viewElement = this.getViewElementInActivePage(... | [
"function jumpToElementByName(name) {\n var theElement = jq(\"[name='\" + escapeName(name) + \"']\");\n if (theElement.length != 0) {\n if (!usePortalForContext() || jQuery(\"#fancybox-frame\", parent.document).length) {\n jQuery.scrollTo(theElement, 1);\n }\n else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Confirm a question. Returns `true` or `false`. | confirm(q) {
var res;
//(1) arguments
if (typeof(q) == "string") q = {name: q};
//(2) prompt
if (this.responses.hasOwnProperty(q.name)) res = ([true, "true", "yes"].indexOf(this.responses[q.name]) >= 0);
else res = inquirer.confirm(Object.assign(getQOptions(this.params[q.name]), q));
this... | [
"_checkConfirmationPrompt(aCommand) {\n const kDontAskAgainPref = \"mailnews.\" + aCommand + \".dontAskAgain\";\n // default to ask user if the pref is not set\n if (!Services.prefs.getBoolPref(kDontAskAgainPref, false)) {\n let checkbox = {value: false};\n let choice = Services.prompt.confirmEx(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the (cached) module resolution information for a module name that was exported from a SourceFile. The compiler populates this cache as part of analyzing the source file. | static getResolvedModule(sourceFile, moduleNameText) {
// Compiler internal:
// https://github.com/microsoft/TypeScript/blob/v3.2.2/src/compiler/utilities.ts#L218
return ts.getResolvedModule(sourceFile, moduleNameText);
} | [
"function getModuleByExports(exportModule, req = require) {\n let ks = Object.keys(req.cache);\n let i = ks.length;\n while (--i) {\n let key = ks[i];\n let mod = req.cache[key];\n if (mod.exports === exportModule) {\n return mod;\n }\n }\n return null;\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make trigonometric function table | function _makeCosSinTable() {
var n2 = _n >> 1,
n4 = _n >> 2,
n8 = _n >> 3,
n2p4 = n2 + n4,
t = Math.sin(Math.PI / _n),
dc = 2 * t * t,
ds = Math.sqrt(dc * (2 - dc)),
c = _cstb[n4] = 1,
... | [
"function theta_oh(o,h) {\n console.log((Math.asin(o/h))*180/Math.PI)\n}",
"function cos (angle) { return Math.cos(rad(angle)); }",
"function FFT() {\n\n var _n = 0, // order\n _bitrev = null, // bit reversal table\n _cstb = null; // sin/cos table\n var _tre, _tim;\n\n this.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
goalOrientedRobot uses the findRoute | function goalOrientedRobot({ place, parcels }, route) {
if (route.length == 0) {
let parcel = parcels[0];
if (parcel.place != place) {
route = findRoute(roadGraph, place, parcel.place)
} else {
route = findRoute(roadGraph, place, parcel.address)
}
}
re... | [
"function findRoute(start, end, map, opt) {\n\n var step = opt.step;\n var startPoints, endPoints;\n var startCenter, endCenter;\n\n // set of points we start pathfinding from\n if (start instanceof g.rect) {\n startPoints = getRectPoints(start, opt.startDirections, opt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns all posible zone entries within +/ 24 h of the given time so that ambiguities can be detected / fixed | function findZoneEntries(zone, millis, pad) {
if (pad === undefined) pad = 24*3600*1000;
var entries = zone.filter(function(e){ return millis+pad >= e.from && millis-pad < e.to });
if (entries.length > 0)
return entries;
throw "Time zone info not available for "
+ zone.name + ", "
+ new Date(mill... | [
"getLocationTimesByDay(day, hours) {\n // NOTE: Location availability is stored in the Firestore database as:\n // availability: {\n // Friday: [\n // { open: '10:00 AM', close: '3:00 PM' },\n // { open: '10:00 AM', close: '3:00 PM' },\n // ],\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find all flat indexes above the current level | function allFlatIndexesAboveLevel(namesByLevel, currentLevel) {
let count = 0;
let list = [];
_.each(namesByLevel, function (l, i) {
if (i > currentLevel) {
_.each(l, function (item, i) {
list.push(count + i);
});
}
count += l.length;
});
return list;
} | [
"rebuildTreeIndex() {\n let columnIndex = 0;\n\n this.#rootsIndex.clear();\n\n arrayEach(this.#rootNodes, ([, { data: { colspan } }]) => {\n // Map tree range (colspan range/width) into visual column index of the root node.\n for (let i = columnIndex; i < columnIndex + colspan; i++) {\n th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space. A Curve3 is designed from a series of successive Vector3. Tuto : | function Curve3(points){this._length=0.0;this._points=points;this._length=this._computeLength(points);} | [
"static CreateCubicBezier(v0, v1, v2, v3, nbPoints) {\n // tslint:disable-next-line:no-parameter-reassignment\n nbPoints = nbPoints > 3 ? nbPoints : 4;\n const bez = new Array();\n const equation = (t, val0, val1, val2, val3) => {\n const res = (1.0 - t) * (1.0 - t) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts a number to USD format | function toUsd(number) {
number = number.toFixed(2); //to limit the number to two decimal places
number = number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); //to add commas to seperate the thousands
//console.log('to US Dollar:', '$' + number);
return '$' + number; //adds the $
} | [
"function converter(number){\n return number.toLocaleString('USD', {style: 'currency',\n currency: 'USD',\n minimumFractionDigits: 2,\n maximumFractionDigits: 2});\n}",
"function btcConvertUsd(btcValue){\n\t\tvar btcCurrentRate;\n\t\tconsole.log(\"BTC Input: \" + btcValue);\n\t\t// Get the latest exchange ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
go to previous task to review | function hsReviewTaskPrev() {
hsReviewTaskNext(true);
} | [
"function navigateToPrevUrl() {\n if (document.referrer) {\n VeAPI.Utils.Shell.info('navigating to ' + document.referrer);\n window.location.replace(document.referrer);\n } else if (history && history.go) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This constructor provides property bindings for the accessor bindings. | function AccessorPropertyBinding(accessor, name) {
this.accessor = accessor;
this.name = name;
} | [
"function StatefulPropertyBinding(stateful, name){\r\n\t\tthis.stateful = stateful;\r\n\t\tthis.name = name;\r\n\t}",
"function Binding(value){\r\n\t\tthis.value= value;\r\n\t\tif(value){\r\n\t\t\tvalue._binding = this;\r\n\t\t}\r\n\t}",
"makeObservable(propertyNames) {\n var that = this;\n for (v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test returning true if p1 and p2 are both lying on the same side of ab, false otherwise | function _sameSide(p1,p2,a,b)
{
var temp1 = [];
var temp2 = [];
var temp3 = [];
var cp1 = [];
var cp2 = [];
this.vec3().cross( this.vec3().subtract(b,a, temp1), this.vec3().subtract(p1,a,temp2), cp1 );
this.vec3().cross(... | [
"function overlaps(a, b) {\n if (a.x1 >= b.xMax || a.y1 >= b.yMax || a.x2 <= b.xMin || a.y2 <= b.yMin) {\n return false\n } else {\n return true\n }\n }",
"pointsEqual(p1, p2) {\n return GeoPlus.distance(p1, p2) <... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: ServerBehavior.getPriority DESCRIPTION: Return the priority for this Server Behavior ARGUMENTS: none RETURNS: integer | function ServerBehavior_getPriority()
{
return this.priority;
} | [
"get priority()\n\t{\n\t\t//dump(\"get priority: title:\"+this.title+\", value:\"+this._calEvent.priority);\n\t\treturn this._calEvent.priority;\n\t}",
"function ServerBehavior_setPriority(priorityNumber)\n{\n if (priorityNumber > 0 && priorityNumber <= 10)\n {\n this.priority = priorityNumber;\n }\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a Promise which sends the AUTH LOGIN commands to the server. We can abort the operating after a certain number of milliseconds by passing the optional `timeout` parameter. NOTES: The LOGIN authentication mechanism is not covered by rfc documents. | authLogin(username = null, password = null, timeout = 0) {
const mechanisms = this.getAuthMechanisms();
if (mechanisms.indexOf('LOGIN') === -1) {
throw new Error(`SMTP server does not support the LOGIN authentication mechanism`);
}
let lines = [];
const handler ... | [
"function requestLogin() {\n\tlog('requesting');\n\tvar deferred = Q.defer();\n\n\tif (!code) {\n\t\tdeferred.reject('empty code');\n\t}\n\n\tvar data = querystring.stringify({\n\t\t'AjaxMethod': 'LOGIN',\n\t\t'Account': ACCOUNT.username,\n\t\t'Pwd': ACCOUNT.password,\n\t\t'ValidCode': code\n\t});\n\n\tvar options ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a nontopological path to one or more topological arcs | function convertPath(start, end) {
var arcIds = [],
firstNodeId = -1,
arcStartId;
// Visit each point in the path, up to but not including the last point
for (var i = start; i < end; i++) {
if (pointIsArcEndpoint(i)) {
if (firstNodeId > -1) {
arcIds.push(addEdge(arcS... | [
"constructPath(cameFrom, goal) {\n let path = this.board.getNeighborTiles(goal[0], goal[1]);\n let pos = goal;\n while (pos !== null) {\n path.unshift(pos);\n pos = cameFrom[pos]; // set the pos to prev pos\n }\n\n return path;\n }",
"findPaths(fromNavNode, toNavNode) {\r\n\t\tlet walkin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var cardOutput = document.getElementById('cardoutput'); | function captureInput() {
var cardInput = document.getElementById('card-text').value;
console.log("cardInput", cardInput);
// cardOutput.innerHTML = cardInput;
// console.log("cardOutput", cardOutput);
cardText.push(cardInput);
console.log("cardText", cardText);
createCard();
} | [
"function showCardReading(carddiv) {\r\n\t\r\n}",
"function makeCard(id, data)\n{\n $(\"#\" + id).text(data[0]);\n}",
"function pcDraw() {\n createRandomValues();\n let card = document.createElement(\"span\");\n pcHand.appendChild(card);\n card.textContent = randomNumberValue;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to grab encoded message | function getMessageEncoding( msg )
{
let enc = new TextEncoder();
return enc.encode( msg );
} | [
"function decodeMessage() {\n// new RegExp( \"(\\\\d)(\\\\d{2})(.{\" + smash._securityTokenLength + \"})(.{\" + smash._securityTokenLength + \"})(\\\\d)(\\\\d{2})(.*)\" )\n\t\tvar type=currentHash.substr(0,1);\n\t\tvar msn=currentHash.substr(1,2);\n\t\tvar nextStart = 3;\n\t\tvar tokenParent=currentHash.substr(next... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursive step for generating random expressions Returns a string of two inverted commas with only terminals in between | function recursiveRandomExpression(depth, nonterminal) {
if (expressionsAtDepth_[depth][nonterminal].length <= 0) {
throw (`${depth}: No possible replacements for ${nonterminal}.`
+ 'If this is NOT the first level of recursion then we have a problem.');
}
let potentialExpressions = expressionsAtDepth_[dep... | [
"function genScramble(length) {\n var prevMove = -1, secPrevMove = -1, scramble = \"\";\n for (i = 0; i < length; i++) {\n var move = Math.floor((Math.random() * 6)),\n dir = Math.floor((Math.random() * 3));\n if (((prevMove == 0) && (secPrevMove != 1)) || ((prevMove == 1) && (secPrevMo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UnicodePropertyValueExpression :: UnicodePropertyName `=` UnicodePropertyValue LoneUnicodePropertyNameOrValue | eatUnicodePropertyValueExpression() {
const start = this.index;
// UnicodePropertyName `=` UnicodePropertyValue
if (this.eatUnicodePropertyName() && this.eat(unicode_1.EqualsSign)) {
this._lastKeyValue = this._lastStrValue;
if (this.eatUnicodePropertyValue()) {
... | [
"function evaluate_property_assignment(stmt,env) {\n var obj = evaluate(object(stmt), env);\n var prop = evaluate(property(stmt), env);\n var val = evaluate(value(stmt), env);\n obj[prop] = val;\n return val;\n}",
"function setExprProp(eID, {key, value}) {\n\t\tCalc.setExpression({\n\t\t\tid: eID,\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handler for Selecting AlarmTriggers | function selectAlarmTrigger(SelectID)
{
mySelect = document.getElementById(SelectID)
myValue = mySelect.value
StoreAlarmTrigger(SelectID, myValue)
} | [
"function selectTrigger(device, type) {\n vm.selectedDevice = angular.copy(device);\n vm.selectedType = angular.copy(type);\n vm.selectedTypeIs = angular.copy(type);\n vm.selectedTypeFrom = null;\n vm.selectedTypeTo = null;\n\n vm.availableOperators = _getAvailableOperators(type.type);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialises the queue results object. Used once per queue run. | _initQueueResults() {
this.results = {
[QUEUE_LOG_TYPES.success]: {},
[QUEUE_LOG_TYPES.fail]: {},
[QUEUE_LOG_TYPES.skip]: {}
};
} | [
"function PQueueInit() {\n\treturn new buckets.PriorityQueue();\n}",
"function ArrayQueue() {}",
"function addResults (transport, next) {\n queryTransport(transport, function (err, result) {\n //\n // queryTransport could potentially invoke the callback\n // multiple times sinc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shorten the left note group by a step. Works for outofsync. | shortenPrevNoteGp() {
if (this.isChordMode()) {
return;
}
this._surger()
const step = this.editor.step.over(frac.build(2));
const noteGps = this.getCurrVoice().noteGps;
const left = noteGps.getLeft();
if (noteGps.atHead() || !left) {
// At head; don't do anything.
return;
... | [
"function swimLeftFast(e) {\n var s = e.target;\n s.x -= 4;\n}",
"lengthenPrevNoteGp(newEnd) {\n this._surger();\n const noteGps = this.getCurrVoice().noteGps;\n\n while (noteGps.getCurr() && noteGps.getCurr().start.lessThan(newEnd)) {\n this.skipRight();\n this.unsafeRemoveFromNoteGps();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the running balance of all transactions | updateRunningBalances() {
// Do nothing for investment accounts
if ("investment" === this.context.account_type) {
return;
}
this.transactions.reduce((openingBalance, transaction) => {
transaction.balance = openingBalance + (transaction.amount * ("inflow" === transaction.direction ? 1 : -1));
return t... | [
"function updateRunningBalance(amount){\n\t\n\t\tAccount.runningBalance = Account.endingBalance;\n\t}",
"function updateEndingBalance(amount){\n\t\n\t\t// start balance\n\t\tvar start = Account.startBalance;\n\t\t\n\t\t// Deposits\n\t\tvar deposits = Account.totalDeposits;\n\t\t\n\t\t// Withdraws\n\t\tvar withdra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move an image (or a file) from a [from path] to a [to path] | function moveImage(from, to, callback) {
fs.rename(from, to, function(error) {
if(error) {
console.log('Error while moving image');
}
callback(null);
});
} | [
"function moveFileWithCollisionHandling(src, dst, cb) {\n return moveOrCopyFileWithCollisionHandling(src, dst, 'move', cb);\n}",
"function moveUserFiles() {\n\tcpr(userDir.toString(), \"/Users/ArvindB/Documents/node-slideshow/public/images/\", {\n\t overwrite: true, //If the file exists, overwrite it\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtener promedio de sus scores | function getPromedio (scores) {
return scores.reduce((acum, next) => {
return acum + next.score / scores.length
},0)
} | [
"sumFinalResultsScore(finalResults) {\n let confettiQuantity = 0;\n finalResults.finalScoreboard.forEach((result) => {\n confettiQuantity += result.score;\n });\n return Math.floor(confettiQuantity / 2);\n }",
"function getScore()\n {\n return score\n }",
"formatScore(leveledScore... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |