query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
A function to gather all environments referenced. to convert environment references into references to their names. | function collectEnvs(env) {
// Record the env, unless we've already done so.
if (envs[env.name])
return;
envs[env.name] = env;
// Now go through the bindings and look for more env references.
for (var b in env.bindings) {
var c = env.bindings[b];
... | [
"getENVs() {\n let args = [];\n for (let instruction of this.instructions) {\n if (instruction instanceof env_1.Env) {\n args.push(instruction);\n }\n }\n return args;\n }",
"function getAllReferences (scope, referenceArr){ \n scop... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Closes edit box when CANCEL button is pressed and doesn't change the task | function cancelEdit(){
//close edit box
closeEditBox();
} | [
"function cancel_edit_of_task() {\n \ttoggle_form_view(\"ADD\");\n}",
"cancelEdit() {\n const me = this,\n { inputField, oldValue } = me,\n { value } = inputField;\n\n if (!me.isFinishing && me.trigger('beforecancel', { value: value, oldValue }) !== false) {\n // Hiding must not trigger our b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds `count` of time `unit` to the source date. Returns a modified `Date` object. | function add(date, unit, count, utc) {
var timeZoneOffset = 0;
if (!utc && unit != "millisecond") {
timeZoneOffset = date.getTimezoneOffset();
date.setUTCMinutes(date.getUTCMinutes() - timeZoneOffset);
}
switch (unit) {
case "day":
var day = date.getUTCDate();
... | [
"function add(date, unit, count, utc) {\n var timeZoneOffset = 0;\n\n if (!utc && unit != \"millisecond\") {\n timeZoneOffset = date.getTimezoneOffset();\n date.setUTCMinutes(date.getUTCMinutes() - timeZoneOffset);\n }\n\n switch (unit) {\n case \"day\":\n var day =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================ Function Add PNG Object ====================== | function addPNGFile(imgName){
console.log('adding PNG', imgName);
var imgPNGName = new Image()
imgPNGName.src = imgName;
fabric.Image.fromURL(imgName, function(img) {
canvas.add(img.set({ left: 5, top: 5, }).scale(0.5)).setActiveObject(img);
selectObjParam();
canvas.renderAll();
});
... | [
"addImage() {\n }",
"static addGraphic(name, src) {\n var graphic = new Image();\n graphic.src = src;\n this.graphics.push({\n name: name,\n image: graphic\n });\n }",
"function addObject(object, id) {\n scribbol.canvas.add(object);\n scribbol.util.reg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To preserve some backwards compatibility with oldstyle GeoJSON files, pass through any original CRS object if the crs has not been set by mapshaper jsonObj: a toplevel GeoJSON or TopoJSON object | function preserveOriginalCRS(dataset, jsonObj) {
var info = dataset.info || {};
if (!info.crs && 'input_geojson_crs' in info) {
// use input geojson crs if available and coords have not changed
jsonObj.crs = info.input_geojson_crs;
}
// Removing the following (seems ineffectual at best)
... | [
"function reprojectGeoJson(geojson, sourceUrl) {\n if (geojson.crs === undefined) {\n // no CRS, hopefully it's in EPSG 4326.\n return geojson;\n }\n\n if (sourceUrl === 'http://data.gov.au/geoserver/ysc-garbage-collection-zones/wfs?request=GetFeature&typeName=ckan_e7b72b97_8046_4d84_ab9f_874... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add server to virtual server pool operates on whatever form is passed to it | function AddServerToPool(form) {
var ServerPort = form.ipaddr.value;
form['servers[]'].options[form['servers[]'].options.length] = new Option(ServerPort,ServerPort);
} | [
"function addCurrentServer() {\r\n\t/*\r\n\t* TODO \r\n\t* Need to grab current server URL, add to txt field and call addServer()\r\n\t*/\r\n}",
"static set dedicatedServer(value) {}",
"async addServer(ctx, next) {\n console.log('Controller HIT: ServerController::addServer');\n return new Promise(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handler to be called as soon as the remote stream becomes available | function gotRemoteStream(event) {
// Associate the remote video element with the retrieved stream
remoteVideo.srcObject = event.stream;
remoteVideo.play();
} | [
"function gotRemoteStream(event){\n\t// Associate the remote video element with the retrieved stream\n\tif ('srcObject' in remoteVideo) {\n\t\tremoteVideo.srcObject = event.stream;\n\t\t\n\t} else {\n\t\tremoteVideo.src = window.URL.createObjectURL(event.stream);\n\t}\n\tlog(\"Received remote stream\");\n}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
9. Please write a function that takes two arrays of items and returns an array of tuples made from two input arrays at the same indexes. Excessive items should be dropped. example input [1,2,3], [4,5,6,7] example output [[1,4], [2,5], [3,6]] | function getArrayTuple(arr1, arr2) {
let result = [];
for(let i = 0; i < arr1.length; i++) {
if (arr2[i]) result.push([arr1[i], arr2[i]])
};
return result
} | [
"function make2(a, b){\n let newArr = []\n let combined = a.concat(b)\n \n for (let i = 0; i < combined.length; i++){\n newArr.push(combined[i])\n if (newArr.length === 2) break\n }\n return newArr\n}",
"function zip(first, second) {\n var newArr = [];\n for (let i = 0; i < first... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Only send data if the last packet went through Do not use this if your data must be sent! (Aka motor events) Only if it should not be sent when something else is sending | function safeSendData(){
var date = new Date();
if(webSock.bufferedAmount == 0 && ((date.getTime() - timeOfLastMessage) > 100))
{
timeOfLastMessage = date.getTime();
sendData();
}
} | [
"_send () {\n log(`Sending data to endpoints (Buffer size: ${Object.keys(this.buffer).length} keys [${Object.keys(this.buffer).join(', ')}])`)\n if (!this.isConnected()) return log(\"Axon is not connected, can't send any data.\")\n\n // Handle axon buffer size\n if (this._axon.socks[0].bufferSize > 2900... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
animate enemy left to right (could add up and down to this) boxes array of grid boxes that include animation index current location of animation direction current direction of animation | function animateEnemy(boxes, index, direction) {
if (boxes.length <= 0) {
return;
}
//update images
if (direction == "right") {
boxes[index].classList.add("sharkr");
} else {
boxes[index].classList.add("sharkl");
}
//remove images from other boxes
... | [
"function animateEnemy(boxes, index, direction) {\r\n\r\n\t//exit function if no animation\r\n\tif(boxes.length <= 0) {return;}\r\n\r\n\t//update image\r\n\tif(direction == \"right\") {\r\n\t\tboxes[index].classList.add(\"drifter_r\");\r\n\t } else {\r\n\t boxes[index].classList.add(\"drifter_L\");\r\n\t}\r\n\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Encrypt and compose a secured Nexo message This functions takes the original message, encrypts it and converts the encrypted form to Base64 and names it NexoBlob. After that, a new message is created with a copy of the header, the NexoBlob and an added SecurityTrailer. | encrypt_and_hmac(bytes) {
// parse the json
var body = JSON.parse(bytes);
// and determined if it is a request or responce
var request = true;
var saletopoirequest = body["SaleToPOIRequest"];
if (!saletopoirequest) {
request = false;
... | [
"messageEncrypt(payload, receiver_public_key, sender_private_key){\n\n let nonce = NACL.randomBytes(NACL.secretbox.nonceLength);\n let key = this.decodePublicKey(receiver_public_key)\n let secret = this.decodeSecretKey(sender_private_key)\n let messageUint8 = UTIL.decodeUTF8(payload)\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function takes in two parameters for the URL extension and city. It calls an ajax request and calls a function depending on the extend | function sendRequest(extend, city) {
var ajax = new XMLHttpRequest();
if (extend == "cities") {
ajax.onload = fetchCities;
} else if (extend == "oneday&city=") {
ajax.onload = printInfo;
} else if (extend == "week&city=") {
ajax.onload = printForecast;
}
ajax.open("GET", "https://webster.cs.washing... | [
"function getCity(val, type, interview) {\n var alterDiv = 'workplace';\n if(interview == true)\n alterDiv = 'interview';\n\n var prefectureVal = '';\n prefectureVal = $('#'+alterDiv+'_prefecture option:selected').text();\n\n removeMessage();\n var param = {id:val,type:type,prefecture:prefe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class SmartSettingsProxy uses the SMART preferences API to store the data. | function SmartSettingsProxy() {
return {
read: GC.getPreferences,
write: function (dataToWrite) {
return GC.setPreferences(JSON.stringify(dataToWrite));
},
unset: GC.deletePreferences
};
} | [
"function SettingsProxy( instance )\n{\n\tthis.instance = instance;\n\tthis.data = JSON.parse( instance.value );\n\tthis.saving = 0;\n}",
"function SettingsManager() {}",
"function storeSettings() {\n browser.storage.local.set({\n configs: {\n isAlert: isAlertBtn[0].checked || false,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle migrating all docs from an old MatchSchema to the current MatchSchema. | function adminMatchMigrateSchema(matches) {
var numMigrated = 0;
matches.forEach(function(match) {
if ((match.ownerState.lastMsg.length === 0) || (match.requesterState.lastMsg.length === 0)) {
numMigrated = numMigrated + 1;
var newOwnerMsg = {
language: 'en',
text: match.ownerState.l... | [
"transformSchemaAfterRead(schema) {\n if (!schema) {\n return null;\n }\n if (!schema.name) {\n schema.name == 'Current';\n }\n // Add internal models\n schema.models[SchemaModel] = this.schemaModelFields;\n schema.models[MigrationModel] = this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns default mapping type name for entity. | getStorageTypeName() {
return this.getEntityTypeId();
} | [
"function getTypeScriptName() {\n var targetType = fieldPropertiesHelper.getSelectedType(spFormBuilderService);\n\n if (targetType && targetType.getEntity) {\n var type = targetType.getEntity();\n\n if (type && type.typeScriptName) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a default canvas in the DOM. | _createCanvas() {
const canvasId = "xeokit-canvas-" + math.createUUID();
const body = document.getElementsByTagName("body")[0];
const div = document.createElement('div');
const style = div.style;
style.height = "100%";
style.width = "100%";
style.padding = "0";
... | [
"_createCanvas() {\n\n const canvasId = \"xeogl-canvas-\" + math.createUUID();\n const body = document.getElementsByTagName(\"body\")[0];\n const div = document.createElement('div');\n\n const style = div.style;\n style.height = \"100%\";\n style.width = \"100%\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Based on Vue's internal `observe()` function. Ensures that the given entity is observable and optionally notes that it is referenced by a component | function observeEntity(entity, asRootData) {
if (asRootData === void 0) { asRootData = false; }
if (entity instanceof Entity) {
var ob = getEntityObserver(entity, true);
if (asRootData && ob) {
ob.vmCount++;
}
return ob;
}
} | [
"notifyComponentChange(entity) {\n this._changed.add(entity);\n }",
"onReferenceBound(entity) {\n this.observable.send(\"referenceBoundToMe\", entity);\n }",
"function getEntityObserver(entity, create) {\n if (create === void 0) { create = false; }\n if (hasOwnProperty$1(entity, '__ob__') &&... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Escapes characters that can not be in an XML attribute. | function escapeAttribute(value) {
return value.replace(/&/g, '&').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
} | [
"function escapeAttribute(value) {\n\t return value.replace(/&/g, '&').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\n\t}",
"function escapeAttribute(value) {\n return value.replace(/&/g, '&').replace(/'/g, ''').replace(/</g, '<').replace(/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a log entry on the server based on the following inputs severity: one of 'DEBUG','ERROR','FATAL','INFO','WARN' url: the context url lineNr: line number of the error message: The error/log message | logOnServer(severity, url, lineNr, message) {
// Can't use client here as we need to send to a different endpoint
API._fetch(LOGGING_ENDPOINT, [{ severity, url, lineNr, message }])
} | [
"function URLLogEntry() {}",
"function createLogInfoObj (error , functionName , severity ) {\n if (error instanceof Error) {\n return new LogInfo (error.lineNumber || \"\" , functionName , error.stack || \"\" , error.fileName || \"\" , severity , error.message || \"\" );\n }\n if (error instanceof String) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to check if end application has Bootstrap loaded | function isBootstrap(){
var st = document.styleSheets;
for (var i=0; i< st.length; i++){
if (st[i].href != null && st[i].href.indexOf("bootstrap") > -1){
return true;
}
}
} | [
"function hasOnAppBootstrapHook(instance) {\n return !shared_utils_1.isNil(instance.onApplicationBootstrap);\n}",
"function checkLoadStatus()\t{\n \t\t\tvar allLoaded = true;\n \t\t\tfor(var i=0; i<jsLoaded.length; i++)\t{\n \t\t\t\tif(!jsLoaded[js[i]]){\n \t\t\t\t\tallLoaded = false;\n \t\t\t\t}\n \t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SEARCHING SEQUENCE finds all substrings within the main sequence that match the searched motif stores results as arrays of 2 integers the beginning int of the match and the end int | function findInSequence() {
var beginMatch = 0;
var endMatch = 0;
var i = 0;
var specChar = RegExp('[X]');
var test = specChar.exec(searchMotif);
console.log(test);
var xs = [];
var generalCase = false;
var splitMotif = searchMotif.split("");
if (test != null && searchMotif.length >= 2){
for (var i = 0; ... | [
"function findCandidateSequences(seq, length, PAM){\n var regex = generateMixedBaseRegex(PAM);\n var match;\n var results = [];\n var currentStrand = '+';\n var matchSeq;\n\n while((match = regex.exec(seq))){\n matchSeq = seq.substring(match.index - length + PAM.length, match.index + PAM.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify a onlineTest given its ID | function verifyOnlineTest(id) {
const requestOptions = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: authHeader(),
},
};
const url = `/document_online/${id}/check_document/`;
return axios.get(`${apiUrl}${url}`, requestOptions)
.then(response => res... | [
"function verifyInstance(id, callback) {\n $.ajax({\n 'url': '/api/verify?id=' + id,\n 'type': 'GET',\n 'success': function (data) {\n //Results Check\n if (data.result === \"success\") {\n if (data.data) {\n //tally instance exists\n if (callback) {\n callbac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
here is a custome function... with parameters for font, size, message, startX, startY Parameters are placeholders for variables | function typo(font, size, message, startX, startY){
fill(200, 0, 200);
// here we set the font as whatever font is passed through the function as a parameter
textFont(font);
// here we set the size as whatever font is passed through the function as a parameter
textSize(size);
// use the alingn fuction to ad... | [
"Text(inSize,inString,inPos,inColour,inJustification,font)\n {\n if(font == undefined)\n {\n this.ctx().font = inSize +\"px san-serif\";\n }\n else\n {\n this.ctx().font = inSize +\"px \"+font;//Archivo Black\";\n }\n this.ctx().textAlign = i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the method that's called once the favorite (followed) artists and people are fetched. | function userAuthorFetchCallback(artists) {
var favs = $('#favorites');
artists.items.forEach(function(artist) {
var domEl = $('<li></li>');
var img = $('<img></img>');
domEl.html(artist.name);
img.attr('src', artist.images[0].url);
domEl.append(img);
favs.append(domEl);
});
} | [
"async getFavArtworks() {\r\n let favorites = [];\r\n if (welcomePage.authUser.favorites) {\r\n for (let artworkId of welcomePage.authUser.favorites) {\r\n await this.artworkRef.doc(artworkId).get().then(function (doc) {\r\n let artwork = doc.data();\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allows to compose model update functions (a la monad chain operation) | function chainModelUpdates(arrayModelUpdateFn) {
return function chainedModelUpdates(model, eventData, actionResponse, settings) {
return __WEBPACK_IMPORTED_MODULE_0_ramda__["flatten"](__WEBPACK_IMPORTED_MODULE_0_ramda__["map"](
modelUpdateFn => modelUpdateFn(model, eventData, actionResponse, settings),
... | [
"update() {\n console.assert(\n arguments.length === 0 || typeof arguments[0] === \"string\",\n \"binder.update() returns function for updating, do not call directly with a model object.\"\n );\n let fields = arguments.length > 0 ? arguments : Object.keys(this.fields);\n return model => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the next entry in the log by applying an action. | function computeNextEntry(reducer, action, state, error) {
if (error) {
return {
state: state,
error: 'Interrupted by an error up the chain'
};
}
var nextState = state;
var nextError;
try {
nextState = reducer(st... | [
"function computeNextEntry(reducer, action, state, error) {\n\t\t if (error) {\n\t\t return {\n\t\t state: state,\n\t\t error: 'Interrupted by an error up the chain'\n\t\t };\n\t\t }\n\n\t\t var nextState = state;\n\t\t var nextError = undefined;\n\t\t try {\n\t\t nextState = reducer(state, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Can be used to calculate which value to use given a default value. The test value can be a function parameter value which might or might not be provided | function calculateValue(testValue, defaultValue) {
if (testValue) {
return testValue;
}
else {
return defaultValue;
}
} | [
"function defaultValue(test,defaultValue) {\r\n\treturn (typeof test !== 'undefined' ? test : defaultValue);\r\n}",
"function getDefaultValue (current_value, name) {\n if (typeof current_value === 'undefined' || current_value === 'NaN') {\n return clientState.scenario_event_defaults[name];\n } el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collect articles on the Lakers Bleacher Report web page params: data = axios GET request response.data object return: an array of article info objects | function collectLBRNews(data) {
let articles = [];
const $ = cheerio.load(data);
// HTML element context where articles are placed
const contexts = [$("#outer-container #main-content .sectionPage .contentStream .cell")];
contexts.forEach(context => {
context.each(function (i, element) {
... | [
"async function getData() {\n let articles = [];\n // JSON API endpoint\n let url = `${site.parent}/jsonapi/node/article`;\n do {\n const response = await fetch(url);\n const json = await response.json();\n // transform the paginated data\n const nodes = json.data.map(node => ({\n title: node.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all winner from hall of fame DB and execute te renderHallOfFame with it. | function getAndRenderHallOfFame() {
let winnerForm = document.getElementById('winner-form');
if (winnerForm) {
winner_form_container.removeChild(winnerForm);
winner_form_container.style.display = 'none';
}
hallOfFameModule.getHallOfFamePromise()
.then(... | [
"function render() {\n board.forEach(function(square, idx) {\n squares[idx].style.background = lookup[square];\n });\n if (winner === 'T') {\n message.innerHTML = 'Tie Game!';\n } else if (winner) {\n message.innerHTML = `You win ${lookup[winner].toUpperCase()}!`;\n } else {\n message.innerHTML = `... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set Student Data to Delete Student Modal | function deleteStudent(id, name, guardian, occupation, phone, dob, rel, address){
$('#stIDDelete').html(id);
$('#stNameDelete').html(name);
$('#dobDelete').html(dob);
$('#religionDelete').html(rel);
$('#addressDelete').html(address);
$('#gNameDelete').html(guardian);
$('#occupationDelete').html(occup... | [
"function removeStudent(evt) {\n evt.preventDefault();\n\n var studentid = $(this).attr('data-studentid');\n var classid = $(this).attr('data-classid');\n var formValues = {\n 'class_id' : $(this).attr('data-classid'),\n 'user_id' : $(this).attr('data-studentid')\n };\n\n $(\".modal-body\").text('Are yo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset a draggable element. | function resetDraggableElement(elt) {
elt.show();
elt.draggable( "enable" );
} | [
"function resetDrag(){\n drag = {\n x: 0,\n y: 0,\n start_x: null,\n start_y: null\n };\n }",
"reset() {\n this._dragRef.reset();\n }",
"reset() {\n // Check if user actually moved the elem\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A transform that adds `__typename` field on any `LinkedField` of a union or interface type where there is no unaliased `__typename` selection. | function generateTypeNameTransform(context) {
cache = new Map();
var schema = context.getSchema();
var typenameField = {
kind: 'ScalarField',
alias: TYPENAME_KEY,
args: [],
directives: [],
handles: null,
loc: {
kind: 'Generated'
},
metadata: null,
name: TYPENAME_KEY,
... | [
"function relayGenerateTypeNameTransform(\n context: CompilerContext,\n): CompilerContext {\n const stringType = assertLeafType(context.serverSchema.getType(STRING_TYPE));\n const typenameField: ScalarField = {\n kind: 'ScalarField',\n alias: (null: ?string),\n args: [],\n directives: [],\n handle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This column will store a number version of the entity. Every time your entity will be persisted, this number will be increased by one so you can organize visioning and update strategies of your entity. | function VersionColumn(options) {
return function (object, propertyName) {
__1.getMetadataArgsStorage().columns.push({
target: object.constructor,
propertyName: propertyName,
mode: "version",
options: options || {}
});
};
} | [
"get versionId() {\n return this.getStringAttribute('version_id');\n }",
"function createVersionNumber() {\n return new Date().toJSON().slice(0, 10) + '--' + uniqueId();\n}",
"incrementEntityIdCounter() {\n this.state.entityIdCounter += 1;\n }",
"get instanceCount() {\n return this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check booking rules and filter spaces | filterSpaces(list) {
const settings = this._org.building_settings;
const res = Object(_bookings_src_lib_booking_utilities__WEBPACK_IMPORTED_MODULE_7__["filterSpacesRules"])(list, settings, this._staff.current, Object.assign({}, this._data));
return res;
} | [
"function filterSpacesRules(list = [], building_settings, host, options) {\n return list.filter((space) => {\n var _a;\n const booking_rules = (_a = building_settings[space.level.parent_id].details) === null || _a === void 0 ? void 0 : _a.booking_rules;\n const { date, all_day, duration, vis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds a form body based on data to be used for post requests | buildFormBody(data){
var formBody = [];
for (var property in data) {
var encodedKey = encodeURIComponent(property);
var encodedValue = encodeURIComponent(data[property]);
formBody.push(encodedKey + "=" + encodedValue);
}
formBody = formBody.join("&");
... | [
"buildRequestBody(obj) {\n // here we can controll the body of the various request methods\n switch (this.state.method) {\n case 'POST':\n const form = Array.from(document.querySelector('#explorer-body').querySelectorAll('input'));\n form.forEach(input => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the current BBOP graph | setBBOPGraph(graph) {
this.bbopGraph = graph;
this.bbopGraphBackup = graph.clone();
this.preprocess(graph);
} | [
"resetBBOPGraph() {\n this.setBBOPGraph(this.bbopGraphBackup); \n }",
"setGraph(label){this.#label=label;return this}",
"changeGraph() {\n this.graph = this.graphs[this.currentGraphKey];\n\n this.axis = new CGFaxis(this, this.graph.referenceLength);\n\n this.gl.clearColor(this.graph.ba... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
populate the role drop down | function populateRoleDropDown() {
// populate the option lists if they don't exist
let roleDropdown = document.getElementById('role-dropdown');
if(roleDropdown.length == 0) {
rolesData = pullRoleData();
for (let i=0; i<=rolesData.length-1; i++) {
let option = document.createElement("option");
option.te... | [
"function CreateSelect() {\n\n\t$('div.fillterDiv #selectRole').empty();\n\tvar r ='<option value=\"0\"> '+__(\"All\")+' </option>';\n\tfor(var i in _roles)\n\t\t{\n\t\t\tr += '<option value=\"'+ _roles[i].id + '\">'+ _roles[i].name +'</option>';\n\t }\n\t$('div.fillterDiv #selectRole').append(r);\n\n\tvar roleI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a game to the list | function addGame(){
let game ={};
let title = prompt("Enter Name of the game");
game.title = title;
let platform = prompt("Enter Name of the platform of the game");
game.platform = platform;
console.log(game)
games.push(game)
render();
} | [
"function addGame(game) {\n $(\"#game_choose .games\").append(\"<li id='game-\" + game.id + \"'>\" + game.name + \"</li>\")\n }",
"function addGame(id) {\n var li = document.createElement('li');\n li.id = id;\n li.innerHTML = id;\n document.querySelector('.existing-games').appendChild(li);\n}",
"AddGame... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
obnoxious blinking function! cause everyone loves this stuff. hey, it's less bad than alerting... args are color (e.g. "red" or "ff0000", same as html or css colors) and number of times to blink as an int (e.g. 1, 2, 3) | function blink(color, reps) {
for (var i = 0; i < reps+1; i++) {
setTimeout(function(){
document.getElementById("theBody").style.backgroundColor = color;
}, 200 * i - 100);
setTimeout(function(){
document.getElementById("theBody").style.backgroundColor = "#ffffff";
},... | [
"function blinkCounter(number){\n\tconsole.log(\"Blinking \"+number+\"x!\");\n\tvar duration = 250;\n\n\t(function blink(i, color) {\n\t\tvar newColor = color==\"red\" ? \"black\":\"red\";\n\t\tsetTimeout(function() {\n\t\t\t$(\".counter\").css(\"color\", newColor);\n\t\t\tif (--i) blink(i, newColor);\n\t\t}, durat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
15. Calculate the area of a triangle | function areaofTriangle(base,height){
return (base*height)/2
} | [
"function areaOfTriangle(side1,side2,side3)\r\n{\r\n let s = (side1 + side2 + side3)/2;\r\n let area = Math.sqrt(s*(s - side1)(s - side2)(s - side3));\r\n return area;\r\n}",
"function areaTriangle(base, height) {\n console.log((base * height) / 2)\n}",
"function areaOfTriangle(base, height) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the width of the twin. (solution for textareas with widths in percent) | function setTwinWidth(){
var curatedWidth = Math.floor(parseInt($textarea.width(),10));
if($twin.width() !== curatedWidth){
$twin.css({'width': curatedWidth + 'px'});
// Update height of textarea
update(true);
}
} | [
"function setTwinWidth(){\n var curatedWidth = Math.floor(parseInt(domElm.offsetWidth, 10));\n if (domTwin.offsetWidth !== curatedWidth) {\n twin.css({\n 'width': curatedWidth + 'px'\n });\n // Update height of textarea\n update(true);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
start listening for events on each card | function startListening() {
const allCards = Array.prototype.slice.call(document.querySelectorAll(".card"));
for (let i=0; i<allCards.length; i++) {
allCards[i].addEventListener("click", respondToTheClick);
}
// showTimer();
} | [
"function addCardEvents() {\r\n for(let index = 0; index < cards.length; index++)\r\n {\r\n cards[index].addEventListener(\"click\", function() {\r\n discoverCard(index);\r\n });\r\n }\r\n}",
"function registerCardEvents(){\n\t\t// the ID of the main div element container for thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
verify all tokens defined in the onboarding/askUserPermission flow (except state) are defined in onboarding/getDeveloperInput | function validateUrlTokens(onboardingNode, log, filepath) {
var urlTokens = [];
var permissionFlowNode = xpath.select("onboardflow[@name='askUserPermission']/flow[arg[@name='url']]", onboardingNode, true);
if(permissionFlowNode !== undefined) {
var urlTemplate = xpath.select("description/text()", p... | [
"function detectTokens() {\n const emailToken = detectEmailConfirmationToken();\n const externalAccessToken = detectExternalAccessToken();\n const recoveryToken = detectRecoveryToken();\n\n if (emailToken) {\n //console.log(\"Detected email confirmation token\", emailToken);\n confirmEmail... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get range date this month | function getThisMonthDateRange() {
var current = moment();
return getMonthDateRange(current.year(), current.month());
} | [
"getMonthDateRange(year, month) {\n\t\tmonth = month - 1;\n\t\tlet startDate = moment.utc([year, month]);\n\t\tlet endDate = moment.utc(startDate).endOf(\"month\");\n\t\treturn { start: startDate.toDate(), end: endDate.toDate() };\n\t}",
"currentMonthRange(){\n let calendar = this.getCalendar();\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Group snippets and piles by grid. | groupByGrid () {
const gridPiles = [];
// Add every pile to the grid it is located in
this.piles.forEach((pile) => {
const column = Math.floor(pile.x / fgmState.gridCellWidthInclSpacing);
const row = Math.floor(-pile.y / fgmState.gridCellHeightInclSpacing);
const index = (row * this.gridN... | [
"groupBySimilarity () {\n const toBePiled = this.piles.length - this.visiblePilesMax;\n\n if (toBePiled <= 0) {\n return;\n }\n\n // Get a copy of the pointers to piles\n const _piles = this.piles.slice();\n\n // Sort piles by their ranking\n _piles.sort((a, b) => a.rank - b.rank);\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
simplify(re, im) if the imaginary part is 0, the real part is returned otherwise, a complex instance is created | function simplify(re,im){return im===0?re:new Z(re,im)} | [
"function test_complexExponential(re, im) {\n\tvar l = re.length = im.length,\n\t\te_x, y,\n\t\te_re = [],\n\t\te_im = [];\n\t\n\tfor (var i = 0; i < l; i++) {\n\t\te_x = Math.exp(re[i]);\n\t\ty = im[i];\n\t\t\n\t\te_re.push(e_x * Math.cos(y));\n\t\te_im.push(e_x * Math.sin(y));\n\t}\n\t\n\tvar result = new Objec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to save scenes, overwrites scene if it already exists | saveScene(scene) {
if (this.getSceneById(scene.id) === null) {
this.addNewScene(scene)
return
}
this.overwriteScene(scene.id, scene)
} | [
"function saveScene() {\n let saveName = document.getElementById(\"save-scene-text\").value;\n if (saveName.length < 1 || saveName.length > 12) {\n printToConsole(\"ERROR: Enter scene name no longer than 12 characters!\");\n return;\n }\n\n printToConsole(\"Saving \" + saveName + \" to loc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getMeasureList Gets the list of measures in an array from the selections | static getMeasureList(selections) {
let i = 0;
let cur = {};
const rv = [];
if (!selections.length) {
return rv;
}
cur = selections[0].selector.measure;
for (i = 0; i < selections.length; ++i) {
const sel = selections[i];
if (i === 0 || (sel.selector.measure !== cur)) {
... | [
"static getMeasureList(selections) {\n let i = 0;\n let cur = {};\n const rv = [];\n if (!selections.length) {\n return rv;\n }\n cur = selections[0].selector.measure;\n for (i = 0; i < selections.length; ++i) {\n const sel = selections[i];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculateAllDimensions calculates all dimensions used to frame and text rendering PARAMETERS: imageView: image id RETURNS: nothing | function calculateAllDimensions(imageView) {
//dimensions of image
allDimensions.imageWidth = imageView.image.width;
allDimensions.imageHeight = imageView.image.height;
//dimensions of image including inner frame
allDimensions.framedImageWidth =
allDimensions.imageWidth + 2 * allDimensions.innerF... | [
"function calculateDimensions () {\n calculateWrapper();\n calculateBuffer();\n }",
"computeFittedDimensions() {\n var {width, height, path} = this.getImageData(),\n parent = this.getDOMNode().parentNode,\n pWidth = parent.offsetWidth,\n pHei... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exchange Rates //// The exchange rates endpoint returns the current exchange rates used by Nomics to convert prices from markets into USD. This contains Fiat currencies as well as a BTC and ETH quote prices. This endpoint helps normalize data across markets as well as to provide localization for users. Currently, this ... | exchangeRates() {
return this.getExchangeRatesV1()
.catch((err) => {
console.error("Error in 'exchangeRates' method of nomics module\n" + err);
throw new Error(err);
});
} | [
"function getExchangeRate() {\n const sourceCurrency = document.querySelector('.currency_convert_from').value;\n const destinationCurrency = document.querySelector('.currency_convert_to').value;\n const currencyQueryString = `${sourceCurrency}_${destinationCurrency}`;\n\n const url = bui... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads selected image and unencodes image bytes for Rekognition DetectFaces API | function ProcessImage(imgGotten) {
//AnonLog();
var control = document.getElementById("fileToUpload");
// var file = control.files[0];
var file = img;
// Load base64 encoded image
// var reader = new FileReader();
// reader.onload = (function (theFile) {
// return function ... | [
"ProcessImage(screenshot) {\n\n var image = atob(screenshot.split(\"data:image/jpeg;base64,\")[1]);\n\n //unencode image bytes for Rekognition DetectFaces API \n var length = image.length;\n var imageBytes = new ArrayBuffer(length);\n var ua = new Uint8Array(imageBytes);\n for (var i = 0; i < length; i++) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a batch task. | function addBatchTask(taskName) {
// Remove the right-most component to get the batch name
var batchName = taskName.split(DELIMITER).slice(0, -1).join(DELIMITER);
if (!batchName) {
return;
}
// Get known dependencies for this batch
var batchDeps = allDeps[batchName];
if (batchDeps == null) {
batch... | [
"addTask(name, operation, ...params) {\r var task = new Task(name, operation, ...params);\r this.taskQueue.push(task);\r this.updateBacklogsAndTaskQueues();\r }",
"addBatchTask(options) {\r\n let index = 0;\r\n // Unacceptable values: NaN, <=0, type not number/function\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The loadStrings method creates a jQuery Deferred object, as well as an XMLHttpRequest object (for newer browsers) or an ActiveXObject (for older versions of IE), then makes an AJAX request based on the locale that was passed to it. The response from this request is then parsed as JSON and used to resolve the Deferred o... | function loadStrings(locale) {
var jqDeferred = $.Deferred();
var endpoint = (defaults.loadFromAPI) ? defaults.apiPath : defaults.localPath + locale + '.json';
var request = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
var timeo... | [
"function $load( languageToLoad ) {\n var deferred = m.deferred();\n if( isBrowser( ) ) {\n m.request( { method: \"GET\", url: $infix() + languageToLoad + $suffix() } )\n .then( function( translations ) {\n currentLanguage = languageToLoad || currentLangua... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save a file to S3 | function saveToS3(fileName) {
// load in file;
let logDir = './logs';
let directory =`${logDir}/${fileName}`;
let myKey = fileName;
var myBody;
console.log(directory);
// read then save to s3 in one step (so no undefined errors)
fs.readFile(directory, (err, data) => {
if (err) throw err;
... | [
"function saveObjToS3(data, fileName, bucket, callback){\n console.log(\"saveObjToS3\", data);\n //save data to s3 \n var params = {Bucket: bucket, Key: fileName, Body: data, ContentType: 'text/plain'};\n s3.putObject(params, function(err, data) {\n if (err) {\n console.log(\"saveObjToS3 err\", err);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens the discipline decline list page. | function openDisciplineDeclineListPage(entityPk) {
if (entityPk == 0) {
alert(getMessage("pm.common.miniEntity.open.error"));
return;
}
var path = getCSPath() + "/disciplinedeclinemgr/maintainDisciplineDecline.do?" +
"process=loadAllDisciplineDeclineEntity&forDivPopupB=Y&dd... | [
"function renderDisciplineListElement(discipline) {\n var table = document.getElementById('discipline_list');\n var row = table.insertRow(-1);\n\n var id = discipline.discipline_id.toString();\n\n var name = row.insertCell(0);\n var description = row.insertCell(1);\n\n name.innerHTML = disciplin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
artistData: objeto JS con los datos necesarios para crear un artista artistData.name (string) artistData.country (string) retorna: el nuevo artista creado | addArtist(artistData) {
/* Crea un artista y lo agrega a unqfy.
El objeto artista creado debe soportar (al menos):
- una propiedad name (string)
- una propiedad country (string)
*/
const newArtist = new Artist(this.idGenerator.generateId(),artistData.name, artistData.country);
this.checkIfThereIsA... | [
"addArtist(artistData) {\n /* Crea un artista y lo agrega a unqfy.\n El objeto artista creado debe soportar (al menos):\n - una propiedad name (string)\n - una propiedad country (string)\n */\n this._validarParametros(artistData, [\"name\", \"country\"]);\n this._validarDisponibilidadNombreArtista(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update state after user clicking adding new toy to show add Toy UI | newToyCallback(e) {
this.setState({addToy: true});
} | [
"handleNewToy(e) {\n\t\tlet item_id = e.target.getAttribute('data-key');\n\t\tlet user_id = this.props.user.id;\n\t\t\n\t\tthis.props.actions.addBox('/api/boxes', {active: true, item_id: item_id, user_id: user_id}).then(\n\t\t\t()=>{\n\t\t\t\tthis.props.actions.fetchUsers('/api/users').then(()=>{ this.setState({add... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When countdown is invoked, it creates a 'CLOSURE' that contains variable i. NOTE! All of the anonymous callbacks that we create in the for loop have access to i the same i!!! The easiest way to solve this is to move declaration (let i=5...) into the For Loop. | function countdown() {
"use strict";
console.log("Countdown: ");
for (let i = 5; i > 0; i--) { // DIFFERENCE: 'i' is now block scoped!!!
setTimeout(function () { // Be mindful of the scope that your callbacks are declared in!!!
console.log(i === 0 ? "... | [
"function countdown(timer) {\n return (function(n) {\n for (var i = n; i >= 0; i--) {\n console.log(i);\n }\n console.log('Done!');\n })(timer);\n}",
"function countdown (num) {\n //To overcome the problem , Instead of var use let as it creates block level scope\n for (let i = 0; i <= num; i += ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Eof Import YleyJkhServices Import TeamContractServices | async importTeamContractServices() {
this.log("Импортируем связки КонтрактКомпании-Услуга", "Info");
const {
source,
target,
ctx,
} = this;
const knex = source.getKnex();
const query = source.getQuery("yley_contract_services", "source")
;
query
.innerJoin(ta... | [
"async importTeamContracts() {\n\n this.log(\"Импортируем контракты команд\", \"Info\");\n\n // throw new Error(\"Test\");\n\n const {\n source,\n target,\n ctx,\n } = this;\n\n\n const knex = source.getKnex();\n\n\n const query = source.getQuery(\"yley_company_contracts\", \"source... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
place the piece at the specified z location | place_piece(value, z) {
this.gamespot[z] = value;
} | [
"function place_piece( index, x, y ) {\n pieces[index].x = x;\n pieces[index].y = y;\n $('#' + pieces[index].id).css('left', (x * 33.5) + '%');\n $('#' + pieces[index].id).css('top', (y * 33.5) + '%');\n }",
"place(x,y,facing = this.state.direction){\n\t\tlet currentSquares = this.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion region function EnableInputElement(id, enabled) Enable an input field on the screen, or disable it | function EnableInputElement(id, enabled) {
var inputElement = document.getElementById(id);
if (inputElement && inputElement.disabled !== undefined) {
inputElement.disabled = !enabled;
}
else {
console.log(`Could not find element '${id}' to set disabled to ${!enabled}`);
}
} | [
"function enableElement(id) {\n document.getElementById(id).disabled = false;\n}",
"function enable(id)\r\n{\r\n\tid.disabled = '';\r\n\treturn true;\r\n}",
"function EnableElementById(strId)\n\t{\t\t\n\t\t// show the element\n\t\tdocument.getElementById(strId).disabled = false;\n\t}",
"function enableInput(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adapt change delivery destination window when page is resized | function adaptChangeDeliveryDestinationWindow() {
let elem1 = document.getElementById("change-parcel-delivery-destination-win");
let elem2 = elem1.querySelector(".title-bar");
let elem3 = elem1.querySelector(".body");
let win_height = 473; //window total height
let body_top_and_... | [
"function adjustWindow() {\n AuxWindows.resizeCurrentTo(700, 0);\n}",
"function windowResizeHandler() {\n updateBounds();\n // if result panel has been shown\n if (document.documentElement.contains(panelContainer)) {\n if (displaySetting.type === \"fixed\") showFixedPanel();\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
public readonly importTaskBsdeFromExcel: string = super.appendToBaseUrl('/import_task_bsde_from_excel'); | function StandardImportPmApi() {
var _this = _super.call(this, StandardImportPmApi_1.baseUrl) || this;
// public readonly getImportAtaXLS: string = super.appendToBaseUrl('/get_import_ata_xls');
// public readonly importAtaFromExcel: string = super.appendToBaseUrl('/import_ata_from_excel');
... | [
"excelImport(data){\nreturn this.post(Config.API_URL + Constant.BANNER_EXCELIMPORT, data);\n}",
"excelImport(data){\nreturn this.post(Config.API_URL + Constant.REFFERAL_EXCELIMPORT, data);\n}",
"get baseUrl() {\n return super.url;\n }",
"importExcelInventarioMasiva(formData) {\n return this.h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to detect if we are likely being view on iPad | function isIpad() { return (navigator.userAgent.match(/iPad/i)) && (navigator.userAgent.match(/iPad/i)!= null); } | [
"function is_iPad(){\n var ua = navigator.userAgent.toLowerCase();\n if(ua.match(/iPad/i)==\"ipad\") {\n return true;\n } else {\n return false;\n }\n}",
"function isIPad() {\n\n return isDevice(\"iPad\");\n }",
"function DetectIpad()\n\t{\n\t\tif (uagent.search(deviceIpad) > -... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
4. Pythagoras Write a function calculateSide that takes two arguments: sideA and sideB, and returns the solution for sideC using the Pythagorean theorem. hint: discover the Pythagorean Theorem on a website called google.com hint: checkout the Math methods in javascript restriction: for this problem, do NOT use Math.hyp... | function calculateSide(sideA, sideB) {
const sideC = Math.sqrt(Math.pow(sideA, 2) + Math.pow(sideB, 2));
return sideC;
} | [
"function calculateSide(sideA, sideB) {\n sideC = Math.sqrt(Math.pow(sideA, 2) + Math.pow(sideB, 2)); \n return sideC;\n}",
"function calculateHypotenuse(sideA, sideB) {\n return Math.floor(Math.sqrt(sideA ** 2 + sideB ** 2));\n}",
"function calculateHypotenuse(aSide, bSide) {\n return Math.round(Math... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Triggers a server action | triggerServer(payload) {
// Send request
Entities.callEntityServerMethod(this.localEntity.id, "clientRequestForServer", [JSON.stringify({
plugin: this.constructor.pluginID,
data: payload
})])
} | [
"handleServerAction(action: Action): void {\n this.dispatch({\n source: constants.SERVER_ACTION,\n action: action\n });\n }",
"dispatch(action) {\n\t\t\n\t\t// Only non-client actions are allowed to be sent by the server\n\t\tif ( ! this._protocol.isClient[action.type]) {\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updatePool public function 1. URL /api/tenants/config/lbaas/pool/:uuid PUT 2. Sets Post Data and sends back the Pool config to client | function updatePool(request, response, appData) {
logutils.logger.debug('updatePool');
updatePoolCB(request, appData, function(error, results) {
commonUtils.handleJSONResponse(error, response, results);
});
} | [
"async createOrEditPool(options) {\n let type = options.type || options.algo;\n let getTime = await this.getTime();\n let body = {\n algorithm: type.toUpperCase(),\n name: options.name,\n username: options.user,\n password: options.pass,\n stratumHostname: options.host,\n stra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates & returns a page number (1based) based on a specific item index and number per page. Parameters: current_index: The index (0based) of an item num_per_page: The number of items per page Return value: The page number (1based) | function calc_page_num_with_current_idx(current_idx, num_per_page)
{
var top_idx = 0;
while (current_idx >= top_idx+num_per_page)
top_idx += num_per_page;
return calc_page_num_with_top_idx(top_idx, num_per_page);
} | [
"pageIndex(itemIndex) {\n if (itemIndex < 0 || this.itemCount() - 1 < itemIndex) return -1;\n return Math.floor(itemIndex / this.ipp);\n }",
"function calcPageNumAndTopPageIdx(pItemIdx, pNumItemsPerPage)\n{\n\tvar retObj = {\n\t\tpageNum: 0,\n\t\tpageTopIdx: -1\n\t};\n\n\tvar pageNum = 1;\n\tvar topIdx = 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! \brief get the table "process_input" changed value, submit the changes, get the results from server and update the results in the current page \param profit_of_other_processes: total profit of all processes exclude current process | function apply_model_basis_info_changes(factory_id, rf_id, profit_of_other_processes) {
// read the table, loop through each tr
var request_content = {};
var all_rows = $("#process_input > table tbody tr");
if (all_rows.length > 0) {
// the first row: cell 1 with id as chem_id, value is the quan... | [
"function eventProfitChangedHandler( evt ){\n\tconsole.log('event event profit handler');\n\tvar total = 0;\n\tvar remainder = 0;\n\n\tjq('#gbMainTable > tbody > tr.dr').not('.LNRow').find(createFieldInputSelector( 'EventProfit__c' )).each(function(){\n\t\tif (jq.isNumeric(parseInt(jq( this ).val()))){\n\t\t\tconso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper for dispatching popNotification function, which pops a notification. | popNotification(id) {
this.props.dispatch(popNotification(id));
} | [
"dismissNotification(notification) {\n this._get(\n \"dismissNotification?user=\" +\n this.state.user +\n \"¬ificationid=\" +\n notification.id\n );\n }",
"close(notification) {\n notification.close();\n }",
"handleNotification(notification) { }",
"function removeNotifi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prevents the user from deleting the command prompt. | function preventPromptErasing(event, deleteKeyPressed)
{
if($(_consoleSelector)[0].selectionStart < _eraseLimit || $(_consoleSelector)[0].selectionEnd < _eraseLimit || (!deleteKeyPressed && $(_consoleSelector)[0].selectionStart == _eraseLimit || $(_consoleSelector)[0].selectionEnd == _eraseLim... | [
"function deletePrompt() {\n document.getElementById(\"prompt\").innerHTML = \"\";\n }",
"function shellDropLine()\n{\n // Drop the line then output whatever was typed but not executed (inspired by how AIX handles this).\n _StdIn.advanceLine();\n this.putPrompt();\n \n if(_StdIn.buffer.getSize(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the maximum horizontal speed of a moving platform | function getMovingPlatformMaxSpeedY() {
return 2;
} | [
"function getMovingPlatformMaxSpeedX() {\n return 2;\n}",
"get horizontalSpeed() {\n if (this.pointers.length > 0)\n return (\n this.pointers.reduce((sum, pointer) => {\n return sum + pointer.horizontalSpeed;\n }, 0) / this.pointers.length\n );\n else return 0;\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
recursive function to find all words in the given node. | function findAllWords(node, arr) {
// base case, if node is at a word, push to output
if (node.end) {
arr.unshift(node.getWord());
}
// iterate through each children, call recursive findAllWords
for (var child in node.children) {
findAllWords(node.children[child], arr);
}
} | [
"function findAllWords(node, arr) {\r\n\r\n // base case, if node is at a word, push to output\r\n if (node.end) {\r\n arr.push(node.getWord());\r\n }\r\n\r\n // Iterating through each children, and calling findallwords function recursively \r\n for (var child in node.children) {\r\n f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pass draw function to superclass, then draw sprites, then check for overlap | draw() {
// PNG room draw
super.draw();
if (x0 === true) this.bookSprites[0].remove();
if (x1 === true) this.bookSprites[1].remove();
if (x2 === true) this.bookSprites[2].remove();
if (x3 === true) this.bookSprites[3].remove();
drawSprite(this.bookSprites[0]);
drawSprite(this.boo... | [
"draw() {\n // PNG room draw\n super.draw();\n\n //this.present.draw();\n drawSprite(this.PresentSprite)\n drawSprite(this.DadSitNpc)\n\n //overlap with sprite\n // talk() function gets called\n playerSprite.overlap(this.PresentSprite,talkToWeirdy);\n playerSprite.overlap(this.DadSitNpc,t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format an array into a grammatically correct string of values from the array | formatArray(arrayInfo) {
// To store the final, desired string displaying all the author names
let stringInfo = '';
if (arrayInfo === undefined) {
stringInfo = 'Unknown'
} else if (arrayInfo.length === 1) {
stringInfo = arrayInfo[0]
} else if (arrayInfo.length === 2) {
stringInfo ... | [
"function arrayToFmtString(array) {\n var results = '';\n array.forEach(function(item, index){\n results += '\"' + item.trim() + '\"';\n if (index < array.length - 1) {\n results += ', ';\n }\n });\n return results;\n}",
"function formatArrayToString(array) {\n if (array.length === 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find and return second largest unique number in given Array. Array may contain values of any data type. Ignore everything except numbers and strings, which may be converted to numbers. If passed value is not an Array or if there is no second largest item in given Array (e.g. [1, 1, 1]) should return undefined. Examples... | function secondLargest(array) {
if(array <= 0 || !Array.isArray(array)) return undefined;
let filteredNum = [...new Set(array)].filter(e => /\d+$/.test(e)).map(e => e).sort((a, b) => b - a)[1];
if(array.every((e, i, arr) => e === arr[0])) return undefined
return +filteredNum;
} | [
"function secondLargest(arr) {\n if (arr.length < 2) {\n return null;\n }\n\n var max, secondmax;\n // Since we know array length is at least 2, we can compare first two elements right away.\n if (arr[0] > arr[1]) {\n max = arr[0];\n secondmax = arr[1];\n } else {\n max = arr[1];\n secondmax = arr[0];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If `true`, will pause slide switching when mouse cursor hovers the slide. | set pauseOnHover(value) {
this._pauseOnHover$.next(value);
} | [
"function playOnMouseOut() {\r\n if (options.manuallyPaused) {\r\n return true;\r\n }\r\n beginScrollingInterval();\r\n }",
"startPlayingMouseLeave() {\n if (this.carouselService.settings.autoplayHoverPause && this.carouselService.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tells you whether this node type has any required attributes. | hasRequiredAttrs() {
for (let n in this.attrs)
if (this.attrs[n].isRequired)
return true;
return false;
} | [
"function CheckRequiredAttributes() {\n\t\t\t\t\n\t\t\t}",
"async checkRequired () {\n\t\tif (!this.options.new) {\n\t\t\t// we only require attributes for models being created, since for models that have already existed\n\t\t\t// we can't assume we have their complete set of attributes\n\t\t\treturn;\n\t\t}\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the currently active global terminators | peekGlobalTerminators() {
var _a;
return (_a = this.globalTerminators[this.globalTerminators.length - 1]) !== null && _a !== void 0 ? _a : [];
} | [
"function getAllWindowHandles() {\n return new Promise(function(resolve, reject) {\n exec(\"xprop -root _NET_CLIENT_LIST\", function(error, stdout, stderr) {\n if (error) {\n return reject(error);\n }\n\n let ids = stdout.match(/0x(([a-z]|\\d)+)/gi);\n resolve(ids);\n });\n });\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Kills the zombie, disabling rendering/collisions. | killZombie(zomb) {
zomb.die();
} | [
"kill(){\n this.vulnerable = false;\n this.lives -= 1;\n this.engine.stop();\n this.emit(\"ship_death\");\n this.setActive(false).setVisible(false);\n }",
"function zombieDestruct(zombie) {\nzombie.style.display = \"none\";\nzombieId++;\nmakeZombie();\n}",
"kill() {\n\t\tsu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A loki persistence adapter which persists to web browser's local storage object | function LokiLocalStorageAdapter() { } | [
"function LokiLocalStorageAdapter() {}",
"persist() {\n if (!SUPPORTS_LOCAL_STORAGE) {\n return;\n }\n const serializedCookies = Array.from(this.store.entries()).map(([origin, cookies]) => {\n return [origin, Array.from(cookies.entries())];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Middleware to update a device into the db under current user's client | function putDevice(req, res, next){
var user = req.user;
var id = req.body.id;
var deviceData = req.body;
utils.dbHandler(req, res, next, function(){
return dbDevice.putDevice(user, id, deviceData);
});
} | [
"function socketUpdateForAdminDevice(req, res, next){\n\tnext();\n\n\tvar user = {client_id: req.result.result.client_id};\n\tvar deviceId = req.result.result.id;\n\tvar permittedUsers = req.permittedUsers;\n\n\treturn dbDevice.getDeviceByIdForAdmin(deviceId)\n\t.then(function(device){\n\t\tvar rtAdminDevice = requ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We keep the Todos in sequential order, despite being saved by unordered GUID in the database. This generates the next order number for new items. | nextOrder() {
if (!this.length) {
return 1;
}
return this.last().get('order') + 1;
} | [
"generateTodoId(){\n const lastTodo = this.state.todos[this.state.todos.length - 1];\n if(lastTodo){\n return lastTodo.id + 1;\n }\n\n return 1;\n }",
"getTodoId() {\n const id = this._todos[0] ? this._todos[0].id : 0;\n return id + 1;\n }",
"nextOrder() {\n return this.len... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::Kendra::DataSource.HookConfiguration` resource | function cfnDataSourceHookConfigurationPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDataSource_HookConfigurationPropertyValidator(properties).assertSuccess();
return {
InvocationCondition: cfnDataSourceDocumentAttributeConditionPropert... | [
"renderProperties(x) { return ui.divText(`Properties for ${x.name}`); }",
"function renderProperties(setup) {\n // print available exams\n var html = '';\n if (!('localStorage' in window)) {\n html += warning(getMessage('msg_options_change_disabled', 'Changing options is disabled, because your bro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= Description Sends itself one step backward by changing its ZIndex. = Returns +self+ | sendBackward() {
const _index = this.zIndex();
// 0 is already at the back
if (_index !== 0 && this.zOrderDisabled === false) {
this.parent.viewsZOrder.splice(_index, 1);
this.parent.viewsZOrder.splice(_index - 1, 0, this.viewId);
this._updateZIndexAllSiblings();
}
return this;
} | [
"ReverseFrames() {\n\n this.reverse_frames = true;\n return this;\n }",
"back() {\n this.idx --;\n }",
"reverse() {\n this.direction *= -1\n }",
"function stepBackward() {\n window.clearTimeout(timer);\n\n index -= 2;\n if (index < -1) index = -1;\n\n time = index / 20.0;\n pos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Destroy chart before unmount. | componentWillUnmount() {
this.chart.destroy();
} | [
"componentWillUnmount() {\n this.chart.destroy();\n }",
"componentWillUnmount() {\n this.chart.destroy();\n }",
"function chartOnDestroy() {\n if (this.accessibility) {\n this.accessibility.destroy();\n }\n }",
"_destroyChart () {\n if (this.chart) {\n // TODO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear timer and resolve pending iframe ready promise. | function clearTimerAndResolve() {
_window().clearTimeout(networkErrorTimer);
resolve(iframe);
} | [
"function clearTimerAndResolve() {\n _window().clearTimeout(networkErrorTimer);\n\n resolve(iframe);\n } // This returns an IThenable. However the reject part does not call",
"function pollReady() {\n if (!iframe.contentWindow.document.getElementById('progress')) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a promise, which resolves once the image is loaded loaded | function imageLoaded(imageElement) {
return new Promise((resolve, reject) => {
if (imageElement.complete) {
// If my script is so slow, that the image is loaded before I create my promise, I resolve the promise right away
resolve();
} else {
// Otherwise, I resolve it once the image 'load' e... | [
"function waitForLoad() {\n return new Promise(resolve => {\n image.addEventListener(\"load\", resolve);\n });\n }",
"function imageLoaded(img){\r\n\t\treturn new Promise(function(resolve,reject){\r\n\t\t\tvar checkInterval = setInterval(function(){\r\n\t\t\t\t\tif(checkImageLoaded(img)){\r\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stops the passive score counter | function stopScoreCounter() {
clearInterval(scoreCounterID);
} | [
"function stopScore(){\n if(score<0){\n score = 0;\n }\n}",
"function stopGame () {\n if (score === levels[currentLevel]) {\n currentLevel++;\n stopIntervals();\n levelWin();\n } else {\n if (counter <= 0) {\n stopIntervals();\n levelLose();\n }\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a column at the given position in a table. | function addColumn(tr, ref, col) {
var map = ref.map;
var tableStart = ref.tableStart;
var table = ref.table;
var refColumn = col > 0 ? -1 : 0;
if (columnIsHeader(map, table, col + refColumn))
{ refColumn = col == 0 || col == map.width ? null : 0; }
for (var row = 0; row < map.height; row++) {
var... | [
"function appendColumn() {\n var tbl = document.getElementById('my-table'), // table reference\n i;\n // open loop for each row and append cell\n for (i = 0; i < tbl.rows.length; i++) {\n createCell(tbl.rows[i].insertCell(tbl.rows[i].cells.length), i, '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads record count by executing the given query | async loadCount()
{
const qParams = this._cache.queryParams;
if (!qParams)
{
throw new Meteor.Error('Calling .loadCount() while query params are not ready');
}
return this.getEntity().getCount(qParams.filter || {});
} | [
"function executeCountQuery(query) {\n return new Promise((resolve, reject) => {\n query.exec((err, data) => {\n if (err) return reject(err);\n if (!data) return resolve(0);\n resolve(data);\n })\n });\n }",
"count(query) {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SELECT "user" FROM tags WHERE tag = '$1' INTERSECT ... | function genIntersectQuery(tag, i) {
return 'SELECT "user" FROM "tags-users" WHERE tag = $' + (i + 1).toString();
} | [
"function unionTags(notebook, tags){\n\tvar list = [];\n\tfor(var i = 0; i < tags.length; i++){\n\t\tvar tag = tags[i];\n\n\t\tvar tagList = notebook.access_database[tag];\n\t\tif(tagList !== undefined){\n\t\t\tlist = list.concat(tagList);\n\t\t}\n\t}\n\tlist = list.filter(function(elem, ind){\n\t\treturn list.inde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the link for a display field | function getLinkAddress(field, candidate) {
var href = field.link;
var match;
while (match = href.match(/^(.*?)@@(.*?)@@(.*)$/)) {
href = match[1] + candidate[match[2]] + match[3];
}
return href;
} | [
"function LinkField(config) {\n Field.apply(this); // extends Field class\n\n this.Url = '#';\n\n if (typeof config != 'undefined') {\n for (var prop in config)\n if (this.hasOwnProperty(prop))\n this[prop] = config[prop];\n }\n\n this.Super_Display = this.Display;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Suma todos los valores de una propiedad en una coleccion | function suma(coleccion, propiedad, valor){
var suma = 0;
$.each(coleccion, function(key, val){
if ($.isNumeric(val[propiedad][valor])) {
suma = suma + val[propiedad][valor];
}
});
return suma;
} | [
"function sumarTotalPrecio(){\n\n\t\t\tvar precioItem = $('.nuevoPrecioProducto');\n\n\t\t\tvar arraySumarPrecio = [];\n\n\t\t\tfor (var i = 0; i < precioItem.length; i++){\n\n\t\t\t\tarraySumarPrecio.push(Number($(precioItem[i]).val()));\n\t\t\t\t\n\n\t\t\t}\n\n\t\t\tfunction sumarArrayPrecio(total, numero){\n\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given a vertex id returns edges referencing that vertex | edgesForVertexId(vertex_id, geometry) {
return geometry.edges.filter(e => (e.v1 === vertex_id) || (e.v2 === vertex_id));
} | [
"getVertex(id){\n const vertices=this.getVertices();\n for(let i=0;i<this.order;i++){\n if(vertices[i].getNodeId()===id){\n return vertices[i];\n }\n }\n }",
"vertexForId(vertex_id, geometry) {\n return geometry.vertices.find(v => v.id === vertex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize autoScroll on click of Nav. | function autoScroll() {
$('a[href*="#"]').not('[href="#"]').not('[href="#0"]').on("click", scroll);
} | [
"function iniAutoScroll() {\n \n // auto scroll initieel starten\n\t\tstartAutoScroll();\n\t}",
"function navScroll() {\n // init controller\n height = window.innerHeight;\n var controller = new ScrollMagic.Controller();\n\n // build scenes\n new ScrollMagic.Scene({triggerElement: \"#intro\"})\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns if this curve only yields constants. | constant() {
return this._values.length === 1;
} | [
"function getIsCurve()\n{\n return isCurve;\n}",
"static isDefaultCurve(values){\n try{\n if(value.length === 2 &&\n value[0][0] === 0 && value[0][1] === 0 &&\n value[1][0] === 255 && value[1][1] === 255){\n return true\n }else{\n return false\n }\n }catch(e){\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
These functions return HTML templates RENDER FUNCTION(S) This function conditionally replaces the contents of the tag based on the state of the store | function render() {
let bigString;
console.log('render fxn ran')
if (store.view === 'landing') {
bigString = generateTitleTemplate(store);
}
else if (store.view === 'question') {
bigString = generateQuestionTemplate(store);
}
else if (store.view === 'feedback') {
bigString = generateFeedback... | [
"createMarkup() {\n var templateMarkup = this.parseTemplate(this.props.context.getConfigVal('template'));\n return {__html: templateMarkup};\n }",
"html(templateNo = ''){\n let method = 'template' + templateNo;\n if(!this[method]){ return; }\n let rendered = $(this[method]());\n // ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
code to send Ohio email notification | function sendOhioNotification() {
gso.getCrudService()
.execute(constants.post,manageEmpUrlConfig.manageEmpApi + manageEmpUrlConfig.manageBaseUrl + manageEmpUrlConfig.resources.managegroup + "/" + gso.getAppConfig().companyId + "/" + gso.getAppConfig().userId+ "/ohioemail", n... | [
"'emailNotifications.sendEmail'(emailAddress, subject, message) {\n Email.send({\n from: \"notifications@getyourshitdone.club\",\n to: emailAddress,\n subject: subject,\n text: message\n });\n }",
"async function doNotifications(){\n saveMessageToDb();\n\n //set up &... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function receives an object, whose values will all be numbers, and returns the smallest number in the object. | function min(object) {
const arrayOfvalues =Object.values(object);
return Math.min(...arrayOfvalues)
} | [
"function min(object) {\n \n\n smallestNum = Object.values(object);\n return Math.min(...smallestNum);\n\n}",
"function min(object) {\n const values = Object.values(object);\n\n return Math.min(...values);\n}",
"function min(object) {\n\n const arrayOfvalues = Object.values(object);\n\n return Math.min(.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |