query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Handles the click on the name of the folder in the explorer.
function onFolderNameClick() { var clickedLink = $(this); if (clickedLink.closest("li").hasClass("collapsed")) { clickedLink.siblings('div').click(); } const elementId = $(this).attr("data-id"); showFolderOrFileContentById(elementId); }
[ "function clickFolder(e) {\n const folder = e.target.closest('.bookmark-folder');\n const subFolderBtn = e.target.closest('i.fa-level-down-alt');\n\n if (!folder) {\n return;\n }\n\n if (!!subFolderBtn) {\n if (parseInt(folder.dataset.folders) > 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses given JSON Schema string. Prevents invalid JSON to be consumed by a validator.
resolveJsonSchema(jsonSchema) { let resolvedJsonSchema = jsonSchema; if (typeof jsonSchema === 'string') { try { resolvedJsonSchema = parseJson(jsonSchema); } catch (error) { const unparsableJsonSchemaError = new errors.SchemaNotJsonParsableError( `Given JSON Schema is not...
[ "function IsValidJsonString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n }", "parseJsonToObject(str) {\n try {\n const obj = JSON.parse(str);\n return obj;\n } catch (error) {\n return {};\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor, for users who consider it annoying.
get ConfigInputTextCursorBlink() { return this.native.ConfigInputTextCursorBlink; }
[ "_setDefault(){\n this.defaultCursor = \"default\";\n // this.hOverCursor = \"pointer\";\n }", "function pauseCursorBlink() {\n \n // Remove and add \"blinking\"-class\n inputCurrent.removeClass(CLASS_BLINK);\n setTimeout(function() {\n inputCurrent.addClass(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to create TimeSlot and save in database Removes other entires that belong to the current user
async function createTimeSlots() { if (!formData.slot1 || !formData.slot2 || !formData.slot3) return; formData.userid = (await Auth.currentSession()).getIdToken().payload["cognito:username"]; // Loop through TimeSlots and remove any that belong to the current user var timeSlots...
[ "function saveTime() {\n firebase.auth().onAuthStateChanged(function (user) {\n let d = new Date();\n let showerDate = d.toDateString().slice(0, 15);\n let userRef = db.collection(\"users\").doc(user.uid);\n userRef.collection(\"times\").add({\n date: showerDate,\n time: currentTimer\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of all known objects of the given type.
function getObjectsOfType(objType) { var objArr = []; for (var i = 0; i < objects.length; i++) { if (objects[i] instanceof objType) { objArr.push(objects[i]); } } return objArr; }
[ "_collectClasses() {\n const result = []\n let current = Object.getPrototypeOf(this)\n while (current.constructor.name !== 'Object') {\n result.push(current)\n current = Object.getPrototypeOf(current)\n }\n return result\n }", "allObjects() {\n return fs.readdirSync(Files.gitletPath('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscribe to workspace commands
subscribeToCommands () { for (const command of workspaceCommandNames) { this.subscriptions.add( atom.commands.add('atom-workspace', command, () => { // this will not activate package fully because of command prop this.activateFn(command) }) ) } }
[ "function registerCommands() {\r\n return [\r\n vscode_1.commands.registerCommand('rls.update', () => { var _a; return (_a = activeWorkspace.value) === null || _a === void 0 ? void 0 : _a.rustupUpdate(); }),\r\n vscode_1.commands.registerCommand('rls.restart', () => __awaiter(this, void 0, void 0, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves localespecific rules used to determine which day period to use when more than one period is defined for a locale. There is a rule for each defined day period. The first rule is applied to the first day period and so on. Fall back to AM/PM when no rules are available. A rule can specify a period as time range,...
function getLocaleExtraDayPeriodRules(locale) { const data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); checkFullData(data); const rules = data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData][2 /* ExtraDayPeriodsRules */] || []; return rules....
[ "calculatePeriods() {\n\n // go through all jobs and generate compound child elements\n let chart = get(this, 'chart'),\n childs = get(this, 'childLines'),\n start = get(this, 'parentLine._start'),\n end = get(this, 'parentLine._end')\n\n // generate period segments\n let periods =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete the bound bank card Exchange
function DeleteBank(token, account_id, suc_func, error_func) { let api_url = 'del_us_bank_card.php', post_data = { 'token': token, 'account_id': account_id }; CallApi(api_url, post_data, suc_func, error_func); }
[ "async deleteSmartACKMailbox(){\n\t\tconst data = Buffer.from([0x0a, 0x05, 0x83, 0x4b, 0x83, 0x01, 0x9d, 0x45, 0x44]);\n\t\tawait this.sendData(this, data, null, 6);\n\t\tconst response = await this.waitForResponse();\n\t\tconst telegram = new HandleType2(this, response);\n\t\tconsole.log(`Delet Smart ACK mailbox: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TEMPORARY FORM FIELD STORAGE FOR COMPARISON
function storeFormValsTemporarily() { var myForm = arguments[0]; var formElementValues = convertFormElements(myForm); pageControl.setConvertedFormElements(formElementValues); }
[ "function fillSavedInputs() {\n const getFieldByName = name => $(`#id_${name}`);\n\n for (const fieldName in DOM.orderFieldData) { // Ignore ESLintBear (no-restricted-syntax)\n if ({}.hasOwnProperty.call(DOM.orderFieldData, fieldName)) {\n const $field = getFieldByName(fieldName);\n const ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Profile Created Validation For Popup
function profilecreatedforvalidation(){ if($("#profilecreatedforpopup").val() == ""){ $("#notnullprofilecreated").show(); return false; } else { $("#notnullprofilecreated").hide(); return true; } }
[ "function onProceedButtonClicked () {\n let isValid = true;\n let isProfileUrl = true;\n $('#onboardingProfessionError').hide()\n $('#onboardingBioError').hide()\n $('#onboardingPageNameError').hide()\n $('#onboardingProfileImageError').hide()\n const profileUrl = $('#profileImageDataURl')[0].s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the F distribution CDF
static cdf_f(f_stat, f1, f2) { var X = f_stat; var Z = X / (X + f2/f1); var Fcdf = this.Betacdf(Z, f1/2, f2/2); Fcdf = Math.round(Fcdf * 100000) / 100000; return Fcdf; }
[ "static cdf_t(t_stat, df) {\n\t\tvar X = t_stat;\n\t\tvar tcdf, betacdf;\n\n\t\tvar A = df/2;\n\t\tvar S = A+.5;\n\t\tvar Z = df / (df + X*X);\n\t\tvar BT = Math.exp(this.LogGamma(S)-this.LogGamma(.5)-this.LogGamma(A) + A * Math.log(Z) + .5 * Math.log(1-Z));\n\t\tif (Z < (A+1) / (S+2)) {\n\t\t\tbetacdf = BT * this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert a return character and enough spaces to indent the text so as to match the previous line.
function returnWithIndent() { // Selection DOM object const dSel = ta; // How many spaces will be put before the first non-space? var space = 0; if (dSel.selectionStart || dSel.selectionStart == '0') { var startPos = dSel.selectionStart; var end...
[ "function Return() {\n \t\t\tdebugMsg(\"ProgramParser : Return\");\n \t\t\tvar line=lexer.current.line;\n \t\t\t\n \t\t\tlexer.next();\n \t\t\t\n \t\t\tvar expr=Expr();\n \t\t\tvar ast=new ASTUnaryNode(\"return\",expr);\n \t\t\tast.line=line;\n \t\t\treturn ast;\n \t\t}", "indentation() {\n var _a\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Defines a reference to an enum able
function enumReference(table, colEnum, tableEnum, required = false) { const column = table .specificType(colEnum, "smallint") .references("id") .inTable(tableEnum); if (required) { column.notNullable(); } return column; }
[ "bindIdeLinkEnum() {\n this.app.singleton('ide.link', _IdeLink.default);\n }", "function Reference() {}", "function MoveEnumObj() {\n let e = d.Config.enums\n let i = u.GetNumber(event.target.id);\n if (i === 0) { return false; }\n let enumName = u.ID(\"selectAdminEnum\").value;\n let j;\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expects r and s to be positive DER integers. The DER format uses the most significant bit as a sign bit (& 0x80). If the significant bit is set AND the integer is positive, a 0x00 is prepended. Examples: 0 => 0x00 1 => 0x01 1 => 0xff 127 => 0x7f 127 => 0x81 128 => 0x0080 128 => 0x80 255 => 0x00ff 255 => 0xff01 16300 =>...
function encode (r, s) { var lenR = r.length var lenS = s.length if (lenR === 0) throw new Error('R length is zero') if (lenS === 0) throw new Error('S length is zero') if (lenR > 33) throw new Error('R length is too long') if (lenS > 33) throw new Error('S length is too long') if (r[0] & 0x80) thr...
[ "function toDER(r, s) {\n r = r.toArray()\n s = s.toArray()\n \n function constructLength(arr, len) {\n if (len < 0x80) {\n arr.push(len)\n return\n }\n \n let octets = 1 + (Math.log(len) / Math.LN2 >>> 3)\n arr.push(octets | 0x80)\n while (--octets) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to return an array with all the indexes where toSearch appears in str.
function allIndexOf(str, toSearch) { var indices = []; for (var pos = str.indexOf(toSearch); pos !== -1; pos = str.indexOf(toSearch, pos + 1)) { indices.push(pos); } return indices; }
[ "function findAllOccurances(arr, searchTerm, startIndex = 0) {\n let indexArray = [];\n for (let i = startIndex; i < arr.length; i++) {\n if (arr[i] == searchTerm) {\n indexArray.push(i)\n }\n }\n\n return indexArray;\n}", "function getIndicesOf(str, keywords) {\n\tvar searchl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a new offer to the user's wallet
function addItem(req, res, next) { var userId = req.userId, offerId = req.body.offerId; // the id in the postgres table console.log(JSON.stringify(req.body)); db.query('SELECT offerId FROM wallet WHERE userId=$1 AND offerId=$2', [userId, offerId], true) .then(function(offer) { ...
[ "async addOfferingToInvestmentMethod(req, res, next) {\n try {\n const {\n body,\n models: { Investments },\n } = req;\n var { offering, investment } = body;\n var inv = await Investments.findById(investment);\n if (!inv) {\n throw Error('Couldnt find this investment...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Ratings of this vssue according to the issue id
async getRatings() { try { if (!this.API || !this.issueR || this.isLoadingComments) return; this.isLoadingComments = true; const ratings = await this.API.getRatings({ accessToken: this.accessToken, issueId: this.issueR.id, ...
[ "function ratings_obj() {\n this.fi;\n this.vendor;\n this.audit_category;\n this.rating;\n this.date;\n }", "get ids() {\n return issues.map(obj => obj.id);\n }", "function getRatingByLearnerParnetId() {\n return db(\"ratings\").where(\"ratings...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a mapping from a resourceId to the filename of that resource
function createFileMap(resourceType, resourceMappingFile) { const fileMap = {}; const fileKeys = Object.keys(resourceMappingFile); fileKeys.forEach((key) => { const rMap = Array.isArray(resourceMappingFile[key]) ? resourceMappingFile[key] : [resourceMappingFile[key]]; rMap.forEach((map) => {...
[ "function ResourceKey(id, name) {\n this.id = id;\n this.name = name;\n }", "function run_getFileNameIdMap() {\n var fileNameIdMap = getFileNameIdMap();\n Logger.log(fileNameIdMap);\n}", "function mapImageResources(rootDir, subDir, type, resourceName) {\n var pathMap = {};\n shell.ls(pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that calculates clicked candle from d3.mouse coordinates and returns candle index in dtArray
calculateClickedCandle(coord) { return this.dataPointer - this.noCandles + Math.floor((coord[0] - this.xScale.step()*this.xScale.padding()/2)/this.xScale.step()); }
[ "function klik(evt) { // mousedown on svg\n function x2time(x, line) {\n\n function isBigEnough(element) {\n return element >= x;\n }\n\n // Get the sfaff measure number from an X-value;\n var measure = bars[line].xs.findIndex(isBigEnough) - 1;\n var measure_width = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
flip the current active block if possible
flipBlock(){ if(!this.started) return false; if(this.active.flip(this.grid)) postMessage(this.state); else console.log("couldn't flip"); }
[ "function restoreBlock() {\n if (blockStack.length > 0 && !currentBlock.isChildToggled()) {\n currentBlock.setIcon(true);\n currentBlock = blockStack.pop();\n currentBlock.setIcon(false);\n resizeCanvas(); // this redraws the screen\n return true;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provide function constructor and request as arguments. It will throw an exception if the constructor is not valid.
validateTransformerConstructor(constructor, request) { !validators_1.isFunction(constructor) && errorHandling_1.throwExpection(`Transformer does not exist "${request.url}"`); }
[ "function GenericRequest() {}", "makeTransformerInstance(constructor, request) {\n return validators_1.isFunction(constructor.make) ?\n constructor.make(request) :\n new constructor(request);\n }", "function myNew(constructor, ...args) {\n // skip this part...\n // it expla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SRP0[] Set Reference Point 0 0x10
function SRP0(state) { state.rp0 = state.stack.pop(); if (exports.DEBUG) { console.log(state.step, 'SRP0[]', state.rp0); } }
[ "constructor(sourceVoltage, connections) {\r\n //voltage point to copy, array of voltage points to copy it to\r\n this.sourceVoltage = sourceVoltage;\r\n this.connections = connections;\r\n }", "setFreeSpinsReelsData ( freeSpinReelsData = {}){\n this.getService(\"LinesService\").updateHistory();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check or Uncheck All Client CheckBox
function selectAllClientMenuCheckBox(){ if(document.getElementById('clientMenuSelectAllId').checked==true){ document.getElementById('clientMenuAddId').checked=true; document.getElementById('clientMenuViewId').checked=true; document.getElementById('clientMenuUpdateId').checked=true; document.getElementById('c...
[ "function selectAllCoutryMenuCheckBox(){ \n\tif(document.getElementById('countryMenuSelectAllId').checked==true){\n\n\t\tdocument.getElementById('countryMenuAddId').checked=true;\n\t\tdocument.getElementById('countryMenuViewId').checked=true;\n\t\tdocument.getElementById('countryMenuUpdateId').checked=true;\n\t\tdo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if it's a NodeJS output filesystem or if it's a foreign/virtual one. The internal webpack5 implementation of outputFileSystem is gracefulfs.
function isNodeOutputFS(compiler) { return compiler.outputFileSystem && JSON.stringify(compiler.outputFileSystem) === JSON.stringify(fs); }
[ "function isNodeOutputFS(compiler) {\n\treturn (\n\t\tcompiler.outputFileSystem &&\n\t\tcompiler.outputFileSystem.constructor &&\n\t\tcompiler.outputFileSystem.constructor.name === 'NodeOutputFileSystem'\n\t);\n}", "getOutput() {\n // Assuming it is production\n const output = {\n // Here we create a d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.
function isENOENT(error) { return isExpectedError(error, -ENOENT, 'ENOENT'); }
[ "function checkJavaErrno(ne) {\n if (ne instanceof NodeOSException) {\n return ne.getCode();\n }\n throw ne;\n}", "function getJavaErrno(ne) {\n if (ne instanceof OSException) {\n return ne.getStringCode();\n }\n return Constants.EIO;\n}", "validateFilePath(file) {\n try {\n if (fs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get information by http protocol
function getInfoByHttp(url, callback) { // http.get(url, function(res) { // var body = ''; // res.on('data', function(d) { // body += d; // console.log(body); // //callback(null, JSON.parse(body)); // }); // // res.on('end', function() { // // //var obj = JSO...
[ "static getLib (url) {\n let urlo = URL.parse(url);\n let lib;\n switch (urlo.protocol) {\n case 'http:':\n return HTTP;\n\n case 'https:':\n return HTTPS;\n }\n throw new Error(`Unknown protocol ${urlo.protocol}.`);\n }", "function checkForHTTP(url) {\n let outputString =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function remove the shake functionality
function removeShake() { document.getElementById('input').classList.remove('shake') }
[ "function shakeEventDidOccur () {\n\n //put your own code here etc.\n roll();\n}", "function upAndDownShake() {\n \t\tif (counter < numberOfShakes) {\n\n \t\t//Reset the element's position at the start of each shake\n \t\telement.style.transform = 'translate(' + startX + 'px, ' + startY + 'px)';\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Once we have confirmed that we want to share, prepare the tokbox publishing initiating and toggle back to the selects page
function screenConfirmed(isConfirmed) { document.getElementById("selects").innerHTML = ""; if (isConfirmed === true){ onAccessApproved(currentScreensharePickID); } togglePage(); }
[ "function ChooseTypeSubmit() {\n $Dialog.find('button').attr('disabled', 'disabled');\n TargetNS.FinishLinking(Conn.sourceId, Conn.targetId, Conn.connection);\n }", "function pushSubscription(chkbox){\n\tif(chkbox[\"selectedKeys\"]==null)\n\t\taudiencePushSubs=false;\n\telse\n\t\taudi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get List Item Type metadata
function GetItemTypeForListName(name) { return "SP.Data." + name.charAt(0).toUpperCase() + name.split(" ").join("").slice(1) + "ListItem"; }
[ "function getItemTypes() {\n\tvar itemTypes;\n\n\ttry {\n\t\titemTypes = com.ibm.team.workitem.web.cache.internal.Cache.getItem('workitems/itemTypes');\n\t} catch (e) {\n\t\titemTypes = null;\n\t}\n\n\treturn itemTypes;\n}", "function getType(item) {\n console.log(item + ' is a ' + typeof(item));\n}", "getData...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HSB to RGB conversion function Note: this function will not work if the hue value given is the maximum, i.e. 360 degrees. This is because the "i" value will then be 6, and there is no option specified for i=6 in the notes.
function HSBtoRGB(hue, saturation, brightness){ //Normalize input let h = hue*(Math.PI/180); let s = saturation/100; let b = brightness/100; //Define variables i and f let i = Math.floor((3*h)/Math.PI); let f = ((3*h)/Math.PI) - i; //Calculating RGB values let p = b * ...
[ "function RGBtoHSB(red, green, blue)\n{\n //Normalize input\n let r = red/255;\n let g = green/255;\n let b = blue/255;\n \n //Obtain maximum and minimum input values\n let maximum = max(r,g,b);\n let minimum = min(r,g,b);\n \n //Declare h, s, and b variables\n var hue;\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A Track of quaternion keyframe values.
function QuaternionKeyframeTrack( name, times, values, interpolation ) { KeyframeTrackConstructor.call( this, name, times, values, interpolation ); }
[ "function QuaternionKeyframeTrack( name, times, values, interpolation ) {\n \n KeyframeTrack.call( this, name, times, values, interpolation );\n \n }", "function Quaternion() {\n this.data = new Float32Array(4);\n this.data[0] = 0;\n this.data[1] = 0;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To add all parent directories of the given filePath to the given Ancestors object until an parent is reached which already exists in the given Paths object
function traverseUp( filePath, Paths, Ancestors ){ var index, start, end, split = filePath.split('^'); //Throw an error if there is more than one ^ in the given filePath if( split.length > 2 ){ throw new Error('Invalid File Path : ' + filePath) } //Get the start directory and the end string start = path.p...
[ "function collectAncestors( Ancestors, Paths ){\n\tAncestors.Starts.forEach(function( start, i ){\n\t\tAncestors.Ends[i].forEach(function( end ){\n\t\t\taddIfUnique( path.normalize(path.resolve(start+end)), Paths );\n\t\t})\n\t});\n\tAncestors.Starts = [];\n\tAncestors.Ends = [];\n\tAncestors.Base = '';\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add boxes to Lines GameField
function addBoxesToLineIds(id){ var BoxesNumber = Number(Boxes); var BoxesArray = []; var someNumber = 0; if (id<BoxesNumber){ /** * fill only Horizontal lines */ for (var i=(id*BoxesNumber);i<(BoxesNumber+...
[ "fields() {\n // sets \"this.current\" to fields\n this.current = \"fields\";\n // draws the grass\n background(104, 227, 64);\n \n // draws a path\n this.path(width/2, 0);\n \n // draws a pile of rocks or a well\n if (this.well) {\n this.makeWell();\n } else {\n this.rock...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME: buildDialogTable DESCRIPTION: builds and defines structure of dialog displayed when user mouse overs a Work Order event/transaction CALLED FROM: drawChart CALLS: n/a REQUIRES: info a singular JSON object containing all the value added information relating to the WO transaction selected on teh upper inter...
function buildDialogTable(info){ // declare local array defininf table column header names var rowSubjects = [ "Item Description:" , "MGBC:" , "SSCC:" , "Local Pallet ID:" , "BBD:" , "Date and Time:" , "Transaction Type:" , "Quantity:" , "UOM:"]; // append a simple HTML table to ...
[ "function buildInfoTable(rows) {\n var itable = { \n rows: rows,\n dataShape: {\n fieldDefinitions: {\n value: {aspects: {}, baseType: \"STRING\", name: \"value\" }, \n pressed: {aspects: {}, baseType: \"BOOLEAN\", name: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Using Helper function takes two values string s and start value Check if map has s if so get the value Iterate through the s with end being start + 1 so we can get the words in wordDict trim the s string with start and end Recursively ensure if trim is in dict set If so set the trimmed value in map and return true Else...
function helperMethod(s, start) { if (start === s.length) return true; if (map.has(s)) return map.get(s); for (let end = start + 1; end <= s.length; end++) { let trim = s.slice(start, end); if (dict.has(trim) && helperMethod(s, end)) { map.set(start, true...
[ "function isPrefix(trie, word){ \n for(let temp_word of trie){\n if( temp_word.substr(0, word.length) == word){\n return true;\n }\n }\n return false; \n}", "function checkInclusion(s1, s2) {\n let k = s1.length;\n let s1Count = new Map();\n let s2Count = new Map();\n\n for (let i = 0; i <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Invokes the ISR for the fs with the create flag.
function krnDiskCreate(fileName, callBack) { _KernelInterruptQueue.enqueue(new Interrupt(DISK_IRQ, [FS_OPS.CREATE,fileName, null, callBack ? callBack : krnPutAndDrop])); }
[ "function krnDiskDelete(fileName, callBack)\n{\n _KernelInterruptQueue.enqueue(new Interrupt(DISK_IRQ,\n [FS_OPS.DELETE, fileName, null, callBack ? callBack : krnPutAndDrop]));\n}", "function krnDiskLS(callBack)\n{\n _KernelInterruptQueue.enqueue(new Interrupt(DISK_IRQ,\n [FS_OPS.LS, null, nul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method will disconnect socket Return promise or callback
disconnect(callback) { return new promise( (resolve, reject) => { // Make sure socket exist and status is connected if (this.socket && this.isConnected === true) { // Socket exists this.isConnected = false this.socket.disconnect() return callback ? callb...
[ "function disconnect(){\n if(socket.connected){\n socket.disconnect();\n }\n}", "disconnect() {\n\t\tthis.debug('Requesting disconnect from peer');\n\t}", "close() {\n this[_socket].close();\n\n if (this[_timeout] !== null) {\n clearTimeout(this[_timeout]);\n }\n }", "close(callbac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6c Create a validate integer function that takes a number as a parameter and returns true if it is an integer.
function validateInteger(value) { return Number.isInteger(value); }
[ "function isInteger(test) {\n\tif ( !isNaN(parseInt(test,10)) && parseInt(Number(test)) == test ) {\n\t\treturn ( test > 0 );\n\t}\n\treturn false;\n\n}", "function isNumeric(input) {\n return Number.isInteger(input)\n}", "function safeParseInt(value) {\n if (!value) {\n return 0;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets a new task from the words distribution and updates the distribution accordingly
function getNewTask() { var random_menu = Math.round(Math.random()*2); var random_word_index = Math.round(Math.random()*7); while(words_and_distributions[random_menu][random_word_index][1] === 0) { random_menu = Math.round(Math.random()*2); random_word_index = Math.round(Math.random()*7); } words_and_d...
[ "function createNewTask(task) {\n storeTaskLocalStorage(task);\n appendToList(task);\n}", "function impact(task){\r\n\r\n }", "generate() {\n document.querySelector(\".modal-window__task_media\").innerHTML = \"\";\n document.getElementById(\"answer\").value = \"\";\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if an object is a Cheerio instance.
function isCheerio(maybeCheerio) { return maybeCheerio.cheerio != null; }
[ "function isMochaObject(obj)\n{\n return (obj instanceof mocha.Test || obj instanceof mocha.Suite || obj instanceof mocha.Hook);\n}", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === Bot.__pulumiType;\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the scrollbar offset distance. TODO: Remove in 1.0 (we used this in public examples)
function getScrollbarOffset() { try { if (window.innerWidth > document.documentElement.clientWidth) { return window.innerWidth - document.documentElement.clientWidth; } } catch (err) {} return 0; }
[ "function get_actual_scroll_distance() {\n return $document.innerHeight() - $window.height();\n }", "function getScrollOffset() {\n return {\n x: main.scrollLeft,\n y: main.scrollTop };\n\n}", "function verticalScrollbarPos() {\n\t\tvar top = offset.y + height * pixelSize;\n\t\tvar bottom = can...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A bounded interval that emits events when its range changes. / / If max or min is `null`, that dimension is unbounded. / / low Number / high Number / min Number or null, min <= low / max Number or null, high <= max / / Events: / zoom(low, high) / pan:move(low, high) / pan:done(low, high) / / Other classes use a shared ...
function Interval(low, high, min, max) { this.low = low; this.high = high this.min = min; this.max = max this.dirty = false // A dashboard's X interval can have quite a lot of listeners, since it is // shared between member charts. this.setMaxListeners(0) }
[ "function geneBaseBounds(gn, min, max) {\n var gd = genedefs[gn];\n var gg = guigenes[gn];\n if (gd === undefined) return;\n if (gd.basemin === gd.min) {\n gd.min = min;\n gg.minEle.value = min;\n gg.sliderEle.min = min;\n }\n gd.basemin = min;\n if (gd.basemax === gd.max) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes the leaderboard. Uses helper function to get the top scores and the current users rank.
function init() { currUser = sessionStorage.getItem(cUserId); getTopScores(); getCurrentUserRank(); }
[ "function init() {\n scores = {\n p: 0,\n t: 0,\n c: 0\n };\n results = {\n p: '',\n c: ''\n };\n winner = null;\n}", "function Leaderboard() {}", "function prepareLeaderboard() {\r\n\t\t var fsq = require('node-foursquare')(context.foursquare.config);\r\n\t\t fsq.Users.getLeaderboard(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
util method. a: option groups, b: field name to access product components, c: field name to access product Id within product component.
function getAllProductsinCurrentOptiongroups(a, b, c){ // return a list of bundle product Id's. based on flag provided. var res = []; _.each(a, function (group) { res.push(_.pluck(group[b], c)); }); res = _.flatten(res);// Flattens a nested array. ...
[ "function verifyExtraFieldsFromProduct() {\n if ($scope.device.product.extraFields) {\n\n }\n }", "function setOptionLabels(mthis) {\n var products = [];\n var optVal = mthis.val();\n var attrId = parseInt(mthis.prop(\"id\").replace(/[^\\d.]/g, \"\"));\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The `const` funs returns its first argument and ignores the second.
function $const(x, y) /* forall<a,b> (x : a, y : b) -> a */ { return x; }
[ "function ConstantFunction()\r\n{\r\n const Pi=3.142;\r\n //Pi=5; // we cannot update the values in const variables\r\n console.log(Pi);\r\n}", "function protoIsConst2() {\n return {b: 3, __proto__: 10};\n}", "function getConstOrRandomColor(constValOrRandomizer, returnNullIfUndefined)\n{\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function kills the fullScreen instance.
function killFullScreen() { toggleFullScreen(); _self = null; if (_eventListenerElement) _eventListenerElement.removeEventListener("click", toggleFullScreen); }
[ "exitFullscreen() {\n if (this.isFullscreenEnabled()) {\n exitFullscreen();\n }\n }", "function _hideEndScreen() {\r\n hideEndScreen();\r\n }", "async hideSplashScreen() {\n\t\ttry {\n\t\t\tif (!this.splashScreenWindow) return;\n\t\t\tthis.splashScreenWindow.close();\n\t\t\tthis.splashSc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the object representing yourself (person) to this array of people (if your name key does not have the same 'shape' as the ones above, change it to look like these). Write a function that, when passed people as an argument, returns an array of their full names. Can you use your formatName function here?
function returnName(people){ var arrayOfNames = []; for (var i = 0; i < people.length; i++){ arrayOfNames.push(people[i].name.first + ' ' + people[i].name.last); } return arrayOfNames; }
[ "function formatName(person){\n\treturn person.fullName;\n}", "function appendListOfMaleEmployees(name) {\n listOfMaleEmployees.push(name);\n}", "function fullName(array, index) {\n if (array[index].name.middle === undefined) {\n return array[index].name.first + \" \" + array[index].name.last;\n } else ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions For generating random color from Chroma
function generateHex() { return chroma.random(); }
[ "function generateRGB() {\n\tvar r = Math.floor(Math.random() * 256);\n\tvar g = Math.floor(Math.random() * 256);\n\tvar b = Math.floor(Math.random() * 256);\n\treturn \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomColourGen()\r\n{\r\n var colour = 'rgb(' + (Math.floor(Math.random() * 25...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END Google Books Dynamic Display Display the returned data to dynamically change page based on the Marvel function returns.
function marvelDisplay(data) { pageData = data.data.results; //data row from HTML, tagged data-row-show in html var dataRow = document.getElementById('data-row-show'); var rowDataShow = ``; //this is the data to get from API call to display for character search for (var i = 0; i < pageData.length; i++) {...
[ "function renderGoogleBookData(results){\n $(\".bookcls\").html(\"\");\n $(\".bookcls\").html(`<h2 class=\"conHead\">Books</h2>`);\n\n let html = '<ul class=\"content-list\">';\n results.forEach(function(value){\n \n html += `\n <li class=\"book-cls content-list-item\">\n <h1 class=\"booktitl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save all coins in cache
function saveCoinsInCache(coins) { state.cacheAllCoins = coins; }
[ "function saveSpecifCoinInCache(coinInfo) {\n let coinFullInfo = {\n coinInfo: coinInfo,\n //add cache time\n cacheTime: +new Date(Date.now()),\n };\n state.cachesSpecificCoin.set(coinInfo.id, coinFullInfo);\n //return id to show more info in UI\n return coinInfo.id;\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The use an observable for a disposable object, use it a DisposableOwner: D.create(obs, ...args) // Preferred obs.autoDispose(D.create(null, ...args)) // Equivalent Either of these usages will set the observable to the newly created value. The observable will dispose the owned value when it's set to another value, or wh...
autoDispose(value) { this.setAndTrigger(value); this._owned = value; return value; }
[ "function throttled(delay, initialValue) {\n var timeout = void 0;\n var data = initialValue;\n var subscriptions = new Set();\n var updateValue = function updateValue(value) {\n data = value;\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n subscriptions.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public function `nonEmptyArray`. Returns true if `data` is a nonempty array, false otherwise.
function nonEmptyArray (data) { return array(data) && greater(data.length, 0); }
[ "function isZeroArray(arr) {\r\n\t\tif (!arr[0] && !arr[1] && !arr[2] && !arr[3]) return true;\r\n\t}", "function nonEmpty(jqObject) {\n return jqObject && jqObject.length;\n}", "function IsArrayLike(x) {\r\n return x && typeof x.length == \"number\" && (!x.length || typeof x[0] != \"undefined\");...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Widgets: Combo Box The new BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it. The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. IMGUI_API bool BeginCombo(const char label, const char preview_value, ImGuiCom...
function BeginCombo(label, preview_value = null, flags = 0) { return bind.BeginCombo(label, preview_value, flags); }
[ "function combo(){\n for(k in combos){\n // debugger\n if(Object.keys(currentSelection).sort().join() === combos[k][\"keys\"].sort().join()){\n init()\n combos[k].change()\n // debugger\n }\n }\n\n}", "function _createCombo(data) {\n var retorno = {};\n retorno.comboIds = data;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disable type submit elements for current form
disableSubmitInputs() { this.jqueryForm.find('[type=submit]').each(function () { $(this).prop('disabled', true); }); }
[ "function disableAgencySubmit(disable) {\n $('#agencySubmit').attr('disabled', disable);\n}", "function enableFieldsForSubmit(theform) {\r\n var elems = theform.elements;\r\n\r\n for (var i = 0; i < elems.length; i++) {\r\n if (elems[i].disabled) {\r\n elems[i].style.visibility = \"hidd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Advance the L system any number of generations
advanceGenerations(numGenerations) { for(let i = 0; i < numGenerations; i++) { this.nextGeneration(); } }
[ "learn(steps){\n steps = Math.max(1, steps || 0)\n while (steps--){\n this.currentState = this.randomState()\n this.step()\n }\n }", "function runBatch() {\n if (visitationFn === \"deterministic\") {\n for (let y = 0; y < gridSize; y++) {\n for (let x = 0; x ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves a permission item object using its ID.
static get(permissionItemId){ let kparams = {}; kparams.permissionItemId = permissionItemId; return new kaltura.RequestBuilder('permissionitem', 'get', kparams); }
[ "getPermission(permissionId, region) {\n if (typeof permissionId !== 'string') {\n return this.promise.reject('permissionId must be a string');\n }\n return this.getPermissions([permissionId], region).then((permissions) =>\n permissions.find((permission) => permission.id === permissionId)\n );...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
populates the form with a list of supported clients and when selected with appointments. parameters from the form are used to create a appointment meeting.
function openClientMeetingForm() { document.getElementById("ClientMeetingForm").style.display = "block"; //populate list of clients. populateClientList("clientAtMeeting"); }
[ "function addClient() {\n s = \"<form name='addClient'>\";\n s += \"<div class='cell'>*Codice Fiscale</div><div class='cell' text-align=left><input type=text name=cf size=30></div>\";\n s += \"<div class='row'></div>\";\n s += \"<div class='cell'>*Nome </div><div class='cell' text-align=left><input type...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turn wheel function that starts the wheel turn by comparing the currentAngle stored in the global variable and compares it to the target angle in order initiate turning if the current Angle is not within tolorance.
function turnWheelTo(angle) { global.target = angle; var difference = (global.currentAngle - global.target); // NOTE, js treats '+' as string concatination by default, + in front of globa.target forces int typing if (Math.abs(difference) < global.SLOW_TOLORANCE) { var forceCoefficient = global.PROPORTIONAL_CONS...
[ "function angleReset() {\n\tturnWheelTo(50); // 50 is the middle angle of the G27 wheel. \n\tglobal.turnCounter = 0;\n}", "function toggleSpinning() {\n\t// Toggle the spinning animation\n\tif (isSpinning) {\n\t\t// Stop the arrow\n\t\tisSpinning = false;\n\t\tclearInterval(toggleSpinning.spinInt);\n\t\tspinButto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
detect if str is register
isRegisterName(str) { return this.architecture.hasRegisterName(str); }
[ "function validateType(tstr){\n let retVal = Type.NOT_A_TYPE;\n if(tstr != Type.NOT_A_TYPE){\n for(const t in Type){\n // If a valid type (not NOT_A_TYPE) and symbol string matches given string:\n if(Type[t] && String(Type[t]).slice(7, -1) == tstr){\n retVal = Type[t];\n break;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get data related to this chart_id only
function filter_by_chart_id(value) { return value.chart_id == chart_id; }
[ "function getDatasetInfoById(ds_id) {\n var ds_info, i;\n for (i = 0; i < entry.datasets.length; i++) {\n ds_info = entry.datasets[i];\n if (ds_info[\"id\"] == ds_id) {\n ds_info[\"ref\"] = i; //reference for pulling out datasetinfo from coresponding lists like colorbars\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function calls the showMenuItem function to determine if the Book Transfer request should be displayed on the Scheduled Requests pages
function checkBookReq(id) { var rc; var temp; rc = showMenuItem('book'); if (rc == '0'){ temp = document.getElementById(id); temp.style.display = 'none'; } }//end checkBookReq
[ "function checkFundsReq(id)\r\n{\r\n\tvar rc;\r\n\tvar temp;\r\n\r\n\trc = showMenuItem('funds');\r\n\tif (rc == '0'){\r\n\t\ttemp = document.getElementById(id);\r\n\t\ttemp.style.display = 'none';\r\n\t}\r\n}//end checkFundsReq", "function _showModifyTileMenu() {\n //topAppBar.winControl.hide();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The label for the previous button.
get prevButtonLabel() { return { 'month': this._intl.prevMonthLabel, 'year': this._intl.prevYearLabel, 'multi-year': this._intl.prevMultiYearLabel }[this.calendar.currentView]; }
[ "function showPreviousPreview()\r\n {\r\n if ($label == null)\r\n return;\r\n\r\n log(\"Preview.showPreviousPreview()\");\r\n\r\n // get current label\r\n var prevIndex = $previews.index($label) - 1;\r\n if (prevIndex >= 0)\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Master Server Module Sends the lists of known game servers to game clients, using TCP. Behaviour :: TCP PASSIVE Generates the string to be sent to a game client querying us for game servers list
function generateClientServerList(game){ var response = "\\basic\\\\"; // Servers which reported to us for(var svr in knownGameServers){ // svr is the key in which the server info is stored into the HashMap // but the key was stored in the format address:port, there...
[ "function syncWithKnownMasterServer(server){\r\n var VALIDATION = '\\\\gamename\\\\' + server.game +'\\\\location\\\\0\\\\validate\\\\OPNSRCUP\\\\final\\\\'; // Validation answer\r\n var QUERYREQST = '\\\\list\\\\gamename\\\\' + server.game + '\\\\final\\\\' // Query for games list\r\n\r\n var conn = new t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if a and b are of equal nonzero length, and their contents are equal, or false otherwise. Note that unlike in compare() zerolength inputs are considered _not_ equal, so this function will return false.
function equal(a, b) { if (a.length === 0 || b.length === 0) { return false; } return compare(a, b) !== 0; }
[ "static equal(b1, b2) {\n\n var i,j;\n\n if (b1.size != b2.size) {\n console.log('b1 and b2 are of different sizes');\n return false;\n }\n\n for (i=0; i<b1.size; i++) {\n\n for (j=0; j<b1.size; j++) {\n\n if (b1.board[i][j] !== b2.board[i]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes the yellow cross given a "line" yellow setup
function solveYellowLine(cube) { F(cube); R(cube); U(cube); Ri(cube); Ui(cube); Fi(cube); //console.log("front, right, up, right inverse, up inverse, front inverse (yellow cross created)"); commandSolveYellowCross += "<br>Solves yellow 'line': front, right, up, right inverse, up inverse, front i...
[ "function dibujarLinea(color, x_inicial, y_inicial, x_final, y_final)\n{\n lienzo.beginPath();\n lienzo.strokeStyle = color;\n lienzo.moveTo(x_inicial, y_inicial);\n lienzo.lineTo(x_final, y_final);\n lienzo.stroke();\n lienzo.closePath();\n}", "function drawCross(x, y, color){\n\tctx.strokeStyle = color;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function performs the fake local storage update, so the IE gets the latest token instead of returning the cached localStorageValue
function performFakeLocalStorageUpdate() { var dummy_key = 'dummy_key'; localStorage.setItem(dummy_key, dummy_key); localStorage.removeItem(dummy_key); }
[ "function getLocalStorage() {\n return localStorage;\n}", "function getToken() {\n return localStorage.getItem('token');\n}", "function getToken() {\n\treturn localStorage.getItem('token')\n}", "function updateLocalStorage(){\r\n localStorage.setItem(\"savedTask\",JSON.stringify(currentTasks));\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans the FM band upwards. Called when the 'Scan >>' button is pressed.
function scanUp() { fmRadio.scan( upconvert(band.getMin()), upconvert(band.getMax()), band.getStep()); }
[ "function scanDown() {\n fmRadio.scan(\n upconvert(band.getMin()),\n upconvert(band.getMax()),\n -band.getStep());\n }", "onScanFinished_() {\n this.scanner_ = null;\n }", "onScanCompleted_() {\n if (this.scanCancelled_) {\n return;\n }\n\n this.processNewEntriesQueue_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Language: Q Description: Q is a vectorbased functional paradigm programming language built into the kdb+ database. (K/Q/Kdb+ from Kx Systems)
function q(hljs) { const KEYWORDS = { $pattern: /(`?)[A-Za-z0-9_]+\b/, keyword: 'do while select delete by update from', literal: '0b 1b', built_in: 'neg not null string reciprocal floor ceiling signum mod xbar xlog and or each scan over prior mmu lsq inv md5 ltime gtime count first ...
[ "function getIndexQ() {\n for (let i = d.length - 1; i >= 0; i--) {\n if (d.substring(i, i + 1) === 'Q') {\n return i\n }\n }\n return 0\n }", "function QingVisitor() {\n\tantlr4.tree.ParseTreeVisitor.call(this);\n\treturn this;\n}", "async query(cont...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Submit, format and append winner input data
function submitWinners () { // Reset winners beyond the initial call, and set the new contestants for the new bracket if (winners[0] != null) { contestants = winners.slice(0); winners = []; } // Gather up checkbox data var tempWinners = $("input[type|='radio']"); // Build up the winners array with those...
[ "function processOpnFrmData(event) {\r\n\r\n\r\n event.preventDefault();\r\n\r\n let nopBoughgame = \"Never Bought Game\"\r\n // Read and adjust data from the form\r\n const nopOpn = document.getElementById(\"story\").value.trim();\r\n const nopName = document.getElementById(\"name\").value.trim();\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Broadcasts a session update message by updating local storage
function broadcastSessionUpdate() { if (localStorage) { localStorage.setItem('sessionUpdate', true); localStorage.removeItem('sessionUpdate'); } }
[ "function broadcastSessionDialogResponse(response) {\n if (localStorage) {\n localStorage.setItem('sessionDialogResponse', response);\n localStorage.removeItem('sessionDialogResponse');\n }\n}", "function sendWebsocketUpdate() {\n io.emit('updateMessages', messageContainer);\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function shows the specific picture from the main page that the user wants to delete in a div element, or hides the div element if needed
function showPictureToDelete() { if (document.forms[1].deletePics.value == "") { $('#showPicture').empty(); } else { $('#showPicture').empty(); var picture = document.forms[1].deletePics.value; var pictureScript = '<p><img src="../mainPictures/' + picture + '"width="50" height="76" />'; $('#showPicture')...
[ "function hideSmIm(){\r\ndocument.getElementById('smallImage').style.display = 'none';\r\n$(\"#savPicBlk\").hide();\r\n}", "function del_entrypic( entry_id, pic_id ) {\r\n\t\t\r\n\t\tforward_func = del_entrypic_confirmed.bind( null, entry_id, pic_id );\r\n\t\t$( '#hv_alert_wrapper' ).hv_alert( 'show_alert', {\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates an 'usuario' on the database
function updateUsuario(req, res, next) { /* Finding the user document based on query */ Usuario.findOne({ 'nome': req.body.old.nome }, function(err, userDoc) { /* Checking for errors */ if (err) { return next(err); } /* Checking if the user was found */ if (!userDoc) { return res.status(404)....
[ "function saveUser() {\n UserService.Update(vm.user)\n .then(function () {\n FlashService.Success('Usuario modificado correctamente');\n })\n .catch(function (error) {\n FlashService.Error(error);\n });\n }", "function updateUser(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse nonfn call: literal array or literal value
function parseGenVal(expr) { return _.chain(expr) .map(function(e){ if (_.isString(e)) return e; if (_.isArray(e)) return parseGenExpr(e); // array but not fn call throw {expr: expr, e: e, msg: "Cannot parse, only supports string/array here, got " + (typeof e)}; }) .value(); }
[ "function parseFuncInstrArguments(signature) {\n var args = [];\n var namedArgs = {};\n var signaturePtr = 0;\n\n while (token.type === _tokenizer.tokens.name || isKeyword(token, _tokenizer.keywords.offset)) {\n var key = token.value;\n eatToken();\n eatTokenOfType(_tokenize...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a base64encoded string of "numberBytes" random bytes
function randomBytes(numberBytes) { return crypto.randomBytes(numberBytes).toString('base64'); }
[ "function randomInt64() {\n var halfOne = crypto_1.randomBytes(4).readUInt32LE(0, true);\n var halfTwo = crypto_1.randomBytes(4).readUInt32LE(0, true);\n var str = \"\" + halfOne + halfTwo;\n var len = str[0] === \"9\" ? 18 : 19;\n return str.slice(0, len); // postgres max int64 == 922337203685477580...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Samples the unit space based on p Breaks into fs.length equally spaces units centers a Stepf on each unit hfLut[i] represents the height fraction for sample i
function createHfLut(fs, hfLut, n) { //var n = 1 + Math.ceil(1.0 / p); var b = 0.65; var u0 = 0.0; var u1 = 1.0; var nn = 1; // var fsn = fs.length; var fis = (u1 - u0) / functionSummaries.length; for (var i = 0; i < n; ++i) { var u = (1.0 * i) / n; var fic = Math.floor(functionSummaries.length * u); var v...
[ "function determineFrequency(f) {\n var qstate = new jsqubits.QState(numInBits + numOutBits).hadamard(inputBits);\n qstate = qstate.applyFunction(inputBits, outBits, f);\n // We do not need to measure the outBits, but it does speed up the simulation.\n qstate = qstate.measure(outBits).newState;\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter of the link attribute.
set link(aValue) { this._logger.debug("link[set]"); this._link = aValue; let uri; try { uri = this._ioService.newURI(this._link, null, null); } catch (e) { uri = this._ioService.newURI("http://" + this._link, null, null); } this._domain = uri.host; }
[ "set link(aValue) {\n this._logService.debug(\"gsDiggEvent.link[set]\");\n this._link = aValue;\n\n var uri;\n try {\n uri = this._ioService.newURI(this._link, null, null);\n } catch (e) {\n uri = this._ioService.newURI(\"http://\" + this._link, null, null);\n }\n this._domain = uri.h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the sites dropdown box with the specified values
function loadSites(values, selectAll) { require(["dojo/ready", "dijit/form/MultiSelect", "dijit/form/Button", "dojo/dom", "dojo/_base/window"], function(ready, MultiSelect, Button, dom, win){ ready(function(){ if (sitesMultiSelect != null) sitesMultiSelect.destroyRecursive(true); selSites = dom.byId('selectSit...
[ "function setOptions(domains) {\n $(\"#edit-field-domain-source option\").each(function(index, obj) {\n if (jQuery.inArray(obj.value, domains) == -1 && obj.value != '_none') {\n // If the current selection is removed, reset the selection to _none.\n if ($(\"#edit-field-domain-s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a configuration for the given `version` of a package at `packagePath`.
getPackageConfig(packageName, packagePath, version) { const rawPackageConfig = this.getRawPackageConfig(packageName, packagePath, version); return new ProcessedNgccPackageConfig(this.fs, packagePath, rawPackageConfig); }
[ "get configVersion() {\n return '0.0.0'\n }", "async function getConfigFromPackageJson() {\n const { repository } = await utils_1.loadPackageJson();\n if (!repository) {\n return;\n }\n const { owner, name } = parse_github_url_1.default(typeof repository === \"string\" ? repository : reposi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds a new waypoint element after given waypoint index
function addWaypointAfter(idx, numWaypoints) { //for the current element, show the move down button (will later be at least the next to last one) var previous = $('#' + idx); previous.children()[3].show(); //'move' all successor waypoints down from idx+1 to numWaypoints for (var ...
[ "function handleAddWaypointClick(e) {\n //id of prior to last waypoint:\n var waypointId = $(e.currentTarget).prev().attr('id');\n var oldIndex = parseInt(waypointId);\n addWaypointAfter(oldIndex, oldIndex + 1);\n theInterface.emit('ui:selectWaypointType', oldIndex);\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Opens the dialog to create a new virtual folder
newVirtualFolder(aName, aSearchTerms, aParent) { let folder = aParent || GetSelectedMsgFolders()[0]; if (!folder) folder = GetDefaultAccountRootFolder(); let name = folder.prettyName; if (aName) name += "-" + aName; window.openDialog("chrome://messenger/content/virtualFolderProperties....
[ "function createNewFolder() {\n var id = $(this).parent().attr(\"data-id\");\n fileSystem.createFileOrFolder(id, \"folder\");\n updateUI();\n }", "editVirtualFolder(aFolder) {\n let folder = aFolder || GetSelectedMsgFolders()[0];\n\n function editVirtualCallback(aURI) {\n // we ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET Recupera todas las notas que sean favoritas
function getAllFavNotes(req, res) { //Query a mongoDB Note.find({favorite:1}, (err, notes) => { //Compruebo si hay algun error en el callback if (err) return res.status(500) .send({ message: `Se ha producido un error: ${err}` }) //Comprueba si tra...
[ "getFavorites() {\n\t\treturn apiFetch(\n\t\t\t{\n\t\t\t\tpath: '/vtblocks/v1/layouts/favorites',\n\t\t\t\tmethod: 'GET',\n\t\t\t}\n\t\t).then(\n\t\t\tfavorite_keys => {\n\t\t\t\tlet favorites = [];\n\n\t\t\t\tObject.values( this.state.all ).forEach( function( item ) {\n\t\t\t\t\tif ( favorite_keys.includes( item.k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manage billing groups [BETA] [See on api.ovh.com](
CreateANewBillingGroup(payload) { let url = `/me/billing/group`; return this.client.request('POST', url, payload); }
[ "postV3GroupsIdAccessRequests(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\nprivate_token_header.apiKe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the function where all the data is accessed and put into arrays. Those arrays are also updated and removed as new data is received. New data is checked through the "listeningFirebaseRefs" array, as this is where database locations are stored and checked on regularly.
function databaseQuery() { userInitial = firebase.database().ref("users/"); userInvites = firebase.database().ref("users/" + user.uid + "/invites"); var fetchData = function (postRef) { postRef.on('child_added', function (data) { onlineInt = 1; var i = findUIDItemInArr(data.key, use...
[ "async function collectData(){\n let favs = [];\n\n await firebase.database().ref('recommenderData').child('favourite')\n .once('value', x => {\n x.forEach(data => {\n favs.push(data.val());\n checkSkill(data.val().preferenceType, data.val().favouritedAmount);\n })\n })\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called by IDE when a new behavior type is to be created
function CreateIDEBehaviorType() { return new IDEBehaviorType(); }
[ "addNewClassInModel() {\n let model = this.get('selectedValue');\n let modelHash = this.getModelArrayByStereotype(model.data);\n\n if (model.data.get('stereotype') === '«implementation»') {\n modelHash.pushObject({ settings: model, editForms: A(), listForms: A(), parents: A(), bs: null });\n } else...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method that checks wether the scroll button has to be displayed
checkScrollButton() { this.scrollTopButton.current.classList.toggle('hidden', window.scrollY < 300); }
[ "isVisible() {\n return this.toolbar.is(\":visible\");\n }", "function scrollCheck() {\n if ($(\"header\").is(\":visible\")) {\n closeMenu();\n }\n}", "isInViewport() {\n const vm = this;\n\n if(vm.firstTime) {\n // first time set postion of element ou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
issueMutation performs two important actions: it optimistically applies a Mutation to the current local state (if this option is not turned off), and issues the Mutation to the server. If the server request is successful, the changes are committed to the local state; if not, the optimistic changes are rolled back.
function issueMutation(mutation, options) { var executionId; var target = mutation.target instanceof Id ? mutation.target : new Id(mutation.target, 'local-' + localCount++); if (!options.waitForServer) { return performOptimisticMutation(target, mutation, options.batch); } return MutationExecutor.execute...
[ "async postIssue() {\n if (!this.API || !this.options || this.issue || this.issueId)\n return;\n // login to create issue\n if (!this.isLogined) {\n this.login();\n }\n // only owner/admins can create issue\n // if (!this.isAdmin) return\n try {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets all doctors for an admin profile
function getAllDoctors(req, res, next) { db.any('select acct_active, active, fname, lname, id, username from users') .then(function (data) { res.status(200) .json({ status: 'success', data: data, message: 'Retrieved ALL Doctors' }); }) .catch(f...
[ "getAllAdmins() {\n return this.getUserSets('ADMIN');\n }", "function getDoctors() {\n var doctors = document.querySelectorAll('div.detail-data');\n/* used source for help:\n https://stackoverflow.com/questions/41186171/casper-js-links-from-array\n*/\n return Array.prototype.map.call(doctors, function(e) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds zeros to the right of a byte
function addZerosRight(number) { return number.padEnd(8, "0"); }
[ "function bytePad(binarystr) {\n var padChar = \"0\";\n var pad = new Array(1 + 8).join(padChar);\n return (pad + binarystr).slice(-pad.length);\n}", "function rotateLeft8Bit(value, n) {\n return ((value << n) | (value >> (8 - n))) & 0xFF;\n}", "function leftCircularShift(num,bits){\nnum = num.toString(2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task Cards Render Task card
function renderTaskCards() { // Clear task cards before rendering toDoDiv.innerHTML = `<h2>To do</h2>`; inProgressDiv.innerHTML = `<h2>In Progress</h2>`; finishedDiv.innerHTML = `<h2>Finished</h2>`; // Get tasks const taskArray = getLocalStorage("task"); // Create task card /...
[ "function clickTaskCard(event) {\r\n // Display view task\r\n popUpView.style.display = \"block\";\r\n\r\n // get local storage\r\n let LocalStorageTaskArray = getLocalStorage(\"task\");\r\n // Get index of taskcard clicked\r\n let index = LocalStorageTaskArray.findIndex(obj => obj.name === event....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates state to animate Forward Low Kick
forwardLowKick() { this.updateState(KEN_SPRITE_POSITION.forwardLowKick, KEN_IDLE_ANIMATION_TIME, false); this.triggerAttack(DAMAGE, NORMAL_HIT); }
[ "haduken() {\n\t\tthis.updateState(KEN_SPRITE_POSITION.haduken, KEN_IDLE_ANIMATION_TIME, false);\n\t}", "animateBrickState() {\n for (let i = 0; i < this.gridState.length; i++) {\n this.gridState[i] = this.gridState[i] >> 1\n // * Mask off the numbers so they don't just continually grow once the bric...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a map of IDs to their respective balances, finds the reconciliation transactions so that the balances come down to zero.
function solveBalances(balances) { var remains = balances.entrySeq() .filter(v => v[1] > 0 || v[1] < 0) .groupBy(v => v[1] > 0) var positives = remains.get(true).sort((a, b) => a[1] - b[1]).toArray() var negatives = remains.get(false).sort((a, b) => b[1] - a[1]).toArray() var transactions = [] while (...
[ "function withdraw(clients, balances, client, amount) {\n let name = client;\n\n for (let i = 0; i < clients.length; i++) {\n if (clients[i] == name) {\n if (balances[i] > amount) {\n\n return balances[i] - amount , balances[i] -= amount;\n \n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update dog to server
function updateDogOnServer(dog) { fetch(`${dogsURL}/${dog.id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify(dog) }).then(() => getDogs()) }
[ "function apiUpdate(req, res) {\n // console.log('PUT /api/breed/:name');\n // console.log(req.params.name);\n // console.log(req.body);\n\n // update the specified breed\n db.Breed.find({'name': req.params.name}, function(err, sheep) {\n //console.log(sheep);\n if (err) {\n res.status(404).send('ER...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
moveAt(event.pageX, shiftX, setRangeLeft, rangeRef);
function onMouseMove(event) { moveAt(event.pageX, shiftX, setRangeLeft, rangeRef); }
[ "function getXmovement(fromIndex,toIndex){if(fromIndex==toIndex){return'none';}if(fromIndex>toIndex){return'left';}return'right';}", "moveAround() {\r\n\r\n\r\n }", "function movement() {\n trayX = constrain(trayX, 70, width - 70); \n if (keyIsDown(LEFT_ARROW)) {\n trayX -= 3;\n } else if (keyIsDown(RI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detect if the HTML or the BODY tags has a [mdthemesdisabled] attribute If yes, then immediately disable all theme stylesheet generation and DOM injection
function detectDisabledThemes($mdThemingProvider) { var isDisabled = !!document.querySelector('[md-themes-disabled]'); $mdThemingProvider.disableTheming(isDisabled); }
[ "async addTheme(){\n //If there is no page styling already\n if(!document.querySelector('.eggy-theme') && this.options.styles){\n //Create the style tag\n let styles = document.createElement('style');\n //Add a class\n styles.classList.add('eggy-theme');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Example: label(resource(r_1_XX_),satiation). >> r_1_xx has_label satiation or label(entity(e1),food).
function translateResourceLabel(terms){ var name = terms[0].terms[0].predicate; var label = terms[1].predicate; var readWriteValue = "private" if(terms[2] !== undefined){ //if it has a read write value readWriteValue = terms[2].predicate; } return ...
[ "_label(label) {\n return `${label}${label && this.required ? '*' : ''}`;\n }", "function isObligatoryLabel(label){\t\r\n\treturn obligatoryDataElementsLabel.includes(label);\r\n}", "label(attributeName) {\n const arg = this.args[attributeName];\n return arg ? arg.label : null;\n }", "function CLC_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Engine(canvas): Constructor. Args: canvas: the element used to draw.
function Engine(canvas) { var self = this; /* * PRIVATE MEMBER */ var ctx = null; // context of the canvas var sprites = null; // all sprites var clickables = null; // all clickable sprites var mouse_objs = null; /* * PUBLIC MEMBER ...
[ "bindElements(canvasEl) {\n this.canvas = new MainCanvas(canvasEl);\n }", "initCanvas() {\n // Create new canvas object.\n this._canvasContainer = document.getElementById(this._canvasId);\n if (!this._canvasContainer)\n throw new Error(`Canvas \"${this._canvasId}\" not found`);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an XML request to populateTypes.php Sends XML request, apply callback.
function getTypes(button, callback) { xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "populateTypes.php?q=", true); xmlhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { // defensive check if (typeof callback === "function") { ...
[ "function getAddressTypes(callback) {\n\n let addressTypeRequest = createRequest('GET', '/addresstypes', 'application/json');\n\n let req = http.get(addressTypeRequest, function (response) {\n let addressResult = '';\n response.on('data', (chunk) => {\n addressResult += chunk;\n });\n response.on...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check whether width is already present in array
function CheckArrayContainsW(w) { for (var i = 0; i < arrWidth.length; i++) { if (arrWidth[i] == w || arrWidth[i] + 2 == w || arrWidth[i] - 2 == w) return arrWidth[i]; } }
[ "function InsertIntoArray(w) {\r\n //insert first element\r\n if (arrWidth.length == 0) {\r\n arrWidth[0] = w; \r\n return;\r\n }\r\n var eleExist = false;\r\n for (var i = 0; i < arrWidth.length; i++) {\r\n if (arrWidth[i] == w || arrWidth[i] + 2 == w || arrWidth[i] - 2 == w)\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5. update the any one existing Mentors
editMentor() {}
[ "function addSkillToMentors(mentorsArr, newSkill) {\n mentorsArr.forEach((obj) => {\n obj.addSkill(newSkill);\n });\n}", "update(numTarjeta, modificaciones) {\n return this.findOneAndUpdate({ numTarjeta: numTarjeta }, modificaciones, { multi: true });\n }", "updateMonsterData(monsterData) {\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays a JSONformatted representation of domain list data
function gotTheDomainListData2(data) { var z = data; alert(JSON.stringify(data)); }
[ "function getDomainInfo(){\n\tvar url = getURL(\"ConfigEditor\",\"JSON\");\n\tif(globalDeviceType == \"Mobile\"){\n loading('show');\n }\n\tvar InfoType = \"JSON\";\n\tvar query = {\"QUERY\":[{\"user\":globalUserName}]};\n query = JSON.stringify(query);\n\tconsole\n\t$.ajax({\n\t\turl: url,\n\t\tdata :...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }