query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Enter a parse tree produced by Java9ParservariableDeclaratorId. | enterVariableDeclaratorId(ctx) {
} | [
"enterVariableDeclaratorList(ctx) {\n\t}",
"variableDeclaration() {\n const varNodes = [new Var(this.currentToken)];\n this.eat(tokens.ID);\n while (this.currentToken.type === tokens.comma) {\n this.eat(tokens.comma);\n varNodes.push(new Var(this.currentToken));\n this.eat(tokens.ID);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to create the animal assigns a newname(sting) to name assigns a newDiscription(string) to discription | function animal(newName,newDiscription)
{
this.name=newName;
this.discription= newDiscription;
} | [
"function createAnimal(species, noiseVerb, noiseNoun){\n return{\n species,\n [noiseVerb](){\n return `The ${[species]} says ${[noiseNoun]}.`\n }\n }\n }",
"function createPet(name, species, well_behaved) {\n return {name, species, well_behaved};\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
playTone takes a button number (1 through 4, corresponding with the four game buttons on the page) and a length of time in milliseconds (1000 milliseconds = 1 second). When you call this function, it plays a tone for the amount of time specified. | function playTone(btn,len){
o.frequency.value = freqMap[btn]
g.gain.setTargetAtTime(volume,context.currentTime + 0.05,0.025)
tonePlaying = true
setTimeout(function(){
stopTone()
},len)
} | [
"function play(){\n next();\n timeout_id = setTimeout(\"play()\",1000/persec)\n}",
"function playButtonSound() { \nsound.src = 'music/click.mp3'\nsound.play() }",
"function drumSeqOn() {\n console.log(\"playing sequencer...\");\n let index = 0;\n Tone.Transport.scheduleRepeat(repeat, '8n');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For stream processing, we want to throttle the stream based on our queuing bandwidth. The callback is called when it's good time to queue the next job. We do allow some jobs to be queued in parallel, we don't need to wait for one job to be queued before sending the next one. But we limit it to a reasonable number, sinc... | throttle(callback) {
if (this._queuing < this._concurrency)
callback();
else
this.once('ready', ()=> this.throttle(callback));
} | [
"function Queue(workers) {\n var self = this;\n var requests = [];\n\n // Configure the workers. Builds an array of\n // available workers.\n self.workers = [];\n for (var i = 0; i < workers; i++) {\n var worker = new Worker();\n worker.ready(function () { self.tick(); });\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets an HTML string for the sepcified image and size. The image has to include all relevant dataset values (flickrs data). | getImageHtml(image, size) {
const flickrData = JSON.parse(image.dataset['flickr']);
const dateTaken = new Date(flickrData.date_taken);
const formattedDate = `${dateTaken.getDate().toString().padStart(2, '0')}-${(dateTaken.getMonth() + 1).toString().padStart(2, '0')}-${dateTaken.getFullYear()}`;
... | [
"function getShapeBgImageHtmlCode (imageName, width, height) {\r\n\r\n//\tvar randomNumber = Math.random() * 1000000;\r\n\tvar randomNumber = \"\";\r\n\r\n\tif (dynapi.ua.ie == true && dynapi.ua.v >= 5) {\r\n\t\treturn \"<DIV STYLE=\\\"height:100%; width:100%; filter:progid:DXImageTransform.Microsoft.AlphaImageLoad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set domestic active icon for Marker. | function setMarkerIconActive(marker) {
setMarkerIcon(marker, 'yellow', 'dot');
} | [
"function setMarkerIconUnactive(marker) {\n if (controller.isStartPoint(marker.id))\n setMarkerIcon(marker, 'green', 'dot');\n else\n setMarkerIcon(marker, 'red', 'dot');\n}",
"function toggleMarkersIcons(newMarker) {\n var oldMarker = controller.getActiveMarker();\n if (oldMarker != nul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : checkInputReservedVlan AUTHOR : Krisfen G. Ducao DATE : March 30, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS : | function checkInputReservedVlan(evt,ths){
evt = (evt) ? evt : window.event;
var str = "";var vlan = "";
var charCode = (evt.which) ? evt.which : evt.keyCode;
var asciiCode = String.fromCharCode(charCode);
var value = [];
if (charCode==44){
str = $(ths).val();
vlan = str.split(",");
for(var a=0;a<vlan.len... | [
"function checkInputLeave(ths){\n\tvar str = $(ths).val();\n\tvar id = $(ths).attr('id');\n\tvar vlan = str.split(\",\");\n\tvar value = [];\n\tfor(var a=0;a<vlan.length;a++){\t\n\t\tif (vlan[a]>4094){\n\t\t\talerts(\"Input cannot be greater than 4094\")\n\t\t\t$(\"#\"+id).val(value);\n\t\t\treturn 0;\n\t\t}\n\t\tv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
VISITOR GENERATION HELPER FUNCTIONS Get dynamic (date based) visitor (visitorId + acountId) | function getDynamicVisitor(date) {
// Create New Date, date will be used in the case of testing, otherwise, today will = today.
const today = date || new Date();
// Get the day of the week as a number [0 - 6 = Sun - Sat]
const dayOfWeek = today.getDay();
let visitorName, // Name from array
visitor = '';... | [
"function getStaticVisitor() {\n const randNum = Math.random() * 100;\n const accountId =\n staticAccounts[Math.floor(Math.random() * staticAccounts.length)];\n const accountIdNoSpaces = accountId.replace(/\\s/g, '');\n\n let visitorId;\n if (randNum < 25) {\n // 0 - 25 (25%)\n visitorId = `visitor1@$... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We could, if we wanted, do a complete move validation of the father's moveset to see if it's valid. This would recurse and be NPHard so instead we won't. We'll instead use a simplified algorithm: The father can learn the moveset if it has at most one egg/event move. `eggGen` should be 5 or earlier. Later gens should ne... | fatherCanLearn(template, moves, eggGen) {
if (!template.learnset) return false;
if (template.id === 'smeargle') return true;
let eggMoveCount = 0;
const noEggIncompatibility = template.eggGroups.includes('Field');
for (const move of moves) {
let curTemplate = template;
/** 1 = can learn from egg, 2 = ca... | [
"function moreAboutKaren(parents, noOfSiblings, isNuclearFamily) {\n if (typeof parents === \"string\") {\n return true;\n } else {\n return false;\n }\n if (typeof noOfSiblings == \"number\") {\n return true;\n } else {\n return false;\n }\n if (typeof isNuclearFami... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
on touch end change panes or return to current pane | function onTouchEnd(event){
if(g_temp.touchActive == false)
return(true);
//event.preventDefault();
g_temp.touchActive = false;
if(isMovementValidForChange() == false){
animateToCurrentPane();
return(true);
}
//move pane or return back
var innerPos = getInnerPos();
var diff = inn... | [
"panEnd() {\n return this._getUpdatedState({\n startPanPosition: null\n });\n }",
"function stageTouchEnd() {\n\twindow['variable' +dynamicPinchLastDist[pageCanvas]] = window['variable' + dynamicPinchStartCenter[pageCanvas]] = 0;\n}",
"panEnd() {\n return this._getUpdatedState({\n startPanLn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This step calls "onEnvProvisioningFailure" in case of any errors. | async function updateEnvOnProvisioningFailure({
requestContext,
container,
resolvedVars,
status,
error,
outputs,
provisionedProductId,
}) {
const payload = { requestContext, container, resolvedVars, status, error, outputs, provisionedProductId };
const environmentScService = await container.find('envi... | [
"function envErr(){\n if (process.env.NODE_ENV === \"production\"){\n let message = \"Error: Set env var(s)\";\n\n for(let arg of arguments){\n message += \" '\" + arg + \"'\"\n }\n\n console.error(message);\n process.exit(1);\n }\n }",
"function envErr(){\n if (process.env... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Match each source code identifier and any associated array indexing. Extract the indicies and recursivly replace them also. | function replaceArrayRefs(text) {
return replaceIdentifierRefs(text, function (id, indx) {
var k, offset, reply;
if ( id === "index" ) { hasIndex = true; }
for ( k = 0; k < indx.length; k++ ) {
indx[k] = replaceArrayRefs(indx[k]);
}
var arg = hash[id];
var dimen;
var joinStr, bracket, fixin... | [
"function rebuildIndexMapBruteForce() {\n var i;\n indexMap = {};\n\n for (i = 0; i < array.length; i += 1) {\n indexMap[array[i].id] = i;\n }\n }",
"function replaceArray(original, replacement, av)\n {\n\tfor (var i = 0; i < original.size(); i++)\n\t{\n\t\toriginal.valu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is called during the "preload" state of the phaser lifecycle. It loads the chair asset from the url. | function preload() {
game.load.image('chair', 'https://media1.popsugar-assets.com/static/imgs/interview/chair.png');
} | [
"function Preload() {\n assets = new createjs.LoadQueue(); // asset container\n util.GameConfig.ASSETS = assets; // make a reference to the assets in the global config\n assets.installPlugin(createjs.Sound); // supports sound preloading\n assets.loadManifest(assetManifest); // load asset... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update last log id | function updateLastLogID(last_log_id)
{
window.last_log_id=last_log_id;
} | [
"function getLastLogId(redis, callback) {\n redis.get('lastLogId', function(err, res) {\n if (callback) callback(res || '');\n });\n}",
"function getLastId(sn, callback) {\n // get the last id of sn from table SNLogs and if ok, execute the callback function\n // please use the reserved field to sto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Walk through template and mark all fields as unmodified. This guards against the edge case where we're passed in the same template object to multiple calls to this function. Note that it's quite possible for the modified attribute to be undefined, in which case we simply leave it undefined. | function markUnmodified(root_node) {
$.each(root_node, function(key, value) {
// Filter out nodes we don't want to recurse into. These include
// arrays, pointers to the DOM elements we stash in the template and
// leaf values.
if (key === "ref" ||
... | [
"function resetFields() {\n\n fields.forEach(field => {\n field.innerHTML = \"\";\n });\n\n}",
"visitModify_col_substitutable(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function template_edit()\n{\n}",
"setTransformDirty () {\n this._transformDirty = true;\n }",
"enterFieldMo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests animationend event after click. | testAnimationEndEventAfterClick() {
/** @suppress {visibility} suppression added to enable type checking */
const offset = style.getPageOffset(oneThumbSlider.valueThumb);
/** @suppress {visibility} suppression added to enable type checking */
const size = style.getSize(oneThumbSlider.valueThumb);
of... | [
"onAnimationEnd() {\n return null;\n }",
"function C012_AfterClass_Outro_Click() {\n\n\t// Jump to the next animation\n\tTextPhase++;\n\t//if (TextPhase >= 3) SaveMenu(\"C012_AfterClass\", \"Intro\");\n\n}",
"finish() {\n this.finishBtn.click();\n }",
"function video_done(e) {\n\tthis.curr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return true if provided pattern is positive pattern. | function isPositivePattern(pattern) {
return !isNegativePattern(pattern);
} | [
"function isPositive(input) {\n return input > 0;\n}",
"function checkPattern(file, pattern) {\n const match = multimatch(file, pattern);\n return match.length > 0;\n}",
"isEmpty(patternProperty) {\n if ((patternProperty = \"\")) {\n return true;\n } else {\n return false;\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `VirtualGatewayTlsValidationContextFileTrustProperty` | function CfnVirtualGateway_VirtualGatewayTlsValidationContextFileTrustPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationRes... | [
"function CfnVirtualNode_TlsValidationContextFileTrustPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('E... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
oni_exp constructors: Seq : exp > oni_exp | function Seq(/* exp1, exp2, ... */) {
precondition_arg_list(arguments);
return new OEN_Seq(arguments);
} | [
"function Alt(/* exp1, exp2, ... */) {\n precondition_arg_list(arguments);\n return new OEN_Alt(arguments);\n}",
"function Apply(/* fexp, aexp1, aexp2, ... */) {\n precondition_arg_list(arguments);\n return new OEN_Apply(arguments[0], slice_args(arguments, 1));\n}",
"function Lambda(/* formals, exp+ */) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepare the sources and loop through each of them running the capture function with defined options return the results array with capture metadata | async capture(sources, opts = {}) {
if (!this.browser) {
await this.prepare();
}
if (_.isEmpty(sources)) {
return [];
}
// Ensure default options
opts = _.merge({
type: 'png',
options: {}
}, opts);
// TODO: Validate execution options
validateType(opts.type)... | [
"function getSourceFilesGoPro(gpurl){\n\tgpurl = gpurl || 'http://10.5.5.9/videos/DCIM/100GOPRO/'; //this is the default gopro url\n\tvar files;\n\t\n\treturn new Promise (function(resolve,reject){\n\t\trp({url:gpurl})\n\t\t.then(function(res){\n\t\t\t//writefile('C:/temp/tango/gopro.html',res.body);\n\t\t\t//p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a JS array of arrays of numbers from a string Example input: "[255, 255, 255], [35, 35, 35]" Example output: [[255, 255, 255], [35, 35, 35]] | function getNumberArraysFromString(string) {
let array = [];
let re = /\[(.*?)(?=\])/g;
let matches;
do {
matches = re.exec(string);
if(matches)
array.push(matches[1].split(',').map(Number));
} while (matches);
return array;
} | [
"function convertIntoArray(string){\n return string.split(\" \");\n}",
"function makeIntList(str)\n\t{\n\t\tif (!str)\n\t\t\treturn [];\n\n\t\tvar out = [];\n\n\t\t$.each(str.split(','), function(idx, val) {\n\t\t\tout.push(parseFloat(val));\n\t\t});\n\n\t\treturn out.sort();\n\t}",
"function toArray(num) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addBlock() create new procedure block under topblock; this is used to add toplevel procedure visuals to the context | function addBlock(label) {
// make sure label is unique identifier
var newlabel = label;
var counter = 1;
var found;
do {
found = topBlock.forEachChild(function(child){
if (child.getLabel() == newlabel) {
newlabel = label + counter;... | [
"function addNode(kind) {\n var node = null;\n\n // must not be in top block scope\n if (currentBlock === topBlock)\n return;\n\n // create node based on kind; it gets a reference to the current block's\n // logic object\n node = createVisual(ctx,kind,currentBloc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
data is the search results of the user's input from Teleport API. Function gets first city result from data and gives query to functions to display relevant Teleport and Wikipedia info. | function showAllInfo(data) {
$(".info_section").empty();
if (verifyTeleportDataNotEmpty(data)) {
const firstCity = data._embedded[`city:search-results`][0];
showTeleportCityInfo(firstCity);
showWikipediaInfo(firstCity[`matching_full_name`]);
}
else {
displayNoSearchResults();
... | [
"function searchCityAndGetWeather(){\n city = $(searchInput).val()\n getWeatherAndForecast()\n }",
"function getTeleportCityDetails(data) {\n let cityDetails = {\n cityName : data.name ,\n closestUrbanCity : null ,\n fullName : data.full_name ,\n latLng : { lat : data[`location`][`la... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to determined if the dog is captured | function isDogCaptured(isCaptured){
if (isCaptured = true){
alert('You have captured the Guard dog to the underworld!')
endGame();
}
} | [
"function is_captured() {\n if (Math.abs(hero.pos.x - zombie.pos.x) < char_size) {\n if (Math.abs(hero.pos.y - zombie.pos.y) < char_size) {\n return true;\n }\n }\n return false;\n }",
"function massHysteria(c, d) {\n let c = cats;\n let d = dogs;\n\n if (d.raining === true && ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function is called when clicking the add note button | function addNote(){
// get the span element that hode the number of notes
curCounter = $(this).parent().prev();
// get the article id
var articleId = $(this).data('article-id');
// store the article id in save button's data attr
$('#btn-save-note').data('article-id', articleId);
$('textarea').val('');... | [
"function addNote(e) {\n let addTxt = document.getElementById(\"addTxt\");\n let addTitle = document.getElementById(\"addTitle\");\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObject = [];\n } else {\n notesObject = JSON.parse(notes);\n }\n let myOb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get All Threads and Render an Individual Thread | function _GET_ThreadsRenderInd() {
$.ajax({
dataType: "json",
headers: { "Authorization": "Basic " + btoa(state.user + ":" + state.password) },
url: "/threads",
type: "GET",
success: function success(data) {
state.movieThreads = data.movieThreads;
saveToStorage(state);
renderInd... | [
"function _GET_AllThreads() {\n\n $.ajax({\n dataType: \"json\",\n // headers: { \"Authorization\": \"Basic \" + btoa(state.user + \":\" + state.password) },\n url: \"/threads\",\n success: function success(data) {\n state.movieThreads = data.movieThreads;\n saveToStorage(state); // persist\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to pull player at bats and divide by the number of games to determine average at bat per game. | function batspergame (player) {
return player.atbats / player.games;
} | [
"function getOverFromBalls(balls){\n\n let tempOver=String(balls).split('.');\n \n if(tempOver.length===2)\n {\n return Number(parseFloat(Number(tempOver[0])+Number(tempOver[1][0])*.06).toFixed(1));\n }\n else \n { \n //if no. of balls are directly a multiple of 6 they we are r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new ContactOtherActivity. Other contact activity schema | constructor() {
ContactOtherActivity.initialize(this);
} | [
"constructor() { \n \n RecipientContact.initialize(this);\n }",
"function add_google_contact_create_contact(email_address, auth_token, xml) {\n url = 'http://www.google.com/m8/feeds/contacts/' + escape(email_address) + \"/base\";\n\n return add_google_contact_send_request(\"POST\", url, xml... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render a select2 thumbnail image | function select2Thumbnail(image) {
if (!image) {
image = blankImage();
}
return `<img src='${image}' class='select2-thumbnail'>`;
} | [
"function onImagePickerOptionChange(pickerOption) {\r\n $('#projectImagePreview').attr('src', $(pickerOption.option[0]).data('img-src'));\r\n}",
"function showLargeImage(caption,thumbnailArrayIndex){\n\t//set ID for previously selected thumbnail\n\tvar oldObjIdString = 'FSI_' + currentImageIndex;\n\tcurrentIma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the card node from its parent / Returns the card. / The CardSlot should not be used after this | delete() {
if (this._node && this._node.parentNode) {
this._node.parentNode.removeChild(this._node)
}
return this._card
} | [
"pop() {\n if (this.currentNode.children.length > 0) return;\n\n let tmp = this.currentNode;\n this.previous();\n tmp.removeFromParent();\n }",
"removeFromFront() {\n\n if(this.isEmpty()) return null;\n\n var nodeToRemove = this.head;\n\n this.head = this.head.next;\n node... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Responsive navigation toggle active (displayBlock) class on nav ul | function toggleNavUl() {
let navUl = document.querySelector("nav ul");
if (navUl.classList.value === "displayBlock") {
navUl.classList.remove("displayBlock");
} else {
navUl.classList.add("displayBlock");
}
} | [
"toggleMenu() {\n\n /* conditional check to figure out wheter to add or remove 'hidden' and replacing it with 'block', or the other way around */\n if ($('nav.nav').hasClass('hidden')) {\n $('nav.nav').removeClass('hidden');\n $('nav.nav').addClass('block');\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to check for slices that are compositions from other slices IE: z slices from top and y slices | function getCrossSlice(startSlice,endSlice)
{
var sliceString;
//trying to move z slices from the top towards the upper right corner
//start from x_slice1 and land on x_slice2 or x_slice3, or start from
//x_slice2 or x_slice3 and land on x_slice1
if(((startSlice === "x_slice1") && ((endSlice === "x... | [
"function sliceMovementStop(x,y)\n{\n endX = x;\n endY = y;\n var startSlice = getSliceRange(startX,startY).slice;\n var endSlice = getSliceRange(endX,endY).slice;\n var movDir;\n var degreeAdd;\n var sliceString;\n var sliceArr;\n var results = {};\n/*\n window.alert(\"Start Slice \" ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : gatherDataAutoD AUTHOR : Cathyrine Bobis DATE : MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS : | function gatherDataAutoD(type){
// setAutoDVariable();
var data = autoDDevData[0];
var date = new Date();
var month = date.getMonth();
var day = date.getDay();
var year = date.getFullYear();
var hour = date.getHours();
var min = date.getMinutes();
var sec = date.getMilliseconds();
var logname =... | [
"function createDataAutoD(idx){\n\n var d = autoDDevData[0];\n\tif(globalInfoType==\"XML\"){\n var autoDS = \"<MAINCONFIG>\";\n autoDS += \"<DEVICE \";\n autoDS += \"DeviceType='\"+d.DeviceType+\"' \";\n autoDS += \"Domain='\"+d.Domain+\"' \";\n autoDS += \"DomainId='\"+d.DomainId+\"' \";\n aut... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Give a visual feedback on the state of the last status. Use recursively to restore the original color. statusColor = hex str, resetColor = bool | function setStatusIndicator(statusColor, resetColor) {
// Explicitly set the border attributes because the border may not exist
// before the first time the color is explicitly set.
$('#status-box').removeClass('status-box-normal').addClass('status-box-update');
$('#status-box').css('border-color', statusColor);
... | [
"status(title, status) {\n const statusString = status === false ? symbols.error : symbols.success;\n console.log(Log.fill(`\n [${chalk.yellow(title)}] [FILL] [${statusString}]\n `));\n }",
"function changeStatus() {\n var text = \"Time Range Bar: <b>\" + boolToOnOff(mainfocus)\n + \"</b>... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls findAll function from parent controller to reset filters Must be called as a seperate function in order for it to hit the parent controller | resetFilters() {
this.findAll();
} | [
"function resetFilters() {\n refinedTable = tableData;\n dataTable(tableData);\n}",
"filterAll (iterator) {\n return this.getAllModels().filter(iterator)\n }",
"clearAllFilters() {\n this.currentFilters = []\n\n each(this.filters, filter => {\n filter.value = ''\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find last ball main chain index by a special mic | function findLastBallMciOfMci( conn, mci, handleLastBallMci )
{
if ( 0 === mci )
{
throw Error( "findLastBallMciOfMci called with mci=0" );
}
//
// ONLY one row dumped if we query successfully
//
conn.query
(
"SELECT lb_units.main_chain_index, lb_units.is_on_main_chain \n\
FROM units JOIN units AS lb_uni... | [
"function readLastMainChainIndex( handleLastMcIndex )\n{\n\tdb.query\n\t(\n\t\t\"SELECT MAX( main_chain_index ) AS last_mc_index FROM units\",\n\t\tfunction( rows )\n\t\t{\n\t\t\tvar last_mc_index;\n\n\t\t\t//\t...\n\t\t\tlast_mc_index\t= rows[ 0 ].last_mc_index;\n\n\t\t\tif ( last_mc_index === null )\n\t\t\t{\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Query whether the chat sidebar is visible | function isChatVisible() {
return jQuery(".sizing-wrapper").hasClass("with-chat");
} | [
"isVisible() {\n return this.toolbar.is(\":visible\");\n }",
"function _isPanelOpen() {\n return $issuesPanel.is(\":visible\");\n }",
"function filters_visibility () {\n filters_trig = $('#mobileFilters');\n if($(document).scrollTop() >= $('.domain-results-searchbar-container').offset(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
one can publish any data to subscribers | publish (data) {
this.subscribers.forEach(subscriber => {
subscriber(data);
});
} | [
"function subscribeTo(p) {\n publisher = p;\n p.addGlube(that);\n }",
"publish(eventType, ...payload) {\n const subscribers = this.events.get(eventType);\n if (subscribers) {\n for (const eventHandler of subscribers) {\n eventHandler(...payload);\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle selected rows to make sticky | function toggleSelectedRows() {
//if row is pinned and u click, unpin it
if (this.getAttribute('class') === 'pinned') {
this.setAttribute('class', 'unpinned');
} else {
//if row isn't pinned and u click on it, pin it
this.setAttribute('class', 'pinned');
}
} | [
"function OnClickMoveDown()\r\n{\r\n var rows = iDoc.getElementById(\"dataTable\").rows;\r\n\r\n\r\n for (var i = rows.length - 2; i > 0; i--)\r\n {\r\n row1 = rows[i].getAttribute(\"selected\");\r\n row2 = rows[i + 1].getAttribute(\"selected\");\r\n\r\n\r\n if (row1 == 1 && row2 == 0)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the ids of the constructor's parameters are in the breed's fields | constructorParamsAreFields(parameters, fields) {
const fieldIds = fields.map((field) => field.id.name);
const fieldVars = fields.map((field) => field.variable);
doCheck(
parameters.ids.every((paramId, i) => {
const matchingField = fieldIds.indexOf(paramId.name);
const fieldAndParamType... | [
"constructorNameMatchesBreedId(constructorId, breedId) {\n doCheck(\n constructorId.name === breedId.name,\n `A constructor's identifier must match the identifier of the breed in which it is defined`\n );\n }",
"constructorReturnsBreedType(constr, breed) {\n doCheck(\n this.typesAreEquiva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Need to wrap addrof in this wrapper because it sometimes fails (don't know why, but this works) | function addrof(val) {
for (var i = 0; i < 100; i++) {
var result = addrofInternal(val);
if (typeof result != "object" && result !== 13.37){
return result;
}
}
print("[-] Addrof didn't work. Prepare for WebContent to crash or other strange stuff to happen...");
t... | [
"function addRedo(func) {\n redoQueue.push(func);\n return;\n}",
"function addOnloadHook (hookFunct) {\n // Allows add-on scripts to add onload functions\n if (!doneOnloadHook) {\n onloadFuncts[onloadFuncts.length] = makeSafe (hookFunct);\n } else {\n makeSafe (hookFunct)(); // bug in MS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assign a message to a contact Unmatched page | function Assign(messageId) {
// console.log('Assign # : '+messageId);
// get array of checked ids
var newContacts = $(".imapper-contact-box input:checkbox:checked").map(function(){
return $(this).val();
}).get();
// fields for creating a contact
var prefix = cj("#tab2 .prefix").val();
... | [
"function openMessageFrame(contactElement){\n\n\t\t\t//get a reference to the view object\n\t\t\tvar msgView = document.getElementById(\"message_view\");\n\n\t\t\tif(activeContact.trim() !== \"\"){\n\t\t\t\t\n\t\t\t\t//Change the color of the current active contact to black\n\t\t\t\tvar currentActiveContact = docum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that takes a date object and returns a string in the format YYYYMMDD | function returnDateStr (date) {
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (month < 10) {
month = `0${month}`;
}
if (day < 10) {
day = `0${day}`;
}
return `${year}-${month}-${day}`;
} | [
"function dateToString(date) {\n 'use strict'\n //function adds zeros if value < 10\n function addZero(i) {\n if (i < 10) {\n i = \"0\" + i;\n }\n return i;\n }\n\n return addZero(date.getDate()) + \".\" + (addZero(date.getMonth() + 1)) + \".\" + date.getFullYear() + \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_______________________________________________________ resetImportForm this function resets the inputs in the import form in ./index.html Return Value void ___________________________________________________________ | function resetImportForm(){
// Reset previously selected values for next import
resetInputPaths({label: true, runs: true})
resetImportValidation({analType: true, label: true, runs: true});
$("#analType").val('');
$('input:radio[name=dataFormat]')[0].checked = true;
$('input:radio[name=delimiter... | [
"function resetForm() {\n setInputs(initial);\n }",
"function onClickReset() {\r\n cleanInputs();\r\n resetFieldsUi();\r\n}",
"function resetForm() {\n $formLogin.validate().resetForm();\n $formLost.validate().resetForm();\n $formRegister.validate().resetForm();\n }",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cleanTrace is run to remove duplicate TracingStartedInPage events, and to change TracingStartedInBrowser events into TracingStartedInPage. This is done by searching for most occuring threads and basing new events off of those. | function cleanTrace(trace) {
const traceEvents = trace.traceEvents;
// Keep track of most occuring threads
const threads = [];
const countsByThread = {};
const traceStartEvents = [];
const makeMockEvent = (evt, ts) => {
return {
pid: evt.pid,
tid: evt.tid,
ts: ts || 0, // default to 0... | [
"async pruneFrames() {\n let entries;\n try {\n entries = await webext.webNavigation.getAllFrames({\n tabId: this.tabId\n });\n } catch(ex) {\n }\n if ( Array.isArray(entries) === false ) { return; }\n const toKeep = new Set();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate start and stop times in the format of Date objects given an event (course or custom) returned as an array [start_time, stop_time] | function getStartStopTimes(event) {
let times = [];
let start_time = new Date(firstMonday);
start_time.setDate(start_time.getDate() + event.start.getDay() - 1); // based on first monday, figure out which day the class starts
let end_time = new Date(start_time);
start_time.setHours(event.start.getH... | [
"getTimesBetween(start, end, day) {\n var times = [];\n // First check if the time is a period\n if (this.data.periods[day].indexOf(start) >= 0) {\n // Check the day given and return the times between those two\n // periods on that given day.\n var periods = Dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns whether a point is contained by all of a list of circles | function containedInCircles(point, circles) {
for (var i = 0; i < circles.length; ++i) {
if (distance(point, circles[i]) > circles[i].radius + SMALL) {
return false;
}
}
return true;
} | [
"function insideCircles(node){\n\tvar strCircles = node.region.label;\n\tvar result = [];\n\t//console.log(circles);\n\n\tfor (var i = 0; i < circles.length; i++){\n\t\tvar circle = circles[i];\n\t\tvar distance = Math.sqrt( Math.pow(node.x - circle.x, 2) + Math.pow(node.y - circle.y, 2) );\n\t\t//does this node's ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Go back to tab/folder B and make sure we change correctly. | function test_switch_to_tab_folder_b() {
switch_tab(tabFolderB);
assert_messages_in_view(setB);
assert_nothing_selected();
assert_thread_tree_focused();
// Let's focus the message pane now
focus_message_pane();
} | [
"function test_switch_to_tab_folder_a() {\n switch_tab(tabFolderA);\n assert_messages_in_view(setA);\n assert_nothing_selected();\n assert_folder_tree_focused();\n}",
"function test_tabs_are_still_happy() {\n switch_tab(tabFolderB);\n assert_messages_in_view(setB);\n assert_selected_and_displayed(messageB)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the auto scrolling for touch devices. | function removeTouchHandler(){if(isTouchDevice||isTouch){// normalScrollElements requires it off #2691
if(options.autoScrolling){$body.removeEventListener(events.touchmove,touchMoveHandler,{passive:false});$body.removeEventListener(events.touchmove,preventBouncing,{passive:false});}var touchWrapper=options.touchWrapper... | [
"cancelAutoScrollTimeOut() {\n clearTimeout(this.autoScrollTimeOut);\n }",
"cancelScroll() {\n this._isScrollLocked = false;\n }",
"function preventPenScroll(evt) {\n if (evt.targetTouches[0].force) {\n return killEvent(evt);\n }\n }",
"handleScroll_() {\n this.resetAutoAdva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
region Validation function for upload control | function ValidateUploadFile(sender, args) {
args.IsValid = false;
var fuUploadFileAttachmentControl = jQuery(sender).parents('[id*=UploadFileAttachment]').find('[id*=fuUploadFileAttachment]');
if (fuUploadFileAttachmentControl.val() != 'undefined' && fuUploadFileAttachmentControl.val() != '') {
... | [
"function checkFile(el,allowed) {\n\tvar suffix = $(el).val().split(\".\")[$(el).val().split(\".\").length-1].toUpperCase();\n\tif (!(allowed.indexOf(suffix) !== -1)) {\n\t\talert(\"File type not allowed,\\nAllowed files: *.\"+allowed.join(\",*.\"));\n\t\t$(el).val(\"\");\n\t}\n}",
"function fileTypeValidate(file... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get cols of current width. | getCols() {
let cols = Math.floor(Math.ceil(this.getWidth() / 100) / 2) * 2;
return cols > 0 ? cols : 1;
} | [
"function getNumCols () {\n if (typeof settings.cols === 'function') {\n return settings.cols($win.width());\n }\n else if (typeof settings.cols === 'number') {\n return settings.cols;\n }\n else {\n return base.length;\n }\n }",
"function getColWidth(items) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========= MSELEX_FillSelectTable ================ PR20200821 PR20220119 | function MSELEX_FillSelectTable() {
console.log( "===== MSELEX_FillSelectTable ========= ");
const tblBody_select = el_MSELEX_tblBody_select;
tblBody_select.innerText = null;
let row_count = 0, add_to_list = false;
// --- loop through ete_exam_rows
if(ete_exam_rows && ete_exam... | [
"function MDUO_FillSelectRow(tblName, data_dict, tblBody_select) {\n //console.log( \"===== MDUO_FillSelectRow ========= \");\n //console.log( \" data_dict: \", data_dict);\n\n//--- loop through data_map\n let pk_int = null, lvl_pk = null;\n let col_txt_list = [];\n\n const is_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a new term to the polynomial, return false when failed, for instance, the | NewTerm(coef, exp) {
for (let i = 0; i < this._term.Length(); ++i) {
if (this._term.GetElement(i).Exp === exp) {
return false;
}
}
const pt = new PolynomialTerm();
pt.Coef = coef;
pt.Exp = Math.round(exp); // Ensure the exp is not a... | [
"function checkAddOper(field, j, k, sum, stop) {\n solveTries++;\n var next = field.slice(0);\n var jx = cellPos[j][0];\n var jy = cellPos[j][1];\n if (!(next[jx + jy * size] & (1 << k)))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to clear the endGame message | function clearEndMsg()
{
endMsg.textContent = "";
endMsg.style.visibility = "hidden";
} | [
"function end() {\n\t// set GAMEOVER to true\n\tGAME_OVER = true;\n\t// call clear methods\n\tUFO.clear();\n\tBULLET.clear();\n\tBOOM.clear();\n\t// fill the score\n\tscore.textContent = GAME_SCORE;\n\t// show score board\n\tgame.classList.remove('active');\n}",
"endGame() {\n // All timers must be cleared to ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds the project with gradle. Returns a promise. | async build (opts) {
const wrapper = path.join(this.root, 'gradlew');
const args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts);
events.emit('verbose', `Running Gradle Build: ${wrapper} ${args.join(' ')}`);
try {
return await execa(wrapper, args, { s... | [
"async function build() {\n try {\n const configurations = [\n createFileConfiguration(\n `${COMPONENTS}/index.js`,\n 'umd',\n 'dist/ninja-ui.umd.js',\n pkg.name,\n ),\n // Build CJS\n createFileConfiguration(\n `${COMPONENTS}/index.js... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the tests are still running on Sauce Labs. | function checkSauce() {
const opts = {
url: `https://${ SAUCE_LABS_USERNAME }:${ SAUCE_LABS_ACCESS_KEY }@saucelabs.com/rest/v1/cct-sauce/js-tests/status`,
method: 'POST',
json: {
'js tests': sauceTests
}
};
setTimeout( function() {
request.post( opts, function( err, httpResponse, body ) ... | [
"function check() {\n clearTimeout(timer)\n\n if (device.present) {\n // We might get multiple status updates in rapid succession,\n // so let's wait for a while\n switch (device.type) {\n case 'device':\n case 'emulator':\n willStop = false\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the current lang from the document's HTML element, which the server set when the page was first rendered. This saves us having to pass extra locale info around on the URL. | function getCurrentLang() {
var html = document.querySelector( "html" );
return html && html.lang ? html.lang : "en-US";
} | [
"function currentLang() {\n if(window.location.pathname.slice(0, 4) == '/fr/') {\n return 'fr';\n } else {\n return 'en';\n }\n}",
"function CLC_Content_FindLanguage(targObj){\r\n var lang = CLC_GetClosestAttributeOf(targObj, \"lang\");\r\n if (!lang){\r\n lang = CLC_GetClosestAttr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checking if the image sources are loaded from the same webpage simlar to the above method If the percent of externally loaded images is less than 20 then legit, between 20 and 50 suspecious, greather than 50 then phishing. | function request_url() {
// storing all of the image sources in an array.
var img = document.getElementsByTagName("img");
var img_src = new Array(img.length);
for (i = 0; i < img.length; i++) {
img_src[i] = img[i].src;
}
// Counting the number of times an im... | [
"function urlExists(url) {\n\t\tvar http = new XMLHttpRequest();\n\t\thttp.open('HEAD', url);\n\t\thttp.send();\n\t\tif (http.status !== 404) {\n\t\t\timgsNumber++;\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"function getUrlsOfPageImages() { \n var list = document.body.getElementsB... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
EVERY GAME resultsToDb ++++++++++++++++++++++++++++ EVERY GAME dailyScheduleToDb | function dailyScheduleToDb(gameName, body) {
body.sport_events.forEach(function (match) {
if (new Date(match.scheduled).getTime() <= new Date().getTime() || match.status != "not_started") {
return; //dont add matches already played/inprogress
}
var matches = admin.database().ref('matches');
ma... | [
"function resultsToDb(gameName, body) {\n console.log(gameName + ' Results to DB');\n\n var matches = admin.database().ref('matches');\n matches.once('value', function (matchesSnapShot) {\n matchesSnapShot.forEach(function (matchSnapShot) {\n //get the key\n var dbMatchId = matchSnapShot.key.split('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
added_items_count is the way in which the do_list can be considered to be a hierarchy such that an instruction that adds more instuctions under it, those new insturctions will be considered subinstrustions. This is important for presenting the do_list as a hierarchy (as the Inspect does, but also necessary to remove pr... | function total_sub_instruction_count_aux(id_of_top_ins, aic_array){
let result = 0 //this.added_items_count[id_of_top_ins]
let tally = 1 //this.added_items_count[id_of_top_ins]
for(let i = id_of_top_ins; true ; i++){
let aic_for_i = aic_array[i] //this.added_items_count[i]
if (aic_for_i ===... | [
"function updateCounter() {\n var toDoListItems = document.querySelectorAll('.todo-items');\n\n listCounter.innerHTML = toDoListItems.length - completedTasks;\n}",
"function updateNitems(add=true){\n\tif(add){\n\t\tnItems++;\n\t}else{\n\t\tnItems--;\n\t}\n\tdocument.getElementById( \"counter\" ).innerHTML =nIte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Args to send a proposal to remove (and liquidate) a strategy. | async function proposeRemoveStrategyArgs(config) {
const vaultProxy = await ethers.getContract("VaultProxy");
const vaultAdmin = await ethers.getContractAt(
"VaultAdmin",
vaultProxy.address
);
// Harvest the strategy first, then remove it.
// Note: in the future we'll modify the vault's removeStrateg... | [
"deletereplicaprop(params) {\n this.options.qs = Object.assign({\n action: 'DELETEREPLICAPROP',\n }, params);\n\n return this.request(this.options);\n }",
"function removePartyFromBallot(e){\n\tlet party = e.target.parentNode.parentNode;\n\tlet cansId = party.getAttribute('href'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
BASE UI FUNCTIONALITY Functions which handle vital UI functionality such as main navigation and layout They are auto initialized Handles sidebar and side overlay custom scrolling functionality | static uiHandleScroll (mode) {
// windowW = getWidth()
//
// // Init scrolling
// if (mode === 'init') {
// var sScrollTimeout
// // Unbind events in case they are already binded
// jQuery(window).off('resize.cb.scroll orientationchange.cb.scroll');
//
// // Bind the eve... | [
"function initSidebarUIEvents() {\n // Click on any items in the actions menu\n sidebar.$el.find('.aui-sidebar-group-actions ul').on('click', '> li > a[data-web-item-key]', function () {\n events.trigger('bitbucket.internal.ui.sidebar.actions-menu.item.clicked', null, {\n isC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======================== pet Object =========================== / ===================== pet Serializer Object ======================= Note: I could have simply built up a DOM tree for the pet elements, and then serialized this, rather than using this object+methods. However I wasn't confident in getting DOM accesses to... | function petSerializer(p, merging)
{
//properties
this.pet = p;
this.top = '<?xml version=\'1.0\'?>\n<?xml-stylesheet type=\"text/xsl\" href=\"pet.xsl\"?>\n<rdf:RDF\n ' +
'xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n ' +
'xmlns:rdfs=\"http://www.w3.org/2000... | [
"function Pet(petName,age,adopted,markings,breed){\n this.petName = petName;\n this.age = age;\n this.adopted = adopted;\n this.markings = markings;\n this.breed = breed;\n}",
"function createPet() {\n\n\t\n\tvar petDetails = [];\n\tvar petCollection;\n\n\t//collect any data already held in localStorage \n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a list of the words in the mnemonic that are not in the list of valid BIP39 words for the specified or detected language. | function invalidMnemonicWords(mnemonic, language) {
var words = splitMnemonic(mnemonic);
var detectedLanguage = language !== null && language !== void 0 ? language : detectMnemonicLanguage(words);
if (detectedLanguage === undefined) {
return undefined;
}
var wordSet = new Set(getWordList(det... | [
"function acceptedWords(arr) {\n\treturn arr.filter(x => !x.startsWith(\"C\"))\n}",
"misspelled (line) {\n \tvar words = line.split(' ');\n \tvar i = 0;\n \tvar bads = [];\n var word;\n \tfor (word in words) {\n \t var x = words[word] + \"\";\n \t var checkWord = x.replace(/[^a-zA-Z']/g, '');\n \t if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tools This processes a JS string into a Cline array of numbers, 0terminated. For LLVMoriginating strings, see parser.js:parseLLVMString function | function intArrayFromString(stringy, dontAddNull, length /* optional */) {
var ret = (new Runtime.UTF8Processor()).processJSString(stringy);
if (length) {
ret.length = length;
}
if (!dontAddNull) {
ret.push(0);
}
return ret;
} | [
"function cpp2js(str) {\n const nullIndex = str.indexOf(\"\\0\");\n if (nullIndex === -1)\n return str;\n return str.substr(0, nullIndex);\n}",
"function getCodePoints(string) {\n var newArray = [];\n for (i = 0; i < string.length; i++) {\n newArray.push(string.codePointAt(i));\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an ambient color as an array of color values r, g, b, compute and return ambient component as an array in the range between 0 and 1 | function computeAmbient(ambientColor, ambientLightIntensity) {
let ambient = [];
for (let c = 0; c < 3; c++) {
ambient[c] = (ambientColor[c] / 255) * (ambientLightIntensity[c] / 255);
}
return ambient;
} | [
"function computeDiffuse(color, normal, lightDirection) {\n let diffuse = [];\n for (let c = 0; c < 3; c++) {\n diffuse[c] = (color[c] / 255) * (light.color[c] / 255) *\n Math.max(0, vec3.dot(normal, lightDirection));\n }\n return diffuse;\n}",
"function computeSpecular(specularColor, specularLightI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate dates for week ahead; | calcWeekAhead(){
const userDate = $('#week-date').val();
this.week = [];
for(let i = 0; i < 5; i++){
const result = new Date(userDate);
let day = '',
month = '',
year = '',
newDate = '';
result.setDate(result.getDate() + i);
day = result.getDate();
if(day.toString().length... | [
"function handleWeekEvents(parameter){\n\n if(parameter.date == ''){\n let today = new Date();\n let next = new Date();\n\n next.setDate(next.getDate() + 7);\n\n let dd = today.getDate();\n let mm = today.getMonth()+1;\n let yyyy = today.getFullYear();\n\n let next_dd= next.getDate();\n let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Light color with opacity | lightColorWithOpacity(r, g, b, a, light) {
r *= light;
g *= light;
b *= light;
if (r > 255) r = 255;
if (g > 255) g = 255;
if (b > 255) b = 255;
return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
} | [
"static Yellow() {\n return new Color3(1, 1, 0);\n }",
"static Yellow() {\n return new Color4(1, 1, 0, 1);\n }",
"function randLightColor() {\r\n\tvar rC = Math.floor(Math.random() * 256);\r\n\tvar gC = Math.floor(Math.random() * 256);\r\n\tvar bC = Math.floor(Math.random() * 256);\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
writes the table based on the sorted array. There are a maximum of 10 being displayed. | function writeTable(array) {
var count = 0;
// cache <tbody> element:
var tbody = $('#tableBody');
tbody.empty();
//creates the first row with the headers
var tr = $('<tr/>').appendTo(tbody);
tr.append('<th> Place </th>');
tr.append('<th> Name </th>');
tr.append('<th> Score </th>');
... | [
"function sortByRankHandler(){\n // table.classList.remove('data');\n\n // take isolated copy keep the refernce safe\n let sortedByRank = myData.slice();\n sortedByRank.sort(function(a , b){\n return a.rank - b.rank;\n \n \n });\n display.innerHTML = ``;\n\n\n for (let index = 0;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Translation of demographic neighborhood name to our neighborhood id | function translateNeighborhood(name) {
var id = name;
var translations = {
'cedar_riverside_west_bank': 'cedar_riverside',
'prospect_park_east_river_road': 'prospect_park_east_river',
'u_of_mn': 'university_of_minnesota',
'jordon': 'jordan',
'stevens_square_loring_hgts_': 'stevens_square_loring_... | [
"function neighborhoodFromLayer(layer) {\n return layer.feature.properties.NTAName;\n }",
"mapNetworkString(networkId) {\n switch (networkId) {\n case 1: return \"Mainnet\";\n case 2: return \"Morden\";\n case 3: return \"Ropsten\";\n case 4: return \"Rinkeby\";\n cas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle a change in the grouping field | function onGroupsChange(newVal, oldVal) {
if (newVal !== oldVal) {
ctrl.isGroupedBy = true;
ctrl.grouping = ctrl.sitGridOptions.groups && ctrl.sitGridOptions.groups.length > 0;
//un-subscribing grid rows change
eventListners... | [
"groupStyleChanged() {\n this.disableGroupAdjustmentWhenChildrenChange();\n this.adjustChildrenVertically();\n this.adjustChildrenHorizontally();\n this.enableGroupAdjustmentWhenChildrenChange();\n }",
"function updateGroup(oContext) {\n\t\t\t\tvar oNewGroup = oBinding.getGroup(oCon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if `route` is a path match for the `rawSegment`, `segments`, and `outlet` without verifying that its children are a full match for the remainder of the `rawSegment` children as well. | function isImmediateMatch(route, rawSegment, segments, outlet) {
// We allow matches to empty paths when the outlets differ so we can match a url like `/(b:b)` to
// a config like
// * `{path: '', children: [{path: 'b', outlet: 'b'}]}`
// or even
// * `{path: '', outlet: 'a', children: [{path: 'b', ... | [
"function isOnPatrolRoute(robot) {\n for (let i = 0; i < ROUTE_PATROL.length; ++i) {\n if (robot.r === ROUTE_PATROL[i].r && robot.c === ROUTE_PATROL[i].c) {\n return true;\n }\n }\n return false;\n}",
"matches(from, to) {\n let matchesFrom = false;\n if (this.from === \"*\") {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================== Validate =================================================== test the reqular expression , v is value, re is regualar expression | function TestRE(v, re)
{
return new RegExp(re).test(v);
} | [
"function validateInput(input, RegExp) {\n if (input.val().match(RegExp)) return true;\n else return false;\n}",
"function validateFieldValue(regex,valueToValidate,errorField,failedText) {\n if (timesSubmited) {\n if (valueToValidate != \"\") {\n if (!regex.test(valueToValidate)) {\n return fade... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Query the historical info for given height. | queryHistoricalInfo(query) {
const { height } = query;
if (is.undefined(height)) {
throw new errors_1.SdkError('block height can not be empty');
}
const request = new types.staking_query_pb.QueryHistoricalInfoRequest()
.setHeight(height);
return this.clien... | [
"getHistoricalAccountData(address, startHeight, endHeight, increment) {\n return rxjs_1.of(\"historical/get?address=\" + address.plain() + \"&startHeight=\" + startHeight + \"&endHeight=\" + endHeight + \"&increment=\" + increment)\n .pipe(operators_1.flatMap((url) => requestPromise.get(this.nextH... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Provides async utilities for an array. | function asyncArray(inputs) {
return new AsyncArrayOps(inputs);
} | [
"function doToArray(array, callback){\n array.forEach(callback)\n}",
"function tap(arr, callback){\n callback(arr); \n return arr;\n}",
"function procesar (unArray, callback) {\n return callback (unArray)\n}",
"arrayInjector(somethings) {\n return Promise.all(somethings.map(something => this.inject(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Refreshes the Object Selects for Events and Global Events | refreshObjectSelect() {
let select_obj_buffer = this.prepareSelectObjects();
$('.select_event_primary').empty().append(select_obj_buffer);
$('#event_primary').empty().append(select_obj_buffer);
$('#glevent_primary').empty().append(select_obj_buffer);
//globalevent
$('.se... | [
"function resetAllEvents(){\n\t\t\tevents.forEach( ev => { \n\t\t\t\tev.button.gotoAndStop(0);\n\t\t\t\tev.button.cursor = \"pointer\";\n\t\t\t\tev.choosen = false; \n\t\t\t});\n\t\t\t// update instructions\n\t\t\tself.instructions.gotoAndStop(0);\n\t\t\t// update side box\n\t\t\tself.sideBox.gotoAndStop(0);\n\t\t}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom type guard for Trait. Returns true if node is instance of Trait. Returns false otherwise. Also returns false for super interfaces of Trait. | function isTrait(node) {
return node.kind() == "Trait" && node.RAMLVersion() == "RAML08";
} | [
"hasInheritance(node) {\n let inherits = false;\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n if (match_1.default(child, 'extends', 'implements')) {\n inherits = true;\n }\n }\n return inherits;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a is input field id name b is invalid input message class name c is boolean value for required Function validates only date using d/m/yy or dd/mm/yyyy format | function validateDate(a, b, c) {
// Value in the field
var date = $(a).val();
// Regular Expression to validate value against
var regularExpression = /^(3[01]|[12][0-9]|0?[1-9])-(1[0-2]|0?[1-9])-(?:[0-9]{2})?[0-9]{2}$/;
if (c) {
// Validating field content
if (!regularExpression.te... | [
"function account_patient_validate () {\n acc_patienterrorFound = false;\n if($j('[id$=LensAccountId]').val() == '' || $j('[id$=LensAccount]').val() == ''){\n acc_patienterrorFound = true;\n var ele = $j('[id$=LensAccountId]'); \n removeErrorClass(ele);\n ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decodes the root to its associated address. | function decodeAddress(root, mode) {
return mode === "public"
? root
: converter.trytes(maskHash(converter.trits(root)));
} | [
"function decode_addr(v) {\n if (!(v.length === 0 || v.length === 20)) {\n throw new Error(\"Serialized addresses must be empty or 20 bytes long!\");\n }\n return encodeHex(v);\n }",
"function encode_root(v) {\n return v;\n }",
"function decode(iotaAreaCode) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the chart for height | function genHeightChart(smart) {
var patient = smart.patient;
var pt = patient.read();
var obv = smart.patient.api.fetchAll({
// Note - I don't know how to sort results by time or anything. Someone
// should figure that out
type: 'Observation',
query: {
code: {
$or: [
... | [
"function createChart(element_selector, params)\n{\n title_position = 0;\n // Анализируем входные параметры\n //--------------------------------------------------------------------------\n // 1. Формируем параметры запросов\n requestParams.instrument_id = params.histo.instrument_id;\n requestParam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
no syncopations (hierarchically speaking) will need to generate a random, nonsyncopated mixture of motion and repose rhythms should relate to each other (motivic??) over the first 3 bars large leaps in melody should coincide with rhythmic repose good rhythm: distinctive (variation from even and smooth), relationship be... | function makeRandomRhythm(lengthLessOne, numBarsLessOne, beatsPer, shortestDuration){
//shortestDuration === 1/2 for 8th note, 1 for quarter notes, etc. ?
//first, number of rhythmic 'slots' that we can put notes into
var numSlots = beatsPer * numBarsLessOne / shortestDuration;
//console.log(numSlots);... | [
"function getRandomRhymeWord(rhymingWord, maxSyllables) {\n var rhymeList = getRhymeData(rhymingWord);\n if (rhymeList == []) {\n return \"no rhymes\";\n }\n var isGoodRhyme = false;\n var maxIndex = 99;\n if (!(rhymingWord == 'blue')){\n console.log(\"Here\");\n maxIndex = rhymeList.length - 1;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Declare function to ensure user guess is between 1100, if not alert them | function guessValidation () {
if (+($("#userGuess").val()) > 100 || +($("#userGuess").val()) < 1) {
alert("Please enter a number between 1 - 100");
}
} | [
"function alert(guess) {\n\n if (guess < 0 || guess > 9) {\n\n console.log(`ERROR: ${guess} is out of range 0 - 9.`);\n }\n\n}",
"function validGuess(){\n//for guess to be valid, must be in 1-100 range\n//guesses must be remaining, is not be a repeat value, and game is not over\n\n\tif(gameData.playe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ends the document and passes it to the given XML writer `writer` is either an XML writer or a plain object to pass to the constructor of the default XML writer. The default writer is assigned when creating the XML document. Following flags are recognized by the builtin XMLStringWriter: `writer.pretty` pretty prints the... | end(writer) {
var writerOptions;
writerOptions = {};
if (!writer) {
writer = this.options.writer;
} else if (isPlainObject(writer)) {
writerOptions = writer;
writer = this.options.writer;
}
return writer.document(this, writer.filterOptions(wr... | [
"static getLastCharactersToPos(writer, pos) {\r\n const writerLength = writer.getLength();\r\n const charCount = writerLength - pos;\r\n const chars = new Array(charCount);\r\n writer.iterateLastChars((char, i) => {\r\n const insertPos = i - pos;\r\n if (insertPos <... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Minh's Black Magic Getting the RIFCS fragment for the given tab | function getRIFCSforTab(tab, hasField){
var currentTab = $(tab);
var boxes = $('.aro_box', currentTab);
var xml = '';
var lastFragment = '';
$.each(boxes, function(){
var fragment ='';
var fragment_type = '';
/*
* Getting the fragment header
* In the form of <name> or <name type="sometype">
* The n... | [
"function getRomFrame(addr){\n\n}",
"function getCFINodeString(isHrmode) {\n var currentrange;\n currentrange = document.caretRangeFromPoint(0, 0);\n var cfi = \"\";\n // if(currentrange != null) {\n if (currentrange.startContainer.nodeType == 3 && currentrange.startOffset != 0) {\n\n cfi = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a ContentType by content type id | getById(id) {
return ContentType(this).concat(`('${id}')`);
} | [
"function getContentTypeById(formated_id) {\n\tif (formated_id.match(IMAGE) != null) {\n\t\treturn IMAGE;\n\t} else if (formated_id.match(VIDEO) != null) {\n\t\treturn VIDEO;\n\t} else if (formated_id.match(IMAGE_TEXT) != null) {I\n\t\treturn IMAGE_TEXT;\n\t} else if (formated_id.match(TEXT) != null) {\n\t\treturn ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns unique values and their counts in a Series | value_counts() {
const sData = this.values;
const dataDict = {};
for (let i = 0; i < sData.length; i++) {
const val = sData[i];
if (`${val}` in dataDict) {
dataDict[`${val}`] = dataDict[`${val}`] + 1;
} else {
dataDict[`${val}`] = 1;
}
}
const index = Object.... | [
"unique() {\n const newValues = new Set(this.values);\n let series = new Series(Array.from(newValues));\n return series;\n }",
"get uniqueValues() {\n var _a;\n const replaceWithNull = this.traits.replaceWithNullValues;\n const values = this.values.map(value => {\n if (va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
event listener for "close" on the tree | _onClose(ev) {
ev.getData().set(this._tree.getOpenProperty(), false);
} | [
"_closeModel() {\n this._model.querySelector('.close').addEventListener('click', e => {\n this._hideModel();\n });\n }",
"close() {\n this.removeAttribute('expanded');\n this.firstElementChild.setAttribute('aria-expanded', false);\n // Remove the event listener\n this.dispatchCusto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Upon submitting name animate fade away and disable text area requestHostName set to false in store Set player to host Update name in backend | onSubmitName(e, input) {
e.preventDefault()
input.disabled = true
let self = this
this.props.changeNameHolderClass('name__holder name__holder__deactive')
if (this.props.player.name === ''){
this.props.changePlayerName('ANONYMOUS');
}
axios.put('https://mapboxwhereisit.herokuapp.com/g... | [
"function validatePlayerName() {\n const name = getGameForm()['player-name'].value;\n if (!name.trim()) {\n getById('play-button').style.visibility = 'hidden';\n } else {\n playerName = name;\n getById('play-button').style.visibility = 'visible';\n }\n}",
"function changeDisplayNa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function creates a canvas and a container cwidth: desired canvas width cheight: desired cavnas height | function dce_setup_canvas(cwidth, cheight) {
ctx = null;
canvas = null;
canvas_container = null;
// setup canvas
canvas = document.createElement('canvas');
canvas.id = "gfxctx";
canvas.width = cwidth;
canvas.height = cheight;
// setup container
canvas_container = document.createElement('div');
canvas_co... | [
"function mCreateCanvas() {\n createCanvas(...[...arguments]);\n pixelDensity(1);\n mPage = createGraphics(width, height, WEBGL);\n\tmPage.pixelDensity(1);\n}",
"canvas_conf(w, h, t, r, b, l) {\r\n return {\r\n width: w - l - r,\r\n height: h - t - b,\r\n top: t,\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reset table variables after making contacts table restores all main db variable values so that save does not mess up main db after having been in newTable mode called from homescrnBtn.onclick and saveBtn and newDBBtn.onclick if makeContactsTable OR loadFromTableOptions..?good enough? | function resetFromContacts () {
//savedOriginal = false;//flag that prevents repeatedContactsTables from overwriting original. Set back to false here (to allow for changing databases, but not returned to false in CONTACTSbtn in display table which allows for repeated contacts tables but not overwriting original table)... | [
"function saveOriginal () {\n\tconsole.log(\"In saveOriginal function\");\n\tsavedOriginal = true;\nsaveTableTitle= tableTitle.slice();\nsaveTableArray = tableArray.slice();\nsaveOriginaltableTitleLength = tableTitle.length;\nsaveCopyOfTableArray = copyOfTableArray.slice();\nsaveCopyOfTableTitle= copyOfTableTitle.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deprecated. Instead, use: forge.cipher.createCipher('AES', key); forge.cipher.createDecipher('AES', key); Creates a deprecated AES cipher object. This object's mode will default to CBC (cipherblockchaining). The key and iv may be given as a string of bytes, an array of bytes, a byte buffer, or an array of 32bit words. | function _createCipher(options) {
options = options || {};
var mode = (options.mode || 'CBC').toUpperCase();
var algorithm = 'AES-' + mode;
var cipher;
if(options.decrypt) {
cipher = forge.cipher.createDecipher(algorithm, options.key);
} else {
cipher = forge.cipher.createCipher(algorithm, options.... | [
"decryptBuffer(buffer, key, iv, algorithm = 'aes-128-ctr') {\n let decipher = crypto.createDecipheriv(algorithm, key, iv);\n decipher.setAutoPadding(false);\n return Buffer.concat([decipher.update(buffer), decipher.final()]);\n }",
"function encrypt_aes_cbc(input, key, iv) {\n var input_u32 = new Uin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resize the track and slide elements. | function resize() {
var options = Splide.options;
Layout.resize();
applyStyle(Elements.track, {
height: unit(Layout.height)
});
var slideHeight = options.autoHeight ? null : unit(Layout.slideHeight());
Elements.each(function (Slide) {
applyStyle(Slide.container, {
height: sli... | [
"function resizedw(){\n loadSlider(slider);\n }",
"function resize () {\n width = slider.offsetWidth\n\n totalTravel = getTotalTravel()\n\n if (totalTravel <= 0 && active) {\n destroy()\n } else if (totalTravel > 0 && !active) {\n init()\n }\n\n if (active && !suspend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 737 Given an array of words, return the longest word which can fit on a 7 segment display. Image of a 7 segment display Letters which do not fit on a 7 segment display are K, M, V, W and X. Therefore, do not count words which include these letters. | function longest7SegmentWord(arr) {
return arr.filter(x => !(/[kmvwx]/.test(x))).sort((a, b) => b.length - a.length)[0] || '';
} | [
"function findLongestWord(txt) {\n let strArrayA = txtNoPunctuation(txt);\n let strArrayB = cleanTxt(strArrayA);\n \n let orderedArray = strArrayB.sort(function (wordA, wordB){\n return wordB.length - wordA.length || wordA.localeCompare(wordB);\n });\n \n let filterArray = orderedArra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Declare a function called totalLaureates that takes a category input string and returns the total number of laureates for the given category in Nobel history. | function totalLaureates(category) {
let result = [];
for (let i = 0; i < nobels.prizes.length; i++)
if (nobels.prizes[i].category == category) {
result = result.concat(nobels.prizes[i].laureates);
}
return result.length;
} | [
"function getCategoryTotalPoints(category){\n let htmlPath = \" > td.possible.points_possible\"; //HTML path to get to the total points within the table data (td)\n return sumTablePortion(htmlPath, category);\n}",
"function countNbNotesPerCategory() {\n\tvar nbNotesPerCategory = new Array();\n\n\t// Fills n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display the grid paper using a series of white rectangles | function displayGridPaper()
{
for(var row = 0; row < noRows; row++)
{
for(var col = 0; col < noCols; col++)
{
var x = col * squareSize;
var y = row * squareSize;
cv.rect(x, y, squareSize, squareSize);
}
}
} | [
"drawHTMLBoard() {\r\n\t\tfor (let column of this.spaces) {\r\n\t\t\tfor (let space of column) {\r\n\t\t\t\tspace.drawSVGSpace();\r\n\t\t\t}\t\r\n\t\t}\r\n\t}",
"function drawGrid() {\n for(let i = 0; i < HEIGHT; i++) {\n // create a new raw\n let raw = $('<div class=\"raw\"></div>');... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
author: Ali El Zoheiry. description: generates a letter and creates a new button and places it in the top row in a random column and then calls the dropAblockCont method. params: success: the block and the letter are generated successfuly and placed in the correct place. failure: the game is over. | function dropAblock(){
if(tutorialFlag == true){
newDrop = true;
return;
}
if( gameOver == true ){
return;
}
while(true){
letter = generateLetter();
if(letter != -1){
break;
}
}
var randNum = Math.floor(Math.random()*dimension);
var clss = 'col0-' + randNum;
var newButton = "<button id='btn" ... | [
"function dropAblockCont(clss, btn, randNum, counter){\n\tif(gameOver==true){\n\t\treturn;\n\t}\n\tvar stop;\n\tvar newCounter = counter + 1;\n\tvar newClss = 'col' + newCounter + '-' + randNum;\n\n\tpullingBlocks = setTimeout(function(){\n\t\tif(newCounter == dimension){\n\t\t\tif(tutorialFlag == false){\n\t\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempts to find an artifact with a specific identity. | tryGetArtifact(id) {
return this.artifacts.find(a => a.id === id);
} | [
"getNestedAssemblyArtifact(artifactId) {\n const artifact = this.tryGetArtifact(artifactId);\n if (!artifact) {\n throw new Error(`Unable to find artifact with id \"${artifactId}\"`);\n }\n if (!(artifact instanceof nested_cloud_assembly_artifact_1.NestedCloudAssemblyArtifact)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the active media for a uid | set({ state, getters, dispatch, commit }, { id, corpuUid, uid }) {
// Before, stop the media if playing
if (state.properties[uid] && state.properties[uid].isPlaying) {
dispatch('pause', { uid })
}
// Set the active media for this uid
// If the media id is not defined, get one
commit('set'... | [
"play(state, { uid }) {\n Vue.set(state.properties[uid], 'isPlaying', true)\n }",
"set media(aValue) {\n this._logService.debug(\"gsDiggEvent.media[set]\");\n this._media = aValue;\n }",
"unsetAll({ state, dispatch }, { id }) {\n // loop over the mediaUids\n Object.keys(state.actives).forEach(u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to find what is the best type of bgp peering between 2 vrfs | findBGPPeerData(vrf1_id, vrf2_id) {
let result_data = null;
let vrf1 = this.findMesh("vrf", vrf1_id, this.scene.L3);
let vrf2 = this.findMesh("vrf", vrf2_id, this.scene.L3);
if((vrf1 === null) || (vrf2 === null))
return null;
// Check if these two vrfs have the same... | [
"findBGPPeerData_createStruct(vrf1_id, vrf2_id, src_if, dst_if) {\n let result_data = {\n src_vrf_id: vrf1_id,\n dst_vrf_id: vrf2_id,\n curve_x: 0,\n curve_y: 4,\n color: 0xff0000,\n };\n\n let addressing = [];\n // First of all, if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if a subscription option is checked | function CheckSubscriptionOptions() {
if (!document.getElementById("subscribeNewsletter").checked && !document.getElementById("subscribeBreakingNews").checked) {
return false;
} else {
return true;
}
} | [
"function smsSubscription(chkbox){\n\tif(chkbox[\"selectedKeys\"]==null)\n\t\taudienceSmsSubs=false;\n\telse\n\t\taudienceSmsSubs=true;\n}",
"function pushSubscription(chkbox){\n\tif(chkbox[\"selectedKeys\"]==null)\n\t\taudiencePushSubs=false;\n\telse\n\t\taudiencePushSubs=true;\n}",
"function emailSubscription... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |