query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Get a list of all package names in the depenency graph. | getAllDependencyNamesByLevelOrder(seedPatterns) {
const names = new (_set || _load_set()).default();
for (const _ref of this.getLevelOrderManifests(seedPatterns)) {
const name = _ref.name;
names.add(name);
}
return names;
} | [
"get packageNames() {\n return this.packageIds\n }",
"get dependencies() {\n let deps = [];\n\n this.packages.forEach(pkg => {\n deps.push(...Object.keys(pkg.allDependencies));\n });\n\n // Deduplicate dependencies\n return [...new Set(deps)];\n }",
"get allDeps() {\n var _a, _b;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create table cell with object magnitude | function create_mag_cell(mag) {
return $("<td>", {
class: "objects-mag",
}).append(
$("<span>", {
class: "objects-label",
text: "Mag:",
}),
$("<span>", {
text: String(mag),
})
);
} | [
"function createObjectTable(obj) {\n var heads = [], colWidths = [], vals = [];\n _.each(obj, function(v, k) {\n v = String(v);\n heads.push(k.replace(/(^|\\s)([a-z])/g, uppercaseRegexMatch));\n vals.push(v);\n var width = Math.max(strlen(k), strlen(v)) + 2;\n if (width > exports.maxTableCell) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the exposure of the frontmost document Potential DOM FIX | function setFrontmostExposure( exposure, gamma )
{
if (typeof(gamma) == "undefined")
gamma = 1.0;
args = new ActionDescriptor();
args.putInteger( classVersion, 3 );
args.putEnumerated( keyMethod, app.stringIDToTypeID( 'hdrToningMethodType' ),
app.stringIDToTypeID( 'hdrtype2' ) );
args.putDouble( key... | [
"function flashEditor() {\n\t\tvar scrollTop = doc.body.scrollTop || doc.documentElement.scrollTop;\n\t\tvar bodyClass = doc.body.className;\n\t\tvar editorOpacity = editor.style.opacity;\n\t\tvar editorTransform = editor.style.transform;\n\t\tdoc.body.className = 'edgeview';\n\t\teditor.style.transform = 'none';\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Merge successful result of deleting entities on the server that have the given primary keys Clears the entity changeState for those keys unless the MergeStrategy is ignoreChanges. | mergeSaveDeletes(keys, collection, mergeStrategy) {
mergeStrategy =
mergeStrategy == null ? MergeStrategy.OverwriteChanges : mergeStrategy;
// same logic for all non-ignore merge strategies: always clear (commit) the changes
const deleteIds = keys; // make TypeScript happy
co... | [
"deleteAllEntities() {\n // Consider switch to this[entityIds].forEach(id => this.deleteEntity());\n this[entityIds] = []\n this[componentRegistry].clear()\n }",
"async delete(_applySideEffects=true) {\n // Comprehend and validate this querys essence.\n let {conditions, retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
undefined because age is private and only accessible inside constructor. Example 2 | function Student2(name, age) {
var age = age;// This is private variable only accessible inside the constructor.
this.name = name;
this.getAge = function () {
return age;
};
} | [
"constructor(initialAge) {\n \n function initializeAge(age) {\n if (age < 0 ) console.log('Age is not valid, setting age to 0.');\n\n return (age > 0 ? age : 0);\n };\n\n this.age = initializeAge(initialAge); \n }",
"function getAge() {\n return _age;\n }",
"get age() {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns list of english voices: | function getEnglishVoices() {
englishVoices = [];
speechSynthesis.getVoices().forEach(function (voice) {
if (voice.lang.includes("en")) {
englishVoices.push(voice);
}
});
return englishVoices;
} | [
"function getVoices() {\n voices = speechSynthesis.getVoices(); // get array of speaking voices from speechSynethesis\n voices.forEach((voice) => {\n const option = document.createElement(\"option\"); // create option element\n option.value = voice.name; // impart value to option tag\n option.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ ignoreInteractions / / Setting 'ignoreinteractions' to false, will show results of / _a_posteriori_ multiple comparison tests for factors involved in / significant interactions with other factors. This is not the correct / behaviour | function ignoreInteractions() {
if ( ignoreinteractions === false ) ignoreinteractions = true;
else ignoreinteractions = false;
// In any case we should redo Post Hoc tests!
buildPostHocTests();
} | [
"function checkInteractions(td) {\n if (td.hasOwnProperty(\"interactions\")) {\n console.log('! Warning: interactions are from the previous TD Specification, please use properties, actions, events instead');\n }\n if (td.hasOwnProperty(\"interaction\")) {\n console.log('! Warning: interaction... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if a star has been clicked. | function starsClick() {
if (pub.hoveredBody > -1) {
pub.clickedBody = pub.hoveredBody;
pub.starsCircleDone = false;
pub.starsCenterDone = false;
pub.orbitsPhi = [];
pub.orbitCoords = [];
}
} | [
"function mouseClicked() {\n // If it has been clicked return true\n return true;\n }",
"function starClicked(e)\n{\n\tprivacyClicked = true;\n}",
"function checkStar(){\n\tif(currentDeck.currentCard.starred == 0 || currentDeck.currentCard.starred == null){\n\t\t$('#starCard').removeClass('star... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
listBlobHierarchySegment returns a single segment of blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. After getting a segment, process it, and then call listBlobsHierarchicalSegment again (passing the the previouslyreturned Marker) to get the next segment. | async listBlobHierarchySegment(delimiter, marker, options = {}) {
var _a;
const { span, updatedOptions } = createSpan("ContainerClient-listBlobHierarchySegment", options);
try {
const response = await this.containerContext.listBlobHierarchySegment(delimiter, Object.assign(Object.assi... | [
"async listBlobHierarchySegment(delimiter, marker, options = {}) {\n var _a;\n const { span, updatedOptions } = createSpan(\"ContainerClient-listBlobHierarchySegment\", options);\n try {\n const response = await this.containerContext.listBlobHierarchySegment(delimiter, Object.assign(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts set accessors at the specified index. | insertSetAccessors(index, structures) {
return this._insertProperty(index, structures, () => this._context.structurePrinterFactory.forSetAccessorDeclaration({ isAmbient: false }));
} | [
"insertSetAccessor(index, structure) {\r\n return this.insertSetAccessors(index, [structure])[0];\r\n }",
"setByIndex(index, value) {\n let key = this.getKeyByIndex(index);\n super.set(key, value);\n }",
"insertGetAccessors(index, structures) {\r\n return this._insertProperty(i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate whether a square should be high lighted | highLighted(i) {
for (let index = 0; index < this.props.WinnerSquares.length; index++) {
if (this.props.WinnerSquares[index] === i) {
return true;
}
}
return false;
} | [
"isLighter() {\n const yiq = (this.rgba.r * 299 + this.rgba.g * 587 + this.rgba.b * 114) / 1000;\n return yiq >= 128;\n }",
"function isLight(color) {\r\n return ((color.r * 299) + (color.g * 587) + (color.b * 114)) / 1000 >= 128;\r\n}",
"function isLight(color) {\n return (colo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Punkte aus CSVDatei importieren | function importPunkteCSV() {
var files = document.getElementById("importPunkteCSV").files;
if (files.length < 1) {
return;
}
var reader = new FileReader();
// Closure to capture the file information.
reader.onload = (function (theFile) {
return function (e) {
var stri... | [
"function parseCSVAndSaveInImportedFiles(csv) {\n //read csv mit jquerey.csv als Array of Strings\n let data = $.csv.toArrays(csv);\n //daten werden geparsed (an ; getrennt und in Array geladen)\n let parsed_data = parseDataStructure(data);\n //geparsete Daten werden in globale Variable geschrieben\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creating a spy on console.warn displayed by our app | function spyOnWarnings (t) {
t.context.warn = console.warn
console.warn = sinon.spy()
return console.warn
} | [
"warn() {}",
"static warn() {\n var str;\n str = Util.toStrArgs('Warning:', arguments);\n Util.consoleLog(str);\n }",
"function console_warn(message) {\n C.warn(message);\n}",
"function logWarning() {\n var _console3;\n\n if (!internalDebugValue && \"production\" === \"test\") {\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function runs a piece of generated Lidl code on a scenario and returns a trace | function run(code, scenario) {
var trans = new Function("data", code.partialSource.transitionFunction);
var init = new Function("data", code.partialSource.initializationFunction);
var trace = [init()];
// Execute LIDL system step by step
var i;
for (i = 0; i < scenario.length; i++) {
trace[i].inter = ... | [
"async function run() {\n const sdkClient = await sdk.init(\n process.env.LIGHTSTEP_ORGANIZATION, process.env.LIGHTSTEP_API_KEY)\n\n const streams = await sdkClient.listStreams({ project : process.env.LIGHTSTEP_PROJECT })\n\n // Select the first stream returned and get a trace\n const streamId = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a boolean depending on whether the scrollable element is at the end or at the start of the scrolling depending on the given type. | function isScrolled(type, scrollable){
if(type === 'top'){
return !scrollable.scrollTop();
}else if(type === 'bottom'){
return scrollable.scrollTop() + 1 + scrollable.innerHeight() >= scrollable[0].scrollHeight;
}
} | [
"function isScrolled(type, scrollable){\n\t\t\tif(type === 'top'){\n\t\t\t\treturn !scrollable.scrollTop();\n\t\t\t}else if(type === 'bottom'){\n\t\t\t\treturn scrollable.scrollTop() + 1 + scrollable.innerHeight() >= scrollable[0].scrollHeight;\n\t\t\t}\n\t\t}",
"function isScrolled(type, scrollable){\r\n\t\t\tif... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
On map layer hover: highlight associated table rows | function on_geojson_mouse_event(evtdata) {
const should_apply_highlight = evtdata.type === 'mouseover';
const index = data.features.indexOf(evtdata.layer.feature);
const tableRowEl = $('table tbody tr').get(index);
tableRowEl.classList.toggle('highlighted', should_apply_h... | [
"highlight(row){}",
"function highlightTables() {\r\n selectedCompanyIds.forEach(function(id) {\r\n $canvasMap.setLayer('table' + careerFairData.tableMappingList.get(\"companyId\", id).id + 'Box', {\r\n fillStyle: \"#0F0\"\r\n });\r\n });\r\n _.difference(filteredCompanyIds, sele... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ParseIncident: Basic XML parse to parse the Incident | function ParseIncident()
{
var IncidentDoc = new ActiveXObject("microsoft.XMLDOM");
try
{
IncidentDoc.load( g_szIncidentFile );
if ( IncidentDoc.parseError.reason != "")
{
alert( IncidentDoc.parseError.reason);
}
//
// Fetch the Upload data
//
var UploadData = IncidentDoc.documentElement.fir... | [
"function ParseIncident()\n{\n\tTraceFunctEnter(\"ParseIncident\");\n\tvar IncidentDoc\t= new ActiveXObject(\"microsoft.XMLDOM\");\n\t\n\ttry \n\t{\n\t if (g_IsIM)\n\t\t IncidentDoc.load( g_szIncidentFile );\n\t\telse\n\t\t IncidentDoc.loadXML (g_Blob);\n\t\t \n\t\tif ( IncidentDoc.parseError.reason != ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to reset pollutant selections. Called from the 'Reset Pollutant' button. | function resetPollClick() {
pollClick = false;
d3.selectAll("button.poll_reset").style("display", "none");
d3.selectAll(".mainBars").filter(function(d) {
return d.key == selPoll;
}).style("fill", '#0086b3').style('stroke', '#0086b3');
if (selState.length > 0) {
mapTitle.text(selRiskString + ' Assessme... | [
"resetSelections() {\n this.lastSelectedRadioButtonOption = null;\n this.setTabIndexes();\n this.options.forEach(option => {\n option.uncheck();\n option.enable();\n });\n }",
"function reset(){\n rndChoices = [];\n}",
"function resetFunction () {\n document.getElementById... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compute distance in miles between two lat/lon points | function distanceInMiles(lat1, lon1, lat2, lon2) {
if(lat1 == lat2 && lon1 == lon2)
return 0.;
var rad = 3963.;
var deg2rad = Math.PI/180.;
var ang = Math.cos(lat1 * deg2rad) * Math.cos(lat2 * deg2rad) * Math.cos((lon1 - lon2)*deg2rad) + Math.sin(lat1 * deg2rad) * Math.sin(lat2 * deg2rad);
ret... | [
"function toMiles(lat1, lon1, lat2, lon2){ \n var R = 6378.137; \n var dLat = (lat2 - lat1) * Math.PI / 180;\n var dLon = (lon2 - lon1) * Math.PI / 180;\n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) *\n Math.sin(dLon/2) * Ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this takes a function string and executes it | function exec_fun_str(func_str) {
//
var funs = func_str.split(';');
for (var i = 0; i < funs.length; i++) {
if (trim(funs[i]) === '') { continue;}
//
var m = funs[i].match(/([A-Z_]+)[(](.*?)[)]/i);
var name = m[1];
var args = m[2].split(',');
//
for (... | [
"function execute_string(string)\n{\n eval(string);\n}",
"function runYourString (arg, obj) {\r\n var fn = new Function (obj.param, obj.func);\r\n return fn(arg);\r\n}",
"function executeFuncOrString(func) {\n\tif (\"function\" == typeof func) {\n\t\tfunc();\n\t} else {\n\t\tglobalEval(func);\n\t}\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add bucket/hole to the environment | setupBucket() {
const EPS = 0.05;
const edgeOffset = 10.0;
const bucket = new Bucket();
bucket.position.set(
this.terrain.terrainWidth / 2.0 - edgeOffset,
this.terrain.terrainDepth + EPS,
-this.terrain.terrainHeight / 2.0 + edgeOffset
);
... | [
"addEnvironment(env) {\n if(this.environments.indexOf(env) === -1)\n {\n this.environments.push(env);\n this.registry[env] = {};\n }\n }",
"addBucket(bucket) {\n this.bucketsToAdd.push(bucket);\n }",
"function createBucket() {\n metadata\n .buckets.set(bucketName, new Buc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to update the srcs when we have a new set of images | function updateSrcs() {
$('#img1').attr('src', gifArray[championIndex]);
$('#img2').attr('src', gifArray[challengerIndex]);
} | [
"function updateImage() {\n newSrc = images[index];\n $('#image').attr('src', newSrc);\n}",
"function loadImages(){\n for(var i = 0; i < images.length; i++){\n setImageSrc(images[i]);\n }\n }",
"function repopulateImages() {\r\n const dateNow = Date.now();\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts canvas x value to percentage of canvas width | function pctFromXVal(xValue) {
return xValue * 100 / canvas.width;
} | [
"function xValFromPct(percent) {\n return percent * canvas.width / 100;\n}",
"xCoordToPercent(x) {\n x -= this.$parent.offset().left; // pixel position\n const max = this.$parent.innerWidth();\n return Number(((x / max) * 100).toFixed(2)); // round to 2 decimal places\n }",
"function px_x(percent){\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates the dropdown menu items based on the array that is passed in | function departmentDropdownHandler(arr) {
// loops through the given array and adds the department to the dropdown list
for (let i = 0; i < arr.length; i++) {
let a = document.createElement('a');
a.classList.add('dropdown-item');
a.href = '#';
a.innerText = arr[i].name;
... | [
"async _constructDropdownMenu() {\n let response = await this._getLabelPrefixes();\n let dropdownOptions = ['None', 'Component', 'Is open', 'Status', 'Owner'];\n dropdownOptions = dropdownOptions.concat(response);\n const dropdownHTML = dropdownOptions.map((str) => html`\n <option class='menu' @cli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saving the company site has to be in done in a particular order and if one step fails we should prevent other steps from executing, hence the noop catch in the end to allow previous rethrown rejections to be ignored after processing this promise chain. | function saveCompanySite() {
return $q.when(true)
.then(displayDisableVoicemailWarning)
.then(saveCustomer)
.then(saveSite)
.then(saveAutoAttendantSite)
.then(updateCustomerVoice)
.then(updateVoicemailUserTemplate)
.then(saveVoicemailToEmail)... | [
"function saveForm() {\n return saveCompanySite()\n .then(saveInternalNumbers);\n }",
"savePolicy(model) {\n return __awaiter(this, void 0, void 0, function* () {\n throw new Error('not implemented');\n });\n }",
"_save(order, postSave) {\n if (this.order.st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse a type URI (e.g., " or " and return a displayable string from it (e.g., "Male" or "Aunt Or Uncle"). Removes the URL path, and separates capitalized letters with a space. | function parseType(typeUri) {
return typeUri === null || typeUri === undefined ? "(No type)" :
typeUri.
// Remove everything up to the last "/"
replace(/.*\//gi, "").
// Insert spaces before capitals, e.g., "SomeType" -> "Some Type"
replace(/([A-Z])/g, '$1');
} | [
"function normalize(type) {\n\tif (!type) {\n\t\treturn '';\n\t}\n\n\t// clean up content type (drop the parameters, such as charset)\n\t// ref: http://www.w3.org/Protocols/rfc1341/4_Content-Type.html\n\tif (type.indexOf(';') > 0) {\n\t\ttype.split(';').some(function(part) {\n\t\t\tif (part.indexOf('/') > 0) {\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle the cart/submit buttons click event When the buttons are pressed we need to wait until flyout element is visible before injecting the progress bar | function handleCartButton(event){
// Utility method for executing a callback when an element is loaded to the DOM
// Needs a MAX_TRIES config to avoid setting the timeout indefinitely
// if the element is never loaded
const MAX_TRIES = 10;
let counter = 0;
const waitForEl = (selector, callback) => {
cons... | [
"function clickedButton(e) {\n // WHEN DONE:\n if (listOfIds.length !== 0) {\n // each calibration button is popped out of the list one-by-one.\n // it is set to fade in.\n $('#' + listOfIds.pop()).show();\n } else {\n if (!dataIsSent) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the embedded shadow elements | get shadowElements() {
let shadowElements = this.querySelectorAll("*")
.filter(item => item.hasShadow);
let mapped = (shadowElements.allElems() || []).map(element => element.shadowRoot);
return new DomQuery(...mapped);
} | [
"function getInnerElements() {\n return [instance.popperChildren.tooltip, instance.popperChildren.backdrop, instance.popperChildren.content];\n }",
"getFocusableElements() {\n return queryShadowRoot(this, isHidden, isFocusable);\n }",
"function getInnerElements() {\n return [instance.popperCh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the beta license agreement for a specific app. | function readBetaLicenseAgreementForApp(api, id, query) {
return api_1.GET(api, `/apps/${id}/betaLicenseAgreement`, { query })
} | [
"function readAppInformationForBetaLicenseAgreement(api, id, query) {\n return api_1.GET(api, `/betaLicenseAgreements/${id}/app`, { query })\n}",
"function readBetaLicenseAgreementInformation(api, id, query) {\n return api_1.GET(api, `/betaLicenseAgreements/${id}`, { query })\n}",
"function getAppResource... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new fragment containing the combined content of this fragment and the other. | append(other) {
if (!other.size)
return this;
if (!this.size)
return other;
let last = this.lastChild, first2 = other.firstChild, content = this.content.slice(), i = 0;
if (last.isText && last.sameMarkup(first2)) {
content[content.length - 1] = last.withText(last.text + first2.text);
... | [
"function WithFragments() {}",
"appendTo(node) {\n node.appendChild(this.fragment);\n }",
"addToEnd(node) {\n return new Fragment(this.content.concat(node), this.size + node.nodeSize);\n }",
"appendTo(node) {\n node.appendChild(this.fragment);\n }",
"addToStart(node) {\n return new Frag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add opened menu id to cookie | function addOpenMenuItemIdToCookie(menuItemId)
{
var openMenuItemIds = get_cookie('openMenuItemIds');
if (openMenuItemIds)
{
if (openMenuItemIds.indexOf(menuItemId) == -1)
openMenuItemIds += ";"+menuItemId;
}
else
openMenuItemIds = menuItemId;
set_cookie('openMenuItemIds', openMenuItemIds,... | [
"function addOpenMenuItemIdToCookie(menuItemId)\n{\n\tvar openMenuItemIds = get_cookie('openMenuItemIds');\n\tif (openMenuItemIds)\n\t{\n\t\tif (openMenuItemIds.indexOf(menuItemId) == -1)\n\t\t\topenMenuItemIds += \";\"+menuItemId;\t\n\t\t\t\t\n\t}\n\telse\n\t\topenMenuItemIds = menuItemId;\n\tset_cookie('openMenuI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
justs :: (Filterable f, Functor f) => f (Maybe a) > f a . . Discards each element that is Nothing, and unwraps each element that is . a Just. Related to Haskell's `catMaybes` function. . . See also [`lefts`](lefts) and [`rights`](rights). . . ```javascript . > S.justs ([S.Just ('foo'), S.Nothing, S.Just ('baz')]) . ['f... | function justs(maybes) {
return map (prop ('value')) (filter (isJust) (maybes));
} | [
"function justs(maybes) {\n return map (value) (filter (isJust) (maybes));\n }",
"function catMaybes(ls){\r\n var acc = [];\r\n for(var i = 0, l = ls.length; i < l; ++i)\r\n if(ls[i].Just)\r\n acc.push(ls[i][0]);\r\n return acc;\r\n}",
"function compact(arrOrObj, opt_filterOutNoth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Does not work. Do not need this yet but I may need to loop through the devData.repositories and write out each individually? | function updateRepository(devData) {
console.log('6g. in updateRespository')
if (devData) {
let repoDevData = {
repoName: devData.name,
repoDesc: devData.description,
activeFlag: false,
archiveFlag: false,
deploymentLink: "",
imageLink: "",
html_url: devData.html_url,
... | [
"function processRepositories() {\n var deps = grunt.config.get('dependencies');\n var newDeps = [];\n\n // Iterate over dependencies and apply all kinds of mappings\n deps.forEach(function (dependency) {\n dependency = mapLegacyDependencyConfig(dependency);\n newDe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getCurrentBoardTokenPositions Returns an array with the current tokens values in the board Returns: [Array] An array of the current token values in all the board spaces | function getCurrentBoardTokenPositions() {
let $boardPositionElements = $('[data-board-position]');
return $boardPositionElements.map((i) => {
let $boardSpace = $($boardPositionElements[i]);
return $boardSpace.attr('data-user-token');
});
} | [
"function getCurrentBoardValues() {\n var board = getCurrentBoardTokenPositions();\n var winningCombinationBoardValues = [];\n\n for (var boardRow = 0; boardRow < winningCombinationIndexes.length; boardRow++) {\n var valuesBoardRow = [];\n\n for (var boardSpaceIndex = 0; boardSpaceIndex < winningCombinatio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fail callback to tell us that wifi isn't working | function wifiFail(params){
displayOutput("No Wifi available - should fall back on GPS satellite chip");
doGeo(params);
} | [
"function noNetworkDetected(){\n //We have no network and the current network status in the app is network, meaning we have to switch to local load and load local tiles\n if(networkMode == \"network\"){\n onOffline();\n }\n else{\n console.log(\"No network change or unknown error\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct a factory function expression for the given `R3FactoryMetadata`. | function compileFactoryFunction(meta) {
var t = variable('t');
var statements = [];
// The type to instantiate via constructor invocation. If there is no delegated factory, meaning
// this type is always created by constructor invocation, then this is the type-to-create
// parameter provided by the ... | [
"function compileFactoryFunction(meta) {\n var t = variable('t');\n var statements = [];\n // The type to instantiate via constructor invocation. If there is no delegated factory, meaning\n // this type is always created by constructor invocation, then this is the type-to-create\n // parameter provid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all companies in database. queries may contain optional filters | static async all(queries) {
console.debug('Class Company all - Start');
// Throw error if query parameter min employees greater than or equal
// to max_employees
if (+queries.min_employees >= +queries.max_employees) {
throw new ExpressError(
'Query parameters are invalid. Minimum number of employees mus... | [
"getAll() {\n let query = `\n query{\n companies{\n slug\n title\n platform\n description\n }\n }\n `;\n return this._GQL.get(query);\n }",
"getallcompanylist(ctx) {\n\n return this.adapter.find({});\n }",
"function ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Amazon Marker Function I have declared an insertAmazonMarker function, which then consists of multiple data inputs | function insertAmazonMarker(map) {
// Amazon Location
var AmazonLocation = new google.maps.LatLng(47.626444, -122.337627);
var AmazonLocationMarker = new google.maps.Marker({
position: AmazonLocation,
icon: {
url: "http://maps.google.com/mapfiles/ms/icons/red-dot.png",
... | [
"function create_marker(dataRow)\n{\n\tvar lat = dataRow['bl.lat'];\n\tvar lon = dataRow['bl.lon'];\n\tvar pk = dataRow['ls.ls_id'];\n\t//var tn_name = dataRow['ls.tn_name'];\n\t//var amount_base_rent = dataRow['ls.amount_base_rent'];\n\t//var area_negotiated = dataRow['ls.area_negotiated'];\n\t//var date_end = dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform the requested persistence operation and return a scalar Observable that the effect should dispatch to the store after the server responds. | persist(action) {
if (action.payload.skip) {
// Should not persist. Pretend it succeeded.
return this.handleSkipSuccess$(action);
}
if (action.payload.error) {
return this.handleError$(action)(action.payload.error);
}
try {
// Cance... | [
"getResponseData$(crid) {\n /**\n * reducedActions$ must be replay observable of the most recent action reduced by the store.\n * because the response action might have been dispatched to the store\n * before caller had a chance to subscribe.\n */\n return this.reducedA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
replace character in string | function replaceChar(text,char,byChar)
{
for(var i=0;i<text.length;i++)
{
text=text.replace(char,byChar);
}
return text;
} | [
"function replaceCharacter(str) {\n var newString = str.replace(/-/g , \"_\");\n return newString;\n }",
"function replaceInString(string, character, characterToReplace){\n var newString = \"\";\n for(var i = 0; i < string.length; i++) {\n if(string[i] === character) {\n newString +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks whether the specified login name belongs to a valid user in the web. If the user doesn't exist, adds the user to the web. | ensureUser(loginName) {
const postBody = jsS({
logonName: loginName,
});
return this.clone(Web_1, "ensureuser").postCore({ body: postBody }).then((data) => {
return {
data: data,
user: new SiteUser(odataUrlFrom(data)),
}... | [
"function IsAccountValid(login_name, login_password){\n // TODO: Need to add logic to check user provided login credential with database\n // login match - return true\n // login does not match - return false\n \n // remove below line after above logic is added\n return true;\n}",
"function chec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a new array instance containing the annotation objects optionally filtered by line number. | getAnnotations(editor, lineNumber=null) {
const relativePath = this._relativeEditorPath(editor)
if (relativePath in this.annotations) {
if (lineNumber == null) {
return [...this.annotations[relativePath]]
}
else {
return this.annotation... | [
"adjustedAnnotations() {\n return this.file.annotations.map(annotation => annotation.adjusted(this.offset));\n }",
"function processAnnotations( buffer2 ) {\r\n var textLines = buffer2.split(/\\r\\n|\\n/);\r\n //var fields = textLines[0].split(',');\r\n var jsonLine;\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
====================================== Competition Tooltip ========================================= | function SetupCompetitionTooltip(){
// http://qtip2.com/
$('.icon1').each(function() {
$(this).qtip({
content: {
text: '<div class="tooltipText">' + $(this).data("summary") + '</div>'
},
position: { my: 'lefttop', at: 'rightmiddle' },
sty... | [
"function overSkill0() {\r\n\tget(\"tooltip-display\").style.display = \"block\";\r\n\tget(\"tooltip-text\").innerHTML = skillsDescArray[0]\r\n}",
"function customToolTip(date, game) {\n\treturn '<div id=\"plot-tool-tip\">' +\n\t\t\t\t'<div class=\"bold\">' + date.toString().substring(0,15) + '</div>' + // date\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Traverses specific expression types and marks a CallExpression in tail position | function markTailCall(expr) {
if (expr.type === "CallExpression") {
expr.isTailCall = true;
} else if (expr.type === "SequenceExpression" && expr.expressions.length > 0) {
return markTailCall(expr.expressions[expr.expressions.length - 1]);
} else if (expr.type === "LogicalExpression") {
if (expr.operator... | [
"function markTailCall(expr) {\n\t\tif (expr.type === \"CallExpression\") {\n\t\t\texpr.tailCall = true;\n\t\t} else if (expr.type === \"SequenceExpression\" && expr.expressions.length > 0) {\n\t\t\treturn markTailCall(expr.expressions[expr.expressions.length - 1]);\n\t\t} else if (expr.type === \"LogicalExpression... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ m1 previous moon position / m2 next moon position / s1 previous sun position / s2 next sun position / / Test for conjunction of the sun and moon / m1,s1 is in one time moment / m2,s2 is in second time moment / / this function tests whether conjunction occurs between / these two moments | static IsConjunction(m1, s1, s2, m2) {
if (m2 < m1)
m2 += 360.0;
if (s2 < s1)
s2 += 360.0;
if ((m1 <= s1) && (s1 < s2) && (s2 <= m2))
return true;
m1 = GCMath.putIn180(m1);
m2 = GCMath.putIn180(m2);
s1 = GCMath.putIn180(s1);
s2 = GCMath.putIn180(s2);
if ((m1 <= s1) && (s1 < s2) && (s2 <= m2))... | [
"oppositeMoves(m1, m2) {\n return (\n !!m1 &&\n m2.appear[0].c == \"c\" &&\n m2.appear.length == 1 &&\n m2.vanish.length == 1 &&\n m1.start.x == m2.end.x &&\n m1.end.x == m2.start.x &&\n m1.start.y == m2.end.y &&\n m1.end.y == m2.start.y\n );\n }",
"oppositeMoves(m1,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ParaBg Paralax segment of page that shows a picture in the background and a button that goes to the online RSVP form | function ParaBg() {
const insideStyles = {
backgroundColor: "#FFE8D6",
padding: 40,
position: "absolute",
top: "50%",
left: "20%",
};
function rsvp(){
window.open("https://9r0d4g8jfji.typeform.com/to/C4r4Zibb")
}
return (
<Parallax bgImage={matches} strength={300}>
<Fade c... | [
"drawPage(){\n image(this.curPage, this.x, this.y, this.width, this.height);\n if (this.comicEnd){\n fill(BLACKTINT);\n rect(center_x-140, 558, 280, 30, 10);\n fontStyle(20, \"#ddd\", CENTER, BOLDITALIC);\n text(\"Press Space to Continue\", center_x, 580);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns combined image collection for a given area | function getImages(bounds) {
var start = '2000-01-01'
var stop = '2019-01-01'
//var bounds = catchments.geometry().dissolve(10000).buffer(10000).simplify(50000)
//print(bounds)
//Map.addLayer(bounds)
var images = assets.getImages(bounds, {
resample: true,
missions: [
'L5',
'L4', ... | [
"function getImageCollection(compositeArea,startDate,endDate,startJulian,endJulian){\n\t\tvar ls;var l4TOAs;var l5TOAs;var l7TOAs;var l8TOAs;\n\t\tvar metadataCloudCoverMax = 80;\n\t\tvar sensorBandDictLandsatTOA =ee.Dictionary({L8 : ee.List([1,2,3,4,5,9,6]),\n\t\t\t\t\t\t\tL7 : ee.List([0,1,2,3,4,5,7]),\n\t\t\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Is Admin Channel Is Game Channel | function isGameChannel(msg) {
if(msg.channel.name == undefined) {
return false;
}
var channel = msg.channel.name;
var gameChannels = serverConfig.gameChannels;
// Cross reference channel vs gameChannels
for(var a = 0; a < gameChannels.length; a++) {
if(channel == gameChannels[a]) {
return true;
}
}
ret... | [
"function isBotChannel() {\n\t\treturn ((message.channel.id === setting.salonBotId));\n\t}",
"hasChannel() {\n return this.channel.id ? true : false;\n }",
"function isBotTurn(){\r\n return !isUserTurn();\r\n}",
"function doesOwnChannel (core, channelName, trip) {\n\tif (channelHasOwner(core, chann... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the LocalStorage of a task, either on click of the check box or when called from the updateCompleteTasks method | function updateTask(checkBox) {
var task = checkBox.closest("task");
var text = task.getElementsByTagName("text");
var keys = Object.keys(localStorage);
var tasks = [];
for (var i = 0; i < keys.length; i++) {
tasks.push(localStorage.getItem(keys[i]));
}
... | [
"function update_task(task_id,task_status)\n{\n var task = JSON.parse(localStorage.getItem(task_id));\n task.done = task_status;\n localStorage.setItem(task_id,JSON.stringify(task));\n\n}",
"updateTask() {\n\t\tthis.wLocalStorage.addData(\"feedback\", false);\n\t\tlet task = this.wLocalStorage.getData(\"task\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get list of custom training schedule | getListCustomTrainingSchedule(qParams) {
return this.request.get('/training-dates', qParams);
} | [
"getListTrainingSchedule(qParams) {\n return this.request.get('/training-info', qParams);\n }",
"get schedules() {\n return Array.from(this._schedules.values());\n }",
"function createTrainSchedule(firstTrainTotalMin, frequency) {\n \n // Need to reset these values to create new schedule array.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replaces 'WEEK_DAY_NAME' and 'MONTH_NAME' with dynamic contents in element '.topNavtitle' | function setTodayTitle(el) {
var subTitleEl = el.querySelector('.topNav-title');
var innerText = subTitleEl.innerText;
innerText = innerText.replace("--WEEK_DAY_NAME--", utils.getWeekDay());
innerText = innerText.replace("--MONTH_NAME--", utils.getMonthName());
subTitleEl.innerT... | [
"function fillWeekTitle(){\n\tvar str = starttime;\n\tvar title;\n\tvar tempId ;\n\tvar weekTimeShow;\n\tvar titleDate = new Date(str.split(\"-\")[0],(str.split(\"-\")[1]-1),str.split(\"-\")[2].split(\" \")[0]);\n\tfor(var i=1;i<=7;i++){\n\t\ttempId = \"weektitle_\"+i;\n\t\ttitle = weekDays[i-1] ;//+ titleDate.getY... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
write function that returns shortest of the words in the given array | function getShortest(wordArray) {
} | [
"function findMinWord(arr) { \r\n \r\n arr.sort((a, b) => a - b);\r\n return arr[0];\r\n \r\n}",
"function getShortest(wordArray) {\n let minlength = wordArray[0].length;\n let shortString = wordArray[0];\n for (let i of wordArray){\n if (i.length < minlength){\n minlengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the steps feild from the dataObject | function getStepsStructure(dataObject){
var structure = dataObject["structure"];
var steps = structure["steps"];
return steps;
} | [
"get steps () { return this.data.steps }",
"function getSteps(){\n var result = Workflow.callMethod(\"AbBldgOpsHelpDesk-StepService-getSteps\");\n \n if (result.code == 'executed') {\n steps = eval('(' + result.jsonExpression + ')');\n }\n else {\n Workflow.handleError(result);\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write XML string of preferences | function SetSamplePreferences()
{
var doc = xmldso.XMLDocument;
var strRoot = "<" + SAMPLE_ROOT + "></" + SAMPLE_ROOT + ">";
doc.loadXML(strRoot);
var root = doc.documentElement;
var elem = doc.createElement(SAMPLE_ONE_TAG);
elem.text = m_Enable_Logging;
root.appendChild(elem);
elem = doc.cre... | [
"function writePreferences(context, preferences) {\n // read manifest\n const manifest = getManifest(context);\n\n // update manifest\n manifest.file = updateNightSteedMetaData(manifest.file, preferences);\n\n // save manifest\n xmlHelper.writeJsonAsXml(manifest.path, manifest.file);\n }",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
in the constructor we provide SharedCustomerDataService for service and Router for routing to another components | function GetAllCustomersComponent(_sharedDataService, _router) {
this._sharedDataService = _sharedDataService;
this._router = _router;
} | [
"function UpdateCustomerComponent(_sharedDataService, _router, _route, _formBuilder) {\n this._sharedDataService = _sharedDataService;\n this._router = _router;\n this._route = _route;\n this._formBuilder = _formBuilder;\n this.customerUpdate = new _Common_Customer__WEBPACK_IMPORT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connect to a remote host using privateKey auth via sshagent. | connectToRemoteHost (host, cb) {
let config = {
host: host.Hostname,
dstPort: DST_PORT,
localPort: LOCAL_PORT,
username: host.User,
agent: process.env.SSH_AUTH_SOCK
}
this.tunnel = tunnel(config, (err) => {
if (err) return cb(err)
this.client = redis.createClient(co... | [
"async connectSSH() {\n console.log('Connecting to SSH client');\n await this.ssh.connect({\n host: this.host,\n username: this.username,\n password: this.password\n });\n console.log('ssh connection eztablished:');\n }",
"function ssh_connect(options) {\n let client = new ssh2.Clie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a word or prhase, produce something that RiTa will interpret as the way that phrase would be spoken. RiTa doesn't care much for punctuation. Remove it. A string of all caps is assumed to be spoken as a series of letters. Right for NFL, wrong for NASCAR. Words made of both letters and digits are split apart into c... | function makespeakable(phrase) {
phrase = phrase.replace(/['"]/g, "");
phrase = phrase.replace(/[-+]/g, " ");
phrase = phrase.replace(/([A-Z])(?=[A-Z])/g, "$1 "); //split apart capitals
phrase = phrase.replace(/([A-Za-z])([0-9])/g, "$1 $2"); // split letter-number
phrase = phrase.replace(/([0-9])([A-Za-z])... | [
"function convertWord(letter) {\n if (letter === \"r\") return \" The Rock\";\n if (letter === \"p\") return \"Paperboy\";\n return \"Edward Scissorhands\";\n\n }",
"function normalizedWord(word){\n if ( isAnswer(word) == false) {\n //alert('aaa');\n return wor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decide sort class to add based on sort order | function sortClassToAdd(SortOrder){
var classtoAdd = ""
if(SortOrder == 0){
classtoAdd = "headerSortUp";
} else {
classtoAdd = "headerSortDown";
}
return (classtoAdd);
} | [
"function addSortIndicators() {\n getNthColumn( currentSort.index ).className += currentSort.desc ? ' sorted-desc' : ' sorted'\n }",
"function addSortIndicators () {\r\n getNthColumn( currentSort.index ).className += currentSort.desc ? ' sorted-desc' : ' sorted';\r\n }",
"function addSortInd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Be Slidey Transition Suite | function BeSlideyTransitionSuite () {
var self = this;
this.props = {};
this.register("slidey-x", function (newval, oldval) {
if( !isValidNumString(newval) ) return false;
newval = isValidNum(newval) ? newval.toString() + "px" : newval;
self.props["left"] = newval;
});
this.register... | [
"function AppTransitions() {}",
"function pageTransition() {\n let tl = gsap.timeline();\n\n tl.to('.transition-item', {\n duration: 0.3,\n scaleY: 1,\n transformOrigin: 'bottom left',\n stagger: 0.15,\n ease: 'power2.easeInOut',\n });\n tl.to('.transition-item', {\n duration... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves all saved charts from the database. | function getAllBarChartObjects(){
itemDB.open("BarChartDatabase", 1, "barchartDatastore", "", barchartIndexes, true, function(result){
let db = result;
itemDB.fetchAll(db, "barchartDatastore", function(results){
displayListOfBarCharts(results);
});
});
} | [
"function displaySavedCharts(){\n var chartsObj = getAllChartObjects();\n displayListOfCharts(chartsObj);\n}",
"function getAllChartObjects(){\n itemDB.open(\"BarChartDatabase\", 1, \"barchartDatastore\", \"\", barchartIndexes, true, function(result){\n let db = result;\n itemDB.fetchAll(db, \"barchartDa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load rules from rules.json file using HTTP request | function loadContent() {
httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState === XMLHttpRequest.DONE) {
if (httpRequest.status === 200) {
let rules = JSON.parse(httpRequest.responseText);
displayRules(r... | [
"loadRules() {\n var fs = require(\"fs\");\n var temp = JSON.parse(fs.readFileSync(this.path).toString());\n Object.keys(temp).forEach(key => {\n this.rules.set(key, temp[key]);\n });\n }",
"getRules() {\n request.get('https://' + this.host + '/rules?key=' + this.k... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Triggers all registered auth state change listeners. | runAuthChangeHandler() {
for (var i = 0; i < this.authObservers_.length; i++) {
this.authObservers_[i](this['currentUser']);
}
} | [
"setAuthListeners() {\n // Listen for sign-in state changes.\n gapi.auth2.getAuthInstance().isSignedIn\n .listen(isSignedIn => this.updateSigninStatus(isSignedIn))\n\n // Handle the initial sign-in state.\n this.updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get())\n }",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allows user to press Enter key on Keyboard to submit their location | function submitWithEnterKey() {
checkValue();
if (event.keyCode === 13)
$('#findLocationButton').click();
} | [
"function searchForLocationIfEnter(e){\n\tvar c = document.all? event.keyCode : e.which;\n if(c == 13) \n\t{\n\t\tsearchForLocation();\n\t\treturn false;\n\t}\n return true;\n}",
"function enterPressAddressBox(e)\n{\n\tif(e.keyCode == 13)\n\t{\n\t\tgeoCodeAddress();\n\t}\n}",
"_onKeyDown(e) {\n if (e.k... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instead of doing a deep copy of oldSolid we just do a fromString(oldSolid.toString()) | duplicateFrom(oldSolid) {
this.fromString(oldSolid.toString(), oldSolid._octree.boundingBox.edge)
} | [
"makeObjectSolid(objectName) {\n\n const transparentObjectNames = [...this.state.transparentObjectNames];\n const index = transparentObjectNames.indexOf(objectName);\n\n if (index !== -1) {\n\n transparentObjectNames.splice(index, 1);\n\n this.setState({\n transparentObjectNames: transpare... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will be called twice during a transition between two views: once when the transition is at the point that neither view is visible, and once when the view being transitioned to has fully loaded. These two calls may happen in either order, but at least one (expectedly the former) needs to contain an argumen... | function animationReady(revealContent) {
if (continueAnimation) {
if (angular.isDefined(revealContent)) continueAnimation = revealContent;
continueAnimation.run(continueAnimation.args);
continueAnimation = false;
} else if (angular.isDefined(reveal... | [
"handlePreviewToVisibleTransition_() {\n const advancementType = this.advancement_?.getType();\n devAssert(\n advancementType === AdvancementConfigType.TIME_BASED_ADVANCEMENT,\n 'The advancement is expected to be time-based in preview mode'\n );\n\n // Here, we store the progress values of the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new Revision, saving all Entries' current versions to a new versioned document. | static async create(name) {
const newRevisionIndex = (await this.getLatestRevisionIndex()) + 1
const newRevision = new this({
_id: newRevisionIndex,
name: name || `Revision started on ${(new Date()).toLocaleString()}`,
})
await newRevision.save()
... | [
"static async createInitialRevision() {\n\n if (await this.count() === 0) {\n \n const initialRevision = await this.create()\n console.log(`Initial Revision created: ${initialRevision.name}`)\n console.log('-----------------------------------')\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers a named hook in the `hook` stack | function register_hook (hook, name, callback) {
Hooks[hook].push({name: name, callback: callback});
} | [
"addHook(hook) {\n this.hooks.push(hook);\n }",
"addHook(hook) {\n this.log(`Adding ${ hook.name }`);\n\n this.hooks.push(hook);\n\n this.log(`Added ${ hook.name }`);\n }",
"push(name, handler) {\n const hooks = this.init(name);\n this.set(name, [...hooks, handler]);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
detects value overlaps between maps | function detectOverlap(map, roomMap, value = 0) {
for(let roomY = 0; roomY < roomMap.room.length; roomY++) {
for(let roomX = 0; roomX < roomMap.room[roomY].length; roomX++) {
if (map[roomMap.coordY + roomY][roomMap.coordX + roomX].cellValue == value && roomMap.room[roomY][roomX].cellValue == val... | [
"function detectOverlaps() {\n //TODO\n}",
"function get_overlap(maps){\r\n let year_dict = {};\r\n let min, max;\r\n // Calculate which months have maps.\r\n for (let i = 0; i < maps.length; i++) { // For each map\r\n for (let j = maps[i][0]; j <= maps[i][2]; j++){ // Between start year and... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Free up enough room to download the given chunk. If includeInProgressChunks is true then chunks that are downloading or about to be are treated as if they have already landed when checking for available space. This prevents overshooting the buffer's byte limit. returns true if we are able to free up enough room | function _tryMakeRoom(chunkInfo, includeInProgressChunks) {
debug$assertPositiveInt(_maxBufferBytes);
var requestedSize = chunkInfo.length;
var availableSize = _maxBufferBytes - _getTotalBytes(includeInProgressChunks);
if (availableSize > requestedSize) {
// there is room in... | [
"allChunksDownloaded() {\n for (let i = this.receivedBuffer - 1; i >= 0; i--) {\n if (!this.receivedBuffer[i]) {\n return false;\n }\n }\n\n return true;\n }",
"function _isBufferFull() {\n return _getNormalizedBufferLength() >= 0.9 || _haveDownloadedRemainingMedia();\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Forge wordreference url word : word to translate format : type of result : html or json. Default empty for html | function createTranslationUrl(word, format="", sourceDest = undefined) {
var language = sourceDest || prefs.prefs["translate.source"]+prefs.prefs["translate.destination"];
return "http://api.wordreference.com/b583b/"+format+"/"+language+"/"+word;
} | [
"function getDefinition(word) {\n $.ajax({\n type: \"GET\",\n url: \"http://api.wordnik.com:80/v4/word.json/\"+word+\"/definitions?limit=200&partOfSpeech=noun&includeRelated=false&sourceDictionaries=all&useCanonical=true&includeTags=false&api_key=a2a73e7b926c924fad7001ca3111acd55af2ffabf50eb4ae5\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compare two scenario results to indicate if it's faster or slower. It considers the error margin, and returns 0 if the difference is in the error margin. It returns a percent of progress. | function compareScenarioResults(
result: ScenarioResult,
previous: ScenarioResult
): number {
const error = Math.max(result.error, previous.error);
const difference = (previous.time - result.time) * 100 / previous.time;
if (Math.abs(difference) <= error) {
return 0;
}
return differ... | [
"compareSteps(a, b) {\r\n\t\treturn b.score - a.score;\r\n\t}",
"function percentDifference (value1, value2) {\n value1 = parseFloat(value1, 10);\n value2 = parseFloat(value2, 10);\n \n var result = ((value1 - value2)/((value1 + value2)/2))*100; \n return result;\n}",
"function percentDiff(num1, num2) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onlyUnique / Given a string, remove any characters that are not unique from the string. | function onlyUnique(str) {
// YOUR CODE HERE
let uniqStr = '';
for (let i = 0; i < str.length; i++) {
if (uniqStr.indexOf(str.charAt(i)) === -1) uniqStr += str[i];
}
return uniqStr;
} | [
"function uniqueChars(str) {\n return str.split('').filter(function(item, i, ar){ return ar.indexOf(item) === i; }).join('');\n}",
"function uniqueCharacters (string) {\n\tvar result = '';\n\tvar str = string.split('');\n\tfor (var i=0; i<str.length; i++) {\n\t\tif (result.indexOf(str[i]) === -1) {\n\t\t\tresult... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a unique constraint for one or more columns. The constraint name can be anything you want, but it must be unique across the whole database. Examples ```ts addUniqueConstraint('first_name_last_name_unique', ['first_name', 'last_name']) ``` | addUniqueConstraint(constraintName, columns) {
return new CreateTableBuilder({
...this.#props,
node: create_table_node_js_1.CreateTableNode.cloneWithConstraint(this.#props.node, unique_constraint_node_js_1.UniqueConstraintNode.create(columns, constraintName)),
});
} | [
"unique() {\n return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, { unique: true }));\n }",
"enterUniqueKeyColumnConstraint(ctx) {\n\t}",
"function testInsert_UniqueKeyViolation_CrossColumn() {\n var table = env.schema.table('tableD');\n var row = table.createRow({\n 'id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
append a new row with the returned word info to the DOM library table | function addrow(data, word){
var button;
button = $('<button>').text('Listen!').addClass(word);
$("#library").append(`
<tr id="${word}">
<td class="td--word ${word}">${word}</td>
<td class="td--definition">${data.list[0].definition}</td>
<td class="td--speak"><button class="butto... | [
"function appendTable(item, index) {\n //create table\n var table = document.createElement(\"TABLE\");\n //set unique id for each table\n table.setAttribute(\"id\", 'gvTable_' + index);\n //add table to element\n item.appendChild(table);\n //generate enough words to ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getWirePoints2() This function returns an array with three points to be used in drawing a wire. It is called ONLY from the vertical plugout lines of a connector (plugout1 and plugout3). The first horizontal portion of the line is not necessary for the plugout lines of a connector that are already vertical. So, we simpl... | function getWirePoints2(start, end) {
points = []; // null the points array
points.push(start.x, start.y); // push start.x, start.y
points.push(start.x, end.y); // push start.x, end.y
points.push(end.x, end.y); // push end.x, end.y
return points; // return the array
} | [
"function getWirePoints(start, end) {\n\t\tpoints = [];\t\t\t\t\t\t\t// null the points array\n\t\tpoints.push(start.x, start.y);\t\t\t// push start.x, start.y\n\t\tvar xMed = (points[0] + end.x) / 2;\t\t// comput the middle x\n\t\tpoints.push(xMed, start.y);\t\t\t\t// push middle.x, start.y\n\t\tpoints.push(xMed, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
slowly change wind direction on a random basis | alterWind() {
var change = Math.random() * 0.1;
if(Math.random() > 0.5)
change *= -1;
if(Math.random() > 0.6)
this.wind[0] += change;
else
this.wind[2] += change;
vec3.normalize(this.wind, this.wind);
vec3.scale(this.wind, this.wind, this.windStrength);
} | [
"function updateWind() {\r\n if (Math.random() < gustProbability) {\r\n windCycleGustTime = (Math.random() * 10 + 1) | 0;\r\n }\r\n if (windCycleGustTime > 0) {\r\n windCycleGustTime --;\r\n windCycleGust += windCycleGustTime/20\r\n } else {\r\n windCycleGust *= 0.99;\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= Description When the +_flag+ is true, the view will be aligned to the right. The +_px+ offset defines how many pixels from the parent's right edge the right edge of this view will be. If both setFlexRight and setFlexLeft are set, the width is flexible. Use the constructor or setRect instead of calling this method dir... | setFlexRight(_flag, _px) {
if (this.isNullOrUndefined(_flag)) {
_flag = true;
}
this.flexRight = _flag;
if (this.isNullOrUndefined(_px)) {
_px = 0;
}
this._rightOffset = _px;
return this;
} | [
"alignRight(view, offset = 0) {\n this.right = Math.round(view.right + offset);\n return this;\n }",
"moveRightOf(view, offset = 0) {\n this.left = Math.round(view.right + offset);\n return this;\n }",
"function right(x) { currentAlignment = alignRight }",
"right() { \n fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolves [DebugAdapterExecutable](DebugAdapterExecutable) based on contribution. | function resolveDebugAdapterExecutable(pluginPath, debuggerContribution) {
return __awaiter(this, void 0, void 0, function () {
var info, program, programArgs, runtime, runtimeArgs, command, args;
return __generator(this, function (_a) {
info = toPlatformInfo(debuggerContribution);
... | [
"function DebugAdapterExecutable(command, args, options) {\n this.command = command;\n this.args = args;\n this.options = options;\n }",
"_find_dependencies (exe_path) {\n var exe_out = execSync('otool -L ' + exe_path);\n var exe_result = ab2str(exe_out); // arrybuffer to str... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to clear publishrelated URL query parameters and state data Called at the end of every publish event | clearPublishState() {
if (typeof window !== "undefined" && window.location && window.location.href && window.history) {
if (queryKeyValue('publish', window.location.href)) {
window.history.replaceState(window.state, '', editQueryValue(window.location.href, 'publish', null));
... | [
"clearUrlParams() {\n this.updateUrlParams({\n type: undefined,\n color: undefined,\n debug: undefined,\n triggers: undefined,\n zoom: undefined,\n });\n }",
"clearState() {\n // Remove all related query parameters. Keep all other paramete... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear all role checkboxes in a row | function clear_role_checkboxes(e) {
var user_id = $(this).attr('id').substr(7);
for (var i in roles) {
$('#checkbox-'+roles[i]+'-'+user_id).attr('checked', false);
}
} | [
"function clear_role_checkboxes(e) {\n var user_id = $(this).attr('id').substr(7);\n for (var i in roles) {\n $('#checkbox-'+roles[i]+'-'+user_id).attr('checked', false);\n }\n}",
"function resetRoleListbox() {\n // Reset the role settings\n $('#orgRoleList input').each(function (ind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this returns false if the fragment shader cannot compile true if it can | function checkFragmentShader(shaderCode, lint = false) {
if (!gl) {
return;
}
let shader = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(shader, shaderCode);
gl.compileShader(shader);
let infoLog = gl.getShaderInfoLog(shader);
let result = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
let... | [
"compileFragmentShader() {\n let fragmentShader = this.webGL.createShader(this.webGL.FRAGMENT_SHADER)\n this.webGL.shaderSource(fragmentShader, this.fragmentShader)\n this.webGL.compileShader(fragmentShader)\n return fragmentShader;\n }",
"function checkCompile(shader, shaderType) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCION QUE DEVUELVE EL MAXIMO NUMERO DE UN JSON ARR (DEBES INGRESAR EL KEY DEL CAMPO) | function maxNumJsonARR(json, key) {
var num = 0, arr = [];
for (i = 0; i < json.length; i++) {
arr.push(parseFloat(json[i][key]));
}
num = Math.max(...arr);
return num;
} | [
"async get_max_comic_number() {\n this.url = 'server/apis/get-max-comic-number.php';\n\n let comic_number = 0;\n const response = await fetch( this.url, { headers: this.headers } );\n const res_obj = await response.json();\n\n if ( res_obj.success ) {\n comic_numbe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves all the posts of a course given the course ID and user role | function retrievePosts(req, res, next){
courseService.retrievePosts(req.params.id, req.user.sub).then(x => {
res.json(x);
})
} | [
"function getAllPost(){\n return $http.get(protocol+Base64.decode($rootScope.globals.currentUser.authdata)+'@'+host+'/author/posts').then(handleSuccess, handleError('Error'));\n }",
"async getPosts(req, res) {\n const parsedResult = JSON.parse(req.user); //user detail returned by passport\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array of zones and their respective version. Each zone has a single version only. | async function getZones () {
const { data } = await axios.get(`${BASE_URL}/zones.json`)
return data.map(({ name, slug, versions }) => {
const component = ZONE_TEMPLATE_MAPPING[slug]
const version = versions.find((version) => version.no === WEBSITE_VERSION)
if (!component) {
throw new Error(
... | [
"getzones(){\n\tvar view = this;\n\tvar defer = Q.defer();\n var apiUrl = view.apiBaseUrl+\"/\"+view.apiVersion+\"/rkszones\";\n\trequest({\n method: 'GET',\n\t\theaders: {\n\t\t\t'Cookie': view.rawCookie,\n\t\t\t'Content-Type': 'application/json'\n\t\t},\n\t\turl: apiUrl,\n }, function(error, respons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NEXT VIDEO, PRINT TITLES, MOTION, POSITION | function playNextVideo() {
var index
if (position === (ids.length-1) * (-62)) {
position = 0
imageHolder.style.left = String(position) + "vw"
imageHolder.style.transition = "left 0.5s ease"
index = position / (-62)
videoTitle.textContent = ids[index]["title"]
description.textContent = ids[in... | [
"function nextVideo() {\n\tvar nextVidObject = myPlayer.playlist.next();\n\t$('#chn-next-title').html(myPlayer.playlist()[myPlayer.playlist.currentItem()+1].name);\n\t$('#chn-previous-title').html(myPlayer.playlist()[myPlayer.playlist.currentItem()-1].name);\n\tconsole.log(\"next video loading\");\t\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check for GROUP in single number (rank) | getSetScoreGroup(t) {
let isValidGroup = true;
if (t.length > Constants.NUMBER_OF_TILE_SUITS && !Constants.ALLOW_DUPLICATE_SUITS_IN_GROUP) {
return 0;
}
let firstTileRank = null;
let suits = [];
for (let i = 0; i < t.length; i++) {
if (!TileHelper.isJoker(t[i])) {
let t... | [
"has(num){\n if (this.group.indexOf(num) !== -1){\n return true;\n } \n return false;\n }",
"function nick_in_group(nickname, group) {\n var present = 0;\n session[\"sockets\"].forEach(function (sock) {\n if (sock.nickname && nickname == sock.nickname &&\n so... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MediatorResult es una clase que empaqueta de manera general el resultado de una peticion a un servicio a traves de un Mediator | function MediatorResult(code, msg, parserResult)
{
this.code = code;
this.msg = msg;
this.parserResult = parserResult;
} | [
"function MediatorEvent(type, id, mediatorResult) \n {\n // Super\n psd.framework.Event.call(this, type);\n\n this.id = id;\n this.result = mediatorResult;\n }",
"function Mediator() \n {\n // Super\n psd.framework.EventDispatcher.call(this);\n\t\t\n // Id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch all spatialspan activities of patient | function getAllSpatialSpanActivities(patientPin){
var rawQuery = "SELECT ss.* " +
"FROM spatial_span as ss, patients as pt " +
"WHERE ss.PatientPinFK = pt.PatientPin AND pt.PatientPin = :pin "+
" order by ss.CreatedAt asc";
return database.sequelize.query(rawQuery, {
replacement... | [
"function generateSelectListData(spatialSpanActivities){\n var listData = [];\n spatialSpanActivities.forEach(function(instance){\n listData.push({id: instance.id, CreatedAt: instance.CreatedAt});\n });\n\n return listData;\n}",
"queryLayerViewAgeStats(featureLayerView, buffer) {\n // Data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when the anchor position updates. | _onAnchorUpdate()
{
this._transformID = -1;
} | [
"handleUpdateAnchor() {\n const position = this._cachePosition || this.rgbToPosition(this._rgb);\n\n const anchor = this.anchorElement;\n const offset = anchor.offsetWidth / 2;\n const x = position.x - offset + 5;\n const y = position.y - offset - 5;\n const xPercent = (x /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assemble the arguments for an Angular callee check. | function assembleArguments(thisGuy) {
switch (thisGuy.callExpression.callee.property.name) {
case 'animation':
case 'component':
case 'config':
case 'controller':
case 'decorator':
case 'directive':
case 'factory':
case 'filter':
case 'run':
case 'service'... | [
"function assembleProviderArguments(thisGuy) {\n return [thisGuy.callExpression, thisGuy, Object.assign({}, thisGuy, { fn: findProviderGet(thisGuy) })];\n }",
"function argumentBindingReg(){\n console.log(arguments)\n}",
"function args() {\n\n}",
"function SimpleArgs() {\r\n}",
"function createArgume... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implementation code for procedure 'saveAccount' | function saveAccount(account) {
var data = input('post','json','/GoShieldServices/goshield.svc/Account/Save','application/json; charset=UTF-8',JSON.stringify(account));
return WL.Server.invokeHttp(data);
} | [
"function saveAccount()\n {\n var token = $$('App.AddAccount.Github.Token.Input').getValue();\n\n enableControlls(false);\n assertToken(token)\n .done(function() {\n return Adapter.Accounts.findByToken(token)\n .done(fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
disabled all the colour buttons and gives a game over sound and uses if statements to check if you got above a certain score to change the gameover text. | function gamelose(){
$("h1").text("You Lose!");
var audiolost = document.getElementById("soundbtngameover");
audiolost.play();
document.getElementById("startButton").disabled = false;
document.getElementById("buttonone").disabled = true;
document.getElementById("buttontwo").disabled = true;
docu... | [
"gameOver() {\n this.disableButton(ROLL_DICE_BUTTON_ID);\n this.disableButton(END_TURN_BUTTON_ID);\n this.isGameOver = true;\n }",
"function gameOver() {\n\n running = false;\n clearInterval(timer);\n seconds = 60;\n amount = 0;\n alert(\"Game over! Your total score is \" + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send rich message with kitten | function kittenMessage(recipientId, text) {
text = text || "";
var values = text.split(' ');
if (values.length === 3 && values[0] === 'kitten') {
if (Number(values[1]) > 0 && Number(values[2]) > 0) {
var imageUrl = "http://placekitten.com/g/" + Number(values[1]) + ... | [
"function kittenMessage(recipientId, text) {\r\n\r\n text = text || \"\";\r\n\r\n\r\n var values = text.split(' ');\r\n\r\n if (values.length === 3 && values[0] === 'Kitten') {\r\n if (Number(values[1]) > 0 && Number(values[2]) > 0) {\r\n \r\n var imageUrl = \"https://placekitten... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
dleet = delete but it's a reserved word so there. broadcast tables:dleet so we know it's been deleted | function dleet(data) {
debug('dleet request', data);
if (!data[pk]) return emit(routes.read, {"error": "no id attribute in passed data for " + routes.read});
var query = table.delete().where(table[pk].equals(data[pk])).returning("*").toQuery();
db.query(query.text, query.values, function(err, resp){
debug('d... | [
"function queryDeleteDept (deptName) {\n connection.query('DELETE FROM department WHERE id = ?', deptName);\n}",
"delete(){\n try{\n db.query(`DELETE FROM ${this.table} WHERE id = ${this.cols.id}`)\n } catch(err){\n console.log(err)\n }\n }",
"localDelete(charId,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear House Group This script empties your groups so that they can be repopulated when you have updated your house groups in your sms. | function clearHouseMembers(){
var houses = ['green', 'blue', 'red', 'yellow', 'purple'];
var query = "select distinct school_year from ST where substring(school_year, 2,3) >= 3";
var schoolyearSet = Jdbc.getConnection("jdbc:mysql://222.16.227.81:3306/database", "user", "password").createStatement().executeQuery(... | [
"function\tClearAll() {\n\t\tGroup.remove({}, (err, groups) => {\n\t\t\tif(err)\n\t\t\t\tconsole.log(err);\n\t\t\tconsole.log(groups);\n\t\t})\n\t}",
"function clear_groups()\r\n {\r\n clear_resources();\r\n\r\n // Remove all groups\r\n $('ul', access_groups... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Persist all queued objects | function flush() {
// Get a local reference to the active promise;
// this will be replaced with a promise for the next round
// of persistence calls, so we want to make sure we clear
// the correct one when this flush completes.
var flushi... | [
"function flush() {\n // Get a local reference to the active promise;\n // this will be replaced with a promise for the next round\n // of persistence calls, so we want to make sure we clear\n // the correct one when this flush completes.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creating posts, which will delay 2 seconds. second parameter will be callback you can use any name instead of callback, but this is common practice! | function createPosts(post, callback){
setTimeout( () => {
posts.push(post);
// calling callback function
callback();
}, 2000);
} | [
"function createPosts(post ,callback){ // we make use of callback function\n setTimeout(()=>{\n\n Posts.push(post);\n callback();\n }, 2000);\n}",
"function createPost(post, callback) {\n setTimeout(() => {\n posts.push(post);\n callback();\n }, 2000);\n}",
"function crea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
$watch will not check any vars prefixed with $, so we manually check $priority and $value using this method | function watchExp(){
var obj = parsed(scope);
return [obj, obj.$priority, obj.$value];
} | [
"function watchExp(){var obj=parsed(scope);return[obj,obj.$priority,obj.$value]}",
"function watchExp(){\n var obj = parsed(scope);\n return [obj, obj.$priority, obj.$value];\n }",
"function checkMetaVars() {\n var dat = p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
query Salesforce for a list of leads hardcoded for 'today' Alexa utterance example: 'new leads' or 'my leads' careful 'new lead' is different intent for creating a new lead | function handleLeadsTodayIntent(response) {
var speechOutput = 'saywhat';
var query = 'Select Name, Company from Lead where CreatedDate = TODAY';
// auth and run query
org.authenticate({ username: SF_USER, password: SF_PWD_TOKEN }).then(function(){
return org.query({ query: query })
}).then(function(res... | [
"function querySalesforceLead(emailAddress, accessToken, conversationId, orgId, callbackFn) {\n\t\n\tconsole.log(\"email address is :\" + emailAddress);\t\t \n\n\n if (typeof emailAddress != 'undefined') {\n\n\n\t\tvar jsforce = require('jsforce');\n\t\tvar conn = new jsforce.Connection({\n\t\t instanceUrl : 'htt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loops through model data and calculates the total cost of all selected items Emits event when new total cost is set | getTotalSelectedItemsCost() {
const totalCost = this.itemModelList.data.reduce((prevVal, item) => {
if (!item.isChecked) {
return prevVal;
}
return prevVal + MartCtrl.getItemCost(item);
}, 0);
events.emit(MART_CTRL_SET_TOTAL_COST, totalCost)... | [
"calculateTotal() {\n let total = 0;\n for (let item of this.items) {\n total += item.cost;\n }\n return total;\n }",
"function calculateTotalsAndCosts(initial) {\n var selectedItems = 0;\n var totalItems = 0\n var cost = {\n total: 0,\n remaining: 0,\n selected: 0,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |