query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Called on `drain` event | onDrain() {
this.writeBuffer.splice(0, this.prevBufferLen);
// setting prevBufferLen = 0 is very important
// for example, when upgrading, upgrade packet is sent over,
// and a nonzero prevBufferLen could cause problems on `drain`
this.prevBufferLen = 0;
if (0 === this.writeBuffer.length) {
... | [
"function drainQueue() {\n runHandlers(handlerQueue);\n handlerQueue = [];\n }",
"async flush() {\n if (this.err !== null)\n throw this.err;\n if (this.n === 0)\n return;\n let n = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parse a unit string or throw an error. It may have a prefix at beginning, and a power number at the end (without ^, otherwise it would have been split away already) | function parsePrefixUnitPower(text) {
let pow = 1, u = null; //unit power, the unit object
//try to find simply as {prefix + unit}
u = parsePrefixUnit(text, pow);
if(u) {return u;}
//not found - try to find as {prefix + unit + power}
const powIndex = text.search(/[\.\d]+$/);
if(powIndex > -1) {
pow =... | [
"function split(text, IACB) { //IACB see crawl function definition\n\t\tconst arr = protectNumbers(text, IACB)\n\t\t\t.split(/([\\^*/+\\-])/)\n\t\t\t.filter(o => o.length > 0)\n\t\t\t.map(o => unprotectNumbers(o));\n\n\t\t//text is now split into array of strings, iterate through it and parse them\n\t\tconst arr2 =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load product in shop | function loadAllProductInShop() {
Product.getProductLive({ SearchText: '' })
.then(function (res) {
$scope.products = res.data;
});
} | [
"static async fetchProductById(productId) {\n const product = storage\n .get(\"products\")\n .find({ id: Number(productId) })\n .value()\n return product\n }",
"function continueShopping() {\n getProducts();\n }",
"async show({ params }) {\n return Product.findProduct(params);\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
restoreValidation() Removes the temporary validation rules and replaces them with the original rules | function restoreValidation() {
if ( !$.isEmptyObject(j2w.validator.initial) ) {
$('#tcsignup').validate().settings.rules = j2w.validator.initial;
}
} | [
"clearValidations() {\n this.validateField(null);\n setProperties(this, {\n '_edited': false,\n 'validationErrorMessages': [],\n validationStateVisible: false\n });\n }",
"resetRules() {\n this.ruleContextAgent.removeAllListeners();\n this.ruleManager.resetRules();\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to create button for name of new Run and difficulty | function createNewRunButton(resort) {
let btn = document.createElement('button');
btn.className = 'btn btn-info';
btn.innerHTML = 'Create';
btn.onclick = () => {
resort.runs.push(new Run(getValue(`name-input-${resort.id}`), getValue(`difficulty-input-${resort.id}`)))
drawDOM();
};
... | [
"function createButton(inrTxt) {\r\n const elem = document.createElement(`button`);\r\n elem.classList.add(`buttons`);\r\n elem.innerText = `${inrTxt}`;\r\n active.buttons.push({\r\n e: elem\r\n });\r\n box.appendChild(elem);\r\n }",
"function addButtons() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make a new upwardable. Register it, and add a `change` method which notifies when it is to be replaced. | function make(x, options = {}) {
var {debug = DEBUG_ALL} = options;
var u;
debug = DEBUG && debug;
if (x === undefined) u = makeUndefined();
else if (x === null) u = makeNull();
else {
u = Object(x);
if (!is(u)) {
add(u, debug);
defineProperty(u, 'change', { value: change });
}
}... | [
"function change(x) {\n var u = this;\n var debug = u._upwardableDebug;\n\n if (x !== this.valueOf()) {\n u = make(x, { debug });\n getNotifier(this).notify({object: this, newValue: u, type: 'upward'});\n\n if (debug) {\n console.debug(...channel.debug(\"Replaced upwardable\", this._upwardableId, \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns a stub for webpackassets.json if it doesn't exist yet (because node.js and webpack are being run in parallel in development mode) | function default_webpack_assets() {
var webpack_assets = {
javascript: {},
styles: {}
};
return webpack_assets;
} | [
"loadEnvironmentInfo() {\n let infoPath = path.join(this.projectFolder, \"envInfo.json\");\n if (this.utils.fileExists(infoPath)) {\n return this.utils.readJsonFile(infoPath);\n }\n return null;\n }",
"function readManifest() {\n if (manifestExists()){\n var manifestS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a player given the lobby and player role | function getPlayer(lobby, role) {
return players.find(player => player.lobby === lobby && player.role === role);
} | [
"function getLobbyWithPlayer(username, hostonly = false)\n{\n const found = lobbies.find(lobby =>\n lobby.players.some(player =>\n {\n return (player.username == username) && (player.host || !hostonly);\n }\n )\n );\n\n if (found)\n return found;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
writeStringOrBuffer write a String or Buffer with the its length prefix | function writeStringOrBuffer(buffer, pos, toWrite) {
var written = 0
if (toWrite && typeof toWrite === 'string') {
written += writeString(buffer, pos + written, toWrite)
} else if (toWrite) {
written += writeNumber(buffer, pos + written, toWrite.length)
written += writeBuffer(buffer, pos + written, t... | [
"write(buffer) {\n this.wsSocket.send(buffer);\n }",
"function writeString(attribute, val) {\n // write length of attribute (1 byte) \n buf.writeUInt8(attribute.length, offset);\n offset++;\n\n // write attribute (string)\n offset += buf.write(attribute, offset);\n \n // write type ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Click the News & Video tab | clickNews_VideoTab(){
this.newsVideoTab.waitForExist();
this.newsVideoTab.click();
} | [
"click_raceMeetingNewsVideoTab(){\n this.raceMeetingNewsVideo_Tab.waitForExist();\n this.raceMeetingNewsVideo_Tab.click();\n }",
"clickNewsArticleTab(){\n // this.newsTab.waitForExist();\n this.newsTab.click();\n }",
"get newsTab() {return browser.element(\"~News & Videos\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
keep affiliate link if they exist | function keepAffiliateLink(){
var affiliate = getQueryParam(affiliateParam);
if(affiliate){
var anchors = document.querySelectorAll('a');
anchors.forEach(a =>{
if(a.href){
a.href += ((a.href.match(/\?/) ? '&' : '?')+affiliateParam+'='+affiliate);
}
});
}
} | [
"function uniqueLinkGen(){\n if(linkGenStore.findOne({'shortURL':short_url})===true){//check if short url is present\n short_url = linkGen.genURL();\n uniqueLinkGen();\n }\n else{\n return short_url;\n }\n }",
"function loot_fix_sell_links() {\n\n\t$('a[href^=\"javasc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a basic arrow shape with the given position and rotation on the given stage | function createBasicArrow(stage, position, rotation) {
var marker = new ROS2D.NavigationArrow2({
size : 20,
strokeSize : 1,
fillColor : locationArrowColor,
ringColor : rotationRingColor,
});
marker.x = position.x;
marker.y = position.y;
marker.rotation = rotation;
marker.scaleX = 1.0 / stage... | [
"function draw_arrow(begin, end, alpha){\n //begin = createVector(begin[0], begin[1]);\n //end = createVector(end[0], end[1]);\n if (alpha < 0) {\n stroke(255, 0, 0, -alpha);\n fill(255, 0, 0, -alpha);\n } else {\n stroke(0, 0, 255, alpha);\n fill(0, 0, 255, alpha);\n }\n line(begin.x, begin.y, en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if current letter is space or not | function isSpace(letter)
{
// check if the letter is a space
if(letter.charCodeAt(0).toString(16) == "20")
return true;
return false;
} | [
"eatSpace() {\n let start = this.pos\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos\n return this.pos > start\n }",
"function isNotSpace(input)\r\n{\r\n var letters = /^[ ]+$/\r\n if(input.match(letters))\r\n {\r\n return false;\r\n }\r\n els... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Caclulates stats based on loadFoodPeefs() output | function calculateFoodData(preferences, restrictions, guestCount) {
prefPercentage = [];
var occurences = findOccurences(preferences);
var uniqueRestrictions = restrictions.getUnique();
for (var i = 0; i < occurences[0].length; i++) {
var prefObj = {};
prefObj.name = occurences[0][i];
... | [
"UPDATE_OPP_ATHLETE_STATISTICS(state) {\n let result = [];\n\n for (let athlete in state.oppRoster) {\n result.push(\n {\n name: state.oppRoster[athlete].name,\n number: state.oppRoster[athlete].number,\n points:0,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
base action for store crud actions The store could be a string or an object A string means that we must find the first store of that type A objet means that it's already a store objet | function findStore(store) {
if (typeof store !== 'string') {
return store
} else {
const stores = registerStore.getAll(store);
if (stores.length > 0) {
return stores[0]
} else {
return store;
}
}
} | [
"switchStores(storeType) {\n this.storeType = storeType;\n this.reloadStores(true);\n }",
"function addStore(req, res) {\n \n //If storename is not provided or is blank return 403 status\n if (!req.body.storename || req.body.storename == \"\"){ \n\n res.statusCode = 403;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reset for next question | function reset() {
// go to next question
game.qIndex++;
if (game.qIndex < game.qArray.length) {
//remove classes for styling answers
$(".answerArea").find(".correct").toggleClass("correct");
$(".answerArea").find(".selected").toggleClass("selected");
//reset time
game.timeLeft = 8;
//reset ans... | [
"function setNextQuestion() {}",
"reset() {\n\tthis.progress = new Progress(0);\n\tthis.question = [];\n\tthis.setChanged();\n\tthis.notifyObservers(this.progress);\n\tthis.clearChanged();\n }",
"function nextQuestion() {\n // clear out divs (image and win/loss/outoftime)\n console.log(question... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new SkeletonViewer | function SkeletonViewer(/** defines the skeleton to render */skeleton,/** defines the mesh attached to the skeleton */mesh,scene,/** defines a boolean indicating if bones matrices must be forced to update before rendering (true by default) */autoUpdateBonesMatrices,/** defines the rendering group id to use with the vi... | [
"function Skeleton(/** defines the skeleton name */name,/** defines the skeleton Id */id,scene){this.name=name;this.id=id;/**\n * Gets the list of child bones\n */this.bones=new Array();/**\n * Gets a boolean indicating if the root matrix is provided by meshes or by the current s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a higherorder function that takes in one argument, an integer, and returns a function that will multiply a fare for a ride accordingly. If createFareMultiplier() receives an argument of 4, it will return a function that takes in a fare as an argument and quadruples the fare. | function createFareMultiplier(multiplier) {
return function(fare) {
return fare*multiplier;
};
} | [
"function product(a) {\n return function (b) {\n return a * b;\n };\n}",
"function creerMultiplicateur2(n){\n\n\tif (arguments.length === 2) {\n\t\tvar x = arguments[1];\n\t\treturn n * x;\n\n\t}else if (arguments.length === 1 ){\n\t\treturn (x) => x * n;\n\t}\n\n}",
"function liftf(binaryFunction... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show all results if tld search is empty. | function empty_find_tld_handle () {
fundamental_vars.error_status = false;
fundamental_vars.filtersOn = false;
$('.filters-on-use').text(DOMAINS_LANG['DOMAIN_SEARCH']['HEAD_TEXT']['ALL']);
$('.tldResults').show();
$('.tld-line').hide();
$('.asked').show();
$('#show_more').show();
$('.t... | [
"function search()\n{\n\tvar searchText = searchInput.value;\n\n\t// if input's empty\n\t// displaying everything\n\tif (searchText == \"\")\n\t{\n\t\tshowAllFilteredWordEntries();\n\t\treturn;\n\t}\n\n\t// hiding everything except the matched words\n\tfor (let i = 0; i < loadedData.length; i++)\n\t{\n\t\tlet entry... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Quick remove button for keywords: | function removeButton (e, place) {
return `<button class="removeKeyword" value=${e.id} onclick="removeKeywordButton(${place.id});">-</button>`;
} | [
"function removeCorpusButton()\n{\n d3.select(\".corpus-link\").remove();\n d3.select(\".back-button\").remove();\n d3.select(\".aggregate-button\").remove();\n}",
"function removeDeleteButtons() {\n\tYUI().use('node', function (Y) {\n\t\tvar allButtons = Y.all('.lfr-ddm-repeatable-delete-button');\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Labeling input elements compactly using their value attribute (i.e. search fields) You have an input element. You want it to say 'Search' or a similar label, provided its initial value is empty. On focus, if the label is present, it should clear. If they defocus it and it's empty, you want the label to come back. Here ... | function aInputSelfLabel(selector, label, select, focus, persistentLabel)
{
var aInput = $(selector);
aInput.each(function() {
setLabelIfNeeded(this);
$(this).addClass('a-default-value');
});
if (focus)
{
aInput.focus();
};
aInput.focus(function(){
var v = $(this).val();
if... | [
"_label(label) {\n return `${label}${label && this.required ? '*' : ''}`;\n }",
"function TKR_prepLabelAC() {\n var i = 0;\n while ($('label'+i)) {\n TKR_validateLabel($('label'+i));\n i++;\n }\n}",
"function myFunctionLabel(){\nconst labelForm = document.querySelector('.screen-reader-text');\ncons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns whether the point is inside all the planes that define the view area | function isPointInView(p) {
for (var i = 0; i < view_plane_normals.length; i++)
if (dot([p.x-camera_location.x,
p.y-camera_location.y,
p.z-camera_location.z],
view_plane_normals[i]) < -0.001)
return false
return true
} | [
"containsVertex(planes, vertices) {\n\n for (let vertex of vertices) {\n\n let isInside = true\n\n for (let plane of planes) {\n\n if (plane.distanceToPoint(vertex) < 0) {\n\n isInside = false\n break\n }\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Guarda los cambios de las potencias del centro eventual de carga | function GuardarCambiosContenedor()
{
(typeof Referencia == 'string') ? (Referencia = Referencia) : (Referencia = Referencia.tittle)
var ReferenciaMarcador = BuscarIndice(Proyecciones[ProyeccionActiva].MarcadoresCollecion, Referencia, 1);
var CoordenadaTexto = document.getElementById("ccoordenadas").val... | [
"function GuardarFormularioCaptura(form){\n \n\tif (!ValidateForm(form)){\n\n\t if(VAR_ERROR.length > 0){\n var html = '';\n CAMPOS_OBLIGATORIOS=[];\n //Si el anexo accionistas no está habilitado remueve los campos obligatorios\n if(!($(\"input[name='anexo_accionist... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function isSumEqual that takes two array parameters and returns true if the sum of elements in both arrays are equal. | function isSumEqual(arr1,arr2){
let sum1 =0;
let sum2 =0;
for(let ele1 of arr1){
sum1 += ele1;
}
for(let ele2 of arr2){
sum2 += ele2;
}
return sum1 === sum2;
} | [
"function isSumEqual(arr1, arr2) {\n sum1 = 0;\n sum2 = 0;\n for (let i = 0; i < arr1.length; i++) {\n sum1 += arr1[i];\n }\n for (let i = 0; i < arr2.length; i++) {\n sum2 += arr2[i];\n }\n if (sum1 === sum2) {\n return true;\n }\n return true;\n}",
"function same(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gives event functionality to config object | function defineEvents(config) {
config.pubSub = new PubSub();
/*if ( config.utils == null ) {
config.utils = {};
}*/
config.events = {};
var events = config.events;
var types = config.events.types = {};
events.onClick = function onClickDispatch(field, v... | [
"function ConfigFunction () {\n\n\n }",
"function initConfig (event) {\n let config = null;\n\n if (!fs.existsSync(configPath)) {\n const fd = fs.openSync(configPath, 'w');\n\n const initialConfig = {\n apiServer: '',\n operator: '',\n notificationsEnabled: true,\n };\n\n fs.writeSyn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Split remaning fragment and pass bits to the respective handlers | breakHeart(frag) {
if (frag.safe)
return this.callback(frag);
let bits = frag.split(break_re);
for (let i = 0, len = bits.length; i < len; i++) {
// anchor refs
const morsels = bits[i].split(ref_re);
for (let j = 0, l = morsels.length; j < l; j++) {
const m = morsels[j];
if (j % 2)
this.r... | [
"parseChunks(chunk, byteStart) {\r\n if (!this._onError || !this._onMediaInfo || !this._onTrackMetadata || !this._onDataAvailable) {\r\n throw new IllegalStateException('Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified');\r\n }\r\n\r\n let off... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isPointInButton() returns true if `p`, the coordinates of a mouse click, are inside the button at `column` and `row`. | function isPointInButton(p, column, row) {
var b = buttonPosition(column, row);
return !(p.x < b.x ||
p.y < b.y ||
p.x > b.x + BUTTON_SIZE ||
p.y > b.y + BUTTON_SIZE);
} | [
"function isOnButton(x, y, btn) {\n var inXBounds = (x >= btn.rect[0]) && (x <= btn.rect[0] + btn.rect[2]);\n var inYBounds = (y >= btn.rect[1]) && (y <= btn.rect[1] + btn.rect[3]);\n return inXBounds && inYBounds;\n}",
"function pointIsInCanvas(x, y, w, h) {\n return x >= 0 && x <= w && y >= 0 && y <= h;\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Increases the aircrafts altitude | increaseAircraftAltitude() {
const altitude_diff = this.altitude - this.target.altitude;
let climbRate = this.getClimbRate() * PERFORMANCE.TYPICAL_CLIMB_FACTOR;
if (this.mcp.shouldExpediteAltitudeChange || this.isTakeoff()) {
climbRate = this.model.rate.climb;
}
con... | [
"decreaseAircraftAltitude() {\n const altitude_diff = this.altitude - this.target.altitude;\n let descentRate = this.model.rate.descent * PERFORMANCE.TYPICAL_DESCENT_FACTOR;\n\n if (this.mcp.shouldExpediteAltitudeChange || this.isEstablishedOnCourse()) {\n descentRate = this.model.ra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct a HighScoreAccessor object, along with its readers & writers | function buildHighScoreAccessor(cookieHandler) {
var options = {},
limit = c.HIGH_SCORE_LENGTH;
options.localHighScoreReader =
new FOM.LocalHighScoreReader(cookieHandler, limit);
options.serverHighScoreReader = new FOM.ServerHighScoreReader(limit);
options.localH... | [
"getHighScores() {\n\t\tvar ref = this.database.ref(this.tableName);\n\t\tvar db = this;\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\t(function(db){\n\t\t\t\tref.on(\"value\", function(snapshot) {\n\t\t\t\t\tdb.highScores = snapshot.val();\n\t\t\t\t\tdb.setHighScoreInformation();\n\t\t\t\t\tresolve (s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the dirPath prefix from filePath | function relativePath(dirPath, filePath) {
return filePath.replace(dirPath, "")
} | [
"stripPrefixFromPaths( files, base_path ){\n if (!base_path) base_path = path.join(this.base_path, this.base_name)\n base_path = this.constructor.endPathWithPathSep(base_path)\n let re_base_path = new RegExp(`^${_.escapeRegExp(base_path)}`)\n return files.map( item => item.replace(re_base_path,'') )\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets all workflows from new api | async function getWorkflows(){
if (!m_workflow_cache.data || (((new Date) - m_workflow_cache.last_update) > 5000)){
var url = helpers.build_new_api_url("/workflows");
var response = await axios.get(url, {timeout: 7000,agent: false, maxSockets: Infinity});
m_workflow_cache.data = respons... | [
"function getPlaylists() {\n return axios.get(endpoints.playlist)\n}",
"getV3RunnersAll(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fills the clicked category with items and and appends a click handler which calls function checkGuessItems | function buildCategories(clickedCategory, correctCategory, otherCategories) {
if (clickedCategory === correctCategory.category) {
$('#guessItems').empty();
$.each(correctCategory.answers, function (index, data) {
$('#guessItems').append('<a class="guessButton" id="' + data + '">' + data ... | [
"function setClickHandler(correctCategory,imageCategories) {\n $('#guessOverview').children().click(function (event) {\n buildCategories(event.target.id, correctCategory, imageCategories)\n })\n\n}",
"function clickOnItem() {\n var dogTrait = this.id;\n var dogPart = this.dataset.cat;\n dog[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Endpoint that allows user to request Ownership of a Wallet address (POST Endpoint) | requestOwnership() {
this.app.post("/requestValidation", async (req, res) => {
if(req.body.address) {
const address = req.body.address;
const message = await this.blockchain.requestMessageOwnershipVerification(address);
if(message){
... | [
"function transferOwnership(res,ToAddress,FromAddress,PrivateKey){\r\n web3.eth.defaultAccount = FromAddress;\r\n var count = web3.eth.getTransactionCount(web3.eth.defaultAccount);\r\n var data = contract.transferOwnership.getData(ToAddress);\r\n var gasPrice = web3.eth.gasPrice;\r\n var gasLimit = 3... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show a `:double` fixedpoint notation. The optional `precision` (= `2`) specifies the maximum precision. If `>=0` it specifies the number of digits behind the dot (up to `20` max). If negative, then at most the absolute value of `precision` digits behind the dot are used. This may still show a number in exponential nota... | function show_fixed(d, precision) /* (d : double, precision : ?int) -> string */ {
var _precision_17876 = (precision !== undefined) ? precision : -2;
var dabs = Math.abs(d);
var _x27 = (((dabs < (1.0e-15))) || ((dabs > (1.0e21))));
if (_x27) {
return show_exp(d, _precision_17876);
}
else {
return s... | [
"function show_exp(d, precision) /* (d : double, precision : ?int) -> string */ {\n var _precision_17864 = (precision !== undefined) ? precision : -17;\n return show_expx(d, $std_core._int_to_int32(_precision_17864));\n}",
"function precision_function() {\n var a = 1234567.89876543210;\n document.getElem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a + to positive numbers and a plusminus to 0 | function addSign(num){
addition = "";
if(num > 0) addition = "+";
else if(num == 0) addition = "±";
return addition + num;
} | [
"function plusZero(method){\n\treturn ( method < 10 ) ? \"0\" + method : method;\n}",
"function pressPlusMinus() {\n\tif (displayVal !== \"0\") {\n\t\tif (displayVal.charAt(0) === \"-\") {\t\n\t\t\tdisplayVal = displayVal.slice(1);\n\t\t}\n\t\telse {\n\t\t\tdisplayVal = \"-\" + displayVal;\n\t\t}\n\t\toutput(disp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) | function BufferCopy (target, target_start, start, end) {
var source = this
if (!start) start = 0
if (!end && end !== 0) end = this.length
if (!target_start) target_start = 0
// Copy 0 bytes; we're done
if (end === start) return
if (target.length === 0 || source.length === 0) return
// Fatal error con... | [
"function copyBytes(src, dst, off = 0) {\n const r = dst.byteLength - off;\n if (src.byteLength > r) {\n src = src.subarray(0, r);\n }\n dst.set(src, off);\n return src.byteLength;\n }",
"function clone (buffer) {\r\n return copy(buffer, shallow(buffer));\r\n}",
"function copy(a, b, cb) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch items from Store | fetchItems(store) {
let query = encodeURI(this.state.query)
let id = store['id']
let request = `api/search?q=${query}&id=${id}`
console.log(request)
fetch(request)
.then(function(response){
return response.json()
})
.then((items) => {
let activeStores = this.state.activeStore... | [
"_fetchFromAPI() {\n // Generate new items\n let { indexedDb } = this;\n\n return indexedDb.add('item', [\n this._createItemPayload(),\n this._createItemPayload(),\n this._createItemPayload(),\n ]);\n }",
"function fetchItems() {\n const offset = state.offset - 1;\n state.offset ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns patterns that can be applied inside the current directory. | function getPatternsInsideCurrentDirectory(patterns) {
return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
} | [
"function getEntryFileGlobs({ fixtures, tests }) {\n let globs = [];\n for (let patterns of [fixtures, tests]) {\n for (let pattern of patterns) {\n if (typeof pattern === \"string\") {\n globs.push(pattern);\n }\n else if (pattern.included !== false) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses or constructs a data uri string compliant with RFC 2397. UCWA server sends instant messages in the data uri format and this class can be involved to parse them. Data URLs have to be parsed because SkypeWeb needs to extract separate attributes from them and this cannot be done with a regular expression. | function DataUri(string) {
var parts = DataUri.pattern.exec(string);
if (!parts)
throw new SyntaxError('Invalid data URL: ' + string);
return parts;
} | [
"function buildUriSpec(data) {\n var uriSpec = '';\n\n data.uriSpec.parts.forEach(function(part) {\n if (part.variable) {\n if (data[part.value] == undefined && DEFAULTS[part.value]) {\n part.value = DEFAULTS[part.value];\n } else {\n part.value = data[part.value];\n }\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Combined touch and mouse input Touch has a higher priority then mouse, and while touching no mouse events are allowed. This because touch devices also emit mouse events while doing a touch. | function TouchMouseInput() {
Input.apply(this, arguments);
var handler = bindFn(this.handler, this);
this.touch = new TouchInput(this.manager, handler);
this.mouse = new MouseInput(this.manager, handler);
} | [
"function isReallyTouch(e){//if is not IE || IE is detecting `touch` or `pen`\nreturn typeof e.pointerType==='undefined'||e.pointerType!='mouse';}",
"get isTouch()\n {\n return \"ontouchstart\" in window;\n }",
"function setMouseHijack(value){if(va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will add the controls listeners to the window and trigger the light properties accordingly. | function handleLightControl(windowObj, light, userData, levels) {
// Adding listeners to the window object for keydown and keyup events
windowObj.addEventListener( 'keydown', function callKeydownHandler(e) {
keyHandler( e, light, userData, levels, true );
} );
windowObj.addEventListener( 'keyup', functio... | [
"function setupImageControls() {\n Data.Controls.Brightness = document.getElementById('brightness');\n Data.Controls.Contrast = document.getElementById('contrast');\n Data.Controls.Hue = document.getElementById('hue');\n Data.Controls.Saturation = document.getElementById('saturation');\n\n Data.Controls.Bright... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connection Class (this can probably be removed it is kept in for the google maps script only) | function Connection (){
/**
* Loads a google maps API v3 script
* @param {Function} callback function to call when script has been loaded and added to DOM
*/
this.loadGoogleMaps = function(callback){};
} | [
"function PuplishMap(){}",
"function init() {\n map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);\n getMyLocation();\n}",
"function initializeOriginAndDestination() {\n origin = new google.maps.Marker({\n position: { lat: 0, lng: 0 },\n map,\n });\n\n destin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this is class for sunshine values, it is extended from countryvalues this i sused to store sunshine data for country | function SunshineValues()
{
CountryValues.call(this);
} | [
"function calcSun() {\n\tvar latitude = getLatitude();\n\tvar longitude = getLongitude();\n\tvar indexRS = solarDateTimeLatLong.mos;\n if (isValidInput(indexRS)) {\n if((latitude >= -90) && (latitude < -89)) {\n alert(\"All latitudes between 89 and 90 S\\n will be set to -89\");\n so... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Browser Plugin This plugin provides a html representation, so that a WebDAV server may be accessed using a browser. The class intercepts GET requests to collection resources and generates a simple html index. | function jsDAV_Browser_Plugin(handler) {
this.handler = handler;
this.enablePost = false; //not implemented ATM
this.initialize();
} | [
"function jsDAV_ServerPlugin() {}",
"function adminCrawler(req, res){\n\t\tsendCrawlerLayout(req, res, []);\n\t}",
"function jsDAV_Directory() {}",
"Index() {\n return this.http.request('GET', '/snapshots');\n }",
"async web (relativePath, systemPath, stripSlashes) {\n const indexNames = []\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the dequeue method is called, push all the elements from stack 1 into stack 2, which reverses the order of the elements. Now pop from stack 2. | dequeue() {
if(this.stack2.length === 0 ){
if(this.stack1.length===0){return'cannot dequeue stack is empty'}
while(this.stack1.length>0){
let p = this.stack1.pop();
this.stack2.push(p);
}
}
return this.stack2.pop();
} | [
"flipStackTwo(){\n\t\twhile(this.stackTwo.length >0){\n\t\t\tthis.stackOne.push(this.stackTwo.pop());\n\t\t}\n\t}",
"function Queue(){\n //Stack1 for pushing Queue Items\n let stack1 = new Stack();\n //Stack2 for popping Queue Items\n let stack2 = new Stack();\n\n this.push = function(element){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this controller simply tells the dialogs service to open a memberPicker window with a specified callback, this callback will receive an object with a selection on it | function memberPickerController($scope, dialogService, entityResource, $log, iconHelper, angularHelper){
function trim(str, chr) {
var rgxtrim = (!chr) ? new RegExp('^\\s+|\\s+$', 'g') : new RegExp('^' + chr + '+|' + chr + '+$', 'g');
return str.replace(rgxtrim, '');
}
$scope.renderModel =... | [
"initDialog() {\n this.view = new InviteDialogView(this);\n }",
"function goToTeamSelection(){\n clientValuesFactory.setActiveWindow(windowViews.selectTeam);\n }",
"function initMemberDropdown() {\n var contributorsUrl = \"https://api.github.com/repos/\" + repoName + \"/stats/contr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
search for multiple parameters at once pass in params as object with values i: ingr (should be array) c: type a: alcoholic (pass in as boolean) | function multiSearch ( params ) {
logger.silly('Multi search on params', params);
var url = 'http://www.thecocktaildb.com/api/json/v1/1/filter.php?';
if (params.hasOwnProperty('i')) {
for (var param in params['i']) {
url = url + 'i=' + param + '&';
}
}
if (params.hasOwnPr... | [
"function w3_ext_param_array_match_str(arr, s, func)\n{\n var found = false;\n arr.forEach(function(a_el, i) {\n var el = a_el.toString().toLowerCase();\n //console.log('w3_ext_param_array_match_str CONSIDER '+ i +' '+ el +' '+ s);\n if (!found && el.startsWith(s)) {\n //console.log('w3_e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compares drone pick up time to package deadlines and assigns drones to packages | function assignDrones(sortedDrones, sortedShipments){
var assignments = [],
unassignedPackageIds = [],
// checking to see that drone can deliver package before deadline
for (let i = 0; i < drones.length; i++){
if (currentTime + timeToDepo(sortedDrones[i]) + timeOfTravel(depo, sortedShipments[0].dest... | [
"function updateWaitingTimeOfWaitingCallers() {\n var wc;\n for (wc in waitingCallers) {\n waitingCallers[wc].updateWaiting();\n }\n }",
"function timer() {\n nodes.forEach(function (o, i) {\n o.timeleft -= 1;\n if (o.timeleft == 0 && o.istage < o.stages.length - 1) {\n // Decre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add a back to corpus button as well as our fancy new back selector and, if func is not null, add an aggregate button that links to appropriate aggregate | function addCorpusLink(source, func, params)
{
var pressTimer;
var agg_timer;
var should_go_back = true; //need to not trigger regular click if we mean to long click
d3.select("#header").append("button").attr("class", "corpus-link").text("Back to Corpus!").on("click", function()
{
goTo(sour... | [
"function removeCorpusButton()\n{\n d3.select(\".corpus-link\").remove();\n d3.select(\".back-button\").remove();\n d3.select(\".aggregate-button\").remove();\n}",
"function textBackwardButton() {\n\treturn (\n\t\t`<button class='mainPageButton' onclick='mainPage(); img='images/back.png'></button>`\n\t);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the correct api json based on whether we're in create mode or not | getAPIJSON(){
return this.props.new ?
{
Name: this.state.name,
//TODO: add functionality
InstructorID: this.state.instructors,
PollID: this.state.polls,
UserID: this.state.users,
} :
{
//edit the data to include the values inputted
Action: "A... | [
"function createApi(opts){\n var deferred = Q.defer(),\n params = {\n name : opts.name,\n description : opts.description\n };\n\n apigateway.createRestApi(params, function(err, data) {\n if (err) deferred.reject(err);\n else deferred.resolve(data);\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
methods: insertFirst(value), insertLast(value), insert(node1, node2), find(value) | insertFirst(value) {
this.head = new Node(value, this.head);
} | [
"insert(value) {\n const search = (newNode) => {\n const newBinaryTree = new BinarySearchTree(value);\n if (value >= newNode.value) {\n if (!newNode.right) newNode.right = newBinaryTree;\n else search(newNode.right);\n } else {\n if (!newNode.left) {\n newNode.left = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set height for splash screen | function SetSplashScreenHeight() {
var height = dojo.coords('divSplashScreenContent').h - 80;
dojo.byId('divSplashContent').style.height = (height + 14) + "px";
CreateScrollbar(dojo.byId("divSplashContainer"), dojo.byId("divSplashContent"));
} | [
"function fullscreenImgHeight() {\n $('#home, .background-video').css({height:window_height});\n }",
"set requestedHeight(value) {}",
"function setLandingSize() {\r\n\tappContainer_Ls.css({\r\n\t\t'width' : appContainerWidth_Ls,\r\n\t\t'height' : appContainerHeight_Ls,\r\n\t\t'margin-top': appContainer_marg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Se establece el tipo de usuario en caso de ser null | usuarioRecibido() {
var usuarioR = this.usuario;
if (!this.usuario) {
//si el usuario es null o undefined
usuarioR = { nombre: "Visitante", rol: "Estudiante" };
}
return usuarioR;
} | [
"function typeUser() {\n var queryParameters = {\n orderBy: \"Name\",\n equalTo: domain[1]\n },\n result = database.getData(\"dominios\", queryParameters);\n\n if (Object.getOwnPropertyNames(result).length == 0) {\n var queryParameters = {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a chat message of the specified type | createChatMessage(type, message) {
// Patch the chat appearance to conform with specific modules
let csspatches = '';
if (game.modules.get('pathfinder-ui') !== undefined && game.modules.get('pathfinder-ui').active) {
csspatches += 'sasmira-uis-fix';
} else if (game.modules.get('dnd-ui') !== undefined &&... | [
"function newMessage(template,message){\n if(template === 'partner'){\n partnerIsTyping();\n setTimeout(appendMessage, 1000)\n }\n else{\n appendMessage();\n }\n // generates message HTML from appropriate template, stored in DOM\n function appendMessage(){\n $('.chat-window-timeline .chat-partner-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Restores any purchases that the current user has made in the past, but we have lost memory of. | function restorePurchases()
{
showLoading();
Storekit.restoreCompletedTransactions();
} | [
"resetUserPayment() {\n Object.keys(this._paidMoney).forEach(key => (this._paidMoney[key] = 0));\n }",
"revertAll() {\n this._pendingBackupRebase = true;\n this._pendingUpdates = this._pendingUpdates.filter((update) => update.kind !== 'optimistic');\n }",
"restore() {\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public: Reload current page with pjax. Returns whatever $.pjax returns. | function pjaxReload(container, options) {
var defaults = {
url: window.location.href,
push: false,
replace: true,
scrollTo: false
}
return pjax($.extend(defaults, optionsFor(container, options)))
} | [
"function newScrape() {\n $.ajax(\"/scrape\", {\n type: \"GET\"\n }).then(function(){\n location.reload();\n });\n}",
"function updateWidget() {\n window.location.reload();\n}",
"function refresh_parent(url) {\n\t// disable all links\n\t$(\"a\").attr('href',\"javascript:\").click(funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
data = result Daten header = header falls eigener use Header = true, wenn eigener header benutzt werden soll Returns JSON Object for Data | function updateJSON(data, header, useHeader) {
let arrayOfDataObjects = [];
let currentDataObject = {};
let headerData = [];
let rowIndex = 0;
let colIndex = 0;
if (useHeader) {
headerData = header;
}
else {
headerData = data[0];
rowIndex = 1;
}
for(rowIndex; rowIndex < data.length; rowIndex++) {
c... | [
"addMeta(data) {\n if (this.json.results) {\n Object.assign(this.json, data);\n }\n }",
"function parseHeader(dataString) {\n\n // make sure all lines in the header are comma separated\n const commaLines = dataString.split('\\n').reduce((a, b) => {\n const r = b.trim();\n if (r.length !== 0) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render the overall score | function renderScore(){
if(score!=undefined && questions[0]){
return(
<div>
<h5>Score: {score}/{questions.length}</h5>
{console.log("Score: ",score)}
{console.log("Questions length: ",questions.length)}
</di... | [
"function renderUserScore() {\n console.log(`Current user score - ${quizApp.correctAnswers}, ${quizApp.incorrectAnswers}`);\n $('.correct').text(quizApp.correctAnswers);\n $('.incorrect').text(quizApp.incorrectAnswers);\n}",
"function displayScore() {\n // rectangle outline for score\n rectMode(CORNER);\n n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API bool CheckboxFlags(const char label, unsigned int flags, unsigned int flags_value); | function CheckboxFlags(label, flags, flags_value) {
if (Array.isArray(flags)) {
return bind.CheckboxFlags(label, flags, flags_value);
}
else {
const ref_flags = [flags()];
const ret = bind.CheckboxFlags(label, ref_flags, flags_value);
flags(... | [
"function checkCheckBox(cb){\r\n\treturn cb.checked;\r\n}",
"function markCheckboxes() {\n let check = (id) => {\n if (settings[id] == 'true') {\n $('#' + id).prop('checked', true);\n }\n }\n check('hide-hr-value');\n check('hide-upgrade-log');\n check('value-with-quantity');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Request a zoom at `scale` across `duration` using `method`. No need to think about different game zoom levels; that's taken care of within this. | request(scale, duration, method, period) {
let current = this.stage.scale.x;
let target = scale * this.defaultZoom;
this.active = {
startScale: current,
targetScale: target,
elapsed: 0,
duration: duration,
... | [
"function zoom(newscale, center) { // zoom around center\n\t\tif (newscale.toFixed > 2 && newscale.toFixed(2) < 0.25){\n\t\t\treturn;\n\t\t}\n\t\tvar caX = window['variable' + dynamicVar[pageCanvas]].getWidth()/2;\n\t\tvar caY = window['variable' + dynamicVar[pageCanvas]].getHeight()/2;\n\t\tzoomOrigin = window['va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
terraform.getPkgReleases This function will fetch a package from the specified Terraform registry and return all semver versions. `sourceUrl` is supported of "source" field is set `homepage` is set to the Terraform registry's page if it's on the official main registry | async function getPkgReleases({ lookupName, registryUrls }) {
const { registry, repository } = getRegistryRepository(
lookupName,
registryUrls
);
logger.debug({ registry, repository }, 'terraform.getDependencies()');
const cacheNamespace = 'terraform';
const pkgUrl = `${registry}/v1/modules/${reposito... | [
"async function getPkgReleases({ lookupName }) {\n logger.debug({ lookupName }, 'orb.getPkgReleases()');\n const cacheNamespace = 'orb';\n const cacheKey = lookupName;\n const cachedResult = await renovateCache.get(cacheNamespace, cacheKey);\n // istanbul ignore if\n if (cachedResult) {\n return cachedResu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a label that is closest to the given 'seconds' | function findCurrentLabel(seconds, tolerance){
var $current = $();
$(".toc > li").each(function(i, element){
if ($(element).data("start_at") <= seconds + tolerance)
$current = $(element);
else
return false;
});
return $current;
} | [
"getNearestTime (step, time) {\n\t\tlet prev = this.getPreviousTime(step, time);\n\t\tlet next = this.getNextTime(step, time);\n\t\tif (time - prev <= next - time)\n\t\t\treturn prev;\n\t\treturn next;\n\t}",
"function calculate(seconds, max){\n let left;\n /*if(seconds < max){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
How to add a result | function addResult( $result ) {
if ( Util.elementCount( $result ) === 0 ) { return };
$results = $results.add( $result );
} | [
"addResult(result){\n this.results.push(result.state);\n }",
"updateResult() {\r\n }",
"function addResults (transport, next) {\n queryTransport(transport, function (err, result) {\n //\n // queryTransport could potentially invoke the callback\n // multiple times sin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Chapter 101 RopeGroup Player comments on plug size | function C101_KinbakuClub_RopeGroup_PlugSize() {
C101_KinbakuClub_RopeGroup_PlugCommentAvailable = false;
} | [
"P2PChunk(size){\n this.numP2P += 1\n this.sizeP2P += size\n }",
"function C101_KinbakuClub_RopeGroup_PluggedHappily() {\n\tC101_KinbakuClub_RopeGroup_PlugMood = \"Happily\";\n\tC101_KinbakuClub_RopeGroup_PlayerPlugged();\n}",
"function poids()\n{\n message.channel.send({ embed: {\n color:0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParsermaxsize_clause. | visitMaxsize_clause(ctx) {
return this.visitChildren(ctx);
} | [
"function parseLimitClause() {\r\n\t\t\t\t\t\tif (config.limit.constructor == Array) {\r\n\t\t\t\t\t\t\tconfig.begin = config.limit[0];\r\n\t\t\t\t\t\t\tconfig.limit = config.limit[1];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//end function parseLimitClause;",
"visitMaximize_standby_db_clause(ctx) {\n\t return this.visitC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
prikazuje film na stranici sa ostalim filmovima id je redni broj diva na stranici(14) | showFilmm(id) {
var i = 0;
document.getElementById("img" + id).src = "images/films/" + this.img;
document.getElementById("name" + id).innerHTML = this.name;
document.getElementById("director" + id).innerHTML = this.director;
document.getElementById("runningTime" + id).innerHTML ... | [
"function castFilmSerie(idFilmSerie, tipo){\n var attori = []; //array dove verranno inseriti gli attori\n var isFilm = true; \n if (tipo === isFilm){ //se isFilm è true\n tipo = 'movie'; //valorizzo con movie\n }else{\n tipo = 'tv'; // valorizzo con tv\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to hide everything but the shown album. | function hideAndShowAlbums() {
//console.log('hideAndShowAlbums: ' + albumSelected);
for (var i = 0; i < albumSelectors.length; i++) {
var selector = albumSelectors[i];
if (i === albumSelected) {
$(selector).show();
} else {
$(... | [
"function unhide()\r\n{\r\n if (document.querySelector('.pumpkin').style.visibility == \"visible\")\r\n {\r\n document.querySelector('.pumpkin').style.visibility = \"hidden\";\r\n }\r\n else\r\n {\r\ndocument.querySelector('.pumpkin').style.visibility = \"visible\";\r\n }\r\n}",
"function hideSearchFilm(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the first contiguous substring in `string`, starting at `start`, which precedes symbols found in `ranges`. | function scanRange(string, start = 0, ranges = SPACE) {
if ((typeof ranges) === "string") {
ranges = getRanges(ranges);
}
var subString = "";
var char;
var code;
_scanString: for (var loc = start; loc < string.length; loc++) {
char = string[loc];
code = char.charCodeAt(0);
_scanRange: for (const... | [
"function getChunkRange( str, start, end )\n{\n\tvar s = str.indexOf(start);\n\tif(s != -1) {\n\t\ts += start.length;\n\t\tvar e = str.indexOf(end,s);\n\t\tif(e != -1)\n\t\t\treturn [s,e];\n\t}\n}",
"function stringSlice(str,start,end){\n if(end === undefined || end > str.length){end = str.length}\n var new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
multiuse authorization promise authorize the client token and resolve for use in googleapis.auth | authorize() {
this.auth = this.auth || new Promise((resolve, reject) => {
this._client.authorize((err, tokens) => err ?
reject(err) :
resolve(this._client));
});
return this.auth;
} | [
"generateAuthTokens(clientName) {\n var self = this;\n self.getClientConfig(clientName).then(function (clientConfig) {\n const courseraCodeURI = util.format(\n COURSERA_CODE_URI,\n clientConfig.scope,\n COURSERA_CALLBACK_URI + clientConfig.client... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modify the function liftm so that the functions it produces can accept arguments that are either numbers or m objects: | function liftm(biFunction, str){
return function(first, second){
if (typeof first === 'number'){
first= m(first);
}
if (typeof second === 'number'){
second = m(second);
}
return m(biFunction(first.value, second.value), "(" + first.source + str + second.source + ")");
};
} | [
"function someGenerics1(n, m) {}",
"function liftf(binaryFunction){\n\treturn function (x){\n\t\treturn function(y){\n\t\t\treturn binaryFunction(x, y)\n\t\t};\n\t}\n}",
"function miFuncion(){}",
"visitNumeric_function_wrapper(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function complexGenericBehavi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uses the "jumbleMap" method (below) to jumble the answer | function jumbleWord(wordArr, mapArray) {
var textArr = [];
for (var i in wordArr) {
textArr[i] = wordArr[mapArray[i]];
}
return textArr;
} | [
"function PuplishMap(){}",
"function increaseLeastMap() {\n\tfeedArray.map(function(allElement){\n\t\tif(mini==allElement.upvotes)\n\t\t\tallElement.upvotes++;\n\t})\n\n\tconsole.log(feedArray);\n}",
"function rebuildIndexMapBruteForce() {\n var i;\n indexMap = {};\n\n for (i = 0; i < array... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find which plan each door is on, and store the mapping in doorIdToPlan | function findDoors()
{
for (i = 1; i <= config.DoorCount; i++)
{
for (j = 0; j < config.Plans.length; j++)
{
var a = document.getElementById(config.Plans[j].Name);
if (a == null)
continue;
var svgDoc = a.contentDocument;
var element = svgDoc.getElementById("DOOR_" + i + "_OPE... | [
"_findNextRunnerInPlan(id) {\n const {plan} = this._plan;\n const findRunners = plan.filter((_pi) => _pi.size === '2.5x7');\n const findCurrentRunnerIndex = findRunners.findIndex((_pi) => _pi.id === id);\n if (findCurrentRunnerIndex > -1) {\n const findNextRunner = findRunners... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
void PutPublisherProperty (string, Variant) | PutPublisherProperty(string, Variant) {
} | [
"PutSubscriberProperty(string, Variant) {\n\n }",
"onPropertySet(room, property, value, identifier) {\n room[prop] = value;\n }",
"addProperty(property, value) {\n this.properties.set(property, value);\n }",
"function setProperty(propertyName, propertyValue)\r\n{\r\n loadSettingsDb();\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a node to the cfg of this.current_function_stack if it is new. If the previous node is not a branching node, add the previous visited node as its parent, and add this node as the parent's left child. Argument: node a node generated by the parser. | addToCFG(node){
var node_str = this.nodeStr(node);
console.log("addToCFG ", node_str);
if (!(node_str in this.cfg_nodes[this.current_class][this.current_function])){ // add new node
console.log("adding new node to cfg");
var cfg_node = new CFGNo... | [
"function add(node, parent) {\n var children = parent ? parent.children : tokens;\n var prev = children[children.length - 1];\n\n if (\n prev &&\n node.type === prev.type &&\n node.type in MERGEABLE_NODES &&\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the code that correlates to the number from the KeyCode table | function getCode(myCode) {
switch(myCode){
case 65:
myCode = "KeyA";
break;
case 66:
myCode = "KeyB";
break;
case 67:
myCode = "KeyC";
break;
case 68:
myCode = "KeyD";
break;
case ... | [
"function getCodeFromKey(key) {\r\n //Constants for key\r\n if (key == STUDENT_INBOX_KEY) return 1;\r\n if (key == ADMIN_INBOX_KEY) return 2;\r\n if (key == STUDENT_SENT_ITEMS_KEY) return 3;\r\n if (key == ADMIN_SENT_ITEMS_KEY) return 4;\r\n}",
"function determineKeyPress(keycode) {\n switch (keyc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exit a parse tree produced by KotlinParsercomparison. | exitComparison(ctx) {
} | [
"visitExit_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"exitOrdinaryCompilation(ctx) {\n\t}",
"exitIsOperator(ctx) {\n\t}",
"exitJumpExpression(ctx) {\n\t}",
"exitStatementWithoutTrailingSubstatement(ctx) {\n\t}",
"exitBlockLevelExpression(ctx) {\n\t}",
"exitPreprocessorParenthesis(ctx)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests for `thisArg` argument. | function assertThisArg(thisArg, thisValue) {
// In sloppy mode, `this` could be global object or a wrapper of `thisArg`.
assertDeepEq(arr.map(function(v) {
assertDeepEq(this, thisValue);
return v;
}, thisArg), arr);
// In strict mode, `this` strictly equals `this... | [
"function assertThisArg(thisArg, thisValue) {\n // In sloppy mode, `this` could be global object or a wrapper of `thisArg`.\n assertDeepEq(arr.filter(function(v) {\n assertDeepEq(this, thisValue);\n return v;\n }, thisArg), arr);\n\n // In strict mode, `this` strict... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserdir_object_name. | visitDir_object_name(ctx) {
return this.visitChildren(ctx);
} | [
"visitDirectory_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitDirectory_path(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function dir_node(name, dirs, files, parent) {\n this.name = name;\n this.dirs = dirs;\n this.files = files;\n this.parent = parent;\n this.expanded = f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a schedule of meetings, find the oen slots. | function getOpenSlots(schedule) {
var res = [];
var head = schedule[0] && schedule[0][0];
var tail = schedule[schedule.length - 1] &&schedule[schedule.length - 1][1];
if (schedule.length <= 1) {
return schedule;
}
// first slot
if (head !== '09:00') {
res.push(['09:00',... | [
"function getOverlaps(schedules) {\n var res = [];\n \n return schedules.reduce((openSlots, schedule) => {\n var open = getOpenSlots(schedule);\n \n return intersectSchedules(openSlots, open);\n }, [['09:00', '20:00']]);\n \n }",
"function getAvailableLaneAppointmentTimeSlots(laneId,app... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper to get the list of joined protoo peers. | _getJoinedPeers({ excludePeer = undefined } = {})
{
return this._protooRoom.peers
.filter((peer) => peer.data.joined && peer !== excludePeer);
} | [
"sendToAllConnectedPeers(data) {\n for (let peer_id in this.peers) {\n if (this.peers[peer_id] && this.peers[peer_id].isConnected) {\n // Call it in an async way so any failure does not effect sending to other peers\n setTimeout(() => {\n let peer = this.peers[peer_id];\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine the correct component for the form type | _determineParamSettingComponent(form) {
switch (form) {
case 'label':
return FieldLabelSettingComponent;
break;
case 'display':
case 'api':
case 'column':
case 'sort_top':
case 'sort':
case 'helpT... | [
"determineFormType() {\n\n\n if (this.getName().includes(\"Package\")) {\n return formSetType.PACKAGE;\n }\n\n let anchorURLTargets = [\"DR\", \"RD\", \"PBN\", \"Silver\", \"Gold\"];\n for (let i = 0; i < anchorURLTargets.length; ++i) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processes a LESS file by converting it to a CSS file. | function process_less_file(less_file_name) {
log('Processing ' + less_file_name);
q.fcall(read_less_from_file, less_file_name)
.then(compile_less_to_css)
.then(prefix_css)
.then(function(prefixed_css_data) {
write_css_to_file(less_file_name, prefixed_css_data);
}).catch(function(error) {
console.lo... | [
"function compile_less_to_css(less_data) {\n log('Compiling LESS to CSS');\n\n var defer = q.defer();\n\n less.render(less_data, {\n paths: [INPUT_DIRECTORY],\n compress: true\n }, function(error, css_tree) {\n if (error) {\n defer.reject(error);\n } else {\n try {\n var css_d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modul: Zahl eingeben | Test: ausgabe(getZahl("1")); | function getZahl(numStr){
const displayStr = "Bitte Zahl " + numStr + " eingeben:"
let ziffer = prompt(displayStr);
let zahl = parseInt(ziffer);
while (isNaN(zahl) && (ziffer !== null)) {
ziffer = prompt(displayStr);
zahl = parseInt(ziffer);
}
return zahl;
} | [
"function beschiessen(zelle) {\n // Darauf haben wir schon geschossen\n if (zelle.className != nichtGeprüft)\n return;\n\n var drumherum = 0;\n\n // Treffer in der Umgebung zählen\n for (var z = Math.max(0, zelle.zeilennummer - 1), zm = Math.min(10, zelle.zeilennummer + 2) ; z < zm; z++)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hello takes args that are defined at compile time. It can also read from all members, which could be defined at runtime. | hello(args) {
console.log('hello from TestScript');
console.log('my secret is ' + this.secret);
console.log('my constructor secret is ' + this.cs);
console.log('my first arg is ' + args.n1);
console.log('my second arg is ' + args.s1);
} | [
"greeting(parents, args) {\n const { name, age = 10 } = args;\n return `Hello ${name} who is ${age} years old. Welcome!!`;\n }",
"function hello(name){\n console.log(\"hello its my name\",name);\n}",
"function greet(name) {\n return \"Hello \" + name + \"!\";\n}",
"function createHello(hello)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removes all given triples and the references pointing at them | deleteAllTriplesWithRefs(triples) {
triples.forEach(t => {
this.removeTriple(t.subject, t.predicate, t.object);
var allRefsToSubject = this.find(null, null, t.subject);
allRefsToSubject.forEach(r => this.removeTriple(r.subject, r.predicate, r.object));
});
} | [
"_removeCorrespondingXrefs (tx, node) {\n let manager\n if (INTERNAL_BIBR_TYPES.indexOf(node.type) > -1) {\n manager = this._articleSession.getReferenceManager()\n } else if (node.type === 'footnote') {\n manager = this._articleSession.getFootnoteManager()\n } else {\n return\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Receives: integer representing user points Returns: array with all the kudos received | function getKudosList(points) {
const kudos = [];
const listToPoints = (Object.values(KUDOS_TO_POINTS));
for (let i = listToPoints.length - 1; i >= 0; i--) {
for (let j = 0; j < getKudoAmmount(points, i); j++) {
kudos.push(listToPoints[i].name);
}
points %= listToPoints[i].value;
}
return ku... | [
"function getKudosValue(points) {\n let totalValue = 0;\n const listToReal = (Object.values(KUDOS_TO_REAL));\n const listToPoints = (Object.values(KUDOS_TO_POINTS));\n\n for (let i = listToReal.length - 1; i >= 0; i--) {\n totalValue += getKudoAmmount(points, i) * listToReal[i].value;\n points %= listToPo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Triggered when the converter resolves a reflection. | onResolve(context, reflection) {
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
this.postpone(reflection);
walk(reflection.implementedTypes, (target) => {
this.postpone(target);
if (!target.implementedBy) {
target.imp... | [
"onResolve(_context, reflection) {\n if (reflection instanceof models_1.ContainerReflection) {\n this.categorize(reflection);\n }\n }",
"set ReflectionProbeStatic(value) {}",
"get ReflectionProbeStatic() {}",
"initConverter() {\n this.converter = markdownConversionSvc.createConv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pulls objective ID from LMS | get id() {
this._id = getValue(`cmi.objectives.${this.index}.id`);
return this._id;
} | [
"morawareJobID() {\n let reg = /(?<=mw-job-id: )\\d*/\n let jobID = this.msg.match(reg)[0]\n return jobID\n }",
"function LMSGetStudentID()\n{\n\treturn(LMSGetValue(\"cmi.core.student_id\"))\n}",
"function SeqObjectiveTracking(iObj,iLearnerID,iScopeID) \r\n{\r\n\tif (iObj != null)\r\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies mixins specified as a __mixin__ property on the given properties object, returning an object containing the mixed in properties. | function applyMixins(properties) {
var mixins = properties.__mixin__
if (!is.Array(mixins)) {
mixins = [mixins]
}
var mixedProperties = {}
for (var i = 0, l = mixins.length; i < l; i++) {
mixin(mixedProperties, mixins[i])
}
delete properties.__mixin__
return object.extend(mixedProperties, proper... | [
"function $merge(){\n\tvar mix = {};\n\tfor (var i = 0; i < arguments.length; i++){\n\t\tfor (var property in arguments[i]){\n\t\t\tvar ap = arguments[i][property];\n\t\t\tvar mp = mix[property];\n\t\t\tif (mp && $type(ap) == 'object' && $type(mp) == 'object') mix[property] = $merge(mp, ap);\n\t\t\telse mix[propert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the user submits their request to delete data, the DataTable's state is stored, selections are read and parsed, and the request is formed and sent. | function deleteData() {
var table = $('#delete_table').DataTable();
var selectedCells = table.rows('.selected').data();
var deletionIDs = [];
for (var i = 0; i < selectedCells.length; i++)
deletionIDs.push(selectedCells[i][1]);
if (confirm("Are you sure you'd like to delete " + deletio... | [
"function deleteTableRow(id, tableID) {\r\n\t//Create a new HTTP request\r\n\tvar req = new XMLHttpRequest(); \r\n\t\r\n\t//Contruct a URL that sends a GET request to /delete with the id and tableID value\r\n\tvar url = \"http://flip2.engr.oregonstate.edu:\" + port + \"/delete-\" + tableID + \"?id=\" + id; \r\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clear registers read highlighting | function clearReadHighlighting() {
$(".show-read").removeClass("show-read");
assembly.highlight_read_reg = ""
} | [
"function clearWriteHighlighting() {\n $(\".show-write\").removeClass(\"show-write\");\n assembly.highlight_write_reg = \"\";\n}",
"clearHighlight () {\n this._vizceral.setHighlightedNode(undefined);\n }",
"function unselectFeature() {\n if (highlight) {\n highlight.remove();\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================= Funcion que permite descargar grabadora.apk ============================================== | function descargarGrabadoraApk(){
$('.fb').show();
$('.fbback').show();
$('body').css('overflow','hidden');
location.href="http://www.montajesyprocesos.com/inspeccion/servidor/aplicacion/grabadora.apk";
cerrarVentanaCarga();
} | [
"function descargarInspeccionMpApk(){\n $('.fb').show();\n $('.fbback').show();\n $('body').css('overflow','hidden');\n location.href=\"http://www.montajesyprocesos.com/inspeccion/servidor/aplicacion/Inspeccion_MP-debug.apk\";\n cerrarVentanaCarga();\n}",
"function click_btn_descargar_grabadora(){\n\t$(\"#bt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update the remove component of the admin page | function update_admin_remove_component(divid){
setTimeout(function(){
var cc_url = '/admin/component/remove';
var ccAjax = new Ajax.Updater(divid, cc_url, {evalScripts:true});}, 1000);
} | [
"remove() {\n // remove this element from appering \n document.getElementById(this.mainEl.id).remove();\n // send a request to remove this node \n axios.delete('post', {\n id: this.post.id\n })\n }",
"function onRemoveUrl(ev, data) {\n var urlFields = this.select('urlListSelector').find('[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decrease absence duration by switch the current absenceTask with a other absenceTask wich have a duration 1 time smaller. If the duration must reach 0, remove this assignation, set the resource 'moral' to 40 and recalculate the teamMotivation's value. If duration is smaller than 0, deactivate the task. | function checkAbsencesEnd() {
var i, j, k, l, assignment, duration,
listAbsences = Variable.findByName(gm, 'absences'), absenceInstance,
listResources = Variable.findByName(gm, 'resources'), resourceInstance,
assignmentToRemove = new Array(), assignmentToAdd = new Array();
fo... | [
"function decreaseDuration() {\n let durationDisplay = $(\"selectedDuration\");\n let duration = parseInt(durationDisplay.textContent);\n if (duration > 1) {\n durationDisplay.textContent = (duration - 1) + \" hour(s) long\";\n }\n }",
"subtractTime() {\n this.endT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `VirtualGatewayListenerTlsValidationContextTrustProperty` | function CfnVirtualGateway_VirtualGatewayListenerTlsValidationContextTrustPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.Validatio... | [
"function CfnVirtualNode_ListenerTlsValidationContextTrustPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: initOpenLayersMap initializes the map object | function initOpenLayersMap() {
map = new OpenLayers.Map('map', mapInitParams);
} | [
"function initMap() {\n $('#widgetRealTimeMapliveMap .loadingPiwik, .RealTimeMap .loadingPiwik').hide();\n map.addLayer(currentMap.length == 3 ? 'context' : 'countries', {\n styles: {\n fill: colorTheme[currentTheme].fill,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3. Write a function `pow` that takes two parameters: A. a base number (Number) B. an exponent (Number) The function should return the first parameter to the power of the second parameter Ex: pow(3, 2) // should return 9 pow(2, 5) // should return 32 pow(3, 40) // should return 12157665459056929000 Note: you must use `m... | function pow (baseNum, power){
var answer = 1;
for(var i = 0; i < (power) ; i++){
answer *= multiply(baseNum, 1);
console.log(answer);
}
console.log(answer);
return answer;
} | [
"function myPow(base, exp) {\n var num = 1;\n for (var i = 0; i < exp; i++) {\n num *= base;\n }\n return num;\n}",
"function findPower(base,exponent){\n let result = 1;\n\n function findHelper(i){\n if(i > exponent){\n return;\n }\n result *= base;\n findHelper(i + 1);\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ensures the middleware is an array. | prepareMiddlewareArray (middlewareList) {
if (!middlewareList) { return []; }
return (Array.isArray(middlewareList) ? middlewareList : [middlewareList]);
} | [
"function is_array(obj){\n return Array.isArray(obj);\n}",
"function ISARRAY(value) {\n return Object.prototype.toString.call(value) === '[object Array]';\n}",
"static isArray(input) {\n return input instanceof Array;\n }",
"function IsArrayLike(x) {\r\n return x && typeof x.length ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds notifications older than 2 days every hour and removes them from db | function removeOldNotifications() {
// Only set up Cron Job when not in Test mode.
if (!Meteor.isTest && !Meteor.isAppTest) {
const frequency = 'every hour';
SyncedCron.add({
name: 'Checks for notifications that are older than a week and removes them from db',
schedule(parser) {
return p... | [
"function findExpiredBookings() {\n\n var where = {\n status: 'handout',\n end: { $lt: new Date() },\n };\n\n if(moment().format('09:00') == moment().format('HH:mm')) {\n BookingModel.find({$and:[where,{notificationSent:true}]},function(err,bookings) {\n bookings.forEach(function (booking) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build a pipe on the screen that is either attached to the floor or the ceiling | buildPipePair() {
const topHeight = Phaser.Math.RND.between(
1,
globals.tilesTall - globals.pipeGapSize - 1
);
const bottomHeight = globals.tilesTall - globals.pipeGapSize - topHeight;
this.buildPipe(topHeight, false);
this.buildPipe(bottomHeight, true);
} | [
"drawPipes(ctx) {\n this.eachPipe(function (pipe) {\n let pipeOffsetTop = pipe.topPipe.bottom - pipe.topPipe.top;\n let pipeOffsetBottom = pipe.bottomPipe.bottom - pipe.bottomPipe.top;\n\n let topPipeRender = new Image();\n topPipeRender.src = 'assets/images/top-pi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |