query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Trap for property access (getting) and method call. | get(target, property, receiver) {
return trap.get(target, property, receiver);
} | [
"set(target, property, value, receiver) {\n const updateWasSuccessful = trap.set(target, property, value, receiver);\n return updateWasSuccessful;\n }",
"function TestCallThrow(callTrap) {\n var f = new Proxy(() => {\n ;\n }, {\n apply: callTrap\n });\n\n (() => f(11))();\n\n \"myexn\";\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
mPerspective performs the perspective function to both visible and hidden 3D models. All parameters are the same as for perspective(). | function mPerspective() {
perspective(...[...arguments]);
mPage.perspective(...[...arguments]);
} | [
"function setupCameraPerspective() {\n\n\t// image camera -- perpective\n\tcameraPlane = new THREE.PerspectiveCamera( FOV, viewRatio['perspective'], NEAR, FAR );\n\tvar depth = frame.frame_perspective.height/(2*Math.tan((FOV*Math.PI)/(2*180)));\n\tcameraPlane.position.set(0, 0, depth); \n\tcameraPlane.lookAt(new T... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handleSound() If the mouse is moving away from the center of the shape on the X axis, plays the breath in sound. If it gets closer, plays the breath out sound. | handleSound() {
// On the X axis, if the mouse is closer to the center of the shape than it was in the previous frame...
if (this.distanceFromCenterX > mouseX - this.x) {
// Change state to say that the breath in sound is not playing and stop the sound
this.breathInSoundPlaying = false;
this.b... | [
"update(canvas, synth, notes) {\n if(this.x + this.radius > canvas.width || this.x - this.radius < 0) {\n this.dx = -this.dx;\n // LOGIC TO PLAY SOUND GOES HERE\n let note = getNote(notes);\n synth.triggerAttackRelease(note, \"32n\");\n }\n this.x += this.dx;\n if(this.y + this.radiu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serializes the PNPM Shrinkwrap file | serialize() {
return yaml.safeDump(this._shrinkwrapJson, SHRINKWRAP_YAML_FORMAT);
} | [
"function saveDiagram()\n {\n\n var root = {};\n var xmlSection1 = [];\n var xmlSection2 = [];\n var xmlSection = [];\n var elements = [];\n var connects = [];\n var orders = [];\n\n for (var i in formatting)\n { // save the formatting values\n var item = forma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getIddFromAverage computes Idd using a mapping function onto Idd after computing percentage of current jitter versus averaged jitter | function getIddFromAverage(curr_jitter, jitter_average, g) {
var percent = curr_jitter / jitter_average * 100;
return g(percent);
} | [
"function getIddFromStdDev(curr_jitter, jitter_average, jitter_std_dev, f) {\n\tvar num_std_devs = Math.abs(curr_jitter - jitter_average) / jitter_std_dev;\n\treturn f(num_std_devs);\n}",
"function getIdd(averages, codec) {\n\n\t//NOTE: This only takes the jitter delay of the last packet in the cache for now. Ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns list (IDs) of unassigned miners | unassigned() {
return this.minerids.filter(m => !this.minerpool[m]);
// var list = [];
// if(Object.keys(this.minerpool).length == this.minerids.length) return [];
// const assigned = Object.keys(this.minerpool);
// for(var m of this.minerids) {
// if(assigned.indexOf(m) == -1) list.push(m);
// }
// ... | [
"unblockedNodes () {\n const unblocked = []\n\n for (let node = 0; node < this.n; node++) {\n if (!this.isBlocked(node)) unblocked.push(node)\n }\n\n return unblocked\n }",
"function getUnusedCardIDs() {\n //return list\n let r = new Array();\n //copy card ids and add them to r \n ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for My Account page The function changePassword uses a Firebase function to attempt to change the user's password | function changePassword(oldPass, newPass) {
//Get the current logged in user
var user = firebase.auth().currentUser;
//If it has been a while, the Firebase needs the user's credentials so get the user's credentials
var credential = firebase.auth.EmailAuthProvider.credential(user.email, oldPass);
/... | [
"function updatePassword(userId, newPassword, callback) {\n var hashedPassword = common.generatePasswordHash(newPassword);\n\n //update password query\n db.query(\"UPDATE LOGIN_CREDENTIALS SET password = $1 WHERE user_id= $2\", {\n bind: [hashedPassword, userId]\n\n }).spread(function () {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks to see if the level is complete. If it is, it stops the music and loads the next level. | function checkforLevelCompletion() {
if(game.globals.zombieGroup.children.length === 0) {
// Stop the current level's track.
this.music.stop();
game.globals.zombieGroup.destroy();
// Load the next level.
if (game.state.current === 'levelOne') {
game.state.start('levelTwo');
}
... | [
"function checkGameEnd()\n{\n // check if player finished the level\n if (player.x > canvas.width && !screen.paused) {\n screen.paused = true;\n saveScoreToDisk();\n\n // check if it's in the final level\n if (currentLevel < levelFiles.length - 1) {\n menu.setState(\"nex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
current playback position in milliseconds | function getPlaybackPosition() {
if(jQuery("video")[0]) return Math.floor(jQuery("video")[0].currentTime * 1000);
return null;
} | [
"get seek() {\n return this.api.currentTime()\n }",
"function get_playback_position(session) {\n\tif(session.playing) {\n\t\tconst now = (new Date()).getTime();\n\t\tconst time_playing = now - session.last_play_time;\n\t\treturn session.last_position + time_playing / 1000.0;\n\t} else {\n\t\treturn session.la... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
"Enqueues" a SessionDataUpdate. Assumes sessionDataUpdate is valid. | enqueueUpdate(sessionDataUpdate) {
// If update is a no-op, don't enqueue it.
if (sessionDataUpdate.isNoOp()) {
return;
}
// If "queue" is empty, initialize it.
if (!this.sessionData) {
this.sessionData = new SessionData();
this.mergeStrategyForNextServerUpdate = sessionDataUpdate... | [
"update(sessionDataUpdate) {\n if (sessionDataUpdate.isNoOp()) {\n return;\n }\n switch (sessionDataUpdate.mergeStrategy) {\n case SHALLOW_MERGE_STRATEGY:\n this.data = { ...this.data, ...sessionDataUpdate.data };\n break;\n case REPLACE_STRATEGY:\n this.data = sessionDa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete Stevens 1.1 I need to take a storeItem object away from the list of items in the cartItems array. 1.2 steps If I click the minus button, then it will take one away from the total quanitity of that item in the cart. 1.3 actions make a function removeButton & add Event Listener (last thing to do) 1.4 within the fu... | function removeButton(storeItem, cartItems) {
// console.log(storeItem, cartItems.length)
// I need to do a for loop here to run through the cartItems array
// I need an if/else statement of if quantity is > / >= 2 (when remove button is clicked - include in function?), take away 1 from the quanityt...else remo... | [
"function itemQuantity() {\n let increase = document.querySelectorAll(\"i.fa-plus\");\n let decrease = document.querySelectorAll(\"i.fa-minus\");\n let currentQuantity = 0;\n let currentProduct = \"\";\n\n let foodItems = localStorage.getItem(\"foodsInCart\");\n foodItems = JSON.parse(foodItems);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fix links for the tweetdeck.twitter.com website. | function fixTweetDeckLinks() {
// Catch visible links from tweets, quoted tweets and tweets in detail
var selector = ('.tweet-text > .url-ext[data-link-fixed!=1]:not(.is-vishidden), '
+'.quoted-tweet .url-ext[data-link-fixed!=1], '
+'.tweet-detail .url-ext[data-link-fixed!=1]'),
... | [
"function fixLinks() {\n // Catch only text links, not pictures and other stuff\n var links = $( '.twitter-timeline-link[data-link-fixed!=1]:not(.media, .u-hidden)' );\n\n $( links ).each(function(){\n setUrlToLink(this, this.dataset.expandedUrl);\n });\n}",
"function fixLinks() {\n for (var a of docu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: _fnSortAttachListener Purpose: Attach a sort handler (click) to a node Returns: Inputs: object:oSettings dataTables settings object node:nNode node to attach the handler to int:iDataIndex column sorting index function:fnCallback callback function optional | function _fnSortAttachListener ( oSettings, nNode, iDataIndex, fnCallback )
{
$(nNode).bind( 'click.DT', function (e) {
/* If the column is not sortable - don't to anything */
if ( oSettings.aoColumns[iDataIndex].bSortable === false )
{
return;
}
/*
* This is a little bit odd I a... | [
"function aa_tableColumnSort(table,settings)\n{\n\tvar thead = jQuery(table).find('>thead')[0];\n\taa_registerHeaderEvent(thead,'mouseup',clickHandler,'Sort','no dominant');\n\t\n\tfunction clickHandler(e,thead,th) {\n \t var jth = jQuery(th);\n\t if (!thead.LastMouseDown || thead.LastMouseDown.th != th) ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the index of an entity with a defined id. | indexOfId(id) {
var Model = this.constructor.classes().model;
var index = 0;
var result = -1;
id = String(id);
while (index < this._data.length) {
var entity = this._data[index];
if (!(entity instanceof Model)) {
throw new Error('Error, `indexOfId()` is only available on models.... | [
"getIndex(id, data){\n for(let i=0; i<data.length; i++){\n if(id === data[i].id){\n return i;\n }\n }\n console.log(\"No match found\");\n return 0;\n }",
"function getExprIndex(id) {\n\t\tlet exprs = Calc.getState().expressions.list;\n\t\treturn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End the current session for all callers (asks the server to do it) uses internal_call_id to know what to end, set when you got online | async function endSession() {
updateStatus("Ending Call");
console.log(`Ending session: ${internal_call_id}`);
try {
var res = await fetch("/endSession?room_name=" + internal_call_id);
// basic error handling
if (res.status !== 200) {
console.log(res);
alert("Failed to end your session: ... | [
"function endCallback() {\n endIANA(session);\n }",
"function endCall() {\n setMessages([]);\n setChatUsers([]);\n socketRef.current.emit(\"leaveRoom\");\n socketRef.current = null;\n }",
"function stopCall() {\n // quit the current conference room\n bc.quitRoom(room);\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to process (sort and calculate cummulative volume) | function processData(list, type, desc) {
// Convert to data points
for(var i = 0; i < list.length; i++) {
list[i] = {
value: Number(list[i][0]),
volume: Number(list[i][1]),
}
}
// Sort list just in case
list.sort(function(a, b) {
if (a.value > b.value) {
r... | [
"function sortByVol(a,b) {\n if (a.volume < b.volume) {\n return 1;\n }\n else if (a.volume > b.volume) {\n return -1;\n }\n else {\n return 0;\n }\n }",
"function calcForecastVolumeIn(data){\n\t\t\treturn data.forecasts.map(elem=>parse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows the Banner (with animation) | function showBanner() {
//choose a perhaps-new explication
displayExplication();
$flap.height($flap.buffer + $explication.height());
$flap.css("top", $topbar.height() - $flap.height());
$banTit.animate({top: $banTit.pos.top, left: $banTit.pos.left, "font-size": $banTit.size},
{duration: dur});
$banSub.ani... | [
"function toggleBanner() {\n\tif (bannered) {\n\t\thideBanner();\n\t\tclearExplication();\n\t} else {\n\t\tshowBanner();\n\t\tsaveExplication();\n\t}\n}",
"function showAnim(anim) {\n\tif (anim != undefined) {\n\t\tvar label = '';\n\t\tvar img = $('<img id=\"animImage\" />')\n\t\timg.attr('src', \"img/ajax-loader... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to watch for node insertion (to see if the "invite box" has appeared). | function checkForInviteBox() {
// Get container of invite dialog.
var inviteBoxCheck = document.getElementsByClassName('eventInviteLayout')[0] || document.getElementsByClassName('standardLayout')[0] ||
document.getElementById('fb_multi_friend_selector_wrapper');
// Check for match of inviteBoxCheck, an... | [
"function watchForLarkGallery () {\n var observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n if (mutation.addedNodes) {\n theLarkGallery();\n }\n });\n });\n observer.observe(do... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create random lat/long coordinates in a specified radius around a center point | function randomGeo (center, radius) {
var y0 = center.latitude
var x0 = center.longitude
var rd = radius / 111300 // about 111300 meters in one degree
var u = Math.random()
var v = Math.random()
var w = rd * Math.sqrt(u)
var t = 2 * Math.PI * v
var x = w * Math.cos(t)
var y = w * Math.sin(t)
// A... | [
"function getSpawnCoords() {\n\tx = Math.round((Math.random()*(width-3*gridSize)+gridSize)/gridSize)*gridSize;\n\ty = Math.round((Math.random()*(height-3*gridSize)+gridSize)/gridSize)*gridSize;\n\treturn [x, y];\n}",
"function createRandom() {\n let randomCoords = [];\n\n for (let i = 0; i < getRandomInt(10... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serialize a class symbol information | function serializeClass(symbol) {
var classDetails = serializeSymbol(symbol);
var details = {'@id':classDetails.name, '@type':classDetails.type}
//var prop ={}
symbol.members.forEach((value)=>{
var {name, type} = serializeSymbol(value)
var typeVa... | [
"function serializeSymbol(symbol) {\n //getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;\n var name009 = checker.getTypeOfSymbolAtLocation(symbol,symbol.valueDeclaration)//: string;\n\n // const kind = symbol.valueDeclaration ? symbol.valueDeclaration.kind : undefined\n var te... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a string name representation of the given PropertyName node | function getNameFromPropertyName(propertyName) {
if (propertyName.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
return propertyName.name;
}
return `${propertyName.value}`;
} | [
"get propertyName() {}",
"function getJsonName(member) {\n if (!member.selected)\n return '';\n return sp.result(member, 'mappingEntity.name');\n }",
"function extPart_getNodeParamName(partName)\n{\n return dw.getExtDataValue(partName, \"insertText\", \"nodeParamName... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show output table notes dialog | doShowTableNote (name) {
this.tableInfoName = name
this.tableInfoTickle = !this.tableInfoTickle
} | [
"function displayTable() {\r\n displayOnly(\"#tableOfContents\");\r\n traverseAndUpdateTableHelper();\r\n prepareText(heirarchy.tree[0].sections[0].id);\r\n activePart = 0;\r\n iconEventListeners();\r\n settingsEventListeners();\r\n scrollEventListener();\r\n}",
"function makeOutputHelpRow ( path )\n {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
readonly attribute calIDateTime reminderSignalTime; | get reminderSignalTime()
{
return this._reminderSignalTime;
} | [
"get timeChecked()\r\n\t{\r\n\t\treturn this._timeChecked;\r\n\t}",
"get dateTimeReceived()\n\t{\n\t\treturn this._dateTimeReceived;\n\t}",
"_addDate() {\n const valueLink = this.props.valueLink;\n const value = valueLink.value || {};\n const slots = (value.slots || []).slice();\n const start = this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is called by the render function and is called on each game tick. It's purpose is to then call the render functions you have defined on your enemy and player entities within app.js | function renderEntities() {
/* Loop through all of the objects within the allEnemies array and call
* the render function you have defined.
*/
allEnemies.forEach(function(enemy) {
enemy.render();
});
player.render();
} | [
"function render() {\n gameController.render();\n\n renderEntities();\n\n gameController.postRender();\n }",
"function render() {\n\t//clear all canvases for a fresh render\n\tclearScreen();\n\t\n\t//draw objects centered in order\n\tfor (let i = 0; i < objects.length; ++i) {\n\t\tdrawCent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine if there is a live service through ChOP | async function isServiceLive() {
// Fetch the current or next service data
const service = await fetch("https://northlandchurch.online.church/graphql", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json"
},
body: JSON.stringify({
query: CURRE... | [
"isService() {\n\n return this.type == 'service';\n }",
"function IsServiceRunning(/**string*/ name) /**boolean*/\n{\n\tvar strComputer = \".\";\n\tvar SWBemlocator = new ActiveXObject(\"WbemScripting.SWbemLocator\");\n\tvar objCtx = new ActiveXObject(\"WbemScripting.SWbemNamedValueSet\")\n\tobjCtx.Add(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine the mode for the text editor based on the file extension | function editorMode(name) {
var mode = "xml";
if (extname(name) === ".js") mode = "javascript";
if (extname(name) === ".json") mode = "javascript";
if (extname(name) === ".css") mode = "css";
if (extname(name) === ".txt") mode = "text";
return mode;
} | [
"function txtExtension(fileName) {\n var c = fileName.indexOf(\".\");\n var w = fileName.substring(c + 1, fileName.length);\n if (w != \"txt\") return false;\n return true;\n}",
"function changeMode(){\n\tvar new_mode = $('#mode').val();\n\tedit_session.setMode(\"ace/mode/\"+new_mode);\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get first element from a collection input(s): obj: (collection) collection object from which first element is extracted output(s): object=> first element of the collection => NULL, if there is no first element in the collection OR it is not a collection | function firstCollectionElem(obj){
//get first element, if any
var elem = $(obj).first();
//check if collection is empty (i.e. has no first element)
if( elem.length == 0 ){
//return null if it is empty
return null;
}
//return first element
return elem[0];
} | [
"function lastCollectionElem(obj){\n\t//get first element, if any\n\tvar elem = $(obj).last();\n\t//check if collection is empty (i.e. has no first element)\n\tif( elem.length == 0 ){\n\t\t//return null if it is empty\n\t\treturn null;\n\t}\n\t//return first element\n\treturn elem[0];\n}",
"function findFirstProp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Export NetworkSimulator for use by other unittests. | function NetworkSimulator()
{
this._pendingPromises = [];
} | [
"generateNetwork () {\n const nbHidden = this.nodes.filter(node => node.type === 'hidden').length\n const network = new Network(this.nbInput, nbHidden, this.nbOutput)\n return network\n }",
"function generateNetwork() {\n globalInfo = getGlobalInfo()\n \n let connections = new Array... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate a new array, log the array, check for win, display array, update money | function generate(){
if (money >= cost){
var arr1 = [Math.floor(Math.random()*3), Math.floor(Math.random()*3), Math.floor(Math.random()*3)];
// console.log(arr1);
check(arr1);
displayIndex(arr1);
update();
profit = money - 1000 + bank;
displayProfit(profit);
highLow()... | [
"function updateTraderOwns(tradeWith) {\n var tradePlayerStuff = \"\";\n var indexTradePlayer = 1;\n\n document.getElementById(\"trade_with\").innerHTML = \"Trade with: \" + tradeWith;\n for (i = 0; i < tiles2.length; i++) {\n if (tradeWith == tiles2[i].ownedBy) {\n //if (tiles2[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name: resetCopyButton(clickedBtnID) Description: Reset styles all button copy, and add new style to button copied Parameter: clickedBtnID => String Return: None | function resetCopyButton(clickedBtnID) {
var i;
var listButtons = document.getElementsByClassName("btn-copy");
for (i = 0; i < listButtons.length; i++) {
listButtons[i].textContent = "Copy";
listButtons[i].classList.remove("copied");
}
var clickedBtn = document.getElementById(clickedBtnID);
click... | [
"function unhighlightButton(oButton){\r\n oButton.style.backgroundColor = \"\";\r\n oButton.style.color = \"\";\r\n }",
"function resetAddButton() {\n let oldAddButton = id(\"add\");\n var newAddButton = oldAddButton.cloneNode(true);\n oldAddButton.parentNode.replaceChild(newAddButton, oldAddButto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a hash of the data. The hash function is SHA512, truncated to first 32 hex characters. | static async hash(data) {
if (! ("subtle" in window.crypto)) {
return undefined;
}
let input = new TextEncoder().encode(data);
let hash = await window.crypto.subtle.digest("SHA-512", input);
let bytes = new Uint8Array(hash);
let hex = Array.from(bytes).map(byte => byte.toString(16).padStar... | [
"function createDataHash(data){\n const hash = crypto.createHash('sha256');\n hash.update(data);\n\n return hash.digest('base64');\n}",
"function hasher(data) {\n var pre_string = data.lastname + data.firstname + data.gender + data.dob + data.drug;\n var hash = '', curr_str;\n\n hash = Sha1.hash(pre_s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removed alle antwoorden met resultaat 'NULL!' | function removeNull(data){
data.forEach(data => {
for (let key in data) {
if (data[key] == '#NULL!') {
delete data[key];
}
}
});
return data;
} | [
"_getAreaZero() {\n let newArr = [];\n this.area.map(el => {\n newArr.push(...el)\n });\n\n return newArr.some(el => el === null);\n }",
"function filterOutNulls(response) {\n let dataTable = response.getDataTable();\n\n let filtered = [];\n for (const i in dataTable.w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=======For Checking Decimal Value should be of 3 decimal places.. | function CheckFloat3decimal(resid) {
var num = document.getElementById(resid).value;
var tomatch = /^\d*(\.\d{1,3})?$/;
if (tomatch.test(num)) {
return true;
}
else {
alert("Input error");
document.getElementById(resid).value = "";
document.getElementById(r... | [
"function checkDecimal()\n{\n let re = /^([0-9]*|[0-9]*\\.[0-9]*)$/;\n let number = this.value.trim();\n setErrorFlag(this, re.test(number) && number > 0);\n}",
"function formatDecimal3(val, n) {\n n = n || 2;\n var str = \"\" + Math.round ( parseFloat(val) * M... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the ruler from the scene | disableRuler() {
if (this.mRulerEnabled)
this.mSceneController.scene.remove(this.mRulerLine);
this.mRulerEnabled = false;
} | [
"_clearRocketAnimation() {\n this._rocket._tl.clear();\n this.removeChild(this._rocket);\n }",
"function clearScene() {\n var obj;\n for( var i = scene.children.length - 1; i > 3; i--) {\n obj = scene.children[i];\n scene.remove(obj);\n }\n}",
"function removeVisualiserButton(){\r\n\teRem(\"butt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The ISO 3166 (alpha 2) region code | static get iso3166() {
return 'CY';
} | [
"getRegionCode(){\n\t\treturn this.dataArray[3];\n\t}",
"function getCodeFromLetter(str){\n return str.charCodeAt(0)-96;\n}",
"function assertStateCode(code) {\n if (![\"\", \"at\", \"be\", \"bg\", \"ch\", \"cy\", \"cz\", \"de\", \"dk\", \"ee\", \"es\", \"fi\", \"fr\",\n \"gb\", \"gr\", \"hr\", \"h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save Core config to Firebase as part of installation | async writeCoreConfig() {
let c = this.get(null, null, true);
let copy = JSON.parse(JSON.stringify(c));
delete(copy.db);
delete(copy.fs);
let db = await Class.i('awy_core_model_db');
await db.rput(copy, 'config');
} | [
"function saveConfiguration () {\n\tJSON.stringify(config).to(SITE_DIR+'config.json');\n}",
"function save() {\n\twriteFile(config, CONFIG_NAME);\n\tglobal.store.dispatch({\n\t\ttype: StateActions.UPDATE_CONFIGURATION,\n\t\tpayload: {\n\t\t\t...config\n\t\t}\n\t})\n}",
"function writeConfig () {\n self._re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parseSE bKeepHashTags defaults to false returns se: se.titleNoSE : string se.spent : float se.estimate : float | function parseSE(title, bKeepHashTags) {
var se = { bParsed: false, bSFTFormat: false };
se = parseSE_SFT(title);
// Strip hashtags
if (bKeepHashTags === undefined || bKeepHashTags == false)
se.titleNoSE = se.titleNoSE.replace(/#[\w-]+/, "");
return se;
} | [
"function parseTagSoup(soup, tags)\n {\n /*\n 1) [vendor_length] = read an unsigned integer of 32 bits\n 2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets\n 3) [user_comment_list_length] = read an unsigned integer of 32 bits\n 4) iterate [user_comment_list_leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The grinder is the lever on the side. We might want to update this to be more direct (e.g., pull the lever).. right now you just tap it. This object has methods for making the "colour mixing process" happen. | function makeGrinder(args) {
var layer = new Layer({imageName: "lever"})
layer.touchEndedHandler = function(touchSequence) {
new Sound({name: "beep-boop"}).play()
rotateColors()
afterDuration(0.25, function() {
moveColors()
})
afterDuration(1.50, function() {
dripColors()
})
}
function rotateCo... | [
"changeColor() {\n this.currentColor = this.intersectingColor;\n }",
"ColorUpdate(colors) {\n colors.push(vec4(100, 100, 100, 255));\n colors.push(vec4(255, 255, 255, 255));\n colors.push(vec4(100, 100, 100, 255));\n colors.push(vec4(255, 255, 255, 255));\n\n colors.push(vec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return true array of splitted arguments | function splitArguments() {
var splitedArray, ii;
if (!arguments[0]) {
throw new WrongArgumentException("Can't parse arguments, cause it doesn't exist!");
}
splitedArray = new Array();
for (ii = 0; ii < arguments[0].length; ii++) {
splitedArray.push... | [
"isListMatch(value) {\n if (!value) return false;\n const v = this.isCaseSensitive ? value : value.toLowerCase();\n let isMatch = false;\n for (const value of v.split(',')) {\n const v = value.trim();\n if ((this.re && v.match(this.re) !== null) || this.arg === v) {\n isMatch = true;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Placement > [InitWorker, ...] Convert the received Placement into an InitWorkerList, with each WorkerPlace in the list converted to the equivalent InitWorker. | function jsonToInitWorkerList(placement) {
return placement.map(jsonToInitWorker);
} | [
"function jsonToInitWorker(workerPlace) {\n let workerRequest = jsonToWorkerRequest(workerPlace[0]);\n return { player: workerRequest.player, x: workerPlace[1], y: workerPlace[2] };\n}",
"placeInitialWorker(existingWorkers) {\n return this.clientRequest(existingWorkers, MessageConverter.initWorkerListToJson,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save current Rules data to local storage ($('body').data('json')). | function saveRules() {
if ($('.stats').length != 0) {
var rulesJSON = getJSONFromRules();
if (rulesJSON == 1)
return 1;
var allJSON = $('body').data('json');
allJSON.forEach(function (e, i, arr) {
// arr is just used for changing values directly!
... | [
"function saveproxyRule() {\n\tvar rules = {};\n\tvar co = 0;\n\n\t$(\"#proxy_rules_list .proxy_rule_boxes\").each(function() {\n\t\tvar url = stripHTMLTags($(this).find('.url').text());\n\t\tvar proxy_type = stripHTMLTags($(this).find('.proxy_type').prop(\"selectedIndex\"));\n\t\tvar proxy_location = stripHTMLTags... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the NODEs on the GRID | renderNodes() {
const {cellSizeInPx, nodes} = this.props;
if (nodes.length === 0) {
return;
}
const nodeCells = [];
nodes.forEach((node) => {
const {X, Y} = node.Location;
// Calculate grid position in pixels
const radius = (cellSizeInPx / 2) - padding_in_cell;
cons... | [
"function drawCanvasGrid(node){\n\n}",
"function drawGrid() {\n for(let i = 0; i < HEIGHT; i++) {\n // create a new raw\n let raw = $('<div class=\"raw\"></div>');\n // fill the raw with squares\n for(let j = 0; j < WIDTH; j++) {\n raw.append('<div... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Credential issuance is an interactive protocol between a user and an issuer The issuer takes its secret and public keys and user attribute values as input The user takes the issuer public key and user secret as input The issuance protocol consists of the following steps: 1) The issuer sends a random nonce to the user 2... | function NewCredRequest(sk , IssuerNonce , ipk , rng ) {
// Set Nym as h_{sk}^{sk}
let HSk = ipk.HSk
let Nym = HSk.mul(sk)
// generate a zero-knowledge proof of knowledge (ZK PoK) of the secret key
// Sample the randomness needed for the proof
let rSk = RandModOrder(rng)
// Step 1: First message (t-values)
... | [
"function VerCred(cred, sk , ipk ) {\n\t// Validate Input\n\n\t// - parse the credential\n\tlet A = cred.A\n\tlet B = cred.B\n\tlet E = cred.E\n\tlet S = cred.S\n\n\t// - verify that all attribute values are present\n\tfor (i = 0; i < cred.Attrs.length; i++) {\n\t\tif (cred.Attrs[i] == null) {\n\t\t\t//throw Error... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the dismiss state. | get dismiss() {
return this.skeleton.dismiss;
} | [
"set dismiss(state) {\n this.skeleton.dismiss = state;\n }",
"canDismiss() {\n return true;\n }",
"attemptDismiss() {\n\t\tif(this.state.currentModal.props.dismissible) this.state.currentModal.props.onDismiss();\n\t}",
"get transitioning() {\n return this._fullyOpened === OpenedState.OPEN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserlog_file_group. | visitLog_file_group(ctx) {
return this.visitChildren(ctx);
} | [
"visitLog_grp(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitRegister_logfile_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitAdd_logfile_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitDrop_logfile_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
split accesskey according to | function splitAccesskey(val) {
var t = val.split(/\s+/),
keys = [];
for (var i=0, k; k = t[i]; i++) {
k = k[0].toUpperCase(); // first character only
// theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, ... screw ... | [
"function FindAccessKeyMarker(/*string*/ text)\r\n {\r\n var lenght = text.Length;\r\n var startIndex = 0; \r\n while (startIndex < lenght)\r\n { \r\n \tvar index = text.IndexOf(AccessKeyMarker, startIndex); \r\n if (index == -1)\r\n return -1; \r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParsermodel_rules_clause. | visitModel_rules_clause(ctx) {
return this.visitChildren(ctx);
} | [
"visitModel_rules_element(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitModel_rules_part(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitValidation_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitData_manipulation_language_statements(ctx) {\n\t return this.visitChildren(c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
h: 0360 s: 0100 v: 0100 returns: [ 0255, 0255, 0255 ] | function HSV_RGB (h, s, v) {
var u = 255 * (v / 100);
if (h === null) {
return [ u, u, u ];
}
h /= 60;
s /= 100;
var i = Math.floor(h);
var f = i%2 ? h-i : 1-(h-i);
var m = u * (1 - s);
var n = u * (1 - s * f);
switch (i) {
case 6:
case 0: return [u,n,m];
case 1: return ... | [
"function rgbToHsv(r, g, b){\n r = r/255, g = g/255, b = b/255;\n var max = Math.max(r, g, b), min = Math.min(r, g, b);\n var h, s, v = max;\n\n var d = max - min;\n s = max == 0 ? 0 : d / max;\n\n if(max == min){\n h = 0; // achromatic\n }else{\n switch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
copyright when copy text page | function copyright() {
//Get the selected text and append the extra info
var selection = window.getSelection(),
website = 'www.binhbatoday.com', //website
pagelink = '. Nguồn từ: ' + website, // text
copytext = selection + pagelink,
newdiv = document.creat... | [
"function changeCopyRight()\n{\n console.log(\"\\tStart changeCopyRight\");\n var i;\n\n var name = \"\";\n var short = \"\";\n var url = \"\";\n var image = \"\";\n\n console.log(\"\\t\\tOpgegeven licence in config is [\" + respecConfig.licence + \"]\");\n if( respecConfig.licence != null)\n {\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select team to add people to | function selectTeam(team) {
selectedTeam = team;
team.classList.add("select");
const opponent = team == teamA ? teamB : teamA;
if (opponent.classList.contains("select")) {
opponent.classList.remove("select");
}
} | [
"function goToTeamSelection(){\n clientValuesFactory.setActiveWindow(windowViews.selectTeam);\n }",
"function toggleTeam()\n{\n var pickedTeam = $('#teamNum').val() + \" \" + $('#event option:selected').text();\n if($('#list').hasClass('btn-success'))\n {\n userData.teamList.push... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ends the game if the bird's current health is zero or less | function updateBird() {
if (bird.healthCurrent <= 0) {
gameLose();
}
} | [
"endGame() {\n if (this.health <= 0) {\n backgroundMusic.stop();\n failSound.play();\n state = \"GAMEOVER\";\n return;\n } else if (this.score >= 40) {\n state = \"GAMEWIN\";\n return;\n }\n }",
"function youDied () {\n if (yourInfo.hp <= 0) {\n console.log(\"You ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the FlixStack links from the current page. | function remove_links() {
$('.flixstack-wrapper').hide();
$('.flixstack-wrapper').remove();
} | [
"function removeLinks() {\n links.splice(0,links.length);\n draw();\n}",
"function clear_link(mhc){ \n\t\tvar unlinked = 0;\n\t\tvar aNav = $(mhc);\n\t\tvar a = aNav.getElementsByTagName('a');\n\t\tvar mysplit = window.location.href.split('#')[0];\n\t\tfor(var i=1;i<a.length;i++)\n\t\t\tif(a[i].href == mysp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : checkDeviceStatus AUTHOR : Anna Marie Paulo DATE : March 6, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : validation for config and software device status PARAMETERS : | function checkDeviceStatus(flag, type){
var txt1="";
saveresmain = 1;
if(globalInfoType == "JSON"){
devicesArr = getDevicesNodeJSON();
deviceArr = getDevicesNodeJSON();
}
//if(!checkRunningSanity("saveconfig")){return;}
for(var a=0; a<devicesArr.length; a++){
if(devicesArr[a].DeviceType... | [
"function updateStatus(devices, new_status)\n{\n\tfor (var i in new_status )\t\t\t//for each status\n\t{\n\t\tfor(var j in devices)\t\t\t//look for the match ID\n\t\t{\n\t\t\tif( devices[j].deviceID == new_status[i].deviceID )\n\t\t\t{\n\t\t\t\tvar status = devices[j].status;\t\t//access the status array\t\t\t\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether this pin is currently low. | isLow() {
if (this.mode == 'output') {
return !this.high;
} else if (this.mode == 'input') {
return this.get() === false;
}
return null;
} | [
"isHigh() {\n if (this.mode == 'output') {\n return this.high;\n } else if (this.mode == 'input') {\n return this.get() === true;\n }\n return null;\n }",
"isOnTheWater() {\n return this.y <= 0;\n }",
"function isEnabled() {\n return tray != undefined;\n}",
"isLocalOnHold() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Append a new module override at the end of the list | function moduleappend()
{
if(appending == false) {
appending = true;
new Zikula.Ajax.Request(
Zikula.Config.baseURL + "ajax.php?module=doctastic&func=createoverride",
{
onComplete: moduleappend_response
});
}
} | [
"_handleOverrideGroup(name, override, result) {\n let markerOverride = override;\n\n if (override.missing_in_dst) {\n result.push(new OverrideGroup({\n mode: 'empty'\n }));\n result.push(new OverrideGroup({\n na... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOTE: The CommandHandler is effectively an abstract base for various handlers including ActionHandler, AccessorHandler and AssertHandler. Subclasses need to implement an execute(seleniumApi, command) function, where seleniumApi is the Selenium object, and command a SeleniumCommand object. | function CommandHandler(type, haltOnFailure, executor) {
this.type = type;
this.haltOnFailure = haltOnFailure;
this.executor = executor;
} | [
"handleCommandEvent (e) {\n if (e == null || e.target == null) { return false }\n var target = $(e.target)\n var parent = target.parent()\n var isCommand = parent.hasClass(Constants.commandClassName)\n var eventType = e.type\n if (eventType === 'click' && isCommand) {\n var commandId = parent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show the forum topic with the given ID in the center panel | function showForumTopic(topicID)
{
topic = getForumTopicByID(topicID);
if(topic == null)
return;
contents = '<h1>' + topic.title + '</h1>';
participant = getParticipantByID(topic.participantID);
if(participant == null)
contents += '<h2>By: Removed participant</h2>';
... | [
"function showForum(courseID)\r\n{\r\n course = getCourseByID(courseID);\r\n if(course == null)\r\n return;\r\n var contents = '<h1>Forums: ' + course.name + '</h1>';\r\n topics = getForumTopicsByCourseID(courseID);\r\n contents += '<ul>';\r\n for(topic in topics)\r\n {\r\n partic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
overview image click handler | function overviewImgClick(e){
var i,j,tname,turl,item,c,li,
target = e.target || e.srcElement,
type = default_types_1,
premium;
turl = target.u;
//디폴트 타입에서 필요 li 검색
for (i = 0; i < type.length; i++) {
tname = type[i].n;
if (tname === turl) {
item = type[i];
break;
}
}
if (!item)
return;
//... | [
"function imageClicked() {\n var currentSource = $(this).attr('src');\n var altSource = $(this).attr('data-src');\n $(this).attr('src', altSource);\n $(this).attr('data-src', currentSource);\n }",
"function menuImageClick() {\n Data.Edit.Mode = EditModes.Image;\n updateMenu();\n}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the page size option is greater than total number of elements (users) disable it | function checkPageSizes() {
let pageSizesToShow = $('#pageSizesToShow').data('pagesizestoshow');
$("#pageSizeSelect option").each(function(i, option) {
if ($.inArray(parseInt(option.value), pageSizesToShow) === -1) {
option.disabled = true;
}
});
} | [
"function trkDisplayPagesNeeded() {\n for(i = 0; i < (trkPagination.length); i++) {\n var loopCurrentPageValue = trkPagination[i].attributes.value.value;\n if(loopCurrentPageValue <= trkNumberOfPagesNeeded) {\n trkPagination[i].style.display = \"flex\";\n } else {\n trkPagination[i].style.displa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the root stack resource for the current stack deployment | function getStackResource() {
const { stackResource } = exports.getStore();
return stackResource;
} | [
"get resourceStack() {\n const actionResource = this.actionProperties.resource;\n if (!actionResource) {\n return undefined;\n }\n const actionResourceStack = core_1.Stack.of(actionResource);\n const actionResourceStackEnv = {\n region: actionResourceStack.re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
looks for duplicate decimals in arr, doesn't allow second decimal | function checkForDecimal(arr) {
return arr.length === new Set(arr).size;
} | [
"function isAvgWhole(arr) {\n\tlet a = 0;\n\tfor (let i = 0; i < arr.length; i++) {\n\t\ta += arr[i];\n\t}\n\t\n\treturn Number.isInteger(a / arr.length);\n}",
"function testcase() {\n var a = new Array(1,2,1);\n if (a.lastIndexOf(2,1.49) === 1 && // 1.49 resolves to 1\n a.lastIndexOf(2,0.51) === -1 && ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add walls to storage | addWalls(x, y) {
const dir = this.getNeighbours(x, y);
for (let i = 0; i < dir.length; i++) {
// Insert into data structure
this.walls.insert({
x: dir[i][0],
y: dir[i][1],
direction: dir[i][2]
});
}
} | [
"function makeWalls( worldPivot, spaceApart, left, up, right, down, material ) {\n\n\tvar object;\n\tvar box;\n\n\t// right\n\tif ( right ) {\n\n\t\tobject = new THREE.Mesh( new THREE.BoxBufferGeometry( spaceApart, WallLength, WallThickness, 4, 4, 4 ), material );\n\t\tobject.position.set( worldPivot.x, 50, worldPi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When component mounts, listRestaurants action is called and reducer is applied to get me restaurant data | componentDidMount() {
this.props.listRestaurants();
} | [
"function mapDispatchToProps(dispatch){\n return {\n getRecipesAction : (searchTerm) => {\n dispatch(getRecipes(searchTerm)) \n }\n }\n }",
"toRestaurant() {\n this.props.handleChangePage('Restaurant', this.props.rest.restId);\n }",
"getMovies() {\n console.log('in get movie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helpers // TODO: we should bring this out to a images_helper class or something? Generates a random URL with the specified length and a given set of characters | function generateRandomURL(length, chars) {
var output = '';
for (var i = length; i > 0; i--) {
output += chars[Math.round(Math.random() * (chars.length - 1))];
}
return output;
} | [
"function generateURL(id) {\n return `https://picsum.photos/id/${id}/400`;\n }",
"function buildRandomString(length) {\n //declare and initialize a string of the alphabet caracters\n var alphabet = 'abcdefghijklmnopqrstuvwxyz';\n //declare an empty result string\n var resultString = '';\n //REPEAT length... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copies the value of a property from one object to the other. This is used to copy property values as part of setOption for loggers and appenders. Because loggers inherit property values from their parents, it is important never to create a property on a logger if the intent is to inherit from the parent. Copying rules:... | function copyProperty(propertyName, from, to) {
if (from[propertyName] === undefined) {
return;
}
if (from[propertyName] === null) {
delete to[propertyName];
return;
}
to[propertyName] = from[propertyName];
} | [
"function defineAllProperties(to, from) {\n to.__model__ = to.__model__ || from;\n each(from, function(m,n) {\n try {\n if (to.__model__ !== from)\n to.__model__[n] = m;\n defineProperty(to,n,m);\n } catch (t) {}\n });\n }",
"function MergeRecursive(obj1, obj2) {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recomputes and then places each window in its correct position widget > x, y, id | function new_window_fixup() {
var windows = $('.gs-w');
for (var i = 0; i < windows.length; i++) {
$(windows[i]).attr({
'data-col': layout[windows.length-1][i].col(maxCols),
'data-row': layout[windows.length-1][i].row(maxHeight),
'data-sizex': layout[windows.length-1][i].sizex(maxC... | [
"rearrangeDivs() {\n const margin = 10;\n let twidth = window.innerWidth - this.parent_.offsetLeft;\n // TODO remove this hack\n // If the config is present\n let config = document.getElementById(\"config\");\n if (config !== null) twidth -= config.offsetWidth + 10 + margin;\n\n // Group window... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the supplied entry to the cache and updates the cache size as appropriate. All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer returned by `newChangeBuffer()`. | addEntry(t, e, n) {
const s = e.key,
i = this.docs.get(s),
r = i ? i.size : 0,
o = this.ps(e);
return this.docs = this.docs.insert(s, {
document: e.clone(),
size: o,
readTime: n
}), this.size += o - r, this.Ht.addToCollectionParentIndex(t, s.path.popLast());
... | [
"addEntry (state, args) {\n const cache = state.cache[args.property]\n const turn = state.turns[state.currentTurn]\n turn.push(args.entry)\n\n cache.turn = state.currentTurn\n cache.entryId = args.entry.entryId\n state.entryId++\n }",
"addToCache(key, value) {\n assert.isString(key)\n thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
"A requestpath pathmatches a given cookiepath if at least one of the following conditions holds:" | function pathMatch (reqPath, cookiePath) {
// "o The cookie-path and the request-path are identical."
if (cookiePath === reqPath) {
return true;
}
var idx = reqPath.indexOf(cookiePath);
if (idx === 0) {
// "o The cookie-path is a prefix of the request-path, and the last
// character of... | [
"function matchPath(ctx) {\n const pathname = parseurl_1.default(ctx).pathname;\n const cookiePath = cookieOptions.path || \"/\";\n if (cookiePath === \"/\") {\n return true;\n }\n if (pathname.indexOf(cookiePath) !== 0) {\n // cookie path not match\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return minimum cost to reach top step after you pay the cost of a given step you can move 1 or 2 steps you can start from zeroeth or 1st step | function min_cost_stairs(costs) {
const priceSums = new Array(costs.length).fill(0);
priceSums[0] = costs[0];
priceSums[1] = costs[1];
for(let i = 2; i < priceSums.length; i++) {
priceSums[i] = costs[i] + Math.min(priceSums[i - 1], priceSums[i - 2]);
}
return Math.min... | [
"function minCostToClimbStairs(n, price) {\n const dp = new Array(n + 1).fill(0);\n dp[0] = 0;\n dp[1] = price[0];\n\n for (let i = 2; i <= n; i++) {\n dp[i] = price[i-1] + Math.min(dp[i - 1], dp[i - 2]);\n }\n\n return dp[n];\n}",
"calculateTravelCost(previous, next) {\n if (next.row ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
==================================== Stream Receiver ==================================== | function stream_receiver(payload) {
payload.m.forEach( ( msg, num ) => {
streamary.push(msg);
if (streamary.length > streamlim ) streamary.shift();
} );
} | [
"function onReceiveStream(stream, elementID){\n var video = $('#' + elementID + ' video')[0];\n console.log(video);\n video.src = window.URL.createObjectURL(stream);\n }",
"EnumerateStreams() {\n\n }",
"readStream(){\n redis.consumeFromQueue(config.EVENTS_STREAM_CONSUMER_GROUP_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or sets the color to use the border of the input group. | get borderColor() {
return brushToString(this.i.g5);
} | [
"function _editTextColor ( /*[Object] event*/ e ) {\n\t\tthis.nextElementSibling.style.borderColor = this.value;\n\t\tvar activeObject = cnv.getActiveObject();\n\t\tif ( this.value && activeObject ) {\n\t\t\tactiveObject.set({fill: this.value});\n\t\t\tcnv.renderAll();\n\t\t\twindow.tmpTextProps && window.tmpTextPr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates captcha text and converts it to image | function Captcha() {
for (var i = 0; i < 6; i++) {
var a = alpha[Math.floor(Math.random() * alpha.length)];
var b = alpha[Math.floor(Math.random() * alpha.length)];
var c = alpha[Math.floor(Math.random() * alpha.length)];
var d = alpha[Math.floor(Math.random() * alpha.length)];
... | [
"function vpb_refresh_aptcha()\r\n{\r\n\treturn $(\"#vpb_captcha_code\").val('').focus(),document.images['captchaimg'].src = document.images['captchaimg'].src.substring(0,document.images['captchaimg'].src.lastIndexOf(\"?\"))+\"?rand=\"+Math.random()*1000;\r\n}",
"function initCaptcha() {\n captchaX = Math.floo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
eslint nounusedvars: 0 included from index Alerts the user if the browser version is so old, that even the transpiled and polyfilled version is not guaranteed to work. Only an approximation: Using some browser name and versions, may fail to warn or warn incorrectly. | function browserCheckTranspiled()
{
if (
(navigator.sayswho.name === 'Firefox' && navigator.sayswho.version < 50) ||
(navigator.sayswho.name === 'Internet Explorer') ||
(navigator.sayswho.name === 'Chrome' && navigator.sayswho.version < 54)
)
{alert(`Your browser ${navigator.sayswho.name} version ${naviga... | [
"function browserCheckNonTranspiled()\n{\n if (\n (navigator.sayswho.name === 'Firefox' && navigator.sayswho.version < 60) ||\n (navigator.sayswho.name === 'Internet Explorer') ||\n (navigator.sayswho.name === 'Chrome' && navigator.sayswho.version < 61)\n )\n {\n const warning = `Your browser ${navigator... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
disease which affects 1 in 10,000 people 2% false positive rate or 200 in 10,000 people report and validate result | function sim_test_people(run_people){
console.log("\nsim_test_people with %i people", run_people);
expected_disease_count = run_people * odds_for_disease;
expected_false_positive_count = run_people * odds_for_false_positive;
disease_count = 0;
false_positive_count = 0;
for (i=1; i<= run_people; i++){
//... | [
"function boredom(staff){\n let result = 0\n let scores = { 'accounts': 1, 'finance': 2, 'canteen': 10, 'regulation': 3, 'trading': 6, 'change': 6,'IS': 8, 'retail': 5,'cleaning': 4,'pissing about': 25 }\n\n for (let item in staff) {\n result += scores[staff[item]]\n }\n\n\n if (result <= 80) {\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize all model assets used on `faceapi. Will call the `setupStream` once all models were loaded | setupAssets() {
Promise.all([
faceapi.nets.tinyFaceDetector.loadFromUri(FACEDETECTATTR.modelsUri),
faceapi.nets.faceExpressionNet.loadFromUri(FACEDETECTATTR.modelsUri)
]).then(() => {
this.setupStream();
});
} | [
"function init() {\n createjs.Ticker.framerate = animateFps;\n Promise.all([Promise.all(initValueProviders()), Promise.all(initAnimates())]).then(() => {\n Promise.all([initWidgets()]).then(() => {\n resolveValueProviders();\n Object.entries(models).forEach(([, model]) => model.init());\n javasc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FRONTEND TWEAKS ================================================================== add "Go to last reply" link to thread links | function addThreadLastReplyLink(link, submission) {
if ( submission["section"] == "threads" ) {
link.after(' [<a title="Go to last reply" href="'+link.attr("href")+'?vl[page]=LAST&mid=PostsList#PostsListLastPost">»</a>]');
}
} | [
"toggleReplyRequest (threadViewInitiator='NONE', thread={}, activeClass={}, user={}) {\n if (this.replyRequestedByMe) {\n this.replyRequestCount -= 1\n this.replyRequestedByMe = false\n } else {\n this.replyRequestCount += 1\n this.replyRequestedByMe = true\n\n this.logSpotlightAction... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hide the ML slider | function disableML( id ) {
$(id).find(".ml").each( function() {
$(this).slider( "disable" );
$(this).addClass(" vis-hide");
});
} | [
"function exitSlider () {\nmainWrapper.style.display = 'none';\n}",
"function hideSliders() {\r\n $('#about-section-slider, #portfolio-section-slider').hide();\r\n}",
"function hideSlider() {\r\n\tvar mydiv = document.getElementById('day-panel');\r\n\tmydiv.style.display = (mydiv.style.display = 'none');\r\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
// Private functions // // /////////////////////////// Register item index as active index to the list. | function _registerIndex() {
if (angular.isUndefined(lumx.parentController)) {
return;
}
lumx.parentController.activeItemIndex = $element.index(`.${CSS_PREFIX}-list-item`);
} | [
"function DDLightbarMenu_AddItemHotkey(pIdx, pHotkey)\n{\n\tif ((typeof(pIdx) == \"number\") && (pIdx >= 0) && (pIdx < this.items.length) && (typeof(pHotkey) == \"string\") && (this.items[pIdx].hotkeys.indexOf(pHotkey) == -1))\n\t\tthis.items[pIdx].hotkeys += pHotkey;\n}",
"function setNextItemActive() {\n var i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Labs categories list | function getLabsCategories() {
var getLabsCategoriesUrl;
getLabsCategoriesUrl = constantData.SERVER_ADDRESS + apiUrl.categories.CATEGORIES + '/lab';
return serverApi.getData(getLabsCategoriesUrl,true);
} | [
"function getCategories(cv){\n\t'use strict';\n\tvar arr = [];\n\tfor(var i=0; i<cv.category.length; i++){\n\t\tarr.push(cv.category[i].title);\n\t}\n\treturn arr;\n}",
"function getAllCateogorie () {\n return categorie;\n}",
"function fetchcategories() {\n API.getCategories().then(res => {\n const res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Formats all the current cookies in the CookieJar as a string that can be set as the response Cookie header. | toHeader() {
return Object.keys(this.cookies)
.reduce((cookieString, cookieKey) => {
let cookieValue = this.get(cookieKey);
return cookieString + `;${cookieKey}=${cookieValue}`;
}, '')
.replace(';', '');
} | [
"function getAllCookies() {\n const cookiesString = document.cookie || '';\n const cookiesArray = cookiesString.split(';')\n .filter(cookie => cookie !== '')\n .map(cookie => cookie.trim());\n\n // Turn the cookie array into an object of key/value pairs\n const cookies = cookiesArray.reduce((acc, currentV... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set leverage for symbol | async leverage(params) {
if (!params.hasOwnProperty('leverage')) {
params['leverage'] = "20";
}
var schema = {
stub: { required: 'string', format: 'lowercase', },
symbol: { required: 'string', format: 'uppercase', },
type: { re... | [
"set price(value) {\n this._price = 80;\n }",
"set metallic(value) {}",
"SetTurtle(num) {\n if (num == 1) { this.turtleToughness = -1; this.turtleCapacity = 1; this.capacity += this.turtleCapacity; }\n if (num == 2) { this.turtleToughness = -1; this.turtleCapacity = 2; this.capacity += -1 + this.t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParsermodify_column_clauses. | visitModify_column_clauses(ctx) {
return this.visitChildren(ctx);
} | [
"visitModify_mv_column_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitColumn_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitAdd_modify_drop_column_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitModel_column_clauses(ctx) {\n\t return this.visitChildren(ctx)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates spot objects from JSON responses. | function createSpots(spotRes) {
const spots = [];
for (const spot in spotRes) {
if (spotRes.hasOwnProperty(spot)) {
// Check if there are coordinates, and if there are comments. Set to default values if none.
const latitude = spotRes[spot].latitude === undefined ? null : spotRes[spot].latitude;
... | [
"function loadResponse(){\n var APODObject = JSON.parse(this.response)\n APODList.push(APODObject)\n}",
"function getSongs(Query) {\n var spotify = new Spotify(LiriTwitterBOT.spotify);\n if (!Query) {\n Query = \"what's+my+age+again\";\n };\n spotify.search({ type: 'track', query: Query }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor allows for one passenger initialization using singleton pattern sets up connections and creates user object | function Passenger(options) {
if (!_singleton) {
this.config = $.extend(true, {}, DEFAULTS, options); // overrides config defaults
this.setupConnections();
this.user = {};
_singleton = this;
}
return _singleton;
} | [
"async init() {\r\n await Managers.findOne({username: this.username}, function(error, manager) {\r\n if(error) {\r\n console.log(error);\r\n return;\r\n }\r\n else {\r\n this.production = manager.production; \r\n thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
read the email file indicated for the test | readEmailFile (callback) {
const inputFile = this.emailFile + '.eml';
let path = Path.join(process.env.CSSVC_BACKEND_ROOT, 'inbound_email', 'test', 'test_files', inputFile);
FS.readFile(
path,
'utf8',
(error, emailData) => {
if (error) { return callback(error); }
this.emailData = emailData;
c... | [
"async onStopSending(msgId, status, msg, returnFile) {\n ok(returnFile.exists(), \"createRFC822Message should create a mail file\");\n let content = await IOUtils.read(returnFile.path);\n content = String.fromCharCode(...content);\n ok(\n content.includes(\"Subject: Test createRFC822Message\\r\\n\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Places farm by point on the map, adds a path to farm | function generateFarm( stateMap, x, y, style ) {
var shiftX = Math.floor( (Math.random() - 0.5)*FARM_DIST );
var shiftY = (shiftX < 0 ) ? (FARM_DIST + shiftX) : (FARM_DIST - shiftX);
var farmX = x + shiftX;
var farmY = y + shiftY;
// Create windy path between castle and farm (using A*)
var success = false;
whi... | [
"function addLocation()\r\n{\r\n let newWaypoint = currentRoute.routeMarker.getPosition();\r\n currentRoute.waypoints.push(newWaypoint);\r\n currentRoute.displayPath();\r\n}",
"function dreamFlightPath(x, y, zx, zy, colour) {\n var ax = 200 + x;\n var ay = 700 + (y - 150);\n var bx =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Invokes `interceptor` with the `obj` and then returns `obj`. The primary purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. | function tap(obj, interceptor) {
interceptor(obj);
return obj;
} | [
"function chain$($el, obj){\n forOwn(obj, function(method, args){\n if (isPlainObject(args)) {\n chain$($el, args);\n }\n else {\n $el[method].apply($el, [].concat(args));\n }\n });\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
callback function of clicked event on checkboxlabel checks or unchecks the checkbox which belongs to this checkboxlabel but only if no recording is happening | function clickedOnCheckboxLabel(data) {
if (!viewModel.recordingTimeoutHandle()) // only allow toggling of checkbox if currently not recording
{
data.isChecked(!data.isChecked());
}
} | [
"function handleCheck(e) {\n\t\tsetIsComplete(e.target.checked)\n\t}",
"function handleCheckboxLabelClick(checkboxId, event) {\n var checkbox = jQuery(\"#\" + checkboxId);\n if (!checkbox.prop(\"disabled\")) {\n if (jQuery(event.target).is(\"input, select, textarea, option\")) {\n if (!che... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a DIV element that enclosed a Show/Hide anchor and embeds the endnote display in an PRE inside an inner div. | function majaxMakeEndnoteDisplay(doc, labelText, showText, hideText, preclass)
{
var p = doc.createElement("PRE");
if (preclass != undefined)
p.className = preclass;
var ptext = this.endnote;
p.appendChild(doc.createTextNode(ptext));
var innerdiv = doc.createElement("DIV");
innerdiv.st... | [
"function displayNotes(note) {\n const { title, body, _id } = note;\n let displayBox = $(\"<div>\");\n displayBox.addClass(\"note-body\");\n let titleDisplay = $(\"<p>\");\n let bodyDisplay = $(\"<p>\");\n let deleteBtn = $(\"<button>\");\n let hr = $(\"<hr>\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for horse name=================== | function isHorseName(str){
check="`~!@#$%^*()_+=|{}[];:/<>?"+"\\"+"\""+"\"";
f1=1;
for(j=0;j<str.length;j++){
if(check.indexOf(str.charAt(j))!=-1){
f1=0;}}
if(f1==0){return true;}
else{return false;}
} | [
"function hoofdletters(tekst) {\n return tekst.toUpperCase(); // dit is alles\n}",
"function pHName(pH) {\n\treturn pH < 7 && pH >= 0 ? \"acidic\" : pH > 7 && pH <= 14 ? \"alkaline\" : pH === 7 ? \"neutral\" : 'invalid';\n}",
"function Morse(letra)\n{\n var codificacion;\n\n /* SOLUCION BRUTA\n swi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
I check to see if the given param is still the given value. | function isParam( paramName, paramValue ) {
// When comparing, using the coersive equals since we may be comparing
// parsed value against non-parsed values.
if (
params.hasOwnProperty( paramName ) &&
( params[ paramName ... | [
"function hasParamChanged( paramName, paramValue ) {\r\n\r\n // If the param value exists, then we simply want to use that to compare\r\n // against the current snapshot.\r\n if ( ! ng.isUndefined( paramValue ) ) {\r\n\r\n return( ! isParam( paramName,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make json telemetry object | function GetTelemetryObj() {
var myJSON = {
"utc": 0,
"soc": 0,
"soh": 0,
"speed": 0,
"car_model": CAR_MODEL,
"lat": 0,
"lon": 0,
"elevation": 0,
"ext_temp": 0,
"is_charging": 0,
"batt_temp": 0,
"voltage": 0,
"current": 0,
"power":... | [
"function createOutputJsonInstance()\n{\n\tvar output = \n\t\t{\n\t\t\t\"status\": null,\n\t\t\t\"message\": null,\n\t\t\t\"data\": null\n\t\n\t\t}\n\n\treturn output;\n\n}",
"async sendToTelemetry() {\n let reporter;\n try {\n reporter = await telemetry_1.default.create({\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
System menus must be explicitly created on OS X, see nodewebkit documentation: | function createSystemMenuForOSX()
{
if ('darwin' == OS.platform())
{
try
{
var appName = getApplicationName()
var win = GUI.Window.get()
var nativeMenuBar = new GUI.Menu({ type: 'menubar' })
nativeMenuBar.createMacBuiltin(appName)
win.menu = nativeMenuBar;
}
catch (ex)
{
wind... | [
"function setAppMenu() {\n let menuTemplate = [\n {\n label: appName,\n role: 'window',\n submenu: [\n {\n label: 'Quit',\n accelerator: 'CmdorCtrl+Q',\n role: 'close'\n }\n ]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If sheet has additional info, loop and format it | function getAddedInfo(addedInfo){
var header = sheet.getRange(1, 7, 1, lastColumn - 6).getValues();
header = [].concat.apply([], header);
var formatAddedInfo = '<br />';
for (i = 0; i < addedInfo.length; i++){
if (addedInfo[i] != ""){
if (Date.parse(addedInfo[i])) {
if (addedInfo[i].get... | [
"function archiveTask(){\n var style = SpreadsheetApp.newTextStyle()\n //.setForegroundColor(\"red\")\n .setFontSize(11)\n //.setBold(true)\n //.setUnderline(true)\n .build();\n var archived_task={};\n var archives={};\n \n for(var [i,name] in archives_name){\n archived_task[name]=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gives the permutation of all possible pathMatch()es of a given path. The array is in longesttoshortest order. Handy for indexing. | function permutePath(path) {
if (path === '/') {
return ['/'];
}
if (path.lastIndexOf('/') === path.length-1) {
path = path.substr(0,path.length-1);
}
var permutations = [path];
while (path.length > 1) {
var lindex = path.lastIndexOf('/');
if (lindex === 0) {
break;
}
path = pa... | [
"function getPermutations(array) { //not recursive but hey\n\tif (!array.length) return [];\n\tlet results = [[array.shift()]];\n\twhile (array.length) {\n\t\tlet currNum = array.shift();\n\t\tlet tempResults = [];\n\t\tfor (let i = 0; i < results.length; i++) {\n\t\tlet resultsCopy = results.slice();\n\t\t\tfor (l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return 0 if there is a match of different positions of mtchString, 1 otherwise. | function match(item, mtchString) {
const arr = [];
arr.push(`${mtchString} `);
arr.push(` ${mtchString} `);
arr.push(` ${mtchString}.`);
arr.push(` ${mtchString}-`);
arr.push(`${mtchString}- `);
arr.push(`-${mtchString} `);
arr.push(`-${mtchString}`);
arr.push(`-${mtchString}.`);
arr.push(`${mtchStr... | [
"function naiveString(str1,str2){\n var count = 0;\n for(var i = 0;i <str1.length;i ++){\n for(var j = 0;j <str2.length;j ++){\n if(str1[i + j] != str2[j]){\n break;\n }\n if(j === str2.length - 1){\n //console.log(str2.length );\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This callback executes this command, wrapped so that it can be passed to an authenticating command to be called after authentication. | function doWorkWithAuth() {
Command.prototype.execute.apply(self, arguments);
} | [
"function oauthCallback() {\n\tangular.element($('#ProcessController')).scope().$apply(function(scope){\n\t\tscope.authorizeCurrentNode();\n\t});\n}",
"onMessage (message) {\n if (message.command && message.options) {\n this.executeCommand(message.command, message.options);\n }\n }",
"markAuthDone()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Autolink all vulnerabilities following the format CVE (case insensitive). The rightmost number can be 4+ digits long according to | function linkifyCVE(str) {
const regexp = /(CVE-\d{4}\-\d{4,})/gi;
const linkText = "[:vulnerability:$1](/cves/$1)";
return str.replace(regexp, linkText);
} | [
"function removeVulnerabilities() {\n console.log('Removing Vulns');\n vulnerabilities.forEach(function (vulnerability) {\n Meteor.call('removeVulnerability', projectId, vulnerability._id);\n });\n }",
"function addingDiscretionaryLineBreakForURLs(){\r\n myResetFindChangePref... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate Reset Password Code | validateResetPasswordCode(params, cb, errorCb) {
const url = `${endpoint}/password/reset/validate`;
client.post(url, params)
.then((response) => {
if (cb) {
cb(response.data);
}
})
.catch((e) => {
if (errorCb) {
errorCb(e);
}
});
} | [
"function verifyPasswordResetCode(auth, actionCode, continueUrl) {\n auth.verifyPasswordResetCode(actionCode).then(function(email) {\n window.frames['embeddedpage'].contentDocument.getElementById('account').innerText = email;\n }).catch(function(err) {\n alert ('Expired or invalid link, please try again.');... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
API calls associated with SiteWhere device assignments. Create a device assignment. | function createDeviceAssignment(axios$$1, payload) {
return restAuthPost(axios$$1, 'assignments/', payload);
} | [
"function createMeasurementsForAssignment(axios$$1, token, payload) {\n return restAuthPost(axios$$1, 'assignments/' + token + '/measurements', payload);\n }",
"function createDevice(data) {\n var device = new models[\"Device\"](),\n deviceData = networkInfo.device[0];\n\n $.each(deviceData, function(k... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |