query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
gparamList is a list which contains g_parameter of all succesfull transactions total_param is the number of parameters i.e Age, Location etc. g_param is the parameter number of the parameter whose trend is required. nHist is the number of past transactions to get trend. | function getTrend(totalParam, nHist, gparam, gparamList)
{
let parameterList = new Array(totalParam);
parameterList.fill(0);
gparamList.slice(-nHist).forEach((element) => {
parameterList[element]++;
})
return parameterList[gparam]/nHist;
} | [
"listOfAncestorsForFanChart(numGens = 5, primePersonNum = 0) {\n let theList = [];\n let maxNum = this.list.length;\n let maxNumInGen = 2 ** numGens;\n let theMax = Math.min(maxNum, maxNumInGen);\n\n for (var i = 0; i < theMax; i++) {\n if (this.list[i] && this.list[i] ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the outputrelative path where the typing file is being written to. | function getTypingOutputRelativePath(file) {
// Type definitions are intended to be copied into the package output while preserving the
// sub-path from the owning package. e.g. a file like `packages/animations/browser/__index.d.ts`
// will end up being written to `<pkg-out>/browser/... | [
"function getOwningPackageRelativePath(file) {\n return path.relative(owningPackageName, file.shortPath);\n }",
"function getEsm2020OutputRelativePath(file) {\n // Path computed relative to the current package in bazel-bin. e.g. a ES2020 output file\n // in `bazel-out/<..>/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns details of a single Establishment, selected by Id. | function getEstablishment(id) {
return instance.get(`/Establishments/${id}`)
.then(function (response) {
return (response);
})
.catch(function (error) {
return (error);
});
} | [
"async show ({ params }) {\n const establishment = await Establishment.findOrFail(params.id)\n\n await establishment.load('images')\n await establishment.load('evaluations')\n\n return establishment\n }",
"async function getAppointmentDetails(id) {\n dispatch({ type: LOADING_STARTED });\n const... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function called when user wants to add extra funds to available cash, modal displays correct information | function addFundsModal(btn){
var selectedAmount = $(btn).attr('data-id');
$('#add-funds-modal').modal('close');
$('#confirm-add-funds-modal').modal('open');
$('.add-funds-amount').html("US$ " + selectedAmount);
var available_cash = $('#cash-available-invisible').html().replace(/,/g, "");
var new... | [
"function openCashSummaryForEditAmount() {\n\t/* Show History Funds without select a type Option */\n\t$(\"#historyFundingSources\").show();\n\tremoveChitErrorBorder();\n\t$(\"#editCashSummaryTotal\").hide();\n\t$(\"#cashPaymnetInfoMessage\").hide();\n\taddOrRemoveBorderBottom();\n}",
"function editSelectedFundRo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a collection a values determined by a given dimension from recordValuesWithColNames | function createCollection (dimension){
var arr = new Array();
for (var index = 0; index < diseaseClasses.length; index++) {
arr=[...arr, ...selectRows(recordValuesWithColNames[index], dimension)];
}//end for loop
return arr;
} //end createCollection() | [
"geDimensionElements() {\n const elements = {}\n\n _.each(Dimensions, (name) => {\n if (this.elements.hasOwnProperty(name)) {\n elements[name] = this.elements[name]\n }\n })\n\n return elements\n }",
"static findByValues(fieldName, values) {\n\t\t\tconst self = this;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an element's scroll height without padding, border, or margin | function innerScrollHeight(element) {
const style = window.getComputedStyle(element);
return (
element.scrollHeight -
style.getPropertyValue("border-top-width").replace("px", "") -
style.getPropertyValue("border-bottom-width").replace("px", "") -
style.getPropertyValue("padding-top").replace("px", "... | [
"function getElementHeight (element) {\n var clone = element.cloneNode(true)\n clone.style.cssText = 'visibility: hidden; display: block; margin: -999px 0'\n\n var height = (element.parentNode.appendChild(clone)).clientHeight\n element.parentNode.removeChild(clone)\n\n return height\n }",
"get hei... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Drop/Delete all the documents inside the collection | async function dropAllDocuments(client, dataBaseName, collectionName) {
// Delete collection including all its documents
let result = await client.db(dataBaseName).collection(collectionName).drop();
// console.log("drop =>" + result);
// Re-create a collection again
// result = await client.db(dataBaseName).... | [
"async clearDatabase() {\n const { collections } = mongoose.connection;\n\n for (const key in collections) {\n const collection = collections[key];\n collection.deleteMany();\n }\n }",
"async delete() {\n await this.pouchdb.destroy();\n await this.database.removeCollectionDoc(thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : linkSanInit AUTHOR : Clarice Salanda DATE : March 15, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : initializes data in table PARAMETERS : RETURN : | function linkSanInit(){
var linkStat='';
var linkSanityStat='';
if(globalInfoType == "JSON"){
var devices = getDevicesNodeJSON();
}else{
var devices =devicesArr;
}
for(var i = 0; i < devices.length; i++){
linkStat+="<tr>";
linkStat+="<td>"+devices[i].HostName+"</td>";
linkStat+="<td>"... | [
"function connSanInit(){\n\tvar connStat='';\n\tvar connSanityStat='';\n\tif(globalInfoType == \"JSON\"){\n var devices = getDevicesNodeJSON();\n }else{\n var devices =devicesArr;\n }\n\tfor(var i = 0; i < devices.length; i++){\n\t\tconnStat+=\"<tr>\";\n\t\tconnStat+=\"<td>\"+devices[i].HostNam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render links to all children and partners. | function renderChildAndPartnerLinks() {
for (const [, persons] of generations)
for (const person of persons) {
const personBox = jQuery("#box-" + person.id);
if (person.children)
for (const child of person.children)
drawPath(personBox, jQuery("#box... | [
"function build_child_links(data) {\n // FIXME this code is disgusting, rewrite it\n var nav = $.map(data, function(item, i){\n // data will contain all pages in the site. Child links should contain\n // all children nodes of the current node. That is, all nodes of the\n // form:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Language brain interprets all messages coming into creature | function LanguageBrain( inputDictionary, inputCreature ){
var my =this;
this.type = "languageBrain";
this.hostCreature = inputCreature;
if (inputDictionary) this.messageDict = inputDictionary;
// default message dicitonary is used for converting input messages
// to responses
this.messageDict = {
"hello":... | [
"function getTokens(characters){\n var tokenPointer = 0;\n while (tokenPointer < characters.length){\n if (characters[tokenPointer] == \" \") {\n tokenPointer+=1;\n }\n else if (characters[tokenPointer] == \"-\") {\n tokens.push(\"neg\");\n tokenPointer+=1;\n }\n else if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This checks if an Android project is clean or has old build artifacts | isClean () {
const build_path = path.join(this.projectDir, 'build');
// If the build directory doesn't exist, it's clean
return !(fs.existsSync(build_path));
} | [
"clearProjectBuildArtifacts() {\n const editor = atom.workspace.getActiveTextEditor();\n const editorFilePath = editor.getPath();\n let deleteBuildArtifacts = (directory) => {\n if (!fileExists(directory)) {\n return false;\n }\n const files = fs.readdirSync(directory);\n files.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
meleeAdjust (luckySign, luckModifier) adds bonus/penality to Melee attack based on whether the character possesses specific Lucky Signs | function meleeAdjust (luckySign, luckModifier) {
var adjust = 0;
if (luckySign.luckySign != undefined && luckySign.luckySign === "Harsh winter"){
adjust = luckModifier;
}
else if (luckySign.luckySign != undefined && luckySign.luckySign === "The bull") {
adjust = luckModifier;
}
return adjust;
} | [
"function adjustMeleeDamage (luckySign, luckModifier) {\n var adjust = 0;\n if (luckySign.luckySign != undefined && (luckySign.luckySign === \"Born on the battlefield\" || luckySign.luckySign === \"Path of the bear\")){\n adjust = luckModifier;\n }\n\treturn adjust;\n}",
"function adjustWill (luck... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getFitness calculates number of conflictions fitness = board_sizeboard_size conflictions | function getFitness(sample){
return getNumConflictionsOnBoard(sample)/(sample.length*sample.length);
} | [
"evaluatePopulationFitness() {\n\t\tfor (let i = 0; i < this.chromosomes.length; i++) {\n\t\t\tthis.updateFitness(this.chromosomes[i]);\n\t\t}\n\t}",
"function mostFavorableGrid(){\r\n var bestGrid = 0;\r\n var index = 0;\r\n for(var i = 0; i < fitness.length; i++){\r\n if(fitness[i] > bestGrid){\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a required key on the appropriate level | _add_required_key(key, parent_keys) {
this._required.push([...parent_keys, key].join(':'));
} | [
"_add_one_required(keys, parent_keys) {\n this._one_required[parent_keys.join(':')] = keys;\n }",
"function warningWithoutKey() {\n var treeData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var keys = new Map();\n\n function dig(list) {\n var path = arguments.length ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds props for each Notion Page Property | _buildPropertyProps(properties = {}) {
const props = {};
for (const propertyName in properties) {
const property = properties[propertyName];
const propData = NOTION_PAGE_PROPERTIES[property.type];
if (!propData) continue;
props[propertyName] = {
type: propData.typ... | [
"buildPageProperties(parentProperties) {\n const filteredProperties = this._filterProps(parentProperties);\n return this._buildNotionPageProperties(filteredProperties);\n }",
"buildPageMeta(parentPage) {\n const filteredMeta = this._filterProps(parentPage);\n return this._buildNotionPageMet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Output of Wetting Fast model | function wettingFastOutput(){
var outstring = "Wetting Fast with parameter ζ = " + paramZeta + ", parameter δ = " + paramDelta +
" and parameter β = " + paramBeta + ". In the end, the negative energy is " + wettingFastCalculateEnergy(colorConfiguration) + " .";
// console.log(globalEnergy);
ret... | [
"output(inputArr) {\n\n let inputs = (this.hiddensOutputs.singleColumnMatrix(inputArr)); //turn the vision array into a 1xN Matrix\n let Biased = inputs.Bias(); //Applies a level of bias to the array to encourage acting\n\n let WeightedHiddenInputs = this.hiddensInputs.dot(inputs); //Runs the b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Chat "class" This class does not allow multiple clients internal fields: `server` = socket listener `port` = port where the server listen to `cipher` = transform stream to cipher messages `decipher` = transform stream to decipher incoming messages `endPoint` = point where the clear messages can be read (it can be the s... | function Chat(options) {
if (!(this instanceof Chat))
return new Chat(options);
options = Object.assign({}, defaults, options);
EventEmitter.call(this);
this.server = net.createServer(onconnect.bind(this));
this.port = options.port;
Object.defineProperty(this, 'connected', {
... | [
"function StatefulListener(ptcl, readable, writable, opts) {\n MessageListener.call(this, ptcl, opts);\n this._adapter = undefined;\n this._writable = writable.on('finish', onFinish);\n this._readable = readable.on('data', onHandshake).on('end', onEnd);\n\n this.once('eot', function () {\n // Clean up any r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
three Dot in blue | function ThreeDot() {
return (
<svg width="24" height="24" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M288 384C288 366.327 273.673 352 256 352C238.327 352 224 366.327 224 384C224 401.673 238.327 416 256 416C273.673 416 288 401.673 288 384Z" fill="#011B53"/>
... | [
"static Teal() {\n return new Color3(0, 1.0, 1.0);\n }",
"static Dot(left, right) {\n return (left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w);\n }",
"function dimDot (id, dim)\n{\n\tif (dim) ph[id].dot.attr(\"opacity\", 0.15).attr(\"stroke-width\", dotstrok... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks when star and user touches and collects it | checkStar(user) {
if (!this.collected) {
let d = dist(this.x, this.y, user.x, user.y);
if (d < user.size / 2 + this.size / 2) {
this.collected = true;
this.playNote(); //plays note when star is collected (or disappears) by user
}
}
} | [
"function collectGem() {\n if (player.isTouching(gem)) {\n playSound(\"sound://category_instrumental/trumpet.mp3\", false);\n gem.destroy(); \n portal = createPortal();\n }\n}",
"function globalTapped() {\n if(freeze || victory) return;\n if(!boardData[this.board].isActive()) return;\n select(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies the given changes to a given feature/layer and sends a PUT request to the server. | modifyFeature(feature, changes) {
let layerId = feature.get('layerId');
let layer = this.mapsInterface.getLayerFromArray(layerId);
layer = this.updateLayerProperties(changes, layer, feature);
this.mapsInterface.updateLayerIndex(layerId, layer);
this.mapsInterface.updateStarboard();
let url = thi... | [
"function saveLayerChanges() {\n // Update the currently active dataset\n var activeDatasetId = getActiveDatasetId();\n var activeDataset = getDatasetById(activeDatasetId);\n activeDataset.parameters = formToJSON();\n // Update dataset name to reflect the distribution and format\n updateDatasetNam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display error if shader could not be compiled | function glShaderCompileError(error) {
addError(error);
} | [
"function validate(src, type) {\n // uniforms don't get validated by glsl\n if (type !== 0 && type !== 1) {\n return false;\n }\n if (!src) {\n return [false, 0, \"Shader cannot be empty\"];\n }\n if (!context) {\n console.warn(\"No WebGL co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert an array of atom indices to a single string unique identifier. For linear molecules, or for atoms in the main chain, this will just be the atom index, something like "0,1". For branched molecules, however, we uniquely identify atoms by an array of atoms where the branching happened, followed by the index in the... | function idxString(idx) {
return idx.join(":");
} | [
"function mapIdxToId(idxArray) {\n /* Internally cells are referred to by an array of cell indices.\n Translate an array of these numbers to an array of strings */\n\n if (idxArray===null)\n return self.cellIds;\n\n var idList = [];\n for (var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handles the refresh of news on the app | handleRefresh() {
this.setState(
{
refreshing: true
},
() => this.fetchNews()
);
} | [
"function refreshRss() {\n\trss.loadRssFeed({\n\t\tsuccess: function(data) {\n\t\t\tvar rows = [];\n\t\t\t_.each(data, function(item) {\n\t\t\t\trows.push(Alloy.createController('row', {\n\t\t\t\t\tarticleUrl: item.link,\n\t\t\t\t\timage: item.image,\n\t\t\t\t\ttitle: item.title,\n\t\t\t\t\tdate: item.pubDate\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Message to deny the trade | function denyTrade(message){
message.reply(`${message.mentions.members.first().user.username} rejected your trade offer`);
} | [
"function mentorDeclineMeetingRequest() {\n return confirm(\"Are you sure you want to decline a meeting request from this mentee?. No record at this stage will be kept.\")\n}",
"unlockMessage() {\n // if message is over a day old (10 seconds for testing), unlock it and allow deletion\n if(Date.no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function Name: dbgNoti Input: Boolean variable "starts" Output: None. Description: When it got true, starts make notifications, and got false, stop making. Author: JoonChul Kim | function dbgNoti(starts) {
if(starts) {
dbgNotiInterval = setInterval(function() {
noti("HUI", new Date, false);
}, 10000);
} else {
clearInterval(dbgNotiInterval);
}
} | [
"notify(){\n new Notification(this.tache, {body:`Commence à ${this.hstart} et finit à ${this.hend}.`, icon:ICON_PATH})\n this.notified = true\n }",
"function show() {\n var currentTime = new Date();\n var time = /(..)(:..)/.exec(currentTime); // The prettyprinted time.\n var hour = time[1] % 1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders a button acknowledging selected alerts | renderAcknowledgeButton() {
const { selectedItems } = this.state;
if (selectedItems.length === 0) {
return;
}
return (
<EuiButton color="primary" iconType="check" onClick={this.onClickAcknowledge}>
Acknowledge {selectedItems.length} alerts
</EuiButton>
);
} | [
"function renderDeleteMessage(objectText) {\n closeMessages();\n var div = $('<div>')\n .appendTo('#messages')\n .addClass('alert alert-info alert-dismissable');\n $(\"<button>\").appendTo(div)\n .attr('type', 'button')\n .attr('data-dismiss', 'aler... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retourneer geformatteerde datum In: dt = DateType variable dl = Delimiter Rt: string met geformatteerde datum | function formatDate(dt, dl)
{
var dd = ("0" + dt.getDate());
var mm = ("0" + (dt.getMonth() + 1));
var yy = dt.getFullYear();
var fdate = yy + dl + mm.slice(-2) + dl + dd.slice(-2);
//console.log("\t\tdd is [" + dd + "] mm is [" + mm + "] yy = [" + yy + "] dl = [" + dl + "] -> fdate is [" + fdate + "]");
r... | [
"function format_day_string (val, format) {\r\n\tvar d = new Date(val);\r\n\tformat = format.replace('yyyy', d.getFullYear());\r\n\tformat = format.replace('MM', d.getMonth() + 1);\r\n\tformat = format.replace('dd', d.getDate());\r\n\treturn format;\r\n}",
"function formatDateddMMyyyy(d){\n return d.su... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove all of the extra stuff: sign, padding, commas,... The selection is adjusted accordingly, or enough state is preserved to restore it correctly afterwards. | function removeExtraStuff(state) {
if (config.currency) {
state.value = removeCurrencySignAndPadding(state.value, state.selection);
state.value = removeCommas(state.value, state.selection);
}
state.posFromEnd = state.value.length - state.selection.end;
state.sign = false;
var dotPos = -1... | [
"function removeCurrencySignAndPadding(value, selection) {\n var newValue = value;\n if (newValue.charAt(0) === config.currencySymbol) {\n newValue = newValue.substring(1); // Remove sign\n }\n selection.start --;\n selection.end --;\n var lastPadChar = -1;\n for (var i = 0; i < newValue.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function name : validateEnquiryEmailsForm | function validateEnquiryEmailsForm()
{
var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(document.frmAddEditEmail.frmEnquiryEmail.value == "")
{
alert(ENTER_EMAIL);
document.frmAddEditEmail.frmEnquiryEmail.focus() ;
return false;
}
if(document.frmAddEditEmail... | [
"function validateNewsLetterMailForm(formID)\n{\n if(validateForm(formID, 'frmNewsLetterName', 'Title', 'R','frmSubscriberList','Subscriber','R'))\n { \n return true;\n } \n else \n {\n return false;\n }\n}",
"function email_check() {\r\n email_warn(email_validate());\r\n fi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete letter index function | function deleteLetterIndex(e) {
const word = document.querySelector('.word.active') || wordsContainer.firstChild
if (word.lastChild.classList.contains('extra') && e.keyCode === 8) {
letterIndex--
letterIndex = letterIndex <= 0 ? 0 : letterIndex
slashCoords()
word.removeChild(word.lastChild)
} else... | [
"function erase() {\n\tif (eachLetter >= 0) {\n var str=openTo[adding].toString().substring(0, eachLetter);\n document.getElementById(\"demo\").innerHTML = str;\n eachLetter--;\n setTimeout(erase, speed-25);\n } else {\n adding++;\n if(adding>=openTo.length) \n adding=0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete text in a textarea at the current selection. This is provided to allow for fallback to a nonundoable version for Internet explorer and Firefox. | function deleteText(textarea) {
if(deleteSupported) {
if(!document.execCommand("delete")) {
deleteSupported = false;
deleteText(textarea);
}
} else {
// Backup version for Internet Explorer 11
// and Firefox
... | [
"function delete_function() {\r\n\tvar delete_end_char = textarea_element.selectionEnd;\r\n\tif (delete_end_char < textarea_element.value.length && delete_end_char == textarea_element.selectionStart) {\r\n\t\tdelete_end_char++;\r\n\t}\r\n\ttextarea_element.setRangeText(\"\", textarea_element.selectionStart, delete_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HTML5 defines how parsers treat documents with multiple body tags: they merge the attributes from the later ones into the first one. Therefore, just before the parser sends the endDoc event, it will also send this event which will provide the attributes from the effective body tag to the client (the handler). | effectiveBodyTag(attributes) {} | [
"function onDocumentBody(callback) {\n if (document.body) {\n callback();\n } else {\n setTimeout(function () {\n onDocumentBody(callback);\n }, 0);\n }\n }",
"function addBodyListeners() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process the Start Button | processStartButton() {
clearTimeout(this.timer);
this.timer = null;
this.game.switchScreens('play');
} | [
"function handleGetStarted() {\n\t$('main').on('click', '.start-button', function(event) {\n\t\tshowLogIn();\n\t})\n}",
"function tourButtonClick() {\n\tstartButtonClick();\n\tstartIntro();\n}",
"function clickStart() {\n $('#start').click(function (event) {\n // This starts the game when the star... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to execute / send command to Jarvis | function postCommand(obj) {
// Get command from DOM element and remove line breaks
var command = $$(obj).text();
command = command.replace(/(\r\n|\n|\r)/gm,""); // Strip newlines
// If we need user input for free-form variable
if (command.indexOf('_custom input_') > -1) {
var input = prom... | [
"function SendCommand(Command)\n{\n var Output = SSHClient.RunCommand(Command)\n Log.Message(\"Output from Device is :- \"+ Output.Result)\n return Output.Result\n}",
"function sendCmd(cmd) {\n return sendJson(ip+\"/cmd/{'c':\"+cmd+\"}\");\n}",
"submitCmd(){\n this.cmdText += `> ${this.cmd}\\n`\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write the function printInt(n) taking one parapmeter n and print all natural numbers from 1 to n in console. | function printInt(n) {
// Using a loop print from 1 to n
// start: 1
// var i = 1;
// // stop: n
for(var x=1;x<=n;x++){
//console.log(x);
}
} | [
"function prog14()\n{\n\tvar n= prompt(\"Enter Even No\");\n\tn=parseInt(n);\n\t\n\t\tfor( var i=n+2;i<=n+10;i=i+2)\n\t\t{\n\t\tconsole.log(i);\n\t\t}\n\t\n}",
"function naturalNumber(){\n var printAll=0;\n var num = document.getElementById('sumInput').value;\n for(var i=1; i<=num; i++){\n printAl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hover handler for bounce animation | function thumbsBounceHover($this) {
$this.filter(':not(:animated)').animate({
top: parseInt($this.css('top')) - 25
}, 500, 'easeOutBounce',
function () {
$this.animate({
top: parseInt($this.css('top')) + 25
}... | [
"hover() {\n // Add bounce class\n $(\"#pk_photo\").addClass('animated bounce');\n // Remove after 1 second\n setTimeout(function() {\n $(\"#pk_photo\").removeClass('animated bounce');\n }, 1000);\n }",
"bounce() {\n\n this.balltween\n .to('#b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a row into the HTML file showing the multiple choice field which was created. | function addRowMultipleChoice(mcQuestion) {
const div = document.createElement('div');
div.className = 'form';
div.id = mcQuestion.uuid;
let optionType = 'radio';
if (mcQuestion.multiple) {
optionType = 'checkbox';
}
let optionDisplay = ``;
let list = mcQuestion.optionList;
... | [
"function addQuestionMultipleChoice() {\n let formValues = formToFieldList('mcForm');\n // Will Return List with the following:\n // Index 0: Question Title\n // Index 1: Multiple Selection Allowed\n // Index 2-...: Question Values\n\n let mcTitle = formValues[0];\n let mcMultiple = formValues[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether a |report| is a "opener breakage" COOP report. | function isCoopOpenerBreakageReport(report) {
if (report.type != "coop")
return false;
if (report.body.type != "navigation-from-response" &&
report.body.type != "navigation-to-response") {
return false;
}
return true;
} | [
"function userHasBeenReferredByPartnerWhoSuppliesPromocodes() {\n for (var i = 0; i < referralPartnersWhoSupplyPromocodes.length; i++) {\n if (linkshareReferrerID == referralPartnersWhoSupplyPromocodes[i]) { // If the referrer is in the list of referral partners who supply voucher codes\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does string `s` end with `post`? If so, returns a slice of `s` from the start up to the `post` string at the end. | function ends_with(s, post) /* (s : string, post : string) -> maybe<sslice> */ {
if (xends_with(s, post)) {
return Just(Sslice(s, 0, (((s.length) - (post.length))|0)));
}
else {
return Nothing;
}
} | [
"function find_last(s, sub) /* (s : string, sub : string) -> maybe<sslice> */ {\n var i = ((s).lastIndexOf(sub));\n if ((i<0)) {\n return Nothing;\n }\n else {\n return Just(Sslice(s, i, sub.length));\n }\n}",
"function trimTail(s, tail) {\n return s.split(tail)[0];\n}",
"cut(s, suffix) {\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input_interactions.js (c) Copyright 2018, Brian Mottershead. All rights reserved. Common code for setting up interactions that are transformed to HTML form input elements; namely, choiceInteraction (radio/checkbox), endAttemptInteraction (button), extendedTextInteraction (textarea), hottextInteraction (radio/checkbox),... | function setupInputInteraction(interaction) {
let qtiInteraction = QTI.DOM.getElementById(interaction.id);
let responseVariable = getResponseVariable(interaction);
switch(interaction.tagName) {
case "SELECT":
interaction.onchange=handleResponse;
break;
case "BUTTON":
interaction.onclick=handleRes... | [
"addInteraction(interaction) {\n // Maybe have a list of interactions that are all handled??\n this.interactions[interaction.type] = interaction;\n return this;\n }",
"addInteraction(config) {\n index = getValue('cmi.interactions._count');\n let newInteraction = new Interaction(index, config);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
20.Write a JavaScript for loop that will iterate from 0 to 15. For each iteration, it will check if the current number is odd or even, and display a message to the screen. | function oddEven() {
for (let i = 0; i <= 15; i++) {
if (i % 2 == 0) {
console.log(`${i} is even`);
} else {
console.log(`${i} is odd`);
}
}
} | [
"function oddOrEven(){\n for (let i = 0; i <= 20; i++) {\n if (i % 2 === 0) {\n console.log(i + ' is even');\n } else {\n console.log(i + ' is odd');\n }\n }\n}",
"function printNums() {\n var num = 0\n while ( num <=15 ) {\n if(num % 2 === 0) {\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the predictions for a given agency and a list of stops | predictions(agencyTag, stops, cb) {
var predictions = [ ],
sliceSize = 150,
concurrentRequestsCount = 0;
var slices = [ ],
sliceIndex = 0;
if (stops.length <= sliceSize) {
slices.push(stops);
} else {
for (var i = 0; i < stops.... | [
"vehicles(agencyTag, routeTag, lastUpdateTime, cb) {\n var vehicles = [ ];\n\n if (lastUpdateTime === undefined) {\n lastUpdateTime = 0;\n }\n\n this._newRequest().query({\n command: 'vehicleLocations', a: agencyTag, r: routeTag, t: lastUpdateTime }, function(e) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================================================// ========================================================// dump an editinprogress if edit range overlaps with span with nodeID. in fact, dump an editinprogress if span's nodeID is <= end range of the edit. (can't be editing spans after the current caption comin... | function checkForEditOverlapWithCaptions(nodeID) {
if (!noCurrentEdit()) {
if (parseInt(nodeID, 10) <= parseInt(editState.upperEditRange, 10)) {
cancelEdit();
}
}
/*
var tmpStart = 0;
var tmpEnd = 0;
var inputElem;
var aSpan;
//if no edit box, move on
if ((inputElem = getEditNode()) != null) {
//we ... | [
"function getEditedRange(nodeID) {\n\n\tvar editAttr;\n\tvar aSpan;\n\tvar tmpSpan;\n\tvar range = {\"begin\":-1,\"end\":-1};\n\t\n\t\n\tif ((tmpSpan = document.getElementById(nodeID)) != null) {\n\t\tif (spanIsMarkedEdited(tmpSpan)) {\n\t\t\trange.begin = nodeID;\n\t\t\trange.end = nodeID;\n\t\t\t\n\t\t\t//go forw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The mass of the uncrewed rocket plus the food and other supplies is 75,000 kg. Combine the rocket and crew masses, then calculate and store the amount of fuel required to reach LEO. Add an extra 200 kg of fuel for each dog or cat on board, but only an extra 100 kg for the other species. Round the final amount of fuel U... | function fuelRequired(crewArray){
let massOfCrew = crewMass(crewArray);
let fuel = (75000+massOfCrew)*9.5;
for (i=0; i<crewArray.length; i++){
if (crewArray[i].species === 'dog' || crewArray[i].species === 'cat'){
fuel += 200;
} else {
fuel += 100;
... | [
"function carTrip(car, miles){\n console.log(car, miles)\n\n car.miles += miles\n console.log(car.miles)\n\n \n car.spareTiresUsed += Math.floor(miles / 1000)\n\n return car\n}",
"function calcRecommendedFood(dogsArr) {\n dogsArr.forEach(function (dog) {\n dog.recommendedFood = (dog.weight ** 0.75 * 28)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when pressed the team points button. Change the view to team points. | function goToTeamPoints(){
clientValuesFactory.setActiveWindow(windowViews.teamPoints);
} | [
"function teamPointsUpdate(event, points){\n self.points = points;\n }",
"editPointViewClick() {\n this.deselectAllTabs();\n\n this.editPointViewTab.className = \"WallEditor_EditPointViewTab selected\";\n this.viewController = this.editPointView;\n\n this.selectCurren... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the push notifications in every 2 minutes The Time Interval is Set 2 minutes because we need delay of 1 minute between the location update service and message service to over come the n number of connections with the database | function fetchNotifications() {
// Update Progress bar value
setTimeout(function() {
updateProgressBar("Finishing....", "100%");
setTimeout(function() {
toggleProgressBar();
resetProgressBar();
}, 5000);
}, 10000);
setInterval(function() {
$.ajax({
url : "MessageService",
type : "GET",
da... | [
"function refreshNotifications() {\n received_notifications = false;\n $.ajax({\n url : bb_api_notifications,\n data : { get_notifications_for_user: true, room : room.id, limit : 0, format : 'json', username : user_name, api_key : api_key },\n accepts : 'application/js... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes an annotation on the given zindex and zero based page index. | function Z(e,t){var n=y.annos[t].splice(e,1)[0];y.activepage&&y.activepage._paper&&y.activepage._paper._annos.exclude(n.getObject()),y.activeanno===n&&(y.activeanno=null),n.dispose(),y.activepage&&y.activepage._grips&&y.activepage._grips.repaint(),l.trigger({type:"annotationdeleted",page:t,index:e})} | [
"deleteDataByIndex(index) {\n this.content.splice(index, 1);\n }",
"function deleteObject(array,index){\n delete(array[index]);\n array.splice(index, 1);\n}",
"deleteHome(index) {\n _houseService.deleteHome(index)\n _draw()\n }",
"removeHighlight(index: number): void {\n var unhighlighte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load a gRPC package definition as a gRPC object hierarchy. | function loadPackageDefinition(packageDef) {
const result = {};
for (const serviceFqn in packageDef) {
if (Object.prototype.hasOwnProperty.call(packageDef, serviceFqn)) {
const service = packageDef[serviceFqn];
const nameComponents = serviceFqn.split('.');
if (nameCom... | [
"function _loadProto(path) {\n const packageDefinition = protoLoader.loadSync(path, {\n keepCase: true,\n longs: String,\n enums: String,\n defaults: true,\n oneofs: true,\n });\n return grpc.loadPackageDefinition(packageDefinition);\n}",
"async loadExtensions(extensions) {\n let extensionDat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sortByDOMPosition: Called by our click handler to sort a list of instances according to least > most nested. This is so that if multiple keybound instances have nodes that are ancestors of the click target, they will be sorted to let the instance closest to the click target get first dibs on the next key down event. | function sortByDOMPosition(a, b) {
return a.node.compareDocumentPosition(b.node) === 10 ? 1 : -1;
} | [
"function sortChildren(parent, accessor) {\n var children;\n var i, a, b;\n var swap = true;\n\n while (swap) {\n swap = false;\n children = parent.children;\n for (i = 0; i < children.length - 1; i++) {\n a = accessor(children[i]);\n b = accessor(children[i + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if users email has been verified and if not verified, redirects to verify page | checkEmailVerification() {
if (!this.props.authUserData.email_verified) {
this.props.history.push('/verify');
}
} | [
"function sendEmailVerification() {\n // [START sendemailverification]\n auth.currentUser.sendEmailVerification().then(function() {\n // Email Verification sent!\n // [START_EXCLUDE]\n alert('Email Verification Sent!');\n // [END_EXCLUDE]\n });\n // [END sendemailverification]\n }",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a check Handler for when a used clicks on a check to add: starts the process of adding a check by checking if there's an example file for it, and loading the data from this file if so | function addCheck(checkToAdd) {
// See if theres an example file for this check
sendMessage("checks/listConfigs", "", "post",
function(data, status, xhr){
var exampleFile = "";
var disabledFile = "";
if (typeof(data) != "string") {
data.forEach(function(fileName) {
var checkName = fileNa... | [
"function loadNewChecks() {\n $(\".list\").html(\"\");\n\n // Get a list of all the currently enabled checks (aka checks with a valid config file)\n var enabledChecks = [];\n sendMessage(\"checks/listConfigs\", \"\", \"post\",\n function(data, status, xhr){\n if (typeof(data) == \"string\") return;\n dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
AND resets the Required and Input Sets and updates the Dag Node values | function runModules (dag, keyValuePairs) {
setModules(dag, keyValuePairs)
runConfigs(dag, [])
} // Adds or deletes zero or more Nodes from the Selected Set, resets the Required and Input Set, | [
"function resetVars() {\n\t\tidArrays = [];\n\t\tdeathArrays = [];\n\t\tfollowUpArrays = [];\n\t\tdataType = \"number\";\n\t\tsources = 0;\n\t\tNs = [];\n\t\thaveFollowUp = false;\n\t\tdataName = \"\";\n\t\tdragZone = {'left':-1, 'top':-1, 'right':-1, 'bottom':-1, 'name':\"\", 'ID':\"\"};\n\t\tlimits = {'minX':0, '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Eventually, this will query the backend to get a list of relative grave IDs for a given grave ID and return it. Currently, it just returns a preset list of graves | function getRelatives(graveID = 0) {
// Pre-set layer indexes for graves that are relatives of Hannes Becker
const relativeIndexes = [92, 104, 79, 110, 112, 128];
let relatives = [];
for (let i = 0; i < relativeIndexes.length; i++) {
relatives.push(occupiedGravePoints.getLayer(relativeIndexes[i]));
}
... | [
"static getRemotePaths(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('flavorasset', 'getRemotePaths', kparams);\n\t}",
"async getSignedAgentForListing(listing_id) {\n let listings = await this.getListingsWithId(listing_id);\n let listing = listings[0];\n //conso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
unselectBase if iscol was set | function setcol() {
if (iscol)
unselectBase()
iscol = true;
} | [
"function unselect(self, value){\r\n var opts = self.options;\r\n var combo = self.combo;\r\n var values = combo.getValues();\r\n var index = $.inArray(value+'', values);\r\n if (index >= 0){\r\n values.splice(index, 1);\r\n setValues(self, values);\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SEARCH finds text using wildcards ?, , ~?, and ~. | function SEARCH(find_text, within_text, position) {
if (!within_text) {
return null;
}
position = typeof position === 'undefined' ? 1 : position;
// The SEARCH function translated the find_text into a regex.
var find_exp = find_text.replace(/([^~])\?/g, '$1.') // convert ? into .
.replace(/([^~])\*/g, ... | [
"function cari(){\n\tvar isi = \"saya beajar di rumah teman\";\n\tconsole.log(isi.search(\"beajar\"));\n\tconsole.log(isi.search(/beajar/));\n}",
"function srQuery(container, search, replace, caseSensitive, wholeWord) {\r if (search) {\r var args = getArgs(caseSensitive, wholeWord);\r rng = docum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disconnect any connections associated with the line and anchor index. | disconnect(lineId, lineAnchorIdx) {
this.connections = this.connections.filter(c => !(c.lineId == lineId && c.lineAnchorIdx == lineAnchorIdx));
} | [
"disconnect() {\n if (this.source) {\n this.source.disconnect(this.analyser);\n this.source = null;\n }\n }",
"disconnect() {\n\t\t\tthis.connected = false;\n\t\t\t// Emitting event 'disconnect', 'exit' and finally 'close' to make it similar to Node's childproc & cluster\n\t\t\tthis._emitLocally(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detect if a given value is a server name or a connection string, and assign the result accordingly | static processServerOrConnectionString(value, credentials) {
// If the value contains a connection string server name key, assume it is a connection string
const dataSourceKeys = ['data source=', 'server=', 'address=', 'addr=', 'network address='];
let isConnectionString = dataSourceKeys.some(ke... | [
"vaidateProtocol(host){\n let protocols = ['https://', 'http://'];\n if (protocols.map(protocol => host.includes(protocol)).includes(true)) return host\n throw new Error('Host String must include http:// or https://')\n }",
"function getServerURL(name){\n for(i in SERVERS)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete the CloudFormation stack | static async deleteStack(stackName) {
await KelchCommon.exec('aws cloudformation delete-stack --stack-name ' + stackName);
} | [
"async remove(inputs = {}) {\n const { stage } = inputs;\n if (stage === \"staging\" || stage === \"prod\") {\n const template = await this.load(\"@serverless/template\", stage);\n const output = await template.remove();\n return output;\n }\n }",
"static async deployStack(templateFilePat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the distribution claim amount | async getClaimDistributionAmount () {
this.REQUIRES(Services.COMSTOCK)
const userWallet = this.web3Manager.getWalletAddress()
const web3 = this.web3Manager.getWeb3()
const wallet = web3.utils.toChecksumAddress(userWallet)
const claimDistribution = await this.comstock.getComstock({ wallet })
cons... | [
"async totalClaimable(){\n try {\n let claimable = await this._contract.claimAmount({\n user: this._accountId\n })\n return utils.format.formatNearAmount(claimable)\n } catch (error) {\n console.log(error)\n return 0 \n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display post data in form | function displayEditPost(post){
$("form#edit-form input#title").val(post.title);
$("form#edit-form textarea#content").val(post.body);
} | [
"render() {\n return (\n <div class=\"add-post-container\">\n <h3>Add Post</h3>\n <Form model=\"forms.addPost\" onSubmit={(val) => this.handleSubmit(val)}>\n <Control type=\"text\" model=\"forms.addPost.title\" class=\"form-control\" placeholder=\"E... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets target element back to original size/pos and hides messages | function reset($target, start_pos, width) {
$target.css(start_pos);
//$target.css({'left': start_pos.left + 'px', 'top': start_pos.top + 'px'});
if(width > 0) $target.width(width);
$target.removeClass('disabled_bg');
$('.cal-tip').hide('fast');
$('#cal_messages').css('top', '0px').hide('fast');
} | [
"hide() {\n\t\tthis.element.style.visibility = 'hidden';\n\t}",
"function removeWinningMessage() {\n winningMessage.textContent = \"\";\n boardElement.classList.remove(\"hidden\");\n winningMessage.classList.remove(\"visible\");\n winningMessage.classList.add(\"hidden\");\n }",
"show() {\n\t\tthis.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
New neurons have been entered by user, update graph. | queriesUpdated (neurons) {
// Check if new list of neurons is the same as the ones already rendered on last update
var matched = (this.state.neurons.length == neurons.length) && this.state.neurons.every(function (element, index) {
return element.id === neurons[index].id;
});
// Request graph... | [
"function updateNetwork() {\n if (d3.event) {\n d3.event.stopPropagation();\n }\n node = node.data(graph.nodes, function (d) {\n return d.id;\n });\n node.exit().remove();\n node = node.enter().append(\"circle\").attr(\"fill\", function (d) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
$( '.gallery__previewitem' ).bind( "tap", slideHandler ); | function slideHandler (e) {
var target = $(e.target);
if (target.hasClass('gallery__preview-item')) {
var img = target.closest('.gallery__preview-show').find('.gallery__preview-pic');
var src = target.data('src');
img.attr('src', src).hide().fadeIn(200);
}
} | [
"function displayMovieLightbox(e) { \r\n $(e).click((event)=>{\r\n let posterIndex = $(event.target).attr(\"data-index\");\r\n let index = parseInt(posterIndex, 10);\r\n let movieSlides = $('.movie-slides');\r\n $('#lightbox-b').show();\r\n movieSlides.eq(index).s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
enumerate over the key+items in a collection, removing each pair as they are enumerated. | function ezForEachAndRemove(
/** a javascript object with enumerable properties */
collection,
/** return a rejected promise from the callback to abort enumeration. item is removed from collection immediatly prior to the callback being invoked, so if you wish it to remain in the collection you will need t... | [
"removeNonMatching(iterable) {\n let cnt = 0;\n // if iterable has a \"has\" property, then we can just use it directly\n let other = iterable.hasOwnProperty(\"has\") ? iterable : new SpecialSet(iterable);\n for (let item of this) {\n if (!other.has(item)) {\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
It sorts all the arrays related to the filters. | function sortFilterArrays()
{
yearsArray.sort(function(a, b) {return b - a});
authorsArray.sort(function(a, b) {return b[1] - a[1]});
if (NUMBER_OF_TIMES_IN_FILTER <= yearsArray.length)
OLDER_TEXT = "< " + yearsArray[NUMBER_OF_TIMES_IN_FILTER - 1]
} | [
"createFiltersData() {\n let filtersData = {}\n this.createFilterKeys(this.state.data[0], filtersData);\n this.populateFiltersObject(this.state.data, filtersData);\n for (let key in filtersData) {\n filtersData[key].sort();\n }\n return (filtersData);\n }",
"function sortJSON() {\n\tfilter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`applyContainer` performs an operation on the container and its views as specified by `action` (insert, detach, destroy) Inserting a Container is complicated by the fact that the container may have Views which themselves have containers or projections. | function applyContainer(renderer, action, lContainer, renderParent, beforeNode) {
ngDevMode && assertLContainer(lContainer);
const anchor = lContainer[NATIVE]; // LContainer has its own before node.
const native = unwrapRNode(lContainer);
// An LContainer can be created dynamically on any node by inject... | [
"_onAppliedUpdate(view, metadata) {\n if (view && _.isFunction(view.afterApplyUpdate)) {\n view.afterApplyUpdate(metadata);\n }\n }",
"_onApplyingUpdate(view, metadata) {\n if (view && _.isFunction(view.beforeApplyUpdate)) {\n view.beforeApplyUpdate(metadata);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render ChatPanelHeader and ChatPanelFooter only when a thread is clicked. Before that there will be nothing but blank chat panel. | render() {
let chatPanelHeader;
let chatPanelFooter;
if (this.state.thread && this.state.thread.id !== -1) {
chatPanelHeader = <ChatPanelHeader thread={this.state.thread} />;
chatPanelFooter = (<ChatPanelFooter
text={this.state.text}
onTextChange={this.onTextChange}
onKey... | [
"renderChatPage () {\n this.clearShadowRoot()\n this.shadowRoot.appendChild(chatLayoutTemp.content.cloneNode(true))\n this.getElement('#chatUsernameP').textContent = this.username\n\n this.socket.addEventListener('message', this.boundGetMsgFromServer)\n this.getElement('form').addEventListener('submi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update existing short link. | static update(id, shortLink){
let kparams = {};
kparams.id = id;
kparams.shortLink = shortLink;
return new kaltura.RequestBuilder('shortlink_shortlink', 'update', kparams);
} | [
"function shortenUrl(longUrl) {\n var newUrl = Url({\n long_url: longUrl\n });\n // save the new link in the db\n newUrl.save(function(err) {\n if (err){\n console.log(err);\n }\n });\n // the short url will just be the id of the saved url in the db. Todo : optimize this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all category checkboxes with a checked status | function getCheckedCategories() {
let availableategories = document.getElementsByClassName('filter-checkbox');
let checkedCategories = [];
for (let j = 0; j < availableategories.length; ++j) {
if (availableategories[j].checked == true) {
checkedCategories.push(availableategories[j].value... | [
"function checkboxes() {\n\t\t\treturn $('#' + self.id + ' .check > :checkbox');\n\t\t}",
"function getAllCheckedItems(container) {\n var wrapper = document.querySelector(container);\n var chckbox = wrapper.querySelectorAll('input');\n var testCollection = [];\n\n chckb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detach the vertexHelper to stuff objects | function detachVertexHelper()
{
//if (INTERSECTED.name.category == 'stuff' && readOnly != 1) {
for (var i=0; i<vertexHelpers.length; i++){
scene.remove(vertexHelpers[i]);
}
vertexHelpers = [];
clickedVertex = null;
//}
} | [
"detach() {\n this.surface = null;\n this.dom = null;\n }",
"delete() {\n\t\t// Remove all edge relate to vertex\n\t\tthis.vertexMgmt.edgeMgmt.removeAllEdgeConnectToVertex(this)\n\n\t\t// Remove from DOM\n\t\td3.select(`#${this.id}`).remove()\n\t\t// Remove from data container\n\t\t_.remove(this.dataContai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calcula el angulo entre el punto origen y un punto en la lista | calcularAngulo(punto){
return this.angulo = Math.atan2(punto.y - this.y, punto.x - this.x);
} | [
"function sukeistiMasyvo2elementus(x, y) {\n let t = prekiautojai[x];\n prekiautojai[x] = prekiautojai[y];\n prekiautojai[y] = t;\n}",
"function sukeistiMasyvo2Elementus(x, y) {\n var z = prekiautojai[x];\n prekiautojai[x] = prekiautojai[y];\n prekiautojai[y] = z;\n\n}",
"function paraulaAlea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get items from menu_id | static async getMenuItems(menu_id) {
const result = await db.query(
`SELECT DISTINCT m.id, m.title, i.id, i.name, i.price, i.type, i.ingredients, i.description
FROM menus AS m
INNER JOIN menu_item
ON m.id = menu_item.menu_id
INNER JOIN items AS i
ON menu_item.item_id = i.id
... | [
"static getMenuItem(id) {\n return menuItemById[id];\n }",
"async allItems() {\n const allItemMenuLocator = await this.components.menuAllItemsLink()\n await allItemMenuLocator.click()\n }",
"fetchMenuByType(type) {\n return this.http.get('menu/' + type);\n }",
"function getRel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the rocket's animation | _clearRocketAnimation() {
this._rocket._tl.clear();
this.removeChild(this._rocket);
} | [
"stopBrickAnimation() {\n clearInterval(this.animationIntervalContainer)\n this.animationIntervalContainer = null\n }",
"cancel() {\n if (this.raf) {\n cancelAnimationFrame(this.raf);\n }\n }",
"function resetAnimation(){\n animationSteps = [];\n step = 0;\n resetFlow... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The event for dragging over a skill paragraph. | function dragSkillOver(e) {
e.preventDefault(); //Allow the drag-over.
} | [
"function dropSkill(e) {\n\t\tlet span= O(e.dataTransfer.getData(\"span\"));\n\t\tlet skill= O(e.dataTransfer.getData(\"skill\"));\n\t\t\n\t\tlet id = skill.id;\n\t\tlet dot1 = id.indexOf('.');\n\t\tlet dot2 = id.indexOf('.',dot1+1);\n\t\tlet fromRating = parseInt(id.substring(dot1+1,dot2));\n\t\t//Also get the fro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find out which lines are selected and remove scenetag from them | function removeSceneTagFromSelection() {
var rep = this.rep;
var documentAttributeManager = this.documentAttributeManager;
if (!(rep.selStart && rep.selEnd)) {
return;
}
var firstLine = rep.selStart[0];
var lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0));
_(_.range(fi... | [
"removeLines(lines){\n\t\t//console.log(\"This is removeLines:\",lines);\n\n\t\tvar lines_n = lines.length;\n\t\tfor (var l=0;l<lines_n;l++){\n\t\t\tthis.scene.remove(lines[l]);\n\n\t\t}\n\t\t// lines.forEach( function( item ) { \n\t\t// \tthis.scene.remove( item ) \n\t\t// },this );\n\t}",
"function RemoveLines(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a "no games found view" | function createNoGamesView() {
$.newChallenge.add(Ti.UI.createLabel({
width : Ti.UI.FILL,
text : Alloy.Globals.PHRASES.noGamesTxt+ " ",
left : 60,
top : 40,
font : Alloy.Globals.getFontCustom(16, 'Regular'),
color : '#CCC'
}));
} | [
"render() {\n const results = this.state.regionalResults;\n\n if (results.errors === 0 && results.games.length) {\n return this._renderGames(results);\n } else if (results.errors) {\n return this._renderError();\n } else {\n return this._renderNothing();\n }\n }",
"function createGa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the requestpassword form and renders the requestpasswordreset template. This is similar to the password reset dialog, but has a screenbased interaction instead of a popup interaction. | function passwordReset() {
app.getForm('requestpassword').clear();
app.getView({
ContinueURL: URLUtils.https('Account-PasswordResetForm')
}).render('account/password/requestpasswordreset');
} | [
"function passwordResetDialog() {\n // @FIXME reimplement using dialogify\n app.getForm('requestpassword').clear();\n app.getView({\n ContinueURL: URLUtils.https('Account-PasswordResetDialogForm')\n }).render('account/password/requestpasswordresetdialog');\n}",
"function setNewPasswordForm() {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the Chisquared CDF | static cdf_chisq(x, df) {
let Z = x
let DF = df;
let Chisqcdf = this.Gammacdf(Z/2, DF/2)
Chisqcdf = Math.round(Chisqcdf * 100000) / 100000;
return 1 - Chisqcdf;
} | [
"static cdf_f(f_stat, f1, f2) {\n\t\tvar X = f_stat;\n\t\tvar Z = X / (X + f2/f1);\n\t\tvar Fcdf = this.Betacdf(Z, f1/2, f2/2);\n\t\tFcdf = Math.round(Fcdf * 100000) / 100000;\n\t\treturn Fcdf;\n\t}",
"static cdf_t(t_stat, df) {\n\t\tvar X = t_stat;\n\t\tvar tcdf, betacdf;\n\n\t\tvar A = df/2;\n\t\tvar S = A+.5;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a string of data potentially containing a command, parse out the command (if it is valid), otherwise return null | function parseCommand(data) {
for (const command in commands) {
const commandExpr = commands[command];
if (commandExpr.test(data)) {
return {
name: command,
argument: data.match(commandExpr)[1]
}
}
}
return null;
} | [
"function validateNone (data, command) {\n // good job!\n return true;\n }",
"function validateParry (data, command) {\n // no additional validation necessary\n return true;\n }",
"function parseCommand(message) {\n const regexp = new RegExp(`^[${Config.allowedCommandPrefixes.join('')}](\\\\w+)\\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks to see if the top row matches | function topRowMatch(){
if(isEmptyRow("square0","square1", "square2")){
isEqual("#square0", "#square1", "#square2");
}
} | [
"function middleRowMatch(){\n\tif(isEmptyRow(\"square3\", \"square4\",\"square5\")){\n\t\tisEqual(\"#square3\", \"#square4\", \"#square5\");\n\t}\n}",
"function lastColumnMatch(){\n\tif(isEmptyRow(\"square2\", \"square5\",\"square8\")){\n\t\tisEqual(\"#square2\", \"#square5\", \"#square8\");\n\t}\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We need our custom method because encodeURIComponent is too aggressive and doesn't follow with regards to the character set (pchar) allowed in path segments: segment = pchar | function encodeUriSegment(val){return encodeUriQuery(val,true).replace(/%26/gi,'&').replace(/%3D/gi,'=').replace(/%2B/gi,'+');} | [
"function encodeURL(path)\n{\n return encodeURIComponent(path).replace(/%2F/g,'/');\n}",
"function encodeUriPath(pathParam) { \n /*if (uriPath.indexOf(\"/\") === -1) {\n return encodeUriPathComponent(uriPath);\n }\n var slashSplitPath = uriPath.split('/');\n for (var pathCptInd in s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 69 A pair of strings form a strange pair if: 1st string's first letter = 2nd string's last letter. 1st string's last letter = 2nd string's first letter. | function isStrangePair(str1, str2) {
return (str1[0] === str2[str2.length -1] && str1[str1.length -1] === str2[0]);
} | [
"function flipEndChars(str) {\n\tif (str.length < 2 || typeof str !== 'string') {\n\t\treturn \"Incompatible.\";\n\t} else if (str[0] === str[str.length - 1]) {\n\t\t return \"Two's a pair.\";\n\t } else {\n\t\t return str.slice(-1) + str.slice(1, -1) + str.slice(0, 1);\n\t }\n}",
"function pairElement(str) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the timeout value that should be passed to setTimeout now for the timer to end at the deadline. For any deadline before now, the timer should end immediately, represented by a value of 0. For any deadline more than MAX_TIMEOUT_TIME milliseconds in the future, a timer cannot be set that will end at that time, so it ... | function getRelativeTimeout(deadline) {
const deadlineMs = deadline instanceof Date ? deadline.getTime() : deadline;
const now = new Date().getTime();
const timeout = deadlineMs - now;
if (timeout < 0) {
return 0;
}
else if (timeout > MAX_TIMEOUT_TIME) {
return Infinity;
}
... | [
"function getTimeout(timeout) {\n if (!isFinite(timeout) || !util.isPositiveNumber(timeout)) {\n timeout = 0;\n }\n \n return timeout;\n }",
"getTimeout(){cov_50nz68pmo.f[2]++;cov_50nz68pmo.s[6]++;return this.timeout;}",
"withMaximum(maximum) {\n max = maximum;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers this directive as present in its node's injector by flipping the directive's corresponding bit in the injector's bloom filter. | function bloomAdd(injector, type) {
var id = type[NG_ELEMENT_ID];
// Set a unique ID on the directive type, so if something tries to inject the directive,
// we can easily retrieve the ID and hash it into the bloom bit that should be checked.
if (id == null) {
id = type[NG_ELEMENT_ID] = nextNgEl... | [
"function tcbProcessDirective(el, dir, unclaimed, tcb, scope) {\n var id = scope.getDirectiveId(el, dir);\n if (id !== null) {\n // This directive has been processed before. No need to run through it again.\n return id;\n }\n id = scope.allocateDirectiveId(el, dir);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the invaders hit a wall, if they do, drops them on row down and changes their direction. | function checkInvaderWallLimit() {
if ((invaders[0][invader_leftLimit].x < 0)
|| (invaders[0][invader_rightLimit].x +
invaders[0][invader_rightLimit].width > canvas.width)) {
invader_vector = invader_vector * -1;
// Invader drop (wub wub wub)
for (var i = 0; i < NUM_ROWS; i++) {
for (var j = 0; ... | [
"find_direction() {\n this.direction = (this.direction + 1) % 4; // CCW 90\n if (!this.is_facing_wall())\n return true;\n this.direction = (this.direction + 3) % 4; // CCW 270\n if (!this.is_facing_wall())\n return true;\n this.direction = (this.direction + 3... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================ CHANGES SETTINGS NAVBAR INNERHTML (TEXT > IMAGE and reverse) RESPECT TO WINDOW WIDTH | function ChangeInnerHtmlOfSettingsNavbar() {
if ($(window).width() < 550) {
$(".hidden-user-settings-nav-headers a").eq(0).html("<img src='images/user.png' alt='User Image!'>");
$(".hidden-user-settings-nav-headers a").eq(1).html("<img src='images/padlock.png' alt='Padlock Image!'>");
... | [
"function updateLook() {\n if (gURLBar.focused) {\n reset(1);\n return;\n }\n // compute the width of enhancedURLBar first\n partsWidth = 0;\n Array.forEach(enhancedURLBar.childNodes, function(child) partsWidth += child.boxObject.width);\n\n if (partsWidth > getMaxWidth() || showingHidde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles system shutdown by relaying the shutdown request to all active connections. | async _handleSystemShutdown() {
const shutdownManager = ServerEnv.theOne.shutdownManager;
// This `await` returns soon after the system decides it is to shut down.
await shutdownManager.whenShuttingDown();
// Inform the traffic signal, and pump it with the call to
// `shouldAllowTraffic()`, so tha... | [
"function onConnectionClose() {\n\tif (shutdownInProgress && 0 === (httpServer.connections + httpsServer.connections))\n\t\tshutdownNext()\n}",
"function shutdown(socket) {\n var i;\n if (socket) {\n i = sockets.indexOf(socket);\n if (i !== -1) {\n socket.end();\n sockets.splice(i, 1);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOTICE file in the root directory of this source tree. See Keyboards, Assitive Technologies, and element.click() all produce a "virtual" click event. This is a method of inferring such clicks. Every browser except IE 11 only sets a zero value of "detail" for click events that are "virtual". However, IE 11 uses a zero v... | function $ffc54430b1dbeee65879852feaaff07d$var$isVirtualClick(event) {
// JAWS/NVDA with Firefox.
if (event.mozInputSource === 0 && event.isTrusted) {
return true;
}
return event.detail === 0 && !event.pointerType;
} | [
"function createClick(e) {\n // TODO. Does copying the properties adequately capture all the semantics of the click event?\n var clonedEvent = document.createEvent(\"MouseEvent\");\n clonedEvent.initMouseEvent('click', true, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
uses package name to find description | function switchPDesc(package) {
var desc;
switch (package) {
case "Basic":
desc =
"Rubbish removal, vacuuming floor sufaces, toilet areas full clean-up.";
break;
case "Basic Extra":
desc = "As basic plus washing dishes in kitchenettes.";
break;
case "Extensive":
des... | [
"getNameDescription(instance, element, defaultValue='') {\n instance.name = this.v(element, 'meta.title', defaultValue);\n instance.description = this.v(element, 'meta.description', '');\n\n instance.nameSourcemap = this.s(element, 'meta.title');\n instance.descriptionSourcemap = this.s(element, 'meta.d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs cleanup by deleting temporarily extracted contents of zip file. | function cleanup(dir) {
console.log('Removing temporarily extracted zip contents ...');
// cf. http://stackoverflow.com/questions/18052762/remove-directory-which-is-not-empty
var deleteFolderRecursive = function(path) {
if( fs.existsSync(path) ) {
fs.readdirSync(path).forEach(function(file,index){
... | [
"function unzip() {\n return new Promise((resolve, reject) => {\n if (!fs.existsSync(path.join(__dirname, '/../tmp/gtfs/trips.txt'))) {\n const zip = new StreamZip({\n file: path.join(__dirname, '/../tmp/gtfs.zip'),\n storeEntries: true\n });\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PCMDRUM BANK SELECT | PROGRAM | GROUP | NUMBER MSB | LSB | NUMBER | | ++++ 086 | 000 | 001 032 | User PCM Drum Kit | 0001 0032 ++++ 086 | 064 | 001 014 | Preset PCM Drum Kit | 0001 0014 ++++ 120 | 000 | 001 057 | GM2 Drum Kit | 0001 0009 | function collectPCMD_Preset() {
collect_bank([86,86], [64,64], [0,13], 'pcmd');
} | [
"function collectSND_Preset() {\n collect_bank([88,88],[64,64],[0,25],'snd');\n}",
"function _moduleAddr(addr) {\r\n if (addr < 16) {\r\n switch (addr) {\r\n case 0:\r\n rpio.open(16, rpio.OUTPUT, rpio.HIGH);\r\n rpio.open(18, rpio.OUTPUT, rp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method to get condition for that error | getCondition() { return 'Bad Request' } | [
"getCondition() {\n errors.throwNotImplemented(\"getting condition (dequeue options)\");\n }",
"get isError() {\n return (this.flags & 4) /* NodeFlag.Error */ > 0\n }",
"isErrorState() {\r\n const gl = this.gl;\r\n return gl === null || gl.getError() !== gl.NO_ERROR;\r\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the mouse is up, add the let name to current active expr/space if the timer has not expired (i.e., single click) | function letNameMouseUp(a1, a2, box, obj) {
if (Timer) {
clearTimeout(Timer);
Timer = null;
addLetNameExpr(a1, a2, box, obj);
}
} | [
"function letNameMouseDown(a1, a2, box, obj) {\r\n\r\n if (!Timer) {\r\n Timer = setTimeout(function() {\r\n Timer = null;\r\n editLetName(a1, a2, box, obj);\r\n },\r\n 300);\r\n }\r\n}",
"function addLetNameExpr(parentPath, childPos, box, obj) {\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets up the NNTP daemon object for use in fake server | function setupNNTPDaemon() {
var daemon = new nntpDaemon();
groups.forEach(function(element) {
daemon.addGroup(element[0]);
});
var article = new newsArticle(kSimpleNewsArticle);
daemon.addArticleToGroup(article, "test.subscribe.simple", 1);
return daemon;
} | [
"function start () {\n let node = process.execPath\n let daemonFile = path.join(__dirname, '../daemon')\n let daemonLog = path.resolve(untildify('~/.hotel/daemon.log'))\n\n debug(`creating ${startupFile}`)\n startup.create('hotel', node, [daemonFile], daemonLog)\n\n console.log(` Started http://localhost:${c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Here, we ask you to write a function that returns a copy of the function passed through, but sets the this value of the function's copy. | function returnNewFunctionOf(functionToBeCopied, thisValue) {
const copy = function(functionToBeCopied, thisValue) {
return thisValue
}
return copy
} | [
"function cloneFunction(func) {\n return function (...args) {\n return func.call(this, ...args);\n };\n}",
"function setThisWithApply(fn, thisValue, args) {\n return fn.apply(thisValue, args)\n}",
"function super_fn() {\n if (!oldFn) {\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========== ATTRIBUTES ========== disk_id computed: true, optional: false, required: false | get diskId() {
return this.getStringAttribute('disk_id');
} | [
"fake(disk) {\n disk = disk || this.getDefaultMappingName();\n if (!this.fakes.has(disk)) {\n this.logger.trace({ disk: disk }, 'drive faking disk');\n this.fakes.set(disk, this.fakeCallback(this, disk, this.getMappingConfig(disk)));\n }\n }",
"restore(disk) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toStopPosition() function The function will turn off all lights except the green light. After two and a half seconds, the green light will turn off and the yellow light will pulse every 300 milliseconds. After three and a half seconds, the yellow lights turns off and the red light comes on, thus back to the stop positi... | toStopPosition() {
console.log('[johnny-five] Proceeding with Stop Sequence.');
this.red.stop().off();
this.yellow.stop().off();
this.green.on();
setTimeout(() => {
this.green.off();
this.yellow.pulse(300);
}, 2000);
setTimeout(() => {
this.red.on();
this.yellow.st... | [
"toGoPosition() {\n console.log('[johnny-five] Proceeding with Go Sequence.');\n\n this.red.on();\n this.yellow.stop().off();\n this.green.stop().off();\n\n setTimeout(() => {\n this.yellow.on();\n }, 2000);\n\n setTimeout(() => {\n this.red.off();\n this.yellow.off();\n thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the moreorless wellcommented version of the Proportion Library's "machines" class. (c)2013 Neal McDonald, released under MIT License Use it however you like; have a nice day. There is only one class in this file. It defines the prMachines class, which provides functions All the functions implement machines or t... | function prMachines(pg) {
this.pg = pg; // the page in which the machines will operate
} | [
"function test() {\n var testCasino = new Casino(2, 20000);\n var testCasino1 = new Casino(1, 1000);\n var testCasino2 = new Casino(1, 1000);\n testCasino._showAllMachines();\n console.log(testCasino._getTotalAmountOfMoney());\n console.log(testCasino._getTotalNumberOfMachines());\n console.log... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initiates a factory reset and restarts. | requestFactoryResetRestart() {} | [
"function restart() {\n force.start();\n t = 1;\n }",
"function restart() {\n number = 60;\n start();\n }",
"function restartGame() {\n initAll();\n resetPlayer();\n toggleDice(false);\n}",
"restart() {\n this.snake = new Snake();\n this.arcadeStepIncrease = 0.001;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether the dates passed are equal in value. | function areDatesEqual(a, b) {
return sameValueZeroEqual(a.valueOf(), b.valueOf());
} | [
"function isDateEqual(a, b) {\n return (\n a instanceof Date &&\n b instanceof Date &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}",
"function sameDate(date1, date2) {\n return (date1.getDate() === date2.getDate()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |