query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Handler to unshare notes from user
function unShareNoteFromUser(userId, noteId, done) { logger.info("Inside service method - unshare notes from user"); usersDao.removeNoteFromUser(userId, noteId, done); }
[ "function unShareNoteFromUser(userId, noteId, done) {\n logger.info(\"Inside controller method - unshare notes from user\");\n usersService.unShareNoteFromUser(userId, noteId, done);\n}", "handler(argv) {\n notes.removeNote(argv.title)\n // console.log('Removing the note')\n }", "function user...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enable the animation state.
_enableAnimation() { this.isAnimatable = true; toggleClass(this.navEl, 'no-animation', !this.isAnimatable); }
[ "function OnEnable () \n\t{\n\t\t//Enable the animation\n\t\tcanAnimate = true;\n\t}", "enable() {\n return this._client.send(\"Animation.enable\");\n }", "function enableAnimation() {\n if (animationsDisabled) {\n animationsDisabled = false;\n interactive = true;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get description of buttons from json
async function getButtonType() { // Read JSON file return await fetch(base_url + '/content/en.json') .then(response => response.json()) .then(data => { let saveButton = data['en']['translation']['saveButton']; let createButton = data['en']['translation']['createButton']; ...
[ "function getButtons(obj) {\n return keyWith(obj, 'Button');\n}", "generateButtonsJson() {\n\n let buttons = [];\n for (let key in this.buttons) {\n let button = this.buttons[key];\n let temporaryButton = {};\n temporaryButton.type = button.type;\n tempor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End the current phone call, disconnecting Twilio as well
endCall(oldState) { if (phone.conn) { if (oldState == PhoneState.Incoming) { phone.conn.reject(); } log("Phone state changed to idle. Disconnecting all calls"); Twilio.Device.disconnectAll(); phone.conn = null; } }
[ "endCall(oldState) {\n if (this.conn) {\n if (oldState == PhoneState.Incoming) {\n this.conn.reject();\n }\n log(\"Phone state changed to idle. Disconnecting all calls\");\n Twilio.Device.disconnectAll();\n this.conn = null;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the remote calls object
async update () { // Get the remote calls names let remote = await this.call('_update'); // Reset the remote object this.remote = {}; // Fill the remote object with the calls wrappers remote.forEach(name => { this.remote[name] = async (...args) => { return await this.call(name, ......
[ "function RemoteCallManager() {}", "_updateFromResponse(response) {\n this.id = response.getId();\n this.state = response.getData().state;\n this.toAddress = response.getData().toAddress;\n this.fromAddress = response.getData().fromAddress;\n var mediaProperties = response.getMe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write the minimum and maximum to be used for later scaling to a file. Use the values for future transformation of data before model prediction.
function write_params() { var fs = require('fs'); var path = require('path'); // Data which will write in a file. var data = { X_max: X_max, X_min: X_min, max_: max_, min_: min_ }; return fs.writeFileSync(path.resolve(__dirname, 'minmaxscaler.json'), JSON.stringify(data)); }
[ "calculateMinMax() {\n var i = 0;\n Object.keys(this.data).forEach(key => {\n this.data[key].forEach(reading => {\n var value = parseInt(reading.sensor_value);\n if(i == 0) {\n this.minValue = value;\n this.maxValue = value...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
z and Z can be tested when knowing the timezoneoffset of the machines the test will run on here it is EET
testPattern_z_() { var df; for (var i = 0; i < this.__dates.length; i++) { var date = this.__dates[i].date; var timezoneOffset = date.getTimezoneOffset(); var timezoneSign = timezoneOffset > 0 ? 1 : -1; var timezoneHours = Math.floor(Math.abs(timezoneOffset) / 60); v...
[ "function getOffSetTimeZone(){\n\t\treturn (-(new Date().getTimezoneOffset()));\n\t}", "function checkTZ(tzId) {\n var tz = tzSvc.getTimezone(tzId);\n\n // Have to handle UTC separately because it has no .icalComponent.\n if (tz.isUTC) {\n if (offsetDec == 0 && offsetJun == 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
num 11 11. Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array.
function searchInsertPosition(arr, target) { if (arr.length === 0) return 0; arr = arr.sort((a, b) => a - b); for (let i = 0; i < arr.length; i++) { if (arr[i] === target) return i; else if(arr[i]>target) return i; } return arr.length; }
[ "function searchInsert(nums, target) {\n for (let i = 0; i < nums.length; i++) {\n if (nums[i] === target) {\n return i;\n }\n }\n\n nums.push(target);\n\n return nums.sort((a, b) => a - b).indexOf(target);\n}", "function binarySearchIndex(array, target) {\n\n}", "function s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2nd card flip delay
function flipDelay() { openedCards[1].toggleClass('open show').animateCss('flipInY'); clearOpenCards(); }
[ "function flipHiddenCard() {\n setTimeout(function () {\n if (dealerHand.length === 2) {\n $(\"#dealer-card-1\").addClass(\"flipped\");\n $(\"#dealer-card-1\").attr(\"src\", \"images/\" + dealerHand[1].src);\n }\n }, 5000);\n}", "function flipCard() {\n var cardId = th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
bai13: S = x^2 + x^4 +...+x^2n
function bai13(x,n) { var tong = 0; var tich = 1; for (let i = 1; i <= Math.abs(n); i++) { tich*=x*x; tong+=tich; } return tong; }
[ "function senx(x){\n let res = x;\n for(let i = 3 ; i <= 7 ; i=i+4){\n res = res - Math.pow(x,i)/fact(i)\n }\n for(let i = 5 ; i <= 9 ; i=i+4){\n res = res + Math.pow(x,i)/fact(i)\n }\n return(res)\n}", "function bai12(x,n) {\n var tong = 0;\n var tich = 1;\n for (let i = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all sub rental for rental ends / make package effect for rental
function packageEffectForRental (rentalForCalculationOfPackage, packageorders, rentals, packageFoodTypes, chargeMultiplierWithFood, serviceCharge, vat, serviceTaxRateWithFood, isWeekend, gracePeriodForGames, serviceTaxParameter, endTimeForActiveRental, packageCgst, packageSgst, gameCgst, gameSgst, foodCgst, foodSgst) {...
[ "TrendingWeek(req, res) {\n let filter = {};\n let control = new restaurantjs(OrderSchema);\n control.TrendWeek(filter, 10).then(async (restaurant) => {\n if (_.isEmpty(restaurant)) return res.send({ status: 0, message: \"No restaurants found.\" });\n let data = [];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
smallest factor of the number
function smallestFactor(x) { if (x < 2) throw "Argument error"; if (x % 2 == 0) return 2; var end = Math.floor(Math.sqrt(b)); for (var i = 3; i <= end; i += 2) { if (x % i == 0) return i; } return x; }
[ "function lesserFactor(n){ //find the smallest factor that's not 1, of any given integer\n for(let i = 2; i <= Math.sqrt(n); i++){ //run through every integer bigger than 1, up to the square root of n\n if(n % i === 0){ //if i is a factor of n...\n return i; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The size of each character (This scales the whole text).
get characterSize() {}
[ "get fontSize () {\n\t\treturn this.font.size\n\t}", "_calculateCharSize() {\n // Note: We calculate char size with every redraw. Size may change, for\n // example when any of the timelines parents had display:none for example.\n\n // determine the char width and height on the minor axis\n if (!this.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apppend an "or" clause to a db query
function noSQL_OR(expression){ 'use strict'; return ".or(" + expression + ")"; }
[ "static or(...args) { return this.__query().or(...args); }", "function doOr() {\n doDoubleOp(\"OR\");\n}", "orWhereNot() {\n return this._bool('or').whereNot.apply(this, arguments);\n }", "orWhereRaw (sql, bindings = []) {\n return this.whereRaw(sql, bindings, 'or')\n }", "function queryJoinerOr(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
keep within 360 degrees
function fix360(v) { while(v < 0.0)v += 360; while(v > 360)v -= 360; return v; }
[ "function fix360(v) {\r\t while (v < 0.0) v += 360;\r\t while (v > 360) v -= 360;\r\t return v;\r\t}", "normalizeIn360() {\n return Angle.fromDegree(numbers.modulo(this.degree, 360));\n }", "function fix360(v){\n if(v < 0.0)v += 360;\n if(v > 360)v -= 360;\n return v;\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clears signaturePad of marks and resets data arrays added feature to wipe the data from memory if want the pages reset
function clearCanvas(){ canvas2d.clearRect(0,0,canvas.width,canvas.height); signaturePad.fromData([]); sessionStorage.signatureValue = JSON.stringify([]); }
[ "function clearMarks(){\n\n //clear validation and marks in rules in ruleArray\n for (var v = 0; v < ruleArray.length; v++){\n if (ruleArray[v][VAL]){\n ruleArray[v][VAL] = false;\n mark(v, false);\n }\n }\n\n // clear validation and marks in rules in blackList\n for (var v = 0; v < blackList.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the current building preview sprite is positioned so it does not collide with any nobuild level region or another tower and is within the game boundary; returns false otherwise
function isValidBuild() { let result = true; if (gameInfo.currentLevelCash < gameInfo.currentLevelBuildingPreview.price) { result = false; } for (let tower of gameInfo.currentLevelTowers) { if (game.hitTestRectangle(gameInfo.currentLevelBuildingPreview, tower)) { result = false; } } for (let noBuildZone ...
[ "isValid() {\n if (game.mouseOver.type == 'highground' && game.mouseOver.buildable && game.mouseOver.tower == null) {\n return true;\n }\n return false;\n }", "playerIsInBounds() {\n\t\tvar newCoords = [player.x - this.x, player.y - this.y, player.z - this.z];\n\t\t//rotating by...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getBinPath returns the path to the tool.
function getBinPath(tool, useCache = true) { const r = getBinPathWithExplanation(tool, useCache); return r.binPath; }
[ "async _getToolPath () {\r\n const localPath = this.getLocalPath()\r\n if (localPath) {\r\n let local = false\r\n try {\r\n await fs.promises.access(localPath, fs.constants.X_OK)\r\n local = true\r\n } catch (e) { }\r\n if (local) {\r\n return localPath\r\n }\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Collision Detection// s = singular item/character, a = array of characters// TODO: Set this shit up
function collide(s,a){ var self = this; self.o = s; self.a = a; }
[ "detectCollision(ast) {\n ast.forEach(function(a) {\n // need to clean up the boundaries for cleaner collisions but works\n if (this.xPos >= a.xPos && this.xPos <= a.xPos + a.width * .8 && this.yPos <= a.yPos + a.height * .9) {\n // console.log(\"hit\");\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
constructor for Class OrientDB
function OrientDB(){ // configure orientdb client - ensure you change the username and password here this.server = Oriento({ host: 'localhost', port: 2424, username: 'username', password: 'password' }); // we will connect to a database named 'yelp-test' try { this....
[ "function MVDBobj() {\n\t\tthis.initialize.apply(this, arguments);\n\t}", "function AwesomeDB()\n{\n this.MySQL = Object.create(Adb_MySQL);\n}", "constructor() {\n this._db;\n }", "function NodeDB(){\r\n\t\"use strict\";\r\n\tDatabase.call(this, [\"NODE ID\", \"NODE OBJECT\"]);\r\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
registers event listeners to be used for mario actions
addEventListeners() { document.addEventListener("keydown", (e) => { e.stopPropagation(); if(e.keyCode == 32 && !this.marioIsJumping) this.marioJump() if(e.keyCode == 39) this.marioMoveRight(); if(e.keyCode == 37) this.marionMoveLeft(); }, fals...
[ "initActions() {\n this.canvas.addEventListener('mousedown', (event) => { this.startDrawing(event); });\n this.canvas.addEventListener('mouseup', (event) => { this.endDrawing(event); });\n this.canvas.addEventListener('mousemove', (event) => { this.onMove(event); });\n }", "function regist...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TCID is the issue id created in Jira Id is the transition id for the wanted status
function updateIssueStatusInJira(TCID, Id){ getAjaxSetupConnection('POST'); var jsonData = { "transition": { "id": Id } } $.ajax({ url: base_url + '/rest/api/latest/issue/' + TCID + '/transitions?expand=transitions.fields', data: JSON.stringify(jsonData), success: function (data, status,...
[ "async transitionTo(status) {\n const results = await jira_1.jira.listTransitions(this.key);\n const re = new RegExp(status, 'i');\n const transitions = results.transitions.filter(t => re.test(t.to.name));\n if (transitions.length === 1) {\n this.data.fields.status = transitio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate a single token on clicking generate token btn
function generateToken( el ) { axios.get('/0/workspace/'+ space + '/genToken').then(function ( res ) { var generated = res.data; // add new key to content var appendTo = document.getElementById('member-tokens-assigned'); var html = document.createElement('div');...
[ "function genToken() {\n\t\tlet token = uuid.v4();\n\t\tsetStorage({'WTA_TOKEN': token});\n\t\treturn token;\n\t}", "function create_token(ev) {\n api.submit_login(props.login);\n }", "function generateToken() {\n return shortid();\n}", "generateToken() {\n const token = generateToken();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
an abstract interpreter / tracer. a normal interpreter except for certain cases where there is an abstract value. then emit a statement into the trace.
function tracer(ast, env) { env = (env==undefined?new Environment():env) // console.log(env.depth) // console.log("tracer: ",ast) // console.log("tracer, trace so far: ",global_trace) // console.log(env) switch (ast.type) { //First the statements: case 'Program': case...
[ "function tracer(ast, env) {\n env = (env==undefined?new Environment():env)\n // console.log(env.depth)\n // console.log(\"tracer: \",ast)\n // console.log(\"tracer, trace so far: \",global_trace)\n // console.log(env)\n switch (ast.type) {\n //First the statements:\n cas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: Browser class Info: IE or NS browser.
function Browser() { this.IE = false; this.NS = false; this.isFireFox1_5 = false; this.Opera = false; this.Safari = false; this.Mac = false; var userAgent; userAgent = navigator.userAgent; if ((userAgent.indexOf("Opera")) >= 0) { this.Opera = true; return; } if ((userAgent.indexOf("...
[ "function BrowserInfo()\n{\n this.name = navigator.appName;\n this.codename = navigator.appCodeName;\n this.version = navigator.appVersion.substring(0,4);\n this.platform = navigator.platform;\n this.javaEnabled = navigator.javaEnabled();\n this.screenWidth = screen.width;\n this.screenHeight = screen.height...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to start the bot socket connection, when it is shutdown
start() { this.connectionManager.connect().catch((err) => { logger.error('Unable to start the bot %j', err); }); }
[ "function Bot$start(){\n if(this.client == null){\n this.createServer();\n this.createClient();\n \n }\n}", "connectToServer() {\n const heartbeat = () => {\n clearTimeout(this.pingTimeout)\n this.pingTimeout = setTimeout(() => {\n this.connec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lex function that supports token stacks
function tokenStackLex() { var token; token = tstack.pop() || lexer.lex() || EOF; // if token isn't its numeric value, convert if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } ...
[ "function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn't its numeric value, convert\n if (typeof token !== 'number') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n token = self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send out ship exploding status
function shipBoom(data){ var out = {}; out[data.id] = { status: 'boom', stage: data.stage }; io.sockets.emit('shipstat', out); }
[ "function ship_attack(choice){\n\t\t\t//Disable button if no response\n\t\t\tif (shield_activated==null){\n\t\t\t\tshield_activated = false\n\t\t\t\tresponse.ships.rt_shield_activated.push(null);\n\t\t\t}\n\n\t\t\t//Log shield response\n\t\t\tresponse.ships.shield_activated.push(shield_activated)\n\n\t\t\tvar point...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Everybody loves pi, but what if pi were a square? Given a number of digits digits, find the smallest integer whose square is greater or equal to the sum of the squares of the first digits digits of pi, including the 3 before the decimal point. Note: Test cases will not extend beyond 100 digits; the first 100 digits of ...
function squarePi(digits){ let d = '31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679' return Math.ceil(d.slice(0, digits).split('').reduce((s, i) => s + parseInt(i) ** 2, 0) ** 0.5); }
[ "function int_sqrt(a)\n{\n var l, u, s;\n if (a == 0n)\n return a;\n l = ceil_log2(a);\n u = 1n << ((l + 1n) / 2n);\n /* u >= floor(sqrt(a)) */\n for(;;) {\n s = u;\n u = ((a / s) + s) / 2n;\n if (u >= s)\n break;\n }\n return s;\n}", "function smalle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
9.1 Ordinary Object Internal Methods and Internal Slots 9.1.1.1 OrdinaryGetPrototypeOf(O)
function OrdinaryGetPrototypeOf(O) { var proto = Object.getPrototypeOf(O); if (typeof O !== "function" || O === functionPrototype) return proto; // TypeScript doesn't set __proto__ in ES5, as it's non-standard. // Try to determine ...
[ "function OrdinaryGetPrototypeOf(O) {\r\n\t var proto = Object.getPrototypeOf(O);\r\n\t if (typeof O !== \"function\" || O === functionPrototype)\r\n\t return proto;\r\n\t // TypeScript doesn't set __proto__ in ES5, as it's non-standard.\r\n\t // Try to determine the superclas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if we need to call resolvePendingBPs on scriptParsed event If break on load is active and we are using the regex approach, only call the resolvePendingBreakpoint function for files where we do not set break on load breakpoints. For those files, it is called from onPaused function. For the default Chrome's API ap...
shouldResolvePendingBPs(mappedUrl) { if (this._breakOnLoadStrategy === 'regex' && !this.stopOnEntryRequestedFileNameToBreakpointId.has(mappedUrl)) { return true; } return false; }
[ "shouldContinueOnStopOnEntryBreakpoint(pausedLocation) {\n return __awaiter(this, void 0, void 0, function* () {\n // If the file has no unbound breakpoints or none of the resolved breakpoints are at (1,1), we should continue after hitting the stopOnEntry breakpoint\n let shouldContinue...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Glue to generate config.json for sequelize.
function getConfig() { const conf = dotenv.config().parsed; const env = process.env.NODE_ENV; const sequelizeConfig = {}; sequelizeConfig[env] = { "url": conf.DATABASE_URL, "dialect": "postgres" }; return sequelizeConfig; }
[ "function generateConfig() {\n var options = {\n \"$schema\": \"./node_modules/ng-translation-gen/ng-translation-gen-schema.json\"\n };\n if (args.input) {\n options.input = args.input;\n }\n if (args.output) {\n options.output = args.output;\n }\n if (args.mapping) {\n options.mapping = args.map...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1 Write a script that allocates array of 20 integers and initializes each element by its index multiplied by 5. Print the obtained array on the console.
function initArrayOf20Int() { var integerArray = new Array(20); var result = ""; for (var i = 0; i < integerArray.length; i++) { integerArray[i] = i * 5; result += integerArray[i] + "\n"; } printInElement(result); }
[ "function maker() {\n var arr = [];\n for (var i = 0; i < 25; i++) {\n arr[i] = i + 1;\n }\n return arr;\n}", "function maker(array) {\n \n var array = [];\n \n for(var i = 1;i <= 25; i++){\n array.push(i);\n }\n return array;\n }", "function maker() {\n array = []\n for (let i = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a popup that displays the properties for each feature displayed from the data
function onEachFeature(feature, layer) { var popupContent = ""; if (feature.properties) { for (var property in feature.properties){ popupContent += "<p>" + property + ": " + feature.properties[property] + "</p>"; } layer.bindPopup(popupContent); }; }
[ "function showProperties(e) {\n var properties = e.target.feature.properties;\n var html = '<button id=\"close-props\" class=\"btn btn-sm btn-warning pull-right\" onclick=\"clearProperties()\" title=\"Sluit data tab\"><i class=\"fa fa-close\"></i></button><table class=\"table table-bordered table-condensed\">...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Has a integer value and is used in the changinImg(). Will be used to change the id and array number. / The RandVal() main purpose is to create a random integer from the MIN to MAX range. This will be used in checklist() to add to user. Since it is by itself in the function, It won't have any issues when called upon at ...
function RandVal() { rand = Math.floor(Math.random() * MAX) + MIN; //Chooses a random number from the ranges of MIN and MAX. }
[ "function randInt(minVal, maxVal) {\r\n var size = maxVal - minVal + 1;\r\n return Math.floor(minVal + size*Math.random());\r\n }", "function randInt(minVal, maxVal) {\n var size = maxVal - minVal + 1;\n return Math.floor(minVal + size*Math.random());\n }", "function randNumber(val){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import './FieldHelp.css' A simple span that displays help text. Optional class added when help is related to an error.
function Help({ help, hasErrors, id, suggestion, onChange }) { const preTxt = 'Do you mean ' const postTxt = '? ' const className = classNames('help-block', { 'validation-message': hasErrors, }) return ( <p className={className} id={`${id}-helpBlock`}> {suggestion && <span> {...
[ "function setValidationText(helpField, helpMessage) {\n if (logLevel >= 4) { logToWorkflow(\"entering setValidationText()\", \"DEBUG\", false); }\n if (helpField) {\n helpField.innerHTML = helpMessage;\n }\n if (logLevel >= 4) { logToWorkflow(\"exiting setValidationText()\", \"DEBUG\", false); }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the specific columns for each type of split_by
function return_table_columns(table_type){ var tmp_table = [] if(table_type == "Season"){ for(var i = 0; i < table_columns.length; i++) { var column = table_columns[i]; if(column.title != "Game.ID" && column.title != "...
[ "function indicatorsToColumns(report, countBy, requestParam) {\n var result = [];\n //converts a set of supplementColumns into sql columns\n _.each(supplementColumnsToColumns(report), function (column) {\n result.push(column);\n });\n //converts set of indicators to sq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if it has XDomainRequest.
hasXDR() { return typeof XDomainRequest !== "undefined" && !this.xs && this.enablesXDR; }
[ "hasXDR() {\n\t return typeof XDomainRequest !== \"undefined\" && !this.xs && this.enablesXDR;\n\t }", "hasXDR() {\n return typeof XDomainRequest !== \"undefined\" && !this.xs && this.enablesXDR;\n }", "hasXDR() {\r\n return typeof XDomainRequest !== \"undefined\" && !this.xs && this.enab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called on layer click
function clickLayer() { // Outline and open popup on click this.openPopup(); this.bringToFront(); this.setStyle({ weight: 2, opacity: 1 }); }
[ "onclick(e){\n\t\tvar {x, y} = this.canvasMousePos(e);\n\t\tvar lcl = this.getLayerAt(x, y);\n\t\tif(lcl){\n\t\t\tthis.last_clicked_layer = lcl;\n\t\t\tthis.fireEvent('layer-click');\n\t\t}\n\t}", "function OnLayerClick()\n{\n var id = this.id;\n if(id != undefined)\n {\n var layerNumber = id.charAt(id....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateStatus (1) Update "status" settings with user input (2) save settings (3) send updated settings to tab.js to modify active tab blur css
function updateStatus () { settings.status = document.querySelector("input[name=status]").checked browser.storage.sync.set({"settings": settings}) sendUpdatedSettings() }
[ "function setStatus(status, active) {\n active_ = active;\n status_ = status;\n\n /* Apply update if the extension is not active */\n if (update_ && !active_)\n chrome.runtime.reload();\n\n refreshUI();\n}", "change_status() {\n // Do not update status while invisible ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Translate the environment variable list into a dict
function getEnv(vars) { let buildenv = {} for (let i = 0, len = vars.length; i < len; i++) { buildenv[vars[i].name] = vars[i].value } return buildenv }
[ "parse(envString) {\n const envCollection = dotenv_1.default.parse(envString.trim());\n return Object.keys(envCollection).reduce((result, key) => {\n result[key] = this.interpolate(envCollection[key], envCollection);\n return result;\n }, {});\n }", "function loadEnvi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Includes a circle to the objects list
function addCircle(radius, center = [0, 0, 1]) { objectSelected = objects.push({ name: '', type: 'circle', radius: radius, center: center, fill: '#FFFFFF', stroke: '#000000', actualStroke: '#000000', T: Math.identity(), R: Math.identity(), ...
[ "function addCircle(){\n\t\t\tvar newCirc = new fabric.Circle({\n\t\t\ttop: 100, \n\t\t\tleft: 100, \n\t\t\tradius: 75,\t\t\t\n fill : 'rgb(200,200,200)'\n\t\t\t});\t\n\t\t\tcanvas.add(newCirc).setActiveObject(newCirc);\n\t\t\tselectObjParam();\n\t\t\tcanvas.renderAll();\t\t\n\n\t\t}", "function drawCi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If results are recieved from the API call, scroll to where the results are displayed
componentDidUpdate() { scrollToComponent(this.results, { offset: 0, align: "top", duration: 500, ease: "out-circ" }); }
[ "function scrollToResults() {\n window.scrollTo({ top: 1500, behavior: 'smooth' });\n}", "function scrollToResults() {\n if (userData.dinnerOptions.length > 0 && userData.movieOptions.length > 0) {\n $('html, body').animate({\n scrollTop: $(\"#results-area\").offset().top\n }, 300);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when the button clicked, it will send a request to the pokeapi server using the ajaxFunc below this function will send the user input to the server, and get a request back
function ajaxFunc() { //gather the user's input let num = document.getElementById("userInput").value; //.value is how we can parse user input //initialize an XHR object to send/recieve data let xhr = new XMLHttpRequest(); //this functionality will execute every time the event listener fires (sinc...
[ "function request() {\n\t// Clear existing response status\n\tjQuery('#responseStatus').empty();\n\tvar index = jQuery('#endpoint').val();\n\tvar endpoint = _API[index];\n\tvar argStr;\n\tif (endpoint.type == 'JSON') {\n\t\targStr = jQuery('#template').val();\n\t} else if (endpoint.type == 'FORM') {\n\t\tvar args =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if there is at least one unhealthy person in the wagon. Return false if not. const dysentery = this.party.some(traveler => traveler.isUnhealthy === false)
shouldQuarantine() { const healthy = this.passengers.some(traveler => traveler.isHealthy === false) return healthy }
[ "function quarantine(wagon) {\n let myWagonArray = wagon.getPassengerList();\n for(let i = 0; i < myWagonArray.length; i++) {\n if(myWagonArray[i].getHealthStatus() == false) {\n return true;\n }\n }\n return false;\n }", "shouldQuarantine() {\n if (this.passengers.some(passen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Arrow functions // ES5
function arrowFunc(name) { return 'Hello ' + name; }
[ "function my() {\n console.log(\"This is Arrow funtion concept\");\n\n}", "function visitArrowFunction(node) {\n if (node.transformFlags & 16384 /* ContainsLexicalThis */) {\n enableSubstitutionsForCapturedThis();\n }\n var savedConvertedLoopState = convertedLoop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
buildNews() function to pull News data and insert it into HTML page
function buildNews(playerName) { //set var url = '<flask_route>' + playerName // d3.js to fetch news data for sample // select the div id for where the news is going to go, set it to var news // clear html using news.html("") // use object.entries to insert the news }
[ "function buildNews() {\n let newsHtml;\n\n newsHtml = /*html*/ `<div class=\"news\">\n <h2 class=\"newsh2\">Nyheter</h2>\n <article>\n <p>\"Toy Story 4\" - Stor succé på Svenska Biografer</p>\n <p>\n \"Pulp Fiction\" - En alltid välkommen Klassiker, återigen på Bio\n hos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy the account address to clipboard
copyAddress() { var dummy = document.createElement("input"); document.body.appendChild(dummy); dummy.setAttribute("id", "dummy_id"); dummy.setAttribute('value', this._Wallet.currentAccount.address); dummy.select(); document.execCommand("copy"); document.body.remov...
[ "function CopyAddress() {\n clipboardy.writeSync(myWallet.address);\n alert(\"Address Copied: \" + myWallet.address);\n}", "function copyAddressToClipboard(){\n var addr = \"0x9847098fhfer\";\n cordova.plugins.clipboard.copy(addr);\n }", "copyAddress(address) {\n var dummy = document.createE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hint button provides exact number of hint numbers as guesses remaining
function provideHint(){ //As the function generates random numbers, it is important to prevent the user from clicking the hint button more than once to see which number has not changed. if (hintNotGiven) { var hintArr = []; for(var i = 0; i < guesses; i++) { hintArr[i] = generateWinningNumber(); } hin...
[ "function handleHintBtn() {\n if (game.pastGuesses.length < 3) {\n prompt.innerHTML = 'A little early for a hint, don\\'t you think?';\n } else {\n let hints = game.provideHint();\n prompt.innerHTML = `The answer is one of the following: ${hints[0]}, ${hints[1]}, and ${hints[2]}`;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1. begin from province (model), next city and then resort 2. iterate each model, firstly check if the model already exists using its name. 3. if so give an alert; otherwise insert it. 4. for city and resort, update corresponding province and city 5. also insert the same object into cache
async function initModel(db, redisClient, apiOption) { const provinces = require("../model/province-model"); _.each(provinces, async province => { const provinceName = province.provinceName; const option = { collection: apiOption.provinceCol }; option.type = "find"; option.query = { provinceName: pr...
[ "saveDataCity() {\n // Prepare data\n let data = {\n id: this.tempRecord.id,\n name: this.tempRecord.name,\n province_id: this.tempRecord.province.id,\n url: '/cities',\n function: 'createCities',\n };\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper method for parsing a URL string into a scheme and a path.
function parseURL(url) { if (url.indexOf(URL_SCHEME_SUFFIX) === -1) { throw new Error(`The url string provided does not contain a scheme. ` + `Supported schemes are: ` + `${ModelStoreManagerRegistry.getSchemes().join(',')}`); } return { scheme: url.split(URL_SCHEME_SU...
[ "function parseURL(url) {\n if (url.indexOf(URL_SCHEME_SUFFIX) === -1) {\n throw new Error(\"The url string provided does not contain a scheme. \" + \"Supported schemes are: \" + (\"\" + ModelStoreManagerRegistry.getSchemes().join(',')));\n }\n return {\n scheme: url.split(URL_SCHEME_SUFFIX)[0],\n path:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets WAIARIA property ariaactivedescendant.
_setActiveDescendant(item) { const that = this; if (!that.readonly) { if (item) { that.setAttribute('aria-activedescendant', item.id); } else { that.removeAttribute('aria-activedescendant'); } } }
[ "onActiveDescendantAssociationChange() {\n this.removeAttributeFromAllElements( 'aria-activedescendant' );\n\n for ( let i = 0; i < this.node.activeDescendantAssociations.length; i++ ) {\n const associationObject = this.node.activeDescendantAssociations[ i ];\n\n // Assert out if the model list is d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the min/max values for a year and return as an array of size=2. You shouldn't need to update this function.
function getExtentsForYear(yearData) { var max = Number.MIN_VALUE; var min = Number.MAX_VALUE; for(var key in yearData) { if(key == 'Year') continue; let val = +yearData[key]; if(val > max) max = val; if(val < min) min = val; } return [min,max]; }
[ "function maxValueYears(data, minYear, maxYear)\n{\n\tvar maxYears =[];\n\tconsole.log(data);\n\t//Loop between the two input years\n\tfor(var i =minYear; i<=maxYear;i++)\n\t{\n\t\tvar max =0;\n\t\t//Check each year which value that is the max\n\t\tdata.forEach(function(d)\n\t\t{\n\t\t\tif(max<d[\"Y\"+i])\n\t\t\t{...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A list of simplices (data) with information about dimensionality and vertex properties (meta). This class should be used as an abstract base or concrete class when constructing geometries that are to be manipulated in JavaScript (as opposed to GLSL shaders).
function SimplexGeometry() { _super.call(this); /** * The geometry as a list of simplices. * A simplex, in the context of WebGL, will usually represent a triangle, line or point. * @property data * @type {Simplex[]} */ ...
[ "function ShapeCollection() {\r\n\t\tthis.title = 'shapes';\r\n\t\t// TODO: insertion of markup should be done by the build process\r\n\t\tthis.shapes = [\r\n\t\t\tPlatonicShape('square', 'square.svg', '<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 50 50\" preserveAspectRatio=\"none\"><rec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Injection A class for new injections to allow for a fluent API.
function Injection(from, dependency) { this.from = from; this.dependency = dependency; }
[ "injection() {\n return this._getOrCreateSubset('injection', injection_1.default);\n }", "function Injector() {\n this.components = {};\n this.instances = {};\n this.stack = [];\n }", "function NgInject(options) {\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checking seed's existence Update seed according to the configuration file.
async function checkExist(newObj){ try { let oldObj = await Seed.findOne({seed: newObj.seed},{_id:0}).lean(); if(!oldObj) await Seed.create(newObj); else{ let diff = difference(oldObj, newObj); if(!lodash.isEmpty(diff)) await Seed.findOneAndUpdate({seed:newObj.seed},n...
[ "async function newSeed() {\n try{\n await checkExist(seeds.tomato);\n await checkExist(seeds.pakchoi);\n await checkExist(seeds.brassica);\n await checkExist(seeds.cucumber);\n await checkExist(seeds.cabbage);\n }catch (err) {\n throw err\n }\n}", "_validateSeed...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
By: Hamid ZarrabiZadeh, Hamed Moghimi December 2014 Edited by: Liu233w initialize scoreboard
function init_scoreboard() { var tbody = document.getElementsByTagName('tbody')[0]; var str = ''; // create rows for (var i = 0; i < rows.length; i++) { var row = rows[i]; var team = row[1]; var name = team[1]; if(team.length >= 3){ name = team[2] + ' ( ' + name + ' )'; } str += '<tr><td>' + row[0...
[ "function init() {\n previousScoreboard();\n }", "function initGameBoard(){\n\t\n\t//create a matrix\n\tcreateEmptyMatrix();\n\t\n\t//place mines in the newly created matrix\n\tplaceMines();\n\t\n\t//draw game board\n\tdrawMatrix();\n\t\n}", "function createScoreBoard() {\n const scoreBoard = {\n sc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Customized gestures that are not supported
function gesture_not_supported(e) { console.log("Gesture is not supported 😞"); }
[ "function disableGestures() {\n lastPanningEnabled = cy.panningEnabled();\n lastZoomingEnabled = cy.zoomingEnabled();\n lastBoxSelectionEnabled = cy.boxSelectionEnabled();\n\n cy.zoomingEnabled(false)\n .panningEnabled(false)\n .boxSelectionEnabled(false);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send the extractorIsOn flag to every linkReader
function activateAutoLinks() { linkReaders.forEach( function(linkReader) { linkReader.postMessage(extractorIsOn); }); }
[ "onLink() {\n this.addLink = !this.addLink;\n }", "function processRefUrls() {\n const readPageCheckId = 'read-page-check';\n const readImg = `<img id=\"${readPageCheckId}\" alt=\"Page Read\" src=\"${chrome.runtime.getURL('images/eye_full.png')}\" style=\"height: 2em; width: auto; position: relative; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses RDF in the form of NQuads.
function _parseNQuads(input) { // define partial regexes var iri = '(?:<([^:]+:[^>]*)>)'; var bnode = '(_:(?:[A-Za-z0-9]+))'; var plain = '"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"'; var datatype = '(?:\\^\\^' + iri + ')'; var language = '(?:@([a-z]+(?:-[a-z0-9]+)*))'; var literal = '(?:' + plain + '(?:' + datatyp...
[ "function _parseNQuads(input){// define partial regexes\nvar iri='(?:<([^:]+:[^>]*)>)';var bnode='(_:(?:[A-Za-z0-9]+))';var plain='\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\"';var datatype='(?:\\\\^\\\\^'+iri+')';var language='(?:@([a-z]+(?:-[a-z0-9]+)*))';var literal='(?:'+plain+'(?:'+datatype+'|'+language+')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close Screen and Stop loop
function onAccelBack(){ console.log('Close Screen and Stop Loop'); inNoiseMon = false; CountScreen.hide(); main.hide(); }
[ "function onAccelBack(){\n console.log('Close Screen and Stop Loop');\n inWristCount = false;\n CountScreen.hide(); \n}", "function endGameTie(){\n screenDisplay(none, none, block);\n tieScreen();\n}", "function stop() {\n console.log(\" stop button clicked \");\n // game.gameOverScreen(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches Immutable DraftJS Entities to the Emoji text. This is necessary as emojis consist of 2 characters (unicode). By making them immutable the whole Emoji is removed when hitting backspace.
function attachImmutableEntitiesToEmojis(editorState) { var contentState = editorState.getCurrentContent(); var blocks = contentState.getBlockMap(); var newContentState = contentState; blocks.forEach(function (block) { var plainText = block.getText(); var addEntityToEmoji = function addEntityToEmoji(s...
[ "function attachImmutableEntitiesToEmojis(editorState) {\n var contentState = editorState.getCurrentContent();\n var blocks = contentState.getBlockMap();\n var newContentState = contentState;\n blocks.forEach(function (block) {\n var plainText = block.getText();\n\n var addEntityToEmoji = function addEnti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates an existing service
static async _update() { const serviceName = Config.str("serviceName"); let service = await ECSManager.describeService(serviceName); if (!service) { throw new Error("Service does not exist: " + serviceName + ". Create instead."); } else if (service.status === "DRAINING") { throw new Error("Service is sti...
[ "function update (service){\n $http.put(API_URL+'services/'+ service.id, service)\n .success(function (data) {\n alert('Service updated correctly');\n index();\n })\n .error(function (err) {\n alert('Error: '+ err.message);\n console.debug(err)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by LUFileParsernestedIntentName.
enterNestedIntentName(ctx) { }
[ "enterNestedIntentNameLine(ctx) {\n\t}", "enterNestedIntentBodyDefinition(ctx) {\n\t}", "visitNestedIntentNameLine(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "enterNestedIntentSection(ctx) {\n\t}", "visitNestedIntentName(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "enterNestedExpressionAtom...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This prints a hello message in the console. (Don't forget to check. :) )
function sayHelloInTheConsole() { console.log("Hey there!\nThanks for checking my console.\n"); }
[ "function sayHello(name) {\n\t\tconsole.log(\"Hello, my name is \" + name);\n\t}", "function printHello(){ console.log(\"Hello\") }", "function printMessage() {\n\tconsole.log(\"Hello world\");\n}", "function printGreeting() {\r\n console.log(\"Hi, I'm Thanhthanh Nguyen! I am not a creative person!\\n\" +\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Massaging the AST node so that it can be compared. This gets called by Prettier's internal code
function massageAstNode(ast, newObj) { // Handling ApexDoc if ( ast["@class"] && ast["@class"] === apexTypes.BLOCK_COMMENT && isApexDocComment(ast) ) { newObj.value = ast.value.replace(/\s/g, ""); } if (ast.scope && typeof ast.scope === "string") { // Apex is case insensitivity, but in son...
[ "function AST(){}", "function walkAST(node, parent) {\n\t\t\tif (!node)\n\t\t\t\treturn;\n\t\t\tfor (var key in node) {\n\t\t\t\tif (key === 'range')\n\t\t\t\t\tcontinue;\n\t\t\t\tvar value = node[key];\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\tfor (var i = 0, l = value.length; i < l; i++)\n\t\t\t\t\t\twalk...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IN: currentState is integer indicating the current state to work from OUT: return object with code and skip if found, otherwise gripe
lookupCode(currentState /*: integer */) /*: string */ { var foundState = this.table[currentState]; if (foundState !== undefined) { //found a currentState... return the code return foundState; } else { throw "[Scanner] lookupState: Invalid State Provided"; } }
[ "function nextState(state) {\n return {\n 'null': 'active',\n 'active': 'unpossible',\n // 'unpossible': 'active'\n }[state] || null;\n }", "function findState(json, wantedState){\n let i = 0;\n currentState = json[i].state;\n while(currentState != wantedState)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Connect to the notes window through a postmessage handshake. Using postmessage enables us to work in situations where the origins differ, such as a presentation being opened from the file system.
function connect() { const presentationURL = deck.getConfig().url; const url = typeof presentationURL === 'string' ? presentationURL : window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search; // Keep trying to connect until we get a 'connected' message...
[ "function connect() {\n\t\t\t// Keep trying to connect until we get a 'connected' message back\n\t\t\tvar connectInterval = setInterval( function() {\n\t\t\t\tnotesPopup.postMessage( JSON.stringify( {\n\t\t\t\t\tnamespace: 'reveal-notes',\n\t\t\t\t\ttype: 'connect',\n\t\t\t\t\turl: window.location.protocol + '//' +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get image of entity, or null. Recursive. The result is returned in the accumulator as an entity might eventually belong to multiple images (for example a reused tag)
static getImagesOfEntity(entityId, metastore, acc) { let metadata = metastore.getMetadataAbout(entityId); if(metadata.type === 'Image') { acc.push(entityId); return; } if(metadata.parents) { for (let i = 0; i < metadata.parents.length; ++i) { GlobalFunctions.getImagesOfEntity(m...
[ "_getImage() {\n let img =\n this.querySelector(`figure#${this.selection} > img`) ||\n this.querySelector(`figure > img`);\n return img ? `url(\"${img.src}\")` : undefined;\n }", "getImageNullObject() {\r\n return this.images[0];\r\n }", "_getImageObject(entityName){\n let widt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves a reference to a WorkerHandle associated with a FrameWorker and a new ClientPort.
function FrameWorker(url, clientWindow, name) { // first create the client port we are going to use. Laster we will // message the worker to create the worker port. let portid = _nextPortId++; let clientPort = new ClientPort(portid, clientWindow); let existingWorker = workerCache[url]; if (!existingWorker...
[ "get client() {\n return __classPrivateFieldGet(this, _WebWorker_client, \"f\");\n }", "[createWorker]() {\n const { options } = this;\n const { baseUri } = options;\n const worker = new HttpWorker(baseUri, this[pidValue]);\n worker.addEventListener('message', this[responseHandler]);\n wo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize a new event bus instance.
constructor() { this.bus = document.createElement('event-bus-singleton'); }
[ "function EventBus() {\n _classCallCheck(this, EventBus);\n\n this.registry = {};\n }", "function EventBus() {\n this.events = {}; // {name: Arrays.<function>}\n}", "constructor() { \n \n Event.initialize(this);\n }", "function EventAggregator() {\n\t\t\t/**\n\t\t\t * @property $event...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Translates the date value into an array of vox file URLs for playing the date. The date must be in the ISO8601 condensed format of YYYYMMDD. One or more fields may be left unspecified by substituting question mark characters ("?") for a numeric value. Output format will be in a localespecific ordering. The format speci...
function datePrompts(value, format) { if (value.length < 4) { return void 0; } if (value.length = 4) { value=value.concat("0000"); } else if (value.length = 6) { var i = "00"; value=i.concat(value); } var day = value.substr(0, 2); var month = value.substr(2, 2); var year = value.substr(4, 4); ...
[ "function datePrompts(value, format)\n{\n var year = value.substring(0, 4);\n var month = value.substring(4, 6);\n var day = value.substring(6, 8);\n var speakMonth;\n var speakDay;\n var speakYear;\n var speakDayOfWeek;\n var f = new Format();\n if (format != undefined) {\n speakM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
copyORIGINALToBowerJson: copy _ORIGINAL_bower.json > bower.json
function copyORIGINALToBowerJson(){ if (grunt.file.exists(ORIGINALFileName)){ grunt.file.copy(ORIGINALFileName, 'bower.json'); grunt.file.delete(ORIGINALFileName); } }
[ "function copyORIGINALToBowerJson(){\n if (grunt.file.exists(ORIGINALFileName)){\n grunt.file.copy(ORIGINALFileName, 'bower.json');\n grunt.file.delete(ORIGINALFileName);\n }\n }", "function bowerTask() {\n var json = JSON.stringify({\n name: package.name,\n descrip...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
uses innerWidth method as a conditional for displaying hamburger nav
function showHamburgerNav () { let hamburger = document.getElementById("hamburgerNav"); //let desktopNav = document.getElementById("desktop_nav"); if (window.innerWidth <= 375) { hamburger.display === "block"; } else { hamburger.display === "none"; } }
[ "function showSideNav(hamburger) {\n let sideNav = document.querySelector(\".side-nav\");\n if (hamburger.classList.contains(\"active\")) {\n sideNav.style.width = '100%';\n } else {\n sideNav.style.width = '0';\n }\n }", "renderNavigation() {\n if (this.state.windowWidth <= 524) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init get all endpoint GET '/'
initGetAllEndpoint() { this.router.get('/', (req, res) => this.getDAO() .getAll({ user: req.user }) .then(users => res.status(200).send(users)) .catch(err => { debug('[getAll]', err.message); return this.sendErr(res, 400, err.message); ...
[ "constructor() {\n super();\n const db = Database.getInstance();\n this.get('/fetchProfile', (req, res, next) => IndexRouter.fetchProfile(db, req, res, next));\n this.get('/fetchItems', (req, res, next) => IndexRouter.fetchItems(db, req, res, next));\n this.get('/fetchEvents', (req, res, next) => Ind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds all abundant numbers up to 'max'
function abundantNumbers(max) { var abundant = []; for (var i = 1; i <= max; i++) { if (Number.divisors(i).sum() > i) { abundant.push(i); } } return abundant; }
[ "function findAbundantNumbers(max) {\n const abundant = [];\n for (let number = 1; number < max; number++) {\n const properDivisors = [];\n const sqrt = Math.sqrt(number);\n for (let divisor = 1; divisor <= sqrt; divisor++) {\n if (number % divisor === 0) {\n pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Slice out a random chunk of the provided in data
function randomSubset(data) { return data.filter(d => Math.random() > 0.5); }
[ "randomStartingSlice () {\n let slice = Math.floor(Math.random() * Math.floor(ModuloBase))\n this.log(`Starting at data slice ${slice}/${ModuloBase}`)\n return slice\n }", "randomStartingSlice () {\n let slice = Math.floor(Math.random() * Math.floor(this.moduloBase))\n this.log(`Starting at data s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the (sample) value for the variable with the given name to the given value. Only specify the name of the variable, not its full path. The path to the source model has to be specified before using this method.
set(variableName, value) { if (!this.__hasVariables) { this.__recreateVariableMap(); } var variable = this.__variableMap[variableName]; if(!variable){ var message = 'A variable with name "' + variable.name + '" could not be found.'; throw new Error(message); } if(this.isTimeDependent){ if...
[ "setValue(variableName,value) {\r\n this.variables[variableName] = value;\r\n }", "set(name, value) {\n this.uniformsByName[name].value = value;\n }", "function @Set(variableName, value) {\n\ttry {\n\t\t//print(\"@Set\");\n\t\t//print(\"Var: \" + variableName);\n\t\t//print(\"Value: \" + val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close the dialog if `noCloseOnEsc` isn't set to true
_handleEscPress(e) { if (this.noCloseOnEsc) { e.preventDefault(); } }
[ "_handleEscPress(e){if(this.noCloseOnEsc){e.preventDefault();}}", "function checkEsc(name) {\r\n // Capture the Esc key to close the dialog.\r\n $(document).on(\"keyup.dialog\", function (event) {\r\n if (event.keyCode === 27) {\r\n event.stopPropagation();\r\n close(name);\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================================== / Player Details Generator / / ========================================= / fills in player details object
function getPlayerDetails() { getJob(); getLevel(); createStats(playerDetails.job, playerDetails.level); getName(); getRace(); getGender(); getDefense(); getExp(); }
[ "function playerInfo(playerName, playerCountry, ) {\n this.name = playerName; // Player's name\n this.country = playerCountry; // Player's choice\n}", "function playerInfo(playerName, playerChoice) {\n this.name = playerName; // Player's name\n this.choice = playerChoice; // Player's choice\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MCH_Save ========= MCH_Hide_Inputboxes ================ PR20230322
function MCH_Hide_Inputboxes() { console.log(" ----- MCH_Hide_Inputboxes ----") console.log(" mod_MCH_dict.meeting_count", mod_MCH_dict.meeting_count); console.log(" mod_MCH_dict.show_err_msg", mod_MCH_dict.show_err_msg); console.log(" mod_MCH_dict.has_changes", mod_MCH_dict....
[ "hideSaveButtons() {\n //TODO: implement it later. NO-OP for now.\n }", "function displaySaveBox () {\n $('.whitelist-overlay-save-dialog').show()\n $('.whitelist-rules-content').hide()\n displaySaveInputs()\n}", "hideSaveOptions() {\n $(\"#saveContainer\").toggleClass(\"displayNone\",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a bounding box as a string in format "minlon,minlat,maxlon,maxlat" that represents the intersection of the currentlyvisible map layer's bounding box and the viewport's bounding box.
function getIntersectionBBOX() { var mapBounds = map.getExtent(); var mapBboxEls = mapBounds.toBBOX().split(','); // bbox is the bounding box of the currently-visible layer var layerBboxEls = bbox.split(','); var newBBOX = Math.max(parseFloat(mapBboxEls[0]), parseFloat(layerBboxEls[0])) + ','; n...
[ "function BoundingBox() {\n var bounds = map.getBounds().getSouthWest().lng + \",\" + map.getBounds().getSouthWest().lat + \",\" + map.getBounds().getNorthEast().lng + \",\" + map.getBounds().getNorthEast().lat;\n return bounds;\n}", "function boundingBox() {\n var vPoints = copy.apply(undefined, argumen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove `value` from a sorted `array`. NOTE: This uses binary search algorithm for fast removals.
function arrayRemoveSorted(array, value) { var index = arrayIndexOfSorted(array, value); if (index >= 0) { arraySplice(array, index, 1); } return index; }
[ "function arrayRemoveSorted(array, value) {\n var index = arrayIndexOfSorted(array, value);\n\n if (index >= 0) {\n arraySplice(array, index, 1);\n }\n\n return index;\n }", "function arrayRemoveSorted(array, value) {\n const index = arrayIndexOfSorted(array, value);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Gets all migrationConfigurations
async function migrationConfigurationsList() { const subscriptionId = "SubscriptionId"; const resourceGroupName = "ResourceGroup"; const namespaceName = "sdk-Namespace-9259"; const credential = new DefaultAzureCredential(); const client = new ServiceBusManagementClient(credential, subscriptionId); const res...
[ "async getMigrators() {\n return this.api.query.migrationModule.migrators.entries();\n }", "function _migrationsGet(cb) {\n\t\t//console.log('_migrationsGet');\n\t\tvar query = connection.query('SELECT * FROM ??', ['_migrations'], function(err, rows, fields) {\n\t\t\tif(err) {\n\t\t\t\tcb(new Error('There was...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Api Url | Div Id in HTML | How many records you want | Whether or not you want to get actors
function GetData(url, containerId, limit, getActors, actorContId, dataType) { var settings = { "async": true, "crossDomain": true, "url": `${url}`, "method": "GET", "headers": {}, "data": "{}" } $.ajax(settings).done(function (response) { if (dataType === 'movies') { console.l...
[ "function loadActors() {\n fetch(\"http://localhost:3000/api/v1/actors\")\n .then(resp => resp.json())\n .then(actorsData => {\n allActors = actorsData\n addDivsToDom(actorsData)\n })\n}", "static async fetchListOfActors() {\n const url = APIService._constructUrl(`person/popular`);\n const respons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simple function that gets called if the user isn't a maintainer Its optional
noMaintainer({ msg, suffix }) { // This will run if the user tries to run a maintainer-only command but isn't a maintainer }
[ "async function isMaintainer (context) {\n const username = commenterUsername(context)\n const result = await context.github.repos.reviewUserPermissionLevel(context.repo({username}))\n\n const permission = result.data.permission\n return permission === 'admin' || permission === 'write'\n}", "function verifyMa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Navigates to the lab page
navigateToLabPage() { return this._navigate(this.buttons.lab, 'labPage.js'); }
[ "static goToPage () {\n\t\tNavigation.goToPageReal($(this).index())\n\t}", "verifyCurrentPage() {\n let currentPage = browser.getTitle();\n if (currentPage.includes(\"Info Dekoor\")) {\n allure.createStep('User is on Dashboard');\n }\n else { \n //super....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the diamonds array with random positions
generateDiamonds() { let count = 0; let randId; let diamondPositions = []; while(this.numDiamonds !== diamondPositions.length) { randId = `${Math.floor(Math.random() * this.xMax)},${Math.floor(Math.random() * this.yMax)}`; if (diamondPositions.indexOf(randId) === -1) { diamondPositions....
[ "function SpawnDiamonds()\n{\n //diamonds can be in cell 1 to 15\n let max = 15;\n let min = 1;\n for(let i = 0; i<5; i++)\n {\n //https://stackoverflow.com/questions/1527803/generating-random-whole-numbers-in-javascript-in-a-specific-range\n let x = Math.floor(Math.random()*(max - min+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HTTP call used to delete a Viewsite
deleteViewsite(requestData) { return axios({ url: '/delete/viewsites', method: 'delete', baseURL: API_LOCATION + '/api/v1/', headers: { 'Content-Type': 'application/json' }, data: { 'viewsiteId': requestData.viewsiteId } }); }
[ "handleDeleteViewsite(event) {\r\n // Prepare HTTP API request data\r\n let requestData = {};\r\n requestData.viewsiteId = event._id;\r\n // Send request to delete Viewsite\r\n this.manageViewsiteService.deleteViewsite(requestData)\r\n .then((results) => {\r\n // Afterwards, update Global Vie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear cache hash starts with given substring
function clearCacheStartingWith(cache, startsWith, callback) { for (var key in cache) { if (key.startsWith(startsWith)) { delete cache[key]; if (callback) callback(key); } } }
[ "function clearCookieStartWith(prefix) {\n var temp=document.cookie.split(\";\");\n var loop3;\n var ts;\n for (loop3 = 0; loop3 < temp.length;loop3++) {\n ts=temp[loop3].split(\"=\")[0];\n if (ts.indexOf(prefix) == 1) {\n \t\t\tdeleteCookie(ts);\n }\n }\n}", "function unset(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to find an item in the local storage Check if specific item and color are in the storage Return 0 if the item doesnt exist
function findMyItem(postResponse, answer){ keys = Object.keys(localStorage); length = parseInt(keys[0]); if (length != null){ length = parseInt(keys[0]); }else{ length = 1 ; } for (var i = 1 ; i <= length ; i++){ var array = localStorage.getItem(i); var json = JSON.parse(array); if(jso...
[ "function checkLocalStorage() {\n\n var flag = false;\n var favoriteArray = localStorage.getItem(\"key\");\n if (favoriteArray) {\n favoriteArray = JSON.parse(favoriteArray);\n for (var i = 0; i < favoriteArray.length; i++) {\n if (favoriteArray[i] == currSy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws broken bottle (sauce).
function drawBrokenBottle() { addObject(currentSauceImage, broken_bottle_x, broken_bottle_y, 0.25); }
[ "function drawThrownBottle() {\n timePassedSinceThrow = new Date().getTime() - lastThrowStarted;\n let gravity = Math.pow(9.81, timePassedSinceThrow / 200);\n throwBottle(timePassedSinceThrow, gravity);\n}", "function drawFail() {\n\t\t\tctx.save(); // save default state\n\t\t\tctx.scale(xscale,yscale); ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for redoing previos action, look at actionstack next action, apply it, shit index
function redoAction() { console.log('redoing action'); if (index < actionStack.length - 1) { let action = JSON.parse(actionStack[++index]) loadAction(action) //redraw things applyFilter(true) setUndoRedo(); } }
[ "function undoAction() {\n console.log('undoing action')\n if (index > 0) {\n let action = JSON.parse(actionStack[--index])\n loadAction(action);\n //redraw things\n applyFilter(true)\n setUndoRedo();\n }\n else if(index == 0){\n setDefaults();\n index--;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draws specified number of cards randomly from an array of cards
function drawCards(deck, num) { const hand = []; for (let i = 0; i < num; i++) { const idx = Math.floor(Math.random() * deck.length); hand.push(...deck.splice(idx, 1)); } return hand; }
[ "function draw(n) {\n var drawn = [];\n /* n random numbers from 0 to deck.length-1 */\n for (let i = 0; i < n; i++) {\n randomNumber = Math.floor(Math.random() * deck.length);\n /* find card at randomNumber and extract it, saving in drawn array */\n let card = deck.splice(randomNumber, 1);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
met. to set up new value of the widget
setValue(value){ const thisWidget = this; const newValue = thisWidget.parseValue(value); /* TODO: Add validation */ if(newValue !=thisWidget.value && thisWidget.isValid(newValue)){ thisWidget.value = newValue; thisWidget.announce(); } thisWidget.renderValue(); }
[ "updateValue() {\r\n this.getParent().setValue(this.state.value);\r\n }", "function updateControlValue() {\n const control = ui.getElement('input-container.input');\n $(control).find('option:first').trigger('change');\n }", "updateSlider_() {\n if (!this.sliderInput_) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
plays the current split item from it's beginning
function playCurrentSplitItem() { var splitItem = getCurrentSplitItem(); if (splitItem != null) { pauseVideo(); var duration = (splitItem.clipEnd - splitItem.clipBegin) * 1000; setCurrentTime(splitItem.clipBegin); clearEvents(); editor.player.on("play", { dur...
[ "skip () {\n const item = this.queue.nowPlaying\n if (!item && !this.queue._d.items.length) return\n if (!this.queue._d.items.length) return this.stop()\n this.queue._d.nowPlaying = this.queue._d.items.shift()\n this.audioPlayer.stop()\n this.play()\n this.queue.emit('updated')\n }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes all children from the component's canvas.
clearComponent() { if (this._canvas) this._canvas.removeChildren(); }
[ "removeChildren() {\n for (let child of this.state.children) {\n child.component.destructor();\n }\n\n this.state.children = [];\n this.state.childrenWatchedData = {};\n }", "removeAllChildren () {\n\t\tlet kids = this.children;\n\t\twhile (kids.length) { this._removeChil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns list of all songs in given key
function getSongsInKey(songList, key) { var newList = []; for(var i = 0; i < songList.length; i++) { if(convertToMajor(songList[i].songKey, songList[i].songQuality) === key) { newList.push(songList[i]); } } return newList; }
[ "function retrieveSongList() {\n\t\treturn _.pluck(instance.indexfile.songs, 'path');\n\t}", "function getAllSongs() {\n return new Promise((res, rej) => {\n db.getObjectStore((err, os) => {\n if (err) return rej(err);\n\n db.getAllFromStore(os)\n .then(songs => songs....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the current location active in the dropdown menue
function setCurrentActive(position) { var buttons = document.querySelectorAll(".dropdownContent a"); buttons.forEach((element, index) => { if (element.firstChild.firstChild.innerText === position.name) { element.firstChild.style.color = "#df6020"; buttons[index].style.color = "#df6020"; docume...
[ "function activateLocation(location) {\n // If any location is already active, deactivate it:\n $('#location-list').find('.active').removeClass('active');\n $('#location-info-list').find('.active').removeClass('active');\n\n $('#' + locationPathId(location)).addClass('active');\n $('#' + lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply the named material to material entity
function applyNamedMaterial(materialName) { // Set the selected material in UI dynamicData[STRING_MATERIAL].selectedMaterial = materialName; switch (materialName){ case CONFIG.STRING_DEFAULT: setMaterialPropertiesToDefaults(); dynamicData[STRING_MATER...
[ "applyMaterialVariant(entity, name) {\n const variant = name ? this.data.variants[name] : null;\n if (variant === undefined) {\n Debug.warn(`No variant named ${name} exists in resource`);\n return;\n }\n const renders = entity.findComponents(\"render\");\n fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }