query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Get list of Tenant Wallet Transaction
findAllTenantTransaction(params) { return this.request.get('tenant-transaction', params); }
[ "findAllTenantTransactionQ(options, params) {\n return this.request.post('tenant-transaction', options, {\n params\n });\n }", "listTransactions (account_number, page){\n const transactions = Api.post(this.base_url + '/listtransactions',\n { virtualaccount: account_number, page: page...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles debug meshes for the tile.
toggleDebug() { if (Settings.get('terrain_debug')) { this.add(this.debugWalls); } else { this.remove(this.debugWalls); } }
[ "_toggleDebug(e) {\n this.__debug = !this.__debug;\n this._triggerDebugPaint(this.__debug);\n }", "function switchDebug () {\n Map.debug = !Map.debug;\n}", "function toggleDebug(){\n let debugScreen = app.stage.getChildByName(\"DebugScreen\");\n let button = debugScreen.getChildByName(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exclusive: anymozilla, sameversion or samevendorrelease
function browserOK(exclusive) { if (exclusive == anymozilla) { if (typeof InstallTrigger == "object") return true; else { if(window.confirm("This package is intended only for Beonex Communicator, Netscape 6 or Mozilla.\nWould you like to download " + installName + "?")) gotoInstallPa...
[ "function doVersionExclude(test) {\n var tags = test.tags;\n for (var i = 0; i < tags.length; i++) {\n var tag = tags[i];\n if (tag.indexOf(\">=\") == 0)\n {\n // Check the tags.\n if (db.version() === \"0.0.0\") {\n print(\"Skipping server version che...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Paginate a HTML Table on the fly. Used to paginate table that lists markers.
function paginateTable($t = null) { // @ Original code by: Gabriele Romanato http://gabrieleromanato.name/jquery-easy-table-pagination/ // @ Modified by Francis Otieno (Kongondo) for the ProcessWire Module InputfieldImageMarker var $tables = $t ? $t : $('table.InputfieldImageMarkers'); $tables.each(function ...
[ "function paginateTable(tableId, pagerId, showPrevNext, showPageNum, rowsPerPage) {\n var pagerSize = 10;\n var pagerLeftInterval = 4;\n var pagerRightInterval = 4;\n var table = $('#'+tableId);\n var pager = $('#'+pagerId);\n \n if (table.hasClass('search_res')) {\n pager.find('li').rem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles the subscript formatting of selected contents.
toggleSubscript() { if (!this.owner.isReadOnlyMode) { let value = this.selection.characterFormat.baselineAlignment === 'Subscript' ? 'Normal' : 'Subscript'; this.selection.characterFormat.baselineAlignment = value; } }
[ "function toggleSubscript(editor) {\n execCommand_1.default(editor, \"subscript\" /* Subscript */);\n}", "toggleSuperscript() {\n if (!this.owner.isReadOnlyMode) {\n let value = this.selection.characterFormat.baselineAlignment === 'Superscript' ? 'Normal' : 'Superscript';\n this.se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts the Y axis ticks given the data to be plotted,
function extractTicks(data, yaxisTicks) { var i, len; for(i = 0, len = data.length; i < len; i += 1) { // extracting the data label and building an array in the form _[[1, // "0-10"], [2, "10-20"],..., [9, "90+"]]_ yaxisTicks.push([i, data[i][0]]); } }
[ "function extractYLabels(){\n for(var i=0;i<data.length;i++){\n if(data[i][0].yLabel){\n yLabels.push(data[i][0].yLabel);\n }\n }\n yLabels = unique(yLabels);\n extractZLabels();\n }", "function transformDataToYLabels(CHART_ELEMENT, data, timestamps, m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HELPERS ///////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// reads all .yml files from `dir` and merge resulting objects into single one
function load_configs(dir, callback) { var config = {}; FsTools.walk(dir, /[.]yml$/, function (file, stats, next) { Async.waterfall([ Async.apply(Fs.readFile, file), function (data, next) { Common.mergeConfigs(config, JsYaml.load(data)); next(); } ], next); }, function (...
[ "function loadConfigs(root) {\n let config = {};\n\n glob('**/*.yml', {\n cwd: root\n })\n .sort() // files order can change, but we shuld return the same result always\n .map(file => path.join(root, file))\n .forEach(file => {\n mergeConfigs(config, yaml.safeLoad(fs.readFileSync(file, 'utf8'), { filena...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Either shows content when logged in or clears contents.
showContentIfLoggedIn() { // Logged in if token exists in browser cache. if (sessionStorage.getItem('auth_token') != null) { this.token = sessionStorage.getItem('auth_token'); this.message = "The user has been logged in."; this.getSecureData(); } else ...
[ "showContentIfLoggedIn() {\n // Logged in if token exists in browser cache.\n if (sessionStorage.getItem('auth_token') != null) {\n this.token = sessionStorage.getItem('auth_token');\n this.message = \"The user has been logged in.\";\n }\n else {\n this.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches the various corner styles to boxes based on their class names.
function attachBoxFeatureCorners(){ $('.box-feature') .css({'padding-bottom':'3px'}) .parent() .append('<div class="br-orange-triangle-inverted"></div>'); $('.box-feature.tl') .css({'padding-top':'0'}) .parent() .prepend('<div class="tl-orange-triangle-inverted"></div>'); }
[ "function applyStyles() {\n padding = settings.get_int('hpadding');\n styleLine = '-natural-hpadding: %dpx'.format(padding);\n // if you set it below 6 and it looks funny, that's your fault!\n if (padding < 6) {\n styleLine += '; -minimum-hpadding: %dpx'.format(padding);\n }\n\n /* set styl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Plays a tiny explosion sound.
playExplosionSound() { this.explosionAudio.play(); }
[ "function explosion() {\n new Audio(\"audio/explode2.wav\").play();\n}", "function playExplosionSound(){\n if(helpExplosionSound>=explosionSound.length){\n helpExplosionSound = 0;\n }\n explosionSound[helpExplosionSound].play();\n helpExplosionSound++;\n }", "function makeExplodeSound(){\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tests two polygons by comparing them on all sides of polygonA
static _polygonPolygonTest(polygonA, polygonB, flipResultPositions = false) { let shortestDist = Number.MAX_VALUE; // set up the result object let result = new SATCollisionInfo(); result.shapeA = flipResultPositions ? polygonB : polygonA; result.shapeB = flipResultPositions...
[ "function testGeoPolygonGeoPolygonSubCase(geopolygon1, geopolygon2) {\n let intersects = false;\n const { numPolygons, polygons } = geopolygon2;\n for (let n = 0; n < numPolygons; n++) {\n let polygon = polygons[n];\n intersects = testGeoPolygonPolygon(geopolygon1, polygon);\n if (intersects === true) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parseInt :: Radix > String > Maybe Integer . . Takes a radix (an integer between 2 and 36 inclusive) and a string, . and returns Just the number represented by the string if it does in . fact represent a number in the base specified by the radix; Nothing . otherwise. . . This function is stricter than [`parseInt`][pars...
function parseInt_(radix) { return function(s) { var charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.slice (0, radix); var pattern = new RegExp ('^[' + charset + ']+$', 'i'); var t = s.replace (/^[+-]/, ''); if (pattern.test (radix === 16 ? t.replace (/^0x/i, '') : t)) { var n = pa...
[ "function parseInt_(radix) {\n return function(s) {\n var charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.slice (0, radix);\n var pattern = new RegExp ('^[' + charset + ']+$', 'i');\n\n var t = s.replace (/^[+-]/, '');\n if (pattern.test (radix === 16 ? t.replace (/^0x/i, '') : t)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
dialogElements all dialogs have elements define the controls of the dialog.
static get dialogElements() { SuiScoreFontDialog._dialogElements = typeof(SuiScoreFontDialog._dialogElements) !== 'undefined' ? SuiScoreFontDialog._dialogElements : [{ smoName: 'engravingFont', parameterName: 'engravingFont', defaultValue: SmoScore.engravingFonts.Bravura, contr...
[ "static get dialogElements() {\n SuiLayoutDialog._dialogElements = typeof(SuiLayoutDialog._dialogElements) !== 'undefined' ? SuiLayoutDialog._dialogElements :\n [{\n smoName: 'applyToPage',\n parameterName: 'applyToPage',\n defaultValue: -1,\n control: 'SuiDropdownComponent',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_.postfix(postfix, fn) simple way to postfix a function which outputs a string example: _.flow( _.get('.length'), _.prefix("items", _.log) )([1, 2, 3])
function postfix(postfix, fn){ return function(input){ fn( (prefix||'') + input ) return input } }
[ "postfix(src, m, call_id) {\n\n let target = this.get_args(this.fdef(m[2])).length\n let m0 = this.parentheses(m[0]) // First closed pair\n let args = this.get_args_2(m0)\n for (var i = args.length; i < target; i++) {\n args.push('void 0')\n }\n\n // Add an uniqu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replacing href attributes with onClick events with Regex It turn My Link into: My Link
function overrideLink(functionName, str){ // Remove links with blank href tags // For exampe: &lt;a href=""&gt;<a>This would break everything!&lt;/a&gt;</a> str = str.replace(/href=""/g, ''); // Replaces links with onclick events return str.replace(/href=\"(.+?)\"/, 'onclick="'...
[ "function newHrefPattern() {\n return /href=[\"']([^'\"]+)[\"']/g;\n}", "static convertLinks(input) {\n let regLink = new RegExp(`\\\\[(.*?)\\\\]\\\\((.*?)\\\\)`, 'gm')\n input = input.replace(regLink, `<a href=\"$2\" >$1</a>`);\n let regexCleanup = new RegExp(`^\\\\<p\\\\>(<a.*?>.*?\\\\<\\\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Entry in the position cache for draggable items.
function CachedItemPosition() {}
[ "function CachedItemPosition() { }", "_storeItemsCoordinates() {\n const that = this;\n\n if (that.disabled || !that.reorder) {\n return;\n }\n\n const coordinates = [];\n\n for (let i = 0; i < that._items.length; i++) {\n const currentItemContainer = that....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests if an interface exists with the specified name
hasInterface(ifaceName, namespaceName) { return !!this.getInterface(ifaceName, namespaceName); }
[ "function implements(object) {\n for(var i = 1; i < arguments.length; i++) { // Looping through all arguments \n // after the first one.\n var interfaceName = arguments[i];\n var interfaceFound = false;\n for(var j = 0; j < object.implementsInte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Responsible for gathering statistics information given constraints about a tournament's teams and calling the given callback with an err if needed, the tournament found, and the array of team statistics
function getFilteredTeamsInformation(tournamentid, constraints, callback) { // console.log(constraints); var teamInfo = []; Tournament.findOne({shortID : tournamentid}, function(err, result) { if (err) { callback(err, null, []); } else if (result == null) { callback(n...
[ "function getTeamsInfo(tournamentid, callback) {\n var teamInfo = [];\n Tournament.findOne({shortID : tournamentid}, function(err, result) {\n\n if (err) {\n callback(err, null, []);\n } else if (result == null) {\n callback(null, null, []);\n } else {\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define the loss function
loss(y, y_pred, len) { const outputLoss = tf.tidy(() => { const yTensor = tf.tensor(y); const y_predTensor = tf.tensor(y_pred); const compute = (1 / (2 * len)) * tf.sum(tf.pow(tf.sub(y_predTensor, yTensor), 2)).dataSync()[0]; return compute; }); return outputLoss; }
[ "function loss() {\n\n }", "loss() {\n }", "function loss(gue,act){\n //return meanSquaredError\n return gue.sub(act).square().mean();\n}", "function loss (pred, label){\n\n return pred.sub(label).square().mean();\n\n}", "function loss(pred, labels){\n return pred.sub(labels).square().mean(); \n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
31 JAN 2019 //JSIntern / Task is to write a JS program to create a new string from a given string, removing the first and last characters of the string if the first or last character is 'P'. If not, then return the original string
function isP(string1) { //check if string starts or ends with a P firstL = string1.substring(0,1) lastL = string1.substring(string1.length, (string1.length - 1)) // if it does, remove the first and last letter, then return result if ((firstL == "P") || (lastL == "p")) { string1 = string1....
[ "function removeP(str){\n\tif(str[0]==\"P\" || str[str.length-1]==\"P\"){\n\t\tvar arr = str.split(\"\");\n\t\tarr.pop();\n\t\tarr.shift();\n\t\tstr = arr.join(\"\");\n\t}\n\treturn str;\n}", "function checkForP(str) {\n if (str.indexOf(\"p\") == 0) str = str.slice(1);\n if (str.lastIndexOf(\"p\") == str.le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ajout d'un fonction a gerer via SocketIo
AddSocketIoFct(ModuleName, Fct){ let apiobject = new Object() apiobject.ModuleName = ModuleName apiobject.Fct = Fct this._SocketIoFctList.push(apiobject) }
[ "function callInicioSocket() {\r\n\tconsole.log(\"Peticion Inicio # \" + MAIN_SERVER_UDP_PORT + \" # \" + APP_ID);\r\n\t\r\n\tvar ab = str2ab(INICIO + \";\" + APP_ID);\r\n\tsocketUdp.write(socks.socketId, ab, writeComplete);\r\n}", "setupSocketIO() {\n\n }", "function createSocketIOObject(sendFunc, warnFunc=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a moment object to the first day of the quarter year momentObj(A) is within.
function convertToFirstOfQuarter(momentObj) { const monthValue = momentObj.month() % 3; let newMoment = momentObj.subtract(monthValue, 'months'); newMoment = convertToFirstOfMonth(momentObj); return moment(newMoment.format('YYYY-MM-DD')); }
[ "function getThisQuarterdays(){\n var dateObj={};\n var firstDay = moment(new Date(new Date().getFullYear(), new Date().getMonth(), 1)).subtract(2, 'months').format('MM-DD-YYYY');\n var lastDay = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0);\n dateObj.endDate = (1+lastDay.getMonth())...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns Article link from body
function extractLink(body) { body = cheerio.load(body); return body('a[tabindex=1]', '.result-1').attr('href'); }
[ "function createBodyLink( linkText, permalink )\n{\n var bodyLink = $( \"<a />\" );\n bodyLink.addClass( \"card-link\" );\n bodyLink.contextmenu( rightClickLink );\n bodyLink.text( linkText );\n if ( permalink != undefined )\n {\n bodyLink.attr( \"href\" , \"https://www.reddit.com\" + perma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
constructor function properties needed: image, title name, author name, book description (under volumeInfo)
function Book(obj) { this.image = obj.volumeInfo.imageLinks ? obj.volumeInfo.imageLinks.thumbnail : `https://i.imgur.com/J5LVHEL.jpg`; this.title = obj.volumeInfo.title ? obj.volumeInfo.title : 'Title not available'; this.author = obj.volumeInfo.authors ? obj.volumeInfo.authors : 'Author(s) not available'; this...
[ "function Book(title, artist, genre, type, image){\n this.title = title;\n this.artist = artist;\n this.genre = genre;\n this.type = type;\n this.image = image;\n}", "constructor(title, image, desc, price) {\n this.title = title;\n this.image = image;\n this.description = desc;\n this.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Push the move and broadcast to all clients for the gameID
addToMoveListAndBroadcast(move, gameID) { let moves = Connection.games.get(gameID) move.id = moves.length + 1 this.broadcast(move, gameID) moves.push(move) }
[ "function broadcast() {\n wss.clients.forEach((client) => {\n if (client.readyState === client.OPEN)\n client.send(JSON.stringify(gameState));\n });\n}", "sendGameUpdateToAll() {\n server.emitToLobby(this.lobby.code, \"UPDATE_GAME\", this.createUpdate())\n\n console.log(\"Game update sent to all:\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Search for user who wrote the quiz instead
searchUser(){ let userQueryRegex = /.*\S.*/; // Input cannot be blank let userQuery = read.question("Search Quiz User: (-1 to exit)\n>> ", {limit: userQueryRegex, limitMessage: "Type something!"}); if(userQuery == -1) this.searchAQuiz(); else this.searchUserFuzzy(userQuery); ...
[ "function searchAndVerify(userQ) {\n\tvar uIndex = -1;\n\tvar userList;\n\t\n\tif (isNaN(parseInt(userQ, 10))) {\n\t\tfs.readFile(path.join(__dirname, \"steamusers.json\"), { encoding: \"utf-8\" }, function(err, data) {\n\t\t\tif (err) { return \"File error. @Drecake#3278 good fuckin job\"; }\n\t\t\t\n\t\t\tuserLis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class to build handlers for `triggers` on behaviors for views
function BehaviorTriggersBuilder(view, behaviors) { this._view = view; this._behaviors = behaviors; this._triggers = {}; }
[ "function BehaviorTriggersBuilder(view, behaviors) {\n this._view = view;\n this._viewUI = _.result(view, 'ui');\n this._behaviors = behaviors;\n this._triggers = {};\n }", "function BehaviorTriggersBuilder(view, behaviors) {\r\n this._view = view;\r\n this._behavior...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds test methods containing "suite.Run()" call.
function findAllTestSuiteRuns(doc, allTests) { // get non-instance test functions const testFunctions = allTests.filter((t) => !testMethodRegex.test(t.name)); // filter further to ones containing suite.Run() return testFunctions.filter((t) => doc.getText(t.range).includes('suite.Run(')); }
[ "runAll() {\n const testName = this.__proto__.constructor.name;\n console.log(`--> Running test: ${testName}`);\n \n let testCount = 0;\n let reflection = Reflect.getPrototypeOf(this);\n let functionNames = Reflect.ownKeys(reflection);\n for (let testIndex = 0; testIndex < functionNam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::Serverless::Function.FunctionEnvironment` resource
function cfnFunctionFunctionEnvironmentPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnFunction_FunctionEnvironmentPropertyValidator(properties).assertSuccess(); return { Variables: cdk.hashMapper(cdk.stringToCloudFormation)(properties.va...
[ "function functionResourceEnvironmentPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n FunctionResource_EnvironmentPropertyValidator(properties).assertSuccess();\n return {\n Variables: cdk.hashMapper(cdk.stringTo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inside of 'vm' for Node, we need a way to translate a pseudoerror back into a real error once it's out of the VM.
function createBuiltInErrorInVm(name) { return { builtInError: true, name: name }; }
[ "translateError(err) {\n return err.toString(); // dumb for now\n }", "error(message) {\n\t\t\t\tthrow this.tokens.error(\"Runtime Error:\\n\" + message);\n\t\t\t}", "function error(e) {\n return is.error(e) ? e : {__clearest__: {error: e}};\n}", "translate(error) {\n return error.type !== undefined...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function setVisibleField(fieldId) Show the field Parameters: fieldId the field Id
function setVisibleField(fieldId) { var field = getInputField(fieldId); if (field != null) { visibleObj(fieldId, true); visibleObj(fieldId + ROW_SUFFIX, true); visibleObj(rtvDisplayFieldFromInputField(field,'*field').id,true); } }
[ "function setInvisibleField(fieldId)\n{\n\tvar field = getInputField(fieldId);\n\tif (field != null)\n\t{\n\t\tvisibleObj(fieldId,false);\n\t\tvisibleObj(fieldId + ROW_SUFFIX, false);\n\t\tvisibleObj(rtvDisplayFieldFromInputField(field,'*field').id,false);\n\t}\n}", "function fieldDisplay(obj) {\r\n \t var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lower the flag when we've reached it
function lowerFlag () { const speed = 1.4; if (flagpole.isFound && flagpole.flagHeight + speed < world.floor - 60) { flagpole.flagHeight += speed; } else if (flagpole.isFound) { flagpole.flagHeight = world.floor - 60; } else { flagpole.flagHeight = flagpole.height + 5; } }
[ "function flagRaised(){\n\treturn flag;\n}", "upChangeTransition(topFlag) {\n this.redraw = false;\n if(topFlag > this.peekRedrawStack()) {\n this.pushRedrawStack(topFlag);\n return true;\n }\n return false;\n }", "breakProcessing() {\n this._break = t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sequence() looks for a sequence matching the first argument the second argument is an event index number events at the given index are distributed to the relevant module dictionaries if there is a named Dict in Max that matches a mod name in an event, it's contents will reflect the event
function play(list, event){ if(event < 0){ error("negative sequence event number not allowed [" + event + "]\n"); return; } //create a new dict tied to the loaded EL var IEMdict = new Dict("EventScript"); var IEMobj = JSON.parse(IEMdict.stringify()); //convert to JS Obj //js objects handle nested arrays ...
[ "function runNextSequence(e) {\n let instance = e.target;\n\n instance.setSequence((instance.sequence + 1) % instance.model.sequences.length);\n}", "function make_sequence_conf( index ) {\n return {\n 'enumerable' : true,\n 'get' : function() { return this.data[ index ]; },\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the new column through redux
addColumn(val) { this.props.addColumn(val); this.setState({ newColumn: false }); }
[ "addColumn ({ commit }, { board, name }) {\n API.postList(board, name)\n .then((column) => commit(types.ADD_COLUMN, { column }))\n }", "addColumn(record, index) {\n console.log('Entered addColumn....');\n console.log(record);\n console.log(index);\n this.props.toggleModal('addColumn');\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
level = 1 + floor(exp / 100);
levelExpNeeded(level) { return (level - 1) * 100; }
[ "function expToLevel(point) {\r\n\tif (point < 0) return 0;\r\n\treturn Math.floor((Math.sqrt(1 + (4 * point) / 3) + 1) / 2);\r\n }", "neededExp(level){\n return level*10;\n }", "static experienceReducedBase (level) {\n return Math.max(1, Math.exp(30090.33 / 5000000 * (level - 99)));\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
read 3 toggle read object property
function toggleReadProperty(indexOfCardToChangeReadProperty) { if(cards[indexOfCardToChangeReadProperty].isRead == false){ cards[indexOfCardToChangeReadProperty].isRead = true; increaseReadCounter(); } else { cards[indexOfCardToChangeReadProperty].isRead = false; decreaseReadCounter(...
[ "toggle(prop) {\n this.set(prop, !this[prop]);\n }", "function toggleRead(event) {\n\t// event.target selects the parent object\n\tconst button = event.target;\n\t// find's the button's parent's parent's dataset set with index to alter this in the library\n\tconst libraryIndex = button.parentElement.parentEle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set players name to default if not set on form
function setPlayesName() { player01Name = document.getElementById("player01Name").value; if (player01Name == "") { player01Name = "player01" } player02Name = document.getElementById("player02Name").value; if (player02Name == "") { player02Name = "player02" } }
[ "function setPlayerName() {\n\t\tplayerName.innerText = nameInput.value;\n\t}", "set playerName(value) {\n this.name = value;\n }", "function resetNames() {\n inputPlayerOneName.value = \"\";\n inputPlayerTwoName.value = \"\";\n }", "function setPlayerName(player, name) {\n /* If...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hang callback on pointer move event of this frame
onPointerMove(callback, isOnce = false) { this._pointerMoveCallbacks.push([ callback, isOnce ]); }
[ "function _pointerMoveHandler(e) {\n\t\t_lastPointerEvent = e;\n\n\t\tif (!_pendingPointerMoveHandlers) {\n\t\t\twindow.requestAnimationFrame(_callPointerMoveHandlers);\n\t\t}\n\t\t_pendingPointerMoveHandlers = true;\n\t}", "function onPointerUp () {\nconsole.log('up')\npointerDownTarget = 0\n}", "onAfterMove()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Carrega caminho da imagem dos eventos da Petrobras
function petrobras_caminho(N_evento) { var caminho = ''; switch (N_evento) { case 1: caminho = "Imagens/Petrobras_1.jpg"; break; case 2: caminho = "Imagens/Petrobras_2.jpg"; break; } return(caminho); }
[ "function clube_Pinheiros_caminho(N_evento)\n{\n var caminho = '';\n\n switch (N_evento) {\n \n case 1:\n caminho = \"Imagens/Clube_Pinheiros_1.jpg\";\n break;\n\n case 2:\n caminho = \"Imagens/Clube_Pinheiros_2.jpg\";\n break; \n \n ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse whole ranges for document and get selector.
parseAndGetSelectors(word, wordLeftOffset) { let { ranges } = new css_range_parser_1.CSSRangeParser(this.document).parse(); let currentRange; let selectorIncludedParentRange; // Binary searching should be better, but not help much. for (let i = 0; i < ranges.length; i++) { ...
[ "function parseRange(range, opts) {\n const match = range.match(/^([^#:]*:)?((?:(?!::)[^#])*)(?:#((?:(?!::).)*))?(?:::(.*))?$/);\n if (match === null)\n throw new Error(`Invalid range (${range})`);\n const protocol = typeof match[1] !== `undefined`\n ? match[1]\n : null;\n if (typeo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Debug utility: logging wrapper for uirouter $state.go()
function stateDbg(toStateName, params, options) { console.log('>> Loading [%s]...', toStateName); return $state.go(toStateName, params, options) .then(function () { console.log('>>>> [%s] loaded, state:', toStateName, $state.current); }) .catch(functi...
[ "function logTheRoute() {\n LoggerActions.debug(`You've visited \"${this.state.location.pathname}\"`);\n}", "print() {\n logger.info(this._state);\n }", "function logSM() {\n util.log(util.inspect(stateMachine,{showHidden:false,depth:10}));\n}", "function debug() {\n\tlog(4, arguments);\n}", "debug(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create `TNode.type=TNodeType.Placeholder` node. See `TNodeType.Placeholder` for more information.
function createTNodePlaceholder(tView, previousTNodes, index) { var tNode = createTNodeAtIndex(tView, index, 64 /* Placeholder */ , null, null); addTNodeAndUpdateInsertBeforeIndex(previousTNodes, tNode); return tNode; }
[ "function createTNodePlaceholder(tView, previousTNodes, index) {\n var tNode = createTNodeAtIndex(tView, index, 64\n /* TNodeType.Placeholder */\n , null, null);\n addTNodeAndUpdateInsertBeforeIndex(previousTNodes, tNode);\n return tNode;\n}", "function createTNodePlaceholder(tView, previousTNodes, index) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
////////////////////////////////////////////////////////////////// Tile Generation // ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// Game tile object declaration
function gameTile(type) { this.type = type; }
[ "function newTile(){\n\tvar Tile = {\n\t\tx: 0, // X position of this tile\n\t\ty: 0, //Y position of this tile\n\t\tlocal_x:0,\n\t\tlocal_y:0,\n\t\twidth: 0, //width and height of this tile\n\t\theight: 0,\n\t\tbaseSourceIndex: 0, //index of tile source in tile engine's source array\n\t\tdecorationIndex: 0,\n\t\tp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the user has at least one notification that is not marked as read
hasUnreadNotifications() { return this.isLoggedIn() && !!_find(this.user.notifications, {isRead: false}) }
[ "hasUnreadNotifications() {\n if (this.notifications) {\n return _.filter(this.notifications.notifications, notification => {\n return !notification.read;\n }).length > 0;\n }\n\n return false;\n }", "hasNotifications() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
read iOS project module from cordova context
function getProjectModule (context) { var projectRoot = getProjectRoot(context); var projectPath = path.join(projectRoot, 'platforms', 'ios'); try { // pre 5.0 cordova structure return context.requireCordovaModule('cordova-lib/src/plugman/platforms').ios.parseProjectFile(projectPath); } cat...
[ "function getProjectModule (context) {\n var projectRoot = getProjectRoot(context)\n var projectPath = path.join(projectRoot, 'platforms', 'ios')\n\n try {\n // pre 5.0 cordova structure\n return context.requireCordovaModule('cordova-lib/src/plugman/platforms').ios.parseProjectFile(projectPath)\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find group two targets are both in
function findGroupPair(groups, targets) { var one var two var key = -1 _.forEach(groups, function (g, k) { one = _.some(g, function (d) { return d.name == targets[0] }) two = _.some(g, function (d) { return d.name == targets[1] }) if (one & two) key = k ...
[ "function findGroup(groups, target) {\n return _.findKey(groups, function (g) {\n return _.some(g, function (gg) {\n return gg.name == target\n })\n })\n }", "function sameCoreCheck(q1, q2){\n\tfor (var i = 0; i < nodeGroupings.length; i++){\n\t\tfor (var j = 0; j < nodeGroupings[i].length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create the TimeViewed & TimeSpendOnArticle from Articles //
function GetTimeandTimeSpent(cb) { var TimeReviwed = []; db.query( 'SELECT Article.TimesViewd,Article.TimeSpendOnArticle,Topics.TopicID,MODELS.ModelID,Article.ArticleID,Article.Title AS Article, Topics.Title AS Topic ,MODELS.Title AS MODEL FROM `Article` INNER JOIN Topics ON Topics.TopicID = Article.TopicID INN...
[ "function processArticleList( articles )\n{\t\n\tvar displayList = new Array();\n\n\t\tarticles.sort(function(a,b){\n\t\tif(a.created == b.created)return 0;\n\t\tif(a.created > b.created)return -1;\n\t\tif(a.created < b.created)return 1;\n\t\t});\n\t\n\tvar todayDate = systemTime.getTime();\n\tvar yesterdayDate = s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
selects a menu item this method provides functionality for nested radial menus
function selectMenuitem(evt) { var $this = $(this); var $element = $(evt.target); var container = $.radmenu.container; if (!$element.hasClass(container.itemClz)) $element = $element.closest("." + container.itemClz); var isInNested = $element.parents("....
[ "function radialMenuOnSelect() {\r\n\r\n\t\ttracker.recordSelectedItem(this.id);\r\n\t\tvar radialmenu = document.getElementById('radialmenu');\r\n\t\tradialmenu\r\n\t\t\t\t.parentNode\r\n\t\t\t\t.removeChild(radialmenu);\r\n\r\n\t\tdocument\r\n\t\t\t\t.getElementById(\"selectedItem\")\r\n\t\t\t\t.innerHTML = this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NAME : UserNavigationLoginAction_w3cstyle.js AUTHOR : Atos Origin DATE CREATED : 05/09/2005 DESCRIPTION: JavaScript functionality for taking default login action (Login, Register and Confirm Buttons) when user hits enter button $Log: P:/TDPortal/archives/DotNet2.0Codebase/TransportDirect/Web2/Scripts/UserNavigationLogi...
function TakeLoginAction(e) { var enterkeyPressed = IsEnterKeyPressed(e); if (enterkeyPressed) { if (window.event) { event.returnValue = false; event.cancel = true; } else { e.returnValue = false; e.cancel = true; } var ...
[ "function loginInit ()\n {\n var usrObj = document.getElementById ('txtUserName'); \n var screenShowObj = document.getElementById ('hdSreenVal');\n if(screenShowObj)\n {\n var screenVal = parseInt(screenShowObj.value, 10);\n switch (screenVal)\n { \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Js functions to install components and process a crud form
function install_form() { _install_form($(".form-editor")); }
[ "function install (caller) \r\n{\r\n\tif (!is_empty(caller)) \r\n\t{\r\n\t\tlet ajax_file = '/files/ajax/send.install.php';\r\n\t\tlet call_form = $(caller).closest('.install-form');\r\n\t\tlet fields = $(caller).closest('form').find('input, select, textarea');\r\n\t\tlet module_row = $(caller).closest('.module-row...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
After click on edit button, take applicantId from ApplicantInfo and open edit form (set visibility on true). Save states into sessionStorage in case of reload page.
handleEdit(id){ this.setState({showEditForm: true, applicantIdToEdit: id}); sessionStorage.setItem('showEditForm', 'true'); sessionStorage.setItem('applicantIdToEdit', id); }
[ "function edit_onclick() {\n entryEdit = this.employee;\n saveFilterOptions();\n setEdit();\n window.location.href = \"Edit.html\";\n}", "function editDisplay() {\n var x = document.getElementById(\"appt-edit\");\n if (x.style.display === \"none\") {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new login object, and attaches the account repo info to it.
function createLogin (ctx, accountReply, callback) { var username = accountReply.username + '-' + base58.encode(crypto.random(4)) var password = base58.encode(crypto.random(24)) var pin = accountReply.pinString var opts = {} if (accountReply.type === 'account:repo:co.airbitz.wallet') { opts.syncKey = new...
[ "function createLogin (io, username, opts) {\n var fixedName = fixUsername(username);\n\n return makeNewKit(io, null, '', fixedName, opts).then(function (kit) {\n var request = {};\n request.data = kit.server;\n return io.authRequest('POST', '/v2/login/create', request).then(function (reply) {\n kit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
int Bind (IDispatch, string, string)
Bind(IDispatch, string, string) { }
[ "function Component_BindingHandler() {}", "ConnectServer(string, string, string, string, string, string, int, IDispatch) {\n\n }", "function Bind_A_Obound() {\r\n}", "bindResponder(_responder) {\n }", "function Bind_Obound() {\r\n}", "function bind(obj,name){var f=obj[name].bind(obj);var sig=_getMetho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Passing values to parameters are not mandatory, eventhough this is not possible to do in JAVA
function passingValueToParamDemo(a,b,c) { return "This got passed to me A " + a + " B " + b + " C " + c; }
[ "function objeto_params(){\n \n}", "function defaultparams(a=101,b=\"lokesh\"){\n console.log(`student with ID ${a} is ${b}`)\n}", "function parameterRequired_(name, value)\n{\n if (typeof(value) == \"undefined\")\n throw \"'\" + name + \"' PARAMETER IS REQUIRED\";\n}", "function paramFunction()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Created by jhansen on 9/21/2015. / This function will handle the majority of ajax calls. It takes an endpoint, the data to be passed to the endpoint, and will accept a callback function. It will return a response object with a true/false status and can call a showMessage function to display a message to the
function ajaxCall(url,data,failCallback,successCallback) { var response={}; $.ajax({ url: url, type: "GET", data: data, dataType: 'json', error: function() { response.status=false; }, success: function(data) { response.statu...
[ "function apiCallForCurrentConditionsWithAJAX(endpoint) {\n\treturn $.ajax({\n\t\turl: endpoint,\n\t\ttype:\"GET\",\n\t\tsuccess: function(result) {\n\t\t\t//console.log(\"result is: \");\n\t\t\t//console.log(result);\n\t\t\t//console.log(\"now calling function to continue the program\");\n\t\t\t\n\t\t\t//Trigger t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===========================Returns the max Y value in data list=================================
function getMaxY(data) { let max = 0; let possibleMaxNumbers = data.values.map(function(cur){ return cur.y; }) max = Math.max.apply(null, possibleMaxNumbers); return max; }
[ "function getMaxY(data) {\r\n\tvar max = 0;\r\n\r\n\tfor(var i = 0; i < data.values.length; i ++) {\r\n\t\tif(data.values[i].Y > max) {\r\n\t\t\tmax = data.values[i].Y;\r\n\t\t}\r\n\t}\r\n\r\n\tmax += 10 - max % 10;\r\n\treturn max;\r\n}", "function getMaxY(data) {\n var max = 0;\n for (var i = 0; i < data....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function finds common abscissa values of two curves Creates modified curves with common abscissa domain Assuming that each curve xarrays are sorted in ascending order
#transformToCommonAbscissa() { const sampleCurveLength = this.sampleCurve.x.length; const targetCurveLength = this.targetCurve.x.length; let commonXmin = Math.max(this.sampleCurve.x[0], this.targetCurve.x[0]); let commonXmax = Math.min(this.sampleCurve.x[sampleCurveLength - 1], this....
[ "function checkEndpoints(curveA, curveB) {\n if (curveB.next === curveA) {\n if (curveA.next === curveB) {\n // if this is a very simple loop with only 2 beziers in it\n return undefined;\n }\n // else swap the curves to make the algorithm simpler\n [curveA, curv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
comparing the images in the imgActiv arrray
function compareImg(){ let allImages = document.querySelectorAll("img") //img see line in createBoard where element is created let firstId = imgActivId[0]; let secondId = imgActivId[1]; if(imgActiv[0]!==imgActiv[1]){ allImages[firstId].setAttribute("src", "img/blank.png"); allImages[secon...
[ "function compareImages(firstImage, secondImage){\n //console.log(\"compare images\");\n //console.log(firstImage);\n //console.log(secondImage);\n\n //test for array comparisons\n var arr1 = firstImage.filters;\n var arr2 = secondImage.filters;\n\n if (firstImage.key != secondImage.key){\n return false;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hides main financial info Author: Fardeen Yaqub
function hideFinancialInfo() { $('#projectData').find('#returnFinancial').hide(); $('#projectData').find('#pricingInfoTabLink').hide(); $('#projectData').find('#accountsReceivableTabLink').hide(); $('#projectData').find('#accountsPayableTabLink').hide(); $('#projectData').find('#accountsPayableTabLink').hide(...
[ "function showOrHideByAuthor(){\n $('#choose-authors .authorCheckbox').each(function() {\n var author = this.value,\n checked = this.checked;\n d3.selectAll('#scatter-container' + ' .' + author).classed('hidden', !checked);\n d3.selectAll('text' + '.' + author).classed('hidden', !chec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to display the tree in the HTML page.
function displayTree(node){ var str = ""; function createTreeHTML(node){ str = str + "<div><p class='status-" + node.status+ "'>" + node.value + "</p>"; for(var child in node.children){ createTreeHTML(node.children[child]); } str = str + "</div>"; } createTreeHTML(node); $('#tree-container').html(str);...
[ "function displayTree(tree) {\n\n return inspect(tree, false, 20, true);\n}", "function visTreeHtml(n) {\n if (isLeaf(n)) {\n return ['<br/>chr = [', n.chr, '], freq = ', n.freq];\n }\n\n return ['<ul><li>freq = ', n.freq, '</li><li>left', \n visTreeHtml(n.left), '</li><li>right',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====================================== Command parsing ====================================== checkBlacklistChannel() returns true when it's blacklisted and false if it's not
function checkBlacklistChannel(userID, serverID, channelID, args) { args = args.split(" "); if(blackList.hasOwnProperty("server" + serverID) && args[0] != getCommandPrefix(serverID) + "enable" && args[0] != getCommandPrefix(serverID) + "disable" && args[0] != getCommandPrefix(serverID) + "enablechannel" && args[...
[ "isBlackListed(command) {\n if (BLACKLISTED_COMMANDS.indexOf(command) !== -1) return true;\n return false;\n }", "function checkBlacklistCommand(serverID, args) {\n\targs = args.split(\" \");\n\n\tif(blackList.hasOwnProperty(\"server\" + serverID)) {\n\t\tfor(var i in blackList[\"server\" + serverID].disab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes a MySQL query to delete a post specified by its ID. Returns a Promise that resolves to true if the post specified by `id` existed and was successfully deleted or to false otherwise.
async function deletePostById(id) { comments = await deleteCommentsByPostId(id); likes = await deleteLikesByPostId(id); const [ result ] = await mysqlPool.query( 'DELETE FROM posts WHERE postId = ?', [ id ] ); return result.affectedRows > 0; }
[ "async function deleteCommentsByPostId(id){\n const [ result ] = await mysqlPool.query(\n 'DELETE FROM comments WHERE postId = ?',\n [ id ]\n );\n return result.affectedRows > 0;\n}", "async function DELETE_POST_BY_ID(res, id) {\n\tconst posts = await deletePost(id);\n\tres.end(\n\t\tjson({\n\t\t\tsucces...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Try to open a directory (triggered by the downloadDialog) Note that this does not work on all platforms!
function openDir(setId) { log("open dir for " + setId); setData[setId].saveDirectory.QueryInterface(Components.interfaces.nsILocalFile); try { setData[setId].saveDirectory.reveal(); } catch (e) { Services.prompt.alert(null, "Not supported", "Opening a directory is not supported on this platform"); ...
[ "function openDirectory(sender) {\n dialog.showOpenDialog(null, {\n properties: ['openDirectory'],\n }, (filePaths) => {\n if (filePaths && filePaths.length === 1) {\n sender.send('open-directory', filePaths[0]);\n }\n });\n}", "function openDirectory()\n{\n\tvar temp = {};\n\ttemp.currentDirecto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the modal element
function removeModal() { let modal = document.querySelector('.modal'); modal.remove(); }
[ "_removeModal() {\n this.$el.modal('hide');\n }", "_remove() {\n this.backdrop.remove();\n this.modal.remove();\n Utils.removeClass(document.body, 'modal-mode');\n }", "function removeModal() {\n document.querySelector(\".modal-container\").remove();\n}", "removeModal() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
start_cloud(section,plugin,cloud) This function sends an HTTP POST request to server.php with the type "start_cloud". You can add new parameters.
function start_cloud(section,plugin,cloud) { submit_data="section="+section+"&plugin="+plugin+"&cloud="+cloud+"&type=start_cloud"; $.ajax({ type: "POST", url: "index.php", data: submit_data, beforeSend: function() { $('#daemonStatus').removeClass("stopped"); ...
[ "function stop_cloud(section,plugin,cloud)\n{\n submit_data=\"section=\"+section+\"&plugin=\"+plugin+\"&cloud=\"+cloud+\"&type=stop_cloud\";\n $.ajax({\n type: \"POST\",\n url: \"index.php\",\n data: submit_data,\n beforeSend: function() {\n $('#daemonStatus').removeClas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unique fragment names A GraphQL document is only valid if all defined fragments have unique names.
function UniqueFragmentNamesRule(context) { var knownFragmentNames = Object.create(null); return { OperationDefinition: function OperationDefinition() { return false; }, FragmentDefinition: function FragmentDefinition(node) { var fragmentName = node.name.value; if (knownFragmentNames[...
[ "function UniqueFragmentNamesRule(context) {\n const knownFragmentNames = Object.create(null);\n return {\n OperationDefinition: () => false,\n FragmentDefinition(node) {\n const fragmentName = node.name.value;\n if (knownFragmentNames[fragmentName]) {\n context.reportError(new _GraphQLErro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates high at risk graph
function updateAtRiskHigh(){ var svgAtRiskHigh = d3.select("#vis-sec-at-risk-high") .append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .style("margin-left", margin.left + "px") .append("g") .attr("transform", ...
[ "function updateAtRisk(){\n\tvar svgAtRisk = d3.select(\"#vis-sec-at-risk\")\n\t\t\t\t\t\t.append(\"svg\")\n\t\t\t\t\t\t.attr(\"width\", width + margin.left + margin.right)\n\t\t\t\t\t\t.attr(\"height\", height + margin.top + margin.bottom)\n\t\t\t\t\t\t.style(\"margin-left\", margin.left + \"px\")\n\t\t\t\t\t\t.ap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Audio Frame (position) Conversions
frame2ms(frame) { }
[ "frame(frame) {\n const nch = frame.header.nchannels()\n const ns = frame.header.nbsamples()\n\n this.pcm.samplerate = frame.header.samplerate\n this.pcm.channels = nch\n this.pcm.length = 32 * ns\n\n /*\n if (frame.options & Mad.Option.HALFSAMPLERATE) {\n this.pcm.samplerate /= 2;\n this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start collection of entropy.
function eventsCollect() { if (!d) asmCrypto.random.skipSystemRNGWarning = true; if (localStorage.randseed) { if (d) console.log('Initially seeding PRNG with a stored seed'); asmCrypto.random.seed(asmCrypto.string_to_bytes(base64urldecode(localStorage.randseed))); } if ((document...
[ "function start() {\n console.log('loading training images');\n output[trainingImages[imageLoadIdx].letter] = 1;\n img.onload = handleImgLoad;\n img.src = __dirname + trainingImages[imageLoadIdx].path;\n}", "function addEntropy() {\n\n\t\tprng.addEntropy();\n\t\tvar prngState = prng.string(256);\t\t\t\t// obt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unsubscribe from the BroadcastStateMachine publisher's socket. Calling this method stops "pulse" events and will also prevent "timeout" events. After calling this method, a call to `subscribe()` is explicitly needed to reconnect and resubscribe the socket.
unsubscribe() { const sub = this.sub , url = this.url; if (url && sub) { debug('sub.disconnect: %s', this.url) try { sub.disconnect(this.url); } catch(_e) {/* ignore */} sub.unsubscribe(this[secretBuf$]); clearTimeout(this._pulseTimeout); this._pulseTime...
[ "unsubscribe()\n {\n console.log(`No more sockets waiting for data from this channel. Unsubscribing.`)\n }", "unsubscribe() {\n this.unbind();\n this.socket.emit('unsubscribe', {\n channel: this.name,\n auth: this.options.auth || {},\n });\n }", "stop()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `ConfluenceBlogConfigurationProperty`
function CfnDataSource_ConfluenceBlogConfigurationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an obj...
[ "function CfnDataSource_ConfluenceAttachmentConfigurationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the value of the opacity slider for the region overlay.
function getRegionOpacity() { var opacity = $('#regionOpacity').slider("value"); return isNaN(opacity) ? map.defaultRegionOpacity : opacity / 100; }
[ "function getLayerOpacity() {\n var opacity = $('#layerOpacity').slider(\"value\");\n return isNaN(opacity) ? map.defaultLayerOpacity : opacity / 100;\n }", "get opacity() {\n return this._opacity * 100;\n }", "get opacity() { return this.alpha * 255; }", "getOpacity() {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render the top level templates (header, files pane, tabs pane)
function renderTopLevel() { $("#wrapper").prepend(templates['header']()); $('#center_wrap').append(templates['files']()); $('#center_wrap').append(templates['panes']()); console.log('-- rendered top level UI html --'); }
[ "_renderMainContent () {\n switch (this.currentView) {\n case views.HOME:\n return lazyLoad(\n import('./views/view-home'),\n html`\n <view-home \n ._hasPendingChildren=\"${this._hasPendingChildren}\"\n ._pendingCount=\"${this._pendingCount}\">\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new interface.
addInterface(id, data) { this.interfaces[id] = new InterfaceData(data); this.interfaceNames.push(data.name); }
[ "addInterface(iface) {\n // late binding and avoid cyclic, aka, weak \n Object.defineProperty(iface, 'dobj', { get: () => this })\n Object.defineProperty(iface, 'dbus', { get: () => this.dbus })\n this.ifaces.push(iface)\n return this\n }", "addInterface(iface) {\n this.interfaces[iface...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check the object tree to see if the objPolicyLockTimer has been initialized. If resetTimer is true, reset found Policy Lock Timer.
function isPolicyLockTimerInitialized(resetTimer) { var isInitialized = false; if (objPolicyLockTimer) { // objPolicyLockTimer has been initialized isInitialized = true; // Reset Policy Lock Timer if (resetTimer) { objPolicyLockTimer.resetTimer(); } ...
[ "function resetPolicyLockTimer() {\r\n isPolicyLockTimerInitialized(true);\r\n}", "function initializePolicyLockTimer() {\r\n // Create timer object\r\n objPolicyLockTimer = new policyLockTimerObj();\r\n objPolicyLockTimer.timeoutInMilliSeconds = policyLockDuration * 60 * 1000;\r\n objPolicyLockTim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles callback event when changes are made to the hovering functionality
handleHoverChanged() { if(!hover) { hover = true; } else { hover = false; } }
[ "_hoverCallback() {\n this._hovered = true;\n }", "_hoverCallback() {\n this.hovered = true;\n }", "onhover() {\n this.hover = true;\n }", "function preparationHover(){\n \n}", "onHoverIn(e) {\n }", "function registerHoverBehav() {\n\t\t\t$('#markContainer').hover(functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var myParser = Dataset.parser('interval', 'timeframe.end');
function parseInterval(){ var options = Array.prototype.slice.call(arguments); return function(res){ var dataset = new Dataset(); each(res.result, function(record, i){ var index = options[0] && options[0] === 'timeframe.end' ? record.timeframe.end : record.timeframe.start; dataset.set(['Result',...
[ "function parseInterval() {\n var options = Array.prototype.slice.call(arguments);\n return function (res) {\n var dataset = new Dataset().type('interval');\n Object(each[\"a\" /* each */])(res.result, function (record, i) {\n var index = options[0] && options[0] === 'timeframe.end' ? record.timeframe....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a new pie chart that is smaller when the screen size is reduced below 580 pixels
function resizePie() { var minNormalWidth = 580; if (window.innerWidth <= minNormalWidth) { // Remove the old pie chart and generate a new, resized one whenever the screen is resized when its size is below 580px $("#pieChart").find("svg").remove(); generatePieChart(); } }
[ "function updatePieChartDimensions() {\t\n\t$(\"#chart\").width($(document).width() - 430);\n\tvar dim = Math.min($(\"#chart\").width(), $(\"#chart\").height());\n\tdim = dim * 0.9;\n\t$(\"#chart-pie\").width(dim);\n\t$(\"#chart-pie\").height(dim);\n}", "function generatePieChart() {\n var pieChartOutline = {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the sector for the specified track and side.
findSectorInfo(track, side, sector) { for (const sectorInfo of this.sectorInfos) { if (!sectorInfo.isFree() && sectorInfo.track === track && sectorInfo.getSide() === side && (sector === undefined || sectorInfo.sector === sector)) { retu...
[ "function sector(cx, cy, r, startAngle, endAngle, params) {\n var x1 = cx + r * Math.cos(-startAngle * rad),\n x2 = cx + r * Math.cos(-endAngle * rad),\n y1 = cy + r * Math.sin(-startAngle * rad),\n y2 = cy + r * Math.sin(-endAngle * rad);\n return paper.path([\"M\", c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Macros call this method to apply the lambda to a series of provided values. This needs to have the macro's section passed in so that its JS code can be eval()'d in the correct scope.
apply(section, {loop:loopArg, 'with':withArg, making:makingArg, fail:failArg, pass:passArg, ignoreVia}) { /* We run the JS code of this lambda, inserting the arguments by adding them to a "tempVariables" object. The tempVariable references in the code are compiled to VarRefs for tempVariables. */ const...
[ "function jKarmaAddClosure(values, key, func) {\n\tfor(var i=0; i<values.length; i++) {\n\t\tvalues[i][key] = func(values[i]);\n\t}\n}", "function applyLambda(proc, args) {\n /*\n (eval-sequence\n (procedure-body procedure)\n (extend-environment\n (procedure-parameters procedure...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if a and b have an intersection. Also return true if a or b are undefined since this means we don't know what fields a node produces or depends on.
function fieldIntersection(a, b) { if (a === undefined || b === undefined) { return true; } return hasIntersection(prefixGenerator(a), prefixGenerator(b)); } // eslint-disable-next-line @typescript-eslint/ban-types
[ "function fieldIntersection(a, b) {\n if (a === undefined || b === undefined) {\n return true;\n }\n return hasIntersection(prefixGenerator(a), prefixGenerator(b));\n }", "function fieldIntersection(a, b) {\n if (a === undefined || b === undefined) {\n return true;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the current user IdToken which is used to make api calls
getUserIdToken() { return this.cognitoUser.getSignInUserSession().getIdToken().getJwtToken(); }
[ "async getTokenFromCurrentUser() {\n if (!auth.currentUser) {\n throw new Error('el usuario no esta loggeado.');\n }\n\n // obtengo el token\n const idTokenResult = await auth.currentUser.getIdTokenResult();\n\n // saco el token del resultado\n const { token } = idTokenResult;\n\n return t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorting of the vertices is needed so function is not called
function sortVertices(verticeA, verticeB, verticeC) { var arr = []; var v1 = {}; var v2 = {}; var v3 = {}; copyVertex(v1, verticeA) copyVertex(v2, verticeB) copyVertex(v3, verticeC) /* 1. Identify least x vertex and that is v1. if x is same then highest y. 2. Identify least y vertex in other 2. If same y th...
[ "function sort_vertices()\n {\n // Sort the vertices by height from smallest Y to largest Y.\n ngon.vertices.sort(vertexSorters.verticalAscending);\n\n const topVert = ngon.vertices[0];\n const bottomVert = ngon.vertices[ngon.vertices.length-1];\n\n leftVerts[numLeftVerts++] = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the body properties code for text. This method creating the XML code of the body properties of a text.
function createBodyProperties ( objOptions ) { var bodyProperties = '<a:bodyPr'; if ( objOptions && objOptions.bodyProp ) { // Set anchorPoints bottom, center or top: if ( objOptions.bodyProp.anchor ) { bodyProperties += ' anchor="' + objOptions.bodyProp.anchor + '"'; } // Endif. if ( objOptions.b...
[ "function genXmlTextBody(slideObj) {\n\t\t// FIRST: Shapes without text, etc. may be sent here during build, but have no text to render so return an empty string\n\t\tif ( !slideObj.options.isTableCell && (typeof slideObj.text === 'undefined' || slideObj.text == null) ) return '';\n\n\t\t// Create options if needed...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
output: the names in reverse, separated by a comma then a space split the names reverse the names join using ', ' as joiner
function swapName(names) { return names.split(' ').reverse().join(', '); }
[ "function list(names){\n names = names.map(e => e.name)\n if(names.length <= 1)return names.join()\n if(names.length === 2)return names.join(` & `)\n if(names.length > 2){\n let last = ` & ${names.pop()}`\n return names.join(\", \") + last\n }\n}", "function sortNames(str){\n const names = st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to set coordinates of random pitfalls in the table cells
function setPitfalls() { //local variables var randNum1 = 0; var randNum2 = 0; var randNum3 = 0; //set row- and col-values of pitfalls for (var j = 0; j < pitfall_col_val_array.length; j++) { randNum1 = (Math.floor(Math.random()*MAZE_HEIG...
[ "randomise(){\r\n for(let i = 0; i < this.rows; i++){\r\n for(let j = 0 ; j < this.cols; j++){\r\n this.cells[i][j] = random(-1, 1);\r\n }\r\n }\r\n }", "random_cell() {\n\t\t// TODO\n\t}", "function SetRandomStates() {\n let tmpRow;\n let tmpCol;\n let tmpState;\n for (let i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to collect all payouts per batch, read from the payoutfile It cycles through the paymentqueue and executes the myfunction, which is the function 'start' The actual payout transactions are done by the 'start' function In the start function transactions are delayed by timer 'transactiontimeout' (1000) The timeouta...
function getpayqueue (myfunction) { var payqueuearray = JSON.parse(fs.readFileSync(paymentqueuefile)); var backuppayqueue = fs.writeFileSync(paymentqueuefile+".bak",fs.readFileSync(paymentqueuefile)) //Create backup of queuefile var batchpaymentarray var cleanpayqueuearray = payqueuearray.filter(getnonemptybatches...
[ "function getpayqueue (myfunction) {\r\n\r\n\tvar payqueuearray = JSON.parse(fs.readFileSync(paymentqueuefile));\r\n\tjobs = payqueuearray.length\r\n\tvar backuppayqueue = fs.writeFileSync(paymentqueuefile+\".bak\",fs.readFileSync(paymentqueuefile))\t//Create backup of queuefile\r\n\tvar batchpaymentarray\r\n\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is actually a noop, but can be used to cast a mutable type to an immutable type and make TypeScript happy
function castImmutable(value) { return value; }
[ "function castImmutable(value) {\n return value;\n }", "function toImmutable(arg) {\n\t return (isImmutable(arg))\n\t ? arg\n\t : Immutable.fromJS(arg)\n\t}", "function toImmutable(arg) {\n\t\t return (isImmutable(arg))\n\t\t ? arg\n\t\t : Immutable.fromJS(arg)\n\t\t}", "markImmutable() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Activate element, alter animation name based on the index.
activate(oldIndex) { this.transitionName = this.index < oldIndex ? this.parent.vertical ? 'slide-down' : 'slide-next' : this.parent.vertical ? 'slide-up' : 'slide-prev'; }
[ "activate(oldIndex) {\n this.transitionName = this.index < oldIndex\n ? this.parent.vertical ? 'slide-down' : 'slide-next'\n : this.parent.vertical ? 'slide-up' : 'slide-prev'\n }", "activateSlide(index) {\r\n this.carouselState.slides = this.getCarouselItems...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns dictionary of the url (term > frequency) TODO
function parse(url, title) { title = title.split(/\W/g).filter(function(s){return s.length}); url = decodeURIComponent(url.replace(/\+/g, " ")); url = url.replace(/http:\/\//gi,"").replace(/https:\/\//gi,""); var parsed = title.concat(url.split(/\W/g)).filter(function(term) { ...
[ "function findMetaTags(url){\n let keywordsDict = {};\n urlMetadata(url).then(\n function (metadata) { \n // success handler\n for (let prop in metadata){\n var new_words = (keyword_extractor.extract(metadata[prop],{\n language:\"english\",\n remov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apply color to all objects
function set_color(){ for (var i=0; i<objects.length; i++){ if(i == diff) objects[i].style.background = trans_color; else objects[i].style.background = gener_color; } }
[ "function colorObjects(objectsArray,color){\n\tfor(var i=0;i<objectsArray.length;i++)\n\t{\n\t\t$(objectsArray[i][0]).css(objectsArray[i][1],color);\n\t}\n}", "function canvasObjColor() {\n\t\tvar color = this.value;\n\t\tvar activeObj = canvasEditor.getActiveObject();\n\t\tvar activeGrp = canvasEditor.getActiveG...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to update the search results for towns
function updateTowns(para) { //display the search results label var searchLabel = document.getElementById("search"); searchLabel.style.visibility = "visible"; //create list element var node = document.createElement("li"); //node.townObj = para; var textnode = document.createTextNode(para.getName()); node.append...
[ "function updateSearchResults(ourResult){\n\tvar _ourResult = ourResult;\n window.location.hash = 'k=' + _ourResult;\n SP.UI.Notify.addNotification(\"We searched for\" + _ourResult, false);\t \n}", "function doSearchUpdate() {\n\n /*\n * Grab the search query from the navbar search box.\n */\n var sea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Brothel,Location,CouplesMax,GroupsMax,CouplesPrice,GroupsPrice,Discount Crimson Citadel,Coventry,5,8,110,210,10 Ebony Woods,Erdington,10,26,90,160,8 Sapphire Suties,Sommerset,20,12,150,250,15 hotel constructor
function Hotel(name, location, couplesMax, groupsMax, couplesPrice, groupsPrice, discount) { // set object variables this.name = name; this.location = location; this.couplesMax = couplesMax; this.groupsMax = groupsMax; this.couplesPrice = couplesPrice; this.groupsPrice = groupsPrice; thi...
[ "constructor(country, area, highway, population, railway, laborF, unempR,\n birthR, deathR, lExpect, infMort, fertRate, aidsDeath, aidsLive,\n debt, infRate, importt, exportt, gdp,\n militDollar, militGDP,\n gasConsump, gasProd, gasExport, gasImport,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)
function OrdinaryGetOwnMetadata(MetadataKey, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); if (IsUndefined(metadataMap)) return undefined; return metadataMap.get(MetadataKey); }
[ "function OrdinaryGetOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return undefined$a;\n return metadataMap.get(MetadataKey);\n }", "function OrdinaryGetOwnMetadata(Metad...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ObjectTypeDefinition : Description? type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
parseObjectTypeDefinition() { const start = this._lexer.token; const description = this.parseDescription(); this.expectKeyword('type'); const name = this.parseName(); const interfaces = this.parseImplementsInterfaces(); const directives = this.parseConstDirectives(); const fields = this.pars...
[ "parseObjectTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('type');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Date: 7/14/2016 Last Updated: 7/26/2016 Version: 0.3.0 Description: An attempt at a basic drawing app using Canvas this defines objects
function CanvasPaintObjectFactory(owner) { var base = this; base.owner = owner; base.drawingObject = function(data, obj) { obj.tool = data.tool; obj.id = data.id; obj.order = data.order; obj.layer = data.layer; obj.erased = []; obj.genCanvas = function() { // add new canvas for the new object ...
[ "function CanvasBasicObject() { }", "function CanvasObj(canvas, x, y, size, color) {\n this.context = canvas.context;\n this.x = x;\n this.y = y;\n this.size = size;\n this.color = color;\n }", "function CanvasTool() {}", "function CanvasObject(canvasId) {\n this.canvasId = canv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This only applies to eventType === EVENT_TYPE_ATTACHED_VIRTUAL_IO
get ioMembers() { if (this.eventType !== HubAttachedMessage.EVENT_TYPE_ATTACHED_VIRTUAL_IO) { return []; } return [this.data[7], this.data[8]]; }
[ "attached() \n\t{\n\t\t//Increase attach counter\n\t\tthis.counter++;\n\t\t\n\t\t//If it is the first\n\t\tif (this.counter===1)\n\t\t\t/**\n\t\t\t* IncomingStreamTrack stopped event\n\t\t\t*\n\t\t\t* @name attached\n\t\t\t* @memberof IncomingStreamTrack\n\t\t\t* @kind event\n\t\t\t* @argument {IncomingStreamTrack}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
begin rct new functions creates a Pedersen commitment from an amount (in scalar form) and a mask C = bG + aH where b = mask, a = amount
function commit(amount, mask){ if (!valid_hex(mask) || mask.length !== 64 || !valid_hex(amount) || amount.length !== 64){ throw "invalid amount or mask!"; } var C = this.ge_double_scalarmult_base_vartime(amount, H, mask); return C; }
[ "function commit(amount, mask){\n if (!valid_hex(mask) || mask.length !== 64 || !valid_hex(amount) || amount.length !== 64){\n throw \"invalid amount or mask!\";\n }\n var C = ge_double_scalarmult_base_vartime(amount, H, mask);\n return C;\n}", "function commit(amount, mask){\n if (!vali...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Collapses the code region nearest the current cursor position. Nearest is found by searching from the current line and moving up the document until an opening codefolding region is found.
function collapseCurrent() { var editor = EditorManager.getFocusedEditor(); if (!editor) { return; } var cm = editor._codeMirror; var cursor = editor.getCursorPos(), i; // Move cursor up until a collapsible line is found for (i = cursor.line; i >= 0; i...
[ "function collapseCustomRegions() {\n var editor = EditorManager.getFocusedEditor();\n if (editor) {\n var cm = editor._codeMirror, i = cm.firstLine();\n while (i < cm.lastLine()) {\n var range = cm.foldCode(i, {rangeFinder: regionFold});\n if (range...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the sprite with an offset, allowing you to use any point not just top left as the control (position) point.
set_sprite_offset(x_offset, y_offset) { this.sprite.x_offset = x_offset; this.sprite.y_offset = y_offset; }
[ "draw(ctx, offset) {\n }", "draw() {\n sprite(this.spriteNumber, this.x, this.y)\n }", "set_sprite_offset_center() {\r\n this.sprite.x_offset = -(Math.round(this.sprite.width / 2));\r\n this.sprite.y_offset = -(Math.round(this.sprite.height / 2));\r\n }", "yLocation(offset)\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }