query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
displayAll combines data from the three tables in our database into one | function displayAll() {
connection.query("SELECT e.id, e.first_name, e.last_name, r.title, r.salary, d.name, m.first_name AS ? , m.last_name AS ? FROM employee e JOIN role r ON e.role_id = r.id JOIN department d ON r.department_id = d.id LEFT JOIN employee m on e.manager_id = m.id;", ["manager_first_name", "manag... | [
"function viewAll(){\n connection.query(\"select employee.id, first_name, last_name, title, department.name, salary from employee inner join role on employee.id = role.id inner join department on department.id = role.id\",\n (err, data) =>{\n if (err) throw err;\n console.table(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find this extension's directory relative to the brackets root | function _extensionDirForBrowser() {
var bracketsIndex = window.location.pathname;
var bracketsDir = bracketsIndex.substr(0, bracketsIndex.lastIndexOf('/') + 1);
var extensionDir = bracketsDir + require.toUrl('./');
return extensionDir;
} | [
"function getCurrentDirectory() {\r\n\treturn File.GetAbsolutePathName(\".\");\r\n}",
"dir() {\n if (this.program.dir) {\n if (Path.isAbsolute(this.program.dir)) {\n return this.program.dir;\n }\n return Path.resolve(process.cwd(), this.program.dir);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the address of this token sorts before the address of the other token | sortsBefore(other) {
invariant(this.chainId === other.chainId, 'CHAIN_IDS');
invariant(this.address !== other.address, 'ADDRESSES');
return this.address.toLowerCase() < other.address.toLowerCase();
} | [
"static isBefore(a, b) {\n if (a.lineNumber < b.lineNumber) {\n return true;\n }\n if (b.lineNumber < a.lineNumber) {\n return false;\n }\n return a.column < b.column;\n }",
"isBefore(point, another) {\n return Point.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
headRequest: Build Head's request | headRequest() {
let operation = {
'api': 'HeadBucket',
'method': 'HEAD',
'uri': '/<bucket-name>',
'params': {
},
'headers': {
'Host': this.properties.zone + '.' + this.config.host,
},
'elements': {
},
'properties': this.properties,
'body': un... | [
"head(route, ...middleware) {\n return this._addRoute(route, middleware, \"HEAD\");\n }",
"function fetchWithHeader() {\n fetch('https://api.github.com/users?since=135').then(function(response) {\n console.log(response.headers.get('Content-Type'));\n console.log(response.headers.get('Da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get all the resources | function getResources() {
return $q.when(resources);
} | [
"getResources(includeTs) {\n const resources = this.data.manifest.control.resources;\n let pathsCollection = [];\n Object.keys(resources).forEach(resourceType => {\n let paths;\n if (resourceType !== constants.LIBRARY_ELEM_NAME) {\n paths = (resourceType ===... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find all groups and include all associated groupEvents from the GroupEvent model | list(req, res) {
return Group
.findAll({
include: [{
model: GroupEvent,
as: 'groupEvents',
}],
})
.then(groups => res.status(200).send(groups))
.catch(error => res.status(400).send(error));... | [
"findEvents (groupId, query) {\n assert.equal(typeof groupId, 'number', 'groupId must be number')\n assert.equal(typeof query, 'object', 'query must be object')\n return this._apiRequest(`/group/${groupId}/events`, 'GET',\n PieceMakerApi._convertData(query), PieceMakerApi._fixEventsResponse)\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stores git collection ID in parent component DuplicateApp | callbackGit(data) {
this.state.extSetState({ gitCollectionId: data.smart_collection.id });
} | [
"function makeApp() {\n window.addEventListener('load', (event) => {\n db.collection(\"apps\").add({})\n .then(function (doc) {\n docAppID = doc.id;\n console.log(\"app id!\" + docAppID);\n })\n });\n }",
"onComponentO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pinPosterMult(locationArray) takes the array and fires off a Google place search for each location. | function pinPosterMult(locationArray) {
// creates a Google place search service object. PlacesService does the work of
// actually searching for location data.
var service = new google.maps.places.PlacesService(map);
// Iterates through the array of locations, creates a search object ... | [
"function pinPoster(locations) {\n\n // creates a Google place search service object\n var service = new google.maps.places.PlacesService(map);\n\n // Iterates through the array of locations, creates a search object for each location\n locations.forEach(function(place){\n // the search request ob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detects intersection between mouse cursor (vector from center to mouse position) and menu item. If detects, activates this item. | intersection () {
var tan = this.vector.y / this.vector.x,
_this = this,
from, to,
cursorDegree = -Math.atan2(-this.vector.y, -this.vector.x) * 180/Math.PI + 180;
for (var i= 0, max = this.cache.length; i < max; i++) {
var item = _this.cache[i];
... | [
"function theClickedItem(item) {\n setHighlightItem(item);\n }",
"function onSelectStart(event){\n\n if (event instanceof MouseEvent && !renderer.xr.isPresenting()){\n\t// Handle mouse click outside of VR.\n\t// Determine screen coordinates of click.\n\tvar mouse = new THREE.Vector2();\n\tmouse.x = (event.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the source for the user inputs to the given gate as the given observable. If there was already a source, it is replaced. | setUserInput (gate, observable) {
if (userInputsSubscriptions.has(gate.id)) {
userInputsSubscriptions.get(gate.id).unsubscribe()
}
userInputsSubscriptions.set(
gate.id,
observable.subscribe((...args) => {
getUserInput(gate).next(...args)
})
)
} | [
"function setUserInput (gate, state, value) {\n state.inputs[gate.id] = value\n}",
"UPDATE_EXCHANGE_SOURCE (_state, _exchangeSource) {\n _state.exchangeSource = _exchangeSource\n }",
"getInputs (gate) {\n if (!inputSubjects.has(gate.id)) {\n const gatePinSubjects = (\n ga... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/////////////////////////////////////////////////////////////////////////////////////////// p.258 updating game info updateGameInfo() resets display to initial values when a new game starts | function updateGameInfo() {
var $ = jewel.dom.$;
$("#game-screen .score span")[0].innerHTML = gameState.score;
$("#game-screen .level span")[0].innerHTML = gameState.level;
} | [
"function displayGameInfo(){\n // Game Stats\n document.getElementById(\"dealer-points\").innerHTML = dealer.points;\n document.getElementById(\"player-points\").innerHTML = player.points;\n document.getElementById(\"bet-amount\").innerHTML = player.bet;\n document.getElementById(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper for creating derived property definitions | function createDerivedProperty(modelProto, name, definition) {
var def = modelProto._derived[name] = {
fn: isFunction(definition) ? definition : definition.fn,
cache: (definition.cache !== false),
depList: definition.deps || []
};
// add to our shared dependency list
def.... | [
"inherit(property) {\n }",
"createProperty(obj, name, value, post = null, priority = 0, transform = null, isPoly = false) {\n obj['__' + name] = {\n value,\n isProperty: true,\n sequencers: [],\n tidals: [],\n mods: [],\n name,\n type: obj.type,\n __owner: obj,\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if the state or payload is malformed | function stateAndPayloadAreValid(config, state, payload) {
// ensure that the instances array exists
if (! Array.isArray(state[config.stateKey])) {
console.error(`State does not contain an "${ config.stateKey }" array.`);
return false;
}
// ensure that the payload contains an id
if... | [
"function stateAndPayloadAreValid(config, state, payload) {\n\n // ensure that the instances array exists\n if (!Array.isArray(state[config.stateKey])) {\n console.error('State does not contain an \"' + config.stateKey + '\" array.');\n return false;\n }\n\n // ensure that the payload cont... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a list of explanations, renders them in the explanation box | function updateExplanation(explanation) {
var update = d3.select('#explanation')
.selectAll('li')
.data(explanation);
update.text(function(d) { return d; });
update.enter()
.append('li')
.text(function(d) { return d; });
update.exit().remove();
... | [
"function questions_html(){\n let html = \"<ol>\";\n let nr = 0;\n if ( Object.keys( self.questions ).length > 0 ) for (const answers of Object.values( self.questions )){\n nr += 1;\n html += \"<li>\";\n if ( self.headers && self.headers[ nr ] ) html += \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. lookup division type def 2. create n number of subdivisions of that type as contents of dividing element 3. optional could be to update the duration of the top level... or maybe it makes sense to create the measures first before creating the staves but if the score is proportional notation, it doesn't matter what th... | createSubdivisions(dataset)
{
console.log('createSubdivisions', dataset);
let target = document.getElementById(dataset.target);
// could evaluate function for the tree here
let treeStr = dataset.division_tree;
let tree;
if( treeStr.indexOf("x") != -1 )
... | [
"function createMeasureDIV(measure) {\n var positionArray = tixlb[measure];\n var line = positionArray[0];\n var bar = positionArray[1];\n //var measure_width = bars[line].xs[bar] - bars[line].xs[bar-1];\n //var measure_height = bars[line].ys[bar] ;\n\n var coord = getCoordforMeasure(measure);\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Nth cataln number Cn = 1/n+1 2nCn | function catalan(n) {
let c = combination(2 * n, n);
return Math.floor(c / (n + 1));
} | [
"function c(N, K) {\n var C = [];\n for (let n=0; n<=N; n++) {\n C[n] = [1]\n C[0][n] = 0\n }\n for (let n=1; n<=N; n++) {\n for (let k=1; k<=N; k++) {\n let k0 = (k <= n-k) ? k : n-k\n if (n < k)\n C[n][k] = 0\n else if (n===k)\n C[n][k] = 1\n else\n C[n][k] = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Conversion time from DEGREE fromat to H:M:S:MS format time output time_deg input time in range 0 deg to 360 deg where 0 deg = 0:00 AM and 360 deg = 12:00 PM | SetDegTime(time_deg)
{
var time_hr = 0.0;
time_deg = GCMath.putIn360(time_deg);
// hour
time_hr = time_deg / 360 * 24;
this.hour = parseInt( Math.floor(time_hr));
// minute
time_hr -= hour;
time_hr *= 60;
this.min = parseInt( Math.floor(time... | [
"function getTime(time) {\n var tempTime;\n tempTime = replaceAt(time, 2, \"h\");\n tempTime = replaceAt(tempTime, 5, \"m\");\n tempTime += \"s\";\n return tempTime;\n }",
"function hmsToDegrees(h, m, s) {\n\t//1 hour = 15 degrees\n\t//1 minute = 1/4 degree\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UPDATE TABLE FUNCTIONS /update of table on user input parameters: type sort|filter (two options how to update the table) columnId id of column according to which the update will be performed | function updateDynamicTable(type, colIndex, userInput) {
//console.log("UPDATING");
if (type == "sortUp") {
sortTableUp(colIndex);
} else if (type == "sortDown") {
sortTableDown(colIndex);
} else {
filterTable(colIndex, userInput);
}
// write edited table to HTML
writeTableToHtml();
} | [
"updateColumn({ commit, state, rootState }, details) {\n const {\n columnData, columnIndex, tableIndex, tagIndex,\n } = details;\n const tableId = state.tagList[tagIndex].tables[tableIndex]._id;\n return axios.patch(\n `${constant.api.enframe}apps/${rootState.application.id}/tables... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clears the map and tiles. | function clear() {
// set map to 0
for (var x = 0; x < mWidth; x++) {
mMap[x] = mMap[x] || [];
for (var y = 0; y < mHeight; y++) {
mMap[x][y] = 0;
}
}
mMapNextIndex.x = 0;
mMapNextIndex.y = 0;
// reset tiles
mTiles.length = 0;
} | [
"function clearMap() {\n for (var i = 0; i < facilityMarkers.length; ++i) {\n facilityMarkers[i].setMap(null);\n }\n facilityMarkers = [];\n}",
"function eraseMap() {\n document.body.removeChild(map);\n }",
"function cleanMap() {\n\n\t// Disable position selection by mouse click.\n\tdisablePositionSel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts, formats and downloads the data from chapter message, adds it to the full book, and sends the command to load the next chapter. | function chapterMessage(message) {
let chapterText = createChapter(message.titleText, message.bodyText, ++chapterNum);
fullBook = fullBook.concat(chapterText);
const chapterBlob = new Blob(chapterText);
const chapterURL = URL.createObjectURL(chapterBlob);
let titleText = message.titleText.replace(/\... | [
"loadChapters() {\n\n if(this.getSpecification() === undefined)\n throw \"Specification isn't done loading, can't fetch chapters.\";\n else if(this.getSpecification() === null)\n throw \"Specification failed to load, can't fetch chapters\";\n\n\t\t// Request all of the chapter co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
It controls whether all ships are located on the game board, and if so, removes the distribution panel, and replace the original ship drawings with the corresponding locker background images. Parameters: none. | function fleet_ready(){
click_sound.play();
var contador = 0;
for(let i = 0; i < 15; i++) //It counts the emplaced ships.
if(own_fleet[i])
contador++;
if(contador == 15){ //If all ships era emplaced...
document.getElementById("game... | [
"function own_board_random_deployment(){\r\n \r\n click_sound.play();\r\n \r\n random_fleet_deployment(own_board, own_fleet); //It calls the random fleet distribution function.\r\n\r\n for(let i = 0; i < 15; i++){ //Loop that puts all distributed ships in place.\r\n\r\n if(i < 10){ //For all s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setGreenLights Set the traffic lights to green based on the direction of the traffic | setGreenLights() {
// Get the array traffic lights from the config
let lights = this.config.getDirections()[this.getDirectionIndex()];
// Set the traffic lights to green based on the direction of the traffic
lights.map((direction) => {this.trafficLights[direction].color = TRAFFIC_LIGHT_GREEN;});
// Set the ... | [
"setYellowLights() {\n\t\t// Get the array traffic lights from the config\n\t\tlet lights = this.config.getDirections()[this.getDirectionIndex()];\n\n\t\t// Set the traffic lights to green based on the direction of the traffic\n\t\tlights.map((direction) => {this.trafficLights[direction].color = TRAFFIC_LIGHT_YELLO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method takes a batch of inserted item statements and 1) identifies all parent bibIds (even if bibIds not present in those statements), and 2) posts them to the configured "IndexDocumentQueue" stream (which triggers reindexing by the discoveryapiindexer) | _writeToIndexDocumentQueue (batch) {
const streamName = process.env.INDEX_DOCUMENT_STREAM_NAME
const schemaName = process.env.INDEX_DOCUMENT_SCHEMA_NAME
// Make sure stream-writing is configured
if (streamName && schemaName) {
return this._getBibIdsForItemStatements(batch)
.then((bibIds) =... | [
"_getBibIdsForItemStatements (statements) {\n // Build hash mapping subject_ids to array of statements:\n const subjectIdGroups = statements.reduce((hash, statement) => {\n if (!hash[statement.subject_id]) hash[statement.subject_id] = []\n hash[statement.subject_id].push(statement)\n return has... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subtract and carry register from A | subcReg(register) {
const sum = regA[0] - register[0] - ((regF[0] & F_CARRY) ? 1 : 0);
regA[0] = sum;
// TODO: test carry register
regF[0] = F_OP | (regA[0] ? 0 : F_ZERO) | ((sum < 0) ? F_CARRY : 0);
if ((regA[0] ^ register[0] ^ sum) & 0x10) regF[0] |= F_HCARRY;
return 4;
} | [
"function byteopsCSubQ(a) {\r\n a = a - paramsQ; // should result in a negative integer\r\n // push left most signed bit to right most position\r\n // remember javascript does bitwise operations in signed 32 bit\r\n // add q back again if left most bit was 0 (positive number)\r\n a = a + ((a >> 31) &... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the environment variables from the specified file. | function getEnvVarsFromFile(envFile) {
const envVars = Object.assign({}, process.env)
if (process.env.APPDATA) {
envVars.APPDATA = process.env.APPDATA
}
// Read from the JSON file.
const jsonString = fs.readFileSync(path.resolve(process.cwd(), envFile), {
encoding: "utf8"
})
const varsFromFile =... | [
"get environment() {\n if (this._enviornment)\n return Promise.resolve(this._enviornment);\n return fs.readFile(this.environmentPath).then((file) => __awaiter(this, void 0, void 0, function* () {\n let localEnvironment = jsonc.parse(file.toString());\n if (!localEnviro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the template of the ship based on type | getTemplate(type) {
switch (type) {
case SHIP_TYPE_1:
return SHIP_TYPE_1_TEMPLATE;
case SHIP_TYPE_2:
return SHIP_TYPE_2_TEMPLATE;
case SHIP_TYPE_3:
return SHIP_TYPE_3_TEMPLATE;
}
} | [
"getTemplate(tname) {\n let template = this.templates[tname]\n if (!template) {\n template = new Template(this, tname);\n this.templates[tname] = template;\n }\n return template;\n }",
"getTemplate(name) {\n return this.templa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the request type from the intent or returns an error | function getRequestTypeFromIntent(request) {
console.log('entering getRequestTypeFromIntent function');
var dataTypeSlot = request.slot('DataType');
// slots can be missing, or slots can be provided but with empty value.
// must test for both.
if (!dataTypeSlot) {
return {
error:... | [
"static isV1Request(request, type) {\n switch(type) {\n case DaxMethodIds.getItem:\n return !DynamoDBV1Converter._isArrayEmpty(request.AttributesToGet);\n case DaxMethodIds.batchGetItem:\n if(!DynamoDBV1Converter._isMapEmpty(request.RequestItems)) {\n for(const tableName of Objec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets info for all streamers on the twitchStreamers list | function getAllStreamersData(streamerList, onOfforAll) {
streamerList.forEach(function(streamer) {
var url = "https://wind-bow.glitch.me/twitch-api/streams/" + streamer;
var request = new XMLHttpRequest();
request.onload = function () {
if (request.status == 200) {
resultsObject = JSON.parse... | [
"function getAllStreamers() {\r\n clearElements();\r\n getStreamData(\"all\");\r\n }",
"function getStreamList(streamPlayerList) {\n $(\".streams\").remove();\n $(\".streamlist\").append('<img id=\"loadingGIF\" src=\"loading.gif\" >');\n for (var i = 0; i < streamPlayerList.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search form at the header | function showSearch() {
tm.fromTo($searchForm, .3, {'display': 'none', y: -220}, {'display': 'block', y: 0, ease: Power3.easeInOut})
} | [
"function search_home_page(){\n $('.header .icon-search .fa-search').on('click', function(){\n $('header').toggleClass('active-search-form');\n $('.header.active-search-form input').focus();\n });\n $('.header .icon-search .fa-remove').on('click', function(){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
email twitter to all contacts | function bEmailTwitterAllCon(broadCast_sender_email,broadCast_name,broadCast_sender_name,broadCast_message,broadCast_email_subject,x)
{
$('#takeOneAction').val('false');
var rEmail=1;var rTts=0;var rSms=0;var rTwitter=1;
//checks of validations
generalValidations(broadCast_name,broadCast_message);
var isvalid = em... | [
"function bEmailSmsTwitterAllCon(senderId,broadCast_sender_email,broadCast_name,broadCast_sender_name,broadCast_message,broadCast_email_subject,x)\n{\n\t$('#takeOneAction').val('false');\n\tvar rEmail=1;var rTts=0;var rSms=1;var rTwitter=1;\n\t//checks of validations\n\tsmsCntVal(senderId);\n\tgeneralValidations(br... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copies all HTMl attributes from one DOM node to another. | function copyHtmlAttributes(srcEl, dstEl) {
for (var atts = srcEl.attributes, ic = atts.length, i = 0; i < ic; ++i) {
dstEl.setAttribute(atts[i].nodeName, atts[i].nodeValue);
}
} | [
"cloneAttributes(target, source) {\n [...source.attributes].forEach( attr => { target.setAttribute(attr.nodeName === \"id\" ? 'data-id' : attr.nodeName ,attr.nodeValue) })\n }",
"function addAttributes(node, attrs) {\n for (var name in attrs) {\n var mode = attrMo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of all the active players present on the provided ref instance (which can be an instance of a directive, component or element). This function will only return players that have been added to the ref instance using `addPlayer` or any players that are active through any template styling bindings (`[style]`... | function getPlayers(ref) {
var context = getLContext(ref);
if (!context) {
ngDevMode && throwInvalidRefError();
return [];
}
var stylingContext = getStylingContext(context.nodeIndex, context.lView);
var playerContext = stylingContext ? getPlayerContext(stylingContext) : null;
ret... | [
"function getAllPlayers() {\n var players = [];\n\n Object.keys(io.sockets.connected).forEach(function(socketId) {\n var player = io.sockets.connected[socketId].player;\n\n if (player) {\n players.push(player);\n }\n });\n\n return players;\n}",
"setActivePlayersIds() {\n\t\tlet activePlayersIds... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private methods: Given a latitude and longitude, this method looks through all the stored locations and returns the index of the location with matching latitude and longitude if one exists, otherwise it returns null. | function indexForLocation(latitude, longitude)
{
for (var i = 0; i < locations.length; i++ ){
var location = me.locationAtIndex(i);
if (location.latitude == latitude && location.longitude == longitude){
return i
}
}
} | [
"function indice(lat, lon, array){\n\tvar n = array.length;\n\tindex = -1;\n\tfor (var i = 0 ; i < n; i++) {\n\t\tif (Number(array[i][0]) == lat && Number(array[i][1]) == lon){\n\t\t\tindex = i;\n\t\t\treturn index;\n\t\t}\n\t}\n\treturn index;\t\n\t\t\n}",
"existLatLon(locationObject, array) {\n let exist = f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the role definition with the specified name | getByName(name) {
return RoleDefinition(this, `getbyname('${name}')`);
} | [
"function retrieveRoleByName(name) {\n return new Promise(function(resolve, reject) {\n Role.findOne({ name })\n .lean()\n .then(function(role) {\n resolve(role);\n })\n .catch(function(err) {\n reject(err);\n });\n });\n}",
"function getUserRole(name, role){\n switc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switches back to default content. For example when you selected the frame and need to get out from it. | static async switchToDefaultContent() {
await browser.switchTo().defaultContent();
} | [
"function clearContentBox(){\n\t\tcontent.html('');\n\t}",
"function OLiframeBack(){\r\n if(parent==self){\r\n alert('This feature is only for iframe content');\r\n return;\r\n }\r\n history.back();\r\n}",
"function backToWinMenu() {\n changeVisibility(\"menu\");\n changeVisibility(\"winScreen\");\n} //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function to construct a legend for the given singleband vis parameters. Requires that the vis parameters specify 'min' and 'max' but not 'bands'. | function makeLegend(vis) {
var lon = ee.Image.pixelLonLat().select('longitude');
var gradient = lon.multiply((vis.max-vis.min)/100.0).add(vis.min);
var legendImage = gradient.visualize(vis);
// In case you really need it, get the color ramp as an image:
print(legendImage.getThumbURL({bbox:'0,0,100,8', dime... | [
"function makeLegendBins(input_raster) {\n\t\tvar population_raster_colours = [\"#ffffcc\", \"#a1dab4\", \"#41b6c4\", \"#2c7fb8\", \"#253494\"];\n\t\tvar population_raster_bins = [\"0-4\", \"4-7\", \"7-10\", \"10-14\", \">14\"];\n\t\tvar travel_time_raster_colours = [\"#ca0020\", \"#eb846e\", \"#f5d6c8\", \"#cee3ed... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether the HTML document is trusted. If trusted, it can execute Javascript in the iframe sandbox. | get trusted() {
return this.content.sandbox.indexOf('allow-scripts') !== -1;
} | [
"function in_iframe () {\r\n try {\r\n return window.self !== window.top;\r\n } catch (e) {\r\n return true;\r\n }\r\n }",
"function secure(spec) {\n\n /*\n * Based on web workers. The sandboxed env. is isolated\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
let procesar = (unArray,callback) => callback (unArray); | function procesar (unArray, callback) {
return callback (unArray)
} | [
"function callback(callback){\n callback()\n}",
"function myFilter(array, callback) {\n return callback(array);\n}",
"function tap(arr, callback){\n callback(arr); \n return arr;\n}",
"function doToArray(array, callback){\n array.forEach(callback)\n}",
"function iterate(callback){\n let array = [\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a 2d plane tag. Image must be in resource folder. does not actuall add to scene. Adds to a list of tags. | function AddTag(image){
var texture = THREE.ImageUtils.loadTexture("img/"+image);
var geometry = new THREE.PlaneGeometry(2,2);
var material = new THREE.MeshBasicMaterial( { map: texture} );
var tag = new THREE.Mesh( geometry, material );
tag.lookAt(camera.position);
$(tag).click(function(){
console.log("clicked... | [
"function makePlane(width, height){\n var vertexPositionData = [];\n var normalData = [];\n var textureCoordData = [];\n for (var i = 0; i <= height; i++) {\n for (var j = 0; j <= width; j++) {\n //vertex positions rangeing from -1 to 1\n var x = 2*(i / height) - 1;\n var y = 2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter a parse tree produced by KotlinParsernamedInfix. | enterNamedInfix(ctx) {
} | [
"enterInfixFunctionCall(ctx) {\n\t}",
"enterPreprocessorParenthesis(ctx) {\n\t}",
"enterInOperator(ctx) {\n\t}",
"enterPostfixUnaryOperation(ctx) {\n\t}",
"enterPostfixUnaryExpression(ctx) {\n\t}",
"enterMultiVariableDeclaration(ctx) {\n\t}",
"enterJumpExpression(ctx) {\n\t}",
"enterBlockLevelExpressi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION FOR POPULATING MY MOVIES FROM FIREBASE | function populateMyMoviesPage() {
getjson('https://user-enter-luke.firebaseio.com/users.json')
p.then(function(data) {
moviesAdded = [];
moviesViewed = [];
if (data !== null) {
for (var i = 0; i < data[userID].movies.length; i++) {
moviesAdded.push(data[userID].movies[i]);
}
for (var i = 0; i < data[... | [
"function getPlayers() {\n var ref = new Firebase(\"https://tictacstoe.firebaseio.com/players\");\n var players = $firebaseObject(ref);\n\n players.tictacs = [];\n players.tictacs.push({\n type: \"spearmint\",\n image: \"images/green-tic.png\",\n alt: \"green\"\n });\n players.ticta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
subscribeclose or outside of form is clicked exit form | function exitSubscribeForm() {
$('.subscribe-overlay').hide();
$('.subscribe-form').css('top', '28%');
$('.subscribe-form').hide();
} | [
"function addCloseButtonFunctionality(){\n\t\t\t\n\t\t\t\n\t\t}",
"close() {\n this.showModal = false;\n\n this.onClose();\n }",
"function cpsh_onClose(evt) {\n if (processed) {\n WapPushManager.close();\n return;\n }\n quitAppConfirmDialog.hidden = false;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(Internal) Gets a space separated list of the class names on the element. The list is wrapped with a single space on each end to facilitate finding matches within the list. | function classList(element) {
return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
} | [
"function getClassNames(node) {\n\tif (node) {\n\t\tvar classAttrName = 'class';\n\t\tvar classNames = node.getAttribute(classAttrName) || \"\";\n\t\treturn classNames.split(/\\s+/).filter(function(n) {\n\t\t\treturn n != '';\n\t\t});\n\n\t}\n}",
"function getClassNames() {\n\tvar names = [];\n\tfor (var name in ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove Phase from challenge Phases list | removePhase (index) {
const { challenge: oldChallenge } = this.state
const newChallenge = { ...oldChallenge }
const newPhaseList = _.cloneDeep(oldChallenge.phases)
newPhaseList.splice(index, 1)
newChallenge.phases = _.clone(newPhaseList)
this.setState({ challenge: newChallenge })
} | [
"removeTexture(texture) {\n // remove from our textures array\n this.textures = this.textures.filter(element => element.uuid !== texture.uuid);\n }",
"function removeQuestion() {\n removeQuestionID = questions.indexOf(selectedQuestion);\n questions.splice(removeQuestionID, 1);\n answerLi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function transfers the collected airport data into a global variable and collects the data of all routes in a country Parameters: Returns: | function generateAirportList(airportData)
{
// Transfer Airport Data to Global Variable
airports = airportData;
// Make Web Service Request
let url = "https://eng1003.monash/OpenFlights/allroutes/";
let data = {
country: countryRef.value,
callback: "generateAllRoutes"
}
webS... | [
"function analyticsLaneGeo(){\r\n\r\n // Customer Number\r\n ds_Analytics.cusPrefix = cusprefix;\r\n ds_Analytics.cusBase = cusbase;\r\n ds_Analytics.cusSuffix = cussuffix;\r\n\r\n // Lane Geography\r\n for (var i = 0; i < geo.length; i++) {\r\n switch (geo[i][\"geotype\"]) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a user or update user info when request with userId | function addUpdateUser (req,res) {
const { userId } = req.body;
// console.log(req.body);
if (userId) {
User.findOneAndUpdate({ _id: userId },
req.body,
{ new: true },
)
.exec()
.then(user => {
// user.password = undefined;
return res.json({ status: 0, data: {} });
... | [
"function signup(userData){\n console.log(\"creating new user \"+userData.id);\n return User.create(userData)\n }",
"async function createUser() {\n const response = await fetch(`/api/users/`, {\n method: 'POST',\n body: JSON.stringify(userData),\n headers:{\n 'Content-Type': 'appl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOTE(liayoo): Bytes for some data (e.g. parents & children references, version) are excluded from this calculation, since their sizes can vary and affect the gas costs and state proof hashes. 4(isLeaf) + 132(proofHash) + 8(treeHeight) + 8(treeSize) + 8(treeBytes) = 160 | computeNodeBytes() {
return sizeof(this.value) + 160;
} | [
"function verify(proof, j) {\n const path = proof.path.toString('hex');\n const value = proof.value;\n const parentNodes = proof.parentNodes;\n const header = proof.header;\n const blockHash = proof.blockHash;\n const txRoot = header[j]; // txRoot is the 4th item in the header Array\n try{\n var currentN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exit a parse tree produced by KotlinParsernullableType. | exitNullableType(ctx) {
} | [
"exitParenthesizedType(ctx) {\n\t}",
"exitAnnotationTypeMemberDeclaration(ctx) {\n\t}",
"exitUnannTypeVariable(ctx) {\n\t}",
"enterNullableType(ctx) {\n\t}",
"exitFloatingPointType(ctx) {\n\t}",
"exitSingleTypeImportDeclaration(ctx) {\n\t}",
"exitUnannPrimitiveType(ctx) {\n\t}",
"exitTypeConstraints(c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Split this BSplineSurface into two at uk, by refining uknots | splitU(uk) {
let r = this.u_degree;
// Count number of times uk already occurs in the u-knot vector
// We have to add uk until it occurs r-times in the u-knot vector,
// where r is the u-degree of the curve
// In case there are knots in the u-knot vector that are equal to uk
... | [
"splitV(vk) {\n let r = this.v_degree;\n // Count number of times vk already occurs in the v-knot vector\n // We have to add vk until it occurs r-times in the v-knot vector,\n // where r is the v-degree of the curve\n // In case there are knots in the v-knot vector that are equal ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Similar to FastPath.prototype.call, except that the value obtained by accessing this.getValue()[name1][name2]... should be arraylike. The callback will be called with a reference to this path object for each element of the array. | each(callback, ...names) {
const {
stack
} = this;
const {
length
} = stack;
let value = getLast(stack);
for (const name of names) {
value = value[name];
stack.push(name, value);
}
for (let i = 0; i < value.length; ++i) {
if (i in... | [
"each(callback, ...names) {\n const {\n stack\n } = this;\n const {\n length\n } = stack;\n let value = getLast(stack);\n\n for (const name of names) {\n value = value[name];\n stack.push(name, value);\n }\n\n for (let i = 0; i < value.length; ++i) {\n if (i in value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET testing all stack | function testGetAllStack(done) {
chai.request(server)
.get(BASEURL + 'all')
.end(function(err, res) {
res.should.be.json;
res.body.should.be.a('object');
res.body.should.have.property('status');
res.body.should.have.property('success');
res... | [
"function testGetStackById(done, stack) {\n chai.request(server)\n .get(BASEURL + 'id/' + stack._id)\n .end(function(err, res) {\n res.should.be.json;\n res.body.should.be.a('object');\n res.body.should.have.property('status');\n res.body.should.have.prop... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when we move from point1 to point2 how we make this move ? The retuen value looks like: | static findMoveDirection(point1, point2) {
return [
point2.y > point1.y ? interface_4.Direction.TOP : interface_4.Direction.BOTTOM,
point2.x > point1.x ? interface_4.Direction.RIGHT : interface_4.Direction.LEFT
];
} | [
"function moveOrigin(points, newOriginX, newOriginY){\n for(var i = 0; i<points.length; i+=2){\n points[i] -= newOriginX;\n points[i+1] -= newOriginY;\n }\n}",
"moveTo(x, y) {\n let coordinates = this.getXY();\n this.x = x + coordinates.x;\n this.y = y + coordinates.y;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function called which verifies that a coupon code is valid, the coupon is not expired. A coupon is no more valid on the day AFTER the expiration date. All dates will be passed as strings in this format: "MONTH DATE, YEAR". | function checkCoupon(enteredCode, correctCode, currentDate, expirationDate){
console.log(enteredCode + ' ' + correctCode + ' ' + currentDate + ' ' + expirationDate)
console.log(enteredCode.length);
if(enteredCode.toString().length < 3 || enteredCode.toString() != correctCode.toString() || enteredCode == '') {
r... | [
"function checkCoupon(coupon) {\n// console.log(\"==checkCoupon==\");\n// set a limit to the expiration date of the coupon\nvar expirationDate = new Date(coupon);\nexpirationDate.setHours(23);\nexpirationDate.setMinutes(59);\nexpirationDate.setSeconds(59);\n// checking if the coupon's date exceeds the END of the da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LotLineSprite This Sprite is draw lot line for the slot machines. | function LotLineSprite() {
this.initialize.apply(this, arguments);
} | [
"function hLine(i){\n var x1 = scaleUp(0);\n var x2 = scaleUp(boardSize - 1);\n var y = scaleUp(i); \n drawLine(x1, x2, y, y);\n //alert(\"i:\" + i+ \" x1:\"+x1+ \" x2:\"+x2+\" y1:\"+y+ \" y2:\"+y);\n }",
"function drawLine() {\n let draw = game.add.graphics();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides any cells and headers in a table if they have no content to prevent empty rows from displaying in grid layout when all cells are render=false or hidden by disclosure | function hideEmptyCells() {
// get all the td elements
jQuery('td.' + kradVariables.GRID_LAYOUT_CELL_CLASS).each(function () {
// check if the children is hidden (progressive) or if there is no content(render=false)
var cellEmpty = jQuery(this).children().is(".uif-placeholder") || jQuery(this).i... | [
"function hide_empty_columns(table) {\r\n\t\tvar column_count = 0;\r\n\t table.each(function(a, tbl) {\r\n\t $(tbl).find('th').each(function(i) {\r\n\t \tcolumn_count++;\r\n\t var remove = true;\r\n\t var currentTable = $(this).parents('table');\r\n\t var tds = curr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================================================================== isTouchDevice return true if it is a touch device ========================================================================== | function isTouchDevice() {
return !!('ontouchstart' in window) || ( !! ('onmsgesturechange' in window) && !! window.navigator.maxTouchPoints);
} | [
"get isTouch()\n {\n return \"ontouchstart\" in window;\n }",
"function deviceHasTouchScreen() {\n let hasTouchScreen = false;\n if (\"maxTouchPoints\" in navigator) {\n hasTouchScreen = navigator.maxTouchPoints > 0;\n } else if (\"msMax... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParsernull_statement. | visitNull_statement(ctx) {
return this.visitChildren(ctx);
} | [
"function NilNode() {\n}",
"visitRespect_or_ignore_nulls(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"lesx_parseEmptyExpression() {\n var node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);\n return this.finishNodeAt(node, 'LesxEmptyExpression', this.start, this.startLoc);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handler for receiving a new Missile | function handleMissileNew(data){
MyGame.handlers.MissileHandler.handleNewMissile(data.message);//send everything
//Call correct Audio
if(data.message.owner == 'player'){
MyGame.handlers.AudioHandler.handleNewGlobalAudio({
type:'laser',
center:... | [
"function handleMissileDestroyed(data){\n MyGame.handlers.MissileHandler.destroyMissile(data.message);//pass in only id of missile\n }",
"function shootMissile() {\n playerMissiles.push(new Sprite(playerObj.top - 8, playerObj.left + 34, 3, 10));\n //invoke draw missiles\n drawMissil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Log file changes to console | function logFileChange(event) {
var fileName = require('path').relative(__dirname, event.path);
console.log('[' + 'WATCH'.green + '] ' + fileName.magenta + ' was ' + event.type + ', running tasks...');
} | [
"function logFileChange(event) {\n\t\tvar fileName = require('path').relative(__dirname, event.path);\n\t\tconsole.log('[' + 'WATCH'.green + '] ' + fileName.magenta + ' was ' + event.type + ', running tasks...');\n\t}",
"function logFile() {\n\tuserInput = userInput.join(' '); // join the array with spaces\n\tvar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a file in specified (bucket, key) | function getFileS3(filename, key, bucket, callback) {
var params = {Bucket: bucket, Key: key};
var file = require('fs').createWriteStream(filename);
s3.getObject(params).createReadStream().on("finish", callback).pipe(file);
} | [
"function getS3(callback, key, bucket, callback) {\n var params = {Bucket: bucket, Key: key};\n s3.getObject(params, callback).send();\n}",
"retrieve(key) {\n // const strKey = typeof key === 'number' ? key.toString() : key;\n const index = getIndexBelowMax(key, this.limit);\n const bucket = this.stora... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To disable logging on stdout, should be enabled in production. Log and debug will only write to the logfile. | function disableStdout() {
isStdoutDisabled = true;
} | [
"function stopLogging() {\n chrome.send('setLoggingEnabled', [false]);\n $('logs').innerHTML = '';\n $('start-logging').hidden = false;\n $('stop-logging').hidden = true;\n}",
"function debugLog() {\n if (_debug) {\n console.log.apply(console, arguments);\n }\n }",
"function conf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enable a previously disabled rule for this node. | enableRule(ruleId) {
this.disabledRules.delete(ruleId);
} | [
"enable() {\n const eqs = this.equations;\n for (let i = 0; i < eqs.length; i++) {\n eqs[i].enabled = true;\n }\n }",
"function setEnabled(){\n\t'use strict';\n\tif($('input:radio[name=cats]:checked').val()===\"opt1\"){\n\t\t$(\"#category\").removeAttr(\"disabled\");\n\t\t$(\"#oldlabel\").css('colo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prevent element from connecting when it's upgrade disabled. This prevents user code in `attached` from being called. | connectedCallback() {
if (!this.__isUpgradeDisabled) {
super.connectedCallback();
}
} | [
"_onDetachEnabled( event) {\n this.detached = true;\n if( event.cancellable) { event.stopPropagation(); }\n }",
"onDisabled() {\n this.updateInvalid();\n }",
"function checkElementNotDisabled(element) {\r\n if (element.disabled) {\r\n throw {statusCode: 12, value: {message: \"Cannot operate... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: doLMSInitialize() Inputs: None Return: CMIBoolean true if the initialization was successful, or CMIBoolean false if the initialization failed. Description: Initialize communication with LMS by calling the LMSInitialize function which will be implemented by the LMS. | function doLMSInitialize()
{
var api = getAPIHandle();
if (api == null)
{
messageAlert("Unable to locate the LMS's API Implementation.\nLMSInitialize was not successful.");
return "false";
}
var result = api.LMSInitialize("");
if (result.toString() != "true")
{
var err = Error... | [
"function LMSInitialize() \n{\n\tvar strResult = strCMIFalse\n\tif (objAPI != null){\n\t\tstrResult = objAPI.LMSInitialize(strEmptyString)\n\t\tif(strResult == strCMITrue){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\thandleSCORMError();\n\t\t\treturn false;\n\t\t}\n\t}\n\telse{\n\t\thandleSCORMError();\n\t\treturn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw the line d which has 1/d length | function draw_d_line() {
//Calculate x and y endpoints and starting position
var right_edge = EW_CENTER_POINT.x + inverseWavelength
var deltaX = inverseD * Math.cos(radians_90)
var deltaY = inverseD * Math.sin(radians_90)
ctxe.beginPath()
ctxe.moveTo(right_edge, EW_CENTE... | [
"function drawLine(svg){\t\n\t\t\tsvg.style.strokeOpacity = '0.6';\n\t\t\tvar length = svg.getTotalLength();\n\t\t\t// Clear any previous transition\n\t\t\tsvg.style.transition = svg.style.WebkitTransition ='none';\n\t\t\t// Set up the starting positions\n\t\t\tsvg.style.strokeDasharray = length + ' ' + length;\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add an asynchronous validator or validators to this control, without affecting other validators. When you add or remove a validator at run time, you must call `updateValueAndValidity()` for the new validation to take effect. Adding a validator that already exists will have no effect. | addAsyncValidators(validators) {
this.setAsyncValidators(addValidators(validators, this._rawAsyncValidators));
} | [
"setNewValidators(newValidators) {\r\n super.setValidators(newValidators ? newValidators.validators.map(validator => validator && validator[1]) : null);\r\n super.setAsyncValidators(newValidators && newValidators.asyncValidators\r\n ? newValidators.asyncValidators.map(validator => validator... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render a single task assignee | renderAssignee (assignee) {
const assigneeDisplay = assignee.fullName || assignee.displayName || assignee.username || assignee.email;
const assigneeHeadshot = Utils.renderUserHeadshot(assignee);
return `
${assigneeHeadshot}
<span class="assignee">${assigneeDisplay}</span>
`;
} | [
"function assignTask(taskStringId, assigneeStringId) {\n client.tasks.update(taskStringId, {assignee: assigneeStringId});\n}",
"async getTaskAssign() {\n let boardMembers;\n const boardResponse = await boardGet(this.taskData.boardID);\n if (!(await this.handleResponseStatus(boardResponse, (b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to save data from single trial | function saveSingleTrial(data, subjid, task_url, trialnum, correct){
// Use jQuery to send an AJAX post request to savejsptrial/
$.ajax(
{
type: 'POST',
url: '/savejsptrial/',
data: {
// Need to add parent study fields
'jsPsychData': data,
'subjid': subjid,
'task_url': t... | [
"function saveParticipantData() {\n \n var nameStr = []; valStr = [];\n var firstPFpauses = 0; secondPFpauses = 0;\n var firstPFcorrect = 0; secondPFcorrect = 0;\n var SLcorrect = 0; numCorr = 0; \n exp_data[\"SL2subject\"] = subjectID;\n exp_data[\"SL2condition\"] = condition;\n exp_data[\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Listener for changes to ColumnMappingManager. Recalculates the number of applicable column mappings to the current layers. | onColumnMappingsChange_() {
this['mappingCount'] = 0;
var mappings = vectortools.getColumnMappings(this.scope_['sourceIds']);
for (var key in mappings) {
var columnsMap = mappings[key];
this['mappingCount'] += googObject.getCount(columnsMap);
}
ui.apply(this.scope_);
} | [
"recalculateColumnWidths() {\n if (!this._columnTree) {\n return; // No columns\n }\n if (this._cache.isLoading()) {\n this._recalculateColumnWidthOnceLoadingFinished = true;\n } else {\n const cols = this._getColumns().filter((col) => !col.hidden && col.autoWidth);\n this._recalcula... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Conditionally rendering if the button will be highlighted in light blue or else Once button is clicked, handlePending() will run | ifPending() {
if (this.state.status == 'PENDING') {
return <Button size="small" variant="outlined" style={{
textTransform: 'none',
backgroundColor: '#D6E4FF',
fontSize: '10px'
}} onClick={() => this.handlePending()}>Pending</Button>;
} else {
return <Button size="small"... | [
"ifIncomplete() {\n if (this.state.status == 'INCOMPLETE') {\n return <Button size=\"small\" variant=\"outlined\" style={{\n textTransform: 'none',\n fontSize: '10px',\n backgroundColor: '#D6E4FF',\n }} onClick={() => this.handleIncomplete()}>Incomplete</Button>;\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When clicked on search result, scroll search results window away and select the correct ticket. Scroll the right side of the page to the correct ticket. | function ticketSelectScroll(ticket_number){
$('#search_results').slideUp("fast");
$('#search_field').css('border-radius','10px 10px 10px 10px');
//scroll the right box div
console.log(`Scrolling to: ${ticket_number}`);
var elmnt = document.getElementById(`ticket_row_${ticket_number}`);
//c... | [
"function resultsResetScroll() {\n\t\t\tvar resultListing = document.getElementById('resultListing'),\n\t\t\t\tresultDocs = document.getElementById('resultDocs');\n\n\t\t\tif (resultListing) {\n\t\t\t\tresultListing.scrollTop = 0;\n\t\t\t}\n\n\t\t\tif (resultDocs) {\n\t\t\t\tresultDocs.scrollTop = 0;\n\t\t\t}\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the first item in the list found in the Git tree, or null if none of the items exists in the array. | function getFirstFoundInTree(paths, ...items) {
for (const item of items) {
const path = paths.find(p => p.path === item);
if (path) {
return path;
}
}
return null;
} | [
"findFirst(_value) {\n if (this.head === null && this.tail === null) {\n // no nodes in the list\n return null;\n } else {\n // check each node's value one by one from the beginning of the chain\n let current = this.head;\n while (current.nextNode !== null) {\n if (current.valu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enumerate the tokens of an organization This API allows to enumerate the tokens of an organization. organizationId String The organizationid represents an organization that is included in the SigninToday application, also know as slug and it is used as a path parameter to restrict the asked functionality to the specifi... | static list_tokens({ organizationId, whereUnderscoreuser, whereUnderscorelabel, count, page }) {
return new Promise(
async (resolve) => {
try {
resolve(Service.successResponse(''));
} catch (e) {
resolve(Service.rejectResponse(
e.message || 'Invalid input',
... | [
"static list_user_tokens({ organizationId, userId, page, count }) {\n return new Promise(\n async (resolve) => {\n try {\n resolve(Service.successResponse(''));\n } catch (e) {\n resolve(Service.rejectResponse(\n e.message || 'Invalid input',\n e.status ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert tableColumns into List of object | static serializeColumns(list) {
let rslts = [];
for (let m of list) {
if (m instanceof Object) {
if (m instanceof TableColumn) {
rslts.push(m.getData());
} else {
rslts.push(m);
}
}
}
return rslts;
} | [
"static parseColumns(list) {\n let rslt = [];\n\n for (let m of list) {\n if (m != null && m instanceof Object && typeof m['name'] === 'string') {\n let type = 'string';\n\n if (typeof m['type'] === 'string') {\n type = m['type'];\n }\n\n rslt.push(new TableColumn(m['... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the array of inspiration ids to check if the current image has been saved or not | function check_set_save_inspirations(current_img_id,save_img_btn) {
$.post(RELATIVE_PATH + '/config/processing.php',{form : 'Inspiration Sidebar Saved Arr'}, function(data) {
// alert(current_img_id);
if ($.inArray(current_img_id, data) !== -1)
{
$(save_img_btn... | [
"infoResponseIsInStore() {\n const responses = this.currentInfoResponses();\n if (responses.length === this.imageServiceIds().length) {\n return true;\n }\n return false;\n }",
"currentInfoResponses() {\n const { infoResponses } = this.props;\n\n return this.imageServiceIds().map(imageId =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deselect a single seat | function deselectSeat (id) {
if (parseInt(numSeats) === 1) {
firebase.database().ref('/Saler/' + settings.salNummer + '/Personer/' + sessionId).remove()
removeGreenBoxes()
}
_selected = $.grep(_selected, function (item) {
return item !== id
})
var _seatObj = _seats... | [
"deselect() {\n if (this.selected != null) {\n this.selected.deselect();\n this.selected = null;\n }\n }",
"function deselectStars() {\n star1.animations.stop(null, true);\n star1.animations.paused = true;\n star1 = null;\n star2.animations.stop(null, true);\n star2.animations.paus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compares NFCPushOptions structures that were provided to API and received by the mock mojo service. | function assertNFCPushOptionsEqual(provided, received) {
if (provided.ignoreRead !== undefined)
assert_equals(provided.ignoreRead, !!+received.ignore_read);
else
assert_equals(!!+received.ignore_read, true);
if (provided.timeout !== undefined)
assert_equals(provided.timeout, r... | [
"static zfsValidateOptions(options) {\n imperative_1.ImperativeExpect.toNotBeNullOrUndefined(options, ZosFiles_messages_1.ZosFilesMessages.missingFilesCreateOptions.message);\n /* If our caller does not supply these options, we supply default values for them,\n * so they should exist at this p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isListWithDateIdPresent() Check if List with Date ID already present in the DOM 1. If yes, append the new task 2. If no, render a new list with all the tasks | function isListWithDateIdPresent(dateid){
_existingList = document.querySelector(`ul[date-id='${dateid}']`);
return Boolean(_existingList);
} | [
"function loadTasksForDate(node, date, jsonData) {\r\n // Store/Convert the date item into a string item\r\n var dateS = date.getUTCFullYear() + \"-\" + (date.getUTCMonth()+1) + \"-\" + (date.getUTCDate());\r\n var listItem;\r\n\r\n // Iterate through each task associated with the date, appending just t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The user enters a POI search string which should be passed on to the service. Previous search results are removed. The search is automatically triggered after the user stopped typing for a certain period of time (DONE_TYPING_INTERVAL) | function handleSearchPoiInput(e) {
clearTimeout(typingTimerSearchPoi);
if (e.keyIdentifier != 'Shift' && e.currentTarget.value.length != 0) {
typingTimerSearchPoi = setTimeout(function() {
//empty search results
var resultContainer = document.getElementById('f... | [
"searchOnStopTyping() {\n let timer;\n scope.get(this).$watch(() => this.customerName, newVal => {\n // Remove results if search is deleted\n if (!newVal) {\n this.displayData.customerResults = [];\n if (timer) {\n timeout.get(this).cancel(timer);\n timer = null;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use the query and fields to search for documents and view the first document returned. | searchDocuments() {
let searchObj = {}
if (this.searchType === 'query') {
searchObj.query = this.query;
} else if (this.searchType === 'field') {
searchObj.fieldCode = this.queryField;
searchObj.fieldValue = this.queryFieldValue;
}
this.etriev... | [
"async getSingleDoc(mongoUri, dbName, coll) {\n const client = await MongoClient.connect(mongoUri, { useNewUrlParser: true});\n const doc = await client.db(dbName).collection(coll).find().toArray().then(docs => docs[0]);\n logger.collectionSingle(doc, dbName, coll);\n client.close();\n }",
"async sho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets input in form and submits it | function setInputAndSubmit(aForm, aField, aValue)
{
setInput(aForm, aField, aValue);
aForm.submit();
} | [
"function submit() {\n\tif(!is_valid_value()) {\n\t\t// should return some error code\n\t\t$('#error_msg').html('invalid input, try again')\n\t\tsetTimeout(function() {\n\t\t\t$('#error_msg').html('')\n\t\t}, 1000)\n\t\t$('#valueInput').val('').focus()\n return\n }\n\n // Otherwise, let's roll\n sto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List of design ascendants | async ascendants() {
const project = await Project.findOne({ _id: this.project });
const projectAscendants = await project.ascendants();
return [...projectAscendants, project.toObject()];
} | [
"function depth(x) {\n var txt = '';\n\n for (var i=0, max = x.length; i < max; i++){\n var name = x[i].tagName;\n var dashes = $(name).parents().length;\n txt += '-'.repeat(dashes) + name + '\\n';\n console.log('-'.repeat(dashes), name);\n }\n return txt;\n }",
"getImplementatio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function:AddElement () Purpose:Adds an element to the current page | function AddElement ()
{
var ElementType = doAction('REQ_GET_FORMVALUE', "ElementType", "ElementType");
return (AddElementType (ElementType));
} | [
"function appendElement(){\n\t\tif(document && document.body){\n\t\t\tdocument.body.appendChild(iframe);\n\t\t\treturn;\n\t\t}\n\t\tsetTimeout(function(){appendElement()}, 100);\n\t}",
"function addElement(prevElement, element, attribute, attrValue) {\n if (prevElement != \"\") {\n prevElement.after(ele... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var HTMLschoolStart = ''; var HTMLschoolName = '%data%'; var HTMLschoolDegree = ' %data%'; var HTMLschoolDates = '%data%'; var HTMLschoolLocation = '%data%'; var HTMLschoolMajor = 'Major: %data%'; var HTMLonlineClasses = 'Online Classes'; var HTMLonlineTitle = '%data%'; var HTMLonlineSchool = ' %data%'; var HTMLonlineD... | function displayEd() {
for (s in education.schools) {
$("#education").append(HTMLschoolStart);
var school = education.schools[s];
var name = HTMLschoolName.replace("%data%", school.name);
name = name.replace("#", school.url);
var location = HTMLschoolLocation.replace("%data%", school.location); // this is ca... | [
"function loadDatafromJson2Html(){\n\tdocument.getElementById(\"File_name\").innerHTML = prsm_data.prsm.ms.ms_header.spectrum_file_name;\n\tdocument.getElementById(\"PrSM_ID\").innerHTML = prsm_data.prsm.prsm_id;\n\tdocument.getElementById(\"Scan\").innerHTML = prsm_data.prsm.ms.ms_header.scans;\n\tdocument.getElem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the first native node for a given LView, starting from the provided TNode. Native nodes are returned in the order in which those appear in the native tree (DOM). | function getFirstNativeNode(lView, tNode) {
if (tNode !== null) {
ngDevMode &&
assertTNodeType(tNode, 3 /* AnyRNode */ | 12 /* AnyContainer */ | 32 /* Icu */ | 16 /* Projection */);
const tNodeType = tNode.type;
if (tNodeType & 3 /* AnyRNode */) {
return getNativeByTN... | [
"getNodeAtIndex(index) {\n //if index is not within list return null\n if (index >= this.length || index < 0) return null;\n //iterate through nodes until finding the one at index\n let currentNode = this.head;\n let currentIndex = 0;\n while (currentIndex !== index) {\n currentNode = current... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exit a parse tree produced by ObjectiveCPreprocessorParserpreprocessorParenthesis. | exitPreprocessorParenthesis(ctx) {
} | [
"enterPreprocessorParenthesis(ctx) {\n\t}",
"exitParenthesizedType(ctx) {\n\t}",
"exitPostfixUnaryExpression(ctx) {\n\t}",
"exitPreprocessorDef(ctx) {\n\t}",
"visitExit_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function Return() {\n \t\t\tdebugMsg(\"ProgramParser : Return\");\n \t\t\tv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
opens culture info page | function openCultureInfo(index){
if (cultures[index].filter != "faded" ) {
self.allInfoPages.gotoAndStop(index+1);
}
disableMainPageButtons()
} | [
"function loadLocale() {\n\tvar xobj = new XMLHttpRequest();\n\txobj.overrideMimeType(\"application/json\");\n\txobj.open('GET', '/locales/' + langCode + '.json', true);\n\txobj.onreadystatechange = function () {\n\t\tif (xobj.readyState == 4) {\n\t\t\tif (xobj.status == \"200\") {\n\t\t\t\tlocale = JSON.parse(xobj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find capability object in service object in network object | function ipFindCapabilityByName(pName, networkServiceObj) {
if(networkServiceObj == null)
return null;
if(networkServiceObj.capability != null) {
for(var i=0; i<networkServiceObj.capability.length; i++) {
var capabilityObj = networkServiceObj.capability[i];
if(capabilityObj.na... | [
"function ipFindNetworkServiceByName(pName, networkObj) { \n if(networkObj == null)\n return null;\n if(networkObj.service != null) {\n\t for(var i=0; i<networkObj.service.length; i++) {\n\t var networkServiceObj = networkObj.service[i];\n\t if(networkServiceObj.name == pName)\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
mimics FastLED FillSolid method | function FillSolid(stationId,startIndex,numToFill,ledColor){
if(!isNaN(stationId)){
//update server's copy of the LED cluster state
for(var i=startIndex;i<startIndex+numToFill;i++){
colors[stationId][i].r = ledColor.r;
colors[stationId][i].g = ledColor.g;
colors[s... | [
"function drawFlat(spectrum){\n colorMode(HSB, bands);\n var w = width / (bands * 1.5);\n var maxF = Math.max(spectrum);\n for (var i = 0; i < spectrum.length; i++) {\n var amp = spectrum[i];\n var y = map(amp, 0, 255, height, 10);\n fill(i,255,255);\n rect(width/2 + i*w,y,w-2,height-y);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the next `LContainer` that is a sibling of the given container. | function getNextLContainer(container) {
return getNearestLContainer(container[NEXT]);
} | [
"function next () {\r\n return this.siblings()[this.position() + 1]\r\n}",
"function getNextSibling(node, tag){\n\tif (!tag) tag = node.nodeName;\n\ttag = tag.toUpperCase();\n\tvar cont = 20; // Limita o numero de itera��es para evitar sobrecarga no ie\n\twhile (node.nextSibling && node.nextSibling.nodeName && n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
enables the normal buffer in the VAO | enableNormalBuffer () {
const gl = this.gl;
gl.bindBuffer(gl.ARRAY_BUFFER, this.normalBuffer);
gl.enableVertexAttribArray(1);
gl.vertexAttribPointer(1,
3, gl.FLOAT,
false,
0,
0
);
} | [
"createNormalBuffer () {\n\t\tif (this.normalArray === null) {\n\t\t\tconsole.log(\"normalArray uninitialized\");\n\t\t}\n\n\t\tconst gl = this.gl;\n\t\tthis.normalBuffer = gl.createBuffer();\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, this.normalBuffer);\n\t\tgl.bufferData(gl.ARRAY_BUFFER,\n \t\tnew Float32Array(this.n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Language: Lua Description: Lua is a powerful, efficient, lightweight, embeddable scripting language. | function lua(hljs) {
const OPENING_LONG_BRACKET = '\\[=*\\[';
const CLOSING_LONG_BRACKET = '\\]=*\\]';
const LONG_BRACKETS = {
begin: OPENING_LONG_BRACKET,
end: CLOSING_LONG_BRACKET,
contains: ['self']
};
const COMMENTS = [
hljs.COMMENT('--(?!' + OPENING_LONG_BRACKET + ')', '$'),
hljs.COMM... | [
"function ola('Javascript'){\n\t\tconsole.log('Hello world!')\n\t}",
"function ruby(hljs) {\n const RUBY_METHOD_RE = '([a-zA-Z_]\\\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\\\*\\\\*|[-/+%^&*~`|]|\\\\[\\\\]=?)';\n const RUBY_KEYWORDS = {\n keyword:\n 'and then defined module in return redo if BEGIN ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the Bill Summary or full Bill text, depending on the 'text' parameter passed text = the type of text we want back, either the sting "summary" or "full" path = the text_url of an individual bill, e.g. callback = callback the result | function getBillText(text, path, callback) {
makeTextRequest(text, path, function(err, html) {
if (err) {
callback(err);
}
else {
callback(null, html);
}
});
} | [
"function getDescriptionInBatch() {\n if (Config.placesDescription) {\n Places.findOne({wiki_summary: {$exists: false}})\n .then((result) => {\n if (!result) {\n return 'batch complete';\n }\n else {\n let text =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts amount of PLT into PLTwei | function PLT(amount) {
return web3.toWei(amount, 'finney');
} | [
"function boltPersoane(n) {\n var directie = \"dreapta\";\n var persoana = 1;\n var str = \"\";\n for (var i = 1; i < n; i++) {\n if (i % 7 === 0 || div7(i)===true) {\n if(directie === \"dreapta\"){\n persoana++;\n if(persoana>5) {\n per... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wait until the given tab reaches the "complete" status, then return the tab. This also deals with new tabs, which, before loading the requested page, begin at about:blank, which itself reaches the "complete" status. | async function tabCompletion (tab) {
function isComplete (tab) {
return tab.status === 'complete' && tab.url !== 'about:blank'
}
if (!isComplete(tab)) {
return new Promise((resolve, reject) => {
const timer = setTimeout(
function giveUp () {
browser.tabs.onUpdated.removeListener(on... | [
"function goToUrl(tab, url) {\n browser.tabs.update(tab, { url });\n return new Promise(resolve => {\n browser.tabs.onUpdated.addListener(function onUpdated(id, info) {\n if (id === tab && info.status === 'complete') {\n browser.tabs.onUpdated.removeListener(onUpdated);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a binary function subb that takes two numbers and returns their difference | function subb(a, b) {
return b - a;
} | [
"function SUBTRACT() {\n for (var _len14 = arguments.length, values = Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {\n values[_key14] = arguments[_key14];\n }\n\n // Return `#NA!` if 2 arguments are not provided.\n if (values.length !== 2) {\n return error$2.na;\n }\n\n // decompose values into... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check to see if player has appropriate key for collided door. | function checkDoorKey(p_sprite, door, game) {
for (var index in p_sprite.entity.key_ring) {
if (p_sprite.entity.key_ring[index] == door.key) {
door.kill()
game.pickup_sound.play()
return
}
}
} | [
"function checkBorderCollision() {\r\n //Player\r\n if (player_x >= (canvas_w - player_w)) rightKey = false;\r\n if (player_x <= (0)) leftKey = false;\r\n if (player_y <= (0)) upKey = false;\r\n if (player_y >= (canvas_h - player_h)) downKey = false;\r\n\r\n //AI\r\n if (AI_x >= (canvas_w - AI_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
finds specific point based on time input | function findPointAtTime() {
inputTime = document.getElementById("inputTime").value;
refreshGraph();
} | [
"_search(time, param = \"time\") {\n if (this._timeline.length === 0) {\n return -1;\n }\n\n let beginning = 0;\n const len = this._timeline.length;\n let end = len;\n\n if (len > 0 && this._timeline[len - 1][param] <= time) {\n return len - 1;\n }\n\n while (beginning < end) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
swaps current gun with the previously used one | function swapGun()
{
let tmp = gun;
selectGun(prevGun);
prevGun = tmp;
} | [
"swap() {\n const { top, stack } = this;\n const tmp = stack[top - 2];\n\n stack[top] = stack[this.top];\n stack[this.top] = tmp;\n }",
"swap(dropTarget) {\n const previousDrag = dropTarget.draggable;\n previousDrag.revert();\n this.drop(dropTarget);\n }",
"function swap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This should prevent multiple read in a short interval | function lock_read(timeout=2000){
console.log('{DBG] locking');
DETECTION = false;
setTimeout(() => {
console.log('[DBG] UNlocking');
DETECTION = true;
}, timeout);
} | [
"function is_data_stale() {\n\treturn last + max_age < Date.now();\n}",
"checkPendingReads() {\n this.fillBuffer();\n\n let reads = this.pendingReads;\n while (reads.length && this.dataAvailable &&\n reads[0].length <= this.dataAvailable) {\n let pending = this.pendingReads.shift();\n\n le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |