query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Calculate the value of checked and halfChecked keys. This should be only run in init or props changed.
function calcCheckedKeys(keys, props) { var checkable = props.checkable, children = props.children, checkStrictly = props.checkStrictly; if (!checkable || !keys) { return null; } // Convert keys to object format var keyProps = void 0; if (Array.isArray(keys)) { // [Legacy] Follow the ...
[ "function calcCheckedKeys(keys, props) {\n var checkable = props.checkable,\n children = props.children,\n checkStrictly = props.checkStrictly;\n\n\n if (!checkable || !keys) {\n return null;\n }\n\n // Convert keys to object format\n var keyProps = void 0;\n if (Array.isArray(keys)) {\n // [L...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
xInclude, Copyright 20042007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL
function xInclude(url1, url2, etc) { if (document.getElementById || document.all || document.layers) { // minimum dhtml support required var h, f, i, j, a, n, inc; for (var i=0; i<arguments.length; ++i) { // loop thru all the url arguments h = ''; // html (script or link element) to be written ...
[ "function xInclude(url1, url2, etc)\r\n{\r\n if (document.getElementById || document.all || document.layers) {\r\n var h, f;\r\n for (var i=0; i<arguments.length; ++i) {\r\n h = ''; // html to be written\r\n f = arguments[i].toLowerCase(); // lowercase file url\r\n // JS\r\n if (f.indexOf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Spills the entire bag onto the play field.
spill(logspill=true) { if (!this.stage) { console.error('@ BracketArrayExpr.spill: Array is not attached to a Stage.'); return; } else if (this.parent) { console.error('@ BracketArrayExpr.spill: Cannot spill array while it\'s inside of another expression.'); ...
[ "spill(logspill=true) {\n if (!this.stage) {\n console.error('@ BagExpr.spill: Bag is not attached to a Stage.');\n return;\n } else if (this.parent) {\n console.error('@ BagExpr.spill: Cannot spill a bag while it\\'s inside of another expression.');\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the given uaa credential has permisstion to access the appid.
function verifyPermission(appId,uaaCredential) { var deferred = Q.defer(); var cloudControllerUrl = process.env.cloudControllerUrl; if (!cloudControllerUrl) { var errMsg = "The system variable 'cloudControllerUrl' is missing."; ibmlogger.getLogger().error(errMsg); deferred.reject({code:Constant.MISSING_CLOUDC...
[ "async appMemberRequired(ctx, next) {\n const { service: { mysql } } = ctx;\n const user = ctx.user;\n const appId = ctx.query.appId || ctx.request.body.appId;\n const auth = await checkUserAppAuth(mysql, user, appId);\n if (auth) {\n await next();\n } else {\n ctx.body =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the token from asyncstorage
async getToken() { try { const token = await AsyncStorage.getItem('token'); console.log(`DEBUG: token found: ${token}`); return token; } catch (e) { console.log(`DEBUG: Failed to get id: ${e}`); } }
[ "async getToken() {\n try {\n let token = await AsyncStorage.getItem(ACCESS_TOKEN);\n console.log(\"The stored access token is \" + token);\n }\n catch(error) {\n console.log(\"Error! Something went terribly wrong when retrieve the access token.\");\n }\n }", "function getToken() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transform the VPR Allergy record into a SOLR allergy record. vprRecord: The record in VPR format. log: A logger to use to log messages.
function transformRecord(vprRecord, log) { log.debug('solr-allergy-xform.transformRecord: Entered method. vprRecord: %j', vprRecord); if (!_.isObject(vprRecord)) { return null; } var solrRecord = {}; solrXformUtil.setCommonFields(solrRecord, vprRecord); setDomainSpecificFields(solrRe...
[ "function transformRecord(vprRecord, log) {\n log.debug('solr-visit-xform.transformRecord: Entered method. vprRecord: %j', vprRecord);\n\n if (!_.isObject(vprRecord)) {\n return null;\n }\n\n var solrRecord = {};\n\n // A visit - is identical in structure to appointment.\n //--------------...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expand `fieldSpecs` property. This will mutate the object itself.
expand(modules, parameterMappings) { if (parameterMappings.length) { return unimpl_1.unimpl(); } this.fieldSpecs = this.fieldSpecs .map((fieldSpec) => lodash_1.cloneDeep(fieldSpec).expand(modules, parameterMappings)); return this; }
[ "function updateFields(fieldSpec, paths, fields) {\n\treturn _.reduce(_.zip(paths, fields), (acc, [path, field]) =>\n\t\t\t\t_.assocIn(acc, [...path, 'fields'], field),\n\t\t\tfieldSpec);\n}", "visitFieldSpec(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function extendSpecs(specs, path) {\n var fold =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
10. Shipping Calculator You work for an online clothing retailer. Every time an order ships, your company needs to calculate the cost of shipping so they can charge the customer correctly. Because they need to make this calculation so many times and in so many places, they've asked you to write a function that calculat...
function shipCost(weight, distance, isOversized){ var cost = 0; if(isOversized === true){ cost = weight * distance / 100 + 10 }else{ cost = weight * distance / 100 } return cost }
[ "function calc() {\n\n//get the weight from the textbox\n let weight = parseFloat(document.getElementById(\"weight\").value);\n console.log(weight);\n\n //validate, if it is 0 or less then alert an error message\n if (isNaN(weight) || weight < 0) {\n //if determined to be negative or not a number...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init canvas dimensions based on level
initCanvas() { this.canvas = document.getElementById("canvas"); this.canvas.width = this.level.getNumBlocksRow * Block.SIZE + (2 * Sprite.SIDE_LR_WIDTH); this.canvas.height = this.level.getNumBlocksColumn * Block.SIZE + (3 * Sprite.SIDE_TMD_HEIGHT) + Sprite.PANEL_HEIGHT; this.ctx = this.canvas.getContext("2d")...
[ "function setCanvasDimensions()\r\n{\r\n\t\r\n\t//data.boardWidth = Math.floor(viewport().width / data.pieceWidth);\r\n\t//data.boardHeight = Math.floor(viewport().height / data.pieceHeight);\r\n\t\r\n\t//data.pieceWidth = Math.floor(document.body.clientWidth / data.boardWidth);\r\n\t//data.pieceHeight = Math.floor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
make all fields of the obj disabled/enabled. "dis" will be true or false.
function fields_disabled(obj, dis) { var i=0; for(i=0; i<obj.length; i++) { eval("obj["+i+"].disabled="+dis); } }
[ "function disableAll(obj) {\n\tObject.keys(obj).map(each => {\n\t\tobj[each] = false\n\t})\n}", "_toggleEnabled(enabled=null) {\n const all = this.formElements.all\n const allKeys = Object.keys(all)\n if (enabled) {\n allKeys.forEach(k => all[k].disabled = false)\n } else if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new native combiner for the native function.
function lisp_make_native(native_fun, min_args, max_args) { lisp_assert(lisp_is_native_function(native_fun)); var cmb = lisp_make_instance(Lisp_Native_Combiner); cmb.lisp_native_fun = native_fun; cmb.lisp_min_args = min_args; cmb.lisp_max_args = max_args; return cmb; }
[ "function lisp_make_wrapped_native(native_fun, min_args, max_args) {\n return lisp_wrap(lisp_make_native(native_fun, min_args, max_args));\n}", "function defineNativeMethodsOnChainable() {\n\n var nativeTokens = {\n 'Function': 'apply,call',\n 'RegExp': 'compile,exec,test',\n 'Number': 't...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setUpTableCardView(), Shows the Loose cards on the table
setupTableCardView(table, move, humanTurn) { // Get the Table Card View var tableCardView = document.getElementById("tableView"); // Clear all the images from the view while (tableCardView.hasChildNodes()) { tableCardView.removeChild(tableCardView.lastChild); } var cardSelected; var tableCardViews; ...
[ "function setupTableSpread(cards) {\n return;\n}", "function init(){\n table = document.getElementById(\"cardTable\");\n // we should grab all cards from server and add to array here\n // for (var i = 0; i < data.length; i++){\n // we are convert data from database to class and add them to ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Next step : component with form or json upload to create new quiz Component not implemented yet but API endpoint working Unused component but will implement it later for next version
function QuizCreate() { useEffect(() => { // POST method to create new quiz creation : new form and page to implement axios.post('https://otakuiz.herokuapp.com/quiz/create', { quizCategory : { "quizName": "Fullmetal alchemist", "quizLabel": "code-geass", "caption": "Prêt à d...
[ "createQuiz(body) {\n this.setMethod('POST');\n this.setBody(body);\n this.setAuth();\n return this.getApiResult(`${Config.QUIZ_API}/new`);\n }", "createQuiz() {\n console.log(\"udjem ovde\");\n let answers = this.props.answers;\n let questions = this.props.questions;\n le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Locates a closing bracket "]" in the program and sets the pointer to the command after that bracket. If no matching closing bracket is found, kill execution TODO: look into making this more efficient if possible
function jumpToClosingBracket() { var depth = 1; var openingBracketPosition = pointerAddress; pointerAddress += 1; while(pointerAddress < instructions.length) { switch(instructions[pointerAddress]) { case "[": depth += 1; break; case "]": depth -= 1; if(depth ==...
[ "function jumpToOpeningBracket() {\n\t\t\t\n\t\t\tvar depth = 1;\n\t\t\tvar closingBracketPosition = pointerAddress;\n\t\t\tpointerAddress -= 1;\n\t\t\twhile(pointerAddress >= 0) {\t\t\t\t\t\n\t\t\t\tswitch(instructions[pointerAddress]) {\n\t\t\t\t\tcase \"]\":\n\t\t\t\t\t\tdepth += 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches listeners to Firebase which track when new geohashes are added within this query's bounding box.
function _listenForNewGeohashes() { // Get the list of geohashes to query var geohashesToQuery = geohashQueries(_center, _radius*1000).map(_queryToString); // Filter out duplicate geohashes geohashesToQuery = geohashesToQuery.filter(function(geohash, i){ return geohashesToQuery.indexOf(geohash) =...
[ "function startDatabaseQuery() {\n geoQuery = geoFire.query({\n center: [curLat, curLng],\n radius: searchRadius\n });\n var onKeyEnteredRegistration = geoQuery.on(\"key_entered\", function(key, location) {\n var eventRef = firebase.database().ref('events/' + key);\n eventRef.on('value', function(s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this extracts the "text" field from the msg and sends it to Slack
function relay(msg) { var text; // parse the msg so we can grab the "text" key's value -- fortunately this value is consistent across all (current) TFS messages try { text = JSON.parse(JSON.stringify(msg)).message.text; } catch(err) { return; } // send it to Slack requestify.post(url, { chan...
[ "myMsgsSlack(msg) {\n if (msg.user == this.receiver) {\n msg.position = \"left\";\n } else {\n msg.position = \"right\";\n }\n msg.type = \"text\";\n msg.date = parseInt(msg.ts) * 1000;\n msg.text = msg.text;\n return msg;\n }", "function getDataText() {\n var text_input = botTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the encoding used for the control socket. See for what encodings are supported by Node.
set encoding(encoding) { this._encoding = encoding; if (this.socket) { this.socket.setEncoding(encoding); } }
[ "set encoding(encoding) {\n this._encoding = encoding;\n if (this.socket) {\n this.socket.setEncoding(encoding);\n }\n }", "function setEncoding() {\n var source = new events.EventEmitter();\n var valve = new Valve(source);\n var coll = new EventCollector();\n\n coll.listenA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dispatching 'insert Sound' in order to insert the selected sound into the array receiving the object of the selected sound to be played
insertSound({commit}, data){ commit('insertActiveSound', data) }
[ "addSound( name, sound ){\n this.sounds.push( [name, new Sound( sound )] );\n }", "addSound(sound) {\n let dateNow = new Date();\n if (this.lastSoundDate) {\n sound.delay = dateNow - this.lastSoundDate\n }\n this.lastSoundDate = dateNow\n this.sounds.push(so...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All things returned from this function will end up as props on the BandList container. We need this so we can call the selectBand function above through this.props.selectBand That will start the action >> reducer >> state change process
function mapDispatchToProps (dispatch) { // Whenever selectBand is called, this will pass the result to ALL of our reducers return bindActionCreators({ selectBand: selectBand }, dispatch) }
[ "function mapStateToProps (state) {\n return {\n bands: state.bands\n }\n}", "function mapStateToProps(state){\n\treturn{\n\t\tbands: state.bands\n\t};\n}", "fetchBandNames() {\n this.setState({ loading: true, error: null });\n this.rasterService.getBandNames()\n // We merge the band names with ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the position to the last data row. It respects any active filter.
Last() { if (this.CanLast()) { this.Position = this.fRows.length - 1; } }
[ "last() {\n this._focusRowByIndex(this._collection.rawEntity.entities.length - 1);\n }", "last(){this._focusRowByIndex(this._collection.rawEntity.entities.length-1)}", "goLast() {\n\n this.offset = this.dataCount - ( this.dataCount % this.pageSize );\n this.nextBool = false;\n this.prev...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate total of basket
function calculateTotal(){ let basketTotalContainer = document.querySelector('#basket-total'); let basketCount = document.querySelector('#basket-count'); let minibasketTotal = document.querySelector('#mini-basket-total'); basketTotalContainer.innerHTML = ''; basketCount.innerHTML = ''; minibasketTotal.inner...
[ "getTotal() {\n\t\t\tlet itemCount = this.getItemCount(),\n\t\t\t\t\ttotal = 0;\n\n\t\t\twhile(itemCount--) {\n\t\t\t\ttotal += basket[itemCount].price;\n\t\t\t}\n\t\t\treturn total;\n\t\t}", "function getTotal() {\n\n let itemCount = this.getItemCount(), total = 0;\n\n while (itemCount--) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an object with the answers to insert into the document, then it calls the API and tells the API which sheet and which row to add the object corresponds to a row. Returns the inserted row
async function addRow(answers) { const rowToAdd = { date: moment().format("DD/MM YYYY"), task: answers.task, game: answers.game, hours: answers.hours }; try { return doc.addRowAsync(SPREADSHEET_SHEET, rowToAdd); } catch (e) { console.log("Add row error", e); } }
[ "function createRow(sheet, data) {\n var vals = getSheetValues(sheet),\n ret = data;\n\n // Iterate the id of the returned data by one\n ret._id = ++vals.length;\n saveRow(sheet, ret);\n return ret;\n}", "insertRow(data) {\n this.sheet.insertRowBefore(this.firstRow);\n this.updateRow(this.firstRow, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process stat rows from the recent and season queries 'rows' are the query results 'mode' values: recent, season
function processRows(rows, mode) { // Cast Postgres SUMs as ints, and calculate score-adjusted corsi // Separate team and skater rows var teamRows = []; var skaterRows = []; rows.forEach(function(r) { ["toi", "ig", "is", "ic", "ia1", "ia2", "gf", "ga", "sf", "sa", "cf", "ca", "cf_off", "ca_off"].forEach(f...
[ "function queryStats(mode) {\n\t\tvar limit;\n\t\tif (mode === \"recent\") {\n\t\t\tlimit = \"LIMIT 10\";\n\t\t} else if (mode === \"season\") {\n\t\t\tlimit = \"\";\n\t\t}\n\t\tvar queryStr = \"SELECT stats.*, positions.first, positions.last, positions.positions, positions.game_ids\"\n\t\t\t+ \" FROM (\"\n\t\t\t+ ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialization Shorthand selector for DOM elements that belong to the boxplus namespace.
function _selector(name, ancestor) { return $('.' + BOXPLUS + '-' + name, ancestor); }
[ "function createBoxSelector() {\n boxselector = new wax.mm.boxselector();\n boxselector.map(map);\n boxselector.add();\n boxselector.addCallback('change', onBoxChange);\n boxselector.enable();\n}", "function initSelector(elm, soname, soinit, req)\r\n {\r\n return initSelectorExt(\r\n e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GenericController : getSchemaRecords Checked for schema previlege if error no records send
function checkAndGetSchemaRecords(request,callback){ var hostname=request.headers.host.split(":")[0]; var cloudPointHostId=(ContentServer.getConfigDetails(hostname))?ContentServer.getConfigDetails(hostname).cloudPointHostId:undefined; var data=urlParser.getRequestBody(request); data.schemaRoleOnOrg={}; data.cloudP...
[ "function getPArecords(req,res,next){\n\n}", "function getFields0(req, res) {\ntry {\n if (req.params.id) {\n var CollectionTable = require('../models/' + req.params.id);\n if (CollectionTable) {\n var columnFields = CollectionTable.schema.tree;\n ['id', '__t', '_id', 'isAct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Processes HELP. Responds with url to RFC
handler_HELP(command, callback) { this.send(214, 'See https://tools.ietf.org/html/rfc5321 for details'); callback(); }
[ "function clickedHelp() {\n ICEUtils.displayHelp(args.helpID);\n}", "function cmd_Help() {\n\t\t\n\t}", "function displayHelp() {\n ICEUtils.displayHelp(helpID);\n}", "getHelp() {\n if (this.bot.getHelp) {\n listener.relay('_send', this.bid + '|' +\n JSON.stringify(this.bot.getHelp(this.store...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function enumerates all aliases for bidder adapters and defines them in prebid.js. bidderAliases is array of object each of them defines pair of alias/bidder. bc_pbjs is prebid.js instance.
function specifyBidderAliases(bidderAliases, bc_pbjs) { if (bidderAliases && Array.isArray(bidderAliases) && bidderAliases.length > 0) { for (var i = 0; i < bidderAliases.length; i++) { if (bidderAliases[i].bidderName && bidderAliases[i].name) { // defines alias for bidder adapter in prebid.js bc_pbjs.ali...
[ "function specifyBidderAliases (bidderAliases, bc_pbjs) {\n\tif (bidderAliases && Array.isArray(bidderAliases) && bidderAliases.length > 0) {\n\t\tfor (var i = 0; i < bidderAliases.length; i++) {\n\t\t\tif (bidderAliases[i].bidderName && bidderAliases[i].name) {\n\t\t\t\t// defines alias for bidder adapter in prebi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create HTML to display display expected destination amount
function displayDestAmount() { destAmountHTML.value = destAmount; }
[ "function displayExchangeRate() {\n // Calc expected Rate in ETH not Wei\n expectedRateEth = expectedRate / (10 ** 18);\n // Calcualte user Exchange rate\n expectedRateHTML.innerText = `1 ${srcSymbol} = ${expectedRateEth} ${destSymbol}`;\n // expectedRate / (10 ** 18)\n}", "function calcCostOfHtml (htmlQ) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function mainCanvasApp calls the stockMarket.place() method. This sets up the main Canvas.
function mainCanvasApp(){ BD18.stockMarket.place(); }
[ "function mainCanvasApp(){\n BD18.hideMapItems = false;\n BD18.gameBoard.place();\n if (BD18.boardTiles.length === 0) {\n return;\n }\n var tile;\n for(var i=0;i<BD18.boardTiles.length;i++) {\n if (!(i in BD18.boardTiles)) {\n continue;\n }\n tile = BD18.boardTiles[i];\n tile.place();\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Response schemas are models with the following (optional) properties: content the content of the response statusCode headers contentType
function responseShapeFromResponse(responses, responseType, defaultStatusCode) { const headers = []; const contentProp = responseType.properties.get('content'); if (!contentProp) { throw new Error('need content in response'); } const statusCode = responseType.properties.has('statusCode') ? responseTy...
[ "getSupportedResponseContentTypes() {}", "function getResponseSchemaAndNames(path, method, oas, data, options) {\n const endpoint = oas.paths[path][method];\n const statusCode = getResponseStatusCode(path, method, oas, data);\n if (!statusCode) {\n return {};\n }\n let { responseContentType,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints the package version.
function version() { var msg = pkg.version.toString()+'\n'; process.stdout.write( msg, 'utf8' ); process.exit( 0 ); }
[ "function showVersion () {\n var pkg = require(\"./package.json\");\n console.log(pkg.version);\n process.exit(0);\n}", "function outputVersion () {\n fs.readFile(path.join(__dirname, '/../package.json'), function (err, data) {\n if (err) {\n console.log(err.toString())\n } else {\n const pkg ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
User must be owner of user profile. The request parameter "username" must match req.user.username
function userIsOwner(req, res, next) { if (req.user && req.params.username === req.user.username) return next(); next(new ExpressError('Unauthorized', 401)); }
[ "function profileOwner(req, res, next) {\n if (req.params.username === req.session.user.name.username) {\n next();\n } else {\n next(new HttpError(403));\n }\n}", "function checkOwner (req) {\n return req.user.nim === req.object.nim;\n}", "function validateOwner(req, requestedOwner) {\n const reque...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`hasData` for a relationship is a flag to indicate if we consider the content of this relationship "known". Snapshots uses this to tell the difference between unknown (`undefined`) or empty (`null`). The reason for this is that we wouldn't want to serialize unknown relationships as `null` as that might overwrite remote...
setHasData(value) { this.hasData = value; }
[ "push(payload, initial) {\n var hasRelationshipDataProperty = false;\n var hasLink = false;\n\n if (payload.meta) {\n this.updateMeta(payload.meta);\n }\n\n if (payload.data !== undefined) {\n hasRelationshipDataProperty = true;\n this.updateData(payload.data, initial);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pjaxGoTo uses GitHub's existing PJAX to navigate to a URL. It is faster than a hard page reload.
function pjaxGoTo(url, sameRepo) { if (!sameRepo) { window.location.href = url; return; } const e = document.createElement("a"); e.href = url; if (sameRepo) e.dataset.pjax = "#js-repo-pjax-container"; if (sameRepo) e.classList.add("js-navigation-open"); document.body.appendChild(e); e.click(); setTimeout(...
[ "function navigateTo(url) {\n\tlog('Navigating to ' + url);\n\n\tpage.open(url);\n}", "static jumpTo(url) {\n window.location.href = url;\n }", "function navigateTo() {\n\tif (LOGGING) console.log(\"navigateTo\");\n\tHISTORY.push(curTab.curPage);\n\tpage(curTab.curPage);\n}", "function gotoPageWithH...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fire amplify event for entering or exiting a breakpoint Accepts: a valid breakpoint name (string) and a boolean to specify enter or exit event Amplify will provide the current breakpoint and current state within the callback Possible events: onEnterDesktop, onExitDesktop, onEnterTablet, onExitTablet, onEnterMobile, onE...
function publishEvent(bp, state){ bp = bp.toLowerCase().charAt(0).toUpperCase() + bp.slice(1); // convert breakpoint to correct capitalization if( typeof amplify === 'object' && typeof amplify.publish === 'function' ){ amplify.publish('fxcm.device.on' + state + bp, {breakpoint: bp, state: state}); } return t...
[ "function breakpointChange() {\n // this function will communicate with our reducer\n this.dispatchActiveQuery()\n }", "function breakpointChange () {\n this.dispatchActiveQuery()\n }", "function updateBreakpointEvent() {\n if (debugMode) {\n Blockly.getMainWorks...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide the loader from DOM
function hideLoader() { loader.style.display = "none"; }
[ "function hideLoader(){\n loaderEl.style.display = \"none\";\n}", "function hideLoader() {\n $loading.hide();\n}", "hide() {\n this.loadingContainer_.style.setProperty('display', 'none', 'important');\n }", "function hideLoader() {\n\t\t$('#itemsWrapper #loader').remove();\n\t}", "hideLoader() {\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use when user want to get old message ...
function getOldMessage(roomId, limit, before) { }
[ "function checkMessagesOld() {\n let messageOld = JSON.parse(leerMessages());\n if (messageOld !== -1) {\n messages.push.apply(messages, messageOld);\n }\n}", "function getOldMessage(fid,except) {\r\n var gOldApi = new XMLHttpRequest();\r\n gOldApi.open(\"GET\", API_URL+\"/getOldMessage?fid=\"+fid+\"&...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ZM: Validator for date_of_death
function dateValidator(value) { // `this` is the mongoose document console.log('dateValidator:', this.date_of_birth, value) if( this.date_of_birth && value) { return this.date_of_birth < value; } else { return this.date_of_birth? true: false; // Only Death Date is invalid. } }
[ "function dateValidation(input) {\n if(!DateValidation.isDate(input)) {\n return SURVEY_CLIENT.MESSAGES.INVALID_DATE;\n }\n\n return null;\n}", "function dateValidation() {\n if (!leapYear()) {invalidDates.push(\"0229\")}; \n\n for (let i=0; i<invalidDates.length ;i++) {\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds the tool bar HTML
function _buildToolBar(){ var i, len = tools.length, tool=""; for(i=0; i < len;i+=1) { tool += "<li data-toggle='tooltip' data-placement='right' data-original-title='" + tools[i] + "' class='sprite " + tools[i] + "'></li>"; } return "<ul class='toolbar'>" + tool + "</ul>"; }
[ "function createToolBar(){\n\t\tvar i, \n\t\tlen = tools.length,\n\t\ttool=\"\";\n\t\tfor(i=0; i < len;i+=1) {\n\t\t\ttool += \"<li data-toggle='tooltip' data-placement='right' data-original-title='\" + tools[i] + \"' class='sprite \" + tools[i] + \"'></li>\"; \n\t\t}\n\t\t\n\t\treturn \"<ul class='toolbar'>\" + t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Connect handler: once the MQTT client has successfully connected to the MQTT broker it subscribes to the deviceTopic.
function mqttClientConnectHandler() { console.log('connected to MQTT server'); mqttClient.subscribe(deviceTopic); console.log("subscribed to", deviceTopic); }
[ "function mqttClientConnectHandler() {\n console.log('connected to MQTT server');\n mqttClient.subscribe(rawTopic);\n console.log(\"subscribed to\", rawTopic);\n mqttClient.subscribe(statusTopic);\n console.log(\"subscribed to\", statusTopic);\n }", "function onConnect() {\n // Once a conne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend selection to paragraph end.
extendToParagraphEnd() { if (isNullOrUndefined(this.start)) { return; } this.end.moveToParagraphEndInternal(this, true); this.upDownSelectionLength = this.end.location.x; this.fireSelectionChanged(true); }
[ "moveToParagraphEnd() {\n if (this.isForward) {\n this.start.moveToParagraphEndInternal(this, false);\n this.end.setPositionInternal(this.start);\n this.upDownSelectionLength = this.end.location.x;\n }\n else {\n this.end.moveToParagraphEndInternal(th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define las bases de Bernstein de la curva
setBasis(){ var B0 = function(u) { return (1-u)*(1-u);} var B1 = function(u) { return 2*(1-u)*u; } var B2 = function(u) { return u*u;} this.basis = [B0, B1, B2]; }
[ "function bernstein(u, i, n){\n let x = comb(n, i);\n let y = Math.pow(u, i);\n let p1 = (1 - u);\n let p2 = (n - i);\n let z = Math.pow(p1, p2); \n let k = x * y * z\n return k;\n\n}", "setBasis(){\n var B0 = function(u){ return (1-u)*(1-u)*(1-u);}\n var B1 = function(u){ ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize popup filter value fields ==========================================================================================
function initializeFilterValues() { // Get our current column filter property var filter = properties.activeColumn.enhancedTable.filter; // Get our value contentItems var valueContentItems = []; valueContentItems.push(properties.screen.findContentItem(proper...
[ "function initializeFilterValues() {\n\n // Get our current column filter property\n var filter = properties.activeColumn.enhancedTable.filter;\n\n // Get our value contentItems\n var valueContentItems = [];\n valueConten...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to normalize (lowercase data)
function normalizer(toBeNormalized){ return toBeNormalized.toLowerCase(); }
[ "function lowercase(input) {}", "function fx_Lower(data)\n{\n\t//if the data is a valid string lower case it\n\treturn !String_IsNullOrWhiteSpace(data) ? (\"\" + data).toLowerCase() : \"\";\n}", "function normalize(s) {\n return removeAccents(s).toLowerCase();\n}", "function normalizeToLower(text){\n//we do ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the browser mouseDown event and adds the pressed button to the activeCommands list.
mouseDown(event) { var button = event.which || event.button; this.activeCommands[button] = true; }
[ "keyDown(event) {\n var keyCode = event.which || event.keyCode;\n this.activeCommands[keyCode] = true;\n }", "static _HandleButtonDown(e) {\n if (!Mouse._button_down.includes(e.button))\n Mouse._button_down.push(e.button)\n }", "function mouseDown(event) {\n mousePressed = true;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
changeColor: change the color of the shapes accordingly with the tmp_arr passed as input
function changeColor(tmp_stage,tmp_arr){ tmp_arr.forEach(function (item) { tmp_stage.find("#" + item[0]).fill(DICT_COLORS[item[1]]); tmp_stage.find("#main_l").draw(); }); }
[ "function setColor(arr){\n arr.splice(3, 0)\n for(let i = 0; i < arr.length; i++){\n if(arr[i] == 'blue'){\n arr[i] = '#4D4DFF'\n }\n }\n background(arr[0], arr[1], arr[2])\n }", "change_color(index, value) {\n\t\tc_array[index] = value;\n\t\tthis.update_palette();\n\t\tfor (var spri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initialize the sessionResult array
function initSessionResult () { for (var i = 0; i < results.length; i++) { sessionResult.push(0); } }
[ "initializeResultsArray() {\n\t\t// Can be run only after this.checkpoints are initialized\n\t\tthis.checkpoints.forEach((cp, cp_i) => {\n\t\t\tthis.runResults[cp_i] = [];\n\t\t\tcp.testCases.forEach((testcase, tc_i) => {\n\t\t\t\tthis.runResults[cp_i][tc_i] = [];\n\t\t\t});\n\t\t});\n\t}", "function initializeSe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save a list of sources to storage.
function saveSources(sourcesToSave, callback) { if (sourcesToSave == null) return; for (let i in sourcesToSave) { sourcesToSave[i].consumerId = store.state.profileId; sourcesToSave[i].generatedBy = 'auto'; } idb.addSources({ sources: sourcesToSave, }); try { callback(); } catch (err) { ...
[ "function clientSave() {\n\n u.each(sources, function(source) {\n\n var dirtyFiles = u.filter(source.files, function(file) {\n if (file._dirty) { // 1 means unsaved, 2 means saving\n file._dirty = 2; // side effect of filter\n return true;\n }\n return false;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show message in alert bar. Default behavior is override exist message. If "isAppend" is true, will append new message under exists.
function showAlertBar(alertSelector, message, /* boolean */isAppend) { var $alertBox = $(alertSelector); // the alert bar maybe not exist since user click close button of alert bar will remove it from dom tree, we will try to // init them again. if ($alertBox.length == 0) { initAlertBar(); $alertBox = $(a...
[ "function showAlert(alertMessage){\n $(\"#myAlert\").css(\"display\",\"block\").html(\"<b>\"+alertMessage+\"</b>\");\n }", "function showMessage(type, message) {\n var parent;\n if (type === 'error') {\n parent = $('.alert_innner > .alert_box.save_red');\n message = '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disposes all level tiles to restart the level
disposeAll() { let tilesBlocks = this.scene.getMeshesByTags('tilesBlock'); for (let index = 0; index < tilesBlocks.length; index++) { tilesBlocks[index].dispose(); } }
[ "disposeTiles() {\n this.m_disposedTiles.forEach(tile => {\n tile.dispose();\n });\n this.m_disposedTiles.length = 0;\n }", "disposeAll() {\n let tilesBlocks = this.scene.getMeshesByTags('tilesBlock');\n\n for(var index = 0; index < tilesBlocks.length; index++) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to fill the contact fields.
fillContactFields(contactData) { this.fillContactWithAllFieldsAndSave(this.contactInformation, contactData); }
[ "function fillRecipientField()\r\n {\r\n var recipients = $a(\".doc-recipient\");\r\n for(var i =0; i < recipients.length; i++)\r\n $a(recipients[i]).html(\"PARA: \" + $a(\"#form-doc\\\\:setores\" ).val());\r\n }", "function _init_client_contact_field() {\n\t\t\ttry {\n\t\t\t\t_curre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
throw an error if the preprocessor was not registered
function preprocessorNameNotFoundError(name) { panic$1(`No preprocessor named "${name}" was found, are you sure you have registered it?'`); }
[ "function preprocessorTypeError(type){panic$1(`No preprocessor of type \"${type}\" was found, please make sure to use one of these: 'javascript', 'css' or 'template'`);}// throw an error if the preprocessor was not registered", "function preprocessorTypeError(type){panic$2(`No preprocessor of type \"${type}\" was...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I send a tweet. i need: args.status (the text) args.image (url of an image) and that's all I'm supported for now! Note, unlike getTweets which can get by with less access, for this you need user auth as documented here:
function main(args) { return new Promise( (resolve, reject) => { let client = new Twitter({ consumer_key:args.consumer_key, consumer_secret:args.consumer_secret, access_token_key:args.access_token_key, access_token_secret:args.access_token_secret }); /* Special branching for images. Since images...
[ "function tweetIt(txt) {\n\n\tvar tweet = {\n\t\tstatus: txt\n\t}\n\tT.post('statuses/update', tweet, tweeted);\n\n}", "function tweetIt(txt){\n T.post('statuses/update', { status: txt }, function(err, data, response) {\n })\n}", "function tweet(str, url)\r\n {\r\n var status = { status: str };\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add the metadata values from the groovebox var into the userinterface
function applyMetadata() { // get metadata values var metadata = groovebox["metadata"]; // get the current audio file name var currentAudioFile = $(".track-info").attr("file"); // check if the (new) metadata is different than the currently playing song if (gr...
[ "function MetadataDialog(ui, cell)\n{\n\tvar div = document.createElement('div');\n\n\tdiv.style.height = '310px';\n\tdiv.style.overflow = 'auto';\n\t\n\tvar value = ui.editor.graph.getModel().getValue(cell);\n\t\n\t// Converts the value to an XML node\n\tif (!mxUtils.isNode(value))\n\t{\n\t\tvar doc = mxUtils.crea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UPDATE INITIALIZATION TIME OF ALL ITEM
function UpdateTimeInitAllItem() { for (var i = 0, len = tw.animate.length; i < len; i++) { // Update initialization time for each object var dataCur = tw['animate'][i]['data']; dataCur.tsInit = tw.tsInit; } }
[ "function UpdateTimeInitAllItem() {\n\n for( var i = 0, len = tw.animate.length; i < len; i++ ) {\n\n // Update initialization time for each object\n var dataCur = tw['animate'][i]['data'];\n dataCur.tsInit = tw.tsInit;\n }\n }", "applyInit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sort marker arrays by ID, alphabetically
function sortMarkers(array, key) { return array.sort(function(a, b) { var x = a.feature[key]; var y = b.feature[key]; return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }); }
[ "function sortMarkDataAsc(col,id){\n var length = initData.length;\n var data=cloneArray(initData);\n var marks=data.splice(0,length-4);\n var footers=data;\n marks=marks.sort( function( a, b ){\n // Sort by the 2nd value in each array\n var num1=correctValue(a[col]);\n var num2=correctValue(b[col]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a property from storage or entire storage if no property provided
function deleteStorage(property) { return new Deferred( createPromisefunction('delete', { 'property': property, 'value': null }) ); }
[ "deleteProperty(property) {\n this.controller.service(\"data\").delete(`${this.pointer}/${property}`);\n }", "function delete_property(prop) {\n var q = {\n guid: prop.guid,\n key: {value: prop.key.value, namespace: prop.key.namespace, connect: \"delete\"},\n type: {id: \"/type/property\", con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end function for select/deselectAll toggle. / NAME: setLineDefaultAllSelected DESCRIPTION: function called ARGUMENTS TAKEN: none ARGUMENTS RETURNED: none CALLED FROM: CALLS:
function setLineDefaultAllSelected() { $("#line-selectpicker-ethnicities").selectpicker("selectAll"); $("#line-selectpicker-ageBands").selectpicker("selectAll"); $("#line-selectpicker-genders").selectpicker("selectAll"); $("#line-selectpicker-nationalities").selectpicker("selectAll"); $("#line-selectpick...
[ "function resetSelectedLine() {\n gMeme.selectedLineIdx = 0\n}", "function selectAllLines(collectionId) {\n jq(\"#\" + collectionId + \"_div\" + \" input:checkbox.kr-select-line\").attr('checked', true);\n}", "function deselectAllLines(collectionId) {\n jq(\"#\" + collectionId + \"_div\" + \" input:che...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the d3 simulation of the forcedirected graph. Nodes and links must be added before calling this function.
createSimulation() { // Create a new simulation containing the nodes. this.simulation = d3.forceSimulation(this.nodes_data); // Add a charge to each node and a centering force. const _this = this; this.simulation .force("charge", d3.forceManyBody() .strength(function (d) { r...
[ "createSimulation() {\n // Create a new simulation containing the nodes.\n this.simulation = d3.forceSimulation(this.nodesData);\n\n // Add a charge to each node and a centering force.\n this.simulation\n .force('charge', d3.forceManyBody()\n .strength((d) => {\n return d.index < th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load an utterance from XML data (version 0.3)
function loadUIsolated(utt) { /* main orthographic line */ var utts = $(utt); /* user and time information */ var ts = checknumber(timelineRef(utts.attr("start"))); var te = checknumber(timelineRef(utts.attr("end"))); var loc = checkstring(utts.attr("who")); if (loc !== '') trjs.data.codesdata[loc] = true; /...
[ "function loadEtas() {\r\n\trequestXML(etaUrl, iterateEtaXML, showStatus);\r\n}", "function loadXMLToArray(url) {\n let xml = new XMLHttpRequest();\n xml.open(\"get\", url, false);\n xml.send(null);\n xmlDoc = xml.responseXML;\n let elements = xmlDoc.getElementsByTagName(\"object\");\n console.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a web friendly URL slug from a string. Requires XRegExp ( with unicode addons for UTF8 support. Although supported, transliteration is discouraged because 1) most web browsers support UTF8 characters in URLs 2) transliteration causes a loss of information
function slug(s, opt) { s = String(s); opt = Object(opt); var defaults = { 'delimiter': '-', 'limit': undefined, 'lowercase': true, 'replacements': {}, 'transliterate': typeof XRegExp === 'undefined' ? true : false }; // Merge options for (var k in defaults) { if (!opt.hasOwnProper...
[ "function getSlug(str) {\n str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, \"a\");\n str = str.replace(/À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ/g, \"A\");\n str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, \"e\");\n str = str.replace(/È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ/g, \"E\");\n str = str.replace(/ì|í|ị|ỉ|ĩ/g, \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
version I think the idea here, is accept a groove, and make a WAV
function playWithAudioElement(groove){ verifyData(); var aSamples = []; for (var ic = 0; ic < groove.channels.length; ic++){ aSamples[ic] = makeSamples(groove, groove.channels[ic].instrument, makeFnT(groove, groove.channels[ic].data)); } playSamples(aSamples); }
[ "eats(otherBlob){\n var distance = p5.Vector.dist(this.pos, otherBlob.pos);\n if(distance < this.r + otherBlob.r){//if they collided\n if(this.r * this.marginToBeEaten > otherBlob.r){//if me is big enough\n if(otherBlob instanceof Blob){//if was enemy\n if(otherBlob.type == \"enemy\"){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the clock "time" seconds into the future and triggers mining of a new block. Supported only by testrpc / ganache. Returns the timestamp of the newly created block
function fastForward(time) { web3.currentProvider.send({ jsonrpc: '2.0', method: 'evm_increaseTime', params: [ time ], }); web3.currentProvider.send({ jsonrpc: '2.0', method: 'evm_mine', }); return getLastBlockTimestamp(); }
[ "function advanceBlock () {\n ethers.provider.send(\"evm_increaseTime\", [13]) // add 13 seconds\n ethers.provider.send(\"evm_mine\", []) // mine the next block\n}", "async getTime(block) {\n\n let t = this.times[block];\n if(t) {\n return t;\n }\n let b = await this.web3.eth.getBloc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a blank header
function addHeader(){ self.$thead.find('tr').append('<th></th>'); }
[ "insertHeader() {}", "function addHeader() {\n ddCont.push(\n //header: no dice for classic header:\n {\n text: \"Portfolio Summary / Exposure\",\n margin: [0, 5, 0, 0],\n fontSize: 15,\n bold: true,\n color: '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
provides a new stream applying a transformation function to the value of a parent stream
function flatMap(parent$, fn) { var newStream = stream(fn(parent$.value)()); parent$.listeners.push(function mapValue(value) { fn(value).map(function updateOuterStream(result) { newStream(result); }); }); return newStream; }
[ "function map(parent$, fn) {\n\tlet newStream = stream(fn(parent$.value));\n\tparent$.listeners.push(function mapValue(value) {\n\t\tnewStream(fn(value));\n\t});\n\treturn newStream;\n}", "function map(parent$, fn) {\n\tvar newStream = stream(fn(parent$.value));\n\tparent$.listeners.push(function mapValue(value) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read all departments, join with employees and roles and sum up utilized department budget
readAllDepartments() { return this.connection.query( "SELECT department.id, department.name, SUM(role.salary) AS utilized_budget FROM employee LEFT JOIN role on employee.role_id = role.id LEFT JOIN department on role.department_id = department.id GROUP BY department.id, department.name;" ); }
[ "async viewTotalUtilizedBudgetByDepartment() {\n try {\n // Select all employees, sum salary and group them by department\n const result = await empORM.get({\n sql: `SELECT d.id,d.name, COALESCE(sum(r.salary),0) as 'total_utilized_budget' FROM employee e\n INNER JOIN role r\n on e....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtain an instance of a Receiver for a given event target, if none exists it will be created.
static _getInstance(eventTarget) { // The results are stored in an array since objects can't be keys for other // objects. In addition, setting a unique property on an event target as a // hash map key may not be allowed due to CORS restrictions. const existingInstance = this.receive...
[ "static _getInstance(eventTarget) {\n // The results are stored in an array since objects can't be keys for other\n // objects. In addition, setting a unique property on an event target as a\n // hash map key may not be allowed due to CORS restrictions.\n const existingInstance = this.receivers.find(rec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set Aws credentials todo
setAwsCredentials(){ }
[ "function configureAws() {\n\n if (!AWS.config.region) {\n AWS.config.update({\n region: REGION\n });\n }\n AWS.config.credentials = new AWS.Credentials({\n IdentityPoolId: REGION,\n accessKeyId: ACCESS_KEY,\n secretAccessKey: SECRET_KEY\n });\n //console...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the average of assignments given a list expects an array of assignment ID's
function CalcAssignmentListAvg(assignments) { var total = 0; var notGradedCount = 0; assignments.forEach((item) => { if (Assignments[item].average != -1) { total += Assignments[item].average; } else { notGradedCount += 1; } }); var assignmentCount = assignments.length - notGradedCoun...
[ "function average(list) {\n var av = 0;\n var total = 0;\n list.forEach(function(e){\n total += e.candies;\n av = total / list.length;\n })\n return av\n}", "function average(list) {\n\tvar ret = 0;\n\tfor(var i=0;i<list.length;i++)\n\t\tret = ret + list[i];\n\tret = ret / list.length;\n\treturn new Re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flag set to true if the attribute value is static.
get isStatic() { return !this.isDynamic; }
[ "get isStaticIp() {\n return this.getBooleanAttribute('is_static_ip');\n }", "isStatic(): boolean {\n return this.resolved != null && this.resolved.scope.isStatic();\n }", "function getAttrForStatic(elem) {\r\n var attrs = obtainAttr(elem);\r\n return \"elemAttr=\\\"\" + attrs + \"\\\"\";\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MQTT packet length formatter algorithm from reference docs
function mqttPacketLength(length) { var encLength = ''; do { var encByte = length & 127; length = length >> 7; // if there are more data to encode, set the top bit of this byte if ( length > 0 ) { encByte += 128; } encLength += fromCharCode(encByte); } while ( le...
[ "addLengthBits() {\n // @todo fix length to 64 bit\n this.state.message += \"\\x00\\x00\\x00\\x00\";\n let lengthBits = this.state.length << 3;\n for (let i = 3; i >= 0; i--) {\n this.state.message += String.fromCharCode(lengthBits >> (i << 3));\n }\n }", "function derLength(payloadLength) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log('countObject:', countObject) console.log('uniqueCountry:', uniqueCountry) console.log('countOfCountry:', countOfCountry) // Creating a bubble chart that displays each country. // Using uniqueCountry for the x values. // Using countOfCountry for the y values. // Using countOfCountry for the marker size. // U...
function size(countOfCountry) { return countOfCountry.map(d => 25 + d / 2.5) }
[ "function getCountryData(error, whiskeyData) {\n \n var whiskeyBubbles = new Object();\n \n var whiskeyTotal = 0;\n \n for (i = 0; i < whiskeyData.length; i++) {\n \n // console.log(whiskeyData[i][\"Country\"]);\n \n if (whiskeyData[i][\"Country\"] in whiskeyBubbles) {\n w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets this HMAC to its initial state.
reset() { // Shortcut const hasher = this._hasher; // Reset hasher.reset(); hasher.update(this._iKey); }
[ "reset() {\r\n\t\t// Shortcut\r\n\t\tlet hasher = this._hasher;\r\n\r\n\t\t// Reset\r\n\t\thasher.reset();\r\n\t\thasher.update(this._iKey);\r\n\t}", "reset() {\n // Shortcut\n const hasher = this._hasher;\n\n // Reset\n hasher.reset();\n hasher.update(this._iKey);\n }", "reset() {\r\n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
looping for timer functionality
function timerLooping() { timer(); startTimer = setTimeout(timerLooping, 1000); }
[ "function run() {\n clearInterval(timer);\n timer = setInterval(timerFunc, 1000);\n }", "function Timer() {\r\n\t\t\r\n\t\t// log('AGO_Module - Timer' );\r\n\t}", "function updateLoop(){\n\t\t\t\t\tvar time = this.update();\n\n\t\t\t\t\t// set timer for next update\n\t\t\t\t\tthis.updateTimer =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes all cookie consent entries in the database.
function deleteAllEntries() { PercCookieConsentService.deleteAllCookieConsentEntries(LOG_ENDPOINT+"/"+site, function() { window.location.reload(); console.log(I18N.message( "perc.ui.gadgets.cookieConsent@Success deleting entries" )); }, function(results) { var errMess...
[ "function clearCookies() {\n if (typeof document == 'undefined') return false;\n let whitelist = ['cookieconsent_status'];\n let cookies = document.cookie.split(';');\n for (let i = 0; i < cookies.length; i++) {\n let cookie = cookies[i].replace(/\\s/g, '').split('=')[0];\n if (!whitelist.includes(cookie)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
showRect takes into consideration how the current dimensions of the svg appear (is it landscape or portrait?) and sizes the view such that the specified rectangular area is completely in view. It also imposes a minimum dimension to prevent zooming in too much on a small area.
function showRect(svg, { x, y, width, height }) { const view = getViewBox(svg); const { width: width_, height: height_ } = calculateNewWidthAndHeight({ width, height, }); setViewBox(svg, { x: x + width / 2 - width_ / 2, y: y + height / 2 - height_ / 2, width: width_, ...
[ "function showRect(svg, { x, y, width, height }) {\n const view = getViewBox(svg);\n const { width: width_, height: height_ } = calculateNewWidthAndHeight({\n width,\n height,\n });\n setViewBox(svg, {\n x: x + width / 2 - width_ / 2,\n y: y + height / 2 - height_ / 2,\n width: width_,\n heigh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Background color of the tab group.
get backgroundColor() { return this._backgroundColor; }
[ "renderBackgroundColor() {\n elements.blockBackgound.classList.replace(this[state.previousTab].bgClass, this[state.currentTab].bgClass);\n }", "function setBackgroundColor() {\r\n var grid = this;\r\n\r\n grid.parent.style.backgroundColor = 'hsl(' + config.backgroundHue + ',' +\r\n config.backgro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply theme colors to elements
function applyTheme(background, foreground) { let items = document.getElementsByClassName("background"); items.forEach(function(item) { item.style.fill = background; }); let items = document.getElementsByClassName("foreground"); items.forEach(function(item) { item.style.fill = foreground; }); sett...
[ "function setColorTheme(){\n\n}", "function applyTheme(background, foreground) {\n console.log(\"settings log\",background, foreground);\n let items = document.getElementsByClassName(\"background\");\n items.forEach(function(item) {\n item.style.fill = background;\n });\n let items = document.getElementsB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the constraint is contained or not.
hasConstraint(c) { return this._cons.includes(c); }
[ "containedBy(range) {\n\n\t\t// range contains intersection if it contains the known bounds, or any of the parameterized bounds\n\t\tif (range.contains(this.known_bounds)) return true;\n\t\t// the only way we can know that this range contains a parametrized range is if they have the same\n\t\t// parameter. \n\t\tif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine a starting location to display the string so it's centered on a tile. Starts with tile 1
getXLocation(str, tile) { const width = ctx.measureText(str).width; return TILE_WIDTH * (tile - 0.5) - width / 2.0; }
[ "showStart(row,column,_startingLocation){\n if(_startingLocation == column*this.columnHeight+row){\n fill(this.startTextColor)\n // The text() function needs three parameters:\n // the text to draw, the horizontal position,\n // and the vertical position\n fill(this.startTextCo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the YML for a given event from disk
function readEvent(storyPath, storylineSlug, eventSlug) { return fs.readFileSync(`${storyPath}/${storylineSlug}/${eventSlug}.md`).toString(); }
[ "function selectYmlChanged(event) {\n var args = this.id.split(\"--\");\n let directory = viewer[args[0]].getYmlDirectory();\n Drupal.atomizer.base.doAjax(\n '/ajax/loadYml',\n { component: args[0],\n directory: viewer[args[0]].getYmlDirectory(),\n filepath: viewer[arg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
whenever a gateway is first found, connect to it and list all the gateways it sees
function mqtt_discover_gateways(gateway_ip_addr) { if (mqtt_conns.indexOf(gateway_ip_addr) == -1) { mqtt_conns.push(gateway_ip_addr); // connect to gateway over mqtt var mqtt_addr = 'mqtt://' + gateway_ip_addr; var mqtt_client = mqtt.connect(mqtt_addr); mqtt_client.on('connect', function () { // subscri...
[ "async function setupGateway() {\n\n // 2.1 load the connection profile into a JS object\n let connectionProfile = yaml.safeLoad(fs.readFileSync(CONNECTION_PROFILE_PATH, 'utf8'));\n\n // 2.2 Need to setup the user credentials from wallet\n const wallet = new FileSystemWallet(FILESYSTEM_WALLET_PATH)\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Did the request execution fail.
function isFailed(request) { if (request.kind === "failed") { return request.result; } return null; }
[ "function failedRequest(res, options) {\n completeRequest(res, options || {}, { 'keyword': 'success', 'message': 'undefined' });\n}", "function requestFailed(err) {\n console.log('XHR Failed for Main ' + err.data);\n return err.data;\n }", "onFail (error) {\n this._submitting ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Methods prefixed with a $ return a Promise on the React side. Here in the native module, the last two arguments are callback identifiers to resolve or reject that Promise. This method creates an annoying confirmation dialog that will resolve the Promise if you accept it, and reject it if you cancel the dialog. It is av...
$getConfirmation(message, resolve, reject) { const result = window.confirm(message); if (this._rnctx) { if (result) { this._rnctx.invokeCallback(resolve, []); } else { // When rejecting a Promise, a message should be provided to populate // the Error object on the React side ...
[ "function confirm(title, text, confirmButton, cancelButton, confirmPassword, confirmPasswordOnce, confirmDanger) {\n let resolvePromise;\n let rejectPromise;\n\n if (typeof confirmPassword === \"undefined\") {\n confirmPassword = false;\n }\n\n if (typeof confirmPasswordOnce === \"undefined\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End the current gesture entirely. Wait for all touches to be done before resuming gesture detection.
function end_gesture() { window.clearTimeout(click_release_timeout); window.clearTimeout(long_press_timeout); gesture_in_progress = false; }
[ "function gestureEnd(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n pointer.endTime = +Date.now();\n\n runHandlers('end', ev);\n\n lastPointer = pointer;\n pointer = null;\n }", "function gestureEnd(ev) {\n if (!pointer ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getKeywordSectionSeparator() Get the text that separates a keyword section from other sections.
function getKeywordSectionSeparator() { return "\n\n"; }
[ "function getKeywordSeparator() {\n\t\treturn \"\\n\";\n\t}", "function Separator() {\n return {\n 'type': 'Separator',\n 'html': '<hr/>',\n 'text': '----'\n };\n}", "getWordSeparator(inputChar) {\n return this._wordSeparators.find(separator => separator.input === inputChar);\n }", "function Se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
destroy enemy number one function
function destroyEnemyOne(enemy, bullet) { var explosion = explosions.getFirstExists(false); explosion.reset(enemy.body.x + enemy.body.halfWidth, enemy.y + enemy.body.halfHeight); explosion.body.velocity.y = enemy.body.velocity.y; explosion.alpha = 0.7; explosion.play('explosion', 30, false, true); enemy.kil...
[ "function destroyEnemies() {\n\taddGroupEnemy();\n}", "function destroyEnemy()\n{\n\t//holyBurger.currency += enemy.currencyValue;\n\t//loadHolyMolies(holyBurger.currency);\n\tenemyContext.clearRect(enemyXLocation, enemyYLocation, window.innerWidth *.4, window.innerHeight * (225/800));\n\tgameObject.holyMoly += 5...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches the consumer list of given limit and offset
fetchConsumerList() { this.props.actions.fetchConsumerList({ limit: this.state.limit, offset: 0 }) }
[ "list (limit, offset) {\n var listString = ''\n if (offset !== undefined) {\n listString += this.limit(limit) + this.offset(offset)\n } else {\n listString += this.limit(limit)\n }\n\n this.apiString = this.getString() + listString\n return this\n }", "function listCampaigns(callback,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A format for expressing an ordered list of integers is to use a comma separated list of either individual integers or a range of integers denoted by the starting integer separated from the end integer in the range by a dash, ''. The range includes all integers in the interval including both endpoints. It is not conside...
function solution(list){ let result = []; let i, j; for (i = 0; i < list.length; i = j + 1) { result.push(list[i]); for (j = i + 1; j < list.length && list[j] == list[j-1] + 1; j++); j--; if (i == j) { result.push(","); } else if (i + 1 == j) { ...
[ "function solution(list){\n // TODO: complete solution\n var rangeList=[];\n var start=list[0];\n var end=list[0];\n for (var i=1;i<list.length;i++){\n if (list[i] > end+1){\n //Output Current Range\n if (end > start){\n if (end > start +1)\n rangeList.push(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
somar total de itens da lista
total (itens) { prod1 = list[0].amount prod2 = list[1].amount prod3 = list[2].amount prod4 = list[3].amount itens = prod1 + prod2 + prod3 + prod4 return itens }
[ "carrinhoTotal() {\n let total = 0\n if(this.carrinho.length)\n this.carrinho.forEach(item => {\n total += item.preco\n });\n return total\n }", "function countTotal() {\n vm.factura.total = 0;\n vm.factura.canc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getIgnoreKeywords_allWords_V_Words() Get the common words to ignore that start with: v.
function getIgnoreKeywords_allWords_V_Words() { return [ 'variably', 'various', 'verily', 'very', 'view', 'views', 'virtually', 'viz', ]; }
[ "function getIgnoreKeywords_allWords_W_Words() {\n\t\treturn [\n\t\t\t'wait',\n\t\t\t'waited',\n\t\t\t'waiting',\n\t\t\t'waits',\n\t\t\t'want',\n\t\t\t'was',\n\t\t\t'wasn\\'t',\n\t\t\t'way',\n\t\t\t'ways',\n\t\t\t'we',\n\t\t\t'we\\'d',\n\t\t\t'we\\'ll',\n\t\t\t'we\\'re',\n\t\t\t'we\\'ve',\n\t\t\t'well',\n\t\t\t'wen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks to see which nodes are in the new graph but are not in the old graph
function newNotInOld() { newNodes = new Set(); for (const [examName, examValue] of Object.entries(newGraphPoints)) { for (const [gradeName, node] of Object.entries(examValue)) { if (!(gradeName in oldGraphPoints[examName])) { newNodes.add([examName, gradeName, node.value].toS...
[ "function oldNotInNew() {\n oldNodes = new Set();\n for (const [examName, examValue] of Object.entries(oldGraphPoints)) {\n for (const [gradeName, node] of Object.entries(examValue)) {\n if (!(gradeName in newGraphPoints[examName])) {\n oldNodes.add([examName, gradeName, node....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get user's numeric id from cookie if user is logged in
function getUserId() { var userid = ""; document.cookie.split(";").forEach(function(cookie) { if (/userid/.test(cookie)) { userid = cookie.match(/\d+/).toString(); } }) log += "* You" + (userid ? " have" : "'re NOT") + " logged in."; return userid; }
[ "function getuserid() {\n return getCookie(\"USER_ID\")\n}", "function getCookieUserID() {\n\tvar re = new RegExp( \"userid=([^;]+)\" );\n\tvar value = re.exec( document.cookie );\n\tif ( value != null ) {\n\t\treturn value[1];\n\t} else {\n\t\tuserid = genUserID();\n\t\texpires = new Date();\n\t\texpires.setT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an HTML modal object and returns it, given the member's information. ================================================ Member's Photo Member's Name, Member's Grad Year Member's Voice Part Member's Hometown Member's Major Member's Bio Member's Solos
function makeMemberModal(modalId, member) { // instantiate modal var $modal = $('<div/>').attr({ id: modalId, 'class': 'reveal-modal', 'data-reveal': '' }); // insert member titles $modal.append($('<img/>').addClass('memberPhoto').attr('src', member.photo)); $modal.append($('<h4/>').addClass('name').html(me...
[ "function createInformationModal() {\n var info = document.createElement(\"div\");\n info.classList.add(\"modal\");\n info.classList.add(\"hidden\");\n var modalLoadingAnimation = document.createElement(\"img\");\n modalLoadingAnimation.src = \"loader.gif\";\n modalLoadingAnimation.classList.add(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
append column to the HTML table
function appendColumn() { var tbl = document.getElementById('my-table'), // table reference i; // open loop for each row and append cell for (i = 0; i < tbl.rows.length; i++) { createCell(tbl.rows[i].insertCell(tbl.rows[i].cells.length), i, 'col'); } }
[ "function addColumn(){\r\n $('tr').append('<td></td>');\r\n column++;\r\n }", "function appendColumn() {\n var tbl = document.getElementById('my-table'), // table reference\n i;\n // open loop for each row and append cell\n for (i = 0; i < tbl.row...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the bounds for the individual sprite
setBounds() { let x = this.position.getX(); let y = this.position.getY(); let s = Game.Settings().UnitSize; let hs = s / 2; //generate Individual Bounds this.bounds = new Bounds(x - hs, y - hs, x + hs, y + hs); }
[ "keepInBounds() {\n let x = this.sprite.position.x;\n let y = this.sprite.position.y;\n let spriteHalfWidth = this.sprite.width / 2;\n let spriteHalfHeight = this.sprite.height / 2;\n let stageWidth = app.renderer.width;\n let stageHeight = app.renderer.height;\n\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simple function to select text in a div
function select_text(div_id) { var text = document.getElementById(div_id); // Non-IE if (window.getSelection) { var selection = window.getSelection(); // Safari if (selection.setBaseAndExtent) { selection.setBaseAndExtent(text, 0, text, text.innerHTML.length-1); } // Firefox, Opera ...
[ "function selectText( containerid ) {var node = document.getElementById(containerid);if(document.selection){var range = document.body.createTextRange();range.moveToElementText(node);range.select();}else if(window.getSelection){var range = document.createRange();range.selectNodeContents(node);window.getSelection().r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts the Trackball Controls
function start_trackball_controls() { controls = new THREE.TrackballControls(camera); controls.rotateSpeed = 1.0; controls.zoomSpeed = 1.2; controls.panSpeed = 0.8; controls.noZoom = false; controls.noPan = false; controls.staticMoving = true; controls.dynamicDampingFactor = 0.3; ...
[ "initTrackballControls() {\n this.trackballControls = new Trackballcontrols(this.camera, this.wrap)\n this.trackballControls.rotateSpeed = 1.0\n this.trackballControls.zoomSpeed = 1.5\n this.trackballControls.panSpeed = 1\n this.trackballControls.noZoom = false\n this.trackballControls.noPan = fal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get list of courses in list of json format.
static async getCourseList(){ const request = await fetch('https://tddd27-nikha864-backend.herokuapp.com/get_courses', { method: 'get' }); return await request.json(); }
[ "function _getCourseList() {\n let url = '/api/courseList';\n http.get(url, function(res){\n let body = '';\n\n res.on('data', function(chunk){\n body += chunk;\n });\n\n return res.on('end', function(){\n courseList = JSON.parse(body);\n });\n }).on('error', function(e){\n cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse point string and flat array
parse() { let array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [[0, 0]]; var points = []; // if it is an array if (array instanceof Array) { // and it is not flat, there is no need to parse it if (array[0] instanceof Array) { return array; } } else {...
[ "parse(array=[[0,0]]){var points=[];// if it is an array\nif(array instanceof Array){// and it is not flat, there is no need to parse it\nif(array[0]instanceof Array){return array}}else{// Else, it is considered as a string\n// parse points\narray=array.trim().split(delimiter).map(parseFloat)}// validate points - h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }