query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Initializes the physics vortex event
function PhysicsVortexEvent(_scene,_origin,_radius,_strength,_height){this._scene=_scene;this._origin=_origin;this._radius=_radius;this._strength=_strength;this._height=_height;this._originTop=BABYLON.Vector3.Zero();// the most upper part of the cylinder this._centripetalForceThreshold=0.7;// at which distance, relativ...
[ "init() {\n\t\t'use strict';\n\t\tthis.createRenderer();\n\t\tthis.createScene();\n\n\t\tthis.clock = new THREE.Clock;\n this.clock.start();\n\n\n\t\twindow.addEventListener(\"keydown\", KeyDown);\n window.addEventListener(\"keyup\", KeyUp);\n\t}", "function PhysicsRadialExplosionEvent(scene){this._...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Download art assets from IPFS
async function downloadArt(dir) { var metaData = await getMeta(dir); var shaPath = hashPath + dir + '/roms/'; var files = await fsw.readdir(shaPath); socket.emit('emptymodal'); for await (var file of files) { var fileName = file.replace('.sha1',''); var fileExtension = path.extname(fileN...
[ "function d(){\n var filename = \"file.mei\";\n downloadFile(filename, output);\n}", "downloadLibrary(fileName, lib) {\n PersistenceController.downloadAsFile(fileName, lib);\n }", "function get_files_from_server(){\n //link with file containning the files and folders distribution\n fetch(\"h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
box up a JavaScript value and write it to the MVar synchronously
function h$writeMVarJs1(mv,val) { var v = (h$c1(h$data1_e, (val))); if(mv.val !== null) { ; mv.writers.enqueue([null,v]); } else { ; h$notifyMVarFull(mv,v); } }
[ "function update()\n{\n //set the ouput port to the value of the input port\n outResult.set(inVal.get());\n}", "function doSetValue(identifier,value,objectname,callbackname,randomnumber)\n{\n // JP TODO - temp hack to get rid of the value for strings and associated language data model elements\n var dot...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines the position of the loading indicator inside the element. Property type: VerticalAlignment
get loadingIndicatorPosition() { return this.nativeElement ? this.nativeElement.loadingIndicatorPosition : undefined; }
[ "function showLoadingStatus() {\n console.log(\"[menu_actions.js] Showing loading status\");\n showElementById(\"loading-status\");\n}", "function positionInsertIndicator(top, left, height, width) {\n var scrollX, scrollY;\n\n if (!_.isNumber(top) || !_.isNumber(left) || !_.isNumbe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the block set has a block at the location provided.
hasBlockAt(position) { const xVals = this.blocks.get(position.y); return (xVals && xVals.has(position.x)) || false; }
[ "has_block(type) { return (this.tracking_block(type)) ? this.blocks[type] : false; }", "tracking_block(type) { return this.blocks[type] !== undefined; }", "function isBuildingBlock(x, z) {\n\treturn buildingMap[x][z];\n }", "function isFree(aLocation) {\n //for (var liste in locations) {\n // for (va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chapter 101 RopeGroup Lucy might ask a friend to do waht she will not
function C101_KinbakuClub_RopeGroup_FriendOfAFriend() { if (ActorGetValue(ActorLove) >= 3) { OverridenIntroText = GetText("StayRightThere"); C101_KinbakuClub_RopeGroup_NoActor() C101_KinbakuClub_RopeGroup_CurrentStage = 661; } }
[ "function friendlyInter(ad) {\n const prob = Math.random();\n if (ad) { // if tweet is an add, make it more likely it was prompted by a friend's interaction\n return prob > 0.5; // if the interaction belongs to an ad (20% of cases), \n // then make 50% of them friend-inspired interactions\n }\n return pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
make a new QuadTree node (use pool to recycle if possible)
static make(x, y, w, h) { if (QuadTree.pool.length) return QuadTree.pool.pop().reset(x, y, w, h) return new QuadTree(x, y, w, h) }
[ "split () {\n\n const subWidth = this.bounds.width / 2\n const subHeight = this.bounds.height / 2\n const x = this.bounds.x\n const y = this.bounds.y\n\n this.nodes[0] = new QuadTree(this.level+1, new Rectangle(x + subWidth, y, subWidth, subHeight) )\n this.nodes[1] = new Q...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Will need: 1. user's name 2. user avatar 3. num questions asked 4. num questions answered
render() { // const { users, userId } = this.props // const user = users[userId] // const { name, avatarURL, answers, questions } = user // const answersArr = Object.keys(answers) // const numAnswers = answersArr.length // const numQuestions = questions.length // const score = numAnswers ...
[ "function review () { \n\tfor (var i = 0; i < questions.length; i++) {\n\t\tvar userChoice = $(\"input[name = 'question-\" + i +\"']:checked\");\n\t\tif (userChoice.val() == questions[i].correctAnswer) {\n\t\t\tcorrectAnswers++; \n\n\t\t\t} else {\n\t\t\t\tincorrectAnswers++;\n\t\t\t\t\n\t\t}\n\t}\n\t$(\"#correctAn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function takes the answer adds it to the newarr, empties the screen div of any content and then displays the answer from the equals function
function displayAnswer(){ newarr = []; newarr.push(answer); $('.screenp').empty(); $('.screenp').append(answer); }
[ "function equals(){\n $('.equals').on(\"click\", function(){\n arrNum = inputArray.join(\"\");\n joinedArray.push(arrNum);\n inputArray = [];\n switch(operator){\n case '+':\n answer = add(parseFloat(joinedArray[0]), parseFloat(joinedArray[1]));\n inputArray = [];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
puts a div in place of button txFn(gasPrice) should return a tx promise
function makeTxDiv($button, txFn) { const $e = $(` <div> <div class='gps'></div> <div class='btn'></div> <div class='status'></div> </div> `); const $status = $e.find(".status"); // init gps const gps = util.getGasPriceSlider(); gps.$head.remove(); gps.$refresh.show(); gps.refresh(); ...
[ "function showCost() {\n if (!showDiv(\"cost-tag\")) {\n writeToDiv(\"error\",\"Could no find tag <em>cost-tag</em>\");\n }\n\n}", "function upethprice(){\n //send info request to server\n fetch(API_ethprice+API_KEY)\n //when the server responds, do this\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When removing a bubble, animate the width and height down to 0 over 0.1 seconds and after the animation completes, remove the bubble from the DOM and decrement the bubblesLeft
function popBubble(bubble) { bubble.animate({ height: 0, width: 0 }, 100, function() { bubble.remove(); bubblesLeft--; }); }
[ "setupBackgroundBubbles(){\n let bubbleWrapper = document.getElementById(\"bubbleWrapper\");\n // while(bubbleWrapper.firstChild){\n // bubbleWrapper.removeChild(bubbleWrapper.firstChild); \n // }\n for(let i = 0; i < bubbleWrapper.children.length;i++){\n let bubble...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bot inherits from Paddle, has AI
function Bot(){ Paddle.call(this); this.x = game.width - 20 - this.width; this.yVelocity = 4; }
[ "function Player(){\n Paddle.call(this);\n \n this.x = 20;\n}", "giveAI() {\n\n this.isAI = true;\n\n this.AIcontroller = new AIController(this);\n\n\n }", "function Computer() {\n this.paddle = new Paddle(10, 170, 10, 50);\n}", "makeAIMove() {\n this.thinking = true\n\n const aiMove...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the Debug Images based on the given imageView Url
function updateDebugImages() { if (imageViewUrl) { setImage("birdseyeImage", imageViewUrl + '?type=birdseye&' + Math.random()); setImage("edgesImage", imageViewUrl + '?type=edges&' + Math.random()); setImage("linesImage", imageViewUrl + '?type=lines&' + Math.random()); } else { setImage("birdseyeImage", "...
[ "displayImages() {\n observeDocument(node => this.displayOriginalImage(node));\n qa('iframe').forEach(iframe => iframe.querySelectorAll('a[href] img[src]').forEach(this.replaceImgSrc));\n }", "updateconvertedurl() {\n // src is only actually required property\n if (this.src) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hilight current menu item
function currentMenuItem() { var cur_url = window.location.href; var firstChar = cur_url.indexOf("/", 7); var lastChar = cur_url.indexOf("/", firstChar + 1); if (lastChar > -1) { var cur_word = cur_url.substring(firstChar + 1, lastChar); } else { var cur_word = 'home'; } $('.menu li').each(function(){ ...
[ "function menuHighlightClick() {\n Data.Edit.Mode = EditModes.Highlight;\n updateMenu();\n}", "function theClickedItem(item) {\n setHighlightItem(item);\n }", "function highlightActiveSidenav() {\n // This events gets triggered on refresh or URL change\n $rootScope.$on('$stateChangeSuccess', fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert unformatted decklist string to json
function parseDeck(deckString){ var cleanDeckString = "[DECK]" + deckString + "[/DECK]" var deck = mtgparser(cleanDeckString, 'mtgs'); jsonToArray(deck); }
[ "function sc_list2string(l) {\n return new sc_String(sc_list2jsstring(l));\n}", "function getUserDeck(aDeck) {\n var myUrl = getProperty( '_url' );\n var myDeck = UrlFetchApp.fetch( myUrl + '&message=setDeckUnits' );\n var myDeckJson = JSON.parse( myDeck );\n var myCards = myDeckJson.user_decks[ aDeck ].un...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function sends out an email to the student and tutor providing details about the appointment (and acting as a reminder) Source Used: 9
function emailSend(results) { // results is returned from getResults() for (let i = 0; i < results.length; i++) { let userInfo = results[i]; // Send email to tutor about appointment let tutorEmailMsg1 = 'Hello, ' + userInfo[6] + '! '; let tutorEmailMsg2 = userInfo[0] + ' wants to be tutored by ...
[ "function notifyMember(site,personalMail,firstname,lastname,date){\n var body = \"Documents and information required for employee admission.\";\n var subject = \"Welcome to our company\";\n var options = {name:\"HR Team\",htmlBody:body,replyTo:\"hr@example.com\",from:\"hr@example.com\"};\n MailApp.sendEmail(p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
push the participantsdata in foodparty
PushParticipantsData(filter = {},participantsdata = {}){ return new Promise((resolve, reject) => { this.collection.updateOne(filter,{ $push: {participants : { $each: [participantsdata] } } }, (err, obj) => { if (err) { return reject({message: err, status: 0 }); } re...
[ "function addToParty() {\n\t\t$(this).remove();\n\t\tfellowship.append($(this));\n\t\t$(this).children().each(function() {\n\t\t\talert($(this).text() + \" has joined your party!\");\n\t\t});\n\t}", "function pushFood(){\n for(var i = 0; i < data.length; i++){\n nutrifit_db_food.push(data[i]);\n }\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
?? vX xAxis 0 3 vMath.xAxis() FL_V
static xAxis() { return newVec(1.0,0.0,0.0); }
[ "get xAxis() {\n // We just return the xAxis of the first chartItem selected in the workbench.\n for (let i = 0; i < this.chartableItems.length; i++) {\n for (let j = 0; j < this.chartableItems[i].chartItems.length; j++) {\n const chartItem = this.chartableItems[i].chartItems...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
matches a valid lat/long value
function is_valid_latlng(address) { return address.match(/^([-+]?[1-8]?\d(\.\d+)?|90(\.0+)?),?\s*([-+]?180(\.0+)?|[-+]?((1[0-7]\d)|([1-9]?\d))(\.\d+)?)(,\d+z)?$/); }
[ "function isValidLatLng(latLngAddress){\n if(latLngAddress.length!==2){\n return false;\n }\n const lat = latLngAddress[0];\n const lng = latLngAddress[1];\n const isLatitudeValid = isFinite(lat) && Math.abs(lat) <= 90;\n const isLongitudeValid = isFinite(lng) &...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes something that is not an operator object and returns an element matcher for equality with that thing.
function equalityElementMatcher(elementSelector) { if ((0, _Document.isOperatorObject)(elementSelector)) { throw Error('Can\'t create equalityValueSelector for operator object'); } // Special-case: null and undefined are equal (if you got undefined in there // somewhere, or if you got it due to some branch...
[ "EqualityExpression() {\n return this._BinaryExpression(\"RelationExpression\", \"EQUALITY_OPERATOR\");\n }", "function isEqualityComparison(node) {\n return (node.type === utils_1.AST_NODE_TYPES.BinaryExpression &&\n EQ_OPERATORS.test(node.operator));\n }", "function ExprEq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts this's Tile array into a texture filename array for passing to client.
tilesToTextures() { // Convert 1d array to 2d. for (var i = 0; i < this.dimension; i++) { let tempArr = []; for (var j = 0; j < this.dimension; j++) { tempArr.push(this.tiles[i * this.dimension + j].texture); } this.textureArray.push(tempArr); } // console.log(this.textureArray); ...
[ "function getSpriteNames() {\n\tvar loadspriteElements = $(i18n.loadspriteElement).get();\n\t\n\tfor (var i = 0; i < loadspriteCount(); i++) {\n\t\tsprites.push(loadspriteElements[i].getAttribute(i18n.loadspriteSpriteAttribute));\n\t}\n}", "loadTilesetImages() {\n\n // Load all the required tileset images\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Screen where the user searches for his name, and toggles his presence in the current event. It's the main screen of the App, implementing an attendance book functionality.
function SelfCheckInPage({ presenceList, dispatchPresenceAction, setCurrentEvent, currentEvent, }) { /** * Hook for person name search input */ const { value: personSearchToken, bind: bindPersonSearchToken } = useInput( "" ); /** * Avoids querying for each charact...
[ "function attend(event) {\r\n\t/* Get the attend button and change the class and inner html to attending */\r\n\tvar attend = event.children[5];\r\n\tattend.className = \"attending\";\r\n\tattend.innerHTML = \"\";\r\n\tvar spanAttending = document.createElement(\"span\");\r\n\tspanAttending.innerHTML = \"Attending\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper to read msgData ArrayBuffer
function MsgReader(msgArrBuf) { this.data = msgArrBuf; this.offset = 0; this.readUInt8 = function() { var val = this.data.getUint8(this.offset); this.offset += 1; return val; }; this.readUInt16 = function() { try { var val = this.data.getUint16(this.offset, false); //false for big endia...
[ "async onmessage(e) {\n if(!this.connected) return;\n\n if (typeof e.data === 'string') {\n if(this.debug) console.log(\"Received string: '\" + e.data + \"'\");\n }\n else {\n // note: this fails on FireFox 83 due to Blob.arrayBuffer()\n // promise: the \"await\" results ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tries to statically detect if a statement is executed only once. Restrictions: Does not take into account runtime execution problems, such as exceptions; Does not detect if the function is called indirectly through a function pointer;
static isExecutedOnce($statement) { if (!$statement.instanceOf("statement")) { throw ( "isExecutedOnce(): function expects a statement, received '" + $statement.joinPointType + "'" ); } // Go back until it finds the function body var $currentScope = $statement.ancest...
[ "function once$1() {\n let first = true;\n return async () => {\n if (first) {\n first = false;\n return true;\n }\n return false;\n };\n}", "function once(callback) {\n let count = 0;\n let result;\n\n function innerFunc(num){\n if(count === 0){...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscribe an event handler for a particular event.
_subscribe(eventType, eventHandler) { if (Object.keys(this.handlersMap).length === 0) { this.eventTarget.addEventListener('message', this.boundEventHandler); } if (!this.handlersMap[eventType]) { this.handlersMap[eventType] = new Set(); } this.handlersMap[eventType].add(eventHandler); ...
[ "subscribe(eventType, handler) {\n let subscribers = this.events.get(eventType);\n if (!subscribers) {\n subscribers = new Set();\n }\n subscribers.add(handler);\n this.events.set(eventType, subscribers);\n }", "function sendEvent(event) {\n $.each(subscribers, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the hexagons they're squares rn not anymore!!!!!
function makeHexagons(){ var hexX = 0; var hexY = 0; for(var i = 0; i < 91; i++){ hexagons[i][1][0] = hexX; hexagons[i][1][1] = hexY; hexY += 1; if(hexX == 9 && hexY == 7){ hexX += 1; hexY = 5; } if(hexX == 8 && hexY == 8){ hexX += 1; hexY = 4; } ...
[ "function generateHex() {\n const rad = Math.floor(Math.random() * Math.floor(50) + 1);\n\n let hexagon = new Hexagon(rad); // see src/js/Hexagon.js\n\n return hexagon;\n}", "function recolorHexGrid() {\n for (let hex of hexArray) {\n hex.randomizeColors();\n }\n}", "function pointy_hex_corner(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The active lights are the lights that are attached to a node in the scene.
static GetActiveLights() { return s_lightRegister; }
[ "get lightsOn()\r\n\t{\r\n\t\treturn this._lightsOn;\r\n\t}", "getTrafficLights() {\n\t\treturn TRAFFIC_LIGHTS;\n\t}", "getTrafficLights() {\n\t\treturn this.trafficLights;\n\t}", "setYellowLights() {\n\t\t// Get the array traffic lights from the config\n\t\tlet lights = this.config.getDirections()[this.getDi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update statistics link to reflect current settings
function updateStatsLink() { const statsLink = document.getElementById("stats-link") let statsLinkUrl = statsLink.getAttribute("href") let query = statsLinkUrl.indexOf('?'); if (query > 0) { var statsLinkUrlNew = statsLinkUrl.substring(0, query); } else { var statsLinkUrlNew = statsL...
[ "function updateFeedLink() {\n var bounds = map.getPixelBounds(),\n nwTilePoint = new L.Point(\n Math.floor(bounds.min.x / markers.options.tileSize),\n Math.floor(bounds.min.y / markers.options.tileSize)),\n seTilePoint = new L.Point(\n Math.floor(bounds.max.x / markers.options.til...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles form behavior for when the restart button is clicked
function handleRestartButton() { STORE.restart = true; // User is restarting $('.js-quiz-restart-button').prop('disabled', true); // Disable restart button renderDefaultPage(); STORE.restart = false; }
[ "function handleRestartButton() {\n $('div').on('click', '.js-restart-button', function(event) {\n event.preventDefault();\n location.reload();\n });\n}", "function handleRestartQuiz() {\n $('main').on('click', '#restart-quiz-btn', event => {\n console.log(\"Restarting Quiz\");\n\n STORE.quizStarte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method creates the elements that are specific for the Userobject.
function createElements() { var page = document.getElementById('page-content-wrapper'); var img = document.createElement('img'); img.setAttribute("class", "picture"); img.setAttribute("src", "../img/profile/" + current.pic); var name = document.createElement...
[ "function update_user_elements() {\n $('.echo-item-authorName, .echo-item-avatar').each( function() {\n if(!$(this).hasClass('initialized')) {\n var container = $(this).parents('.echo-item-container');\n \n var userName = container.find('.echo-item-authorName').te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a vector with the maximum values from the left and right vectors
static Maximize(left, right) { const max = new Vector4(left.x, left.y, left.z, left.w); max.maximizeInPlace(right); return max; }
[ "function largestAxisVec(dimensions) {\n var dimensionArray = [];\n for (var key in dimensions) {\n dimensionArray.push(dimensions[key]);\n }\n return Math.max.apply(null, dimensionArray);\n}", "function getMinMax(vectors, baseVector) {\n var min = Infinity;\n var max = -1*Infinity;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instantiates a new node object, copies the features and adds the node to the graph, but does NOT clone it's edges
cloneAndAddNode(node) { let new_node = new $N.BaseNode(node.getID()); new_node.setFeatures($DS.clone(node.getFeatures())); this._nodes[node.getID()] = new_node; this._nr_nodes += 1; return new_node; }
[ "constructor(nodesToRemove, nodesToAdd) {\n this.nodesToRemove = nodesToRemove;\n this.nodesToAdd = nodesToAdd;\n }", "clone() {\n var newNetwork = new Network();\n\n newNetwork.nodeNumber = this.nodeNumber;\n\n for (let layer = 0; layer < this.nodes.length; layer++) {\n newNetwork.nodes.push...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ensures that a stream is set as active, will set the passed in stream as the active stream if none exists
_ensureActiveTask() { if (!this._activeStream) { const stream = this._findActiveTaskCandidate(); this._activeStream = stream; // In some cases there may be no streams which we can make active if (stream) { this._writeTaskBuffer(stream); ...
[ "function onStreamActive(stream, handler) {\n stream.once('data', handler)\n}", "_findActiveTaskCandidate() {\n for (const stream of this._streams) {\n if (stream.state === StreamState.Open && stream !== this._activeStream) {\n return stream;\n }\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The preferred results of the data is nested into an object called bindings which is nested in an object called results. This function returns the preferred data.
function showResults(data) { return data.results.bindings; }
[ "formatSearchResults(rawResults) {\n const results = new Array();\n if (typeof (rawResults) === \"undefined\" || rawResults == null) {\n return [];\n }\n const tempResults = rawResults.results ? rawResults.results : rawResults;\n for (const tempResult of tempResults) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads letter for letter view screen
function loadLetter(context, letterID, SID) { getRequest({ message: { action: 'letter', id: letterID }, SID: SID, onsuccess: function (data) { viewLetter(context, data.letter); } }); load...
[ "function getLetterChoice(title = 'Let\\s Play!', text = 'Choose your letter') {\r\n\r\n // user modal letter choice\r\n let pickedLetter = '';\r\n\r\n // misc messages to diplay at game start\r\n const startMessages = [\r\n 'Let\\'s Play',\r\n 'Let\\'s Dance',\r\n 'Let\\'s Tango',\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends nodes to a target projection place. Nodes to insert were previously redistribution and stored on a component host level.
function appendProjectedNodes(lView, tProjectionNode, selectorIndex, componentView) { var projectedView = componentView[PARENT]; var componentNode = componentView[T_HOST]; var nodeToProject = componentNode.projection[selectorIndex]; if (Array.isArray(nodeToProject)) { appendChild(nodeToProject, ...
[ "function addTargetsToDOM(){\n\t//add left target\n\tvar matrix = new THREE.Matrix4();\n\tmatrix.set(0.001, 0.000, 0.000, -0.175,0.000, 0.001, 0.000, 0.000,0.000, 0.000, 0.001, 0.000,0.000, 0.000, 0.000, 1.000);\n\tvar position = new THREE.Vector3();\n\tvar quaternion = new THREE.Quaternion();\n\tvar scale = new TH...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Navigates to the abstract page from the proquest results, Returns true if this can occur, and false if it is impossible
function goAbstractPage(page) { injectClickFunction(page); return page.evaluate(function() { var abstractLink = document.querySelector('.format_abstract'); if (abstractLink) { doClick(abstractLink); return true; } else { return false; } }); }
[ "async isCorrectPageOpened() {\n let currentURL = await PageUtils.getURL()\n return currentURL.indexOf(this.pageUrl)!== -1\n }", "function goCorrectTab(page) {\n injectClickFunction(page);\n return page.evaluate(function() {\n var allResultsLink = document.querySelector('#allResults a');\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lowlevel function that compiles the given `tokens` into a function that accepts two arguments: a Context and a Renderer. Returns the body of the function as a string if `returnBody` is true.
function compileTokens(tokens, returnBody) { if (typeof tokens === "string") { tokens = parse(tokens); } var body = ['""']; var token, method, escape; for (var i = 0, len = tokens.length; i < len; ++i) { token = tokens[i]; switch (token.type) { case "#": case "^": ...
[ "renderTokens(tokens, view, partials, originalTemplate, tags) {\n const context = (view instanceof Context) ? view : new Context(view);\n let buffer = '';\n for (const token of tokens) {\n let value;\n switch (token[0 /* $.TYPE */]) {\n case '#':\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the Pacific Standard Time or Pacific Daylight Time offset (480 or 420, the reverse sign of what would be returned by JavaScript's weird Date `getTimezoneOffset()` method) depending on whether the given (or by default, current) date falls within standard or daylight time.
function pacificTimeOffset(date) { return isDaylightTime(date) ? PDT : PST; }
[ "function calculate_time_zone() {\n\tvar rightNow = new Date();\n\tvar jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0); // jan 1st\n\tvar june1 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0); // june 1st\n\tvar temp = jan1.toGMTString();\n\tvar jan2 = new Date(temp.substring(0, temp.lastIndexOf(\" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add inline content `inline` to `li`. inline comes from processInline so is an array of content
function add(li, loose, inline, nl) { if ( loose ) { li.push( [ "para" ].concat(inline) ); return; } // Hmmm, should this be any block level element or just paras? var add_to = li[li.length -1] instanceof Array && li[li.length - 1][0] == "para" ? li...
[ "function addInline(payload, inline) {\n return addAttachment(payload, inline, true);\n }", "function addInline(label) {\n\t var list = $('#' + label + '-list');\n\t var length = list.children().length;\n\t switch (label) {\n\t // Build facilitator element\n\t case 'facilitator':\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates letter list and turns red if letter is choosen
Letters(guesses){ let guessDiv = document.querySelector("#guessDiv") guessDiv.innerHTML = "" let alphaFirst = ["a", "c", "e", "g", "i", "k", "m", "o", "q", "s", "u", "w", "y"]; let alphaSecond = ["b", "d", "f", "h", "j", "l", "n", "p", "r", "t", "v", "x", "z"]; let ul = docume...
[ "function addPhraseToDisplay(arr) {\n for (let i = 0; i < arr.length; i++) {\n //Select the current character\n let currentChar = arr[i];\n //create a list item\n let li = document.createElement('li');\n //add character to the li\n li.textContent = currentChar;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function checks if the syntax for updateRank
function isUpdateRank(req,res) { return checkTable(req,'pointOfInterest') && isColumnEqualToNumber(req,'rank') && isConditionEqualToString(req,'name') }
[ "setRank(rank)\n\t{\n\t\tswitch (rank)\n\t\t{\n\t\tcase'2':\n\t\tcase'3':\n\t\tcase'4':\n\t\tcase'5':\n\t\tcase'6':\n\t\tcase'7':\n\t\tcase'8':\n\t\tcase'9':\n\t\tcase'J':\n\t\tcase'Q':\n\t\tcase'K':\n\t\tcase'A':\n\t\tcase'j':\n\t\tcase'q':\n\t\tcase'k':\n\t\tcase'a':\n\t\tcase't':\n\t\tcase'T':\n\t\t\tthis.rank =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Comments can be in serveral places. Those comment 'types' are defined in CommentType enumeration. The 'seqid' is the sequence number (or other sequence specifier) of the comment within that type.
function getCommentHtmlId(type, seqid) { return "CommentId_" + type + "_" + seqid; }
[ "set comments(aValue) {\n this._logService.debug(\"gsDiggEvent.comments[set]\");\n this._comments = aValue;\n }", "comments(node, { value: text, type }) {\n return type === 'comment2' && bannerRegex.test(text)\n }", "function requireCom() {\n return this.feedbackType === 'comment...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The body of our custom Web Worker. It expects to receive messages in the form of JSON objects, each containing `label` and `msg`. `label` describes the kind of message the message is. `msg` holds the actual message. Messages of the type 'job' expect the message to be in the form of function components. (See `fnComponen...
function workerBody() { var that = this, lambda, evalInContext, handleErr; /* * Evaluates code within a custom context. This is not * used in our main application thread and happens only when * when we assign a job to a real Web Worker. Thus it does not * hurt performance in our main thread and doesn't...
[ "function MessageForJob(job_label/*TYPES.string.address()*/, operation /*TYPES.char.ptr*/) {\n\t// launch_data_alloc returns something that needs to be freed.\t\n\tvar message = launch_data_alloc(CONSTS.LAUNCH_DATA_DICTIONARY);\n\tconsole.info('message:', message, message.toString(), uneval(message));\n\t\n\tif (me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List tournament records for a given owner.
listTournamentRecordsAroundOwner(bearerToken, tournamentId, ownerId, limit, expiry, options = {}) { if (tournamentId === null || tournamentId === void 0) { throw new Error("'tournamentId' is a required parameter but is null or undefined."); } if (ownerId === null || ownerId === void 0) { ...
[ "listTournamentRecordsAroundOwner(session, tournamentId, ownerId, limit, expiry) {\n return __async(this, null, function* () {\n if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {\n yield this.sessionRefresh(session);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use geographic coordinates (WGS84 datum) in API methods. Note that this method is not yet a part of the stable API. Support for user projections is not yet complete and should be considered experimental.
function useGeographic() { setUserProjection('EPSG:4326'); }
[ "toDefaultProjection(lat, long) {\n return ol.proj.transform([long, lat], 'EPSG:4326', 'EPSG:3857');\n }", "function hackMapProjection(lat, lon, originLat, originLon) {\n var lonCorrection = 1.5;\n var rMajor = 6378137.0;\n\n function lonToX(lon) {\n return rMajor * (lon * Math.PI / 180);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exportCrosstab if a viz is rendered, delete it
function exportCrosstab(sheetName){ if (mainViz === null){ alertOrConsole('Viz must be rendered before it can be downloaded as a Crosstab'); } else { mainViz.showExportCrossTabDialog(); } }
[ "function hideViz() {\n viz.hide();\n}", "function renderViz() {\n\n // Define variables for viz\n var mainVizDiv = $(\"#tableauViz\");\n var mainVizOptions = {\n hideTabs: true,\n hideToolbar: true,\n //toolbarPositon: top, // (or \"bottom\")\n width: 850,\n height: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::AppSync::FunctionConfiguration.AppSyncRuntime` resource
function cfnFunctionConfigurationAppSyncRuntimePropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnFunctionConfiguration_AppSyncRuntimePropertyValidator(properties).assertSuccess(); return { Name: cdk.stringToCloudFormation(properties.name), ...
[ "function cfnResolverAppSyncRuntimePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnResolver_AppSyncRuntimePropertyValidator(properties).assertSuccess();\n return {\n Name: cdk.stringToCloudFormation(properties.name),\n Runtim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Keeps a consistent size in all portlet lists
function saveListSize() { var $this = $(this); $this.css('min-height', $this.height()); }
[ "function refreshListSize()\n{\t\n\tallListItems = document.querySelectorAll('ul>li');\n\tsizeOfList = allListItems.length;\n}", "calculateLayoutSizes() {\n const gridItemsRenderData = this.grid.getItemsRenderData();\n this.layoutSizes =\n Object.keys(gridItemsRenderData)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var arr1 = [1, 2, 2, 3, 4], arr2 = [2, 1, 2, 4, 3], arr3 = [1, 2, 3, 4], arr4 = [1, 2, 3, "4"] arraysSimilar(arr1, arr2); // Should equal true arraysSimilar(arr2, arr3); // Should equal false arraysSimilar(arr3, arr4); // Should equal false
function arraysSimilar(arr1, arr2) { var arr1Length = arr1.length; var arr2Length = arr2.length; var arr1Obj = {}; var arr2Obj = {}; var similar = true; if(arr1Length !== arr2Length){ return false; } for(var i = 0; i < arr1Length; i++){ var indexVal = JSON.stringify(arr1[i]); if(arr1Ob...
[ "function eqArrs_QMRK_(a1, a2) {\n let ok_QMRK_ = true;\n if( (a1.length == a2.length) ) {\n if (true) {\n a1.forEach(function(v, k) {\n return ((!eq_QMRK_(a2[k], v)) ?\n (ok_QMRK_ = false) :\n null);\n });\n }\n }\n return ok_QMRK_;\n}", "function same(arr1, arr2) {\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of function Run / Name: OnReadyStateChange / Description: Handles ready state changes of the control.
function OnReadyStateChange(state){ try { return; // READYSTATE_COMPLETE = 4 if (4 == state){ Init(); Run(); }/* end of if statement */ } catch(e) { e.description = L_ERRORUnexpectedError_TEXT; HandleError(e); return; } }
[ "function readyStateChangePoll() {\n\t\t\tif( asyncRequest.req.readyState == 4 ) {\n\t\t\t\tprocessResponse();\n\t\t\t}\n\t\t}", "function onDeviceReady() {\n\t$(\"#status\").html(\"Status: Ready! 1\");\n}", "function checkReadyState() {\n\t\t\t\tif (doc.readyState == 'complete') {\n\t\t\t\t\t// Clean-up\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END SHARED BETWEEN admin/community AND explore/communities /BEGIN SHARED BETWEEN explore/spaces AND edit/spacePermissions Populates the space details of the currently selected space and queries for the primitives of any fieldsets that are expanded
function populateSpaceDetails(jsonData, id) { // If the space is null, the user can see the space but is not a member if (jsonData.space == null) { // Go ahead and show the space's name $('.spaceName').fadeOut('fast', function() { var spaceName = $('.jstree-clicked').text(); $('.spaceName').text(spaceName)....
[ "function updateParkingLotSpaces(){\n $scope.parkingLotSpaces = getParkingLotSpaces();\n $scope.availableParkingSpacesNo = getAvailableParkingSpotsNr();\n }", "function updateNavigationSettingsOfSpace(res, accountData, spaceId, callback) {\n var activityTab = '';\n var overviewTab = '';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete the current room (OP only or last person in a private room)
deleteCurrentRoom() { this.sendMessage(`/roomdelete`); }
[ "onDeleteChatRoom(socket) {\n socket.on('delete', (roomId: number) => {\n const room: ChatRoom = this.roomProvider.getModel(roomId);\n if (!room) return;\n this.roomProvider.deleteModel(roomId);\n room.users.forEach(user => {\n user.chatRooms = user....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Search the people born in the 197 and returning a formatted texte about it
bornInThe70() { let content = this.title("Entrepreneurs né dans les 70's&nbsp;") + this.people .filter(person => /^197\d$/.test(String(person.year))) .map(person => this.line(`${person.first} ${person.last}, année de naissance : ${person.year}`)) .join...
[ "function searchByDateOfBirth(people){\n let dateOfBirth = promptFor(\"Please enter the date of birth: xx/xx/xxxx format\", validateDate);\n let dateOfBirthStringify = dateOfBirth.split(\"/\");\n if(dateOfBirthStringify[0][0] == 0)\n {\n dateOfBirthStringify[0] = dateOfBirthStringify[0][1];\n date...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a random left value, within the width of the window
function getRandomLeft() { return Math.floor((Math.random() * window.innerWidth) + 1) + "px"; }
[ "function getLeftPosition() {\n return randomFunction(0, viewportWidth - 100);\n}", "getLeftCornerPos() {\n return new THREE.Vector3(\n (-CLOTH_SIZE * this.guiOptions.particle_distance) / 2,\n CLOTH_SIZE * this.guiOptions.particle_distance + CLOTH_TO_FLOOR_DISTANCE,\n 0\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : showConsolePopUp AUTHOR :Juvindle C Tina DATE : March 26, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : open popup for console PARAMETERS : device
function showConsolePopUp(device,devicesArr){ validDevices = device; validSessionDevices = devicesArr; if(globalDeviceType == "Mobile"){ $.mobile.changePage("OpenConsole", { transition: "flow", reverse: false, changeHash: true }); }else{ $( "#Console" ).dialog({ modal: true, autoResize:true, ...
[ "function openConsoleDevice(){\n\tif(glblDevMenImg != undefined && glblDevMenImg != null){\n\t\t$('#deviceMenuPopUp').dialog('close');\n\t}\n\tif(globalInfoType == \"JSON\"){\n\t\tdevicesArr = getDevicesNodeJSON();\n\t}\n\tif(devicesArr.length == 0){\n\t\talerts(\"No devices available in the canvas.\");\n\t}\n\tvar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an instance of the AgendaWrapper.
static async instance() { if (!instance) { instance = new AgendaWrapper(); await instance.start(); } return instance; }
[ "makeAspect() {\n return new Aspect();\n }", "data () : DataClient {\n if (!this.announcement) {\n throw new Error(\"No handler configured, call open()!\")\n }\n\n return new DataClient(this.appID, this.appAccessKey, this.announcement.mqttAddress)\n }", "static getInstance(emitt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rounding to double grid.
function roundToDoubleGrid(v) { return Math.sign(v) * Math.round(Math.abs(v * 2)) / 2; }
[ "function roundToGrid(numb) {\n\treturn Math.round(numb/10) * 10;\n}", "function matrix_round(A,d)\n{\n var d = -1 * d;\n var M = [];\n for(var i = 0; i < A.length; i++)\n {\n M[i] = [];\n for(var j = 0; j < A[0].length; j++)\n {\n M[i][j] = Math.round10(A[i][j],d);\t\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes a stop name and returns its ID for searching the database
function stopNameToId(name) { // If the stop is one with duplicate names // we use the number after it to find it's ID // eg. Newry Stop 2 would be the 3rd ID associated with Newry var splits = name.split("Stop"); if (splits.length == 2) { baseName = splits[0].trim(); num = parseInt(splits[1]) - 1; } else...
[ "function getStationId(stationName, bound) {\n\tvar stationIdCursor = Stops.find({\n\t\t\"stop_name\": stationName,\n\t\t\"platform_code\": bound\n\t},{\n\t\tfields: {\n\t\t\t\"stop_id\": 1\n\t\t}\n\t});\n\n\tvar stationIdFetched = stationIdCursor.fetch()\n\n\tif (stationIdFetched.length !== 0) {\n\t\tvar stationId...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether the current selection is complete. In the case of a single date selection, this is true if the current selection is not null.
isComplete() { return this.selection != null; }
[ "function isReady(){\n if( events.length > 1 ){\n alert(\"Bitte nur eine auswählen\");\n return\n }\n \n if( selectedEvent.status === \"disabled\" ){\n alert(\"Eintrag ist disabled und kann nicht erstellt werden\");\n return\n }\n \n if( selectedEvent.status != \"\" ){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retry If all attempts were made, returns. Otherwise, inits and sends the next attempt.
retry() { if ((this.attempts + 1) === this.config.attempts) { window.clearInterval(this.timer); return; } this.attempts++; this.init(); this.send(); return; }
[ "function attempt() {\r\n connections[id].attempts++;\r\n if (connections[id].attempts > retry) {\r\n connections[id].attempts = 0;\r\n connections[id].deny++;\r\n self.log(chalk.yellow(\"Access denied: too many attempts.\"));\r\n callback(\"Access denied: too many attempts.\",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PAGE STYLESHEETS API for adding a new stylesheet to all components. styleRules should be a string of CSS rules. restorePlace defaults to true. Returns a sheet index value that can be used with updatePageStyles and removePageStyles.
function addPageStyles(styleRules, restorePlace) { return changingStylesheet(function () { p.stylesheets.push(styleRules); var sheetIndex = p.stylesheets.length - 1; var i = 0, cmpt = null; while (cmpt = p.reader.dom.find('component', i++)) { addPageStylesheet(cmpt.contentDocument, ...
[ "function updatePageStyles(sheetIndex, styleRules, restorePlace) {\n return changingStylesheet(function () {\n p.stylesheets[sheetIndex] = styleRules;\n if (typeof styleRules.join == \"function\") {\n styleRules = styleRules.join(\"\\n\");\n }\n\n var i = 0, cmpt = null;\n while (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the key pressed is a printable character and can be used for shortcut navigation
function isPrintableCharacter(event) { var { key } = event; return key.length == 1 || key.length > 1 && /[^a-zA-Z0-9]/.test(key); }
[ "function isKeyPressedValid(e) {\n return (e.keyCode == 8 || e.keyCode == 46) || // backspace and delete keys\n (e.keyCode > 47 && e.keyCode < 58) || // number keys\n (e.keyCode == 32) || // spacebar & return key(s)\n (e.keyCode > 64 && e.keyCode ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a pair of media_label_type and media_label_values control into an autocomplete
function makeAnyMediaLabelAutocomplete(valueControl,typeControl) { $('#'+valueControl).autocomplete({ source: function (request, response) { var media_label_val = $('#'+typeControl).val(); $.ajax({ url: "/media/component/search.cfc", data: { term: request.term, media_label: media_...
[ "function makeMediaLabelAutocomplete(valueControl,media_label) { \r\n\t$('#'+valueControl).autocomplete({\r\n\t\tsource: function (request, response) { \r\n\t\t\t$.ajax({\r\n\t\t\t\turl: \"/media/component/search.cfc\",\r\n\t\t\t\tdata: { \r\n\t\t\t\t\tterm: request.term, \r\n\t\t\t\t\tmedia_label: media_label, \r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update uniform (prop) transitions. This is called in updateState, may result in model updates.
_updateUniformTransition() { // @ts-ignore (TS2339) internalState is alwasy defined when this method is called const { uniformTransitions } = this.internalState; if (uniformTransitions.active) { // clone props const propsInTransition = uniformTransitions.update(); const props = ...
[ "_updateAttributeTransition() {\n const attributeManager = this.getAttributeManager();\n\n if (attributeManager) {\n attributeManager.updateTransition();\n }\n }", "updateTransition() {\n const {\n attributeTransitionManager\n } = this;\n const transitionUpdated = attributeTransitionM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Count arcs in a collection of layers
function countArcsInLayers(layers, arcs) { var counts = new Uint32Array(arcs.size()); layers.filter(layerHasPaths).forEach(function(lyr) { countArcsInShapes(lyr.shapes, counts); }); return counts; }
[ "function getLayerCounts(input, area) {\n const layers = [];\n for (const layer of getLayers(input, area)) {\n const map = {};\n for (let char of layer) {\n map[char] = (map[char] || 0) + 1;\n }\n layers.push(map);\n }\n return layers;\n}", "function getSelectedLayersCount(){\n\t\tvar res = n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update price based on age
updatePrice() { }
[ "async price_update() {}", "set price(value) {\n this._price = 80;\n }", "function updateTaxForPrice(rates, price) {\n var priceEffective = moment(moment(price.effectiveDate).utc().format('YYYY-MM-DD')).toDate();\n if (priceEffective < new Date()) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses and returns a term.
parseTerm() { const startPos = this.tok.pos; // Parse groups and elements let items = []; let electron = false; let next; while (true) { next = this.tok.peek(); if (next == "(") items.push(this.parseGroup()); else if (ne...
[ "function Term() {\n var node = new Node('Term');\n p.child.push(node);\n p = node;\n if (!Factor()) {\n return false;\n } else {\n p = node;\n return TermTail();\n }\n }", "function WordParser () {}", "term() {\n let node = this.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserclose_statement.
visitClose_statement(ctx) { return this.visitChildren(ctx); }
[ "visitExit_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitOpen_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
College Related Functions ALL COLLEGE FUNCTIONS count the number of colleges from database
static async countColleges(){ const result=await pool.query('SELECT COUNT(collegecode) AS count FROM college'); return result[0].count; }
[ "static async countCourses(){\n const result=await pool.query('SELECT COUNT(coursecode) AS count FROM course');\n return result[0].count;\n }", "function getCollaborations(){\n\tvar collaboration = 0;\n\tfor(var i = 0; i < agency.length; i++)\n\t{\n\t\tcollaboration += parseInt(agency[i].agency_c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For mailing to all subscribers
sendEmailList (e, template) { var subscribers = this.getSubscribers(); //list of subscriber objects subscribers.forEach((subscriber) => {this.sendEmail(e, template, subscriber)}); console.log('Emails sent') }
[ "handleSubscribe (e, template) {\n this.subscribeModal.current.toggle();\n this.sendEmailList(e, template); // TURN THIS OFF WHEN TESTING (there is a 200 email quota)\n console.log(\"New subscriber\");\n }", "function subscribeNewsletter() {\n $.fb_service.subscribeNewsletter(this.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the percent down an edge that a point appears.
function _getPercentOfEdgeFromPoint(rect, direction, valueOnEdge) { switch (direction) { case RectangleEdge.top: case RectangleEdge.bottom: return rect.width !== 0 ? (valueOnEdge.x - rect.left) / rect.width * 100 : 100; case RectangleEdge.left: cas...
[ "function getFractionThroughRefPoint(refPointOffset, regionInfo) {\n var bottom = regionInfo.offsetTop + regionInfo.height;\n var fraction = (bottom - refPointOffset) / regionInfo.height;\n return Math.max(0, Math.min(1, fraction));\n }", "function clickPercent(event) {\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add preview events listeneres
function previewEvents() { var current = jQuery(s_selector).find('.item.current'); var node_id = current.attr('node'); if (data[node_id] && !data[node_id].video && data[node_id].b_img) { jQuery(p_selector).find('img.preview').css('cursor', 'pointer').click(function(event) { event = event || window.ev...
[ "_defineListeners() {\n this.editor.model.on('insertContent', (eventInfo, [modelElement]) => {\n if (!isDrupalMedia(modelElement)) {\n return;\n }\n this.upcastDrupalMediaIsImage(modelElement);\n // Need to upcast DrupalMediaType to model so it can be used to show\n // correct but...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====================================================================================== Mostra a Configuracao do Applet =======================================================================================
function showConfig() { theApplet.showConfiguration(); }
[ "function applet_setup() {\n for (key in applet_subs) {\n sub = applet_subs[key];\n if (typeof(applet[sub]) == 'undefined') {\n eval('applet.' + sub + '=function() {};');\n }\n }\n}", "function ConfigFunction () {\n\n\n }", "function config() {\n\toutlet(0, 'host', addr_broadcast);\n\toutlet(0,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes a new instance of `XMLRaw` `text` raw text
constructor(parent, text) { super(parent); if (text == null) { throw new Error("Missing raw text. " + this.debugInfo()); } this.type = NodeType.Raw; this.value = this.stringify.raw(text); }
[ "function createTextElement(text) {\n return new VirtualElement(0 /* Text */, text, emptyObject, emptyArray);\n }", "function Text(attrs) {\n var dflt = {\n content: \"\",\n fill: \"black\",\n font: \"12pt Helvetica\",\n height: 12\n };\n attrs = merg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the requested width of the camera device.
set requestedWidth(value) {}
[ "set width(aValue) {\n this._logService.debug(\"gsDiggThumbnailDTO.width[set]\");\n this._width = aValue;\n }", "set originalWidth(aValue) {\n this._logService.debug(\"gsDiggThumbnailDTO.originalWidth[set]\");\n this._originalWidth = aValue;\n }", "updateWidth() {\n if (this.setupComplete) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates random array of points based on points on grid as well as seed polygons minLength should be the minimum side amount of the created polygon maxLength should be the maximum side amount of the created polygon
function createRandomPointsArrayFromGrid(minLength, maxLength){ minLength = minLength ? minLength : 3; maxLength = maxLength ? maxLength : 5; var sides = JSX.math.random.randInt(minLength, maxLength); var pointsArray = []; for (var i = 0; i < sides; i++) { do{ var point = JSX.math.random.randElement(gridPoint...
[ "function createRandomPointsArray(minLength, maxLength){\n\tminLength = minLength ? minLength : 3;\n\tmaxLength = maxLength ? maxLength : 5;\n\tvar sides = JSX.math.random.randInt(minLength, maxLength);\n\tvar pointsArray = [];\n\tfor (var i = 0; i < sides; i++) {\n\t\tpointsArray.push([JSX.doc.width * Math.random(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An array is called a perfectly odd array if every element at the odd indices of the array is also odd. Write a function named isPerfectlyOdd that takes an array of integers as a parameter and checks whether it is perfectly odd. Return false if the array is an empty array.
function isPerfectlyOdd(arr) { let sum = 0; for (let i = 1; i < arr.length; i += 2) { sum += arr[i]; } if (sum % 2 !== 0) { return true; } return false; }
[ "function hasOnlyOddNumbers(arr){\n return arr.every(function(num){\n return num % 2 !== 0;\n })\n}", "function isPerfectlyOdd(arr){\n if(arr.length === 0){\n return false;\n } \nfor(let i =1; i<arr.length; i +=2){\n console.log(i);\n if(arr[i] % 2 === 0){\n // c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate key/value table row
function generateTableRow(key, value) { return "<tr><td>" + key + "</td><td>" + value + "</td></tr>"; }
[ "function nfTableRow(key, value) {\n var nf = new Intl.NumberFormat();\n return generateTableRow(key, nf.format(value));\n}", "function toTableRow( obj ){\n var out=\"<tr>\";\n for (var prop in obj) {\n out+=\"<td>\" + obj[prop] + \"</td>\";\n }\n return out+\"</tr>\";\n}", "function gene...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes a request to the Google Vision API
function makeRequest(APIkey, imageAs64) { //the request to be made to the Google Vision API var request = { requests: [{ image: { content: imageAs64 }, features: [ { type: "LABEL_DETECTION", maxRe...
[ "function sendFileToCloudVision(content) {\n // var type = $(\"#fileform [name=type]\").val();\n\n // Strip out the file prefix when you convert to json.\n var request = {\n requests: [{\n image: {\n content: content\n },\n features: [{\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check whether point is on the line or not
function onLine(line, point) { if(point.x <= Math.max(line.p1.x, line.p2.x) && point.x <= Math.min(line.p1.x, line.p2.x) && (point.y <= Math.max(line.p1.y, line.p2.y) && point.y <= Math.min(line.p1.y, line.p2.y))) return true; return false; }
[ "function check_point(p) {\n if (p.x < 0 || p.x > 9) {\n return false;\n } else if (p.y < 0 || p.y > 9) {\n return false;\n } else if (spielfeld[p.y][p.x]) {\n //console.log(\"point already in use:\", p);\n return false;\n } else {\n //console.log(\"point ok:\", p);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sorts array with nodes
function nodeArraySort(to_sort) { var sorted = false; while (!sorted) { sorted = true; for (var i=0; i<to_sort.length-1; i++) { if (compareNode(to_sort[i], to_sort[i+1])) { sorted = false; tmp_var = to_sort[i]; to_sort[i] = to_...
[ "reorder () {\n let nodes = []\n\n walk(this.root.children, (node) => {\n nodes.push(node)\n })\n\n let { baseOrder } = this\n nodes.forEach((node, i) => {\n node.order = baseOrder + i\n })\n }", "function sortEntitiesByDistance(array) {\n array.sort(function (current, next) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private methods / enableVotingButtonsForBar params: bar jQuery object representing a bar with the css class c3eventrect Shows the voting buttons above the given bar, binds the appropriate click events to the upvote and downvote arrows, and grays out all the other bars
function enableVotingButtonsForBar(bar) { toggleTooltips("all", bar, true); $(".vote-polygon").css("fill", options.barColors[currentIndex]); $(".tooltipster-content").mouseover(function(event){ $(nScoreDiv).parent().css("opacity", options.nScoreDivHiddenOpacity); toggleToolti...
[ "function disableVoteButtons() {\n\t$(\"#yes-btn\").prop('disabled', true);\n\t$(\"#no-btn\").prop('disabled', true);\n}", "function updateHealthButtons() {\r\n\r\n\t\tvar h = parseInt( $( \"#healthBar\" ).text() );\r\n\t\tvar foodLimit = parseInt( $( \"#foodLimit\" ).text() );\r\n\t\tvar giftLimit = parseInt( $(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete directories and subdirectories from tree
deleteFromTree({ state, commit, getters, dispatch }, directories) { directories.forEach((item) => { // find this directory in the tree const directoryIndex = getters.findDirectoryIndex(item.path); if (directoryIndex !== -1) { // add directory index to array f...
[ "function DeleteOutput (dir) {\n if(dir === \"\") {\n dir = dir_path;\n }\n\n if(fileExists (dir)) {\n var list = fs.readdirSync(dir);\n for(var i = 0; i < list.length; i++) {\n var filename = path.join(dir, list[i]);\n var stat = fs.statSync(filename);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by KotlinParserisOperator.
enterIsOperator(ctx) { }
[ "enterInOperator(ctx) {\n\t}", "function ExpressionParser() {\n \t\tthis.parse = function() {\n\t \t\treturn Statement(); \n\t \t}\n \t\t\n//\t\tStatement := Assignment | Expr\t\n\t\tthis.Statement=function() {return Statement();}\n\t \tfunction Statement() {\n\t \t\tdebugMsg(\"ExpressionParser : Statement\");\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================================== | Websocket send END ROUND
function sendRoundEndMSG() { let message = { messageType: "END ROUND", }; theSocket.sendJSON(message); }
[ "function sendEndGameMSG() {\n let message = {\n messageType: \"END GAME\",\n };\n\n theSocket.sendJSON(message);\n}", "function endWebSocketConnection(ws, code, message) {\n try {\n console.log('Terminating socket');\n ws.end(code, message);\n } catch(err) {\n console.error('Error endi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates Summaries for a cluster of Markers
function getClusterText(markers) { var summary = {}; for(index in markers) { temp = summary[markers[index]['mode']]; if(temp == undefined) { temp = 0; } summary[markers[index]['mode']] = temp+1; } var contentString = '<div id="content">'+ '<p>There are <b>' + zeroIfNAN(markers.length) + '...
[ "function plotLocationSummary(options)\n{\n //Disables in case Quick Load is chosen. For multiple days, the clustering can be annoyingly slow.\n if(quickload)\n {\n\toptions.outerElement.hide();\n\treturn;\n }\n\n var $mycontainer = $(\".template-location-table\").clone();\n $mycontainer.removeAtt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::IAM::AccessKey` resource
function cfnAccessKeyPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAccessKeyPropsValidator(properties).assertSuccess(); return { UserName: cdk.stringToCloudFormation(properties.userName), Serial: cdk.numberToCloudFormation(properti...
[ "function cfnAccessPointPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAccessPointPropsValidator(properties).assertSuccess();\n return {\n Bucket: cdk.stringToCloudFormation(properties.bucket),\n BucketAccountId: cdk.stringToCl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UnBalancedBST insert into tree remove from tree print (inorder, preorder, postorder) create balanced tree check for balanceness search for node in tree show how many steps it took for the search
function UnBalancedBST() { var head = null; var numOfStepsForSearch = 0; this.displayNumOfStepsForSearch = function() { return numOfStepsForSearch; } this.getRoot = function() { return head; } /*************************************** SEARCHING IN TREE *********...
[ "insert(value) {\n let newNode = new TreeNode(value);\n let current;\n this.size++;\n\n if (this.root == null) {\n this.root = newNode;\n } else {\n current = this.root;\n\n while(current != newNode) {\n if (newNode.value >= current.value) {\n if (current.right != null)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders a full block on events within the same day in the $wrapper.
function renderEventsBlock($wrapper, data) { var events = ''; for (var i = 0; i < data.events.length; i++) { events += renderSingleEvent(data.events[i]); } var html = '<li class="events_item stickem-container">'; html += renderEventBlockHeader(data['formatted_date']); html += ( '<div class=day_block">...
[ "function renderSingleEvent(info) {\n return ('<div class=\"event_block animate-fadein\">' +\n '<div class=\"event_start_info\">' +\n '<div class=\"event_start_dt\">starts at</div>' +\n '<div class=\"event_start_time\">' +\n '<div class=\"time_h\">' + info.acf.hour + '</div>' +\n '<div class=\"time_min_hold...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
post a web hook/request to slack channel sending the time totals
copyToSlack(data) { const body = { "channel": "#dev-team", "username": "Standup_Times", "text": data, "icon_url": "https://pbs.twimg.com/profile_images/76277472/bender.jpg" }; // console.log("Send to Slack"); // console.log(this.timerData);...
[ "function sendSlackMessageToHR() {\n dataInit();\n var tmp = [];\n var today = new Date();\n for (var i = 1; i < data1.length; i++){\n for (var j=1; j < data.length; j++){\n var slicesstring = data[j][4].slice(-7,-5);\n var stringYear = data[j][4].slice(-4);\n if (data1[i][2] == data[j][2] && ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes away the marker component of the previously picked entity and sets a marker component on the current picked entity
function updateMarker(picked, oldPicked) { if (picked !== oldPicked) { if (oldPicked !== null && oldPicked.hasComponent('MarkerComponent')) { oldPicked.clearComponent('MarkerComponent'); } if (picked !== null) { picked.setComponent(new MarkerComponent(picked)); } } else { if (picked.hasComponent('Mar...
[ "changeMarker() {\n\t\t_.forEach(this.markers, (a) => a.style.display = this.saved ? 'inline' : '');\n\t}", "function unselectMarker () {\n\t\tif (ParkingService.data.selectedParking == null) return;\n\t\tif (ParkingService.data.selectedParking.id == null) return;\n\t\tconsole.log ('it was at least defined.');\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a hash of `obj` suitable for change detection.
function hash(obj) { return JSON.stringify(obj) }
[ "function calculateChangeHash(item) {\r\n const cpy = Object.assign({}, item);\r\n if (cpy.eTag) {\r\n delete cpy.eTag;\r\n }\r\n ;\r\n return JSON.stringify(cpy);\r\n}", "static toJsonStringUniq (obj) {\n const resultObj = {}\n const keyAry = Object.keys(obj).sort()\n for (let ele ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterate over the items of the InputEx form.
function iterateFormItems(env, action) { $.each(env.form.inputsNames.sections.subFields, function(i, section) { $.each(section.inputsNames.data.subFields, function(j, item) { action(section, item); }) }); }
[ "function examineForm() {\n var fitems = form.getItems();\n for (var j = 0; j < fitems.length; j++) {\n console.log(`Item title for: #${j} - ${fitems[j].getTitle()} ID: ${fitems[j].getID()}`);\n }\n}", "function allInputs () {\n let inputs = _.select(ractive.get('inputs'), function (input) {\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========================================================= Get Nearest 2Hour Weather =========================================================
function getnearestweather(latinput, longinput) { // var forecastobj = { // BR: "Mist", // CL: "Cloudy", // CR: "Drizzle", // FA: "Fair(Day)", // FG: "Fog", // FN: "Fair(Night)", // FW: "Fair & Warm", // HG: "Heavy Thundery Showers with Gusty Winds", ...
[ "function getWeather() {\n\tif (searchBox.getPlaces().length > 0)\n\t{\n\t\tvar loc = searchBox.getPlaces().pop();\n\t\tvar latLon = loc.geometry.location.lat() + \",\" + loc.geometry.location.lng();\n\t\tgetCity(latLon);\n\t\tgetForecast(latLon);\n\t}\n\telse {\n\t\talert(\"Could not retrieve location. Please ente...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: break into `random_bst(size)` and `draw_bst`
function draw_random_bst (size) { var i , canvas= document.getElementById('thecanvas') , ctx= canvas.getContext('2d') , root= null , lt= function (i,j) { return i < j } , data= [] ctx.clearRect(0, 0, canvas.width, canvas.height) size= size || 30 for (i= 0; i != size; i+= 1) data.push(Math...
[ "function UnBalancedBST() {\n var head = null;\n var numOfStepsForSearch = 0;\n\n this.displayNumOfStepsForSearch = function() {\n return numOfStepsForSearch;\n }\n\n this.getRoot = function() {\n return head;\n }\n\n /***************************************\n SEARCHING IN ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a file called fileName in fileSystem's root directory, truncates it to zero length just in case, and calls onSuccess, passing it a FileEntry and FileWriter for the new file.
function createEmptyFile(fileSystem, fileName, onSuccess) { function getSuccessFunc(fileEntry) { // Create a fresh FileWriter here, rather than pass in the used one. // This way we don't accidentally leave our event handlers attached. return function() { fileEntry.createWriter(fu...
[ "function FileWriter() {\n}", "function writeFile(filename, buffer) {\n return new Promise((resolve, reject) => {\n const dirname = path.dirname(filename);\n mkdirp(dirname, error => {\n if (error) {\n reject(error);\n return;\n }\n fs.writeFile(filename, buffer, error => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrieve company name from the mapped entries (data)
function getCompanyName(companyKey, arr){ //filter data for the company names //var compNames=Object.keys(filtered).map(i=> filtered[i]); Object.values(companyKey).map(i=> {Object.entries(dataByCompanies).forEach(([key, value]) => { if (i == key&& !arr.includes(value[0].company)){ arr.push(value[0]...
[ "function nameToDomain(companies) {\n // search for the domain of that specific company\n companies.map((company) => {\n NameToDomain.find({ name: company[\"Company Names\"] })\n .then((response) => {\n // write a new record in the deduped-company-list.csv file\n csvWriter.writeRecords([resp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will load the "other" boxes if there is text in them and "other" is selected in the dropdown
function loadOtherBoxes() { let location = document.getElementById("location"); let selectedValueLocation = location.options[location.selectedIndex].value; let otherLocationDiv = document.getElementById("otherLocation"); if (selectedValueLocation === "other") { if (otherLocationDiv !== "") ...
[ "function other_cardiac(sel,showed) {\n\n\t$(document).ready(function() {\n\n\t\tshowed.hide();\n\n\t});\n\n\tsel.change(function() {\n\n\t\tif (sel.val()==\"other\") {showed.show(\"fast\");}\n\n\t\telse showed.hide(\"fast\");\n\n\t});\n\n}", "function loadAllDropDownListAtStart(){\n\t\t//load vào ddl customer\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if string is a valid ObjectID
function checkIfValidMongoObjectID(str) { // regular expression to check if string is a valid MongoDB ObjectID const regexExp = /^[0-9a-fA-F]{24}$/ return regexExp.test(str) }
[ "function parseId(input) {\n if (input.hasOwnProperty('id')) return typeof input.id === 'string' ? parseInt(input.id, 10) : input.id;\n return false;\n}", "function validateFamilyId(family_id) {\n return family_id.match(/[A-Z]+\\d{8}-\\d{2}/);\n}", "function IsValidGuid(guid) {\r\n var re = new RegExp(/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }