query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Returns manual payment method if supported by the host, null otherwise | getManualPaymentMethod() {
const pm = get(this.props.data, 'Collective.host.settings.paymentMethods.manual');
if (!pm || get(this.state, 'stepDetails.interval')) {
return null;
}
return {
...pm,
instructions: this.props.intl.formatMessage(
{
id: 'host.paymentMethod.m... | [
"RetrieveAvailablePaymentMethod() {\n let url = `/me/payment/availableMethods`;\n return this.client.request('GET', url);\n }",
"function setupPaymentMethods17() {\n const queryParams = new URLSearchParams(window.location.search);\n if (queryParams.has('message')) {\n sho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
search for a food and use a callback to get the result | search(foodSearchString, callback) {
let searchUrl = this.urlRoot + '&sort=n&max=25&offset=0&q=' + foodSearchString;
// hit the API and give it a callback to get the result
request(searchUrl, (error, response, body) => {
if (error) {
callback(error);
... | [
"searchMeal() {\n // Using fuse.js and defining searching key\n const options = {\n includeScore: true,\n keys: ['fields.strMeal']\n }\n const fuse = new Fuse(this.foodsArray, options)\n // Called createCards func for first initializing\n this.createCa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch function Returns a promise Why this won;t work, objects = the objectArrays return fetch(books_url).then(res => res.json()).then(objects => console.log(objects)) | function fetchBooks(){
return fetch(books_url).then(res => res.json())
// Good practice to write out headers even for get fetch, sometimes it can be html coming back.
// function fetchBooks(){
// // Returns a promise
// return fetch(books_url, {
// headers: {
... | [
"function fetchBooks() {\n fetch('https://anapioficeandfire.com/api/books').then(respfrombooks => respfrombooks.json()).then(respfrombooksjson => renderBooks(respfrombooksjson))\n}",
"function getAllBookings() {\n // the URL for the request\n const url = '/bookings';\n // Since this is a GET request, si... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unbinds a listener from a keyset | static unbind(keys, classRef) {
for (const key of keys) {
for (const i in listeners[key]) {
if (listeners[key][i] === classRef) {
delete listeners[key][i]
}
}
}
} | [
"function removeUiStateSetListener(callback, context) {\n\tvar i;\n\tfor (i = uiStateSetListeners.length - 1; i >= 0; i--) {\n\t\tif ((!callback || uiStateSetListeners[i].callback === callback) && (!context || uiStateSetListeners[i].context === context)) {\n\t\t\tuiStateSetListeners.splice(i, 1);\n\t\t}\n\t}\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes in the ID of a cryptocurrency and returns the CryptoExchanger object which handles that currency | static getCryptoExchanger(inCoinID) {
for(var i = 0; i < CryptoExchanger.cryptoExchangerArray.length; i++) {
if(CryptoExchanger.cryptoExchangerArray[i].getCoinID() === inCoinID) {
return CryptoExchanger.cryptoExchangerArray[i];
}
}
return null;
} | [
"static getCryptoExchangerByName(inCoinName) {\n for(var i = 0; i < CryptoExchanger.cryptoExchangerArray.length; i++) {\n if(CryptoExchanger.cryptoExchangerArray[i].getCoinName() === inCoinName) {\n return CryptoExchanger.cryptoExchangerArray[i];\n }\n }\n }",
"convert(money, currency) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SET THE GLOBAL DATE TO THE PREVIOUS YEAR AND REDRAW THE CALENDAR | function setPreviousYear() {
var year = tDoc.calControl.year.value;
if (isFourDigitYear(year) && year > 1000) {
year--;
calDate.setFullYear(year);
tDoc.calControl.year.value = year;
// GENERATE THE CALENDAR SRC
calDocBottom = buildBottomCalFrame();
// DISPLAY THE NEW CALENDAR
... | [
"function setNextYear() {\n\n var year = tDoc.calControl.year.value;\n if (isFourDigitYear(year)) {\n year++;\n calDate.setFullYear(year);\n tDoc.calControl.year.value = year;\n\n\t// GENERATE THE CALENDAR SRC\n\tcalDocBottom = buildBottomCalFrame();\n\n // DISPLAY THE NEW CALENDAR\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter of the href attribute. | set href(aValue) {
this._logger.debug("href[set]");
this._href = aValue;
} | [
"set href(aValue) {\n this._logService.debug(\"gsDiggEvent.href[set]\");\n this._href = aValue;\n }",
"set link(aValue) {\n this._logService.debug(\"gsDiggEvent.link[set]\");\n this._link = aValue;\n\n var uri;\n try {\n uri = this._ioService.newURI(this._link, null, null);\n } catch (e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the cell's neighbors. A cell's upper neighbor has index 0, the right neighbor has index 1 etc in the array cells[i][j].neighbor | function createNeighbors() {
for(var i = 0; i < cells.length; i++) {
for(var j = 0; j < cells[i].length; j++) {
if(j == cells[i].length - 1)
cells[i][j].neighbors.push(-1);
else
cells[i][j].neighbors.push(cells[i][j+1]);
if(i == cells.length - 1)
cells[i][j].neighbors.push(-1);
else
c... | [
"function createNeighborCells(){\n\n var array = new Array();\n var cellPositions = new Array();\n\n // Array the contains fix positions for neighbor cells.\n cellPositions.push(-89.3837279950771);\n cellPositions.push(-142.1328674980365);\n cellPositions.push(-349.87550855851305);\n\n cellPosi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
home/admin/funfuzz/js/jsfunfuzz/messtokens.js Each input to |cat| should be a token or so, OR a bigger logical piece (such as a call to makeExpr). Smaller than a token is ok too ;) When "torture" is true, it may do any of the following: skip a token skip all the tokens to the left skip all the tokens to the right inser... | function cat(toks)
{
if (rnd(1700) === 0)
return totallyRandom(2, ["x"]);
var torture = (rnd(1700) === 57);
if (torture)
dumpln("Torture!!!");
var s = maybeLineBreak();
for (var i = 0; i < toks.length; ++i) {
// Catch bugs in the fuzzer. An easy mistake is
// return /*foo*/ + ...
// ... | [
"function fuzz () {\n let len = 10\n let alpha = 'abcdfghijk'\n for (let v = 0; v < len; v++) {\n for (let w = 0; w < len; w++) {\n for (let x = 0; x < len; x++) {\n for (let y = 0; y < len; y++) {\n for (let z = 0; z < len; z++) {\n let str = [alpha[v], alpha[w], alpha[x], alp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functia de citire din fisierul second.json DETALII COMENZI | function readSecondJson()
{
return JSON.parse(fs.readFileSync("second.json"))["DetaliiComenzi"];
} | [
"function readProiectJson() \n{\n return JSON.parse(fs.readFileSync(\"proiect.json\"))[\"DetaliiContact\"];\n}",
"function writeProiectJson(content)\n{\n fs.writeFileSync(\n \"proiect.json\",\n JSON.stringify({ DetaliiContact: content }),\n \"utf8\",\n err => {\n if (err) {\n console.log(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exclude invalid node from given list | function excludeInvalidNodes(allNodes, invalidNodes) {
var toReturn = null;
if(allNodes != null) {
if(invalidNodes != null && !invalidNodes.isEmpty()) {
var lenght = allNodes.length;
toReturn = new Packages.java.util.ArrayList();
for (var i = 0; i < lenght; i++) {
var currentNode = allNodes[i];
if(... | [
"function filteredElements(nodeList) {\n var filtered = [];\n for (var i = 0; i < nodeList.length; i++) {\n var node = nodeList[i];\n if (node.nodeType !== 3) { // Don't process text nodes\n var $element =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply the function to all arguments by batches | function batchCall(fn, args) {
var BATCH_SIZE = 512;
if (args.length > 0) {
var batch = args.slice(0, BATCH_SIZE);
var rest = args.slice(BATCH_SIZE);
for (var i = 0; i < batch.length; i++) fn(batch[i]);
requestAnimationFrame(batchCall.bind(null, fn, rest));
}
} | [
"function for_each(){\n var param_len = arguments[0].length;\n var proc = arguments[0];\n while(!is_empty_list(arguments[1])){\n var params = [];\n for(var j = 1; j < 1+param_len; j++) {\n params.push(head(arguments[j]));\n arguments[j] = tail(arguments[j]);\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creative feature: Users can create group events that display on multiple users calendars the user is asked what other group members they want in the group event, if they input a user that doesnt exist, they are notifed that the user doesnt exist, but the event is still added for all other valid users and the user thems... | function groupEvent(event) {
event.preventDefault();
const eventtitle = document.getElementById("groupeventtitle").value;
const eventdate = document.getElementById("groupeventdate").value;
const eventtime = document.getElementById("groupeventtime").value;
var eventcategory = document.getElementById("grou... | [
"async afterAddMembers ({ groupId, newUserIds, reactivatedUserIds }) {\n const zapierTriggers = await ZapierTrigger.forTypeAndGroups('new_member', groupId).fetchAll()\n\n const members = await User.query(q => q.whereIn('id', newUserIds.concat(reactivatedUserIds))).fetchAll()\n\n if (zapierTriggers && zapie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the Euclidean distance between the current and the prev. feature vectors | function distanceCurPrev(_feature_vec, _prev_feature_vec) {
var _euclidean_dist = sqrt(
sq(_feature_vec[0] - _prev_feature_vec[0]) +
sq(_feature_vec[1] - _prev_feature_vec[1]) +
sq(_feature_vec[2] - _prev_feature_vec[2]) +
sq(_feature_vec[3] - _prev_feature_vec[3]) +
sq(_feature_vec[4] - _prev_fea... | [
"function calculateDistance(i){\n var distance = new THREE.Vector2();\n var zero = new THREE.Vector2(0,0);\n distance = zero.distanceTo(allVectors[i]);\n return distance;\n}",
"function distance(v1, v2) {\n\t\treturn Math.sqrt(Math.pow(v2.X - v1.X, 2) + Math.pow(v2.Y - v1.Y, 2));\n\t}",
"getDistance... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render is called when a slot is not rendered when the ready event fires | function onRender(event) {
const slot = event.detail.slot;
/* istanbul ignore else */
if (utils.isFunction(slot.display)) {
slot.display();
}
} | [
"onRender() {}",
"_render() {\n if (this._connected && !!this._template) {\n render(this._template(this), this, {eventContext: this});\n }\n }",
"slot$(name,ctx){\n\t\tvar slots_;\n\t\tif (name == '__' && !this.render) {\n\t\t\treturn this;\n\t\t}\t\t\n\t\treturn (slots_ = this.__slots)[name] || (sl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets all the bookmark folders | async function getAllBookmarkFolders() {
const [rootTree] = await browser.bookmarks.getTree();
const livemarksFolders = (await LivemarkStore.getAll()).map(livemark => {
return livemark.id;
});
const folders = [];
const visitChildren = (tree) => {
for (const child of tree) {
if (child.type !== "... | [
"function clearBookmarkFolders() {\n while ($bookmarksList.children.length > 0) {\n $bookmarksList.removeChild($bookmarksList.firstChild);\n }\n }",
"function goToRandomFromAllBookmarks() {\n let bookmarks = [];\n let folderStack = [];\n chrome.bookmarks.getTree(re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get an array of episodes from the most recent season | function getRecentSeason(episodes) {
var recentSeasonId = episodes.pop().season;
return episodes.filter(function (val) {
return val.season === recentSeasonId;
});
} | [
"function getMostViewedEpisodes() {\n let api = \"../api/Episodes\";\n ajaxCall(\"GET\", api, \"\", getSuccessMostViewedEpisodes, errorMostViewedEpisodes);\n}",
"function getSeasonOfEpisodeNumber( epsNumber ){\n\n\tif(epsNumber > 0){\n\t\tfor(var i = 0; i < dkGlobalOverviewTable.arrayOfEpisodesInSeasons.len... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
search for all recordings of tour, render a list of recordings | function searchInTour(production, tour) {
// console.log(tour);
// console.log(production);
FinalResults = Results[tour.replaceAll("'", "'")];
for (recording of FinalResults) {
addRecordingExtras(recording);
}
showTourResults(true, true);
} | [
"function showProductionTours(production) {\n Results = {};\n var tours = new Set();\n // var production;\n for (recording of loadedCSV.data) {\n if (recording.production && production && recording.production.toLowerCase().replaceAll(\"'\", \"'\") == production.toLowerCase()) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display widget for uploading photos to cloudinary | showUploadWidget() {
cloudinary.openUploadWidget({
cloudName: 'dvgovtrrs',
uploadPreset: CLOUDINARY_UPLOAD_PRESET,
sources: [
'local',
'url',
'camera',
'image_search',
'facebook',
'dropbox',
'instagram',
],
googleApiKey: '<image_s... | [
"function displayMediaUpload() {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"content-block-content content-block\"\n\t\t\t\t\tkey=\"two-column-content-upload\"\n\t\t\t\t>\n\t\t\t\t\t<h2>{ __( 'Image Column Area' ) }</h2>\n\t\t\t\t\t{ ! props.attributes.imgID ? (\n\t\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\t\tbut... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears highlights from all the fields of the board | clearHighlights(){
for(let i=0;i<this._fields.length;i++){
for(let j=0;j<this._fields.length;j++){
this._fields[i][j].removeHighlight();
}
}
} | [
"clearHighlight () {\n this._vizceral.setHighlightedNode(undefined);\n }",
"function resetDrawingHighlights() {\n abEamTcController.resetDrawingHighlights();\n}",
"function clearHighlightsOnPage()\n{\n\tunhighlight(document.getElementsByTagName('body')[0]);\n\tcssstr = \"\";\n\tupdateStyleNode(cssstr);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to build query for UPDATE actions in "transactions" table values can be a plain object where each keyvalue pair is the field that needs to be updated in the db row filterConfig is supposed to supply the WHERE clause info for the update query this is not very robust at the moment | function transactionsUpdateBuilder(values, filterConfig = { filter: "" }) {
// values should not be undefined, and it should be an object with at least one entry
if (!values || Object.keys(values).length === 0) {
return;
}
// build up the part of the query that sets each field to be updated, e.g. for values... | [
"function sqlForPartialUpdate(dataToUpdate, jsToSql) {\n // get keys from data to update object\n const keys = Object.keys(dataToUpdate);\n if (keys.length === 0) throw new BadRequestError('No data');\n\n /* get an array of strings where each string is the corresponding db column name for each key\n * set equ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SameHeight : Iguala altura de elementos v:2.1.1 | function sameHeight(){
elements = $('.js-same-height');
if (elements !== null){
Array.prototype.forEach.call(elements, function(el, i){
//Reset de altura
var maxHeight = 0;
//Cual es la altura más alta?
elements = el.querySelectorAll('.js-same');
Array.prototype.forEach.call(el... | [
"function equalHeight() {\n\t\t$('.pitch__content h4').matchHeight();\n\t\t$('.why__content h4').matchHeight();\n\t}",
"function matchHeight()\n {\n obj.width(Math.round( obj.outerWidth( ) * \n obj.parent().height()/obj.outerHeight( ) - \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles rocket bounce sound from shield. | _bounceSound() {
if (this._targetPlanet.name === "blueBig") {
Assets.sounds.bounceL.play();
} else if (this._targetPlanet.name === "redBig") {
Assets.sounds.bounceR.play();
}
} | [
"handleSound() {\n // On the X axis, if the mouse is closer to the center of the shape than it was in the previous frame...\n if (this.distanceFromCenterX > mouseX - this.x) {\n // Change state to say that the breath in sound is not playing and stop the sound\n this.breathInSoundPlaying = false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiates a new BaseTexture. Base class of all the textures in babylon. It groups all the common properties the materials, post process, lights... might need in order to make a correct use of the texture. | function BaseTexture(scene){this._hasAlpha=false;/**
* Defines if the alpha value should be determined via the rgb values.
* If true the luminance of the pixel might be used to find the corresponding alpha value.
*/this.getAlphaFromRGB=false;/**
* Intensity or strengt... | [
"function ProceduralTexture(name,size,fragment,scene,fallbackTexture,generateMipMaps,isCube){if(fallbackTexture===void 0){fallbackTexture=null;}if(generateMipMaps===void 0){generateMipMaps=true;}if(isCube===void 0){isCube=false;}var _this=_super.call(this,null,scene,!generateMipMaps)||this;_this.isCube=isCube;/**\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create each score line and place it in the DOM | displayScores() {
for (let i = 1; i <= this.total; i += 1) {
const data = this.data.get(i);
const div = this.createContent(data.name, data.level, Utils.formatNumber(data.score, ","));
div.className = "highScore";
this.scores.appendChild(div);
}
... | [
"function renderHighScores(){\n\t\n\tvar node = document.getElementById('scores');\n\tnode.innerHTML = '';\n\tnode.innerHTML = '<br/>'\n\tfor(var i = 0; i < highScores.length; i++){\t\n\t\tnode.innerHTML += highScores[i]+'<br/>';\t\n\t}\n}",
"function create_scoreboard( player )\n{\n\tvar section = document.creat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
counts the number of elements b in a given array a | function count(a, b) {
if (b == undefined) {
var count = a.length;
} else {
var count = 0;
for (var i = 0; i < a.length; ++i) {
if (a[i] == b)
count++;
}
}
return count;
} | [
"function numOfAppear(a, array) {\n var i;\n var n = 0;\n for (i = 0; i < array.length; i++) {\n if (array[i] == a) {\n n++;\n }\n }\n return n;\n}",
"function deepCount(a) {\n var len = a.length;\n for(var i = 0; i < a.length; i++){\n if(Array.isArray(a[i])){\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
END OF: GENERAL TEMPALTE METHODS VIDEO TEMPLATES, used by type "video_seq" Using the Vimeo API to check when a video is complete in order to show the next sequence in the videosequence. Could be a new video or more common a set of questions that leads to new videos or exits the sequence. See example in CaseMaria_Video.... | function addNodeVideoSequence(nodeId) {
var res ="",
seq_type,
myObj;
myObj=contentObj[nodeId].sequences[FS.currentSequence];
seq_type=myObj.type;
if (FS.currentSequence == 0) {res ="<div class='row' id='seqWrapper'>"}
switch (seq_type) {
case "video":
res +="... | [
"function nextVideo() {\n\t\tindex == 2 ? index = 0 : index++; //loop counter\n\t\tfunctions[index](); //run\n\t\t//loop first before running because first func is to show vid 1\n\t}",
"function nextVideoByVotes()\n { \n var votes = [];\n Object.keys(videoVotes).forEach(function (key) \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
detectar si el navegador del ciente soporta Gecko / AbstractWindow Constructor / p_xo = Coordenada X en pixels. p_yo = Coordenada Y en pixels. p_to = Timeout en segundos p_hgt = Altura en pixels. p_wth = Ancho X en pixels. | function AbstractWindow(url, p_xo, p_yo, p_wth, p_hgt) {
/* Clase para mostrar la ventana*/
this.classHide = "iwinContainerHide";
/* Clase para ocultar la ventana*/
this.classShow = "iwinContainer";
/* Atributos */
this.xo = p_xo || 0;
this.yo = p_yo || 0;
this.wth = p_wth || 100;
this... | [
"function SlideWindow(name, url, p_wth, p_hgt, p_to) {\r\n\tthis.base = AbstractWindow;\r\n\tthis.base(url, 0, 0, p_wth, 1);\r\n\t/* Atributes */\r\n\tthis.name = name;\r\n\tthis.timeOut = p_to * 1000 || 15000; //TimeOut\r\n\tthis.yoEnd; //Ending move coordinate\r\n\tthis.xoEnd; //Ending move coordinate\r\n\tthis.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for postV3ProjectsIdEnvironments | postV3ProjectsIdEnvironments(incomingOptions, cb) {
const Gitlab = require('./dist');
let defaultClient = Gitlab.ApiClient.instance;
// Configure API key authorization: private_token_header
let private_token_header = defaultClient.authentications['private_token_header'];
private_token_header.apiKey = 'YOUR ... | [
"putV3ProjectsIdEnvironmentsEnvironmentId(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.authentications['private_token_header'];\nprivate_token_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the board (every cell at 0 empty) | initBoard() {
for (let i = 0; i < this.width*this.height; i++) {
this._board.push(0);
}
} | [
"setupBoard() {\n for (let i = 0; i < this.columns; i++) {\n this.board[i] = [];\n\n for (let j = 0; j < this.rows; j++) {\n // Create new cell object for each location on board\n this.board[i][j] = new Cell(i * this.w, j * this.w, this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The props that `useSpring` recognizes. | function useSpring(props, deps) {
const isFn = _react_spring_shared__WEBPACK_IMPORTED_MODULE_1__["is"].fun(props);
const [[values], update, stop] = useSprings(1, isFn ? props : [props], isFn ? deps || [] : deps);
return isFn || arguments.length == 2 ? [values, update, stop] : values;
} | [
"triggerPropUpdate(newProps) {\n this.getAllSprings().forEach((spring) => {\n if (spring && spring.updateSpringsForProps) spring.updateSpringsForProps(newProps);\n });\n }",
"async getConfigProperties() {\n return super.get_auth(`/config`);\n }",
"static get QUERY_PARAMS_PROPS() {\n return Co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TURN GRAY SCALE ON ALL MELEE HEROES | function meleeGrayScaleON(){
var meleeHero = document.getElementsByClassName("melee");
for (var i = 0; i < meleeHero.length; i++) {
meleeHero[i].style.filter = "grayscale(100%)";
}
} | [
"function rangedGrayScaleON(){\n var rangedHero = document.getElementsByClassName(\"ranged\");\n for (var i = 0; i < rangedHero.length; i++) {\n rangedHero[i].style.filter = \"grayscale(100%)\";\n }\n}",
"function meleeGrayScaleOFF(){\n var meleeHero = document.getElementsByClassName(\"melee\");\n for (va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subtest for test_can_display_providers_in_other_languages. This function simply clicks on the div for displaying account providers in other languages, and ensures that those other providers become visible. | function subtest_can_display_providers_in_other_languages(w) {
wait_for_provider_list_loaded(w);
// Check that the "Other languages" div is hidden
wait_for_element_visible(w, "otherLangDesc");
let otherLanguages = w.window.document.querySelectorAll(".otherLanguage");
for (let element of otherLanguages) {
... | [
"function subtest_other_lang_link_hides(w) {\n wait_for_provider_list_loaded(w);\n wait_for_element_invisible(w, \"otherLangDesc\");\n}",
"function subtest_show_tos_privacy_links_for_selected_providers(w) {\n wait_for_provider_list_loaded(w);\n\n // We should be showing the TOS and Privacy links for the selec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
>Check your work! Your banck_account should have $55 in it. 2. You got a bonus! Your pay is now doubled each week. Write code that will save the sum of all the numbers between 1 100 multiplied by 2. >Check your work! Your banck_account should have $10,100 in it. | function bank_account2(){
var total = 0;
for (let i = 0; i <= 100; i++) {
total += i * 2
};
console.log(total);
} | [
"function workToGetBalance() {\n payBalance += 100;\n}",
"function hireaddbal() {\n sum = 0;\n master.hireitems.forEach(function (item) {\n sum += Math.floor(item.multi * item.quan * master.imp.balmulti);\n });\n addbal(sum);\n}",
"function billTotal(subTotal){\nreturn subTotal + (subTotal * .15) + (s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates Roles If role does not exist throw error message | function checkRoles(roles){
var possibleRoles = ["service provider", "device owner", "infrastructure operator", "administrator", "system integrator", "devOps", "user", "superUser"];
for(var i = 0, l = roles.length; i < l; i++){
if(possibleRoles.indexOf(roles[i]) === -1){
return {invalid: true, message: r... | [
"function validateRole(role) {\n\tconst schema = {\n\t\ttitle: Joi.string()\n\t\t\t.min(5)\n\t\t\t.max(30)\n\t\t\t.required()\n\t};\n\n\treturn Joi.validate(role, schema);\n}",
"function checkValidRole(role) {\n if (!['owner', 'moderator', 'user'].includes(role)) {\n throw new RequestError('invalid role');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PresentationValidationUtility consists of all validation methods related to presentation | function PresentationValidationUtility() {} | [
"function genericFormatValidate(genericFv) {\n $('.' + genericFv.className).each(function() {\n var procEl = $(this);\n var reformat = false;\n \n //Check if element has another class\n var numClasses = 0;\n $.each(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the input image to be the image passed into the inputFile element. Reinitilizes the data canvas with the new target data. | function inputFile(){
var file = fileInput.files[0];
var reader = new FileReader();
reader.onload = function () {
var tempImage = new Image();
tempImage.src = reader.result;
tempImage.onload = function() {
inputImage.width = this.width;
inputImage.height = this.height;
inputImage.src = tempImage.... | [
"function setupDataCanvas() {\n\tinputCanvas.width = dataSizeWidth;\n\tinputCanvas.height = dataSizeHeight;\n\tinputContext.drawImage(inputImage, 0, 0, inputImageResWidth, inputImageResHeight, 0, 0, dataSizeWidth, dataSizeHeight);\n\t\n\tvar rescaledImageData = inputContext.getImageData(0, 0, dataSizeWidth, dataSiz... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParsernon_dml_event. | visitNon_dml_event(ctx) {
return this.visitChildren(ctx);
} | [
"visitNon_dml_trigger(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitData_manipulation_language_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function SqlParserListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"visitSimple_dml_trigger(ctx) {\n\t return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Receives a report and saves it to database if new | function addReport(report) {
var deferred = $q.defer();
if (reportCompare(report) == -1) {
reports.push(report);
deferred.resolve('reportHandled');
}
else {
deferred.reject('report already exists');
}
... | [
"function processSaveReport(){\n var ContentFrame = findFrame(getTopWindow(),\"metricsReportContent\");\n if (ContentFrame.validateReport()){\n var footerFrame = $bmId('divPageFoot');\n pageControl.setWrapColSize(footerFrame.children[0].WrapColSize.value);\n if(pageControl.getSavedReportN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2 Use a while loop to build a single string with the numbers 1 through n separated by the number next to the current number. Have it return the new string. eg= 1 2 2 3 3 4 4 5 5 6 6 ... | function string(n){
var i =0;
while(i<n){
i++;
return i," ",n;
}
} | [
"function numberJoinerFancy(startNum, endNum, separator) {\n let newString = ''\n for(let i = startNum; i <= endNum -1; i++) {\n newString += `${i}${separator}`\n }if(i = endNum) {\n newString += `${i}`\n }\n return newString\n}",
"function repeat(input, n){\n var output = ''\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
v6 = .object(ofGroup: Array, withProperties: ["length", "__proto__", "constructor"], withMethods: ["concat", "fill", "indexOf", "entries", "forEach", "find", "reverse", "slice", "flat", "reduce", "join", "findIndex", "reduceRight", "some", "copyWithin", "toString", "pop", "filter", "map", "splice", "keys", "unshift", "... | function v7(v8) {
const v13 = [13.37,1337,1337];
// v13 = .object(ofGroup: Array, withProperties: ["length", "__proto__", "constructor"], withMethods: ["concat", "fill", "indexOf", "entries", "forEach", "find", "reverse", "slice", "flat", "reduce", "join", "findIndex", "reduceRight", "some", "copyWithin", "toSt... | [
"function v25(v26,v27) {\n const v29 = {get:v26,set:v25};\n // v29 = .object(ofGroup: Object, withProperties: [\"__proto__\"], withMethods: [\"get\", \"set\"])\n const v31 = Object.defineProperty(v15,\"__proto__\",v29);\n // v31 = .undefined\n const v33 = [13.37,13.37];\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copies the content from this page to the supplied page instance NOTE: fully overwriting any previous content!! | async copyTo(page, publish = true) {
// we know the method is on the class - but it is protected so not part of the interface
page.setControls(this.getControls());
// copy page properties
if (this._layoutPart.properties) {
if (hOP(this._layoutPart.properties, "topicHeader")) ... | [
"addToPage(page) {\n // Get all of the properties and functions on this component\n const componentProperties = Object.getOwnPropertyNames(this);\n const componentFunctions = Object.getOwnPropertyNames(Object.getPrototypeOf(this));\n const componentPropertiesAndFunctions = componentProperties.concat(com... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is called when user clicks on Change Office button in courier list table | function changeOfficeBtnClicked(courierId) {
$("#quickBackToCourier").show();
selectedCourierId = courierId;
var lastSavedZipCode = localStorage.getItem("currentZipCode");
if(lastSavedZipCode != null)
getAllOfficesForChangeOffice(lastSavedZipCode, "", "");
else
getAllOfficesForChangeOffice("", "", "");... | [
"function processChange(value) {\n //console.log(\"Calendar clicked\");\n //If we are working with the start input\n if(cntrl.getStartCal()) {\n cntrl.setSelectedStartDate(value); \n }\n //If we are working with the end in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class HostEnvironment Stores information about the environment in which the extension is loaded. | function HostEnvironment(appName, appVersion, appLocale, appUILocale, appId, isAppOffline, appSkinInfo)
{
this.appName = appName;
this.appVersion = appVersion;
this.appLocale = appLocale;
this.appUILocale = appUILocale;
this.appId = appId;
this.isAppOffline = isAppOffline;
this.appSkinInfo = appSkinInfo;
} | [
"get environment() {\n if (this._enviornment)\n return Promise.resolve(this._enviornment);\n return fs.readFile(this.environmentPath).then((file) => __awaiter(this, void 0, void 0, function* () {\n let localEnvironment = jsonc.parse(file.toString());\n if (!localEnviro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Track every click on a given link. Use datatype attribute on the link to define click type. | function trackClick() {
var type = this.getAttribute('data-type');
if (type === 'bookmarks-link') {
ga('send', 'event', {
eventCategory: 'type',
eventAction: 'Open bookmarks'
});
} else if (type === 'share') {
ga('send', 'event', {
eventCategory: 'type',
eventAction: this.get... | [
"async function onLinkClicked(event) {\r\n let playlistURI;\r\n let trackURI;\r\n let target = event.target;\r\n // Trace backward to element having embeded URIs\r\n while (!playlistURI && target !== document.body) {\r\n playlistURI = target.href;\r\n trackUR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove a key from the store. | remove(key) {
delete this.store[key];
} | [
"remove(key) {\n var item = this.map[key];\n if (!item) return;\n this._removeItem(item);\n }",
"remove(key) {\n if (this._data[key]) {\n this._busyMemory -= this._lifeTime[key].size;\n delete this._data[key];\n }\n }",
"remove(key) {\n let index = Hash.hash(key, this.sizeLimit);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start the part at the given time. | start(time, offset) {
this._part.start(time, offset ? this._indexTime(offset) : offset);
return this;
} | [
"function start(beatsPerMinute) {\n if (playing) stop();\n\n // assume each step is a 16th note\n stepsPerSecond = beatsPerMinute / 60 * 4;\n context = createNewContext();\n synth = Synth(context);\n\n playing = true;\n scheduleSounds(getPosition(0));\n context.resume();\n\n onTick();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
based on dbscanAlgorithm customized for grouping of line mid point from | function groupsOf(all_lines, posL, posR, radius) {
let groups = [];
//stores nodes that need to get its distance compared
let pivot_index = [];
//gets a random starting poin
let actualGroup = undefined;
while (all_lines.length > 0) {
//there are no neighbors in range
if (pivot... | [
"ensureLineGaps(current) {\n let gaps = [];\n // This won't work at all in predominantly right-to-left text.\n if (this.heightOracle.direction != Direction.LTR)\n return gaps;\n this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.state.doc, 0, 0, li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a HTML element for a unlockable item in the skill tree | function createSkillItem(item, index) {
// Item div
var itemDiv = document.createElement("div");
itemDiv.classList.add("item");
itemDiv.id = "skill-item-" + index;
itemDiv.setAttribute("tooltip", "");
// Item Picture
var itemPic = document.createElement("div");
itemPic.classList.add("it... | [
"function populateSkillTree() {\n // Get the skill tree DOM element and clear it\n var skillTree = document.getElementById(\"skill-tree\");\n skillTree.innerHTML = \"\";\n\n // Initially unlock the apple and the wheat\n if (!window.game.player.unlockedItems.includes(ITEM_APPLE) && !window.game.player... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if this cuboid is overlapped with the other cuboid | isOverlapped(other) {
return (
this._isInRange(other.x - other.w, this.x, this.w) ||
this._isInRange(other.x + other.w, this.x, this.w) ||
this._isInRange(other.y - other.h, this.y, this.h) ||
this._isInRange(other.y + other.h, this.y, this.h) ||
this._isInRange(other.z - other.d, this... | [
"function overlaps(a, b) {\n if (a.x1 >= b.xMax || a.y1 >= b.yMax || a.x2 <= b.xMin || a.y2 <= b.yMin) {\n return false\n } else {\n return true\n }\n }",
"collide(other) {\n // Don't collide if inactive\n if (!thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts the name of a data url like `data:image/jpeg;name=hindenburg.jpg;base64,`..., if any. | function getDataUrlFileName(url) {
var p = url && url.split(';base64,');
var q = p.length ? p[0].split(';').find(function (s) { return s.includes('name='); }) : '';
p = q ? q.split('=') : [];
return p[p.length - 1];
} | [
"function makeDataURI(image) {\n if (image.mime && image.data) {\n image.data = 'data:' + image.mime\n + ';base64,' + image.data;\n }\n }",
"function buildExportBlobUrl(data, name, fileEnding) {\r\n\t\tvar type = {type: 'text/plain'};\r\n var bb = null;\r\n if (window.Blob == ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get "/tag_types.json" do presenter = ResultSetPresenter.new( FakePaginatedResultSet.new(known_tag_types), url_helper, TagTypePresenter, description: "All tag types" ) presenter.present.to_json end | function tag_types_json_formatter(req, res, db, url_helper) {
tag_types.with_counts(db).
then(tts => tts.map(tt => format(tt, url_helper))).
then(tts => res.json(result_set(tts, "All tag types"))).
catch(err => {
console.log(err);
error_503(res);
});
} // tag_types_json_formatter | [
"async index({ request, response, view }) {\n let tags = await Tag.query().select(['tag', 'id'])\n return tags\n }",
"async index() {\n return Type.all();\n }",
"getAll(req, res, next) {\n\n var\n request = new Request(req),\n response = new Response(request, this.expandsURLMap),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If 'obj' does not have the property 'attr', initialize 'attr' with 'initval'. | function touch(obj, attr, initval) {
if (!(attr in obj))
obj[attr] = initval;
return obj[attr];
} | [
"defaultAttributes(attributeObj) {\r\n Object.keys(attributeObj).forEach(name => {\r\n let defaultVal = attributeObj[name];\r\n let userVal = this.getAttribute(name);\r\n\r\n if (!userVal) {\r\n this.setAttribute(name, defaultVal);\r\n }\r\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the maximum height of the textarea as determined by maxRows. | _setMaxHeight() {
const maxHeight = this.maxRows && this._cachedLineHeight ?
`${this.maxRows * this._cachedLineHeight}px` : null;
if (maxHeight) {
this._textareaElement.style.maxHeight = maxHeight;
}
} | [
"set maxLines(value) {}",
"_updateHeight() {\n this._mirroredTextareaRef.el.value = this.composer.textInputContent;\n this._textareaRef.el.style.height = (this._mirroredTextareaRef.el.scrollHeight) + \"px\";\n }",
"function scaleTextArea() {\n let tx = document.getElementsByTagName('textarea')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the given date by first normalizing it and then looking for patterns cMonth (int) : If no month is found, use provided value in stead cDay (str 'start' or 'end') : if no day is found, should it be 1 or end of month | function parse(date, cMonth, cDay) {
// Empty/undefined date is invalid
if (typeof date === "undefined" || !date.length > 1) {
return false;
}
var year = null, month = null, day = null;
date = date.toString();
var parts = normalize(date).split(" ");
... | [
"parseDate(formattedDate) {\n const [monthDayStr, yearStr] = formattedDate.split(', ');\n const [monthStr, dayStr] = monthDayStr.split(' ');\n return {\n month: this.getMonthInt(monthStr),\n day: parseInt(dayStr),\n year: parseInt(yearStr)\n };\n }",
"function parseDate(str) {\n\t if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Activa la carrera cuando se presiona el boton "activar" | function activar() {
let nombreSede = this.dataset.nombre;
let sede = buscarSedePorNombre(nombreSede);
sede[6] = true;
swal({
title: "Activar sede",
text: "¿Está seguro que desea activar esta sede?",
buttons: ["Cancelar", "Aceptar"],
}).then((willDelete) => {
if (willDelete) {
... | [
"function activar(){\n //Se toman todos los items. Ahora para quitar la clase 'activo'\n let opcionesMenu = document.getElementsByClassName('sideBarItem'); \n\n //En este recorrido de todos los items buscamos el que este con clase 'activo'\n for (let i = 0; i < opcionesMe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PBDB Download generator Author: Michael McClennen This code is designed to work with the file download_generator.html to implement a Web application for downloading data from the Paleobiology Database using the database's API. Users can fill in the various form elements to specify the kind of data they wish to download... | function DownloadGeneratorApp( data_url, is_contributor )
{
"use strict";
// Initialize some private variables.
var done_config1, done_config2;
var params = { base_name: '', interval: '', output_metadata: 1, reftypes: 'taxonomy' };
var param_errors = { };
var visible = { };
... | [
"function DownloadController(url, form) {\n //build variables\n DownloadController.prototype.frameName = 'downloadFrame';\n DownloadController.prototype.DOWNLOADFLAG = \"DOWNLOADFLAG=true\";\n\n //define function to get Frame document object\n // if needCreate = true, it will be created if not exists... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add an observer to the observer chain, setting up the head/tail/next/prev properties correctly | function addObserver(chain, observer) {
let tail = chain.tail;
if (tail) {
observer.prev = tail;
tail.next = observer;
chain.tail = observer;
} else {
chain.head = observer;
chain.tail = observer;
}
} | [
"addObserver(observer){\n \n this.observers.push(observer)\n }",
"_observeEntries() {\n this.items.forEach((item) => {\n item.elementsList.forEach((element) => {\n this.observer.observe(element);\n });\n });\n }",
"setTail(node) {\n if (!this.tail) {\n this.head = no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=====| fTwoColumns Function |===== Function for dividing the container row into two columns | function fTwoColumns (rightColumnPercentage) {
//console.log ("fTwoColumns function----------------: ");
/**-*****************************************************-**/
/** When using the default bootstrap's div class = "container", use the ff.
* Otherwise use window.innerWidth.
*******************... | [
"function make_two_column_same_size(){\n\n\ttry{\n\t\tvar side_bar_h = $(\".side_bar\").css(\"height\",\"auto\").height();\n\t\tvar page_content_h = $(\".page-content\").css(\"height\",\"auto\").height();\n\n\t\tif($(\".side_bar\").data(\"originalh\") == undefined){\n\t\t\t$(\".side_bar\").data(\"originalh\",side_b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the browser is Edge, returns the version number as a float, otherwise returns 0 | function getEdgeVersion() {
var match = /Edge\/(\d+[,.]\d+)/.exec(navigator.userAgent);
if (match !== null) {
return +match[1];
}
return 0;
} | [
"function getIEVersionNumber() {\n var ua = navigator.userAgent;\n var MSIEOffset = ua.indexOf(\"MSIE \");\n \n if (MSIEOffset == -1) {\n return 0;\n } else {\n return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(\";\", MSIEOffset)));\n }\n}",
"function detectIEEdge() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Borrar mensajes anteriores. Elimina el contendio del elemento llamado mensaje. | function borrarMensajes() {
let mensaje = document.getElementById("mensaje");
mensaje.innerHTML="";
} | [
"function prevMsgDelete() {\n message.delete([300])\n .then(msg => console.log(`Deleted message from ${msg.author.username}`))\n .catch(console.error);\n }",
"function removeMensagem (mensagem, idCampo) {\n let campoAtrelado = mensagensCampos[idCampo];\n\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2. Divisible by 7 and 5 | function divisible7and5(number){
if((number % 7 === 0) & (number % 5 === 0))
{
console.log(true);
}
else
{
console.log(false);
}
} | [
"function is_odd_or_div_by_7(number)\n{\n\treturn(number % 7 == 0 || number % 2 != 0)\n}",
"function multipleOfFive(num){\n return num%5 === 0 \n}",
"function multipleOf7Or11(n1, n2) {\n if (n1 % 7 === 0 || n1 % 11 === 0 || n2 % 7 === 0 || n2 % 11 === 0) {\n return true;\n } else {\n return false;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Markdown to HTML with options | function html(markdown) {
// Thanks to @GrahamSH-LLK for helping with this
var converter = new showdown.Converter({
backslashEscapesHTMLTags: true,
simplifiedAutoLink: true,
tables: true
});
// GitHub like markdown
showdown.setFlavor("github");
// Finally actually use markdown
var output = co... | [
"function Markdown(text){var parser;return\"undefined\"==typeof arguments.callee.parser?(parser=eval(\"new \"+MARKDOWN_PARSER_CLASS+\"()\"),parser.init(),arguments.callee.parser=parser):parser=arguments.callee.parser,parser.transform(text)}",
"function md(options, cb) {\n var remarkable = new Remarkable();\n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
define the bookmark class | function BookmarkClass() {
// a variable to store marker data as it is retrieved
this.data = { contributors: [],
organisations: [],
venues: [],
events: [],
... | [
"_setBookmark() {\n const { isLogged, type } = this._props;\n const {\n bookmarkLoggedinTemplate, bookmarkNotLoggedTemplate, bookmarkSavednewsTemplate, cardBookmark,\n } = this._blockElements;\n const bookmarkNode = this._domElement.querySelector(cardBookmark);\n let template;\n\n if (isLogge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dibuja una linea en el mapa | function dibujaLineaYActualizaMapa(){
var lngRuta, latRuta;
var posicionRutaAnterior;
var posicionRuta;
navigator.geolocation.getCurrentPosition(function(posicion){
lngRuta = posicion.coords.longitude;
latRuta = posicion.coords.latitude;
posicionRuta = new google.maps.LatLng(latRuta, lngRuta);
... | [
"function createMapLine(){\n\tvar pointX = portMapInfo[0].X;\n\tvar pointY = portMapInfo[0].Y;\n\tvar pointX2 = portMapInfo[0].X2;\n\tvar pointY2 = portMapInfo[0].Y2;\n\tvar mapLine = new Kinetic.Line({\n\t\tpoints: [pointX, pointY, pointX2, pointY2],\n\t\tstroke: 'black',\n\t\tstrokeWidth: 3,\n\t\tlineCap: 'round'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`_loopBy2Keys` executes the callback on given keys of certain entries in index 2 | _loopBy2Keys(index0, key0, key1, callback) {
let index1, index2, key2;
if ((index1 = index0[key0]) && (index2 = index1[key1])) {
for (key2 in index2) callback(key2);
}
} | [
"function caonimabzheshiyigewozijixiedeForEach2(arr, fn){\n var newArr = [];\n for(var i = 0; i < arr.length; i++){\n newArr.push(fn(arr[i]));\n }\n return newArr;\n}",
"function forEach(thing, func) {\n applyEach(thing, function (value, key) {\n func(value, key);\n return valu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is to check that a to: has been specified in new_message.php, forcing user to pick from dropdown list | function checkTo()
{
var to = document.getElementById('to');
var toFull = document.getElementById('to_full');
if (toFull.value == 'All Students' || toFull.value== 'All Professors' || toFull.value == 'All Your Students' || toFull.value == 'All Users' || toFull.value == 'All on this Case' || toFull.value == 'All on a Ca... | [
"selectMessageComingUp() {\n this._aboutToSelectMessage = true;\n }",
"function Assign(messageId) {\n // console.log('Assign # : '+messageId);\n\n // get array of checked ids\n var newContacts = $(\".imapper-contact-box input:checkbox:checked\").map(function(){\n return $(this).val();\n }).ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Executes a MySQL query to fetch a single specified assignment based on its ID. Returns a Promise that resolves to an object containing the requested assignment. If no assignment with the specified ID exists, the returned Promise will resolve to null. | function getAssignmentById(id) {
return new Promise((resolve, reject) => {
mysqlPool.query(
'SELECT * FROM assignments WHERE id = ?',
[ id ],
(err, results) => {
if (err) {
reject(err);
} else {
resolve(results[0]);
}
}
);
});
} | [
"function getAssignmentsByCourseId(id) {\n return new Promise((resolve, reject) => {\n mysqlPool.query(\n 'SELECT * FROM assignments WHERE courseid = ?',\n [ id ],\n function (err, results) {\n if (err) {\n reject(err);\n } else {\n resolve(results);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add "active" class to TOC link corresponding to subsection at top of page | function setActiveSubsection(activeHref) {
var tocLinkToActivate = document.querySelector(".toc a[href$='" + activeHref + "']");
var currentActiveTOCLink = document.querySelector(".toc a.active");
if (tocLinkToActivate != null) {
if (currentActiveTOCLink != null && currentActiveTOCLink !== tocLinkTo... | [
"function trx_addons_mark_active_toc() {\n\t\tvar items = trx_addons_detect_active_toc();\n\t\ttoc_menu_items.removeClass('toc_menu_item_active');\n\t\tfor (var i=0; i<items.current.length; i++) {\n\t\t\ttoc_menu_items.eq(items.current[i]).addClass('toc_menu_item_active');\n\t\t\t// Comment next line if on your dev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a monaco file reference, basically a fancy path | function createFileUri(config, compilerOptions, monaco) {
return monaco.Uri.file(defaultFilePath(config, compilerOptions, monaco));
} | [
"function makeWorkPath() {\r\n\tvar idMk = charIDToTypeID( \"Mk \" );\r\n\t\tvar desc92 = new ActionDescriptor();\r\n\t\tvar idnull = charIDToTypeID( \"null\" );\r\n\t\t\t\tvar ref34 = new ActionReference();\r\n\t\t\t\tvar idPath = charIDToTypeID( \"Path\" );\r\n\t\t\t\tref34.putClass( idPath );\r\n\t\tdesc92.putR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getText(n): Find all Text nodes at or beneath the node n. Concatenate and return as a string. | function getText(n)
{
var strings = [];
getStrings(n, strings);
return strings.join("");
// Recursive inner function.
function getStrings(n, strings)
{
if(n.nodeType == 3 ) /* node.TEXT_NODE */
strings.push(n.data);
else if (n.nodeType == 1 ) /* node.ELEMENT_NODE */
for(var m=n.f... | [
"string(node) {\n if (Text.isText(node)) {\n return node.text;\n } else {\n return node.children.map(Node$1.string).join('');\n }\n }",
"function getDocumentText(element) {\n element = $(element) || $(\"body\");\n var params = { \"text\": \"\", \"trim\": true };\n\n // iterate t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
'saveUserThemeConfig' method is used to call the web method 'SaveUserThemeConfig' to save the user id,themeid through ajax call . | function saveUserThemeConfig(selectedThemeID) {
$.ajax({
type: "POST",
url: opts.serviceUrl + "SaveUserThemeConfig",
data: "{ themeID :'" + selectedThemeID + "'}",
contentType: "application/json",
dataType: "json",
success: function (datap) {
window.locati... | [
"function getThemeConfigItems(themeListDiv) {\n $.ajax({\n type: \"POST\",\n url: opts.serviceUrl + \"GetThemeItems\",\n data: \"{}\",\n contentType: \"application/json;charset=utf-8\",\n dataType: \"json\",\n success: function (datap) {\n var themeConfigItems... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a bunch of traders from traders_spec returns tuple (n_buyers, n_sellers) optionally shuffles the pack of buyers and the pack of sellers | function populate_market(traders_spec, traders, shuffle, verbose){
function trader_type(robottype, name){
if (robottype === 'GVWY'){
return new Trader_Giveaway('GVWY', name, 0.00, 0);
}else if (robottype === 'ZIC'){
return new Trader_ZIC('ZIC', name, 0.00, 0);
}else ... | [
"function tiers(layers) {\n\t// verify layers has exactly 8 elements\n\tassert.equal(8, layers.length, \"expected 8 layers elements, got \" + layers.length);\n\n\t// pack it\n\tlet result = web3.toBigNumber(0);\n\tfor(let i = 0; i < layers.length; i++) {\n\t\tresult = result.times(256).plus(layers[i]);\n\t}\n\n\tre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to get the solar irradiance after a location has been choosen | function getSolar(location, locationType) {
// If latitude & longitude are provided, send to the google API to get the city name
switch (locationType) {
case "lat_long":
parameters = {
lat: location[0],
lon: location[1]
};
// Google API to convert lat/lon to city, region, count... | [
"function getAlt(latAlngA) {\n var elevator = new google.maps.ElevationService;\n elevator.getElevationForLocations({\n 'locations': [latAlngA]\n }, function(results, status) {\n //Checking to see if everything is functional\n if (status === 'OK') {\n // Gets the first result\n if (results[0])... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name: TimeBasedRecommendor Description: the TimeBasedRecommendor is the engine that computes recommendations from the data | function TimeBasedRecommendor() {
/* Private Member Variables */
// setup some maps so that we can store all the data in memory and then update properly
// Basically the concern is that can't add a rating to a candidate that doesn't exist yet
// So we store everything, then create the candidates, then ad... | [
"function companyBotStrategy(trainingData) {\n let time = 0;\n let correctness = 0;\n trainingData.forEach(data => {\n if (data[1] === 1) {\n time += data[0];\n correctness += data[1];\n }\n });\n\n return time / correctness || 0;\n}",
"calculateUserTrend(userid, userStartingWeight) {\n lo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes the direction of the rover when commands are left or right | function changeDirection(direction, command) {
if (direction == 'N' && command == 'l') {
myRover.direction = 'W';
}
else if (direction == 'N' && command == 'r') {
myRover.direction = 'E';
}
else if (direction == 'E' && command == 'l') {
myRover.direction = 'N';
}
else if (direction == 'E' && comm... | [
"function turnRight(rover){\n console.log(rover.name + \": turnRight was called\");\n\n switch(rover.direction){\n case \"N\":\n rover.direction=\"E\";\n break;\n case \"E\":\n rover.direction=\"S\";\n break;\n case \"S\":\n rover.direction=\"W\";\n break;\n case \"W\":\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function : onMapClick Channel : dogtracker_marker_position Description : Publishes lat/lon position to server through this pubnub channel and opens the popup for uploading image to server | function onMapClick(e){
popup
.setLatLng(e.latlng)
.setContent('<strong>Current position : '+e.latlng.toString() +'</strong><br/><br/>'+
'<form id="uploadForm" action="/uploadimage" enctype="multipart/form-data" method="POST" target="uploader_iframe">'+
'<input type="file" name="userPhoto" /><br/><br/>'+
... | [
"function onMapClick(e) {\n // Popup example\n popup\n .setLatLng(e.latlng)\n .setContent(\"You clicked the map at \" + e.latlng.toString())\n .openOn(mymap);\n\n last_point_clicked = e.latlng;\n\n var add_point_cbx = document.getElementById('add_marker_CBX');\n if (add_point_cbx... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sendDataToApp is call back function TODO:send data in object projectData | function sendDataToApp(req, res) {
res.send(projectData);
} | [
"function sendData (client, method, data) {\n\t\tvar packet = { methodName : method, data : data };\n\t\t\n\t\tclient.fn.send(\"PROJECT\", packet);\n\t}",
"function setAppData(appData) {\n self.LApp.data = appData;\n $log.debug('success storing application data');\n }",
"function se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
inverse of the circlePath function, returns a circle object from an svg path | function circleFromPath(path) {
var tokens = path.split(' ');
return { 'x': parseFloat(tokens[1]),
'y': parseFloat(tokens[2]),
'radius': -parseFloat(tokens[4])
};
} | [
"function createSvg(path){\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n const pathElement = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n\n attrDict(svg, {\n 'class':'svg-icon',\n 'viewBox': '0 0 20 20'\n })\n\n attrDict(pathElement,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Writes a uint24 to a buffer starting at the given offset, returning the offset of the next byte. | function writeUInt24BE(
buffer,
value,
offset
) {
offset = buffer.writeUInt8(value >>> 16, offset); // 3rd byte
offset = buffer.writeUInt8(value >>> 8 & 0xff, offset); // 2nd byte
return buffer.writeUInt8(value & 0xff, offset); // 1st byte
} | [
"static uint24(v) { return n(v, 24); }",
"static bytes24(v) { return b(v, 24); }",
"function shift (buffer, offset) {\r\n validate(buffer);\r\n\r\n for (var channel = 0; channel < buffer.numberOfChannels; channel++) {\r\n var cData = buffer.getChannelData(channel);\r\n if (offset > 0) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function adds Heavy Cover number for H_W&F by 1 | function countHcoverHwfPlus() {
instantObj.noOfHcoverHWF = instantObj.noOfHcoverHWF + 1;
countTotalBill();
} | [
"function countHcoverHwfMinus() {\n\t\t\tif(instantObj.noOfHcoverHWF > 0) {\n\t\t\t\tinstantObj.noOfHcoverHWF = instantObj.noOfHcoverHWF - 1;\n\t\t\t\tcountTotalBill();\n\t\t\t}\n\t\t}",
"function countHcoverHwiPlus() {\n\t\t\tinstantObj.noOfHcoverHWI = instantObj.noOfHcoverHWI + 1;\n\t\t\tcountTotalBill();\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return whether or not the current odk json file exists | function odk_json_exists(filename, callback) {
read_git_release_data(REGION_FS_STORAGE, function(files) {
res = false
_.each(files, function(f, i) {
if (basename(f) + ".json" == filename) {
res = true
return
}
});
callback(res)... | [
"fileExists() {\n return fs.pathExists(this.location);\n }",
"exists(objectHash) {\n return objectHash !== undefined\n && fs.existsSync(nodePath.join(Files.gitletPath(), 'objects', objectHash));\n }",
"async ensureExists() {\n if (await this.fileExists()) {\n return;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
$commentsMobile is an array of dom elements. commentsMobile[0] && [3] is HEADER commentsMobile[1] && [4] is CONTAINER commentsMobile[2] && [5] is COMMENT BUTTON | function commentsMobile (ev) {
var v = require('./comments_events_vars')
if ($(ev.target).attr('class').indexOf('disagree') !== -1) {
if (disagreeOpened === false || disagreeOpened === undefined) {
$(v.commentsMobile[3]).css('display', 'flex')
$(v.commentsMobile[4]).css('display', 'block')
$(v... | [
"function initComments() {\n const $comments = $('.comment-item');\n $comments.each((ind, comment) => {\n const $comment = $(comment);\n initComment($comment);\n });\n }",
"parseComments(comments) {\n\t\tconst newComments = [];\n\t\tcomments.forEach((c) => {\n\t\t\tco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ueberprueft, ob ein Objekt einer bestimmten Klasse angehoert (ggfs. per Vererbung) obj: Ein (generisches) Objekt base: Eine Objektklasse (KonstruktorFunktion) return true, wenn der Prototyp rekursiv gefunden werden konnte | function instanceOf(obj, base) {
while (obj !== null) {
if (obj === base.prototype)
return true;
if ((typeof obj) === 'xml') { // Sonderfall mit Selbstbezug
return (base.prototype === XML.prototype);
}
obj = Object.getPrototypeOf(obj);
}
return false... | [
"static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === RelationshipLink.__pulumiType;\n }",
"static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hooks the JWT Strategy. | function hookJWTStrategy(passport) {
var options = {}
options.secretOrKey = config.secret
options.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme('Bearer')
passport.use(new JWTStrategy(options, function(JWTPayload, callback) {
db.users.findOne({ _id: JWTPayload._id }, function(er... | [
"function hookJWTStrategy(passport) {\n // TODO: Set up Passport to use the JWT Strategy.\n const options = {};\n\n options.secretOrKey = config.keys.secret;\n options.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme('jwt');\n options.ignoreExpiration = false;\n\n passport.use(new JWTStrategy(options, (JW... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
channelId and tabId are optional. If callbackOnLoad is not null then it'll be passed the FavoriteTabCookie object once it's loaded. | function saveNewFavoriteTab(channelId,tabId,callbackOnLoad) {
var url = "/b/gamerprof/list/FavoriteTabService?channel="+ channelId;
if(tabId != null){
url += "&tab="+ tabId;
}
new Ajax.Request(url,
{
method:'get',
onSuccess: function(transport){
var response = tr... | [
"function checkOwnFavs(){\n if( ! conf.ownFavs || ! tweet.favorited ){\n return checkFinal();\n }\n checkOwnFavourite( tweet.id_str, function( favourited ){\n if( favourited ){\n console.log('Keeping tweet favourited by self');\n return nextTw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Author: [S.H] Name: _getGroupDataSelector Description: given an item in the list, returns the data object that represents the group that the item belongs to. Params: item Return: data object of each group | function _getGroupDataSelector(item) {
return item.group;
} | [
"function _getGroupKeySelector(item) {\n return item.group.key;\n }",
"function group( item ) {\n\n item [ 'type' ] = TYPE.GROUP;\n item [ 'token' ] = item.uuid;\n item [ 'ts' ] = Service.$tools.getTimestamp( item.updatetime );\n \n return item;\n \n }",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets whether the given module name resolves to a secondary entrypoint. | function isSecondaryEntryPoint(moduleName) {
return getEntryPointSubpath(moduleName) !== '';
} | [
"function isExistingModuleOrLibName(name) {\r\n\r\n var pO = CurProgObj;\r\n\r\n for (var m = 0; m < pO.allModules.length; m++) // search all user modules\r\n if (pO.allModules[m].name == name)\r\n return true;\r\n\r\n for (var m = 0; m < pO.libModules.length; m++) // search all library m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to assign a MDT role to a computer. | async function assignComputer(
computerName,
computerId,
classroomNumber,
roleName
) {
await sqlQuery(`DELETE FROM Settings WHERE ID=${computerId} AND Type='C'`);
await sqlQuery(
`INSERT INTO Settings (Type,ID,ComputerName,OSDComputerName,OrgName,FullName,JoinWorkgroup) VALUES ('C',${computerId},'${comp... | [
"function assignRole(member) {\n // Use the nickname if it exists, otherwise, stick with the username\n let name = (member.nickname != null) ? member.nickname : member.user.username;\n name = name.slice(0,1); // We only want the first letter\n\n let rolesToRemove = [];\n let roleToAdd = '';\n\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
preformat raw data including raw RIS | function preformatRawData(metaData, parser) {
//fix title, year, misc and journal abbreviation
metaData["citation_download"] = metaData["citation_download"].replace(/JO[\t\ ]+[\-]+[\t\ ]+/,"JA - ").replace(/(?:PY|N1)[\t\ ]+[\-]+[\t\ ]+/g,"BIT - ").trim();
} | [
"function changeFormatData(retails) {\n\tlet output = [];\n\t// Put ur code here\n\n\t// loop through the retails array\n\tfor (let i = 0; i < retails.length; i++) {\n\t\tlet row = [];\n\n\t\t// loop through the rows\n\t\tfor (let j = 0; j < retails[i].length; j++) {\n\t\t\tlet temp = '';\n\n\t\t\t// loop through t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws lines to other keypoints if they exist | _drawLines(keypoint) {
if (keypoint.indexLabel < 0) return;
if (!this._edges.hasOwnProperty(keypoint.indexLabel)) return;
let otherIndices = this._edges[keypoint.indexLabel];
otherIndices.forEach(i => {
let k2 = this._labelled[i];
if (!k2) return;
let edge = [keypoint.indexLabel, i];... | [
"function drawKeypoints() {\n // Loop through all the poses detected\n for (let i = 0; i < min(poses.length, 1); i++) {\n // For each pose detected, loop through all the keypoints\n for (let j = 0; j < poses[i].pose.keypoints.length; j++) {\n // A keypoint is an object describing a body part (like righ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
debugDrawCollisionToggle Creates new html elements for debug controls | function debugControls() {
var div = document.getElementById("dbgCtrls");
var diffLabel = document.createElement("p");
diffLabel.textContent = "DIFFICULTY OVERRIDE";
div.appendChild(diffLabel);
var diffEntry = document.createElement("input");
diffEntry.min = 1;
diffEntry.max = 10;
diffEntry.id = `${div.id}_con... | [
"function drawDebugHitbox(entity) {\n let canvas = document.getElementById('gameWorld');\n let ctx = canvas.getContext('2d');\n ctx.beginPath();\n ctx.strokeStyle = entity.isRecoiling ? 'orange' : 'green';\n ctx.lineWidth = 2;\n ctx.rect(entity.hitbox.x, entity.hitbox.y, entity.hitbox.width, entit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adding click listeners to employee cards | function addEventListenersToCards(){
//After the cards have been rendered, we assign them to the variable $cards
$cards = $('.card');
$cards.on('click', event => {
//Because sometimes the users will click on the image, or some text, we must traverse the DOM to access
//the card element itself
let targete... | [
"function employeeClickEventListener() {\n $('li').click(function() {\n let id = $(this).attr('id');\n let idNumber = parseInt(id, 10);\n displayEmployeeModal(idNumber);\n })\n }",
"function clickedCard() {\r\n cardsDeck.addEventListener('click', function (card) {\r\n showCard(card);\r\n });\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: $iq Create a Strophe.Builder with an element as the root. Parameters: (Object) attrs The element attributes in object notation. Returns: A new Strophe.Builder object. | function $iq(attrs) { return new Strophe.Builder("iq", attrs); } | [
"static attach(element) {\n return new DomBuilder(element);\n }",
"function MyCreateElement(type, attrs={}) {\n var elem = document.createElement(type);\n for (var key in attrs)\n elem.setAttribute(key, attrs[key]);\n return elem;\n}",
"static get Builder() {\n class Builder {\n with... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a TLO node to the graph Takes a valid TLO object as input. | function addTlo(tlo) {
if(idCache[tlo.id]) {
console.log("Already added, skipping!", tlo)
} else {
if(typeGroups[tlo.type] === undefined) {
typeGroups[tlo.type] = typeIndex++;
}
tlo.typeGroup = typeGroups[tlo.type];
idCache[tlo.id] = currentGraph.nodes.length; // Edges reference nodes by ... | [
"addNode(value) {\r\n // create a new node\r\n const node = new Node(value)\r\n // add node to the nodes map\r\n this.nodes.set(node, new Map())\r\n // return the new node\r\n return node;\r\n }",
"add(noodle, container, constr, label, pos, noodleExp) {\n var node = constr(noodle, contai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines whether an API validation error is safe to ignore. It checks for known validation errors in certain API definitions on APIs.guru | function shouldIgnoreError (api, error) {
var safeToIgnore = [
// Swagger 3.0 files aren't supported yet
{ error: 'not a valid Swagger API definition' },
// Many Azure API definitions erroneously reference external files that don't exist
{ api: 'azure.com', error: /Error downloading .*\.jso... | [
"function checkAPIKey() {\n if (mashapeAPIKey == null) {\n console.error('ERROR: API Key must be set!');\n }\n}",
"function checkAPIReturn(response) {\n if (response.status === 201 ||\n response.status === 200 ||\n response.status === 204 ||\n response.status === 205\n ) {\n return response;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
APP crea un metodo de pago por un usuario | function crearMetodoDePago(metodo) {
return new Promise(async (resolve, reject) => {
try {
if (!metodo) {
return reject(new Error("faltan datos"));
}
const id = await store.crearMetodoDePago(metodo);
return resolve(id);
} catch (error) {
return reject(error);
}
});
... | [
"function carregarFornecedor() {\n apiService.get('/api/fornecedor/perfil', null,\n carregarMembroSucesso,\n carregarMembroFalha);\n }",
"createTipo ({\n commit\n }, tipo) {\n ApiService.postTipo(tipo).then((response) => {\n tipo.idTipo = respons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
from sugested location pick a random location and populate globale variables | function randomLocation(suggestedLocations) {
var obj_keys = Object.keys(suggestedLocations);
var ran_key = obj_keys[Math.floor(Math.random() * obj_keys.length)];
selectedLocation = suggestedLocations[ran_key];
console.log(selectedLocation);
console.log("Selected restaurant latitude is " + selectedLocati... | [
"function randomLocatePacman(){\n\tif (shape.i != undefined && shape.j != undefined){\n\t\tboard[shape.i][shape.j] = 0;\n\t}\n\n\tlet pacmanCell = findRandomEmptyCell(board);\n\tboard[pacmanCell[0]][pacmanCell[1]] = 2;\n\tshape.i = pacmanCell[0];\n\tshape.j = pacmanCell[1];\n}",
"function randomRobot(state) { ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FunctionName: check_if_query_exists Params: req, queryVal globals: pyArgs purpose: if query variable exists, set the global argument object value to the query variable's value. return: N/A | function check_if_query_exists(req, queryVal){
if(req.query[queryVal] != undefined){
pyArgs[queryVal] = req.query[queryVal];
}
} | [
"_handleExists(callback, exists = true, conj = \"and\") {\r\n if (this._where) this._where += ` ${conj} `;\r\n var query = this._getQueryBy(callback);\r\n this._where += (exists ? \"\" : \"not \") + \"exists (\" + query.sql + \")\";\r\n this._bindings = this._bindings.concat(query._bindi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
random styles for mock testing | function randomStyler()
{
var zoneStyle = Math.floor((Math.random() * 3) );
console.log('randomZone='+ zoneStyle);
return stylesArray[zoneStyle];
} | [
"function newStyle(element) {\n element.style['color'] = randObj().color;\n element.style['font-size'] = randObj().size;\n element.style.fontFamily = randObj().font;\n element.style.backgroundColor = randObj().backgroundColor;\n element.style.border = randObj().border;\n }",
"function getLineAtt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |