query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Refresh only main tagTree. | refreshMainTagTree() {
let $currentTagTree = $('#tree-container').find('.tagtree-widget')
if ($currentTagTree.length) {
let postData = {
_token: this.ajaxToken,
_action: 'requestMainTagTree',
}
let url = this.routes.tagsTreeAjax
... | [
"refreshMainFolderTree() {\n let $currentFolderTree = $('#tree-container').find('.foldertree-widget')\n\n if ($currentFolderTree.length) {\n let postData = {\n _token: this.ajaxToken,\n _action: 'requestMainFolderTree',\n }\n\n let url = t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
boatInfo.rollOrSwim (coll: Collision2D ARF 4.21.14 INPUT: Accepts a Collision2D object RETURN: TRUE if object rolls; FALSE if object swims FEEDBACK: > clients with poor rolls should not be assigned to boats with low rollability > | function swimOrRoll(coll: Collision2D)
{
//return true;
//SET variables
var results = calcSum("swim");
var sumTest =results.x; //the sum of all factors for the flip decision [0-30]
var outlier = results.y; //indicator if there were outliers causing definite outcome 1= flip, 2= no flip)
//IF - ELSE IF - ... | [
"function flipOrBounce(coll: Collision2D)\n{\n\t//TODO: Add additional logic to chance percentages based on collision with different object types\n\t//if (coll.gameObject.tag == \"rock\")\n\t\t\n\t//SET variables \n\tvar results = calcSum(\"flip\");\n\tvar sumTest =results.x; \t\t//the sum of all factors for the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================================================ These are the message & reportfetching functions ============================================================================================================ This runs when the results from the next page load | function onNextLoad(response){
var txt = response.responseText;
// This is where we'll put the table
var temp_table = document.createElement('table');
if (run_type == 'report'){
debug(d_low, "Got a new page of reports");
//dbg(txt);
// this should extract just the table html
txt = txt.... | [
"function writeMessagesForPage() {\n clientErrorStorage = new Object();\n var summaryTextExistence = new Object();\n var page = jQuery(\"[data-type='Page']\");\n var pageId = page.attr(\"id\");\n var data = getValidationData(page, true);\n\n calculateMessageTotals(pageId, data);\n if (prevPageM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
list directory, skipping hidden files | function listDir(dir) {
return fs.readdirSync(dir)
.filter(function(file) {
return file.indexOf('.')!=0;
});
} | [
"static readdirSync (dir) {\n return fs.readdirSync(dir)\n .map( entry => {\n let entry_path = path.join(dir, entry)\n let entry_stat = fs.lstatSync(entry_path)\n if ( entry_stat.isDirectory() ) return Walk.readdirSync(entry_path)\n return entry_path\n })\n .reduce((entries, result) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A debug/testingoriented summary of all styling entries for a `DebugNode` instance. | function DebugStyling() { } | [
"function applyStyles() {\n let debugStyles = \"\";\n\n // Generate styles for debug selectors:\n if (options.debugSelectors.length > 0) {\n options.debugSelectors.forEach((debugClass) => {\n if (!isValidClass(debugClass)) {\n return;\n }\n\n var elements = document.querySelectorAll(`.${... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does a shallow comparison for props and state. See ReactComponentWithPureRenderMixin See also | function shallowCompare(instance, nextProps, nextState) {
return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
} | [
"shouldComponentUpdate(nextProps, nextState) {\n return nextState.tipState !== this.state.tipState\n }",
"function statesEqual (a, b) {\n return deepEquals(a, b)\n}",
"shouldComponentUpdate(nextProps) {\n if (nextProps.currentWeek == this.props.currentWeek && shallowArrayElementsEqual(this.pro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check consequences of player actions (tryCell and toggleFlag or handleLeftClickOnCell and handleRightClickOnCell according to situation) test revealGrid in different setup to assure that it works properly test victory, defeat, and playing conditions | function useGame({
initialGrid,
generateGrid,
rows,
columns,
mines,
}) {
const [playGrid, setPlayGrid] = useState(
Array(rows)
.fill(null)
.map(() => Array(columns).fill(null)),
);
const [gameState, setGameState] = useState('playing');
/**
* Function to call when left click on cel... | [
"function checkWinStates() {\n const xtop = /XXX....../; // x top row\n const xmid = /...XXX.../; // x middle row\n const xbot = /......XXX/; // x bottom row\n const xldg = /X...X...X/; // x left to right diagonal\n const xrdg = /..X.X.X../; // x right to left diagonal\n const xlco = /X..X..X../; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes Blockly.Language with only those blocks for which there are JavaScript generators and blocks that support mutators. When this function completes Blockly.Language should contain all builtin blocks plus whatever AI Components are set here. NOTE: Blockly.WholeLanguage is created in quizmeinitblocklyeditor.js | function initQuizmeLanguage() {
if (DEBUG) console.log("RAM: initQuizmeLanguage ");
var whitelist = [];
whitelist = whitelist.concat(MATH_BLOCKS).concat(LOGIC_BLOCKS).concat(VARIABLES_BLOCKS).concat(PROCEDURES_BLOCKS);
whitelist = whitelist.concat(CONTROLS_BLOCKS).concat(LISTS_BLOCKS).concat(TEXT_BLOCKS).conc... | [
"function resetBlocklyLanguage() {\n\n Blockly.Language.setTooltip = function(block, tooltip) { \n block.setTooltip(\"\");\n }\n Blockly.Language.YailTypeToBlocklyTypeMap = {\n 'number':Number,\n 'text':String,\n 'boolean':Boolean,\n 'list':Array,\n 'component':\"COMPONENT\",\n 'InstantInTi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
END UPDATE SEARCH ADD SETTERS/GETTERS _assignValuesToCombo formats data for form combo component | function _assignValuesToCombo(object) {
var comboValues = Array();
try {
for (var i = 0; i < object.comboIds.length; i++) {
comboValues.push({
id: object.comboIds[i],
name: object.comboNames[i]
});
}
return comboValues;
} catch (e) {
_self.emit("... | [
"function _assignValuesToCombo(object) {\n var comboValues = Array();\n\n try {\n for (var i = 0; i < object.comboIds.length; i++) {\n comboValues.push({\n id: object.comboIds[i],\n name: object.comboNames[i]\n });\n }\n\n return comboValues;\n } catch (e) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if the cell the player is going to contains the key if the cell is of type key, key gained is set to true and gate is opened | checkForKey (futureLocation) {
const isKeyType = this.board.getCell(futureLocation).getType()
if (isKeyType === 'key') {
this.keyGained = true
return true
} else {
return false
}
} | [
"isHeld(key) {\n if(!this.keyStates[key]) {\n return false;\n }\n return this.keyStates[key].isPressed;\n }",
"function checkDoorKey(p_sprite, door, game) {\n\tfor (var index in p_sprite.entity.key_ring) {\n\t\tif (p_sprite.entity.key_ring[index] == door.key) {\n\t\t\tdoor.kill(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
member function hitLWall(xpos) applies a collision between the enemy and a wall to the left params: xpos:Number the xposition of the left wall | hitLWall(xpos){
if(Math.abs(this.vel.x) > 2)
sfx_enemybump.play();
this.pos.x = xpos + this.getCol().size.x / 2;
this.vel.x = this.bounceFriction * Math.abs(this.vel.x);
if(!this.seeking)
this.mov = 0;
} | [
"hitLWall(xpos){\n\t\tthis.pos.x = xpos + this.getCol().size.x / 2;\n\t\tthis.vel.x = 0;\n\t}",
"function left_wall_force(pos_x, radius, elastic_constant=constant.elastic) {\r\n let edge_at = pos_x - radius\r\n if (edge_at < 0) {\r\n return Math.abs(edge_at) * elastic_constant\r\n }\r\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get user account data by Email. Exclude password unless 'includePassword' is true | async function getUserByEmail(email, includePassword) {
const db = getDBReference();
const collection = db.collection('users');
const projection = includePassword ? {} : {password: 0};
const results = await collection
.find({email: email})
.project(projection)
.toArray();
return results[0];
} | [
"async getUserDetailsByEmail(email) {\r\n\t\ttry {\r\n\t\t\tlet user = await UserModel.findOne({\r\n\t\t\t\temail: email,\r\n\t\t\t\tdeletedAt: null,\r\n\t\t\t\tdeletedBy: null,\r\n\t\t\t}).select(\"+password\");\r\n\t\t\tif (\r\n\t\t\t\t!_.isEmpty(user) &&\r\n\t\t\t\tuser.email.toLowerCase() !== email.toLowerCase(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate distance between two vectors | function distance(v1, v2) {
return Math.sqrt(Math.pow(v2.X - v1.X, 2) + Math.pow(v2.Y - v1.Y, 2));
} | [
"function vectorLength([[x1, y1],[x2, y2]]){\n return Math.sqrt(Math.pow((x1-x2),2) + Math.pow((y1-y2),2))\n}",
"function vecAngleDiff(vec1, vec2){\n return Math.acos(dotProduct(vec1, vec2) / (vecLength(vec1) * vecLength(vec2)));\n}",
"function calcDistance(node1, node2) {\n //could use Math.hypot if i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update Update TargetYear by Id Can only be done by Super Administrator | async update({ request, response, auth }) {
try {
let body = request.only(fillable)
const id = request.params.id
const data = await TargetYear.find(id)
if (!data || data.length === 0) {
return response.status(400).send(ResponseParser.apiNotFound())
}
await data.merge(body... | [
"changeYear(newYear){\n this.yearReleased = newYear;\n }",
"function updateYear(year) {\n homeControllerVM.homeSelectedRegistrationYear = year;\n localStorage.setItem('selectedYear', year);\n }",
"function changeImmYear()\n{\n let form = this.form;\n let cens... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ASSESSMENT.JS STARTS HERE Opens the modal to create a new assessment technique | function openAssessmentPlanModal () {
'use strict';
$('#topicDialogBackground').css('display', 'block');
$('#assessment-plan').css('display', 'block');
} | [
"function openNewAssessmentTechniqueModal () {\n\t'use strict';\n\n\t// reset form on new modal open\n\t$('#add-new-technique').find('input, select, textarea').val('');\n\t$('#dimImageModal')\n\t\t.prop('src', '../../images/content/knowDimNone.png')\n\t\t.prop('title', '');\n\n\t$('#techniqueId').val('');\n\t$('#le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes x coord and month name as string | function drawMonthText(x, month) {
const text = document.createElementNS(svgNS, 'text');
text.setAttribute('class', 'calendar-monthname');
text.setAttribute('y', '-5');
text.setAttribute('x', x);
const mthName = document.createTextNode(month);
text.appendChild(mthName);
mainG.a... | [
"function CP_setMonthNames() {\r\n for (var i = 0; i < arguments.length; i++) { this.monthNames[i] = arguments[i]; }\r\n this.copyMonthNamesToWindow();\r\n}",
"function pathMonth(t0) {\n var t1 = new Date(t0.getFullYear(), t0.getMonth() + 1, 0),\n d0 = t0.getDay(), w0 = d3.timeWeek.count(d3.timeYear(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserrecovery_clauses. | visitRecovery_clauses(ctx) {
return this.visitChildren(ctx);
} | [
"visitTablespace_logging_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitTablespace_state_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitValidation_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitDrop_logfile_clauses(ctx) {\n\t return this.visitChildren(ctx... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save requests to firebase | function writeRequest(email, date, time, subject, done, tutor) {
var newEmail = splitEmail(email);
var newDate = splitDate(date);
firebase.database().ref('users/' + newEmail + "/" + newDate).set({
email: email,
date: newDate,
time: time,
tutor: tutor,
done: "no",
subject: subject
});
firebas... | [
"function submitReservation(e){\n\n //prevents submit refreshing page\n e.preventDefault();\n\n //getting the user elements from form inputs by id\n var event = document.getElementById('event').value;\n var date = document.getElementById('date').value;\n var reservation_name = document.getElementByI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add logical break to links hyperlinks and email addresses when an url or email id has large number of characters they would intervene the normal flow of the paragraph. In order to avoid this situation we have to introduce discretionary line breaks to help InDesign decide where the link would be broken | function addLogicalBreaksToLinks(currLink){
var linkStr = currLink.contents;
//var linkStr = 'http://dx.doi.org/10.1136/openhrt-2016-000417';
//linkStr = 'http://static.www.bmj.com/sites/default/files/responseattachments/2015/10/Figure%20271015.docx';
var lineBreakChar = "";//String.fromCodePoint(0x... | [
"function addingDiscretionaryLineBreakForURLs(){\r\n myResetFindChangePref();\r\n//~ app.findGrepPreferences.findWhat = \"https?:\\\\/\\\\/(www\\\\.)?[-a-zA-Z0-9@:%._\\\\+~#=]{2,256}\\\\.[a-z]{2,6}\\\\b([-a-zA-Z0-9@:%_\\\\+.~#?&//=]*)|(www\\\\.)?[-a-zA-Z0-9@:%._\\\\+~#=]{2,256}\\\\.[a-z]{2,6}\\\\b([-a-zA-Z0-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the index of the item that overlaps the specified distance. The item at index i overlaps a distance value if start(i) <= distance < end(i). If no such item exists, 1 is returned. | function indexOf(distance) {
flushPendingChanges.call(this);
var index = indexOfInternal.call(this, distance);
return index >= this._length ? -1 : index;
} | [
"findIndex(pos, end, side = end * Far, startAt = 0) {\n if (pos <= 0)\n return startAt;\n let arr = end < 0 ? this.to : this.from;\n for (let lo = startAt, hi = arr.length;;) {\n if (lo == hi)\n return lo;\n let mid = (lo + hi) >> 1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns module name as animation | getModuleName() {
return 'animation';
} | [
"function getModName(s){\n if(EXEC(/^module\\s+([^\\s\\(]*)/, s)) {\n\treturn /^module\\s+([^\\s\\(]*)/.exec(s)[0];\n } else {\n\treturn \"\";\n }\n}",
"setAnimation(animationName) {\n var currentAnimationName = this.animations.currentAnim.name;\n if (currentAnimationName != animationName) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save expression for selected columns from DBtable | function _saveExpr(w,expr,expr_s,cIndex){
var tksXML='',
qdl=mstrmojo.all.QBuilderModel,
scl=qdl.selectedClns;
success = function(res){
w.count++;
w.updateState(1);
scl[cIndex-1].expr=expr;
//raise event cIndex for the new added... | [
"setFilterExpr(state, { expr, colName }) {\n const filteredCol = state.colsToShow.find(col => col.name === colName);\n filteredCol.expr = expr;\n }",
"function globalSearchToSql() {\n var val = that.searchText.replace(/'/g, \"''\");\n var filterVal = \"%\" + val\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws the button with the icon | draw () {
this.icon.x = this.x
this.icon.y = this.y
const canvas = document.getElementById('editor')
const ctx = canvas.getContext('2d')
const button = new Path2D()
// ctx.moveTo(this.x,this.y)
button.moveTo(this.x, this.y + 10)
button.lineTo(this.x, this.y + this.size - 10)
... | [
"drawIcon() {\n return `<i class=\"fab fa-sketch\"></i>`\n }",
"function drawButton(btn) {\n // Move text down 1 pixel and lighten background colour on mouse hover\n var textOffset;\n if (btn.state === 1) {\n btn.instances.current.background[3] = 0.8;\n textOffset = 1;\n } else {\n btn.inst... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a controller instance for the component described in the context. | createController(context: CompositionContext): Promise<Controller> {
let childContainer;
let viewModel;
let viewModelResource;
let m;
return this.ensureViewModel(context).then(tryActivateViewModel).then(() => {
childContainer = context.childContainer;
viewModel = context.viewModel;
... | [
"createComponent(scenario) {\r\n class DynamicComponent {\r\n constructor() {\r\n Object.assign(this, scenario.context);\r\n }\r\n }\r\n return Component({\r\n selector: 'playground-host',\r\n template: scenario.template,\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Merge two blockquotes: `node` into `prev`, unless in CommonMark or gfm modes. | function mergeBlockquote(previous, node) {
if (this.options.commonmark || this.options.gfm) {
return node
}
previous.children = previous.children.concat(node.children)
return previous
} | [
"function emitTagAndPreviousTextNode() {\n var textBeforeTag = html.slice(currentDataIdx, currentTag.idx);\n if (textBeforeTag) {\n // the html tag was the first element in the html string, or two\n // tags next to each other, in which case we should not emit a te... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the index (i, j) is out of bounds. | function outOfBounds(i, j) {
return (i < 0 || i >= gridHeight) || (j < 0 || j >= gridWidth);
} | [
"function outOfBounds(neighborRow, neighborCol) {\n return neighborRow < 0 ||\n neighborRow > board.length - 1 ||\n neighborCol < 0 ||\n neighborCol > board[0].length - 1\n }",
"function validate(i, j) {\n\t\tlet valid = [];\n\n\t\t//left = [i ,j-1]\n\t\t//right = [i ,j+1]\n\t\t//to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Making Line Orbit with given points | function makeOrbit(points, color) {
const geometry = new THREE.BufferGeometry();
geometry.setFromPoints(points);
const material = new THREE.MeshBasicMaterial({color: color});
const orbit = new THREE.Line(geometry, material);
window.orbit = orbit;
return orbit;
} | [
"breshnamDrawLine (point0, point1) {\n let x0 = point0.x >> 0;\n let y0 = point0.y >> 0;\n let x1 = point1.x >> 0;\n let y1 = point1.y >> 0;\n let dx = Math.abs(x1 - x0);\n let dy = Math.abs(y1 - y0);\n let color = new BABYLON.Color4(1,1,0,1);\n\n if(dy > dx){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursive helper function that determines whether two types are exactly the same | typesAreEquivalent(t1, t2) {
if (t1 === null || t2 === null) {
return true;
}
if (t1.constructor === ListType && t2.constructor === ListType) {
return this.typesAreEquivalent(t1.memberType, t2.memberType);
} else if (t1.constructor === DictType && t2.constructor === DictType) {
return ... | [
"typesMatch(t1, t2) {\n doCheck(\n this.typesAreEquivalent(t1, t2),\n `Type ${util.format(t1)} is not compatible with type ${util.format(t2)}`\n );\n }",
"function sameValueExact(a, b) { // flag for exaxt? which ignores eg 0\n var type = a.type\n\n if (type === \"Dimension\") {\n if (a.val =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called by "Report Corona" button, calls gotCorona function | corona() {
gotCorona(this.props.coords,"https://RawPythonTest.r2dev2bb8.repl.co", this.state.value);
} | [
"function onReportClick(e) {\n\tcommonFunctions.sendScreenshot();\n}",
"function makeGoToCoralReefButton() {\n\n // Create the clickable object\n goToCoralReefButton = new Clickable();\n \n goToCoralReefButton.text = \"Click here to go to the interactive reef\";\n goToCoralReefButton.textColor = \"#365673\";... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Turns on all the camera source key blue LEDs and makes them blink. | function blinkCameraSourceKeys(ignore) {
for (var i = 72; i < 75; i++) {
if (i === ignore) continue;
xkeys.setBacklight(i, false, true); // Turn off Red
xkeys.setBacklight(i, true, false, true); // Turn on Blue blinking
}
} | [
"function updateLeds() {\n if (led_state.Red===\"blink\") {\n GPIO.blink(pin_Red, blink_On, blink_Off);\n }else {\n GPIO.blink(pin_Red,0,0); //Turn off blinking\n let redlight=(led_state.Red==='1') ? 1:0 ; \n GPIO.write(pin_Red,redlight);\n }\n if (led_state.Blue===\"blink\") {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. makeAnomalyGraph and its helper functions / Graph transformation function that accepts a graph containing one or more timeseries associated with a single axis, the name of the displayed variable, and the name of one of the timeseries to use as a base. Adds a secondary y axis, graphing a data series showing the diffe... | function makeAnomalyGraph (base, variable_id, graph) {
//anomalies for some variables are typically expressed as percentages.
//if this is a single variable graph, check the variable configuration
//to see if this is one of them; if so, display percentages on the chart.
const displayPercent = !_.isUndefined(v... | [
"function addAnomalyTooltipFormatter (oldFormatter, baseSeries, displayPercent) { \n const newTooltipValueFormatter = function(value, ratio, id, index) {\n let nominal = oldFormatter(value, ratio, id, index);\n if(_.isUndefined(nominal)) { //this series doesn't display in tooltip.\n return undefined; \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets a value in memory in a dynamic way at runtime. Uses the type data. This is the same as makeSetValue, except that makeSetValue is done at compiletime and generates the needed code then, whereas this function picks the right code at runtime. Note that setValue and getValue only do aligned writes and reads! Note that... | function setValue(ptr, value, type, noSafe) {
type = type || 'i8';
if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
switch(type) {
case 'i1': HEAP8[(ptr)]=value; break;
case 'i8': HEAP8[(ptr)]=value; break;
case 'i16': HEAP16[((ptr)>>1)]=value; break;
case 'i3... | [
"function doSetValue(identifier,value,objectname,callbackname,randomnumber)\n{\n // JP TODO - temp hack to get rid of the value for strings and associated language data model elements\n var dotBindingName = identifier.replace(\".Value\", \"\");\n var api = getAPIHandle();\n var result = \"false\";\n\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A convex polygon. It is assumed that the interior of the polygon is to the left of each edge. Polygons have a maximum number of vertices equal to Settings.maxPolygonVertices. In most cases you should not need many vertices for a convex polygon. extends Shape | function PolygonShape(vertices) {
if (!(this instanceof PolygonShape)) {
return new PolygonShape(vertices);
}
PolygonShape._super.call(this);
this.m_type = PolygonShape.TYPE;
this.m_radius = Settings.polygonRadius;
this.m_centroid = Vec2.zero();
this.m_vertices = []; // Vec2[Settings.maxPolygonVerti... | [
"function drawSVG_Polygon()\n {\n var polygon = scene.create( { t: \"path\", d:\"polygon points:30,0 60,60 0,60\",\n strokeColor: 0x000000ff, strokeWidth: 2, fillColor: 0xFFFF00ff, parent: bg, x: 50, y: 50} );\n\n return polygon;\n }",
"function Polygon(points, color){\n\tthis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update command status when to be called: after switched to RTE mode after execCommand method select event to RTE object click event to RTE object keyup event to RTE object focus event to RTE object | function _updateCommandStatus() {
var status = editor.getCurrentStatus();
for ( var name in status) {
var value = status[name];
var $element = $cazary
.find(".cazary-command-"
+ name);
// set font name
if (name === editor.COMMA... | [
"function spikeExecCommand(commandName, showDefaultUI, valueArgument) {\n\t\tdocument.execCommand(commandName, showDefaultUI, valueArgument);\n\t\t// Mozilla needs to be refocused on the current editable area\n\t\tif ($.browser.mozilla) { current_focused_editable.focus(); }\n\t}",
"function updateMode(newMode) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the cameras collection after calling GetVideoDevicesDescription This method returns the results array that enumerates all video devices; each array element is a string that describes a single device. The last array element is the index of the currently selected device. | function updateVideoDevices(res) {
assert(res.succeeded);
var i, scmr, cams = [], cam;
// build the current device list
for (i = 1; i < res.length - 1; i++) {
cam = Model({
... | [
"_getVideoDevices() {\n return from(navigator.mediaDevices.enumerateDevices()).pipe(map(devices => devices.filter(device => device.kind === 'videoinput')));\n }",
"static listVideoInputDevices(){return __awaiter$1(this,void 0,void 0,function*(){if(!hasNavigator()){throw new Error('Can\\'t enumerate devi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
divHide(divId) divId = The id of the div. Hide the div. | function divHide(divId) {
//console.log('divHide('+divId+')');
if ( document.getElementById(divId) ) {
document.getElementById(divId).style.display = 'none';
} else {
console.warn('document.getElementById('+divId+') == udefined');
}
} | [
"function divHideShow(divId) {\n //console.log('divHide('+divId+')');\n\tif ( document.getElementById(divId) ) {\n\t\tif ( divDisplayState(divId) == 'none' ) {\n\t\t\tdivShow(divId);\n\t\t} else {\n\t\t\tdivHide(divId);\n\t\t}\n\t} else {\n\t\tconsole.warn('document.getElementById('+divId+') == udefined');\n\t}\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function expects access policy and SAS props array... this would be better with typescript see | function generateSASSignature(sasProps, accessPolicy) {
let str = "";
for (const key in sasProps) {
if (sasProps.hasOwnProperty(key)) {
str += accessPolicy[sasProps[key]] === undefined ? `\n` : `${accessPolicy[sasProps[key]]}\n`;
}
}
const sig = crypto
.createHmac("sh... | [
"constructor(scope, id, props) {\n super(scope, id, { type: CfnAccessPointPolicy.CFN_RESOURCE_TYPE_NAME, properties: props });\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_s3objectlambda_CfnAccessPointPolicyProps(props);\n }\n catch (error) {\n if (process.env.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
encode_basic(bcp,flag) forces a basic code point to lowercase if flag is zero, uppercase if flag is nonzero, and returns the resulting code point. The code point is unchanged if it is caseless. The behavior is undefined if bcp is not a basic code point. | function encode_basic(bcp, flag) {
bcp -= (bcp - 97 < 26) << 5;
return bcp + ((!flag && (bcp - 65 < 26)) << 5);
} | [
"function basic(cp){\r\n return cp < 0x80;\r\n // ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./\r\n }",
"function encode_digit(d, flag) {\n return d + 22 + 75 * (d < 26) - ((flag != 0) << 5);\n // 0..25 map to ASCII a..z or A..Z \n // 26..35 map to ASCII ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
download all linked attachments and create the xml file | async function downloadAttachmentsAndMakeXml (filesList, dir, aDir, eDir, attachmentList, attachmentDate, courseInfo) {
const courseId = courseInfo.body.id
if (filesList.length === 0) {
makeXml(courseInfo, attachmentList, attachmentDate, dir, eDir)
} else {
const lockFilePath = `${eDir}${dir}${aDir}/locke... | [
"function downloadAllFiles(){\n\twebsites = getAllWebsites();\n\tfor(var i=0;i<websites.length;i++){\n\t\tclickDownloadFiles(websites[i]);\n\t}\n\t\n\tconsole.log(endDate - initDate);\n}",
"function attachmentCallBack( filename, mimeType, attachment ) {\n\t\t\t\t\tvar ifrm = $('#message-iframe-'+ message.id)[0].c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sortBookmark sort bookmark order by addTime or progress. | sortBookmark() {
let bookmarks = this.props.bookmarks.slice();
if (this.state.sortby === 'addTime') {
bookmarks.sort((a,b) => {
return compareTime(a.addTime, b.addTime) ? 1 : -1;
});
return bookmarks;
} else {
bookmarks.sort((a,b) => {
return ( a.currentChapterOrder ... | [
"function docEdits_sortWeights()\n{\n //var msg=\"presort -------------\\n\";\n //for (i=0; i<docEdits.editList.length; i++) {\n // msg += i+\":\" +docEdits.editList[i].weight+\"=\"+docEdits.editList[i].text+\"\\n\";\n //}\n //alert(msg);\n\n //shift-sort algorithm. Keeps same-weight chunks together\n for (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
use map (takes item from JokeData array, does smtg on it, and put back the item in the same place) put data in another .js file | function JokeApp() {
var jokeComponents
//this de hua more longer
//jokeComponents = jokesData.map(joke => <Meme id={joke.id} question={joke.question} punchLine={joke.punchLine} />)
//this de hua shorter, but need add something in the Meme.js --> add 'jd'
jokeComponents = jokesData.map(joke => <Meme... | [
"function addKey(results){\n results.map(result => {\n\t\tresult.achtergrond = result.achtergrond_Aru + ', ' + result.achtergrond_Cur + ', ' + result.achtergrond_Mar\n + ', ' + result.achtergrond_NL + ', ' + result.achtergrond_Sur + ', ' + result.achtergrond_Tur + ', ' + result.achtergrond_anders\n + ', ' +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The symbol used to represent the currency for the main country using this locale (e.g. $ for the locale enUS). The symbol will be `null` if the main country cannot be determined. | function getLocaleCurrencySymbol(locale) {
var data = findLocaleData(locale);
return data[15 /* CurrencySymbol */] || null;
} | [
"displaySymbol(symbol) {\n return symbol === '' ? ' ' : symbol;\n }",
"function getDefaultHourSymbolFromLocale(locale) {\n var hourCycle = locale.hourCycle;\n if (hourCycle === undefined &&\n // @ts-ignore hourCycle(s) is not identified yet\n locale.hourCycles &&\n // @ts-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts dripline date string into javascript date | function driplineStringToDate(dripstring) {
var date_time=dripstring.split(" ");
var ymd=date_time[0].split("-");
var hms=date_time[1].split(":");
return new Date(ymd[0],ymd[1],ymd[2],hms[0],hms[1],hms[2],0);
} | [
"function transformDate(d) {\n return d.substr(6) + '-' + d.substr(3, 2) + '-' + d.substr(0, 2);\n }",
"function convertDateInput(input){\n return new Date(input.replace(/-/g, '/'));\n}",
"function DATEVALUE(d) {\n return SERIAL(PARSEDATE(d));\n}",
"function parseJsonDate(fecha){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : loadTitanFromLocDir AUTHOR : Mark Anthony Elbambo DATE : January 13, 2013 MODIFIED BY : REVISION DATE : VISIORE : DESCRIPTION : loads the local copy of titan file to be save in home dir PARAMETERS : | function loadTitanFromLocDir(fname){
// var url = "/cgi-bin/Final/RM_CGI_AutoComplete/AutoCompleteCgiQuerryjayson/FindResource2.cgi?action=gettitanfile&query=filename="+fname+"^user="+globalUserName;
// var InfoType = "XML";
// if(InfoType == "XML"){
// var url = getURL("ConfigEditorTopo")+"action=gettitanfile&query=f... | [
"function saveTitanToHome(fname,type){\n//\tvar titanSplt = titanVar.split(\"\\n\").join(\"^\");\n\tvar qry = '{\"QUERY\": [{\"filename\": \"'+fname+'\", \"user\": \"'+globalUserName+'\", \"titan\": \"'+titanVar+'\"}]}';\n\t$.ajax({\n\t\turl: getURL(\"RM\", \"JSON\"),\n\t\tdata : {\n\t\t\t\"action\": \"loadtitan\",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
decode a base58 encoded String into a byte array | function decode(str) {
var num = BigInteger.valueOf(0)
var leading_zero = 0
var seen_other = false
for (var i=0; i<str.length; ++i) {
var chr = str[i]
var bi = alphabetMap[chr]
// if we encounter an invalid character, decoding fails
if (bi === undefined) {
throw new Error('invalid base5... | [
"function hex2base58(s){ return Bitcoin.Base58.encode(hex2bytes(s))}",
"function base582hex(s){\r\n var res, bytes\r\n try { res = parseBase58Check(s); bytes = res[1]; }\r\n catch (err) { bytes = Bitcoin.Base58.decode(s); }\r\n return bytes2hex(bytes)\r\n}",
"function hex_str_to_byte_array(in_str) {\n va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the pgn string for the current game | getPGN () {
return this.game.pgn()
} | [
"getCurrentRoomText() {\n\t\t\treturn currentAdventure.rooms[currentRoom].description;\n\t\t}",
"getPhaseName() {\n let currentPhase = this.props.phases[this.props.phaseIndex];\n if (currentPhase.title === \"Voting\") {\n return \"Time to Vote!\";\n }\n\n let outputString = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
product choices function using inquirer to prompt specific questions to recieve input | function productChoices() {
inquirer
.prompt([
{
type: "input",
message: "What is the ID of the product you would like to buy?",
name: "productID"
},
{
type: "input",
message: "How many items ... | [
"function askProduct() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"productPrompt\",\n message: \"What is the ID of the product you want to buy?\",\n choices: productIDs\n }\n ]).then(({ productPrompt }) => {\n connection.query(\"SELECT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a random 12 Byte array to use as a salt | function generateSalt() {
return hexStringtoUint8Array(secrets.random(96));
} | [
"function generateSalt() {\n return Crypto.randomBytesAsync(256);\n}",
"function randomPassword() {\n\tvar password = new Buffer(24);\n\tfor (var i = 0; i < 24; i++) {\n\t\tpassword[i] = Math.floor(Math.random() * 256);\n\t}\n\treturn password.toString('base64');\n}",
"function random128() {\n var result = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the formula for finding the y intersection of 2 lines given in pointslope form. | function calculateYIntersection(line1, line2) {
return (line1.m * line2.m * (line2.x - line1.x) + line1.y * line2.m - line2.y * line1.m) / (line2.m - line1.m);
} | [
"function lineEquation(pt1, pt2) {\n if (pt1.x === pt2.x) {\n return pt1.y === pt2.y ? null : {\n x: pt1.x\n };\n }\n\n var a = (pt2.y - pt1.y) / (pt2.x - pt1.x);\n return {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a JWT to authenticate this device. The device will be disconnected after the token expires, and will have to reconnect with a new token. The audience field should always be set to the GCP project id. | createJWT () {
const token = {
iat: parseInt(Date.now() / 1000),
exp: parseInt(Date.now() / 1000) + 20 * 60, // 20 minutes
aud: this.mqtt.project
}
return jwt.sign(token, fs.readFileSync(this.device.key.file), { algorithm: this.device.key.algorithm })
} | [
"function createTokenForCRM() {\n var api_user = {\n user_id: user.user_id,\n email: user.email,\n name: user.name\n };\n\n var options = {\n subject: user.id,\n expiresInMinutes: 60,\n audience: configuration.telco_crm_api_client_id,\n issuer: 'https://sandrino-dv.auth0.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
holds rules for converting position based on face | newFacePos(oldFace, pos) {
let row = pos[0];
let col = pos[1];
switch (oldFace) {
case "front":
return pos.map(co=> Util.wrap(co) );
case "left":
if(col < 0 || col > 2) {
return [row, Util.wrap(col)];
} else if (row < 0) {
return [col, 0];
} el... | [
"function preproc()\n{\n // nodal coordinates as passed to opengl\n let coords = []\n // 3 corner nodes of a face to compute the face normal in the shader\n let As = []\n let Bs = []\n let Cs = []\n // triangles as passed to open gl\n let trias = []\n // displacement vector per vertex to ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loop All Mode Obj in One Obj | function resolve_parallel_all_mode_in_one_obj(exe) {
var all_mode_in_one_argument = exe.resolve_series_one_argument[exe.resolve_parallel_all_argument['pointer']];
exe.element_name = all_mode_in_one_argument['element_name'];
var all_mode_name_array = (typeof(all_mode_in_one_argument['obj'][exe.e... | [
"function SetMode(mode : GIZMO_MODE){\t\t\n\t_mode = mode;\n\t\n\tswitch(_mode){\n\t\tcase GIZMO_MODE.TRANSLATE:\n\t\t\ttransform.rotation = Quaternion.identity;\n\t\tbreak;\n\t\t\n\t\tcase GIZMO_MODE.ROTATE:\n\t\t\ttransform.rotation = _selectedObject.transform.rotation;\n\t\tbreak;\n\t\t\n\t\tcase GIZMO_MODE.SCAL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper for allowChars, disallows all, except numbers in given range [from, to] | function range(event, from, to) {
result = allowChars('0-9');
if (result)
return (event.currentTarget.value >= from && event.currentTarget.value <= to);
else
return result;
} | [
"function restrictToRange(val,min,max) {\r\n if (val < min) return min;\r\n if (val > max) return max;\r\n return val;\r\n }",
"function validateForbiddenChar(password) {\n for (const c of password) {\n if (FORBIDDEN_CHAR.has(c)) return false;\n }\n return true;\n }",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The IsWellFormedCurrencyCode abstract operation verifies that the currency argument (after conversion to a String value) represents a wellformed 3letter ISO currency code. The following steps are taken: | function /* 6.3.1 */IsWellFormedCurrencyCode(currency) {
// 1. Let `c` be ToString(currency)
var c = String(currency);
// 2. Let `normalized` be the result of mapping c to upper case as described
// in 6.1.
var normalized = toLatinUpperCase(c);
// 3. If the string length of normalized... | [
"static getCurrencyName(code) {\n let currencyName = this.getPhrase(code, \"CurrencyCode\");\n if (currencyName != \"\" && currencyName.length > 0)\n return currencyName;\n else\n return code;\n }",
"function isISO31661Alpha3(value) {\n return typeof value === 'str... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method will open the options page of the addon | function openOptionsPage() {
runtime.openOptionsPage();
} | [
"function openOptions() \r\n{ \r\n\tchrome.tabs.create({url:\"options.html\"}); \r\n}",
"function OptionsPage() {\r\n try {\r\n qx.Class.define(\"MHTools.OptionsPage\", {\r\n type: 'singleton',\r\n extend: webfrontend.gui.options.OptionsPage,\r\n construct: functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle map request cell's nearby lists. | function handleNearby(nearby_pokemons, cellKey, position) {
// Hunters don't care about nearby. Only catchable.
} | [
"async getNearbyLocations(context) {\n let locations = null,\n nearbyLocations = [],\n radiusDistance = context.getters.radiusDistance;\n\n locations = await context.dispatch('getLocations');\n\n return new Promise(function (resolve) {\n locations.forEach(async ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search in dash for selection syntax documentation | function searchSpecific() {
var editor = getEditor();
var query = getSelectedText(editor);
var docsets = getDocsets();
var dash = new dash_1.Dash(OS, getDashOption());
child_process_1.exec(dash.getCommand(query, docsets));
} | [
"function searchCustomWithSyntax() {\n var docsets = getDocsets();\n var dash = new dash_1.Dash(OS, getDashOption());\n var inputOptions = {\n placeHolder: 'Something to search in Dash.',\n prompt: 'Enter something to search for in Dash.',\n };\n vscode_1.window.showInputBox(inputOption... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch a specific field and update it with resource call. | function fetchField(field) {
return (dispatch) => {
switch(field) {
case 'avatar':
resource("GET", "avatars").then(r => {
dispatch(updateAvatar(r.avatars[0]))
})
break;
case 'headline':
resource("GET", "headlines").then (r => dispatch(
updateHeadline(r.headlines[0])))
break;
... | [
"updateFieldItem(core, field, event) {\n return new Promise((resolve) => {\n if (IsValidFieldPatchEvent(core, event)) {\n const patch = {};\n const path = StringReplaceAll(ParseUrlForParams(`#path/#entityId`, core.params), '//', '/');\n patch[field.name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GenerateLineElement will create a line element with a limited set of attributes that needs appending x2len, y2len are the terminal points of the line Returns: a fully formed line element | function GenerateLineElement(x2len, y2len, stroke_width, stroke_color) {
var aline = document.createElementNS(svgNS, "line");
aline.setAttribute("x2", x2len);
aline.setAttribute("y2", y2len);
aline.setAttributeNS(null, 'stroke-width', stroke_width);
aline.setAttributeNS(null, 'stroke', stroke_color);
return aline... | [
"function createLine(element1, element2) {\n let line = document.createElementNS('http://www.w3.org/2000/svg', 'line');\n let x1 = getOffset(element1).left + (getWidth(element1) / 2);\n let y1 = getOffset(element1).top + (getHeight(element1));\n let x2 = getOffset(element2).left + (getWidth(element2) / ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
prints ONLY the description of the trap | print() {
console.log(this.description);
} | [
"function templateDetails() {\n console.log('');\n console.log(chalk.green(\"Available template details:\"), chalk.grey(\"(npx 11up list)\"));\n templates.forEach(template => {\n console.log(\"\");\n console.log(`🎈 ${chalk.green(template.name)}`);\n console.log(template.description);\n console.log(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reg LoginSuccess to window | function LoginSuccess() {
loginPop.hide();
//在a消失之后执行回调
if (K.isFunction(fn)) {
fn();
}
} | [
"function alertpopupUitgelogd() {\n alert(\"U moet eerst registreren om te kunnen matchen!\");\n loadController(CONTROLLER_REGISTREER);\n }",
"function loginClickHandler() {\n var values = this.getLoginForm().getValues();\n var e = new ExtJSCodeSample.event.SessionEvent(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call this to add story card view duration to instrumenation queue | function pushStoryDuration(data) {
_.at(window,'__dhpwa__.enableClientLogs') && console.log("push StoryDuration: ",data.id);
push(format(_.deepExtend({
timespent: data.duration,
pv_activity: 'story_detail',
wordcount: data.wordCount,
imagecount: data.imageCount,
referrer_flow: _.at(window,'__dhp... | [
"add(duration) {\n return (0, $5c0571aa5b6fb5da$export$96b1d28349274637)(this, duration);\n }",
"add(duration) {\n return (0, $5c0571aa5b6fb5da$export$7ed87b6bc2506470)(this, duration);\n }",
"increaseTime() {\r\n this.duration += 1;\r\n }",
"static _eventCheckerDurationTimeline(e) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create function to compare the base with a number. If base is less than the number, return true. Else, return false. | function numberFunction(num) {
if (base < num) {
return true;
} else {
return false;
}
} | [
"function lessThanNumber(number) {\n if (base > number) {\n return true;\n } else {\n return false;\n }\n }",
"function isGreaterThanTen(num) {\n // code here\n}",
"function createLessThanFilter(base) {\n // YOUR CODE BELOW HERE //\n //I: base (value could ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is called when the user clicks on an expression (a grid expression OR an operator) in the code window. | function exprClicked(parentPath, childpos) {
var sO = CurStepObj;
resetOnInput();
// if we the user clicked on the same expression he is currently
// editing, nothing to do
//
if ((sO.activeParentPath == parentPath) &&
(sO.activeChildPos == childpos) &&
(!sO.isSpace... | [
"function datagrid_on_operator_change() {\n var jq_op_select = $(this);\n var jq_tr = jq_op_select.closest('tr');\n datagrid_toggle_filter_inputs(jq_tr);\n}",
"function addGenExpr(expr) {\r\n\r\n var sO = CurStepObj;\r\n\r\n // if any grid is currently highlighted, remove that highlight first\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom type guard for AnnotationRef. Returns true if node is instance of AnnotationRef. Returns false otherwise. Also returns false for super interfaces of AnnotationRef. | function isAnnotationRef(node) {
return node.kind() == "AnnotationRef" && node.RAMLVersion() == "RAML10";
} | [
"function hasTypeAnnotation (path: NodePath): boolean {\n if (!path.node) {\n return false;\n }\n else if (path.node.typeAnnotation) {\n return true;\n }\n else if (path.isAssignmentPattern()) {\n return hasTypeAnnotation(path.get('left'));\n }\n else {\n return false;\n }\n}",
"hasAnnotationS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for getV3ProjectsIdRepositoryCommitsSha | getV3ProjectsIdRepositoryCommitsSha(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 =... | [
"async function get_all_commits_sha() {\n const repo = await nodegit.Repository.open(local)\n\n const latest_master_commit = await repo.getMasterCommit()\n\n const commits = await new Promise(function (resolve, reject) {\n var hist = latest_master_commit.history()\n hist.start()\n hist.on(\"end\", resol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if `expression` matches `lexeme`. | function test(expression, lexeme) {
var match = expression && expression.exec(lexeme);
return match && match.index === 0;
} | [
"function verify(expression) {\n return true;\n }",
"function parseExpression() {\n let expr;\n //lookahead = lex();\n // if (!lookahead) { //significa que es white o undefined\n // lookahead = lex();\n // }\n if (lookahead.type == \"REGEXP\") {\n expr = new Regexp({type: \"regex\", regex: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the unique values to the permits type select element. This will allow the user to filter permits by type. | function addToSelect(values) {
values.sort();
values.forEach(function (value) {
var option = document.createElement("option");
option.text = value;
permitTypeSelect.add(option);
});
return setpermitsDefinitionExpression(permitTypeSelect.value);
} | [
"prepareSelectTypes() {\n let items_buffer = getReferencesOfType('AGItem');\n let that = this;\n let types_buffer = [];\n let append_buffer = \"<option item_type = ''></option>\";\n if (items_buffer.length > 0) {\n items_buffer.forEach(function (element) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an `AcceptEncoding` string, parse out the encoding returning a negotiated encoding based on the `provided` encodings otherwise just a prioritized array of encodings. | function preferredEncodings(accept, provided) {
const accepts = parseAcceptEncoding(accept);
if (!provided) {
return accepts
.filter(isQuality)
.sort(compareSpecs)
.map(spec => spec.encoding);
}
const priorities = provided.map((... | [
"function assertValidEncoding(encoding) {\n if (typeof encoding === 'string') {\n if (!iconv_lite_1.encodingExists(encoding))\n throw new Error(`Unsupported character encoding '${encoding}'`);\n }\n else if (typeof encoding === 'object' && encoding !== null) {\n let encodingObject ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SUMMARY: Saves the users' information and the campus' information into the files. | function saveState(){
writeToFile(userFile, users);
writeToFile(campusFile, campus);
} | [
"saveUsers(users) {\n Jsonfile.spaces = 4;\n Jsonfile.writeFileSync(usersFile, users);\n }",
"function saveAllUsers() {\n\tfs.writeFile(\n\t\t\"./users.json\",\n\t\tJSON.stringify(usersArr),\n\t\tfunction(err) {\n\t\t\tif (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\t\t}\n\t);\n}",
"function w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if a string is prefixed by 0x | function isHexPrefixed(str) {
return str.slice(0, 2) === '0x';
} | [
"function isHexPrefixed(str){return str.slice(0,2)==='0x';}",
"function isValidHexCode(str) {\n\treturn /^#[a-f0-9]{6}$/i.test(str);\n}",
"function isHex(value) {\n if (value.length == 0) return false;\n if (value.startsWith('0x') || value.startsWith('0X')) {\n value = value.substring(2);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set file to cache | set(file) {
this.cache.set(file.path, file);
} | [
"function loadFileCache() {\n\tcachedFileInfo = getLocalSetting(\"cachedFileInfo\", {});\n}",
"function setCache(key, value, fn) {\n\n\t// the timestamp key\n\tvar timestamp_key = key + '.timestamp';\n\n\t// params to set\n\tvar params = {};\n\n\t// add in\n\tparams[key] = JSON.stringify(value);\n\tparams[timesta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the word in a sentence at a given character index | function getWordAt(string, index) {
const left = string.substr(0, index).split(' ');
const right = string.substr(index).split(' ');
return left[left.length - 1] + right[0];
} | [
"function returnACharacter(string, index) {\n return string[index];\n}",
"function Charat(){\n\tvar kata = 'saya belajar di pasar';\n\tconsole.log(kata.charAt(4));\n}",
"wordAt(pos) {\n let { text, from, length } = this.doc.lineAt(pos)\n let cat = this.charCategorizer(pos)\n let start = po... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get session list for particular event | function getSessions(eventId) {
return request.get(CONFIG.api.sessions + `/events/${eventId}/sessions`)
} | [
"function listerToutesLesSessions(){\n return devfest.sessions;\n}",
"get sessionTasks(){\r\n\t\treturn this.tasks\r\n\t\t\t.filter(function(task){\r\n\t\t\t\treturn task.__session_task__ }) }",
"function activeSessions(clientId) {\n return new Promise(function(resolve) {\n /* Getti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs the game and returns scores for 10 frames | function runGame() {
numOfFrames = 10;
var frames = [];
var totScore = 0;
for (var i = 0; i < numOfFrames; i++) {
frames.push(scores(0, 11, i, frames));
totScore += addCurrentScore(frames[i]);
}
console.log(frames);
console.log(totScore);
// console.log(frames[9][0]);
} | [
"function runGame() {\n score = 0;\n gamePaused = false;\n curTime = 0;\n nextBug = 1\n lastBugTime = 0;\n bugList = [];\n foodList = [];\n\n drawScoreboard();\n bugInterval = window.setInterval(addRandomBug, 1000);\n createRandomFoods(5);\n window.requestAnimationFrame(animateBoard... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set parallaxBg padding by phone | function setParallaxBgPadding(){
const parallaxBg = $('.parallax-bg');
const parallaxWrapper = document.querySelector('#parallax-wrapper');
if(parallaxWrapper.offsetWidth - parallaxWrapper.clientWidth === 0){
parallaxBg.css( {'padding-right':'0px'} );
}
} | [
"set PhonePad(value) {}",
"set NumberPad(value) {}",
"set NamePhonePad(value) {}",
"function padPartial(iotaAreaCode) {\r\n let padded = iotaAreaCode;\r\n if (padded.length < 8) {\r\n padded = padded + \"A\".repeat(8 - padded.length);\r\n }\r\n if (padded.length < 9) {\r\n padded = `... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
recurse down a node tree to find a node with matching nodeName, for custom tags jQuery.find doesn't work in IE8 | function findByNodeName(el, nodeName) {
if (!el.prop) {
// not a jQuery or jqLite object -> wrap it
el = angular.element(el);
}
if (el.prop("nodeName") === nodeName.toUpperCase()) {
return el;
}
var c = el.children();
for (var i = 0; c && i < c.length; i++) {
var node... | [
"function fetchTags(xmlDoc,nodeType)\n {\n var node = xmlDoc.documentElement;\n var nodes = node.querySelectorAll(\"*\");\n var childrenNodes =[];\n for (var i = 0; i < nodes.length; i++) \n {\n var text = null;\n if (nodes[i].childNodes.length == 1 && nodes[i].c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
datagrid_toggle_sort_selects() Called when any of the sorting related select boxes change, it handles hiding and showing the select boxes. | function datagrid_toggle_sort_selects() {
var jq_dds = $('.datagrid .header .sorting dd');
if (jq_dds.length == 0) return;
var dd1 = jq_dds.eq(0)
var dd2 = jq_dds.eq(1)
var dd3 = jq_dds.eq(2)
var sb1 = dd1.find('select');
var sb2 = dd2.find('select');
var sb3 = dd3.find('select');
i... | [
"function selectOrders() {\n\t\t\t\n\t\t\tvar $target = $(this);\n\t\t\tif ($target.hasClass(\"active\")) return false;\n\t\t\t\n\t\t\t_$navis.removeClass(\"active\");\n\t\t\t\n\t\t\tvar cls = $target.prop(\"class\");\n\t\t\t\n\t\t\t$target.addClass(\"active\");\n\t\t\t_$table.removeClass().addClass(cls);\n\t\t\t\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the sets that match the search filters, puts them through the constructor and into the sets array for display Returns the sets array | getSearchSets(nameFilter, numFilter, themeFilter, levelFilter, statFilter) {
$http.get("/sets/?setName=" + nameFilter + "&setNum=" + numFilter + "&theme=" + themeFilter + "&status=" + statFilter + "&skill=" + levelFilter).then(function (response) {
console.log(response);
... | [
"get sets() {\n return TermSets(this, \"sets\");\n }",
"get sets() {\n return TermSets(this);\n }",
"function filterDataSets() {\n \t//the array that will contain the graph lines we want to display\n \tvar dataToDisplay = [];\n\n \t//get all the data sets\n \tvar dataSets = thisG... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This returns all saved images in the local storage | getSavedImagesFromLocalStorage() {
this.savedImagesInLocalStorage = [];
const partialStorageArray = this.getPartialStorageArray();
if (partialStorageArray.length > 0) {
const finalArray = [];
partialStorageArray.forEach((jsonImageInfo) => {
const imageIn... | [
"saveImagesToLocalStorage(uploadedImages) {\n const partialStorageArray = this.getPartialStorageArray();\n\n uploadedImages.forEach((uplodedImage) => {\n const jsonToSave = JSON.stringify(Object.assign({}, uplodedImage));\n partialStorageArray.push(jsonToSave);\n });\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get list of Meetup Group IDs from External[].ID in Project: "User Groups" for all Tasks in Asana | function getMUgroupIDsFromExternalID() {
var options = {
"method": "GET",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer " + personal_access_token
}
};
// GET /projects/projectId-id/task... | [
"function getMUeventIDsFromExternalID() {\n\n var options = {\n \"method\": \"GET\",\n \"headers\": {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\",\n \"Authorization\": \"Bearer \" + personal_access_token\n }\n };\n\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called after dialog has been closed. It resets search and settings pages. It sets selected page to appscoapplicationaddsearch. | _onDialogClosed() {
this._selectedApplication = {};
this.$.appscoApplicationAddSearch.reset();
this.$.appscoApplicationAddSettings.reset();
this._selected = 'appsco-application-add-search';
this._dialogTitle = 'Add application';
this._hideLoader();
} | [
"function resetPage(searchValue) {\r\n\tconst currentDataList = filterData(searchValue);\r\n\tshowPage(currentDataList,1);\r\n\taddPagination(currentDataList);\r\n\t// Change the activeData (global scope) so other\r\n\t// parts of program can access it\r\n\tactiveData = currentDataList;\r\n\treturn;\r\n}",
"_onAp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check mesh connectivity for a complete mesh (with ghost elements added) | function checkMeshConnectivity({points, delaunator: {triangles, halfedges}}) {
// 1. make sure each side's opposite is back to itself
// 2. make sure region-circulating starting from each side works
let r_ghost = points.length - 1, s_out = [];
for (let s0 = 0; s0 < triangles.length; s0++) {
if (... | [
"function is4Connected (x, y) {\r\n\t\tvar c = getConnections(x, y);\r\n\r\n\t\tfor (var key in c) {\r\n\t\t\t// console.log(\"$$border : \"+key);\r\n\t\t\tif (c[key] == null) {\r\n\t\t\t\tconsole.log(\"border : \"+key);\r\n\t\t\t\tdelete c[key];\r\n\t\t\t};\r\n\t\t};\r\n\r\n\t\tif ((c._n == null || c._n.color != n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Void function that receives news object of main news from view page and set the value of main news function with same receives value | changeMainNews(news) {
this.mainNews = news;
this.writer = this.writers.filter((el) => { return el.id == this.mainNews.writerId})[0].value;
mvc.apply();
} | [
"function getNews(){\nreturn news;\n}",
"getNews() {\n\n this.dataBase.findByIndex(\"/news\",\n [\"_id\", \"title\", \"attachment\", \"seoDescription\", \"isMainNews\", \"createDate\", \"writerId\"], \"categoryId\", mvc.routeParams.id).then( data => {\n\n if (data)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /teams/add render addteam page | static async add(ctx) {
const context = ctx.flash.formdata || {}; // failed validation? fill in previous values
await ctx.render('teams-add', context);
} | [
"static async processAdd(ctx) {\n if (ctx.state.auth.user.Role != 'admin') {\n ctx.flash = { _error: 'Team management requires admin privileges' };\n return ctx.response.redirect('/login'+ctx.request.url);\n }\n\n const body = ctx.request.body;\n\n try {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
url create of todoist task from title and task id | function html_link_from_todoist_task(task_title, task_id) {
url = 'https://en.todoist.com/app?lang=en#task%2F' + String(task_id)
html_task = "<a target='_blank' href='" + url + "'>" + task_title + "</a>"
return html_task
} | [
"function task_create_todoist(task_name, project_id, todoist_api_token) {\n todoist_api_token = todoist_api_token || 'a14f98a6b546b044dbb84bcd8eee47fbe3788671'\n return todoist_add_tasks_ajax(todoist_api_token, {\n \"content\": task_name,\n \"project_id\": project_id\n })\n}",
"function cre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether this rigid body is static This property returns whether the rigid body is effectively static. If static property was set while the rigid body was active, it will not take effect until the rigid body is set inactive and active again. Until the component is set inactive, this getter will return whether the rigidb... | get static() {
return !!_wl_physx_component_get_static(this._id);
} | [
"function isStaticPositioned(element){return(getStyle(element,\"position\")||'static')==='static';}",
"hasCollision() {\n return this.collision != null && this.collision != undefined;\n }",
"function getIsSimulating() {\n \t return isSimulating;\n } // getIsSimulating",
"get busy() {\n\t\tretur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decrement an 8bit register DEC B | decReg(register) {
register[0]--;
// Set the zero flag if 0, half-carry if decremented to 0b00001111, and
// the subtract flag to true
regF[0] = (register[0] ? 0 : F_ZERO) |
(((register[0] & 0xF) === 0xF) ? F_HCARRY : 0) |
F_OP;
return 4;
} | [
"function decrement(event){\n if (isRunning){\n return;\n }\n\n var target = event.data.target || event;\n // Get the value of the target\n var value = parseInt(readInput(target));\n if (value <= 1){\n return;\n }\n // Decrement it\n value--;\n // Output incremented value b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Discard older versions of the spell but retain edition info for clarity | static discardOldVersions (records) {
for (let i=0; i < records.length-1; i++) {
for (let j=i+1; j < records.length; j++) {
if (records[i].spell_name === records[j].spell_name) {
let dateA = new Date(records[i].published);
let dateB = new Date(... | [
"async revert(_cancellation) {\r\n const diskContent = await vscode.workspace.fs.readFile(this.uri);\r\n this._bytesize = diskContent.length;\r\n this._documentData = diskContent;\r\n this._unsavedEdits = [];\r\n this._edits = [];\r\n // // If we revert then the edits are e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Makes user avatars clickable | function user_avatars()
{
var avatars = getElementsByClassName(document, 'img', 'user_avatar');
for(var i = 0; i < avatars.length; i++)
{
avatars[i].onclick = avatar_popup;
}
} | [
"function bindNameAndImagesToProfile(){\n var userPics = document.getElementsByClassName(\"userImage\");\n var userPseudoName = document.getElementsByClassName(\"pseudoName\");\n\n for(var x = 0; x < userPics.length; x++){\n // update the image of the user\n userPics[x].src = \"services/getAv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Normally, we don't have to implement shouldComponentUpdate because connect handles a lot of this for us. However, the week grouping causes props mismatches and this results in a full rerender of all four week boxes regardless of whether data changed in that given week box. Since week boxes also include rather expensive... | shouldComponentUpdate(nextProps) {
if (nextProps.currentWeek == this.props.currentWeek && shallowArrayElementsEqual(this.props.weeks, nextProps.weeks)) {
return false
}
return true
} | [
"_selectWeek() {\n this._weeks.forEach(week => {\n const _week = week;\n const dayInThisWeek = _week.findIndex(item => {\n const date = _CalendarDate.default.fromTimestamp(parseInt(item.timestamp) * 1000);\n return date.getMonth() === this._calendarDate.getMonth() && date.getDat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Round x to sd significant digits using rounding mode rm. Check for over/underflow. If r is truthy, it is known that there are more digits after the rounding digit. | function round( x, sd, rm, r ) {
var d, i, j, k, n, ni, rd,
xc = x.c,
pows10 = POWS_TEN;
// if x is not Infinity or NaN...
if (xc) {
// rd is the rounding digit, i.e. the digit after the digit that may be rounded up.
... | [
"function round( x, sd, rm, r ) {\r\n\t var d, i, j, k, n, ni, rd,\r\n\t xc = x.c,\r\n\t pows10 = POWS_TEN;\r\n\r\n\t // if x is not Infinity or NaN...\r\n\t if (xc) {\r\n\r\n\t // rd is the rounding digit, i.e. the digit after the digit ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserconstraint_state. | visitConstraint_state(ctx) {
return this.visitChildren(ctx);
} | [
"visitAdd_constraint_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitCheck_constraint(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitConstraint_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitDrop_constraint_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if html, route to file | function route(){
switch(req.url){
case '/cats': page = 'cats'; break;
case '/cars': page = 'cars'; break;
case '/cars/new': page = 'new'; break;
default: page = 'error';
}
fs.readFile(`views/${page}.html`, 'utf8', render);
} | [
"function fileRouter(parsedUrl, res) {\n\tvar code;\n\tvar page;\n\tvar filePath = './' + parsedUrl.pathname;\n\tif (fs.existsSync(filePath)) {\n\t\t// We found the page, read it and set the code\n\t\tcode = 200;\n\t\tpage = fs.readFileSync(filePath);\n\t}\n\telse {\n\t\t// We didn't find the requested page, so rea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate that the dimensions have been set on this item. Mainly this is here to bug other developers if you extend this abstract class without ensuring that the dimension value is defined as a property on the child class, it will fail. | validateDimensions() {
if (this.dimensions === undefined) {
throw ("NodeLocation cannot be instantiated because it has no dimensions. When extending the " +
"NodeLocation class, please be sure to set the value for dimensions before invoking the parent " +
"by returni... | [
"function validateFavoriteDataDimension() {\n\t\n\tvar issues = [];\n\tfor (var type of [\"charts\", \"mapViews\", \"reportTables\", \"eventReports\", \"eventCharts\"]) {\n\t\tfor (var i = 0; metaData.hasOwnProperty(type) && i < metaData[type].length; i++) {\n\t\t\tvar item = metaData[type][i];\n\t\t\tvar nameableI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup an Express application and web server | function setupServer() {
// Setup the Express application
const app = express();
app.set("port", PORT)
app.use("/", express.static(PUBLIC_DIR))
app.use("/static", express.static(STATIC_DIR))
// Setup the HTTP Web Server
const server = http.createServer(app);
server.listen(PORT);
server.on("listening"... | [
"function startServer() {\n\troutes.setup(router); //Set the route\n\tapp.listen(port); //Passing port for the server\n\t\n\tconsole.log('\\n Server started \\n Mode: ' + env + ' \\n URL: localhost:' + port);\n}",
"function serve() {\n const express = require('express');\n const helmet = require('helmet');\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an autobind map mimicking the original map, but directed at proxy. | function createAutoBindMap() {
if (!current.__reactAutoBindMap) {
return;
}
var __reactAutoBindMap = {};
for (var name in current.__reactAutoBindMap) {
if (typeof proxy[name] === 'function' && current.__reactAutoBindMap.hasOwnProperty(name)) {
__reactAutoBindMap[name] = proxy... | [
"function generateMap() {\n\t\t$('#koi-deeplink-root').extractDeeplinkIdentifiers();\n\n\t\tvar initializing = true;\n\n\t\tmapGenerated = true;\n\t\t\n\t\t$.address.history(use_history);\n\n\t\t$.address.init(function (event) {\n\t\t\t$.address.change(function (event) {\n\t\t\t\tif (!initializing) {\n\t\t\t\t\t_.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates triangles representing a boxshaped wall. | function initWall() {
const numVertices = 8;
const numTriangles = 12;
const numTexCoords = 6;
const pointIndices = [ // numTriangles X 3
[0, 1, 3], // 0 front face
[0, 3, 2], // 1
[2, 3, 5], // 2 right side face
[2, 5, 4], // 3
[4, 5, 7], // 4 rear face
[4, 7, 6], // 5
[6, ... | [
"createWallMesh() {\n this.calculateMeshOutlines();\n\n // [PVector]\n this.wallVerticies = [];\n // [Integer]\n this.wallTriangles = [];\n\n for (const outline of this.outlines) {\n for (let i = 0; i < outline.length - 1; i++) {\n const startIndex = this.wallVerticies.length;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MARK Drag functions for Nodes isAZeroMove: simple test of whether every offset is 0 (no move at all): | function isAZeroMove(a) { return a.every((m) => m === 0); } | [
"function isMovable(tile) {\n var currentX = tile.style.left;\n var currentY = tile.style.top;\n if (currentX == emptyX && Math.abs(parseInt(currentY) - parseInt(emptyY)) == SIZE ||\n currentY == emptyY && Math.abs(parseInt(currentX) - parseInt(emptyX)) == SIZE){\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filters the data array based on searchValue, and returns the filtered array | function filterData(searchValue) {
const searchList = [];
// change searchValue and name (below) to lower case
// to make search insensitive
searchValue = searchValue.toLowerCase();
for (let i = 0; i < data.length; i++) {
let name = data[i]["name"]["first"]+" "+data[i]["name"]["last"];
name = name.toLow... | [
"searchQuery (value) {\n let result = this.tableData\n if (value) result = this.fuseSearch.search(this.searchQuery)\n else result = []\n this.searchedData = result\n }",
"function filterItems() {\n //console.log(inspections)\n return inspections.filter(function(inspection) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |