query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Given an array of domains, generate an array of ChainConfigs which can be used to deploy Optics to each domain for crosschain tests | async function domainsToTestConfigs(domains) {
let configs = domains.map((domain) => {
return {
domain,
currentRoot:
'0x0000000000000000000000000000000000000000000000000000000000000000',
nextToProcessIndex: 1,
optimisticSeconds: 3,
};
});
const wallets = provider.getWallet... | [
"async function deployMultipleChains(chainConfigs) {\n // for each domain, deploy the entire contract suite,\n // including one replica for each other domain\n const chainDetails = {};\n\n let govRouters = [];\n for (let config of chainConfigs) {\n const { domain } = config;\n\n // for the given domain,\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checkout the component to a different version in its working tree. | checkout(version) {} | [
"function commitFct() {\n // create new version on same branch\n var newVersion = new Version();\n var currentVersion = this.lastVersion();\n newVersion.elements.components = currentVersion.elements.getElements();\n newVersion.previous = currentVersion._id;\n\n // Search the old version\n var b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateRecognizeWith : updateRecognizeWith(hammerManager) (private) Sets recognizeWith if defaults have it Since we add recognizers dynamically and without any strict order, we need to guard against trying to set a requireWith for a recognizer that haven't been created yet. | function updateRecognizeWith(hammerManager) {
for (var i = 0; i < hammerManager.recognizers.length; i++) {
var recognizer = hammerManager.recognizers[i];
var recognizerName = recognizer.options.event;
if (!defaults[recognizerName].hasOwnProperty('recognizeWith')) continue;
var recogni... | [
"function updateRecognizeWith(hammerManager) {\n for (var i = 0; i < hammerManager.recognizers.length; i++) {\n var recognizer = hammerManager.recognizers[i];\n var recognizerName = recognizer.options.event;\n\n if (!defaults[recognizerName].hasOwnProperty('recognizeWith')) continue;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply a given function to each value of a matrix and return a new version of it | static map(matrix, func) {
let result = new Matrix(matrix.rows, matrix.cols);
// Apply a function to every element of the matrix
for (let i = 0; i < result.rows; i++) {
for (let j = 0; j < result.cols; j++) {
let val = matrix.data[i][j];
result.data[i]... | [
"static map(matrix, fn) {\n let result = new Matrix(matrix.rows, matrix.columns);\n for (let i = 0; i < matrix.rows; i++)\n for (let j = 0; j < matrix.columns; j++) {\n let val = matrix.data[i][j];\n result.data[i][j] = fn(val);\n }\n return r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method renders the board on the screen with a table, 9 different row sections, and 81 input fields. | function drawBoard() {
var s = '<table class="table">\n';
for (var i = 0; i < 9; ++i) {
s += '<tr>';
for (var j = 0; j < 9; ++j) {
var c = 'cell';
if ((i + 1) % 3 == 0 && j % 3 == 0) {
c = 'cell3';
} else if ((i + 1) % 3 == 0) {
c = 'cell1';
} els... | [
"function renderBoard() {\n //log(\"renderBoard\");\n //log(board);\n // var htmlString = \"\";\n // for (var i = 0; i < boardSize * boardSize; i++) {\n // htmlString += renderBoardCell(board[i], i);\n //\n // if ((i + 1) % boardSize === 0) {\n // htmlString += \"<br>\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Close snackbar on "X" click | function snackbarClose() {
snackbar.classList.remove('snackbar__wrapper');
snackbar.classList.add('snackbar__wrapper--hidden');
} | [
"function handleCloseSnackbar() {}",
"_close(){clearInterval(this._timer);if(1<this._stack.length){this._snackbar.classList.add(\"hide\");this._stack.shift();if(0<this._stack.length){this._show()}else{this.displayObj.snackbar.isOpen=!1;this.displayObj.isOpen=!1}}else{this._stack.shift();this._snackbar.classList.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
//////// STRUCTURE AND SEND AUTOMATIC FOLLOWUP REMINDERS /////////// ///////////////////////////////////////////////////////////////////// return array of rows matching today for update | function getUpdateRows () {
var ss = SpreadsheetApp.getActive();
var followUpSheet = ss.getSheetByName('Following Up');
// get the date array from Follow Up sheet
var followUpDateArray = followUpSheet.getRange(4, 11, followUpSheet.getLastRow(), 1).getValues();
// cycle through the array and push the row... | [
"getTodayEntries(): Array<Entry>{\n let todayEntries = this._entries.filter(entry => entry.date == this.date);\n return todayEntries.filter(entry => entry.fullDate > this._date);\n }",
"function markCurrentDates() {\n const now = new Date();\n UPDATE_DETAILS.forEach((detail, _) => {\n const sheet = sA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ALGORITHM : Calculate (a^b) % c using recursion NOTES: a^b = a^(2(b/2)) If b is even, and b>0. a^b = (a) a^(2(b1/2)) If b is odd. a^b = 1 If b is 0. Time Complexity : O(log(b)) Space Complexity : O(1) | function modRecursion(a, b, c) {
if (b == 0)
return 1;
if (b == 1)
return a % c;
else if (b % 2 == 0) {
return modRecursion((a * a) % c, parseInt(b / 2), c);
} else {
return (a * modRecursion((a * a % c), parseInt(b / 2), c)) % c;
}
} | [
"function modpow(a, b, n) {\n var res=1;\n while (b)\n {\n if (b % 2) { res = (res * a) % n; }\n \n a = (a * a) % n;\n b =Math.floor(b/2);\n }\n\n return res;\n \n}",
"function fastPower (a, b, n) {\n if (n == 0) return 1 % b;\n if (n == 1) return a % b;\n\n let m = a,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Snackbar is dark by default override themeable logic. | isDark() {
return this.hasBackground ? !this.light : themeable.options.computed.isDark.call(this);
} | [
"static dark() {\n window.localStorage.setItem('colorScheme', 'dark')\n this.#isDark = true;\n this.#applyScheme();\n }",
"isDark() {\n return this.hasBackground ? !this.light : _mixins_themeable__WEBPACK_IMPORTED_MODULE_3__[/* default */ \"a\"].options.computed.isDark.call(this);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function called whenever the cities display content | function onDisplayContentForTagcitiesmenutag(tag) {
refreshCities();
} | [
"function addCity() {\r\n displayWeather();\r\n }",
"function initialize() {\n cities();\n}",
"function initialize(){\n cities();\n}",
"function cityClickedHandler(self) {\n\n let accordionItem = self.parents('.elementor-accordion-item');\n\n /* If city is open but doesn't have a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract the scheme of a URL. | function getUrlScheme(url) {
var match = _split(url);
return match && match[_ComponentIndex.Scheme] || "";
} | [
"function getUrlScheme(url) {\n\t var match = _split(url);\n\t return match && match[_ComponentIndex.Scheme] || \"\";\n\t}",
"function getUrlScheme(url) {\n var match = _split(url);\n\n return match && match[_ComponentIndex.Scheme] || '';\n }",
"function getUrlScheme (url) {\n var matc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse input for this domain to get an array of commands to run | static parseInputForCommands({domain=null,input=null,arrayIndex=-1})
{
let cmds={};
// Override commands from config/input
if(Array.isArray(input.domain))
{
if(input.domain[arrayIndex].preflight_commands&&
Object.keys(input.domain[arrayIndex].preflight_commands).length>0)
{
cmds=input.domain[arrayIndex].preflight_com... | [
"parse_commands(inputStr) {\n const cmds = inputStr.split('|').map(x => x.trim())\n return cmds.map(cmd => {\n if(cmd.startsWith('ADD')) {\n return this._parse_add_player(cmd)\n } else {\n return this._parse_attack(cmd)\n }\n })\n }",
"function parseCommand(input) {\n const... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts an array of n face vertices to an array of n + 1 edges. | function faceEdges(face) {
var n = face.length,
edges = [];
for (var a = face[n - 1], i = 0; i < n; ++i) {
edges.push([a, a = face[i]]);
}return edges;
} | [
"function faceEdges(face) {\n var n = face.length,\n edges = [];\n for (var a = face[n - 1], i = 0; i < n; ++i) edges.push([a, a = face[i]]);\n return edges;\n}",
"function colorVertices(n){\r\n var vertex_colors = [];\r\n for (var j = 0; j < n; ++j) {\r\n const c = face_colors[j];\r\n vertex_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is run when pacman takes a pill | function pilltaken(ghost) {
ghost.bias = 2
gridSquare[ghost.ghostIndex].classList.remove('ghostDead')
gridSquare[ghost.ghostIndex].classList.remove(ghost.ghostClass)
gridSquare[ghost.ghostIndex].classList.add('ghostFlee')
for( let i=0; i<16; i++) {
clearInterval(caughtIdOne)
clearInterva... | [
"function ask_pacman_autopilot(x, y, dir, internal) {\n\tvar new_dir = dir;\n\tvar maze = internal.maze;\n\t\n\t/*\n\t// can we carry same direction ?\n\tvar bStraightOk = is_direction_ok(x, y, dir);\n\tif (!bStraightOk) {\n\t\tvar coin = Math.random();\n\t\tif (dir==dir_up || dir==dir_down) {\n\t\t\tif (coin<0.5) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Try to balance the connection pool. | try() {
this.balance()
} | [
"balance() {\n this.log('balance')\n\n if (this.balanceId != null) {\n clearTimeout(this.balanceId)\n this.balanceId = null\n }\n\n const max = this.maxConnectionsRdy()\n const perConnectionMax = Math.floor(max / this.connections.length)\n\n // Low RDY and try conditions\n if (perConn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DOM (Document Object Model) related functions. Populate voices dropdown. | function populateVoicesDropDown() {
voicesDropDown.innerHTML = speechSynthesis
.getVoices()
.map(voice => `<option value="${voice.name}">${voice.name}</option>`)
.join('');
} | [
"function populateVoices() {\n //get the voice \n voices = this.getVoices();\n\n // console.log(voices);\n\n //select the element dropdown then map \n //over all the voice present in the chrome and \n //show it as an option\n voicesDropdown.innerHTML = voices\n .map(voice => `<option val... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves all cards/appointments from asyncstorage. | retrieveItems() {
try{
AsyncStorage.getItem("Appointments").then(res => {
if(res === null){
AsyncStorage.setItem("Appointments", JSON.stringify([]))
} else {
this.setState({avtaler: JSON.parse(res)})}
})
}cat... | [
"async function getCalendarData(){\n let res = await fetch('/calendar');\n let calendarArray = await res.json();\n localStorage.calendarData = JSON.stringify(calendarArray);\n}",
"loadSchedule() {\n Schedule().then((results) => {\n this.setState({baseSchedule: results.data});\n AsyncStorage.setIte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is for the first link so when it is clicked all the other id text boxes remain hidden and the "nav1" id comes into the screen "slow" | function Link1(){
$('#nav2,#nav3,#nav4').hide();
$('#nav1').show('slow');
} | [
"function changeNav2() {\n\t\t$(\"#nav1\").hide(500);//this hides link 1 content\n\t\t$(\"#nav2\").show(500).addClass(\"contentBox\");//this is putting nav 2 into the content box\n\t\t$(\"#nav3\").hide(500); //this hides the nav3 content\n\t\t$(\"#nav4\").hide(500);//this hides the nav4 content\n\t\t\n\t\t}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove animation flag by timeout | dropAnimation() {
if (typeof (this.timer) != 'undefined') clearTimeout(this.timer);
this.timer = setTimeout(this.stopAnimation.bind(this), 350);
} | [
"clearAnimationTimer() {\n raf.cancel(this.animationTimer);\n this.animationTimer = null;\n }",
"dropAnimation () {\n if (this.timer != null) clearTimeout(this.timer);\n this.timer = setTimeout(this.stopAnimation.bind(this), 250);\n }",
"function resetAnimation() {\n setTime... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Drag start event handler, on the bookmarks table e = DragEvent Sets global variables noDropZone, isBkmkItemDragged and dtSignature | function bkmkDragStartHandler (e) {
let rowDragged = e.target; // Should always be a [object HTMLTableRowElement] by construction
//console.log("Drag start event: "+e.type+" target: "+rowDragged+" class: "+rowDragged.classList);
//console.log("Draggable: "+rowDragged.draggable+" Protected: "+rowDragged.dataset.protec... | [
"function handleDragStart(e) {\n\t\t\te.dataTransfer.setData(\"text\", this.id); //note: using \"this\" is the same as using: e.target.\n\t\t}//end function",
"function foodItemDragStart(event)\n{\n // event has a propperty called dataTransfer.\n // dataTransfer is avilable for other eventhandlers as well,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a file to the git index (aka staging area) | async function add ({
dir,
gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'),
fs: _fs,
filepath
}) {
const fs = new FileSystem(_fs);
const type = 'blob';
const object = await fs.read(path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, filepath));
if (object === null) throw new Err... | [
"function addFile (sh, repoPath, filename) {\n sh.cd(repoPath);\n sh.exec('git add ' + filename)\n}",
"async function add ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n filepath\n}) {\n try {\n const fs = new FileSystem(_fs);\n\n await GitIndexMa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filterPosts filters and returns posts in this.props.posts for a category Category name should be mentioned in this.props.category. If no category is mentioned, it returns a copy of this.props.posts | filterPosts() {
if (this.props.category) {
return this.props.posts.filter(post => post.category === this.props.category);
}
return [...this.props.posts];
} | [
"function filterCategory(posts) {\n var reCat = new RegExp(cat);\n return posts.filter(function filterPosts(post) {\n return post.categories.data.some(function checkRe(postCat) {\n return reCat.test(postCat.name);\n });\n });\n }",
"filterPosts() {\n this.showPosts ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a 'type' field to sexp and children, gathering typevariable constraints as pairs in constraints. | function addTypes(env, sexp, constraints) {
var type = null;
switch (sexp.tag) {
case 'sym':
if (sexp.val in env) {
type = env[sexp.val];
} else {
throw 'unknown sym ' + sexp.val;
}
break;
case 'str': type = TString; break;
case 'num': type = TNum; break;
case 'lst':
var head... | [
"addType(type){\r\n\t\tif (typeof this.typeTable[type.name] == \"undefined\"){\r\n\t\t\t//type.table=this;\r\n\t\t\tthis.typeTable[type.name]=type;\r\n\t\t}else{\r\n\t\t\talert('XSD problem : type '+type.name+' is already defined.');\r\n\t\t}\r\n\t}",
"visitType_declarations(ctx, spec) {\n if (!ctx.type_de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Aquries evaluations from form, calculates total score and displays the results in the score overview panel | function calculateFormScore() {
//higligt selected values from previously submitted entry
$("input:hidden[name$='_hidden']").each(function() { // only chose hidden inputs with postfix _hidden
// aquire form category
var category = $(this).attr("name");
category = categor... | [
"function answerEvaluation() {\n var result = eval(questionBox.innerHTML);\n if(result == answer.value) {\n correctAnswer++;\n score.innerHTML = \"SCORE = \" + correctAnswer;\n }\n else {\n score.innerHTML = \"SCORE = \" +correctAnswer;\n var showSolutions = new solutionShow(); \n }\n}",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns reference to horizontal FireMeshLine most closely anchored to y | horzLineAt (y) { return this._horz[this.horzIdxAt(y)] } | [
"getHorizontalLine(slab) {\n // console.log(\"getHorizontalLine() -- \" + this.arrAllLines.length);\n let retElement;\n if (this.arrAllLines.length > 0) {\n this.arrAllLines.forEach((element) => {\n if (element.topY === slab.yPosition) {\n retElement = element;\n }\n });\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Controller to support the template to be shown in the dialog shown for persistence failures. | function PersistenceFailureController() {
} | [
"function ProjectTemplateController(){}",
"static launchGenericError(){\n ModalFactory.launchError('Oops!','Something went wrong. Try quizzing sometime later. We\\'ll try to fix this one');\n }",
"function ResponseModalController() {\n}",
"renderHttpErrorPage() {\n const config = this.app.get('config')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets product list from the database Limits to /limit=? products. DEFAULT: 10 and MAX: 20 | function getProducts(req, res){
var limit = req.query.limit;
//check for query parameter
if(limit&&!isNaN(limit)&&limit<=20&&limit>0){
productData.getProducts(limit, function(data){
if(data==="Error")
res.status(config.HTTP_CODES.SERVER_ERROR).send("Error fetching d... | [
"function getProduct(){\n\n if (productsPerPageCounter == 0) {\n productsURL = 'http://127.0.0.1:3000/api/products/?offset=' + productsPerPage + '&limit=' + howManyProducts; // get X products\n productsPerPageCounter += 1;\n } else if (productsPerPageCounter >= 1) {\n productsPerPage += product... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw something when a touch start is detected | function sketchpad_touchStart() {
// Update the touch co-ordinates
getTouchPos();
drawDot(g_ctx, g_touchX, g_touchY, 12);
// Prevents an additional mousedown event being triggered
event.preventDefault();
} | [
"function sketchpad_touchStart() {\n // Update the touch co-ordinates\n getTouchPos();\n\n drawLine(ctx, touchX, touchY, $scope.size);\n\n // Prevents an additional mousedown event being triggered\n event.preventDefault()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Postconditions: populate shadows based on groupby or retrieve if cached all possible shadows populated since shadows can be reused Also, continue intializing some item attributes (e.g. isShadow, isShadowed, groupByOffset) | function populateShadows() {
// detect all possible groups
var potentialGroups = {};
var potentialGroupByAttributes = [];
for (var attribute in visible.attributes) {
if (visible.attributes[attribute].type === visible.ATTR_TYPE_CATEGORICAL) {
potentialGroupByA... | [
"function populateShadows() {\r\n // detect all possible groups\r\n var potentialGroups = {};\r\n var potentialGroupByAttributes = [];\r\n\r\n for (var attribute in visible.attributes) {\r\n if (visible.attributes[attribute].type === visible.ATTR_TYPE_CATEGORICAL) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Mixtapes by Date | function getMixtapesByDate(callback){
var response = {"errorMessage":null, "results":null};
try {
mongoClient.connect(database.remoteUrl, database.mongoOptions, function(err, client){
if(err) {
response.errorMessage = err;
callback(response);
}
... | [
"function getBookingsBasedOnDate(date) {\r\n return bookings\r\n .chain()\r\n .find({ 'bookingDateTime': { $regex: date } })\r\n .data({ removeMeta: true });\r\n}",
"function getGamesFromDate(date) {\n const games = getGamesWithScores();\n const gamesOnDate = [];\n\n for (let game of ga... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs a command for the text in the active window. Expects that it can append a filename to 'command' to create a complete kubectl command. | function maybeRunKubernetesCommandForActiveWindow(command) {
var editor = vscode.window.activeTextEditor;
if (!editor) {
vscode.window.showErrorMessage("No active editor!");
return false; // No open text editor
}
var namespace = vscode.workspace.getConfiguration('vs-kubernetes')['vs-kube... | [
"addCLICommand(command) {\n this.janus.cli.addCommand.apply(\n this.janus.cli,\n command\n )\n }",
"command(command) {}",
"addCLICommand(command) {\n this._cli.addCommand(command);\n }",
"function execCommand(command, ui, value) {\n var document = this.getDocument();\n\n var handler... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getSearchesArrayForUsers(users, min, max)(a function that returns an array of searches for an array of users passes by param, the amount of searches for every user is between the min and max values passed by param) | function getSearchesArrayForUser(users, min, max) {
const searchesArrayForUser = new Array(users.length);
for (var i = 0; i < users.length; i++) {
searchesArrayForUser.map(() =>
getSearchesArrayForUser(users[i], getRandomArbitrary(min, max))
);
}
return searchesArrayForUser;
} | [
"function getSearchesArrayForUser(user, amount) {\n const searchArray = new Array(amount)\n .fill()\n .map(() => getSearchForUser(user));\n\n return searchArray;\n}",
"function arrayFromRange(min, max) {\n // your code\n}",
"getusersLimitsForCorporate(_,args){ \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTIONS FOR DIFFERENT TASKS changeCurrentLoc is used to change currentLoc value through export function | function changeCurrentLoc(string) {
currentLoc = string;
console.log(currentLoc);
} | [
"async changeParcelCurrentLocation(req, res) {\n\n try {\n\n } catch (error) {\n\n }\n }",
"updateLocation() {\n this.api.exec('getLocation');\n }",
"function updateLocation(){\n \n}",
"_setLocation(location){\n this.location = location;\n this.notify(UpdateMessage.Relocated);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This class defines a complete listener for a parse tree produced by a_b_aa_b__Q_B_Q_Parser. | function a_b_aa_b__Q_B_Q_Listener() {
antlr4.tree.ParseTreeListener.call(this);
return this;
} | [
"function r__Q_A_Q___Q_B_Q_Listener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"function r_A_A__A_E__Q_X_Q_Listener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"function r__Q_AB_Q__Q_CD_Q_Listener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the priority of a charset. | function $lTqt$var$getCharsetPriority(charset, accepted, index) {
var priority = {
o: -1,
q: 0,
s: 0
};
for (var i = 0; i < accepted.length; i++) {
var spec = $lTqt$var$specify(charset, accepted[i], index);
if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) ... | [
"function getCharsetPriority(charset,accepted,index){var priority={o:-1,q:0,s:0};for(var i=0;i<accepted.length;i++){var spec=specify(charset,accepted[i],index);if(spec&&(priority.s-spec.s||priority.q-spec.q||priority.o-spec.o)<0){priority=spec;}}return priority;}",
"function getCharsetPriority(charset, accepted, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
indicates the user completed a puzzle of given size | function finishedSize(size) {
var puzzleArr = puzzles['size' + size];
if (!puzzleArr || !puzzleArr.length)
return;
// remove the first puzzle
puzzleArr.shift();
// see if we can generate a (few) new one(s)
BackgroundService.kick();
} | [
"function completed() {\n var counter = 1;\n for(var row = 0; row < puzzle.length; row++) {\n for(var col = 0; col < puzzle[row].length; col++) {\n if(puzzle[row][col] == counter) counter++;\n else if (puzzle[row][col] == 0 && row == puzzleSize - 1 && col == puzzleSize - 1) return true;\n else r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Object Object > Boolean Changes a marker at a position on the maze given: newMarkerObj specifying a new marker to place on a tile posn of the marker to change expected: true if marker was changed, false otherwise | changeMarker(newMarkerObj, x, y) {
if (this.getMarker(x, y)) {
this.maze[x + (y * this.tilesWide)] = newMarkerObj;
return true;
}
return false;
} | [
"updateMarker(markerObj, oldPosn, newPosn) {\n if (this.getTile(newPosn.x, newPosn.y) === \"wall\") {\n return false;\n }\n this.maze[oldPosn.x + (oldPosn.y * this.tilesWide)] = OPENING_CHAR;\n this.openings.push(oldPosn.x + (oldPosn.y * this.tilesWide));\n this.maze[ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ajoute la classe frtable__shadowleft ou frtable__shadowright sur frtable en fonction d'une valeur de scroll et du sens (right, left) | scroll () {
const isMin = this.node.scrollLeft <= SCROLL_OFFSET;
const max = this.content.offsetWidth - this.node.offsetWidth - SCROLL_OFFSET;
const isMax = Math.abs(this.node.scrollLeft) >= max;
const isRtl = document.documentElement.getAttribute('dir') === 'rtl';
const minSelector = isRtl ? TableS... | [
"setShadowVisibility (side, scrollPosition) {\n // si on a pas scroll, ou qu'on scroll jusqu'au bout\n if (scrollPosition <= SCROLL_OFFSET) {\n if (side === LEFT) removeClass(this.table, SHADOW_LEFT_CLASS);\n else if (side === RIGHT) removeClass(this.table, SHADOW_RIGHT_CLASS);\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stop game tick for all but Blink. | stopGameTime()
{
this.clockTick = 0;
this.specialEffects.prepareCanvasLayersForEffects();
// Handle effects if Blink is casting a spell
if (this.timeIsStopped)
{
console.log("Stopping");
this.specialEffects.performStopTimeSpecialEffects();
}
... | [
"function stopBlinking() {\n\tclearTimeout(board.blinking);\n}",
"function stopBlink() {\n if (blinker) {\n clearInterval(blinker);\n blinker = null;\n }\n}",
"function stopBlinking () {\n window.clearInterval(blinkInterval);\n svl.ui.leftColumn.sound.removeClass(\"highlight-50\");\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`unparse()` Convert UUID byte array (ala parse()) into a string | function unparse(buf, offset) {
var i = offset || 0, bth = _byteToHex;
return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] ... | [
"function parse(s,buf,offset){var i=buf&&offset||0,ii=0;buf=buf||[];s.toLowerCase().replace(/[0-9a-f]{2}/g,function(oct){if(ii<16){// Don't overflow!\nbuf[i+ii++]=_hexToByte[oct];}});// Zero out remaining bytes if string was short\nwhile(ii<16){buf[i+ii++]=0;}return buf;}// **`unparse()` - Convert UUID byte array (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update options from states or vice versa | sync_options_and_states(update_states) {
var that = this;
var current = that.current;
var options = that.options;
if (update_states) {
current.pos = options.pos || current.pos;
current.data_set = options.data_set || current.data_set;
current.s... | [
"[types.UPDATE_OPTIONS] (state, options) {\n\t\t\tstate.options = Object.assign(state.options, options)\n\t\t}",
"function updateOptions() {\n \t// add the new options\n \tfield.html('');\n \tif (placeholder != undefined) {\n \t\tvar option = $(document.createElement('option'));\n \t\toption.attr('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Looks at a list of dependencies and returns a new list by not including `Opts`. | function createDependenciesWithoutOptsFrom(inject) {
return inject.filter(function (dependency) {
return !/Opt$/.test(dependency);
});
} | [
"getMatchingDevDependencies(options = {}) {\n const includes = options.includes || [];\n const excludes = new Set(options.excludes || []);\n return Object.keys(this.metadata.devDependencies).filter(name => !excludes.has(name) && includes.some(prefix => name.startsWith(prefix)));\n }",
"function extractD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Task generates a js that abstract the environments settings | function generateSettings (done) {
nconf.argv()
.env()
.file({
file: 'www/build/js/settings.js',
format: {
stringify: function (obj, replacer, spacing) {
return 'window.Settings = ' + JSON.stringify(obj, replacer || null, spacing || 2);
},
parse: function(value) {... | [
"function generateConfigScript() {\n const prefixRegexp = /^REACT_APP_/;\n const env = process.env;\n const config = Object.keys(env)\n .filter(key => prefixRegexp.test(key))\n .reduce((c, key) => (Object.assign({}, c, { [key]: env[key] })), {});\n\n console.log(config);\n return `windo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines the template for the Dialog section of the window. By default footerTemplate is null. Property type: any | get footerTemplate() {
return this.nativeElement ? this.nativeElement.footerTemplate : undefined;
} | [
"function dlgTemplate() {\n CUI.rte.Templates[\"dlg-\" + INSERT_DIALOG_CONTENT_DIALOG] =\n Handlebars.compile('<div data-rte-dialog=\"' + INSERT_DIALOG_CONTENT_DIALOG +\n '\" class=\"coral--dark coral-Popover coral-RichText-dialog\">' +\n '<iframe width=\"1100px\" hei... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
attachInfo adds the animal's details on the tile | function attachInfo(removeBeforeAttach) {
const { height, weight, diet, species } = info;
const infoTable = document.createElement("DIV");
infoTable.classList.add("info");
infoTable.setAttribute("id", `${species.replace(" ", "_")}-details`);
const tabledInfo = { height, weight, diet };
//for eac... | [
"renderInformationAdditional() {\n document.getElementsByClassName('pk-name')[0].innerHTML = this.pokemonSelected.Name;\n document.getElementsByClassName('pk-image')[0].setAttribute('src', pathImages + this.pokemonSelected.Image);\n /** Load Information Additional.**/\n document.getEleme... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the global button feedback delay timer. | function setButtonDelay(delay) {
buttonDelay = delay;
} | [
"function timerBtnTooltip(btn) {\n\t\ttiming = setTimeout(function () { hideBtnTooltip(btn) }, 2000);\n\t}",
"function buttonDelay() {\n adviceBtn.disabled = true;\n setTimeout(function () {\n adviceBtn.disabled = false;\n }, 4500);\n }",
"setDelay(delay) {\n this.delay = delay;\n }",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
11. Create a function, `getStringDeets`, that takes in a string and returns an object with specific properties containing information about the string, namely: `firstChar` containing the first character of the string `lastChar` containing the last character of the string `length` containing the length of characters of ... | function getStringDeets(string) {
return {
firstChar: string.charAt(0),
lastChar: string.charAt(string.length - 1),
length: string.length,
shoutedVersion: string.toUpperCase()
};
} | [
"function getJerryInfo(chars) {\n}",
"function Utils(string) {\n this.string = string\n\n this.toUpperEven = function (upper) {\n let string = \" \";\n for (let i =0; i<upper.length;i++){\n if (i%2!==0){\n string+= upper[i].toUpperCase();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove course by ID | function removecourse(id) {
courses = courses.filter(course => course.id !== id);
updateLocalStorage();
init();
} | [
"removeCourse(token, id, idOfCourse) {\r\n return this._call('delete', `course/${id}`, { idOfCourse }, token)\r\n }",
"removeCourse(id) {\r\n return courses().then((courseCollection) => {\r\n return courseCollection.removeOne({ _id: id }).then((deletionInfo) => {\r\n if (delet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get past projects works | function getPastProjects(database = connection) {
let allProjects = database("projects")
.select(
"id",
"user_id",
"name",
"done",
"image_url",
"deadline",
"color",
"purpose",
"friendOneEmail",
"friendTwoEmail"
)
.where("done", "=", true);
retu... | [
"getcurrentprojects() { }",
"function getProjects(){\n\n }",
"function getAndDisplayProjects() {\n console.log('something is happening');\n getRecentProjects(displayProjects);\n}",
"function isWorkingOn(index) {\n var next = projects[index - 1] ? function() { isWorkingOn(index-1) } : collectPr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to recheck what members are on the team before it attempts to host on them, for example if someone has been added or removed from the team. If the API call errors out, then nothing is changed. | function recheckTeamMembers(team, callback) {
var channelsInThisCheck = [];
twitchAPI.getTeamChannels(team, function(error, errorType, response) {
if (!error) {
globalVars.teamLastCheck[team] = moment().unix();
// Compiles an array of channels that are, according this this API call, currently in the tea... | [
"teammembers(data) {\n\t\tif (!data.teamID || !Array.isArray(data.teamID)) { return error('teamID (Array)'); }\n\t\treturn success( require('./queries/teammembers')({ teamID : data.teamID }) );\n\t}",
"function checkTeamAllowance(req) {\n // connect to web client to call api methods such as retreiving info and s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: refactor to match ObjectIndexBase's getRef(), specifically the switch from using the kbase_id or guid to the top level ws, obj info. | getRef() {
if (this.objectRef) {
return this.objectRef;
}
const featureType = this.object.data.feature_type;
const featureId = this.object.data.id;
// e.g. https://ci.kbase.us/#dataview/29768/2?sub=Feature&subid=b0001
const {
... | [
"get ObjectReference() {}",
"function fixupRef(ref) {\n if (jabberwerx.util.isJWObjRef(ref)) {\n //if this reference should not be persisted at all.\n if(ref.shouldBeSavedWithGraph && !ref.shouldBeSavedWithGraph()) {\n return undefined;\n }\n //JW ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates a blocks information based on slider positions Param: new value, attribute, id | function blockInfoSet(n, i, id) {
blockInfo[currBlock[4]][i] = n;
if (id == "densitySl" || id == "viscositySl") {
blockInfo[currBlock[4]][0] = 0.1+0.9*(parseFloat(blockInfo[currBlock[4]][5])+5)*(blockInfo[currBlock[4]][6])/10;
}
blockSet(currBlock[4]);
} | [
"modifyBlock(iBlock, property, value) {\n let blocks = [...this.state.blocks];\n let updateBlock = { ...blocks[iBlock] };\n updateBlock[property] = value;\n blocks[iBlock] = updateBlock;\n if (this._mounted) this.setState({ blocks });\n }",
"function updateBlocks() {\n setlBlock(width);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility method that can be used to hide a given object. | static hide(obj) {
obj.setAttribute('visibility', 'hidden');
} | [
"function hide(obj) {\n\tvar theObj = getObject(obj)\n\ttheObj.visibility = \"hidden\"\n}",
"function hide(obj) {\n var theObj = getObject(obj);\n if (theObj) {\n theObj.visibility = \"hidden\";\n }\n}",
"static hide(obj) {\n obj.setAttribute('visibility','hidden');\n }",
"static hid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Defining a function that saves the updated contact to phonebook | function SaveUpdatedContactToPhonebook()
{
Ti.API.info("SaveUpdatedContactToPhonebook");
// TODO: Replace this with return statement
if(contact == null) alert("Contact must be initialized ya beheema !");
if(OS_IOS) {
Titanium.Contacts.save();
}
else if(OS_ANDROID) {
/* Titanium APIs or Android OS has a b... | [
"saveContact() {\n const contact = this.getContact();\n if (contact.isNew() || contact.isDirty()) {\n contact.save();\n }\n }",
"function saveEditedContact(index) {\n var contacts = getContactsFromLocal();\n var genders = document.getElementsByName('editGender');\n var gender;\n if (gen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
factor : PLUS factor | MINUS factor | NOT factor | INTEGER_CONST | REAL_CONST | BOOLEAN_CONST | LPAREN boolean_expr RPAREN | function_call | variable | factor() {
let startToken = this.currentToken;
try {
let tok = this.currentToken;
let rhs = undefined;
let result = undefined;
switch (this.currentToken.type) {
case Lexer.TokenTypes.INTEGER_CONST:
this.eat(Lexer.TokenTypes.INTEGER_CONST);
return new AST.Int... | [
"factor() {\n var token = this.currentToken;\n var node;\n\n if (token.type === PLUS) {\n this.eat(PLUS);\n node = this.factor();\n return new UnaryOp(new Token(PLUS, 'u+'), node);\n }\n\n if (token.type === MINUS) {\n this.eat(MINUS);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes old log file | function removeFile(file) {
if (file.hash ===
crypto
.createHash(file.hashType)
.update(file.name + 'LOG_FILE' + file.date)
.digest('hex')) {
try {
if (fs.existsSync(file.name)) {
fs.unlinkSync(file.name);
}
}
... | [
"_clearLogFile() {\n\t\tfs.writeFileSync(this.logFile, '');\n\t}",
"function removeFile(file){\n if(file.hash === crypto.createHash('md5').update(file.name + \"LOG_FILE\" + file.date).digest(\"hex\")){\n try{\n fs.unlinkSync(file.name);\n }catch(e){\n console.error(new Date(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a binary buffer to an ASCII hex string | function binaryBufferToAsciiHexString(binBuffer) {
var str = "";
for (var index = 0; index < binBuffer.length; index++) {
var b = binBuffer[index];
str += binaryByteToAsciiHex(b);
}
return str;
} | [
"function buf2hex(buffer) { // buffer is an ArrayBuffer\n\treturn Array.prototype.map.call(new Uint8Array(buffer), x => ('00' + x.toString(16)).slice(-2)).join('');\n}",
"function _hexBuffer(text){ return Buffer.from(text, 'hex') }",
"async function buf2hex(buffer) { // buffer is an ArrayBuffer\n\tawait updateS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
highlights the selectable privileges | function controlPrivilegeHighlighting(element){
var activegroup = $(element).attr('class');
var groupelementcount = $('.'+activegroup).length;
var i=1;
if($(element).is(':checked')){
for(i;i<groupelementcount;i++){
$('#'+activegroup+i).removeAttr('disabled');
}
}else{
... | [
"function accessRemoveAndHighlight(){\n\tglobalAccessId = [];\n\t$(\".trUser\").on(\"click\",function(){\n\t\tvar val = $(this).attr('uid');\n\t\tif($.inArray(val, globalAccessId) == -1){\n\t\t\tglobalAccessId.push(val);\n\t\t\tconsole.log('Global: ',globalAccessId);\t\n\t\t\t$(this).addClass('highlight');\n\t\t}el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the body of the given function as an escaped string with single quotes pre and appended. | function getBody(fn) {
var s = fn.toString();
var body = s.slice(s.indexOf('{')+1, s.lastIndexOf('}'));
body = body.replace(/[\r\n]/g,'');
body = body.replace(/^\s*/,'');
body = body.replace(/\s*$/,'');
body = escape(body);
body = '\'{ ' + body + ' }\'';
return body;
} | [
"function getFunctionBody(f) {\n return f.toString(2)\n // take function body - https://stackoverflow.com/a/14886101/1121497\n .match(/function[^{]+\\{([\\s\\S]*)\\}$/)[1]\n // remove indentation\n .split('\\n').map(line => line.substring(4)).join('\\n')\n .trim();\n}",
"function _getF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function called when the user use github auth | function onGit() {
const provider = new firebase.auth.GithubAuthProvider();
firebase.auth().signInWithPopup(provider)
.then(result => {
const user = result.user;
createUser(user);
})
.catch(console.log)
} | [
"function callback() {\n console.log(\"github-auth called back! \\\\o/\");\n\n // TODO: Set $:/status/OAuth/UserName et al\n}",
"function cogerInfoGithub(){\n hello.init({\n github : 'ab19246dc65c63df54c4'\n },{\n redirect_uri : 'redirect.html',\n oauth_proxy : 'https://auth-server.he... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Provides a strong type guard for ARN's of Lambda _functions_ specifically. Note: this typeguard is often the best choice but because `AwsArn` can't provide typing down to the _resource_ level, the resulting type will not fit into broader `AwsArn` type. Use the more general `isLambdaArn()` if you want this. | function isLambdaFunctionArn(arn) {
return /arn:aws(-cn|-us-gov)*:lambda:[\w-]+:(\d+):function:.*/.test(arn);
} | [
"function isLambdaArn(arn) {\r\n return /arn:aws(-cn|-us-gov)*:lambda:[\\w-]+:(\\d+):.*:.*/.test(arn);\r\n}",
"function isArn(arn) {\r\n return /arn:(aws|aws-cn|aws-us-gov):(.*):/.test(arn);\r\n}",
"function isStepFunctionArn(arn) {\r\n return /arn:(aws|aws-cn|aws-us-gov):states:.*:stateMachine/.test(a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigate to given url with validation to insure the navigation actually happened | function navigateToUrl(url) {
Reporter_1.Reporter.debug(`Navigate to ${url}`);
tryBlock(() => browser.url(url), `Failed to navigate to ${url}`);
expectCurrentUrl(url);
} | [
"function checkURL() {\r\n\tif (location.href !== prevUrl) {\r\n\t\tprevUrl = location.href\r\n\t\thasNavigated = true\r\n\t\tonNavigate()\r\n\t}\r\n}",
"function navigateToUrl(url) {\n Reporter_1.Reporter.debug(`Navigate to '${url}'`);\n tryBlock(() => browser.url(url), `Failed to navigate to '${ur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dump the content of the class as text template. It can be used after each build call, otherwise it has an undefined behaviour. | dump () {
return classTemplate(this._name, this._body, this._head).substring(1)
} | [
"generateTemplate() {\n let template = 'class @{className} {\\n';\n\n this.methodList.forEach((method) => {\n template += '\\n\\t/**\\n';\n template += `\\t* ${method.comment}\\n`;\n template += `\\t**/\\n`;\n template += `\\t${method.name}(${method.param})`... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new `DOMTokenList`. | static _create(element, attribute) {
return new DOMTokenListImpl(element, attribute);
} | [
"function create_domTokenList(element, attribute) {\n return DOMTokenListImpl_1.DOMTokenListImpl._create(element, attribute);\n}",
"function TokenList() {\n var array = []\n array.toCSSString = TokenListToCSSString\n return array\n }",
"function TokenList(){\n this._items = [];\n this._cursor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::IoTEvents::DetectorModel.ResetTimer` resource | function cfnDetectorModelResetTimerPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDetectorModel_ResetTimerPropertyValidator(properties).assertSuccess();
return {
TimerName: cdk.stringToCloudFormation(properties.timerName),
};
} | [
"function cfnDetectorModelSetTimerPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnDetectorModel_SetTimerPropertyValidator(properties).assertSuccess();\n return {\n DurationExpression: cdk.stringToCloudFormation(properties.durationEx... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
groupBy :: (a > a > Boolean) > Array a > Array (Array a) . . Splits its array argument into an array of arrays of equal, . adjacent elements. Equality is determined by the function . provided as the first argument. Its behaviour can be surprising . for functions that aren't reflexive, transitive, and symmetric . (see [... | function groupBy(f) {
return function(xs) {
if (xs.length === 0) return [];
var x0 = xs[0]; // :: a
var active = [x0]; // :: Array a
var result = [active]; // :: Array (Array a)
for (var idx = 1; idx < xs.length; idx += 1) {
var x = xs[idx];
if (f (x0) (x)... | [
"function group(xs){\r\n return groupBy(Eq.eq, xs);\r\n}",
"function groupBy(array, fn) {\n const group = {};\n array.forEach(element => {\n const key = fn(element);\n if (!(key in group)) {\n group[key] = [];\n }\n group[key].push(element);\n });\n return group;\n}",
"function groupAny(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the function takes two arguments an array of drivers and either returnLastTwoDrivers or returnLastTwoDrivers are the argumnets selectDifferentDrivers() | function selectDifferentDrivers(drivers, selectingDrivers) {
return selectingDrivers(drivers);
} | [
"function selectDifferentDrivers(arrayDr, fun ){\n if(fun===returnFirstTwoDrivers)\n return returnFirstTwoDrivers(arrayDr);\n if(fun===returnLastTwoDrivers)\n return returnLastTwoDrivers(arrayDr);\n }",
"function selectDifferentDrivers(arrStrDrivers, cb) {\n return cb(arrStrDrivers);\n}",
"function return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a classic switch statement for months :D, this assigns the value of items array based on the filtered result of unfilteredItems array | determineMonth(e) {
switch (this.state.month) {
case 'January':
this.setState({
items: this.state.unfilteredItems.filter(item => item.date.substring(5, 7) === '01')
})
break;
case 'February':
this.setStat... | [
"function completeByMonth(items) {\n\t var monthDetails = {}, completeByMonthItems = [], maxCompleteMonth = 0, itemYears = obj.endingYears(items), i = itemYears.length;\n\t //build comlpeteByMonths object.\n\t while(i--) {\n\t //chuck the null end date. push the year ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get next text inline | getNextTextElement(inline) {
if (inline.nextNode instanceof TextElementBox) {
return inline.nextNode;
}
if (!isNullOrUndefined(inline.nextNode)) {
return this.getNextTextElement(inline.nextNode);
}
return undefined;
} | [
"getNextTextInline(inline) {\n if (inline.nextNode instanceof TextElementBox) {\n return inline.nextNode;\n }\n if (inline.nextNode instanceof FieldElementBox && (HelperMethods.isLinkedFieldCharacter(inline.nextNode))) {\n if (inline.nextNode.fieldType === 1 || inline.next... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
WITHDRAWALS LIST VIEW ////////// WITHDRAWALS LIST VIEW | function WithdrawalsListView() {
var view = util.newObject(WithdrawalsListView);
view.el = $(tmpl.render("treasury_withdrawals_list", {})).wrapDiv();
view.bindEvents();
view.updateWithdrawals();
return view;
} | [
"function sugarListView() {\n}",
"function LibraryListView() {\n}",
"renderListings() {\n return listings.map((listing, index) => {\n return (\n <View key={`listing-${index}`}>\n <Listings \n key={`listing-item-${index}`}\n title={listing.title}\n boldTit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if we have any form ID and a readable post payload. | hasFormId() {
return this.hasValidPayload() && this.getFormId();
} | [
"get isPayload(): boolean {\n return (\n (!!this.postback && typeof this.postback.payload === 'string') ||\n (!!this.quickReply && typeof this.quickReply.payload === 'string')\n );\n }",
"get isPayload() {\n return !!this.postback && typeof this.postback.payload === 'string' || !!this.quickRep... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
move mail to its default folder | function moveToDefaultFolder(id, folderId, currentFolderId){
logInfo("moveToDefaultFolder fired");
setBusy();
var matchString;
//alert("start x");
if ((currentFolderId * 1) == (folderId * 1)){
alert("folders equal");
}else{
//alert("moving");
var url="ajaxMoveMail.pl?folderId=" + fol... | [
"function moveMails(mails, targetFolder, callback) {\n var options = { target: btoa(targetFolder) };\n for (var i = 0; i < mails.length; i++) {\n var key = \"emails[\" + mails[i].folder_base64 + \"][]\";\n if (options[key] !== undefined)\n options[key].push(mails[i].uid);\n else\n options[key] ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
link a workflow entry to the respective PROV objects | function linkToProv( wfEntry, actId, resultId ) {
// the respective activity
wfEntry[ symbols.linkedActivity ] = actId;
wfEntry[ symbols.linkedResult ] = resultId;
} | [
"click(e) {\n\n fetch('/api/workflows',\n {\n method: 'post',\n credentials: 'include',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n 'X-CSRFToken': csrfToken\n },\n body: JSON.stringify({name: \"New Workflow\"}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read variablelength string from input. | read_varstring() {
let size = this.read_varint32();
return this.read_string(size);
} | [
"readString(length){let stringBytes;if(void 0!==length){if(length<0)throw new RangeError(\"Length of the string to read must be positive.\");if(this.__offset+length>this.__data.length)throw new RangeError(`Trying to read ${length} bytes from offset ${this.__offset} exceeds the length of the data.`);stringBytes=this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsGet | repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsGet(
incomingOptions,
cb
) {
const Bitbucket = require('./dist');
let apiInstance = new Bitbucket.DefaultApi();
apiInstance.repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsGet(
(error, data, ... | [
"repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsTestCasesGet(\n incomingOptions,\n cb\n ) {\n const Bitbucket = require('./dist');\n\n let apiInstance = new Bitbucket.DefaultApi();\n apiInstance.repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsTest... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ANCHOR Global functions Returns the ID of an attribute with the name provided, if one is found. | function getAttrID(name, characterID) {
const attrs = findObjs({
_type: 'attribute',
_characterid: characterID,
name: name,
});
if (attrs === undefined || attrs[0] === undefined) {
return undefined;
}
return attrs[0].id;
} | [
"findAttribute(name, attributes) {\r\n return attributes[name] || 0\r\n }",
"function findAttribute(name){\n var attrs = findObjs({\n _type: \"attribute\",\n \t _name: name,\n _characterid: ChameleonChar.id\n\t});\n \n return attrs[0];\n}",
"findAttribute(nam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build the url for the the given reflection and all of its children. | static buildUrls(reflection, urls) {
const mapping = DefaultTheme.getMapping(reflection);
if (mapping) {
if (!reflection.url ||
!DefaultTheme.URL_PREFIX.test(reflection.url)) {
const url = [
mapping.directory,
DefaultThe... | [
"buildUrls(reflection, urls) {\n const mapping = this.mappings.find((mapping) => reflection.kindOf(mapping.kind));\n if (mapping) {\n if (!reflection.url || !MarkdownTheme.URL_PREFIX.test(reflection.url)) {\n const url = this.toUrl(mapping, reflection);\n urls.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get /lists/points/top all lists in order of points | function getAllByOrder() {
return db('lists')
.select('*')
.where('public', true)
.orderBy('list_points', 'desc')
} | [
"async function getTopPoints() {\n \treturn new Promise(resolve => {\n \tusersDB.find({}).sort({ points: -1 }).exec(function (err, docs) {\n \t\t// docs is [doc1, doc3, doc2];\n \t\tresolve(docs)\n \t});\n \t})\n}",
"function getAllByOrder() {\n return db('lists')\n .select('*')\n .orde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function count the number of all DIVs in given HTML fragment passed as string. | function countDivs(html){
var count=0;
var index = 0;
while (html.indexOf('<div', index) != -1) {
count++;
index = html.indexOf('<div', index) + 1;
}
document.getElementById('content').innerHTML =count;
} | [
"function divCount(str) {\r\n let pattern = /(<div>)/g;\r\n return [...str.matchAll(pattern)].length;\r\n}",
"function countDiv() {\n\tvar arrDiv = document.getElementsByTagName('div');\n\treturn arrDiv.length;\n}",
"function countDivs () {\n\t'use strict';\n\n\t// I don't use div's\n\tdocument.getElement... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an event and an outlet (where the outlet is the event's input_outlet), determine if an action should be triggered. Compares the event's threshold value and direction with the outlet's appropriate sensor value. | function shouldTriggerAction(event, outlet) {
var thresholdDirection = event.input_threshold;
var threshold = null;
var testValue = null;
if (event.input === 'time') {
// Compare the hours of the current time and the saved hour value.
testValue = (new Date()).getHours();
threshold = (new Date()).setHours(even... | [
"triggerTest() {\n if (\n this.this.isAboveThreshold &&\n this.this.isTimerActive &&\n this.getCurr().length < MAX_TRIGGER_AMOUNT\n ) {\n this.triggerAction();\n console.log('ACTION');\n }\n }",
"function checkGesture()\n{\n // if a gesture is occuring, sample gesture parameter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROBLEM 2//////////////////// / Create a function called 'greaterThanFive' that takes in a single parameter called 'number'. Check to see if 'number' is greater than 5. If it is, return a true boolean. If it's not, return a false boolean. CODE HERE | function greaterThanFive(number){
if(number > 5){
console.log("true")
}
else{console.log("false")}
} | [
"function greaterThanFive(number) {\n if (number > 5) {\n return true;\n } else {\n return false;\n }\n}",
"function greaterFive(x) {\n if (x > 5) return true;\n else return false;\n}",
"function greaterThanFive() {\n var userNumber = parseInt(prompt(\"Please enter a number\"));\n return us... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
User can chooose which account to open first | function chooseAccount(){
// User action - Deposit or Withdraw money
let ChooseAccount = prompt('Do you want to Deposit or Withdraw? dep or with');
if(ChooseAccount == 'dep'){
depositAcc();
}else if(ChooseAccount == 'with');
Withdraw();
} | [
"openAccount() {\n const { openAccount } = this.props;\n if (openAccount) {\n openAccount();\n }\n }",
"function activateAccount() {\n\n REQUESTS.activateAcct(Q_STRING, () => { showSuccess() }, err => {\n\n if (err.status === 410) {\n showFailed(...EXPIRED);\n } else if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
spawn a new worker to load a specific module. register the worker with the event dispatcher/ returns a deferred object which is fired when the thread is loaded | function spawn(module, callback, errorback) {
var p, initialModuleListener, guid, worker;
if(Worker) {
// create a callback holder
p = create(promise).init();
p.then(callback || false, errorback || false);
// create a new worker and register it's onmessage function
worker ... | [
"function workerBootstrap() {\n var modules = Object.create(null);\n\n // Handle messages for registering a module\n function registerModule(ref, callback) {\n var id = ref.id;\n var name = ref.name;\n var dependencies = ref.dependencies;if (dependencies === void 0) dependencies = [];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The idea is to allow minute movements within an expanded bounding box before updating the list of breweries. Any time the map displays outside of this expanded bounding box, then update the list. Idea 1: Calculate a +/ nmile radius around the center of the map, and any time the center moves outside of that radius, then... | handleMoveEnd(e) {
const mapElement = e.target;
const newCenter = mapElement.getCenter();
const centerPoint = this.state.centerPoint;
const mileRadius = 1 / 69.172;
try {
// If no center point exists, or the center point has moved more than one mile from
// it's original position, then ... | [
"boundsChanged() {\n elAddin.$refs.mapRef.$mapPromise.then((map) => {\n let bounds = map.getBounds();\n\n var center = bounds.getCenter();\n var ne = bounds.getNorthEast();\n\n // r = r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dropdown view ============= Construct Dropdown object. element Textarea or contenteditable element. | function Dropdown(element, completer, option) {
this.$el = Dropdown.createElement(option);
this.completer = completer;
this.id = completer.id + 'dropdown';
this._data = []; // zipped data.
this.$inputEl = $(element);
this.option = option;
// Override setPosition method.... | [
"function Dropdown(element, completer, option) {\n this.$el = Dropdown.createElement(option);\n this.completer = completer;\n this.id = completer.id + 'dropdown';\n this._data = []; // zipped data.\n this.$inputEl = $(element);\n this.option = option... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return whether lrv < rrv | function rngLess (lrv, rrv) {
return (rngComp(lrv, rrv) < 0);
} | [
"function rlt(val1,val2){\n return val1 < val2;\n }",
"lt(other) { return this.cmp(other) < 0; }",
"lte(other) { return this.cmp(other) <= 0; }",
"lt(otherAmt) {\n return this.cmp(otherAmt) < 0;\n }",
"function lt(left, right) {\n return compare(left, right) < 0;\n}",
"function Object$pro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extend the current buffer if needed to make sure we can store num bytes. | extend_if_needed(num) {
if ((this.buffer.length - this.size) < num) {
let new_buffer = new Uint8Array(this.size + num * 2);
new_buffer.set(this.buffer);
this.buffer = new_buffer;
}
} | [
"_grow(numBytes) {\n const remainder = numBytes % constants.BUFFER_CHUNK_SIZE;\n if (remainder > 0) {\n numBytes += (constants.BUFFER_CHUNK_SIZE - remainder);\n }\n const buf = Buffer.alloc(numBytes);\n this.buf.copy(buf);\n this.buf = buf;\n this.maxSize = this.size = numBytes;\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Analyzes the image stored at fileName with the callback onAnalysisComplete(err, analysis). analyzeCallback = function(err, analysis); | function analyzeImage(args, fileName, analyzeCallback) {
var
request = require('request'),
async = require('async'),
fs = require('fs'),
gm = require('gm').subClass({
imageMagick: true
}),
analysis = {};
async.parallel([
function (callback) {
// Write down meta data about ... | [
"function analyzeImage(args, fileName, analyzeCallback) {\n var\n request = require('request'),\n async = require('async'),\n fs = require('fs'),\n gm = require('gm').subClass({\n imageMagick: true\n }),\n analysis = {};\n async.parallel([\n function (callback) {\n // Write down m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
use for the goLocal Box on Mplus topic pages, merely decides whether or not to open the FoLocal Url in a popup or not. | function goLocalPage(url){
if(url)
{
//if the site is hosted, go there else pop open window
if (url.indexOf('nlm.nih.gov') > 0)
location.href=url;
else
{
openOutWin(url);
}
}
return false;
} | [
"function tourpopup()\n{\t\n\tMM_openBrWindow('/admission/flash/onlinetour_detect.html','flashpopup','width=768,height=500');\n\treturn false;\n\twindow.focus()\n}",
"function openPopup(url, name, features)\n{\n var requestParameterPrefix = ( url.indexOf(\"?\") >= 0 ) ? \"&\" : \"?\"; \n window.open( url ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displays the overview of slides (quick nav) by scaling down and arranging all slide elements. Experimental feature, might be dropped if perf can't be improved. | function activateOverview() {
// Only proceed if enabled in config
if (config.overview) {
// Don't auto-slide while in overview mode
cancelAutoSlide();
var wasActive = dom.wrapper.classList.contains('overview');
dom.wrapper.classList.add('overview');
... | [
"function updateOverview() {\n\n\t\tvar vmin = Math.min( window.innerWidth, window.innerHeight );\n\t\tvar scale = Math.max( vmin / 5, 150 ) / vmin;\n\n\t\ttransformSlides( {\n\t\t\toverview: [\n\t\t\t\t'scale('+ scale +')',\n\t\t\t\t'translateX('+ ( -indexh * overviewSlideWidth ) +'px)',\n\t\t\t\t'translateY('+ ( ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inverts the direction of the shield bar | function invertShieldBar() {
var shieldBox = document.getElementById('shieldBox');
var shieldTextBox = document.getElementById('shieldTextBox');
switch(shieldTextBox.style.left) {
case '46%':
shieldBox.style.transform = 'rotate(180deg)';
shieldTextBox.style.transform = 'rotate(180deg) skewX(45deg)';
shie... | [
"invertDirection(){\n this.setVelocity(\n this.getVelocity().map(x=>x * (-1))\n );\n }",
"function disableShields() {\n playerShip.shield = `off`;\n enemy.shield = `off`;\n}",
"reverseX(){ this.dx = -this.dx; }",
"function invertDrag() {\n viewer.controls.rotateSpeed = -viewer.controls.ro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a mission number and the pick number, returns the people on that mission pick If pickNum is 1, then returns the people on the last pick of that mission | function getPlayersOnMissionPickAndLeader(missionNum, pickNum = -1) {
if (!gameData.voteHistory) {
return;
}
// We need a player key to see vote history to get the number of picks in the mission
const firstPlayerKey = Object.keys(gameData.voteHistory)[0];
// The first case prevents us from erroring when... | [
"function computerPick(number){\n return ['cat', 'person', 'catnip'][number];\n}",
"function pickCandidate(party) {\r\n console.log(party);\r\n if (party === 'Democrat') {\r\n let index = Math.floor(Math.random()*democratCandidates.length)\r\n // console.log(index)\r\n let pick = democ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get nav item indexes per items add 1 more if the nav items cann't cover all slides [0, 1, 2, 3, 4] / 3 => [0, 3] | function getVisibleNavIndex(){// reset visibleNavIndexes
visibleNavIndexes=[];var absIndexMin=getAbsIndex()%items;while(absIndexMin<slideCount){if(carousel&&!loop&&absIndexMin+items>slideCount){absIndexMin=slideCount-items;}visibleNavIndexes.push(absIndexMin);absIndexMin+=items;}// nav count * items < slide count means... | [
"function getVisibleNavIndex () {\n // reset visibleNavIndexes\n visibleNavIndexes = [];\n\n var absIndexMin = getAbsIndex()%items;\n while (absIndexMin < slideCount) {\n if (carousel && !loop && absIndexMin + items > slideCount) { absIndexMin = slideCount - items; }\n visibleNavIndexes.push(a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The instance of a component used for the modal content. When a `TemplateRef` is used as the content or when the modal is closed, will return `undefined`. | get componentInstance() {
if (this._contentRef && this._contentRef.componentRef) {
return this._contentRef.componentRef.instance;
}
} | [
"get componentInstance() {\n const nativeElement = this.nativeNode;\n return nativeElement &&\n (getComponent(nativeElement) || getOwningComponent(nativeElement));\n }",
"get componentInstance() {\n const nativeElement = this.nativeNode;\n return nativeElement && (getComponent(na... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Overload this for asynchronous bindings or bindings that recursively apply bindings (e.g. components, foreach, template). A binding should be complete when it has run through once, notably in serverside bindings for prerendering. | get bindingCompleted () { return true } | [
"function bindAsync(left,arg) {\n if (opts.es6target && !left.id && !arg && left.type.indexOf(\"Function\")===0) {\n left.type = 'ArrowFunctionExpression' ;\n return left ;\n }\n\n if (opts.noRuntime) {\n if (arg) {\n if (examine(arg).isLiteral) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if currentVersion (e.g. "3.12.1") is greater or equal than thresholdVersion (e.g. "3.10") | function versionIsAtLeast(currentVersion, thresholdVersion) {
currentVersion = currentVersion.split('.');
thresholdVersion = thresholdVersion.split('.');
// iterate over three version levels ("major.minor.patch")
for( var i = 0 ; i < 3 ; ++i ) {
// sanitize version levels
currentVersion[i] = currentVersion[i] ... | [
"function versionIsGreaterOrEqual(desiredVersion, actualVersion) {\n const versionExpression = /\\^?(\\d+)\\.(\\d+)\\.(\\d+)/;\n const desiredVersionParts = versionExpression.exec(desiredVersion);\n const desiredMajor = Number(desiredVersionParts[1]);\n const desiredMinor = Number(desiredVersionParts[2]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to click on new board. | onClickNewBoard() {
commonActions.click(this.createNewBoardButton);
return new boardForm();
} | [
"function createBoardItemClick(){\n\t// Select box items\n\tlet $boardItem = $('#board');\n\t$boardItem.on('click','.box',function(event){\n\t\t// Grab the coordinates of the box selected\n\t\tlet x = $(this).attr(\"x\");\n\t\tlet y = $(this).attr(\"y\");\n\t\t// Pass dom object and x and y coordinates to move func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
== Step 3: Surface Area Method == Create another method using CuboidMaker's prototype that returns the surface area of a given cuboid's length, width, and height. Formula for cuboid surface area of a cube: 2 (length width + length height + width height) | surfaceArea() {
return 2 * (this.length * this.width + this.length * this.height + this.width * this.height);
} | [
"function areaOfCube(length, width, height){\n area = length * width * height;\n return area;\n}",
"function areaOfCube (l, w, h) {\n area = l * w * h\n return area;\n}",
"cubeSurfaceArea (){\n return 6 * (this.length * this.length)\n}",
"function surfaceAreaCube(side){\n // let sixCube = (side... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets an URL for a cropped version of the image (based on the current configuration) | function getImageUrl(item) {
return item.$image ? item.$image.image + '?width=' + scope.cfg.image.width + '&height=' + scope.cfg.image.height + '&mode=crop' : null;
} | [
"function mws_crop_image(url, width, height) {\n width = (width ? width : 100);\n height = (height ? height : false);\n switch (false) {\n case !/images.unsplash.com/.test(url):\n url = url.split(/[?#]/)[0] + \"?fm=webp&fit=crop\";\n url += \"&w=\" + width + (height ? \"&h=\" + height : \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this calculates the time that the Bot needs to write a msg | function msgSizeTimer(msgContent) {
let awrageCharactersPerMinute = 1150; // http://typefastnow.com/average-typing-speed
let typingTime = Math.floor((JSON.stringify(msgContent).length * 1000) / (awrageCharactersPerMinute/60));
typingTime /= 2;
return typingTime
} | [
"function msgSizeTimer(msgContent) {\n let awrageCharactersPerMinute = 1150; // http://typefastnow.com/average-typing-speed\n let typingTime = Math.floor((JSON.stringify(msgContent).length * 1000) / (awrageCharactersPerMinute/60)); \n return typingTime\n }",
"function calcTimeToWait(msg) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |