query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Sets up labels and controls of all options of the currently selected category.
function displayOptions() { // Hide all controls for (let body of Engine.GetGUIObjectByName("option_controls").children) { body.hidden = true; for (let control of body.children) control.hidden = true; } // Initialize label and control of each option for this category for (let i = 0; i < g_Options[g_TabCat...
[ "init() {\n const defaultCat = controller.getCat(0);\n controller.setCurrentCat(0);\n this.displayCat(defaultCat);\n }", "function writeCategories() {\n for (i = 0; i < 4; i++) {\n var ranNum = makeUniqueRandom(selectCategory.length, uniqueCategory);\n var isDi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate a named graph from a set of mappings
function generateNamedGraph(gconf) { var targetFileBaseName = targetDir + "/" + gconf.graph; var mdFilePath = targetFileBaseName + "-meta.json"; var lastDumpMetadata; if (fs.exists(mdFilePath)) { lastDumpMetadata = JSON.parse(fs.read(mdFilePath)); if (lastDumpMetadata.mapVersion != nu...
[ "function createGraph(edges) {\n \n let roots = new Map();\n \n for (let i = 0; i < edges.length; i++) {\n const first = edges[i][0];\n const second = edges[i][1];\n if (!roots.get(first)) {\n roots.set(first, new Set());\n }\n if (!roots.get(second)) {\n roots.set(sec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
true/false: if the text contents are too long to fit the shape, automatically shrink the text to fit note: autoFit and shrinkText are mutually exclusive doesn't make sense for both to be true (either one is true, or both are false)
shrinkText(value) { // FIXME: TODO: for some strange reason PowerPoint doens't auto-shrink/fit the text in a shape when you first open the pptx. You must click // on the properties of any shape, change any "fit" property (Format Shape->Text Box->Autofit), and then ALL shapes get their auto-fit /...
[ "function resizeText(pixels) {\r\n\r\n}", "static validateShortTextExceedsLength(pageClientAPI, dict) {\n\n //New short text length must be <= global maximum\n let max = libCom.getAppParam(pageClientAPI, 'MEASURINGPOINT', 'ShortTextLength');\n\n if (libThis.evalShortTextLengthWithinLimit(dict...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts ranking options from .env file (via process.env) and returns them in an object that can be spread into the ranking options.
static rankingOptionsFromEnv() { return process.env.RANKING_ENABLE_VIS_PANEL == null ? {} : { enableVisPanel: JSON.parse(process.env.RANKING_ENABLE_VIS_PANEL) }; }
[ "function parseENV() {\n var _a;\n logSettings_1.logger.info('\"parseENV\" got called');\n const options = {\n globalOptions: {},\n options: {\n allowMixed: process.env.TG_ALLOW_MIXED && process.env.TG_ALLOW_MIXED in constants_1.Severity\n ? mapValueToSeverity(proces...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserfetch_statement.
visitFetch_statement(ctx) { return this.visitChildren(ctx); }
[ "function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1]; //check type of token\n\n\tif (tempDesc == ' print' || tempType == 'identifier' || tempType == 'type' || tempDesc == ' while' || tempDesc == ' if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a function, doToArray that accepts an array and a callback. Call .forEach() on the array, passing the callback as the forEach callback.
function doToArray(array, callback){ array.forEach(callback) }
[ "function iterate(callback){\n let array = [\"dog\", \"cat\", \"squirrel\"]\n array.forEach(callback)\n return array\n}", "function procesar (unArray, callback) {\n return callback (unArray)\n}", "function myFilter(array, callback) {\n return callback(array);\n}", "function tap(arr, callback){\n cal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pagination and Home Content
function homeContent() { $('#main-nav li').removeClass('current'); $('#home-btn').parent().addClass('current'); performGetRequest(serviceRootUrl + 'page' + pageNO() + videoLibraryCount(), onVideoLibrariesPerPageLoadSuccess, videoLibrariesErrorMessage); }
[ "function page(){\n ///djahgjkhg \n\n $(\"#page\").pagination({\n pageIndex: 0,\n pageSize: 10,\n total: 100,\n debug: true,\n showInfo: true,\n showJump: true,\n showPageSizes: true,\n loadFirstPage: true,\n firstBtnText: '首页',\n lastBtnText: '尾页',\n prevBtnText: '上一页',\n next...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END UPDATE MINCUT ADD EXCLUDE FROM MINCUT / excludeFromMincut excludes a valve from mincut
function excludeFromMincut(valve_id, mincut_id, device, cb) { try { _self.emit("log", "mincut.js", "excludeFromMincut(" + valve_id + "," + mincut_id + "," + device + ")", "info"); var dataToSend = {}; dataToSend.valve_id = valve_id; dataToSend.mincut_id = mincut_id; dataToSend.device ...
[ "function setExcludingMincut(bool) {\n _excludingMincut = bool;\n }", "function getMincut(x, y, epsg, mincut_id_arg, id_name, cb) {\n try {\n _self.emit(\"log\", \"mincut.js\", \"getMincut(\" + x + \",\" + y + \",\" + epsg + \",\" + mincut_id_arg + \",\" + id_name + \")\", \"info\");\n\n var data...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the APPEND_POSTFIX already exists, if it does the user is promted with the option to overwrite. If not, the function will create a new document with the APPEND_POSTFIX postfix.
function saveNewPostFix(doc, docPath){ //postfix file exists //if the user has already chosen to overwrite all //only display once if this is the case! if (OVERWRITE_ALL == true){ //just overwrite the file overwrite(doc,docPath); } // this is the first case else { if (fl.fileExists(docPath) == true){ v...
[ "function overwrite(doc,docPath){\n\t\n\t//keep the location of the old FLA\n\toldPath = String(doc.pathURI);\n\t\n\t//save the new postfix FLA\n\tfl.saveDocument(doc, docPath);\n\tfl.trace(\"Saved...\" + doc.name);\n}", "function containsPostExt(path, ext){\n\treturn (path.indexOf(String(APPEND_POSTFIX + ext)) !...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function changeEmployee function changeEmployer Take action when the user changes the value of the OwnAcct field. Input: this element containing a flag
function changeEmployer() { let form = this.form; let row = this.name.substring(this.name.length - 2); if (this.value == '1') this.value = 'Y'; if (this.value.toUpperCase() == 'Y') { if (form.elements["Employee" + row]) form.elements["Employee" + row].value = "N"...
[ "function changeEmployee()\n{\n let form = this.form;\n let row = this.name.substring(this.name.length - 2);\n if (this.value == '1')\n this.value = 'Y';\n if (this.value.toUpperCase() == 'Y')\n {\n if (form.elements[\"Employer\" + row])\n form.elements[\"Employer\" +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Date stuff that doesn't belong in datelib core given a timed range, computes an allday range that has the same exact duration, but whose start time is aligned with the start of the day.
function computeAlignedDayRange(timedRange) { var dayCnt = Math.floor(diffDays(timedRange.start, timedRange.end)) || 1; var start = startOfDay(timedRange.start); var end = addDays(start, dayCnt); return { start: start, end: end }; }
[ "getTimesBetween(start, end, day) {\n var times = [];\n // First check if the time is a period\n if (this.data.periods[day].indexOf(start) >= 0) {\n // Check the day given and return the times between those two\n // periods on that given day.\n var periods = Dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parseString takes in a specialString and returns the right / wrong version of the string as well as the concept code
function parseString(str, isCorrect) { if ((str.indexOf("+") || str.indexOf("-") || str.indexOf("{") || str.indexOf("}") || str.indexOf("|")) < 0) { return {"value": str, "code": null}; } //weird cases: {+Plantations.-plantations. / Plantations.|508} //have to remove /Plantations. if (str.indexOf('/') > ...
[ "parse(string) {\n this._string = string;\n this._tokenizer.init(string);\n\n // Prime the tokenizer to obtain the first\n // token which is our lookahead. The lookahead is\n // used for predictive parsing.\n this._lookahead = this._tokenizer.getNextToken();\n\n return this.Program();\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`applyProjectionRecursive` performs operation on the projection specified by `action` (insert, detach, destroy) Inserting a projection requires us to locate the projected nodes from the parent component. The complication is that those nodes themselves could be reprojected from their parent component.
function applyProjectionRecursive(renderer, action, lView, tProjectionNode, renderParent, beforeNode) { var componentLView = lView[DECLARATION_COMPONENT_VIEW]; var componentNode = componentLView[T_HOST]; ngDevMode && assertEqual(typeof tProjectionNode.projection, 'number', 'expecting projection inde...
[ "function zoom(root, p) {\r\n if (document.documentElement.__transition__) return;\r\n\r\n // Rescale outside angles to match the new layout.\r\n var enterArc,\r\n exitArc,\r\n outsideAngle = d3.scale.linear().domain([0, 2 * Math.PI]);\r\n\r\n function insideArc(d) {\r\n return p.key ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes shipping selection from radio buttons
function getRadioSelection() { var selection = document.getElementsByTagName('input'); for (i = 0; i < selection.length; i++) { if (selection[i].checked) { shippingValue = selection[i].value; } } }
[ "function checkShippingMethod() {\n return $('#shipping-options option:selected').val();\n\n}", "static set radioButton(value) {}", "function setDefaultShippingMethod(){\n nlapiSetFieldValue(\"shipmethod\", \"4774\") // set default shipping method to Freight Other\n}", "function checkShipToAddress() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fonction viderTable() vide les valeurs des cellules du tableau et appelle la fonction changerCouleur()
function viderTable() { var numRows = document.getElementById("table").rows.length; var numColumns = document.getElementById("table").rows[0].cells.length; for (var i = 0; i < numRows; i++) { for (var j = 0; j < numColumns; j++) { if (document.getElementById("table").rows[i].cells[j].inn...
[ "function llenar_tabla_vistas_observaciones() {\n $(\"#modal_vista_observaciones\").show()\n $(\"#tabla_vistas_observaciones tr\").remove()\n\n var cuestionario, pregunta, indice_cues, indice_preg = 1;\n $.each(datos_mostrar, function (index, item) {\n //*********aqui se va a ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isDirty returns a boolean value depending on whether the model instance attributes have been changed or not. Dirty model instances can be used to determine if such an instance should be saved.
function isDirty(){ return this.__isDirty__; }
[ "_checkEmberModelsOnDirty() {\n let checkresult = false;\n\n let editformIsDirty = this.get('model.editform.hasDirtyAttributes');\n\n let dataobject = this.get('model.dataobject');\n\n let attributes = dataobject.get('attributes');\n let changedAttributes = attributes.filterBy('hasDirtyAttributes');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ensure all props option syntax are normalized into the Objectbased format.
function normalizeProps (options, vm) { var props = options.props; if (!props) { return } var res = {}; var i, val, name; if (Array.isArray(props)) { i = props.length; while (i--) { val = props[i]; if (typeof val === 'string') { name = camelize(val); r...
[ "function normalizeOptions(options) {\n options = options || {};\n return {\n concatMessages: options.concatMessages === undefined ? true : Boolean(options.concatMessages),\n format: options.format === undefined ? isomorphic_node_1.format\n : (typeof options.format === \"function\" ? ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Separates an array of objects into three subgroups of inputtype objects (switch and buttons), outputtype objects (LEDs), and other components.
function separateGroup(group) { var inputs = []; var components = []; var outputs = []; for (var i = 0; i < group.length; i++) { var object = group[i]; if (object instanceof Switch || object instanceof Button || object instanceof Clock) inputs.push(object); else if (o...
[ "function command_array_creator(arr){\n let new_arr = [];\n arr.forEach(str => {\n new_arr.push(command_extractor(str));\n })\n return new_arr;\n //if ['turn off 812,389 through 865,874', 'toggle 205,417 through 703,826'] was given as input\n //the function would return [ [ 'turnoff', [ 812, 389 ], [ 865, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build Top down hierarchy from root category to category of member to be created
function buildCategoryParentList (category) { var parentCategory = categoryToParentMap[category]; /* * Push hierarchical parents of selected category, including itself on stack * (bottom up from category of member to be created) */ parentList.push(category); while(!jQuery.isEmptyObject(parentCategory)) { ...
[ "function buildHierarchy(data){\n var len=data.length+1; // length of items is length of merging+1\n var list=[];\n // push items\n for (var i=0;i<len;i++){\n list.push({name:i,size:1})\n }\n // push merges\n for (var i=len;i<len*2-1;i++){\n li...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replays a fight result. Accepts the result and opens a Combat screen.
async replayFightResult(metaResult) { this.setState({ loading: true, }); let result; try { result = await this.state.contractFacade.replay( metaResult.seed, metaResult.selection_lhs, metaResult.selection_rhs, ...
[ "function replayGame() {\n resetGame();\n togglePopup();\n }", "function showReplay() {\n document.getElementById('guessing-div').style.display = 'none';\n document.getElementById('replay-div').style.display = 'block';\n}", "function DisplayFight() {\r\n var DivDisplay = document.getElementById(\"DivDis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The ith student started doing their homework at the time startTime[i] and finished it at time endTime[i]. Return the number of students doing their homework at time queryTime.More formally, return the number of students where queryTime lays in the interval[startTime[i], endTime[i]] inclusive
function busyStudent(startTime, endTime, queryTime) { let counter = 0; for (let i = 0; i < startTime.length; i++) { if (startTime[i] <= queryTime && endTime[i] >= queryTime) { counter++; } } return counter; }
[ "function timePlanner(a, b, duration) {\n let aCount = 0;\n let bCount = 0;\n \n while (aCount < a.length && bCount < b.length) {\n const start = Math.max(a[aCount][0], b[bCount][0]);\n const end = Math.min(a[aCount][1], b[bCount][1]);\n\n if (start + duration <= end) {\n return [sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function begins the intro. Input: runIntro requires frame input from within the Leapmotion controller loop Output: runIntro returns true until it has completed cycling through each introText. It then returns false
function runIntro(frame){ if (paused) {return;} console.log(introCount); //Display the cards document.getElementById('expression').innerHTML = '<span class="intro">' + introTexts[introCount] + '</span>'; stop = Date.now(); checkHands(frame); // If we are on the l...
[ "function startIntro(){\n var intro = introJs();\n intro.setOptions({\n steps: [\n { \n intro: \"Hello world!\"\n },\n {\n element: document.querySelector('.cont'),\n intro: \"This is a tooltip.\"\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Injects all the dependencies in the base classes's constructor. The character's HTML Template, its CSS Template and Font Awesome will be added to the DOM. Every version of the character needs these dependencies to operate properly.
injectDependencies() { this.injectHtmlTemplate(); this.injectCssTemplate(this.widgetType); this.injectFontAwesome(); }
[ "init() {\n this._createShadowRoot()\n this._attachStyles()\n this._createElements()\n }", "init () {\n this._initSelectors()\n this._initElements()\n this._initProperties()\n this._initAttributes()\n\n Component.bindMethodToDOMElement(this, 'activateTab', this.activat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the playground. Loop through all the added components
draw() { this.components.forEach( component => component.draw() ); }
[ "function renderPallet(){\n\tfor(let i = 0; i < numColor; i++){\n\t\tswatches[i].display();\n\t}\n\tfillIcon.display();\n}", "display() {\n this.draw(this.points.length);\n }", "draw(){\n\n for(let i=0; i<this.belt.length;i++){\n this.belt[i].draw();\n }\n }", "display() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
then this function is used to display the appropriate category. if the "all" radio button is checked that means user wants to see all events and so all events are shown. if the "work" radio button is checked that means the user wants to see events related to work and so only work events are shown and so on.
function ischecked(){ if(all.checked){ displayEvent(); displayEvent(); }else if(work.checked){ displayCategory(work.value); displayCategory(work.value); }else if(school.checked){ displayCategory(school.value); displayCategory(school.value); }else if(social...
[ "function allDayState(all_day_box) {\n\tif($(all_day_box).is(':checked')) {\n\t\t$('#id_start_time_1').hide();\n\t\t$('#id_end_time_1').hide();\n\t\t$(\"label[for='id_start_time_0']\").text('Day'); \n\t\tif($(\"#id_repeats\").is(':checked')) {\n\t\t\t$('#start-row').hide();\n\t\t\t$('#end-row').hide();\n\t\t} else ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Variables: share_display, share_usergen_default, action_share_description, action_page_title, action_page_description, action_links, properties, images, audio, video
function janrain_popup_share(url, options, variables) { // RPXNOW is not loaded in offline (demo) mode if (typeof RPXNOW === 'undefined') return; RPXNOW.loadAndRun(['Social'], function () { if (typeof options != 'object') options = {}; var activity = new RPXNOW.Social.Activity(variables.share_display, ...
[ "function weixinshare(){\n //wx.config({\n // debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。\n // appId: data.appId, // 必填,公众号的唯一标识\n // timestamp: data.timestamp, // 必填,生成签名的时间戳\n // nonceStr: data.nonceStr, // 必填,生成签名的随机串\n // signatur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function restart width of every story instead of showing story
function widthStoryRestart() { data.forEach(val => { if (val.id !== accountGlobal.id) { for (let i = 0; i < val.news.length; i++) { val.news[i].width = 0; } } else { for (let i = 0; i < val.news.length; i++) { if (val.news[i].id !==...
[ "function reassignWidth() {\n return data[accountGlobal.id].news[storyGlobal.id - 1].width;\n}", "function setAnimation() {\n const element = document.getElementById(\"mainStory-content\");\n element.classList.remove(\"animationMainStory\");\n void element.offsetWidth;\n element.classList.add(\"ani...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start the Recorder. Returns a promise which resolves when the recorder has started.
start() { return (0, _tslib.__awaiter)(this, void 0, void 0, function* () { (0, _Debug.assert)(this.state !== "started", "Recorder is already started"); const startPromise = new Promise(done => { const handleStart = () => { this._recorder.removeEventListener("start", handleStart, false...
[ "async function initRecorder() {\n let blob = {};\n if (!recorder) {\n try {\n recorder = new MediaRecorder(await initStream());\n } catch (e) {\n throw e;\n }\n //Recorder Events\n recorder.ondataavailable = (e) => {\n blob = e.data;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process nums, return false if it times out, true otherwise
function processNumsTiming(n, backVals, timeout) { startTime = Date.now(); // Create the numSorter const numSorter = new NumSorter(); // Add even numbers 0 through n to allowed list for (let i = 0; i <= n; i++) { if (i % 2 === 0) numSorter.addAllowedNum(i); if (!checkTimeout(start...
[ "function areNumbersInRange(puzzle) {\n for (var i = 0; i < puzzle.length; i++) {\n if (puzzle[i] < 0 || puzzle[i] > 9) {\n return false;\n }\n }\n return true;\n }", "function greaterThanSum(nums)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read `Response.body` stream as ArrayBuffer. This function provide progress information by callback.
function readArrayBufferProgressively(res, callback) { if (!callback || !res.body) return res.arrayBuffer(); let contentLength = res.headers.get('Content-Length'); if (!contentLength) return res.arrayBuffer(); const total = parseInt(contentLength); let buffer = new Uint8Array(total);...
[ "async *_bodyStream() {\n let buf = yield 0; // dummy yield to retrieve user provided buf.\n if (this.headers.has(\"content-length\")) {\n const len = this.contentLength;\n if (len === null) {\n return;\n }\n let rr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle an event where a piece changes without moving or attack
function onPieceChange(data){ //The image is being changed if(data.image) pieces[tiles[(MAX_TILES-1)-data.x][(MAX_TILES-1)-data.y].occupant].image.src = data.image; //The job is being changed if(data.job) pieces[tiles[(MAX_TILES-1)-data.x][(MAX_TILES-1)-data.y].occupant].job = data.job; //Motio...
[ "function managePiece() {\n this.piece.place(); //we place the piece exactly in a correct position on the grid\n this.grid.mergePiece(this.piece); //we join the piece to the grid\n if (this.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CLUSTER MEAN get means of point in first and in 2nd half of arrays
clusterMean(data) { let half = data.slice(0, Math.floor(data.length / 2)); // first half of distances array const halfMeanX = half.map(p => p.x).reduce((a, b) => a + b) / half.length; const halfMeanY = half.map(p => p.y).reduce((a, b) => a + b) / half.length; let end = data.slice(Math....
[ "assignedPointsMean(arr, len) {\n \n const meanX = arr.map(p => p.x).reduce((a, b) => a + b) / len;\n const meanY = arr.map(p => p.y).reduce((a, b) => a + b) / len;\n return {\n x: meanX,\n y: meanY\n }\n }", "function calcula...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set access to a Resource for a specific Agent. This function adds the relevant Access Control Policies and Rules to a Resource's Access Control Resource to define the given access for the given Agent specifically. In other words, it can, for example, add Policies that give a particular Agent Read access to the Resource...
function internal_setAgentAccess(resource, webId, access) { return internal_setActorAccess(resource, acp.agent, webId, access); }
[ "async function setAgentResourceAccess(resource, agent, access, options = internal_defaultFetchOptions) {\n return await setActorAccess(resource, agent, access, getAgentAccess$2, setAgentResourceAccess$1, options);\n}", "async function setGroupResourceAccess(resource, group, access, options = internal_defaultF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a demo for FineCoarseSpinner
function demoFineCoarseSpinner( layoutBounds, options ) { const numberProperty = new NumberProperty( 0, { range: new Range( 0, 100 ), tandem: options.tandem.createTandem( 'numberProperty' ) } ); const enabledProperty = new BooleanProperty( true, { tandem: options.tandem.createTandem( 'enabledPropert...
[ "function triggerSpinner() {\n\n //Object for spinner settings\n var optsb = {\n lines: 11 // The number of lines to draw\n , length: 40 // The length of each line\n , width: 13 // The line thickness\n , radius: 25 // The radius of the inner circle\n , scale: 0.5 // Scales o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build the contents of the tableDiv element, filtered according to the specified type.
function buildFilteredTable (type) { // Generate "add column" cell. clearElement(addColumnDiv) addColumnDiv.appendChild(generateColumnAddDropdown(type)) const query = generateQuery(type) updateTable(query, type) }
[ "function renderTableForQuery (query, type) {\n // infer columns from query, to allow generic queries\n let columns\n if (!givenQuery) {\n columns = type.getColumns()\n } else {\n columns = inferColumns(query)\n }\n\n // Start with an empty list of rows; this will be populated\n // by...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get logs from all sources in list in chronological order
function getAllEntries(){ for(const [sourceId, logSource] of logSources.entries()){ getEntries(sourceId, logSource); } }
[ "function getLogsFromServer() {\n if (!$scope.logs) return;\n\n var logs = $scope.logs;\n var len = logs.length;\n for (var i = 0; i < len; i++) {\n getLog(logs[i]);\n }\n }", "function sink (log, sources, ms, cnt) {\n var lastKeys = null\n var stream = kefir.mer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
$Id: CSSAnalyzer.js,v 1.5 2005/03/31 15:18:20 malex Exp $ ============================================================================ The CSSAnalyzer class ============================================================================ Constructor
function CSSAnalyzer(fileAttr, session) { this._doc = fileAttr; this._session = session; this._initialized = false; this._blocks = null; }
[ "parse(cssText) {\n return this.parseStylesheet(new tokenizer_1.Tokenizer(cssText));\n }", "function CSSCache()\n{\n this._blocks = new Object(); // hash table url -> CSSBlock\n this._dates = new Object(); // hash table url -> modification date \n}", "function CSSRule(raw_sel, raw_prop)\n{\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Buff check: "Well fed"
function τSST_detect_buff_well_fed() { buffs_table.buff_msgs_summary = localStorage[storage_key_prefix + 'buffs_table_buff_messages']; var page_buffs_node = $(".buff-messages").find(".timer-message"); if (page_buffs_node.length) { var buffs_list = buffs_table.buff_messages; ...
[ "function checkEntityForBuff(entity, buff) {\n let s = false;\n if (entity.s) s = Object.keys(entity.s).includes(buff);\n let overall = Object.keys(entity).includes(buff);\n return s || overall;\n}", "function τSST_detect_static_buffs() {\n // Available only in Player Details page (http://alpha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MD5 OOP implementation. Use this class to perform an incremental md5, otherwise use the static methods instead.
function MD5() { // call reset to init the instance this.reset(); }
[ "digesting() {}", "function binl_md5(x, len) {/* append padding */x[len >> 5] |= 0x80 << ((len) % 32);x[(((len + 64) >>> 9) << 4) + 14] = len;var i, olda, oldb, oldc, oldd,a = 1732584193,b = -271733879,c = -1732584194,d = 271733878;for (i = 0; i < x.length; i += 16) {olda = a;oldb = b;oldc = c;oldd = d;a = md5_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process up to one thing. Generally: If we are processing a literal, we make sure we have the data for the whole literal, then we process it. If we are not in a literal, we buffer until we have one newline.
function processData(data) { if (data.length === 0) return; var idxCRLF = null, literalInfo, curReq; // - Accumulate data until newlines when not in a literal if (self._state.curExpected === null) { // no newline, append and bail if ((idxCRLF = bufferIndexOfCRLF(data, 0)) === -1) { ...
[ "_completeLiteral(token) {\n // Create a simple string literal by default\n let literal = this._literal(this._literalValue);\n\n switch (token.type) {\n // Create a datatyped literal\n case 'type':\n case 'typeIRI':\n const datatype = this._readEntity(token);\n\n if (datatype =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getValuesForFieldInPolicyAllTypes gets all values for a field for all rules in a policy of all ptypes, duplicated values are removed.
getValuesForFieldInPolicyAllTypes(sec, fieldIndex) { const values = []; const ast = this.model.get(sec); if (!ast) { return values; } for (const ptype of ast.keys()) { values.push(...this.getValuesForFieldInPolicy(sec, ptype, fieldIndex)); } ...
[ "getValues() {\n return this.getValuesFromElement(this.element);\n }", "resolveValues(item, field, index_as, cf) {\n if( index_as !== field ) {\n this.logger.debug(`resolveValues for ${item[\"@id\"]} ${field} ${index_as}`);\n }\n const resolved = this.resolveAndFlatten(item, field, index_as, cf)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test Nominal attribute similarity function
function test_nominal_attribute(){ console.log("test_nominal_attribute....") var myMap = new Map(); myMap.set("Nominal", new Nominal(["0","1","2", "3", "4"])); //initialize var similarityDist = new SimilarityDistanceClass(myMap); var data = [ {"Nominal": "1"}, {"Nominal": "0"}, {"Nom...
[ "function test_mixed_attributes(){\r\n\t\r\n\tconsole.log(\"test_mixed_attributes....\")\r\n\r\n\tvar myMap = new Map();\r\n\tmyMap.set(\"Nominal\", new Nominal([\"0\",\"1\",\"2\", \"3\", \"4\"]));\r\n\tmyMap.set(\"Ordinal\", new Ordinal([\"0\",\"1\",\"2\",\"3\",\"4\"], 4, 0));\r\n\tmyMap.set(\"Numeric\", new Numer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Repeatedly issues requests to a server until we have all fragments of all images, then fires a `done` callback.
function getAllFragments(done) { var endpoint = 0; var queue = []; function _getAllFragments() { if (gotAllFragments()) { done(); } else { if (queue.length < 5) { queue.push(endpoint); getFragment(endpoint + 1, function (fragment) { if (fragment !== null && gotAllI...
[ "function checkImages(){ //Check if the images are loaded.\n\n if(game.doneImages >= game.requiredImages){ //If the image loads, load the page to the DOM.\n\n init();\n }else{ //loop until the images are lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: ShowAlert shows email alert or saved search popup a anchor mode savesearch or newalert
function ShowAlert() { var a = document.createElement('a'); a.href='/enUS/search-editor/default.html?mode=newalert&' + $j('#search_state').val(); a.setAttribute('rel','popup 700 750'); showpopup(a); }
[ "function alertMessageAdd() {\n\t\t\talert.css('display', 'block');\n\t\t}", "function showAlert(type, message, callback) {\n // Set alert colors\n setAlertStyle(type);\n // Determine type of alert to show\n var hitboxElement;\n if ($('#welcome-blue-hitbox').length) {\n // Check to see if we...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(13) Write a function that divides by 2 using binary manipulation only
function divBy2(value) { return value >> 1; }
[ "function divideByTwo(int) {\n return int >> 1\n}", "function divisibleByB(a, b) {\n\treturn a - a % b + b;\n}", "function two (num) {\n if (num>=2) {\n return \tparseInt(num/2)+two(parseInt(num/2));\n }\n else {\n return 0;\n }\n }", "function halveCount(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when department is changed
function updateSelectedDepartment() { }
[ "function updateDeptsFunc(dept, sales) {\n\tvar queryDBquantity = \"SELECT total_sales FROM departments WHERE ?\";\n\t// using mySQL connection to run queryDBquantity\n\tconnection.query(queryDBquantity, {\n\t department_name: dept\n\t}, function(err, res) {\n\t\tif (err) throw err;\n\t\tvar deptSalesDB = res[0].t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
' Name : handle_bp_get_corp_account ' Return type : None ' Input Parameter(s) : req, startTime, apiName ' Purpose : Creating a class to handle the BP_GET_CORP_ACCOUNT API error with following members ' History Header : Version Date Developer Name ' Added By : 1.0 28th Apr,2012 Ravi Raj '
function handle_bp_get_corp_account(req, startTime, apiName) { this.req = req; this.startTime = startTime; this.apiName = apiName; }
[ "function handle_bp_account_lite(req, startTime, apiName) {\n this.req = req; this.startTime = startTime; this.apiName = apiName;\n}", "function handle_bp_remove_biller_corp_account(req, startTime, apiName) {\n this.req = req; this.startTime = startTime; this.apiName = apiName;\n}", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check up right left down Alaways have to check whether the node is a wall If is a wall then it wont be added to the the surr_node_coor if node alrd in close node need to do checking
function get_surr_coor(x){ const coor_current_node = x[0]; const surrounding_node_coor = []; // up const row_up = coor_current_node[0] - 1 ; const column_up = coor_current_node[1] ; if(check_wall(row_up,column_up) === 'unvisited _wall' || check_wall(row_up,column_up) === 'Starting-Node...
[ "checkRI() {\n const leftChildHeight = this.left === null ? -1 : this.left.height;\n const rightChildHeight = this.right === null ? -1 : this.right.height;\n if (Math.abs(leftChildHeight - rightChildHeight) >= 2) {\n console.log(`RI INVALID! ${this.key}`);\n }\n if (Math.max(leftChildHeight, rig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: getClickedWord Called by: delegateMethod Parameters: selRange The clicked location in the DOM. node DOM node that was clicked. Returns: word (word that was clicked on, without punctuation, etc.) Explanation: Retrieves DOM node information for a mouse click. Given the node that was clicked, it gets the string cont...
function getClickedWord(selRange, node) { var nodeText = document.createRange(); nodeText.selectNode(node); var str = nodeText.toString(); var loc = selRange.focusOffset; return isolateWord(str,loc); }
[ "function click_word(word,dimension,mouse_event){\n console.log('word ');\n console.log(word);\n console.log('Dimension: ');\n console.log(dimension);\n /*alert('word: '+ item + ' with coordinates: '+ JSON.stringify(dimension));*/\n }", "function getWordOnPosition(pos) {\n\tvar editableDiv = docum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load userpromocode and append to req.
async function load(req, res, next) { req.userpromocode = await UserPromocode.get(req.params.userpromocodeId); return next(); }
[ "function load(req, res, next, userId) {\n _models.Professional.get(userId).then(function (professional) {\n req.professional = professional;\n return next();\n }).catch(function (e) {\n return next(e);\n });\n}", "willSendRequest (req) {\n req.params.set('apikey', this.context.tm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes a status and updates all checked videos with that status
function updateAllVideoStatuses(newStatus, currentStatus) { /* var id = null; $('.fab-main-videos').find('input:checkbox').each(function(){ id = $(this).attr('value'); if($(this).is(':checked')) { updateVideoStatus(newStatus, currentStatus, id); } ...
[ "function updatevideostatus(){\n \n \n if(video.paused)\n {\n \n video.play();\n }\n else{\n video.pause();\n }\n\n \n }", "function update(){\n\tvlc.status().then(function(status) {\n\t\tvar newPlaying={\n\t\t state: escapeHtml(status.artist+\" - \"+status.album),\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter sur la variable this._imageUrl de l'attribut imageUrl
set imageUrl(monImageUrl) { this._imageUrl = monImageUrl }
[ "set imageURL(aValue) {\n this._logger.debug(\"imageURL[set]\");\n this._imageURL = aValue;\n }", "set imageURL(aValue) {\n this._logService.debug(\"gsDiggEvent.imageURL[set]\");\n this._imageURL = aValue;\n }", "get imageUrl() {\n return this._imageUrl\n }", "async updateImageSource()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
u2 attribute_name_index; u4 attribute_length; u1 info[attribute_length]; }
function AttributeInfo(bytesArray, index) { this.bytes = bytesArray; var startByteIndex = index; var nameIndex = getTwoBytes(bytesArray, index); var attributeLength = getFourBytes(bytesArray, index + 2); var info = null; // todo:Add this this.length = function() { return 6 + attributeLe...
[ "getAttribLocation(name) {\n\t\treturn this.attributes[name] ? this.attributes[name].location : -1;\n\t}", "_updateAttributes() {\n const attributeManager = this.getAttributeManager();\n\n if (!attributeManager) {\n return;\n }\n\n const props = this.props; // Figure out data length\n\n const ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
scan wifi networks and display them in the list
function scan() { if (scanning) return; // stop auto-scanning if wifi disabled or the app is hidden if (!gWifiManager.enabled || document.mozHidden) { scanning = false; return; } scanning = true; var...
[ "listNetworks() {\n return this.sendCmd(WPA_CMD.listNetwork);\n }", "function scan(config){\n cli.info(\"NETWORK FULL SCAN STARTED\\n\");\n _.each(_.keys(SPTree) , function(fromLan){\n _.each(_.keys(SPTree[fromLan]) , function(toLan){\n if (fromLan != toLan){\n doP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disable all custom editors
function wrs_int_disableCustomEditors(){ Object.keys(_wrs_int_customEditors).forEach(function(key) { _wrs_int_customEditors[key].enabled = false; }); }
[ "SetExcludeEditorFromAnyPlatform() {}", "GetExcludeEditorFromAnyPlatform() {}", "function disableEditing() {\n disableForm(true);\n}", "disablePlugin() {\n this.settings = {};\n this.hiddenColumns = [];\n this.lastSelectedColumn = -1;\n\n this.hot.render();\n super.disablePlugin();\n this.r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a control to this group. This method also updates the value and validity of the control.
addControl(name, control) { this.registerControl(name, control); this.updateValueAndValidity(); this._onCollectionChange(); }
[ "function addControl(ctrl, cType, options) {\n for (var i = 0; i < p.controls.length; ++i) {\n if (p.controls[i].control == ctrl) {\n console.warn(\"Already added control: %o\", ctrl);\n return;\n }\n }\n\n options = options || {};\n\n var ctrlData = { control: ctrl, elements: []...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chapter 6 Yuki Check to Stop
function C006_Isolation_Yuki_CheckToStop() { // Yuki doesn't allow the player to stop if she has the egg if (C006_Isolation_Yuki_EggInside) { OverridenIntroText = GetText("NoPullEgg"); C006_Isolation_Yuki_CurrentStage = 200; C006_Isolation_Yuki_AllowPullBack = false; } // Yuki doesn't allow the player to st...
[ "stop() {\n this.target = undefined;\n // @ts-expect-error\n const pathfinder = this.bot.pathfinder;\n pathfinder.setGoal(null);\n // @ts-expect-error\n this.bot.emit('stoppedAttacking');\n }", "function stopGame(){\n\tresetGame();\n\tgoPage('result');\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines the number of bits required to encode the number represented in the given buffer as an unsigned value. The buffer is taken to represent an unsigned number in littleendian form. The number of bits to encode is the (zerobased) bit number of the highestorder 1 bit, plus one. For example: 00011000 01010011 high ...
function unsignedBitCount(buffer) { var result = bits.highOrder(1, buffer) + 1; return result ? result : 1; }
[ "function encodeIntoByteBuffer(buffer) {\n var self = this;\n var initialPosition = buffer.position;\n buffer.putInt32(encodingCookie);\n buffer.putInt32(0); // Placeholder for payload length in bytes.\n buffer.putInt32(1);\n buffer.putInt32(self.numberOfSignificantValueDigits);\n buffer.putInt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Requests a product. Use this to get the information you have set up in iTunesConnect, like the localized name and price for the current user.
function requestProduct(identifier, success) { showLoading(); Storekit.requestProducts([identifier], function (evt) { hideLoading(); if (!evt.success) { alert(L("ERROR_We_failed_to_talk_to_Apple_")); } else if (evt.invalid) { alert(L("ERROR_We_requested_an_invalid_product_")); } else { ...
[ "function askProduct() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"productPrompt\",\n message: \"What is the ID of the product you want to buy?\",\n choices: productIDs\n }\n ]).then(({ productPrompt }) => {\n connection.query(\"SELECT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a hex string return a base64 string
function hex2base64(s){ return Crypto.util.bytesToBase64(hex2bytes(s)) }
[ "function base64(data) {\n\tif (typeof data === 'object') data = JSON.stringify(data);\n\treturn Buffer.from(data).toString('base64');\n}", "toBase64() {\n return this._byteString.toBase64();\n }", "function hexReturnFull(hex) {\n\tvar shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n\treturn hex.re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hammer.Manager mock for use in environments without `document` / `window`.
function HammerManagerMock(m) { var instance = {}; var chainedNoop = function chainedNoop() { return instance; }; instance.get = function () { return null; }; instance.set = chainedNoop; instance.on = chainedNoop; instance.off = chainedNoop; instance.destroy = chainedNoop; instance.emit =...
[ "function addHammerRecognizer(theElement) {\n // We create a manager object, which is the same as Hammer(), but without \t //the presetted recognizers.\n //alert(\"dfadfad\");\n var mc = new Hammer.Manager(theElement);\n \n \n // Tap recognizer with minimal 2 taps\n mc.add(new Hammer.Tap({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursively loops through the initial comment's replies and their replies to mark them all as logically deleted.
function markDeleted(initialComment) { initialComment.deleted = true; if (initialComment.replies) { initialComment.replies.forEach(function(reply) { markDeleted(reply); }); } }
[ "function removecommentsubtree( pid ) {\n\tvar myctrclass = \".descendent-of-\" + pid;\n\n\t$( myctrclass ).each( function () { removecommentsubtree( $(this).attr( \"id\" ) ); } )\n\t\t.remove();\n}", "function onclickBtnReply(e) {\n e.preventDefault();\n /**\n * handle action on clicking reply button\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name : validateDepartureDate() Parameters : none Processes : Reports errors if departure date is in the past. Return Value: none
function validateDepartureDate() { var departureDate = document.getElementById("departureDate").value; // Gets and stores value of departureDate. var departureDateError = document.getElementById("departureDateError"); // Gets and stores departureDateError element. var departureDateObject = new Date(departureDate); ...
[ "function departureDateHandler() {\n\thandlePastDate();\t\t\t\t\t\t// Ensures that a past date is handled.\n\tdateInverter();\t\t\t\t\t\t\t// Inverts dates if necessary.\n}", "function handlePastDate() {\n\tvar departureDate = document.getElementById(\"departureDate\");\t\t\t\t\t// Gets and stores departureDate i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scope a src/dest tuple to the app path
function createSrcDestPre (getScope, getIpfs, rootPath) { return async (...args) => { const appPath = await getAppPath(getScope, getIpfs, rootPath) args[0][0] = Path.join(appPath, safePath(args[0][0])) args[0][1] = Path.join(appPath, safePath(args[0][1])) return args } }
[ "function createSrcPre (getScope, getIpfs, rootPath) {\n return async (...args) => {\n const appPath = await getAppPath(getScope, getIpfs, rootPath)\n args[0] = Path.join(appPath, safePath(args[0]))\n return args\n }\n}", "_applyCustomConfig() {\n\n this._backupSPFXConfig();\n\n // Copy c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates hidden divs to store the letters
function storeLetters(letters) { let letterContainer = document.getElementById("letterContainer"); for (const char of letters) { let underlined = document.createElement("div"); underlined.setAttribute("class", "underlined"); letterContainer.appendChild(underlined); var charContainer = document.creat...
[ "function genBoxes() {\n for (var i = 0; i < answer_length; i++) {\n\n if (answer[i] != \" \") {\n var letter = answer[i].toUpperCase();\n // var $newBoxDiv = $(\"<div class='letterBox'></div> \").text(answer[i].toUpperCase());\n // var $newBoxDiv = $(\"<div class ='flip-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
data should be an array of objects, each with two keys options should be an object of arrays, each with two elements (first one for the left column, second for the right column) options should specify the headers, fields, and alignment (right or left)
function printTable(options, data) { // Calculate widths for each column let fieldMax = [] options.fields.forEach((field, i) => { fieldMax[i] = Math.max.apply(Math,data.map(function(item) { return item[field].toString().length })) }) const leftLength = Math.max(fieldMax[0], options.headers[0].leng...
[ "tabulate(\n headers,\n rows,\n options) {\n if (!_.isArray(headers))\n TypeException(\"headers\", \"array\")\n if (!rows)\n TypeException(\"rows\", \"array\")\n if (_.any(rows, x => { return !_.isArray(x); }))\n TypeException(\"rows child\", \"array\")\n var o = _.extend({}, Kin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
State State is the parent object of Health, Stamina, Happiness. States holds Health, Stamina, Happiness common properties and behaviours.
function State(){ this.max=100; this.value = this.max; this.stateFlag; /* This increases the value property of an object of type State * @param o object inheriting from State * @param inc int the increment to be added */ this.increaseState = fu...
[ "function State() {\n\n this.update = function () {\n console.log(\"Warning: Current state must implement 'update' method\");\n }\n\n this.handleInput = function () {\n console.log(\"Warning: Current state must implement 'handleInput' method\");\n }\n\n this.enter = function () {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The method will get an event and a game_id and will update the game with the given event. The game should be a past game. The validtion is implemented in the client side. If the event exist it will be updated with the new value
async function addEventToGame(game_id,event){ let events_ids = await DButils.execQuery(`SELECT GamesEvents.gameid, Events.eventid FROM Events JOIN GamesEvents ON Events.eventid = GamesEvents.eventid WHERE GamesEvents.gameid = ${game_id} AND Events.EventDate = '${event.event_date}' AND Events.EventTime = '${...
[ "function handleEditGamePage() {\n document.addEventListener(\"DOMContentLoaded\", function (event) {\n \"use strict\";\n\n firebase.database().ref('/Globals').once('value').then(function (snapshot) {\n teamName = snapshot.child('TeamName');\n });\n\n var datetime = localStorage.getItem(\"datetime\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Autoselect text on focus
function focusText() { window.setTimeout(function () { const range = document.createRange(); range.selectNodeContents(document.activeElement); const sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); }, 1); }
[ "onFocusAutosuggest(event) {\n event.target.select();\n }", "_focusActiveOption() {\n var _a;\n if (!this.useActiveDescendant) {\n (_a = this.listKeyManager.activeItem) === null || _a === void 0 ? void 0 : _a.focus();\n }\n this.changeDetectorRef.markForCheck();\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dispatches `projectschange` event, requests update, and notifies any resize.
async [notifyProject]() { this.dispatchEvent(new CustomEvent('projectschange')); await this.requestUpdate(); // @ts-ignore if (this.notifyResize) { // @ts-ignore this.notifyResize(); } }
[ "update(projects) {\n $(this.projectList).empty();\n for (let proj in projects) {\n if (projects[proj].name == undefined) continue;\n let p = document.createElement('div');\n $(p).addClass('proj-value');\n $(this.projectList).append(p);\n\n let in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reference to a type parameter.
function TTypeParam(name) { this.name = name; }
[ "function tcbCtxParam(node) {\n var typeArguments = undefined;\n // Check if the component is generic, and pass generic type parameters if so.\n if (node.typeParameters !== undefined) {\n typeArguments =\n node.typeParameters.map(function (param) { return ts.createType...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if the new site announcement has been shown 3 times already if not, show it and increment the cookie value
function displayNewSiteAnnouncement() { const NewSiteCookie = 'newSiteAnnouncementShown'; const NewSiteAnnouncement = 'New Site Announcement'; const MaxDisplays = 3; try { // check if the lightbox has been shown once already this _session_ (ie visit to the website) if (!session.getItem(NewSiteCookie)) { s...
[ "function wpbingo_ShowNLPopup() {\n\t\tif($('.newsletterpopup').length){\n\t\t\tvar cookieValue = $.cookie(\"digic_lpopup\");\n\t\t\tif(cookieValue == 1) {\n\t\t\t\t$('.newsletterpopup').hide();\n\t\t\t\t$('.popupshadow').hide();\n\t\t\t}else{\n\t\t\t\t$('.newsletterpopup').show();\n\t\t\t\t$('.popupshadow').show()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build an object from key/value pairs: var obj = h$buildObject(key1, val1, key2, val2, ...); note: magic name: invocations of this function are replaced by object literals wherever possible
function h$buildObject() { var r = {}, l = arguments.length; for(var i = 0; i < l; i += 2) { var k = arguments[i], v = arguments[i+1]; r[k] = v; } return r; }
[ "function createMyObject() {\n return{\n foo:'bar',\n answerToUniverse: 42,\n \"olly olly\": 'oxen free',\n sayHello: function(){\n \treturn 'hello';\n }\n };\n}", "object(...keyValues) {\n const code = ['{']\n for (const [key, value] of keyValues) {\n if (code.len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new target data instance with an updated sequence number.
withSequenceNumber(t) { return new si(this.target, this.targetId, this.purpose, t, this.snapshotVersion, this.lastLimboFreeSnapshotVersion, this.resumeToken); }
[ "function newRequest(data){\n var request = createNewRequestContainer(data.requestId);\n createNewRequestInfo(request, data);\n }", "setNew(val) {\n return this._new !== val\n ? Object.assign(new this.constructor(this._data), {\n _new: val\n })\n : this\n }", "function newRefe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ajax call to retrieve all guilds
function retrieveGuilds(){ $('#create_guild').show(); $.ajax({ type: "GET", url: "/WebArenaGoupSI1-04-BE/Upgrade/retrieveAllGuilds", contentType: "application/json", dataType: "json", success: function (data) { $("#...
[ "function retrievePlayerGuild(){\n $('#create_guild').hide();\n $.ajax({\n\t type: \"GET\",\n\t url: \"/WebArenaGoupSI1-04-BE/Upgrade/retrievePlayersGuild\",\n contentType: \"application/json\",\n dataType: \"json\",\n success: function (data) { \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to tally up the positive an negative from the SVM prediction
function calculateSentiment(svmPredictionValues){ var positive = 0; var negative = 0; var i; for(i = 0; i < svmPredictionValues.length; i++){ if(svmPredictionValues[i] == 1){ positive++; } else{ negative++; } if((i+1) >= svmPredictionValues.length){ console.log(" "); console.log(" "); ...
[ "through(threshold) {\n\n\t\tlet d = this.value - threshold\n\t\tlet d_old = this.value_old - threshold\n\n\t\treturn d >= 0 && d_old < 0 ? 1 : d <= 0 && d_old > 0 ? -1 : 0\n\n\t}", "function countKdressKwiMinus() {\n\t\t\tif(instantObj.noOfKdressKWI > 0) {\n\t\t\t\tinstantObj.noOfKdressKWI = instantObj.noOfKdres...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ping at mouse position
function ping(x, y) { mousePos = { x: x, y: y }; if (mousePos.y < toolbox.height) { return; } toolComponent = Qt.createComponent("ping.qml"); if (toolComponent.status == Component.Loading) { toolComponent.statusChanged.connect(finishCreation); } else { finishCreation(); ...
[ "function ping() {\n primus.clearTimeout('ping').write('primus::ping::'+ (+new Date));\n primus.emit('outgoing::ping');\n primus.timers.pong = setTimeout(pong, primus.options.pong);\n }", "function ping() {\n rpc.tunnel.ping(function (err, _ts) {\n if (err) return console.error(err)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserconstructor_declaration.
visitConstructor_declaration(ctx) { return this.visitChildren(ctx); }
[ "enterConstructorDeclarator(ctx) {\n\t}", "visitConstructor_spec(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitDeclare_spec(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "exitConstructorDeclarator(ctx) {\n\t}", "visitType_declaration(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the current shape from the grid. same deal but reverse
function removeShape() { for (var row = 0; row < currentShape.shape.length; row++) { for (var col = 0; col < currentShape.shape[row].length; col++) { if (currentShape.shape[row][col] !== 0) { grid[currentShape.y + row][currentShape.x + col] = 0; ...
[ "clearGrid() {\n for (let row = 0; row < this.N; row++) {\n for (let column = 0; column < this.N; column++) {\n this.grid[row][column].element.remove();\n }\n }\n this.grid = null;\n\n this.width = 0;\n this.height = 0;\n this.N = 0;\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Higherlevel mouse helper function to specifically map mouse coordinates into the coordinates on a canvas that appear under it. This depends on the details of how a canvas gets scaled by CSS.
function canvas_mouse_coords(event, element) { var rcoords = relative_mouse_coords(event, element); // Assume that the CSS object-fit property is "fill" (the default). var xscale = element.width / element.offsetWidth; var yscale = element.height / element.offsetHeight; return {x: rcoords.x * xscale,...
[ "function adjustMouseCoords() {\n\t// adjust for zoom\n\txMouse /= zoomFactor;\n\tyMouse /= zoomFactor;\n\t// adjust for pan\n\t// first get viewBox info\n\tvar vBox = canvas.getAttribute(\"viewBox\").split(\" \");\n\tvar vBoxX = parseFloat(vBox[0]);\n\tvar vBoxY = parseFloat(vBox[1]);\n\tvar vBoxW = parseFloat(vBo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Base your assertions from an existing CloudFormation template formatted as an inmemory JSON object.
static fromJSON(template, templateParsingOptions) { try { jsiiDeprecationWarnings.aws_cdk_lib_assertions_TemplateParsingOptions(templateParsingOptions); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.capt...
[ "ensureTestStructure(transaction) {\n transaction.test.request = transaction.request;\n transaction.test.expected = transaction.expected;\n transaction.test.actual = transaction.real;\n transaction.test.errors = transaction.errors;\n transaction.test.results = transaction.results;\n }", "templateM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUnctiont o wrap the event_data for dividing partitions, removing a network from a partition
function wrapPartitionDivider( network, partition, simulation){ var event_data = {}; event_data.split_networks_list = [ network]; event_data.partition_id = partition._id; event_data.simulation_id = simulation._id; return event_data; }
[ "function wrapPartitionMerge(partitiona, partitionb, simulation){\n\tvar event_data = {};\n\tevent_data.partition_a_id = partitiona._id;\n\tevent_data.partition_b_id = partitionb._id;\n\tevent_data.simulation_id = simulation._id;\n\treturn event_data;\n}", "_removeServiceStreamDataListener ( ) {\n\n this.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given an array of [x,y] points, return the average
function average_point(list) { var sum_x = 0; var sum_y = 0; var num_points = 0; for(var i=0; i<list.length; i++) { sum_x += list[i][0]; sum_y += list[i][1]; num_points += 1; } return [sum_x / num_points, sum_y / num_points]; }
[ "assignedPointsMean(arr, len) {\n \n const meanX = arr.map(p => p.x).reduce((a, b) => a + b) / len;\n const meanY = arr.map(p => p.y).reduce((a, b) => a + b) / len;\n return {\n x: meanX,\n y: meanY\n }\n }", "function avgValu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets X position for the cluster or label of a given weight class weightClass class being queried weightClassList ordered list of weight classes being considered. for label X's this should be all of them, but when the network is filtered by weight class only consider the list of filtered classes
function getXForWeightClass(weightClass, weightClassList) { if(weightClassList == null) { weightClassList = weightClasses; } var i = weightClassList.indexOf(weightClass); if(i === -1) return -1; var margin = 50; return margin + (width - 2 * margin) / weightClassList.length * ...
[ "function getIndicesWithClass(ar, class_name)\n{\n\tvar ind = [];\n\tfor (var i = 0; i < ar.size(); i++)\n\t{\n\t\tif (ar.hasClass(i, class_name))\n\t\t{\n\t\t\tind.push(i);\n\t\t}\n\t}\n\treturn ind;\n}", "function getCheckBoxValue(checkBoxClass){\r\n\tvar checkboxList = document.getElementsByClassName(checkBoxC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the opposite of a given position
function oppositePosition(p) { if (p === 'top') { return 'bottom'; } else if (p === 'bottom') { return 'top'; } else if (p === 'left') { return 'right'; } else if (p === 'right') { return 'left'; } return p; }
[ "negate() {\n return new Vector2(-this.x, -this.y);\n }", "negate() {\n return new Vector3(-this.x, -this.y, -this.z);\n }", "function opposite (degrees) {\n return constrain(degrees - 180)\n}", "negate() {\n return new Vector4(-this.x, -this.y, -this.z, -this.w);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear moving and idle timeouts
clearTimeouts() { clearTimeout(this.movingTimeout); clearTimeout(this.idleTimeout); }
[ "function clearAllTimeouts() {\n \n /* Getting new max timeout timer ID */\n var id = window.setTimeout(function() {}, 0);\n \n /* Going down through the timeout timers and clearing them */\n while (id--) {\n window.clearTimeout(id);\n } \n}", "function clearMonitorTimeout() {\n serlog('Clear disp. o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays 4 paragraphs at a delay interval using promises
function runPromises(text, delay){ // code goes here console.log('runPromises is called', text, delay); return new Promise(function(resolve, reject){ setTimeout(resolve(addParagraph(text)), delay) }) .then(Promise.resolve()) .then(Promise.resolve()) .then(Promise.resolve()) }
[ "function runForLoop(text, delay) {\n // code goes here\n console.log('runForLoop is called', text, delay);\n for (let i = 0; i < 4; i++) {\n setTimeout(addParagraph, delay * i, text);\n };\n}", "function displayWaitingText() {\n var index = 0;\n var waitingMessages = [ 'Creat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom type guard for CustomSecurityScheme. Returns true if node is instance of CustomSecurityScheme. Returns false otherwise. Also returns false for super interfaces of CustomSecurityScheme.
function isCustomSecurityScheme(node) { return node.kind() == "CustomSecurityScheme" && node.RAMLVersion() == "RAML10"; }
[ "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === SigningProfilePermission.__pulumiType;\n }", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find Location Id from Shared Key
function find_location_from_shared_key(shared_key){ var return_result="-1"; var locationSearchObj = search.create({ type: "location", filters: [ //["internalid","anyof",code], ["custrecord_tsa_iu_shared_key_loc", "is", shared_key], "AND", ["custrecord_tsa_loc_type"...
[ "function getUrlEntry(key)\r\n{\r\n\tvar search=location.search.slice(1);\r\n\t//alert(search);\r\n\tvar my_id=search.split(\"&\");\r\n\t//alert(my_id);\r\n\ttry {\r\n\t\tfor(var i=0;i<my_id.length;i++)\r\n\t\t{\r\n\t\t\tvar ar=my_id[i].split(\"=\");\r\n\t\t\tif(ar[0]==key)\r\n\t\t\t{\r\n\t\t\t\treturn ar[1];\r\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update plot limit indicator color
function update_plot_limit_indicator () { limit_indicator_color = "green"; // check if any selections are over plotting limit for (var k = 0; k < max_num_sel; k++) { if (selections.len_filtered_sel(k+1) > max_num_plots) { limit_indicator_color = "orange"; break; } } }
[ "_colorUpdate() {\n if(this.value){\n this.updateStyles({\n '--l2t-paper-color-indicator-icon': this.value,\n '--l2t-paper-color-indicator-icon-display': 'block',\n });\n } else {\n this.updateStyles({\n '--l2t-paper-color-indicator-icon': 'transparent',\n '--l2t-pap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a given robot is sending you radio.
isRadioing(robot) { return robot.signal >= 0; }
[ "sendForm() {\n\t\tlet rand = Math.floor(Math.random() * 101);\n\t\tif(rand <= 70) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function subcommable(action, send) {\n if (structEquiv(action.chan, send.chan)) {\n return patternMatch(action.pattern, send.message);\n }\n\n return fal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new account item in Monday
async function createMondayAccount(account) { console.log('Creting new Monday account:', account.Name) await monday.createItem(boardId, account.Id, { Name: () => account.Name, Phone: () => account.Phone, }) }
[ "createAccount()\n {\n account = this.web3.eth.accounts.create();\n\n vaultData.account_list.push(account)\n\n this.selectAccount( account.address )\n\n this.saveVaultData( vaultData )\n\n }", "function add_saturday()\n{\n\tvar name = validate_name( 'saturday_name', 'Saturday Nig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For each key, find its consecutive file name of the sound
function findFilePath (key) { let filePath = "sounds/" switch (key) { case "w": filePath += "tom-1.mp3" break; case "a": filePath += "tom-2.mp3" break; case "s": filePath += "tom-3.mp3" break case "d": filePath += "tom-4.mp3" break; case "j": ...
[ "function getAudioFileName(key) {\n\n var fileName = \"sounds/\";\n\n switch(key) {\n case 'w': fileName += \"tom-1\"; break;\n case 'a': fileName += \"tom-2\"; break;\n case 's': fileName += \"tom-3\"; break;\n case 'd': fileName += \"tom-4\"; break;\n case 'j': fileName += \"snare\"; break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks to see if a target is one of the cells in the puzzle matrix
function isCell(target) { return target.tagName === "INPUT" && target.classList.length && target.classList[0] === 'sudoku-input'; }
[ "isValidMoveNew(row, column) {\n if (!isInBoundaries(row, column)) {\n return false;\n }\n if (!this.tileSet.hasTileAt(row, column)) {\n return false;\n }\n var dx = [1, 0, -1, 0];\n var dy = [0, 1, 0, -1];\n let thisTile = this.tileSet.getTileA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a SupplyRequestWhen resource
static get __resourceType() { return 'SupplyRequestWhen'; }
[ "when(item) {\n return new Promise((resolve, reject) => {\n const listener = this.on('add', () => {\n if(this[ITEMS].has(item)) {\n resolve();\n this.off('add', listener);\n }\n });\n listener();\n });\n }", "function handleContextREQ (request) {\n\n\n\tsendRe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the first account listed, unless a default account has been set explicitly
async currentAccount() { const accounts = await this.web3.eth.getAccounts() const defaultAccount = this.web3.eth.defaultAccount return defaultAccount || accounts[0] }
[ "function getAccount(username){\n var matchedAccount;\n\n accounts.forEach(function(account){\n if (account.username === username){\n matchedAccount = account;\n }\n\n });\n\n return matchedAccount;\n\n\n}", "async getAccount(accountNo) {\n try {\n const acco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use `__generateActionName` function to generate action names. E.g. If you create an action with name `hello` it will be `action:hello` for the Flux.
function __generateActionName(name) { return 'action:' + name; }
[ "function actionCreator(action){\n return action\n}", "generateActionMessages() {\n this.generateActionGoalMessage();\n this.generateActionResultMessage();\n this.generateActionFeedbackMessage();\n this.generateActionMessage();\n }", "playAction(name) {\n this.action(actions[name])\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
padding blankHTML if node is empty (for cursor position)
function paddingBlankHTML(node){if(!isVoid(node)&&!nodeLength(node)){node.innerHTML=blankHTML;}}
[ "preprocessNodes(node) {\n let cleanedNode = node.cloneNode();\n if (node.nodeType === Node.ELEMENT_NODE) {\n const tag = tagName(node);\n // If we have to replace the tagname we create another node with the new\n // tagname and copy all the attribute of the original node\n if (this.tagMap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTIONS Loads i articles, i = articlesPerLoad
function loadArticles() { // Count Down let i = articlesPerLoad; while (i > 0) { if(articlesLoaded <= maxArticles) { // "articlesLoaded" is also the key of the array getArticleData(storyIDs[articlesLoaded]); articlesLoaded++; } i--; } }
[ "function loadArticles() {\n // clear article list\n clearArticleListChildren();\n\n // Create the query to load the last 12 articles and listen for new ones.\n var articlesRef = firebase.firestore().collection('articles');\n\n if (isUserSignedIn()) {\n // Get public articles\n var query_public = article...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset JSS registry, remove sheets and empty the styleManager.
function reset() { sheetMap.forEach(function (_ref2) { var jssStyleSheet = _ref2.jssStyleSheet; jssStyleSheet.detach(); }); sheetMap = []; }
[ "_destroyStyles() {\n if (!this.styleSheet) {return}\n this.styleSheet.destroy();\n this.styleSheet = null;\n }", "reStyle() {\n console.log('restyle')\n this._destroyStyles();\n this._initStyles();\n }", "function reset() {\n defaultRenderers_ = {};\n decorator...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }