query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Chooses which template to render depending on program args | function chooseTemplate() {
var arg = process.argv[2];
if (process.argv.length < 3) {
console.log("help:");
console.log("'mylib-gen stage' - generates a new stage");
console.log("'mylib-get mylib' - generates a new mylib file");
process.exit(1);
}
if (arg == "stage") {
getStageFields();
... | [
"function selectPage(templateName, args){\n\t\tif(templates[templateName]) {\n\t\t\ttemplates[templateName].apply(args, '#main');\n\t\t\tcurrentPage = templateName;\n\t\t} else {\n\t\t\tconsole.log('WARNING: Failed to find template named ' + templateName);\n\t\t}\n\t}",
"function render(template, data) { \n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
global isDomElem / Get the input mask element for an input / Requires: / inputElem: Input element who's input mask is required | function getMask(inputElem) {
let inputMask;
if (isDomElem(inputElem) === true) {
inputMask = $(inputElem).closest('.input-mask-wrapper').
find('.input-mask');
if (inputMask.length > 0) {
return inputMask;
}
}
return false;
} | [
"function showMask(inputElem) {\n let inputMask = getMask(inputElem);\n let inputValue;\n if (inputMask !== false) {\n $(inputMask).find('.input-mask-positioner').\n removeClass('d-none');\n inputValue = $(inputMask).find('.input-value');\n if ($(inputValue).length > 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
local storage methods. Stores the Priorities entries in local storage componentDidMount will check for local storage data immediately after compoment is rendered | componentDidMount() {
let itemsFromStorage = JSON.parse(localStorage.getItem("priorities"));
// if there is data in local storage it will update the state with the data
if(itemsFromStorage) {
this.setState(itemsFromStorage);
}
} | [
"function init() {\n if (localStorage.getItem(\"recent\") !== null) {\n let retrievedData = localStorage.getItem(\"recent\");\n recentCities = JSON.parse(retrievedData);\n writeRecentCities();\n }\n}",
"function fetchLocalStorage() {\n // CONVERTING LOCAL STORAGE STRING THAT STORE OUR LEADS AND PUSH... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fahrenheit and Celsius are the same at 40 To find this using programming you could do something like this: | function fahrenheitEqualsCelsius(){
// A bit of a risk causing a computer to lockup, but if we write the function correctly
// it should return the value -40 and stop running
var degrees = 200;
var fAndCEqual = false;
while(!fAndCEqual){
var cDegrees = fahrenheitToCelsius(degrees);
v... | [
"function equateFahrenheitCelsius()\n{\n for(var i = 200; i > -200; i--)\n {\n var fahrenheit = ((9/5) * i + 32)\n var celsius = (i - 32) / (9/5);\n\n if(fahrenheit === celsius)\n {\n console.log(\"Fahrenheit and Celsius equate at \" + i + \" degrees\");\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Counts total balance, takes arg fully processed array which elements are all ints, return total balance as int | function gainTotalBalance(arr){
let total = 0
for(let i = 0; i < arr.length; i++){
let element = arr[i]
total = total + element
}
return total
} | [
"function totalIntegers(arr) {\n return arr.reduce((acc, ele, index) => {\n if (Array.isArray(ele)) {\n acc = acc + totalIntegers(ele);\n } else {\n if (typeof ele === 'number') {\n acc = acc + 1;\n }\n }\n return acc;\n }, 0);\n }",
"function sumBalance(ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the start node in a diagram | function getStartNode(){
for(var i = 0; i < myDiagram.model.nodeDataArray.length; i++){
var curNode = myDiagram.model.nodeDataArray[i];
if(curNode.nodeType === nodeTypeStartNode
&& curNode.group === undefined){
return curNode;
}
}
} | [
"getStart(){ // start node\n return this.start;\n }",
"function inertStartNode() {\n let startNode = document.querySelector(\".start-node\").id;\n let splittedNode = startNode.split(\"-\")\n nodesList.push([parseInt(splittedNode[0]), parseInt(splittedNode[1])]);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Localize an array of elements | function localize(l10n, array)
{
for(var i = 0 ; i < array.length ; i++)
{
try
{
var node = document.querySelector('[data-l10n-id=' + array[i] + ']');
if(node != null)
{
node.textContent = l10n.entities[array[i]].value;
}
}
... | [
"_translate(elements, translation = undefined) {\n if (!translation) return;\n\n elements.forEach((element) => {\n var keys = element.getAttribute(this._i18nDataAttr).split(\".\");\n try {\n var text = keys.reduce((obj, i) => obj[i], translation);\n if (text) {\n element.inner... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Notify object data has been loaded | setObjectDataLoaded() {
this.hasDataLoaded.object = true
if(this.hasDataLoaded.record === true) {
this.handleWireDataLoaded();
}
} | [
"_onDataLoaded () {\n this._state = 'dataLoaded';\n this._needRefresh();\n }",
"function notifyLoadObservers(){\n for (var i=0; i<_self.loadObservers.length; i++){\n _self.loadObservers[i](_self);\n }\n }",
"_handleLoadedDataEvent() {\n this.fireEvent(\"loadedda... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Keep track of the set of groups which have pressure. This module is eager it'll push out pressure changes across the entire map whenever a step happens. | function GroupsWithPressure(baseGrid, engines, groups, regions, zones, currentStates) {
// Groups start off in dirtySeeds. On flush() we create pressure objects and
// they move to activePressure. When their zone is destroyed they go to
// dirtyPressure and on the next flush call we tell our watchers about them.
... | [
"function runGroupingStep() {\n var groupColors = [\"#1abc9c\", \"#3498db\", \"#9b59b6\", \"#2ecc71\",\n \"#f1c40f\", \"#e67e22\", \"#e74c3c\",\n \"#16a085\", \"#27ae60\", \"#2980b9\", \"#8e44ad\",\n \"#f39c12\", \"#d35400\",\"#... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls Spotify API to retrieve song information for song title. | function getSongInfo(songTitle) {
// keys to the spotify credentials
var spotify = new Spotify(requestCredentials.spotify);
// Calls Spotify API to retrieve a track.
var param = {
type: 'track',
query: songTitle
}
spotify.search(param, function (err, data) {
if (err) {
logOutput.error(err);
re... | [
"function spotifySong(title){\n\n\tvar spotify = new Spotify({\n\t\tid: keys.spotifyKeys.client_ID,\n\t\tsecret: keys.spotifyKeys.client_secret,\n\t});\n\t \n\tspotify\n\t\t.search({ type: 'track', query: title })\n\t\t.then(function(response) {\n\t\t\t//artist name\n\t\t\tconsole.log(response.tracks.items[0].artis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
transform a ServicesDependencies into a Digraph | function servicesDependenciesToDigraph(data) {
var applicationsByName = {};
var nodeNameFromInfo = function (applicationName, serviceName) {
var application = applicationsByName[applicationName];
if (serviceName) {
return "node_service_" + ap... | [
"diagramToGraphviz(diagramJson) {\n var g = graphviz.digraph('LS')\n const nodes = diagramJson.data.attributes['service-diagram'].nodes\n\n for (var n in nodes) {\n g.addNode(nodes[n].service_name)\n }\n const edges = diagramJson.data.attributes['service-diagram'].edges... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start with the centre of the polygon at origin.x, origin.y, then creates the polygon by sampling points on a circle around the centre. Randon noise is added by varying the angular spacing between sequential points, and by varying the radial distance of each point from the centre | function generatePolygon(origin, numberOfVertices, avgRadius, irregularity = 0.5, spikeyness = 0.5) {
if (numberOfVertices < 3) {
throw new Error('Polygon must be at least with 3 edges.');
}
irregularity = clip(irregularity, 0, 1) * 2 * Math.PI / numberOfVertices;
spikeyness = clip(spikeyness, ... | [
"function generatePolygon(origin, numberOfVertices, avgRadius, irregularity = 0.5, spikeyness = 0.5) {\n if (numberOfVertices < 3) {\n throw new Error('Polygon must be at least with 3 edges.');\n }\n \n irregularity = clip(irregularity, 0, 1) * 2 * Math.PI / numberOfVertices;\n spikeyness = clip(spikeyness,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
print list with optional start and stop nodes, no return | log(beg, end) {
let start = beg || 0;
let stop = end || this.size;
if(this.isEmpty()) console.log(null);
this.forEachNode( (currentNode, i) => {
if(i >= start && i <= stop){
console.log(i, currentNode)
}
}, start, stop)
} | [
"printList() {\n\t\tvar list = \" \";\n\t\tlet curr = this.head;\n\t\twhile (curr !== null) {\n\t\t\tif (curr.next !== null) {\n\t\t\t\tlist += curr.value + \"-->\" + \" \";\n\t\t\t} else {\n\t\t\t\tlist += curr.value + \" \";\n\t\t\t}\n\t\t\tcurr = curr.next;\n\t\t}\n\t\tconsole.log(list);\n\t}",
"function outpu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log(s_id +" id2: "); fetch/requesting ditrict url lets get district name according to state id. | function f1(stat_id)
{
s_id=stat_id
// console.log("f1 called"+s_id);
const get_district_url = `https://cdn-api.co-vin.in/api/v2/admin/location/districts/${s_id}`
xhr.open('GET',get_district_url)
// console.log(get_district_url);
... | [
"function getDistricts(state, cb){\n const stateId = findState(state).state_id;\n\n // Return error if not found.\n if (!stateId || !statesData[stateId]) {\n cb(true);\n return;\n }\n\n // Early return if found.\n if (statesData[stateId].districts) {\n cb();\n return;\n }\n\n getRequest({url: `h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
String$prototype$equals :: String ~> String > Boolean | function String$prototype$equals(other) {
return typeof this === 'object' ?
equals(this.valueOf(), other.valueOf()) :
this === other;
} | [
"function String$prototype$equals(other) {\n return typeof this === 'object' ?\n equals (this.valueOf (), other.valueOf ()) :\n this === other;\n }",
"function String$prototype$equals(other) {\n return typeof other === typeof this && other.valueOf() === this.valueOf();\n }",
"function isEqual(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an animation object that updates a fixed number of times before completing totalSteps of times to update the animation before stopping stepFunction given the current step number (from 0 to totalSteps 1), updates the animated object onComplete (optional) a noargs function that runs once the animation has complet... | function createFixedStepAnimation(totalSteps, stepFunction, onComplete) {
const stepWrapper = function() {
stepFunction(this._steps);
this._steps += 1;
if (this._steps === totalSteps) {
this.stop();
}
};
const stepAnimation = new Animation(stepWrapper, onComplete)... | [
"constructor(stepFunction, onComplete) {\n this.step = stepFunction;\n _activeAnimations.push(this);\n this.onComplete = onComplete || _doNothing;\n }",
"function createLinearMoveAnimation(totalSteps, start, end, stepFunction, onComplete) {\n const xStep = (end.x - start.x) / totalSteps... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
serialize chart Excel Data | serializeChartExcelData() {
this.mArchiveExcel = new ZipArchive();
this.mArchiveExcel.compressionLevel = 'Normal';
let type = this.chart.chartType;
let isScatterType = (type === 'Scatter_Markers' || type === 'Bubble');
this.serializeWorkBook();
this.serializeSharedString(... | [
"function saveGraphDataToSheets() {\n var values = [\n [\"Graph ID\", \"Data\", \"Layout\", \"Config\", \"Graph Height\", \"Graph Width\",\n \"Automargin\"]\n ];\n var graphData = JSON.parse(localStorage.getItem(\"graphData\"));\n for (var graphId in graphData) {\n if (graphData.hasOwnProperty(grap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies the combinator at the given index in the given list of combinator atoms. | function verifyCombinator(combinators, seenObservables, i) {
if (!web3) {
return Promise.reject("Web3 connection not initialised.");
}
// Function to generate an error description.
const errDesc = (index) => {
return "At: '" + combinators[index] + "', atom: " + index + " of the contract... | [
"isValid () {\n let i = 1\n\n for (i; i <= this.chain.length - 1; i++) {\n const currentBlock = this.chain[i]\n const previousBlock = this.chain[i - 1]\n\n if (currentBlock.hash !== currentBlock.calculateHash() ||\n currentBlock.previousHash !== previousBlock.hash) {\n throw new ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To add a blank option in any specific dropdown or in all ROLE keyword fields. Arguments: None or 1) ID of dropdown. Sample Call: SP_InsertBlank("mastercontrol.role.SP_CR_Users.Imp1"); Sample Call: SP_InsertBlank(); | function SP_InsertBlank()
{
switch(arguments.length)
{
case 0:
var oAllCMB = document.getElementsByTagName('select');
if(oAllCMB.length != 0)
{
for(var x=0; x<oAllCMB.length; x++)
{
var cmbID = oAllCMB[x].id;
if(cmbID.indexOf('mastercontrol.role') != -1 && oAllCMB[x].type != "selec... | [
"function SP_InsertOption()\n{\n if(arguments.length == 4)\n {\n var oCMB = arguments[2];\n var elOptNew = document.createElement('option');\n var pstn = arguments[3];\n elOptNew.text = arguments[0];\n elOptNew.value = arguments[1];\n \n if(oCMB.selectedIndex =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for opening a specified user's IRB Training Certification | function openIRB(personNum){
switch (personNum) {
//Open Oscar's cert
case 1:
window.open("images/IRB/certificateOscar_PDF.pdf","_blank");
break;
//Open Bryan's cert
case 2:
window.open("images/IRB/bryan_smith_certificate_PDF.pdf","_blank");
break;
//Open Holly's cert
case 3:
window.open("im... | [
"function gradCertiClick(certi){\r\n\tconsole.log(certi);\r\n\t/*open appropriate link based on clicked certificate*/\r\n\tif(certi.textContent == \"Web Development Advanced certificate\"){\r\n\t\twindow.open(\"http://www.rit.edu/programs/web-development-adv-cert\");\r\n\t}else{\r\n\t\twindow.open(\"http://www.rit.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pulls the party information from local storage and parses the JSON | function getPartyList() {
const partyString = localStorage.getItem('party');
let party = [];
if (partyString) {
party = JSON.parse(partyString);
}
return party;
} | [
"function readstorage() {\n investorName = JSON.parse(localStorage.getItem(\"investorName\"));\n investorEmail = JSON.parse(localStorage.getItem(\"investorEmail\"));\n investorIndustry = JSON.parse(localStorage.getItem(\"investorIndustry\"));\n investedAmount = JSON.parse(localStorage.getItem(\"invested... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Provides a pair of iterators over text positions, tokenized. Transparently requests more text when next() is called and there is no more tokenized text | function createTokenizedTextProvider(pos, characterOptions, wordOptions) {
var forwardIterator = createCharacterIterator(pos, false, null, characterOptions);
var backwardIterator = createCharacterIterator(pos, true, null, characterOptions);
var tokenizer = wordOptions.tokenizer;
... | [
"function createTokenizedTextProvider(pos, options) {\n var forwardIterator = createCharacterIterator(pos, false);\n var backwardIterator = createCharacterIterator(pos, true);\n var tokenizer = options.tokenizer;\n\n // Consumes a word and the whitespace beyond it\n function consu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HTTP Geek Request flow action | function onActionHttpRequest (callback, args) {
util.debugLog('A90 WARNING: Depricated "HTTP Geek Request" action used. Will be deleted in next version.')
var method = 'get'
try {
var options = JSON.parse(args.options)
} catch (error) {
return callback(error)
}
if (options.method) method = options.m... | [
"function handleRequest(reqBody)\n\t{\t\n\t\t//console.log(\"Request Action: \"+reqBody.action);\n\t\t\n\t}",
"function handleRequestMessage() {\n\t\t\t\t//++ TODO: implement request()\n\t\t\t\tconsole.error(\"TODO: implement request()\")\n\t\t\t}",
"function RequestHandler() {}",
"request(level, direction) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function that will return the count of distinct caseinsensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits. Example "abcde" > 0 no characters repeats more than... | function duplicateCount(text){
text = text.toLowerCase().split("")
const countedletters = text.reduce((allLetters, letter) => {
if(letter in allLetters) {
allLetters[letter]++
}
else {
allLetters[letter] = 1
}
return allLetters
}, {})
const filterDup = Object.values(countedletters... | [
"function duplicateCount(text){\n let counter = {};\n text = text.toLowerCase();\n\n for (var i = 0; i < text.length; i++) {\n if (text[i] <= 'z' && text[i] >= 'a' || text[i] >= 0 && text[i] <= 9) {\n (counter[(text[i])]) ? counter[text[i]] ++ : counter[text[i]] = 1;\n }\n }\n let result = [];\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigates to the report page | navigateToReportPage() {
return this._navigate(this.buttons.report, 'reportPage.js');
} | [
"function viewReports() {\n $state.go(\n \"reportList\"\n );\n }",
"_handleClick() {\n\t\tthis.navigate(\"ReportFound\");\n\t}",
"function linkToReportWizard(){\n\tclearQueryData();\n\tshowAnalyticsSection(['wizard_container']);\n}",
"function navigateToViewReports(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toggling the navbar icon | function toggleNavbarIcon() {
if (navbarIconMenu.classList.contains('navbar-open')) {
openNavbar();
} else if (navbarIconMenu.classList.contains('navbar-close')) {
closeNavbar();
}
} | [
"function toggleMenuIcon(e) {\n\t\t$(e).find('.navbar-toggler-icon').toggleClass('opened');\n\t}",
"function _handleNavIconClick () {\n this.$el.find('.nav-list').toggleClass('show');\n }",
"function changeIcon() {\n if (navMenu.classList.contains(\"nav__menu--open\")) {\n navToggle.classList.repl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the given key combination exists in the given list of shortcuts | function shortcutExists(shortcut, shortcuts) {
for(let i = 0; i < shortcuts.length; i ++) {
if(utils.arrayEquals(shortcut.keys, shortcuts[i].keys)) {
return true;
}
}
return false;
} | [
"function contains(shortcuts, shortcut) {\n if (!shortcuts) {\n return false;\n }\n\n for (var i=0,shortcutToCheck; shortcutToCheck=shortcuts[i++];) {\n var experienceId1 = shortcutToCheck.experienceId,\n experienceId2 = shortcut.experi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given two schemas, returns an Array containing descriptions of any breaking changes in the newSchema related to the fields on a type. This includes if a field has been removed from a type or if a field has changed type. | function findFieldsThatChangedType(oldSchema, newSchema) {
var oldTypeMap = oldSchema.getTypeMap();
var newTypeMap = newSchema.getTypeMap();
var breakingFieldChanges = [];
Object.keys(oldTypeMap).forEach(function (typeName) {
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];... | [
"function findFieldsThatChangedType(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingFieldChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[type... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To toggle required field labels. Arguments: 1) Label ID. 2) Flag: true/false Sample Call: SP_RequiredLabelToggle("lblSource",true); updated under bug 40379 | function SP_RequiredLabelToggle(labelId,setRequired)
{
if(arguments.length > 2)
{
var label = $('label[for='+labelId+']');
if(setRequired == true)
{
if(label.text().indexOf("*") == -1)
{
label.text("* "+ label.text());
label.addClass("dynamicRequiredLabel");
}
}
else if(setRequired == false... | [
"function SP_DynamicRequireToggle(labelName, fieldName, flag)\n{\n\tSP_RequiredLabelToggle(labelName, flag);\n\tSP_ToggleFieldShadow(fieldName, \"PinkShadow\", flag); //This call is to ensure v11 style formatting for required fields\n\tmcRequireToggle(fieldName, flag);\n\tif(!flag)\n\t{\n\t\tvar oBorderStyle = docu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implementation of the User Attribute Packet (Tag 17) The User Attribute packet is a variation of the User ID packet. It is capable of storing more types of data than the User ID packet, which is limited to text. Like the User ID packet, a User Attribute packet may be certified by the key owner ("selfsigned") or any oth... | function UserAttribute() {
this.tag = _enums2.default.packet.userAttribute;
this.attributes = [];
} | [
"function setUserAttribute(key, value) {\n if (isInitialized) {\n try {\n var attributes = {};\n attributes[key] = value;\n Taplytics.identify(attributes);\n return 'Successfully called setUserAttribute API on ' + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collect all relationupdating operations from a RESTformat update. Returns a list of all relation updates to perform This mutates update. | collectRelationUpdates(className: string, objectId: ?string, update: any) {
var ops = [];
var deleteMe = [];
objectId = update.objectId || objectId;
var process = (op, key) => {
if (!op) {
return;
}
if (op.__op == 'AddRelation') {
ops.push({ key, op });
deleteM... | [
"handleRelationUpdates(className: string, objectId: string, update: any, ops: any) {\n var pending = [];\n objectId = update.objectId || objectId;\n ops.forEach(({ key, op }) => {\n if (!op) {\n return;\n }\n if (op.__op == 'AddRelation') {\n for (const object of op.objects) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the path of the calling function | function callerPath () {
return callsites()[2].getFileName()
} | [
"function getCallerDir(){\n var file = utils.getCallerFile(3);\n return PATH.dirname(file);\n}",
"function get__filename() {\n return get_caller_file_path_2.get_caller_file_path();\n}",
"_getCallerFilePath() {\n // we are going to temporarily override this method. Keep for restore\n const originalPre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fill the IDB for 'tagging' when loading so new files are taken into account 'eventually', feed it the DB list of files | async function Check_And_Handle_New_Images_IDB(current_file_list) {
//default annotation obj values to use when new file found
for( ii = 0; ii < image_files_in_dir.length; ii++){
bool_new_file_name = current_file_list.some( name_tmp => name_tmp === `${image_files_in_dir[ii]}` )
if( bool_new_file... | [
"async function update_tags(dir, db){\n let files = sort_dir_by_modtime(dir)\n const progress_bar = new cli_progress.SingleBar({});\n let db_size = await db.get('size')\n progress_bar.start(files.length - db_size, 0)\n for (file of files){\n let md5 = strip_ext(file)\n if (await db_exists(db, md5)) { bre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves the message to DynamoDB | function saveMessage(messageId, event) {
return ddb.put({
TableName: 'Messages',
Item: {
messageId: messageId,
name: event.name,
email: event.email,
message: event.message,
},
}).promise();
} | [
"function saveRequest(SOAPAction, message_id, event, callback) {\n\n\tvar now = new Date().toISOString();\n\tvar message = event.body;\n\n // Set when records added now will expire (2 days)\n var expiryDate = getExpiryDate();\n\n var params = {\n TableName: tblName,\n Key: { id : message_id }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To trace some text in the console | function trace(txt) {
if (DEBUG_MODE) {
console.log(txt);
}
} | [
"function trace (text, force = false) {\r\n if (options.traceEnabled || force) {\r\n\tconsole.log(text+\"\\r\\n\");\r\n }\r\n}",
"function trace (text, force = false) {\n if (options.traceEnabled || force) {\n TracePlace.textContent += text + \"\\r\\n\";\n }\n}",
"function printConsole(text){\n consol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SEVENTH (HOUSE HOLD WAGES) ACCORDION VALIDATION // Saravanan N 19th Aug, 2014 Added method to validate household accordion. | function ValidateHouseholdAccordion() {
var isClientSideValidationFailed = GetHouseHoldWagesAccordionClientSideValidationStatus();
var isServerSideValidationFailed = GetHouseHoldWagesAccordionServerSideValidationStatus();
//If all the first accordion control client side validation pass then remove the erro... | [
"function validateEmployeeHandbook(){\n\n\t//check the singature\n\tif(checkInput(\"EHsigned\", \"alpha\")){\n\t\talert(\"Please sign the Employee Handbook Receipt Form!\");\n\t}\n\n\t//check the checkbox agreement\n\telse if(validateCheckBox(\"EHagree\", \"agree\")){\n\t\talert(\"Have you read and agreed with the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::WAFv2::RuleGroup.AndStatement` resource | function cfnRuleGroupAndStatementPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnRuleGroup_AndStatementPropertyValidator(properties).assertSuccess();
return {
Statements: cdk.listMapper(cfnRuleGroupStatementPropertyToCloudFormation)(prope... | [
"function cfnRuleGroupStatementPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnRuleGroup_StatementPropertyValidator(properties).assertSuccess();\n return {\n AndStatement: cfnRuleGroupAndStatementPropertyToCloudFormation(properties.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shit went sour and acces expired / If TimeThis Callendar exists init app, if not create TimeThis callendar and then init app | function checkCallendar(){
gapi.client.load('calendar', 'v3', function() {
var getGcalList = gapi.client.calendar.calendarList.list();
getGcalList.execute(function(resp) {
var nrOfCals=resp.items.length;
var count=0;
for (var key in resp.items) {
//cal ID
//console.log(resp.i... | [
"function initPage() {\n // var lockedOutTime = localStorage.getItem() \n // here we'll get our locked out time from local storage and decide if we're still locked out or not\n let lockedOutStatus = getLockedOutStatus();\n //console.log (lockedOutStatus);\n if (lockedOutStatus) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
==========globals:========== ==========statics:========== class "program" declaration: program contains all scopes defined, and all scopes internally represent all blocks and all symbols so in a way program encaps everything | function program(){
//initialize hashmap of scopes
this._scopes = {};
//create start block (right now pass no scope owner)
var start = new block(null);
//create finalizing block (right now pass no scope owner)
var end = new block(null);
//create and assign global scope
this._scopes[scope.__nextId] = new scope(
... | [
"program() {\n this.eat('PROGRAM')\n const varNode = this.variable()\n const progName = varNode.value\n this.eat('SEMI')\n const blockNode = this.block()\n const progNode = new Program(progName, blockNode)\n this.eat('DOT')\n return progNode\n }",
"Program() {\n return {\n type: '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create scale factor for the images Shrink the images by this scale factor and all of the pictures will be visible along the timeline. Add a fudge factor of 0.4 to make the images overlap slightly. Don't oversize the images on unpopulated timelines. | function getScaleFactor(images) {
var scaleFactor;
var fudgeFactor = 2;
var totalImagesWidth = 0;
_.each(images, function (image) {
totalImagesWidth = (parseInt(totalImagesWidth, 10) + parseInt(image.thumbWidth, 10));
});
if (totalImagesWidth <= Session.get('$timelineBackgroundWidth')) {
scaleFact... | [
"function adjustScaling() {\n var win = {\n width : $window.innerWidth-20,\n height: $window.innerHeight-20\n },\n stage = {\n width : element[0].clientWidth,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the 'full' layout schema depends on the traces types presents | function fillLayoutSchema(schema, dataOut) {
var layoutSchema = schema.layout.layoutAttributes;
for (var i = 0; i < dataOut.length; i++) {
var traceOut = dataOut[i];
var traceSchema = schema.traces[traceOut.type];
var traceLayoutAttr = traceSchema.layoutAttributes;
if (traceLayoutAttr) {
if (t... | [
"function fillLayoutSchema(schema, dataOut) {\n var layoutSchema = schema.layout.layoutAttributes;\n\n for(var i = 0; i < dataOut.length; i++) {\n var traceOut = dataOut[i];\n var traceSchema = schema.traces[traceOut.type];\n var traceLayoutAttr = traceSchema.layoutAttributes;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
16.02.2006 NWJ return parent owner of an element identified by id | function get_parent_owner_by_id(oEle, strID)
{
if (oEle.id==strID) return oEle;
if (oEle.parentNode)
{
return get_parent_owner_by_id(oEle.parentNode, strID);
}
return false;
} | [
"function get_parent_owner_by_id(oEle, strID)\r\n{\r\n\tif (oEle.id==strID) return oEle;\r\n\r\n\tif (oEle.parentNode)\r\n\t{\r\n\t\treturn get_parent_owner_by_id(oEle.parentNode, strID);\r\n\t}\r\n\treturn null;\r\n}",
"get owner() {\n return this.parent || this._owner || IdHelper.fromElement(this.forElement ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove(String) > void Remove a default by its key. | remove(key) {
delete this.#defaults[key];
} | [
"delete (key) {\n this.debug('%s - delete %s', this.label, key)\n return unset(this._config, key)\n }",
"delete(key) {\n\t\tthis.props.remove(key);\n\t}",
"remove(key) {\n delete register[key];\n }",
"remove(key) {\n delete this.store[key];\n }",
"remove(key, value) {\n key = key... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update data testing negotiate feature have an action to edit appointment and update it on the database, this test is goint to update an appointment with an already prepared data. then compare between prepared data and data that saved on the database log "correct" if match, and "incorrect" if doesnt match | function updatetest(){
let dataTest = {
date : "10:00",
time : "17/12/2018",
location: "depoK 2"
}
key = "-LSUNyezSVIuvgYJp14r"
dbAppointmentsRef.child(key).update(dataTest);
dbAppointmentsRef.child(key).once('value',snap => {
let status = "correct data";
... | [
"function updateAppointment(params) {\n return new Promise((resolve, reject) => {\n if(params.id && params.timeslot) {\n db.serialize(() => {\n db.run(\"UPDATE appointmentSchedule_table SET timeslot = ? WHERE id = ?\", [params.timeslot, params.id], function(err) {\n if(err) {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called at the start in order to fill canvas and array with shapes in random positions. | static initialShapes(){
GenesysShape.primitives.forEach((prim) => {
GenesysShape.shapes.push(
new GenesysShape(prim,
Math.random() * (ctx.canvas.width + (prim.width * 2) - prim.width),
Math.random() * (ctx.canvas.height + prim.height), ... | [
"newShape() {\n var id = Math.floor( Math.random() * this.shapes.length );\n var shape = this.shapes[ id ]; // maintain id for color filling\n\n this.current = [];\n for ( var y = 0; y < 4; ++y ) {\n this.current[ y ] = [];\n for ( var x = 0; x < 4; ++x ) {\n var i = 4 * y + x;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hackish way to get the soap response strips out the namespaces and returns the Envelope > Body > [Soap Result] | function desoap (xml, cb) {
parser.parseString(xml, function (err, result) {
var envelopeKey, bodyKey, _ref, _ref2;
if (err) return cb(err);
for (envelopeKey in result) {
if (denamespace(envelopeKey).toLowerCase() === 'envelope') {
for (bodyKey in result[envelopeKey]) {
_ref2 = result[envelopeKey][... | [
"function SOAPEnvelope() {\n return {\n header: \"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' \" +\n \"xmlns:xsd='http://www.w3.org/2001/XMLSchema' \" +\n \"xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body>\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the input passes the constraints on the subject type. | function constraintsAccept(subject) {
var constraints = subject.constraints;
var length = constraints.length;
for (var _len3 = arguments.length, input = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
input[_key3 - 1] = arguments[_key3];
}
for (var i = 0; i < length; i++) {
va... | [
"function constraintsAccept(subject) {\n var constraints = subject.constraints;\n var length = constraints.length;\n\n for (var _len3 = arguments.length, input = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n input[_key3 - 1] = arguments[_key3];\n }\n\n for (var i = 0; i < leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find any animations of a given type and run them | function runAnim (element, animName) {
var anim = Array.prototype.slice.call(element.querySelectorAll(
"animateMotion." + animName));
anim.forEach(function (a) {console.log(a); a.beginElement();});
} | [
"function updateAnimations(){\n\tfor(var i = 0; i < animationList.length; i++){\n\t\tif(animationList[i].meshType == \"turtle\"){\n\t\t\tturtle_animation(animationList[i]);\n\t\t}\n\t\telse if(animationList[i].meshType == \"flingpiece\"){\n\t\t\tflingpiece_animation(animationList[i]);\n\t\t}\n\t}\n}",
"function r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
uuid Job.uuid meta Any additional information to pass to the backend which is not job properties callback f(err, job) | function getJob(uuid, meta, callback) {
if (typeof (uuid) === 'undefined') {
return callback(new wf.BackendInternalError(
'WorkflowRedisBackend.getJob uuid(String) required'));
}
if (typeof (meta) === 'function') {
callback = meta;
meta = {}... | [
"function getInfo(uuid, meta, callback) {\n if (typeof (meta) === 'function') {\n callback = meta;\n meta = {};\n }\n\n var llen;\n var info = [];\n\n return client.exists('job:' + uuid, function (err, result) {\n if (err) {\n log.er... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show an error msg when the name of the room has already been used | function errorNameUsed(data) {
let p = createP(`${data} has already been used!!`);
p.parent(".homepage");
} | [
"function newRoomName() {\n\n // prompt error if name is longer than 55 characters\n toast('Room name cant be longer than 55 characters!', {\n position: toast.POSITION.BOTTOM_CENTER,\n className: 'toast-error',\n progressClassName: 'error-progress-bar',\n autoClose: 3000,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The browser calculates the default value of a slider by using midpoint between the min and the max. | function getDefaultValue(min, max) {
return max < min ? min : min + (max - min) / 2;
} | [
"function calculateSliderValue() {\n var val = scale / zoomController.ZOOM_STEP - 1;\n view.setSliderValue(val);\n }",
"function sliderInit(){\n\n const valueMin = document.getElementById(\"ab-min-value\")\n const valueMax = document.getElementById(\"ab-max-value\")\n\n const sliderMin = document.getEle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the id of patterns that shouldn't be related anymore oldArray newArray | function patternsToUnrelate(oldArray, newArray) {
console.log('oldArray');
console.log(oldArray);
console.log('newArray');
console.log(newArray);
// var ids2Unrelate = oldArray.filter(elem => !newArray.includes(elem.padroes_id));
var ids2Unrelate = oldArray;
for(let i=0; i<oldArray.length;... | [
"function b_copy_array_to_new_noduplicates(old_array){\n const new_array = [];\n // skip if old_array is not an array type\n if(old_array && Array.isArray(old_array)){\n if(old_array.length){\n for (let i = 0, item; item = old_array[i]; i++) {\n // skip if item ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creating a dummyController to test dummy json data | function dummyController(req, res) {
res.send(taqueria);
} | [
"apiRestTest(){}",
"function initDummyData(){\n //Initialize form with basic data for person\n $scope.person = {};\n $scope.person.first = \"John\";\n $scope.person.middle = \"Jay\";\n $scope.person.last = \"Smith\";\n $scope.pe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the bars for all of the facebook events | function addEventsBars(bounds, g, barWidth) {
let y = d3.scale.linear()
.range([(bounds.height/2), (bounds.height)]);
y.domain([0, d3.max(facebookData, d =>
(d.interested_count > d.attending_count) ? d.interested_count : d.attending_count)
]);
let bar = g.selectAll(".events")
.data(facebookData)... | [
"function getFacebookEvents() {\n axios.get(\"https://graph.facebook.com/v2.5/UCLUTechSoc/events\", {\n params: {\n access_token: ACCESS_TOKEN,\n fields: [\n \"name\",\n \"start_time\",\n \"attending_count\",\n \"interested_count\"\n ].join(\",\"),\n limit: 200, /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an object containing the historic price of each asset. | async function getHistoricPrices (assets) {
const historicPrices = {}
const promises = assets.map((asset) => asset.getHistoricPrice())
await Promise.all(promises)
assets.forEach((asset) => {
if (asset.historicPrice) historicPrices[asset.id] = asset.historicPrice
})
return historicPrices
} | [
"function getHistoricalPrice() {\n return $.ajax(`${HIST_PRICE_API_URL}${assetSelected}/history?date=${dateSelected}`);\n}",
"function getPrices(activeMarketHistory, feedPrice) {\n let latestPrice;\n if (activeMarketHistory.size) {\n const latest_two = activeMarketHistory.take(2);\n const l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a JavaScript conditional statement to sort three numbers. Display an alert box to show the result. | function sortNumber(num1, num2, num3) {
if (num1 > num2 && num1 > num3 && num2 > num3)
return num1 + " " + num2 + " " + num3;
else if (num2 > num1 && num2 > num3 && num1 > num3)
return num2 + " " + num1 + " " + num3;
else if (num3 > num1 && num3 > num2 && num1 > num2)
return nu... | [
"function sort3Reals() {\n\tvar real1 = parseFloat(document.getElementById(\"real41TB\").value),\n\t\treal2 = parseFloat(document.getElementById(\"real42TB\").value), \n\t\treal3 = parseFloat(document.getElementById(\"real43TB\").value);\n\n\tif (real1 > real2) {\n if (real1 > real3) {\n \talert(\"1. ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copyright 2000,2001 Macromedia, Inc. All rights reserved. CLASS: TagMenu DESCRIPTION: This class represents a select form control which displays the existing tags of a given type. PUBLIC PROPERTIES: PUBLIC FUNCTIONS: FUNCTION: TagMenu DESCRIPTION: ARGUMENTS: RETURNS: | function TagMenu(behaviorName, paramName, tagNames) {
this.behaviorName = behaviorName;
this.paramName = paramName;
this.tagHiddenInLiveData = false;
//Create the list of tag names that should be displayed
this.tagList = tagNames.toUpperCase().split(",");
this.tagTypeList = new Array();
if (t... | [
"function buildTagDropDown(tag){\n\t\t//Append the Option elements to the 'tagSelect' select element\n\t\ttagSelect.append(\"<option value='\" + tag + \"'>\" + tag + \"</option>\");\n\t}",
"function Dropdown(parent_id, item = {}) {\n item.type = \"select\";\n item.id = item.id || \"{0}_{1}\".format(item.typ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
events clear filter button | function eventsClearFilterButton() {
var $filters = $('.location-filter');
if ($filters.length) {
$filters.on('change', 'input', function () {
clearBtnState();
});
// clear button event
$('.btn-clear-form').on('click', function (e) {
e.preventDefault();
clearFilterTags();
searchSho... | [
"function clearFilterClick() {\n filterBar.value = '';\n clearFilter();\n}",
"function filterClear(){\r\n\t\tg_searchText = \"\";\r\n\t\tjQuery('.uc-catdialog-button-clearfilter').val('');\r\n\t\tloadCats();\r\n\t}",
"function clearFiltering() {\n document.getElementById(\"filter-container\").inner... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset cookies holding records of selected tickets and items to 0 | function resetCookies(){
var basket_details = getCookie("basket_details");
var in_basket = getCookie("in_basket");
var basic_details = getCookie("basic_details");
var vip_details = getCookie("vip_details");
var pro_details = getCookie("pro_details");
var wb_details = getCookie("wb_details");
var tt_det... | [
"function resetCookies() {\n\t\tcookies.set('chocolate', 0);\n\t\tcookies.set('sugar', 0);\n\t\tcookies.set('lemon', 0);\n\t\tfillCounts();\n\t}",
"function clearSelectionCookies() {\n $.cookie(\"for_os\", null, {path: '/'});\n $.cookie(\"for_browser\", null, {path: '/'});\n }",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MP (men's preferences) is the preference matrix of the men: MP[i][j] is the jth most preferred man of woman i WS (women's scores (of the men)) is the score matrix of the women: WS[i][j] is the score of man j for woman i (range from 1 to n) M is the man in the stable pair W is the woman in the stable pair | function isStablePair(M, W, MP, WS) {
let n = MP.length;
//index of next women to ask for each man:
let N = new Array(n).fill(0);
//man currently engaged to each woman
let E = new Array(n).fill(-1);
//score currently achieved by each woman
let CS = new Array(n).fill(0);
// alert('6');
while (MP[M][N[M... | [
"function getScoreMatrix(prefM) {\n let n = prefM.length;\n let SM = new Array(n);\n for (let w = 0; w < n; w++) {\n SM[w] = new Array(n);\n for (let k = 0; k<n; k++) {\n m = prefM[w][k];\n SM[w][m] = n-k;\n }\n }\n return SM;\n}",
"function getPreferences... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads a csv with the aiports and cities and parses it into an array of objects. Then it inserts the each object as a row in the db | function seedAirportLocations(filename){
// Read csv file, parse into an object and then insert values into table JetBlue
// When parsing, it also generates a random temperature
let parsed_data = reader.readFile(filename, function(parsed_data){
parsed_data = addRandomTemperature(parsed_data);
... | [
"function addCitiesToDB() {\n var citiesMetadata = fs.readFileSync('../scraped_cities/scraped_cities5000.csv', 'utf8');\n var db = getConnection();\n\n Papa.parse(citiesMetadata, {\n header: true,\n dynamicTyping: true,\n step: function(row) {\n var locArr = [];\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create row from data. | function createRow(data) {
var row = document.createElement("tr");
row.innerHTML = "<td></td><td></td><td></td>";
var cells = row.querySelectorAll("td");
cells[0].appendChild(document.createTextNode(data.name));
cells[1].appendChild(document.createTextNode(data.size));
... | [
"function createTblRow(...data) {\n\t// 1. Create table row\n\tconst newTr = document.createElement('tr');\n\t// 2. Create table data for every data and append to table row\n\tfor (let i = 0; i < data.length; i++) {\n\t\tconst newTd = document.createElement('td');\n\t\tnewTd.textContent = data[i];\n\t\t// Append ta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to remove extension from submission's filename and append it into the beginning of the name. (Ex: 123[khoi][SEGMENT].cpp > 123cpp[khoi][SEGMENT]). This helps insert new submission into the database easier. | function beautifyFilename(filename) {
var tokens = filename.split('.');
var tripped = tokens[0];
var ext = tokens[tokens.length - 1].toLowerCase();
tokens = tripped.split('-');
tokens.splice(1, 0, ext);
var newFilename = tokens.join('-');
return newFilename;
} | [
"function UpdateFileName(fileName, extension) {\n\tfileName = fileName.split('.');\n\tfileName.pop();\n\t\n\tif(extension !== null) fileName.push(extension);\n\t\n\treturn fileName.join('.');\n}",
"function UpdateFileName(fileName, extension) {\n\tvar fileName = fileName.split('.');\n\tfileName.pop();\n\t(extensi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion suma de los gastos | function suma (alojamiento, transporte, comida){
let gastos = parseInt(alojamiento) + parseInt (transporte) + parseInt (comida);
document.write("El destino que elegiste es " + destino + "<br>");
document.write("La suma de tus gastos es de: " + gastos + "<br>" );
} | [
"getGananciaPromedio() {\n let sum = 0;\n this.ganancias.forEach(num => {\n sum += num;\n });\n return sum / this.ganancias.length\n }",
"calcTotal() {\n let total = 0;\n\n this.pedido.hamburguesas.forEach(hamburguesa => {\n let estePrecio = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
I don't remember seeing 'in' like that is it as simple as it looks? find Q: Write a function called removeUser which accepts an array of objects, each with a key of username, and a string. The function should remove the object from the array and return this object. If the object is not found, return undefined. | function removeUser(usersArray, str) {
let foundIndex = usersArray.findIndex(function(user) {
return user.username === username;
})
if(foundIndex === -1) return;
return usersArray.splice(foundIndex, 1)[0];
} | [
"function removeUser(usersArray, username) {\n let indexFind = usersArray.findIndex(function(user) {\n return user.username === username;\n })\n if(indexFind === -1) return;\n return usersArray.splice(indexFind,1)[0];\n}",
"function removeUser(userList, username){\n\tlet newList = Object.assign({}, userLis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wipe session for the user | function wipe(username) {
Session.remove({ username: username}, (err) => {
console.log(`[SESSION] something wrong with session for ${username}`);
});
} | [
"function wipe(username) {\n Session.remove({ username: username }, (err) => {\n console.log(`[SESSION] Purged session for user: ${username}`);\n });\n}",
"function destroySession() {\n AccessToken.clear();\n updateSessionState(SessionState.LOGGED_OUT);\n $state.reloa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the browser icon to the current painted image in browserIconCtx. | function updateBrowserIcon() {
if (browserIconCtx) chromeBrowserAction.setIcon({ imageData: { "38": browserIconCtx.getImageData(0, 0, 38, 38) } });
} | [
"function updateBrowserIcon(whichIcon){\n const browserIcon = document.querySelector('.browser-icon')\n const path = `img/icons/browsers/${whichIcon}.svg`\n browserIcon.src = path\n }",
"function update_icon()\n {\n const icon = bookmarks.is_unlocked() ? \"unlocked-bookmarks.svg\" :\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Require Extensions only if this compiler will generate js code ifdef TARGET_JS This segment adds extensions to node's `require` function for LiteScript files so that you can just `require` a .lite.md file without having to compile it ahead of time helper function extension_LoadLS(requiringModule, filename) | function extension_LoadLS(requiringModule, filename){
//Read the file, then compile using the `compile` function above.
//Then use node's built-in compile function to compile the generated JavaScript.
//var options = new GeneralOptions
var options = new GeneralOptions();
//options.verboseLevel... | [
"function extension_LoadLS(requiringModule, filename){\n\n//Read the file, then compile using the `compile` function above.\n//Then use node's built-in compile function to compile the generated JavaScript.\n\n var content = compile(filename, Environment.loadFile(filename), {verbose: 0, warnings: 0});\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function for changing the question and updating the buttons | function change_question() {
self.questions[current_question_index].render(question_container);
$('#prev-question-button').prop('disabled', current_question_index === 0);
$('#next-question-button').prop('disabled', current_question_index === self.questions.length - 1);
// When the question is c... | [
"function changeQ() {\n for (var i = 0; i < questions[counter].question.length; i++) {\n var populateQuestions = $('#question');\n $(populateQuestions).text(questions[counter].question[0]);\n }\n\n // populates dom with answers when change question button is clicked.\n for (var j = 0; j < ques... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers a callback for when `onDeny` is fired. | onDeny(callback) {
this.component.onDeny.subscribe((res) => callback(res));
return this;
} | [
"denied(id) {\n const ids = this._arr(id)\n const undenied = ids.filter(i => this.status(id) !== 'denied')\n if (!undenied.length) return new Promise(r => r())\n return this._listener('deny', undenied)\n }",
"async onDeny(request, id) {\n let requests = this.state.requests;\n let index = reques... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return a single select2 id or the first if tags return null if nothing provide id, jquery object or element object | function getSelectedID(select2_) {
var select2 = _getSelect2(select2_);
var values = select2.val();
if (values) {
if (typeof values === "string")
return values;
return values[0];
}
return null;
} | [
"function getDdlOptionId() {\n var el = jQuery(this);\n var text = '';\n if (!el.hasClass('null')) {\n text = el.data('id');\n if (!text)\n text = '';\n }\n return text;\n}",
"function getFirstId(element) {\n if (element.hasAttribute(\"id\")) {\n return element.ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is called whenever we recieve any information in the question display topic. If we get an array, we will populate the board with it. If this is an individual question, we will display it in the modal or collect the daily double bet, depending on the type of question we received. | function handleQuestionDisplay(topic, data)
{
data = JSON.parse(data);
// If we have recieved an array back, we're just starting up and want to populate the board with questions.
if (data instanceof Array) {
populateBoard(data);
return;
}
question.set... | [
"function questionDisplay (){\n\t\tseinfeld.data[count].postQuestAns();\n\t\tseinfeld.data[count].correctAnswer();\n\t\tseinfeld.data[count].incorrectAnswers();\n\t}",
"function displayQuestions(){\n\t\t\tfor(i = 0; i < array.length; i++){\n\t\t\t\tQuestions(array[i]);\n\t\t\t}\n\t\t}",
"function displayQuestio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function draws initial stacked area graph for data of the whole world and also is used to draw a new stacked area graph for a specifically selected country as an update function. | function areaMaker(selectCode, codeCountryData) {
codeData = codeCountryData
var selectCountry;
// draw initial stacked area graph with data for the whole world
if (selectCode == "null") {
selectCountry = "the world";
}
// draw stacked area graph for selected country
else {
... | [
"function drawStackedAreaChart(svgid, data) {\n\n\tvar svg_html = ' Temporal change in neighborhoods<br><br><svg id=\"stackedAreaChart\" ' +\n\t\t\t\t 'width=\"'+app.ChartWidth.replace('px','')+'\" height=\"'+app.ChartHeight.replace('px','')+'\"></svg>'\n\t$(\"#map\"+app.m).html(svg_ht... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The following function builds and writes the menu. It selects the type of list and image to write by first looking at the first character of the link. It then checks whether it should highlight the page it's on in reference to the list of links. This is accomplished using the next function (menuItemHighlighter()). | function buildMenu() {
var theMenu = new String('');
var firstLevelCounter = new Number(0);
var firstLevelHighlight = new Boolean(true);
var closeTag = new Boolean();
for (var i in linx) {
switch(linx[i].charAt(0)) {
case '%':
if (closeTag == true) { theMe... | [
"function buildMenu(type) {\r\n var newMenu = \"\";\r\n for (var i = 0; i < linkMenu.length; i++) {\r\n if (linkMenu[i][1] === \"-HEAD-\" && linkMenu[i][2] == type) {\r\n newMenu += \"<span>\" + linkMenu[i][0] + \"</span> \";\r\n } else if (linkMenu[i][1] !== \"-HEAD-\" && linkMenu[i][2] == type) {\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the manager options and pass in the products data from the database | function loadManagerOptions(products) {
inquirer
.prompt({
type: "list",
name: "choice",
choices: ["View Products for Sale", "View Low Inventory", "Add to Inventory", "Add New Product", "Quit"],
message: "What would you like to do?"
})
.then(function(val) {
switch (val.choice... | [
"function loadProducts(){\n productService.products().then(function(data){\n all_products = data;\n setOptions();\n setupListeners();\n })\n}",
"function populateArtworkOptions () {\n\n const qData = {\n method:'getArtworkOptions'\n }\n callProductsService(qData)\n .then( data ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The canto object has an angleUnit property that specifies how angles are measured. Legal values are "radians" (the default) and "degrees". The value of this property affects the interpretation of angles in the arc(), ellipse(), rotate(), left() and right() methods, but does not affect the interpretation of angles in th... | get angleUnit() {
if (this._useDegrees) return "degrees";
else return "radians"
} | [
"convertFromTo(angle) {\n\treturn this.normalizeDegrees(angle - 180);\n }",
"_degreeToRadian(angle) {\n return angle * Math.PI / 180;\n }",
"function toRadians(degrees){\n return degrees * Math.PI / 180; \n}",
"get angle() {\n return this.transform.rotation * RAD_TO_DEG;\n }",
"toDegrees(radians)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return object which can be sent to clients, to represent this game's data | getGameData() {
return {
d: this._data,
m: this._moved,
t: this._taken,
w: this.winner,
};
} | [
"function newGameObj() {\n return {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\"\n },\n body: JSON.stringify({\n completed: false,\n winner: 0\n })\n }\n}",
"function get_new_gamedata() {\r\n\treturn {\r\n\t\t'tu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dequeues the next process in the queue. Return the dequeue'd process | dequeue() { // removes the item from the queue FIFO
return this.processes.shift(); // use array shift
} | [
"dequeue() {\n return this\n .processes\n .shift();\n }",
"function dequeue () {\n // Nothing to process.\n if (queue.size === 0) return\n\n // Too many jobs running already.\n if (running.size >= jobs) return\n\n // Remove first job from queue (FIFO).\n const job... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Url for searching for band | function buildSearchUrl(band) {
return proxyUrl + searchUrl + band + searchUrlEnd;
} | [
"function setUrls() {\n omdb = \"http://www.omdbapi.com/?t=\" + search + \"&y=&plot=short&apikey=trilogy\";\n band = \"https://rest.bandsintown.com/artists/\" + search + \"/events?app_id=codingbootcamp\";\n}",
"function build_url(pattern) {\n var base_url = \"https://gwo.pl/booksApi/v1/search?query=\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This class defines a complete listener for a parse tree produced by ExprParser. | function ExprListener() {
antlr4.tree.ParseTreeListener.call(this);
return this;
} | [
"function ExprParserListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"function r_A_A__Q_A_Q__B_C__D_E_Listener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"function Listener() {\n\tantlr.tree.ParseTreeListener.call(this);\n this.nodeMap = {};\n this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new instance of the `PdfNumber` class. | function PdfNumber(value){/**
* Sotres the `position`.
* @default -1
* @private
*/this.position5=-1;this.value=value;} | [
"function PdfNumber(value) {\n /**\n * Sotres the `position`.\n * @default -1\n * @private\n */\n this.position5 = -1;\n this.value = value;\n }",
"function Pdf(url) {\n\t//-------------------------------------------------------------------------------------... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name: loadJSFiles Description: loadJSFiles recursively calls itself until all javascript files passed in through jsFiles has been loaded. The files are loaded into the HTML right before the ending tag. An array of strings that contain the names of the javascript files to be loaded should be passed in for the jsFiles pa... | function loadJSFiles(jsFiles, index) {
if (index < jsFiles.length) {
jsFile = jsFiles[index];
index++;
var body = document.getElementsByTagName('body')[0];
var scrScript = document.createElement('script');
scrScript.type= "text/javascript";
//... | [
"function loadJSFile(files, callback) {\r\n var file;\r\n\r\n if (typeof files === 'string') {\r\n file = files;\r\n simpleLoadJS(file, function (script) {\r\n if (typeof callback === 'function') {\r\n callback(script);\r\n }\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mark selected items as Complete | function completeItems() {
for (var i = 0; i < listComponent.selected.length; i++) {
var itemJson = JSON.parse(listComponent.selected[i].dataset.item);
// Find uncompleted item that matches
for (var j = 0; j < listComponent.unCompleted.length; j++) {
if (listComponent.unCompleted[j].conte... | [
"markItemComplete(id) {\r\n // Changes the item complete state to the opposite of it current state\r\n this.getItemById(id).is_complete = !this.getItemById(id).is_complete;\r\n\r\n // Updates the state\r\n this.update();\r\n }",
"function completeItem() { \n\n $(this).paren... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
passes data attribute of sidebar Pokemon to App's fetchPokemonByName() this data is used to setState of app.state.focus | handleClick(e) {
this.props.fetchPokemonByName(e.target.dataset.name)
} | [
"function populatePokemonData ( data ) {\n\n $.ajax('http://pokeapi.co/api/v1/sprite/'+ dataIdForSprite + '/', {\n method: 'GET'\n })\n .done( populatePic )\n .fail( function () {\n console.log('Default Pic fail');\n });\n\n pokemonName = data['name'];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initialize the PruneClusters, and override some factory methods | function initPruneCluster() {
// create a new PruceCluster object, with a minimal cluster size of (30)
// updated arg to 30; seems to really help countries like China/India
CONFIG.clusters = new PruneClusterForLeaflet(30);
CONFIG.map.addLayer(CONFIG.clusters);
// this is from the categories example; sets ups... | [
"constructor() { \n \n Clusters.initialize(this);\n }",
"function ClusterAlgorithm() {}",
"initializeGridBasedClusters () {\n\t\tlet maxX = this.params.maxX;\n\t\tlet maxY = this.params.maxY;\n\t\tlet minX = this.params.minX;\n\t\tlet minY = this.params.minY;\n\t\tlet dataSize = this.dataIn.len... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function getFood(Category) Event handler for dropdown menu selection The purpose of this function is to do an API Ajax Query for the input Category for the global variable CurrentCity. Once the data comes back the appropriate data is parsed from the JSON and entered into the FoodArray. | function getFood(Category) {
if (DebugOn) console.log ("In getFood: " + CurrentCity + "," + Category);
// ajax Query with the cityName and Category
// after response from query
// create pointer to empty FoodArray
var FoodArray = [];
// One by one fill the FoodArray
// Also need to make sure that there ar... | [
"function getCategories() {\n $(\"#categoryName\").html(\" \");\n // let categoryList = $(\"#categoryList\");\n $.getJSON('/api/categories/', (categories) => {\n $.each(categories, (index, category) => {\n $(\"#categoryList\").append(\n $(\"<a />... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Round numbers to a given decimal point | function round(number,decimal_points) {
if (number == null) return 'NaN';
if (!decimal_points || decimal_points == null) return Math.round(number);
var exp = Math.pow(10, decimal_points);
number = Math.round(number * exp) / exp;
return parseFloat(number.toFixed(decimal_points));
} | [
"round(value, decimals){\n return value.toFixed(decimals)\n }",
"function roundOneDecimal(num) {\n return Math.round(num * 10) / 10\n}",
"function roundIt(value) {\n let places = 100;\n if (value < 100) {\n places = 10000;\n } else if (value < 0.001) {\n places = 1000000;\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Type of the ViewChild decorator / constructor function. | function ViewChildDecorator() {} | [
"function ViewChildDecorator(){}",
"function ViewChildDecorator() { }",
"function ViewChildrenDecorator(){}",
"function ViewChildrenDecorator() {}",
"function ContentChildDecorator() {}",
"function ContentChildDecorator(){}",
"function ViewChildrenDecorator() { }",
"function ContentChildDecorator() { ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Capture characters into a buffer until encountering a character. | captureToChar(char) {
let { i: start } = this;
const { chunk } = this;
// eslint-disable-next-line no-constant-condition
while (true) {
let c = this.getCode();
switch (c) {
case NL_LIKE:
this.text += `${chunk.slice(start, this.p... | [
"function processBuffer() {\n var messages = buffer.split('\\n');\n buffer = \"\";\n\n processMessages(messages);\n}",
"function parseBuffer(buf, callback)\n {\n var idxStart = 0;\n var idxCurrent = 0;\n\n while (idxCurrent < buf.length) {\n if (buf[idxCurrent] == 13 &&... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implementation of fetch call with a paramterized input based on adventure ID | async function fetchAdventureDetails(adventureId) {
// TODO: MODULE_ADVENTURE_DETAILS
// 1. Fetch the details of the adventure by making an API call
try {
const response = await fetch(
`${config.backendEndpoint}/adventures/detail?adventure=${adventureId}`
).then((res) => res.json());
return resp... | [
"async function fetchAdventureDetails(adventureId) {\n // TODO: MODULE_ADVENTURE_DETAILS\n // 1. Fetch the details of the adventure by making an API call\n try{\n const response = await fetch(`${config.backendEndpoint}/adventures/detail?adventure=${adventureId}`);\n const data = await response.json();\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handles rendering the ratings on the drawer | renderRatings() {
return (
<div >
<Button bsStyle="primary" onClick={this._openRatingsModal}>Rate this sidewalk</Button>
<SidewalkRatingsModal open={this.state.ratingsModalOpen} onClose={this._closeRatingsModal} />
{this.renderRatingsAmount()}
<hr />
<h4>Overall: {this._formatRating(this.state.... | [
"renderRatings() {\n\t\tvar { ratingsAverage, numRatings } = this.state;\n\t\tif( ratingsAverage && numRatings ) {\n\t\t\treturn (\n\t\t\t\t<div className=\"rating-content\">\n\t\t\t\t\t<span className=\"rating-review\">{ ratingsAverage }</span><span className=\"num-reviews\"> out of { numRatings } Reviews</span>\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns an ordinal scale of multihue colors with normalized/comparable brightness | function multiHueScaleFactory(a,b){return(0,_scale.scaleOrdinal)({range:(0,_theme.getPaletteForBrightness)(a,b)})}// returns an ordinal scale of single-hue colors with varying brightness (dark to light) | [
"function computeColorScale() {\n var blue = chroma('darkblue');\n var red = chroma('darkred');\n var white = chroma('white');\n return scale = [[0, blue.css()], [0.35, white.css()], [0.5, white.css()], [0.65, white.css()], [1, red.css()]];\n}",
"numberToColorHsl(i, min, max) {\n var ratio ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Now, let's set up the functions we will need for the rotations Shuffle the slide array | function shuffle()
{
var o = slides;
for (var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
slides = o;
} | [
"function shuffle() {\n\n\t\tvar slides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );\n\n\t\tslides.forEach( function( slide ) {\n\n\t\t\t// Insert this slide next to another random slide. This may\n\t\t\t// cause the slide to insert before itself but that's fine.\n\t\t\tdom.slides.insert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an instance of CookieStorage. | constructor() {
copyKeys(this, cookieStore);
} | [
"function CookieStorage() {\n _classCallCheck(this, CookieStorage);\n\n copyKeys(this, _cookieStorage2.default);\n }",
"function Storage() {\n _classCallCheck(this, Storage);\n this.storage = this.initStorage();\n }",
"function Storage() {\n classCallCheck(this, Storage);\n\n this.storage = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
graph requires full dataset of the simulation | drawGraphGas(data) {
var mapToPoint = function(x,y) { return {x:x,y:y} }
var es = this.estimator
const wpostGas = data.map((d) => d.wpost*es.wpostGas)
const pregas = data.map((d) => d.commits*es.preGas)
const provegas = data.map((d) => d.commits*es.proveGas)
var ctx = do... | [
"generateGraphData() {\n this.graph.generateData();\n }",
"function makeGraph() {\n \n }",
"generateGraphData() {\n this.sequencer.generateGraphData();\n }",
"drawGraph() {\n logger.debug(`${logContext}.drawGraph<${SpeakingTime.graphType}>: entered`);\n const chart = th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the pagination links based on the ContentRange and Link headers. jqXHR: the ajax xhr | function paginate(jqXHR){
// get the pagination ul
var paginate = $('#pagination ul.pager');
paginate.empty();
var info = $('#info');
info.empty();
// set the content range info
var rangeHeader = jqXHR.getResponseHeader('Content-Range');
var total = rang... | [
"function paginate(jqXHR){\n\n // get the pagination ul\n var paginate = $('ul.pager');\n paginate.empty();\n var info = $('#info');\n info.empty();\n\n // set the content range info\n var rangeHeader = jqXHR.getResponseHeader('Content-Range');\n var total = r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes the matrix and text and outputs a string that's the formatted text. | function formatText(matrix, text, spacesKept) {
var output = "";
var textIndex = 0;
for (var row = 0; row < matrix.length; row++) {
for (var col = 0; col < matrix[row].length; col++) {
/* if the average alpha is less than half transparent */
if (matrix[row][col].a < 127) {
... | [
"printMatrix() {\r\n\t\tlet s = \"\";\r\n\t\tfor (let i = 1; i <= this.m; i++) {\r\n\t\t\ts += '[';\r\n\t\t\tlet row = [];\r\n\t\t\tfor (let j = 1; j <= this.n; j++) {\r\n\t\t\t\trow.push(this.getItem(i, j));\r\n\t\t\t}\r\n\t\t\ts += row.join(', ') + ']\\n';\r\n\t\t}\r\n\t\treturn s;\r\n\t}",
"formatText(input, j... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Flip the hint tile and hide the hint on it. | function hide_hint() {
if ($scope.game_phase != 'not_yet_started') {
var e = document.getElementById("hint_place");
e.style.lineHeight = "18px";
e.innerHTML = '<font size="4px" color="silver"><p style="margin-bottom:5px;">Spell a word that stands for following meaning</font><... | [
"function hideHint() {\n\t\t\t$(\"#viewshedangles_toggle_checkbox_hint_container\").css({left: \"-99999px\", right: \"auto\"});\n\t\t\tif(!is_viewshed_angles_layer_displayed) {\n\t\t\t\t$(\"#viewshedangles_checkbox_unchecked\").css({opacity: 1});\n\t\t\t}\n\t\t}",
"function hideHint() {\n\t\t\t$(\"#landmarks_togg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts the command controller into the document. Make sure that it is inserted before the conflicting Thunderbird command controller. | function injectCalendarCommandController() {
calendarController.defaultController = document.getElementById("tabmail").tabController;
top.controllers.insertControllerAt(0, calendarController);
document.commandDispatcher.updateCommands("calendar_commands");
} | [
"function insertCommand(command) {\r\n\tif (skipCommand(command)) return;\r\n\t\r\n\t// Generate command text\r\n\ttry {\r\n\t\tcommand.variabilize(coscripter.db);\r\n\t\tvar commandText = command.toSlop();\r\n\t} catch (e) {\r\n\t\tdump('Error making slop: ' + e.toSource() + '\\n');\r\n\t\tdebug('Error making slop... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION TO HANDLE THE ACTIVE CLASS | function handleActive(e) {
//REMOVE ACTIVE CLASS
e.target.parentElement.querySelectorAll(".active").forEach((el) => {
el.classList.remove("active");
});
// Add class active
e.target.classList.add("active");
} | [
"handleClasses() {\n\t\tthis.$el.is('.' + this.options.activeClass) ? App.Vent.trigger(App.Events.btnClose, {\n\t\t\t'el': this.$el\n\t\t}) : App.Vent.trigger(App.Events.btnOpen, {\n\t\t\t'el': this.$el\n\t\t});\n\t}",
"_updateActiveClasses() {\n toggleClass(this.handleEl, 'active', this.isActive);\n toggle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |