query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
bins an array of objects with bin label and count node the DOM node to generate the graph in
function histogram_from_bins(bins, node, xlbl, ylbl) { //calculate total items var total = 0; for (var i = 0; i < bins.length; i++) total += bins[i].count; //make the total evenly divisble by ten for whole number marker lines total += 10 - total % 10 var div = document.createElement("div"); div.clas...
[ "computeBins(numCategorias) {\n let x = d3.extent(this.dataTransf, d => {\n return d.x;\n });\n\n let catego = numCategorias;\n let larg = (x[1] - x[0]) / (numCategorias - 1); // tamanho de cada bin do eixo x (max - min )/ (categorias -1)\n // o -1 é para ter um \"espaço nos limites\"\n // sa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End Add New Music via UI
function addNewMusic(){ let title = document.getElementById("inputSong").value; let artist = document.getElementById("inputArtist").value; let album = document.getElementById("inputAlbum").value; let songObj = {"title": title, "artist": artist, "album": album}; // console.log("songObj", songObj); Loader.addToLibr...
[ "function addNewMusic(){\n\tlet title = $('#inputSong').val();\n\tlet artist = $(\"#inputArtist\").val();\n\tlet album = $(\"#inputAlbum\").val();\n\tlet songObj = {\"title\": title, \"artist\": artist, \"album\": album};\n\n\tLoader.addToLibrary(songObj);\n\tLoader.showSongs(callBack);\n\n\tclearTextInputs();\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save vales of education
function educationData() { var select = document.getElementById("education"); localStorage.setItem("save", select.value); console.log(select.value) }
[ "function educationData() {\r\n var select = document.getElementById(\"education\");\r\n if (localStorage === \"\") {\r\n select[localStorage.getItem(\"save\")].selected = true;\r\n } else if (select.value === \"b.com\") {\r\n localStorage.setItem(\"save\", select.value);\r\n } els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
downloadUser will return the download file url that can be used to directly download the archive.
async function downloadUser(ctx, userID) { if (ctx.user.role !== 'ADMIN') { throw new ErrNotAuthorized(); } const { downloadFileURL } = await generateDownloadLinks(ctx, userID); return downloadFileURL; }
[ "function handleDownloadUserFiles(req, res) {\n var domain = checkUserIpAddress(req, res);\n if (domain == null) return;\n var domainname = 'domain', spliturl = decodeURIComponent(req.path).split('/'), filename = '';\n if ((spliturl.length < 3) || (obj.common.IsFilenameValid(spliturl[2])...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove focus for nonscreenreader hoverers
function removeFocus() { document.body.classList.add('hover-focus-hidden'); window.removeEventListener('mouseover', removeFocus); }
[ "_discardKeyboardHover() {\n const that = this;\n\n if (!that._focusedViaKeyboard) {\n return;\n }\n\n if (that._focusedViaKeyboard === that.$.backButton) {\n that.$.backButton.removeAttribute('hover');\n that.$.backButton.$.button.removeAttribute('hover'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reste the last push epoch for a site
resetLastPushDate(aqsid) { // get closest 5 min intervall const ROUNDING = 5 * 60 * 1000;/* ms */ let now = moment(); now = moment(Math.floor((+ now) / ROUNDING) * ROUNDING); LiveSites.update({ // Selector AQSID: `${aqsid}` }, { // Modifier $set: { lastPushEpoch:...
[ "function get_last_published () {\n return last_published ;\n }", "function getLastRefreshTime() {\n return lastRefreshTimeStamp;\n}", "getCurrentEpoch() {\n return Math.round(Date.now() / 1000);\n }", "getLatestTime(){\n for(let i=this.feeds.length-1;i>=0;i--){\n if(!th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Help function to find the circle associated with a name
function findCourseCircle(){ var searchVal = document.getElementById("coursesoverview_courseSearch").value; var circle = null; svg.selectAll('.bubbleGroup').each(function(d){ if (d.code === searchVal){ circle = this; } }) return (circle); }
[ "function findTeacherCircle(){\n var searchVal = document.getElementById(\"teachersoverview_teacherSearch\").value;\n \n var circle = null;\n \n svg.selectAll('.teachersoverview_bubble').each(function(d){\n if (d.name === searchVal){\n circle = this;\n }\n })\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
write N bits into the header
function writeheader(gfc, val, j) { var ptr = gfc.header[gfc.h_ptr].ptr; while (j > 0) { var k = Math.min(j, 8 - (ptr & 7)); j -= k; assert(j < MAX_LENGTH); /* >> 32 too large for 32 bit machines */ gfc.header[gfc.h_ptr].buf[ptr >> 3] |= ((va...
[ "writeHeader() { \n this.binHeader = this.headerParser.encode(this.header);\n let written = fs.writeSync(this.fd, this.binHeader, 0, this.headerSize, 0);\n if (written != this.headerSize) {\n throw new Error(`Could not write header (tried ${this.headerSize} bytes, wrote ${writte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide the SQL saving block
function hideSQL() { $('#sql').hide(); }
[ "hideSaveButtons() {\n //TODO: implement it later. NO-OP for now.\n }", "function disconnectEditorSaveFunction() {\r\n \tvar noAction = function() {};\r\n get(\"editorWidget\").save = noAction;\r\n get(\"saveEditorContentButton\").onClick = noAction;\r\n wt.disabl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply ctrl.offsetLeft to the paging element when it changes
function handleOffsetChange (left) { var elements = getElements(); var newValue = ctrl.shouldCenterTabs ? '' : '-' + left + 'px'; angular.element(elements.paging).css($mdConstant.CSS.TRANSFORM, 'translate3d(' + newValue + ', 0, 0)'); $scope.$broadcast('$mdTabsPaginationChanged'); }
[ "function handleOffsetChange(left){var elements=getElements();var newValue=ctrl.shouldCenterTabs?'':'-'+left+'px';angular.element(elements.paging).css($mdConstant.CSS.TRANSFORM,'translate3d('+newValue+', 0, 0)');$scope.$broadcast('$mdTabsPaginationChanged');}", "function handleOffsetChange (left) {\n\t var ele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show the countdown images
function countdown(){ document.getElementById("time").src = "images/" + sources[T]; T++; if(T == 10){ check(); } }
[ "function setupCountdown() {\n onCountdownActivateCallback(self);\n isCountdown = true;\n startedCountingTime = 0;\n animate.fromTo(recordIcon.scale, 0.4, {\n x: 1.01,\n y: 1.01\n }, {\n x: 0,\n y: 0\n });\n animate.to(textImages[0], 0.3, {\n alp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes table of courses from view
function removeCoursesTable() { let table = $('#courses-table'); table.children().remove(); }
[ "function deleteTimetable() {\n view_courses = [];\n clearTimetable();\n}", "function clearCoursesInTable() {\n while (coursesTBody.hasChildNodes()) {\n if (coursesTBody.firstChild != null) {\n coursesTBody.removeChild(coursesTBody.firstChild);\n }\n }\n}", "function removeC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save current animation to level
function saveAnimation(){ $scope.component.ui.savingStatus = 'saving' var animation = editorAnimationToProjectAnimation($scope.component.animation); AnimationService.updateAnimationByIndex(animation, $scope.component.ui.selectedAnimationIdx, function () { // $scope.animations = Anim...
[ "function saveAnimation () {\n\t\tcurrentWindow.emit('saveRequest');\n\t}", "function saveAnimation (name, data) {\n\n\t\tvar filename = project.animation(name);\n\t\tvar filepath = path.join(project.animPath(), filename);\n\n\t\tfs.writeFile(filepath, data);\n\n\t}", "function saveLevel(lv){\n level = lv\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
launches the New Invitation modal form
function launchModal2() { $('#inviteModal').modal(); }
[ "function privInvite() {\n LUI.update_invites_display();\n M.Modal.getInstance(document.getElementById(\"diaInvite\")).open();\n}", "openRecipients() {\n\t\tthis.formModal.iziModal(\"open\");\n\t}", "function add_ticket() {\n\n $(\"#new_ticket_popup\").modal('show');\n}", "function open_invite_modal(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given value is an Immer draft
function isDraft(value) { return !!value && !!value[DRAFT_STATE]; }
[ "function isDraft(value) {\n return !!value && !!value[DRAFT_STATE];\n }", "function isDraftable(value) {\n if (!value) return false;\n return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE] || isMap(value) || isSet(value);\n}", "function isDraftable(va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decrypts ciphertext string representing an MPIformatted big number with the supplied privkey returns cleartext string
function crypto_rsadecrypt(ciphertext, privkey) { var l = (ciphertext.charCodeAt(0) * 256 + ciphertext.charCodeAt(1) + 7) >> 3; ciphertext = ciphertext.substr(2, l); var cleartext = asmCrypto.bytes_to_string(asmCrypto.RSA_RAW.decrypt(ciphertext, privkey)); if (cleartext.length < privkey[0].length) clear...
[ "function RSADecrypt(ctext) {\n var c = parseBigInt(ctext, 16);\n var m = this.doPrivate(c);\n if (m == null) return null;\n return pkcs1unpad2(m, this.n.bitLength() + 7 >> 3);\n }", "function RSADecrypt(ctext) {\n var c = parseBigInt(ctext, 16);\n var m = this.doPrivate(c);\n if(m == ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the current leaf node for a given revision
function latest(rev, metadata) { var toVisit = metadata.rev_tree.slice(); var node; while ((node = toVisit.pop())) { var pos = node.pos; var tree = node.ids; var id = tree[0]; var opts = tree[1]; var branches = tree[2]; var isLeaf = branches.length === 0...
[ "function latest(rev, metadata) {\n var toVisit = metadata.rev_tree.slice();\n var node;\n while ((node = toVisit.pop())) {\n var pos = node.pos;\n var tree = node.ids;\n var id = tree[0];\n var opts = tree[1];\n var branches = tree[2];\n var isLeaf = branches.length === 0;\n\n var history =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Value Ref for binned fields
function bin(fieldDef, scaleName, side, offset) { return fieldRef(fieldDef, scaleName, { binSuffix: side }, offset ? { offset: offset } : {}); }
[ "function bin(fieldDef, scaleName, side, offset) {\n const binSuffix = side === 'start' ? undefined : 'end';\n return fieldRef(fieldDef, scaleName, { binSuffix }, offset ? { offset } : {});\n}", "function bin(fieldDef, scaleName, side, offset) {\n var binSuffix = side === 'start' ? undefined : 'end';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set state product dengan data dari response
DETAIL_PRODUCT(state, product) { state.product = product }
[ "function setProductResponse(data) {\n let resp;\n if (data.isError) {\n const { messages, status } = data;\n resp = {\n isError: true,\n messages: messages || ['Error.'],\n status\n };\n } else {\n resp = {\n isError: false,\n isEmpty: (Object.getOwnPropertyNames(data).lengt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apppend a "not" clause to a db query
function noSQL_NOT(expression){ 'use strict'; return ".not(" + expression + ")"; }
[ "$not(a, b) {\n return !doQueryOp(a, b);\n }", "$not(a, b) {\n return !this.doQueryOp(a, b);\n }", "function test_Not_Eq() {\n asyncTestCase.waitForAsync('test_Not_Eq');\n\n var employee = db.getSchema().getEmployee();\n var excludedId = 'empId1';\n\n /**\n * Select records from the da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
soundtrack is playing funnction called when "toggle sound" is clicked. this function pauses/plays soundtrack
function toggleSound() { if (sound === true) { myAudio.pause(); sound = false;//soundtrack is paused } else { myAudio.play(); sound = true;//soundtrack is playing } }
[ "function toggleSound() {\n if (sound === true) {\n myAudio.pause();\n sound = false;//soundtrack is paused\n } else {\n myAudio.play();\n sound = true;//soundtrack is playing\n }\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize image map areas.
function initImageMap() { $('#imageMap>area').each((_, area) => { let map = $(area).attr('title'); $(area).off('click').on('click', (_) => { selectMap(map); }) }); }
[ "function initMapAreas()/*:void*/ {var this$=this;\n var currentIdSuffixes/*:Array*/ = [];\n\n this.structValueExpression$AoGC.loadValue(function (struct/*:StructRemoteBeanImpl*/)/*:void*/ {\n if (struct) {\n struct.removeValueChangeListener(AS3.bind(this$,\"imageMapChangeHandler$AoGC\"));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns character object based on id string
getCharFromID(idStr) { for (let i=0; i<this.characters.length; ++i) { if (this.characters[i].id === idStr) return this.characters[i]; } }
[ "function characterById(id) {\n charactersMap = charactersMap || {};\n charactersMap[id] = charactersMap[id] || data.characters.find(function(character){\n return character.id === id;\n });\n return charactersMap[id];\n }", "function characterById(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loop through time slots to compare hour index to currentTime
function compareHour() { //update color code to display the calendar hours to match currentTime var updateHour = moment().hours(); $(".time-block > textarea").each(function() { var hour = parseInt($(this).attr("id").split("-")[1]); //set background color if past hour ...
[ "function divideTimeIntoTwelveSlots(secsInHour, offset, tempMoment) {\n\t\t\tvar timeholder$;\t\t\t\t\t\t\t// selector for html elt\n\t\t\tvar rangeEnd = moment();\n\t\t\tvar now = moment();\n\n\t\t\tfor ( var i = 0 ; i < 12 ; i +=1 ) {\n\t\t\t\ttimeholder$ = my.data.uiElt$['time'].find('#geoTime_timeHolder' + (i +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
__addNextDay for timetable on parentAircraft, create next day routes and assign to newAircraft
function __addNextDay(parentAircraft, noSlots, newAircraft) { var parentRoutes = []; var nextDayRoutes = []; // get details of parent aircraft, crash if it doesn't exist casper.then(function() { casper.verifyAircraft(parentAircraft, function (data) { parentAircraftData = data; if (parentAircraftData.airc...
[ "function addDayAfter(button) {\n let row = button.parentNode.parentNode;\n let index = parseInt(row.id[row.id.length - 1]);\n let rowCount = index + 1;\n let action = schedule.addDayAfter(index, dayStartTime, dayEndTime, dayDuration);\n if(action === undefined) {\n let newRow = loadDay(rowCou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turn an element node into a markup
markupFromNode(node) { if (Markup.isValidElement(node)) { let tagName = remapTagName(node.tagName); let attributes = getAttributes(node); return this.builder.createMarkup(tagName, attributes); } }
[ "markupFromNode(node) {\n if (Markup.isValidElement(node)) {\n const tagName = node.tagName;\n const attributes = getAttributes(node);\n return this.builder.createMarkup(tagName, attributes);\n }\n }", "function asHTML(node){\n\n\tif (isTextNode(node)){\n\t\treturn escapeHTML(node.nodeValue)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ball collision with blocks
function collision() { for (let c = 0; c < blockColumnCount; c++) { for (let r = 0; r < blockRowCount; r++) { if (blocks[c][r].show == 1) { if (ball.x > blocks[c][r].x && ball.x < blocks[c][r].x + blockWidth && ball.y > blocks[c][r].y && ball.y < blocks[c][r].y + blockHeight) { ...
[ "function collisionCheck() {\nfor( let c = 0; c < blockCols; c++) {\n for(let r = 0; r < blockRows; r++) {\n var b = blocks[c][r];\n if(b.destroyed === false || b.destroyed === \"undefined\") {\n if(xball + 5 > b.x && xball -5 < b.x + blockWidth && yball + 5 > b.y && yball - 5 < b.y + blockHeight) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wrap showImage for events
function imgOnclickEvt (img, data) { return function () { showImage (img, data); } }
[ "function onImageClick(evt) {\n showImage(evt.target);\n }", "function showImg(e) {\n imgDiv.className = \"display_img\";\n imgDivChild.src = e.target.src;\n}", "function njbsPostShowImage($imageId)\n{\n\tnjbsGeneralOverlayShow();\n\n\t$('body').append('<div id=\"njbsImgContainer\">'\n\t\t+ '<div clas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes all buttons, sliders and inputs from the menu screen and sets their arrays to empty
function deleteMenu() { randomize_button.remove(); submit_num.remove(); num_stars_input.remove(); submit_num_planets.remove(); num_planets_input.remove(); if (set_stars != null) { set_stars.remove(); } if (preset_binary != null) { preset_binary.remove(); } if (tat...
[ "function destroyOptionsMenuButtons() {\n\t$('#main_menu_button').remove();\n\t$('#options_text').remove();\n\t$('#shoot_option_text').remove();\n\t$('#shoot_option_mouse').remove();\n\t$('#shoot_option_facing').remove();\n\t$('#shoot_explanation').remove();\n\t$('#difficulty_option_text').remove();\n\t$('#difficul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LexicalDeclaration : LetOrConst BindingList
parseLexicalDeclaration() { const kind = this.currentToken === SyntaxKind.ConstKeyword ? 'const' : 'let' this.nextToken() const bindings = this.parseBindingList() this.parseOptionalSemicolon() return new types.VariableDeclaration(kind, bindings) }
[ "function visitVariableDeclarationInLetDeclarationList(node){// For binding pattern names that lack initializers there is no point to emit\n// explicit initializer since downlevel codegen for destructuring will fail\n// in the absence of initializer so all binding elements will say uninitialized\nvar name=node.name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getNewConfig Build and return the new remote config
function getNewConfig() { return __awaiter(this, void 0, void 0, function* () { const { conditionKeys, conditions } = require('./remoteConfigConditions'); console.log('conditions are', conditionKeys); const mywellTranslationOptionsJSON = JSON.stringify(ow_translations_1.possibleTranslationsF...
[ "function newConfig() {\r\n //TODO\r\n}", "function getRemoteConfig (cb) {\n cb(null, null)\n\n //nets({url: remoteConfigUrl, json: true}, function gotConfig (err, resp, config) {\n // if (err || resp.statusCode > 299) config = undefined // ignore errors\n // cb(null, config)\n //})\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch Random User & Add Money
async function getRandomUser() { const res = await fetch('https://randomuser.me/api'); const data = await res.json(); const user = data.results[0]; const newUser = { name: `${user.name.first} ${user.name.last}`, money: Math.floor(Math.random() * 1000000) }; addData(newUser); }
[ "async function getRandomUser() {\n const res = await fetch('https://randomuser.me/api');\n const data = await res.json();\n\n const user = data.results[0];\n\n const newUser = {\n name: `${user.name.first} ${user.name.last}`,\n // Math.floor: Largest integer less than or equal to a number\n money: Mat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move all scope dependencies upwards to their shard_root
function process_ir(scope_data) { var name, scope; // This loop is only needed if root_elements are not marked as shard_roots. for (name in scope_data.root_element_scopes) { scope = scope_data.root_element_scopes[name]; if (!scope.is_shard_root()) { gather_dependencies(scope); } } for (name...
[ "function deps(s, p) {\n if (!shards.map[p] || !shards.map[p].ParentShardId) return;\n shards.deps[s] = lib.toFlags(\"add\", shards.deps[s], shards.map[p].ParentShardId);\n deps(s, shards.map[p].ParentShardId);\n }", "prepare() {\n // References\n for (const ref of this.node....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates the sine curve
function sineCurve(ctx, w, h, step, amplitude, data) { //begins new line ctx.beginPath(); ctx.lineWidth = 2; ctx.strokeStyle = "red"; //constant x axis var x = -1; ctx.moveTo(x, amplitude); //sine curve math --> que while (x < w) { //constant y axis var y = h / 2 + getData(x + step, data); ...
[ "function sine(){\r\n\tvar c = document.getElementById(\"graph\");\r\n\tvar ctext = c.getContext(\"2d\");\r\n\tvar vals = buildSineArr();\r\n\tlastSetGraphed = deepCopy(vals);\r\n\tscaleXCoords(vals, xScaling);\r\n\tscaleYCoords(vals, yScaling);\r\n\tctext.beginPath();\r\n\tctext.strokeStyle=\"#000000\";\r\n\tctext...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reach label selection to label input
function SelectionToInput(event) { label_input = document.getElementById('label'); label_input.value = event.target.value; }
[ "function labelChanged() {\n labels[propLabel].alterText(labelTextBox.value()); // Alter the text of the selected label\n}", "function labelClick( label ) {\n\n var val = $(label).data(\"value\"),\n $thisSlider = slider.element;\n\n if ( true === slider.options....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pause and play the video, and change the button text
function pauseVid() { if (video.paused) { video.play(); btn.innerHTML = "Pause"; } else { video.pause(); btn.innerHTML = "Play"; } }
[ "function pause() {\r\n if (video.paused) {\r\n video.play();\r\n btn.innerHTML = \"Pause\";\r\n } else {\r\n video.pause();\r\n btn.innerHTML = \"Play\";\r\n }\r\n}", "function VideoPlayPause() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Pause\";\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preload images and store them in animalImages array
function preload(){ for (let i = 0; i < NUM_ANIMAL_IMAGES; i++){ let animalImage = loadImage(`assets/images/animal${i}.png`); //${_} allows for a variables to be used in call, must be ``(one with ~) animalImages.push(animalImage); } //load other images sausageDogImage = loadImage("assets/images/sausage-...
[ "function preload() {\n\n for (let i = 0; i < NUM_ANIMAL_IMG; i++) {\n let animalImage = loadImage(`${ANIMALS_IMG}${i}.png`);\n animalImages.push(animalImage);\n }\n\n sausageDogImg = loadImage(`${SAUSAGE_DOG_IMG}`);\n}", "function preload(){\n for (let i = 0; i < NUM_ANIMAL_IMAGES; i++){\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
explore_neighborhood() / Move agents In: change dictionary In/Out: strategy Out: [strategy, this move]
function move(neighborhood, strategy) { var best_site = neighborhood.get('best_site'), o_site = neighborhood.get('o_site'), best_site_strategy = strategy.get(best_site); var mv = {}; mv[o_site] = -1; mv[best_site] = strategy.get(o_site); if(best_site == o_site) { mv[o_s...
[ "function explore_neighborhood(site, strategy, site_occ) {\n\t\t\tvar neighborhood = search_for_sites(site, strategy, site_occ),\n\t\t\t\tpo = {};\n\n\t\t\tif(strategy.get(site) === -1) { return {}; }\n\n\t\t\tvar ownPayoff = payoff(site, strategy);\n\t\t\tpo[site] = ownPayoff; \n\n\t\t\tif(forceMove) {\n\t\t\t\tde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether a ends with b.
function endsWith(a, b) { if (a.length < b.length) { return false; } return a.substring(a.length - b.length) == b; }
[ "function endsWith(a: string, b: string) {\n return a.indexOf(b, a.length - b.length) != -1;\n}", "function commonEnd(a, b){\n if (a[0] === b[0] || a[a.length-1] === b[b.length-1]) return true\n return false\n}", "function checkEnding(str1, str2) {\n return str1.endsWith(str2);\n} //a.endsWith(b) chec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transform a region from local space to world space
transformRegion(region) { // Apply transformations of this game object region = region .translate(this.position.scaleUniform(-1)) .scale(this.scale); // Apply transformations of the parents if (typeof this.parent !== 'undefined') region = this.parent.transformRegion(region); re...
[ "worldToLocal(world) {\r\n let m = this.matrix;\r\n let a = m.a, b = m.c, c = m.b, d = m.d;\r\n let invDet = 1 / (a * d - b * c);\r\n let x = world.x - m.tx, y = world.y - m.ty;\r\n world.x = (x * d * invDet - y * b * invDet);\r\n world.y = (y * a * ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill Behavior Check List adds all behaviors from the catLadyBehaviors array as options in the html checklist
function fillBehaviorCheckList () { for (var i = 0; i < catLadyBehaviors.length; i++) { var description = catLadyBehaviors[i].description; var points = catLadyBehaviors[i].pointValue; var option = '<div class="checkbox"><label><input type= "checkbox" class= "behavior-chec...
[ "function fillBehaviorDropDown ()\n {\n for (var i = 0; i < catLadyBehaviors.length; i++) {\n var description = catLadyBehaviors[i].description;\n var points = catLadyBehaviors[i].pointValue;\n var option = '<option value=\"' + i +'\">' + description + '</option>';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the Atom's Orbit's State 2 to the Scene (Atom Representation Scene)
function add_atom_orbit_state_to_scene_2() { // Creates the Atom's Particle's State's Orbit #2 create_atom_particle_state_orbit_2(); // Creates the Atom's Particle's State #2 create_atom_particle_state_2(); // Creates the group for the Atom's State's Pivot #2 atom_state_pivot_2 = new THR...
[ "function add_atom_orbit_state_to_scene_1() {\n\n // Creates the Atom's Particle's State's Orbit #1\n create_atom_particle_state_orbit_1();\n\n // Creates the Atom's Particle's State #1\n create_atom_particle_state_1();\n\n \n // Creates the group for the Atom's State's Pivot #1\n atom_state_pi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End of Initializing Function 2 Adder Function////////////////////// Responsible for adding integers to the end of the number string. Determines which number to operate on, on the basis of the state of the 'operator' variable (empty)=>Number1 (Any other value)=>Number 2 Also has an special 'result' flag in case we want ...
function adder(obj,input,result=false){ if(result){ obj.operator=""; obj.inputA=obj.result; obj.inputB=""; } else if(obj.operator==="") obj.inputA+=input; //if operator is empty string concatenate new number to the end of the string of number 1 else obj.inputB+=input; //Els...
[ "function addOperator(operator) {\n calc.push(Number(currentNumber.innerText));\n \n /**\n * In case the last value is '=' it clean the previous value and\n * display the next calc\n */\n if(previousNumber.innerText.charAt([previousNumber.innerText.length -1]) === \"=\" & currentNumber.inner...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function 'howManyTimes' receives the price of an annual pass and a single pass and returns the minnimun amount of days that a person have to use the annual pass to take advantage of it
function howManyTimes(annualPassPrice, singlePassPrice) { let amountOfDays; /*This asigns to 'amountOfDays' the minnimun amount of days to take advantage of the annual pass*/ amountOfDays = (Math.floor(annualPassPrice / singlePassPrice) + 1); /*This compares if the amount of days are lower than 365, o...
[ "function timeSpent() {\n\t\t var today = new Date();\n\t\t var daysInMonth = new Date(today.getYear(), today.getMonth(), 0).getDate();\n\t\t var day = Math.max(today.getDate()-1,1);\n\n\t\t return day/daysInMonth;\n\t\t}", "function calculateSupply (age, ammountPerDay){\n\tvar maxAge = 70;\n\n\tconsole.log(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert the SOAP JavaScript object into an XML string
function toXML (obj) { return js2xml( // need to wrap in an array to produce the correct results [createSoapEnvelope(obj)], // add the <?xml version="1.0" encoding="utf-8"?> header {xmlHeader:true} ); }
[ "function obj_to_xml(obj) {\n let xml_str = \"\";\n for (let item in obj) {\n console.log(`${item}: ${obj[item]}`);\n xml_str += `<${item}>${obj[item]}</${item}>\\n`\n }\n xml_str = `<data>\\n${xml_str}</data>`\n return xml_str;\n}", "function jsonObjToXmlStr(jsonObj){\n\t\tvar xmlStr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if firebase location is the last parent category
function isLastCategory(path) { var hasCard; // Initialize boolean firebase.database().ref(path).once("value", function(snapshot) // Reference snapshot { hasCard = snapshot.hasChild("Card1"); }); return hasCard; // Return boolean value }
[ "hasParentCategory() {\n return !!this._parent.length;\n }", "function isLast(idx) {\n const parent = inArr[idx][1];\n for (let i = idx + 1; i < inArr.length; i++) {\n if (inArr[i][1] === parent) {\n return false;\n }\n }\n return true;\n }", "isLast(ite...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the given element has the specified class. Returns the index of the class in the class list, or 1 if it does not exist.
function hasClass(element, className) { return element.className.split(' ').indexOf(className); }
[ "function hasClass(element, clas)\n{\n return (' ' + element.className + ' ').indexOf(' ' + clas + ' ') > -1;\n}", "function hasClass(element, name) {\n\t\t var list = typeof element == 'string' ? element : classList(element);\n\t\t return list.indexOf(' ' + name + ' ') >= 0;\n\t\t }", "function hasCl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On a mouse drag, we'll rerender the scene, passing in incremented angles in each time.
function mouseMove(event) { if (dragging) { yaw += (event.clientX - lastX) * 0.5; pitch += (event.clientY - lastY) * 0.5; var scene = SceneJS.scene("theScene"); yawRotate.set("angle", yaw); pitchRotate.set("angle", pitch); lastX = event.clientX; lastY = eve...
[ "function mouseMove(event) {\n if (dragging) {\n yaw += (event.clientX - lastX) * 0.5;\n pitch += (event.clientY - lastY) * -0.5;\n\n SceneJS.withNode(\"yaw\").set(\"angle\", yaw);\n SceneJS.withNode(\"pitch\").set(\"angle\", pitch);\n\n SceneJS.withNode(\"theScene\").render();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Search books in database and return array of matches based on query
searchBooks() { if (this.state.query === '' || this.state.query === undefined) { return this.setState({ searchResults: [] }) } BooksAPI.search(this.state.query.trim()).then(matches => { if (matches.error) { return this.setState({ searchResults: [] }) } else { // If book already on a shelf, update...
[ "getBooksMatchingQuery(books, query) {\n return books.filter((book) => {\n let bookName = RefSearcherQuery.normalizeQueryStr(book.name);\n return bookName.startsWith(query.book);\n });\n }", "function searchBooks() {\n API.searchGoogleBooks(searchTerm)\n .then(res => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get uniq test from orderObject
function getUniqTests(o) { var tests = []; o.services.forEach(function(s) { if (s.service_id.category == "TEST") tests.push(s.service_id); else if (s.service_id.category == "PROFILE") getProfileTests(s.service_id.childs); else if (s.service_id.category == "PACKAGE...
[ "unique() {\n return this.uniqueBy((one, two) => {\n return one.equals(two)\n })\n }", "function mockOrderedUniqueData() {\n\n setOfNumbers = [\n { date: \"2012-01-11\", visits: 2 }, // 2 point | 3 point\n { date: \"2012-01-12\", visits: 3 }, // 2.5 | null\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function is executed when toolData attribute is updated
handleToolDataUpdated() { this.problemsCount = this._toolData.problemsCount; }
[ "function changeTool ()\n\t{\n\t\t\n\t}", "function event_tool_change(e) {\n\t\tif (toolset[this.value]) {\n\t\t\tconsole.log(\"warunek if: true\");\n\t\t\ttool = new toolset[this.value]();\n\t\t}\n\t}", "function ev_tool_change (ev) {\r\n if (tools[this.value]) {\r\n tool = new tools[this.value]();\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper method for `this._getVisiblePages`. Should only ever be used when the viewer can only display a single page at a time, for example in: `PDFSinglePageViewer`. `PDFViewer` with Presentation Mode active.
_getCurrentVisiblePage() { if (!this.pagesCount) { return { views: [] }; } const pageView = this._pages[this._currentPageNumber - 1]; // NOTE: Compute the `x` and `y` properties of the current view, // since `this._updateLocation` depends of them being available. const elemen...
[ "updateVisibility() {\n this.pages_.forEach((page, index) => {\n if (page.relativePos === ViewportRelativePos.OUTSIDE_VIEWPORT) {\n if (page.isVisible()) {\n page.setVisibility(VisibilityState_Enum.HIDDEN);\n }\n } else if (page.relativePos !== ViewportRelativePos.LEAVING_VIEWPOR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets players with username similar to username limits to n results
searchPlayersLike(username, n=5){ return client({ method: 'GET', path: PLAYER_SEARCH_ROOT+"findPlayersByUsernameLike", params: { username: `%${username}%`, page: 0, size: n } }) }
[ "gather_players_for(player) {\n\t\tconst limit = this.thresholds.play_now\n\t\t//initially filter for N players in same region\n\t\tlet gather_players = this.players.filter((p) => {\n\t\t\treturn p.region == player.region\n\t\t}).slice(0, limit)\n\t\t//linear search through remaining players (in wait order)\n\t\tle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
9. Write a function that returns an array with the numbers 0 through 10
function arrayOneThrough10 () { let array =[]; for (i = 0; i <= 10; i++) { array.push(i); } console.log(array); }
[ "function makeNumbersArray() {\n let array = [0, 1, 2, 3, 4, 5];\n return array;\n}", "function arrayOfNumbers(num) {\n var newArray = [];\n\n for (var i = 1; i <= num; i++) {\n newArray.push(i);\n }\n return newArray;\n}", "function arrayOfNumbers(number) {\n var output = [];\n for (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
deviceready Event Handler The scope of 'this' is the event. In order to call the 'receivedEvent' function, we must explicity call 'app.receivedEvent(...);'
function onDeviceReady() { receivedEvent('deviceready'); }
[ "onDeviceReady() {\n this.receivedEvent()\n }", "function onDeviceReady() {\n\tconsole.log(\"onDeviceReady\");\n\treceivedEvent('deviceready');\n}", "function onDeviceReady() {\n // app.receivedEvent('deviceready');\n backb();\n}", "function bindEvents(){\ndocument.addEventListener('deviceready', th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch a value from a register onto the stack
fetch(register) { this.stack.push(this.fetchValue(register)); }
[ "fetchValue(register) {\n return this[_opcodes.Register[register]];\n }", "fetch(register) {\n let value = this.fetchValue(register);\n this.stack.push(value);\n }", "fetch(register) {\n this.stack.push(this.fetchValue(register));\n }", "fetchValue(register) {\n return this[Regis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the current rules file tree
function updateRulesFileTree() { $.ajax({ type: "GET", url: "/getJsonRulesTree", contentType: "application/json", dataType: "json" }) .done(function(d) { $('#rulesContainer').jstree(true).settings.core.data = d.rulesTree; $('#rulesContainer').jstree(true).refresh(); getTotalRulesCount();...
[ "loadRules() {\n var fs = require(\"fs\");\n var temp = JSON.parse(fs.readFileSync(this.path).toString());\n Object.keys(temp).forEach(key => {\n this.rules.set(key, temp[key]);\n });\n }", "function _update_rules() {\n var last_update = MOA.AN.Lib.getFilePref('upd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a StructureMapGroup resource
static get __resourceType() { return 'StructureMapGroup'; }
[ "static get __resourceType() {\n\t\treturn 'StructureMap';\n\t}", "addGroup() {\n this.mapping.groups.push({\n toPrefix: this.loaderPath ? this.loaderPath : null,\n properties: []\n });\n }", "static get __resourceType() {\n\t\treturn 'StructureMapStructure';\n\t}", "constructor() { \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DRIVING CAR BACK SCENE
drivingCarBack_scene(game) { window.cancelAnimationFrame(game.request); game.world.player.controlBlock = true; game.canvas.ctx.drawImage(game.findImage("stage0_bg"),0,0,game.canvas.cW,game.canvas.cH); game.canvas.ctx.drawImage(game.findImage("meteor"),this.stoneX,390,100,100); game.canvas.ctx.drawI...
[ "MoveBackwards(){\n this.velocityX -= Math.cos(this.car.rotation) * this.power;\n this.velocityY -= Math.sin(this.car.rotation) * this.power;\n }", "function driveAway() {\n game.pauseGameTimer();\n function moveRight() {\n car.position.x += 50;\n\n if (car.pos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse an account document and all of its attributes back to object
static async parseDocument(accountDocument) { const account = new Account(accountDocument.userName, accountDocument.password); account.id = accountDocument.id; const quizRefCollection = accountDocument.quizCollection; for (const quizSetRef of quizRefCollection) { const quizS...
[ "static deserializeAccounts(accounts) {\n const accountObjects = {};\n if (accounts) {\n Object.keys(accounts).map(function (key) {\n const serializedAcc = accounts[key];\n const mappedAcc = {\n homeAccountId: serializedAcc.home_account_id,\n environment: serializedAcc.env...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new MariaDbEngineVersion with an arbitrary version.
static of(mariaDbFullVersion, mariaDbMajorVersion) { return new MariaDbEngineVersion(mariaDbFullVersion, mariaDbMajorVersion); }
[ "static of(auroraMysqlFullVersion, auroraMysqlMajorVersion) {\n return new AuroraMysqlEngineVersion(auroraMysqlFullVersion, auroraMysqlMajorVersion);\n }", "static of(mysqlFullVersion, mysqlMajorVersion) {\n return new MysqlEngineVersion(mysqlFullVersion, mysqlMajorVersion);\n }", "static ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set sprite direction and animations
setSprite() { // Flip sprite if moving in a direction if (this.body.velocity.x > 0) { this.sprite.setFlipX(false); } else if (this.body.velocity.x < 0) { this.sprite.setFlipX(true); } // If not moving play idle animation if (this.body.velocity.x !== 0 || this.body.velocity.y !== 0)...
[ "function setSpriteDirection(sprite, direction) {\n if (direction === 'right') {\n sprite.scale.x = -1;\n }\n else {\n sprite.scale.x = 1;\n }\n}", "function setAnimDir() {\n if (player.Dir === \"Right\") {\n player.AnimDir = 10;\n }\n if (player.Dir === \"Left\") {\n player.AnimDir = 7;\n }\n if (p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate Date Object from fromDate and fromTime input
function generateFromDate(tDate, tTime) { if (!tDate) { return new Date(1); } else if (!tTime) { return new Date(tDate); } else { return new Date(tDate + " " + tTime); } }
[ "function createDateObject(time) {\n const date = new Date(time);\n const obj = {\n day: date.getDate(),\n weekday: date.getDay(),\n month: date.getMonth(),\n year: date.getFullYear(),\n milliseconds: date.getTime(),\n };\n return obj;\n }", "function make_date(date, time) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Walk through the DOM, and create a corresponding CodeTreeNode for each node
function transformDomToCodeTree(dom, sourceFile, appId) { var domRoot = dom; var stack = [ domRoot ], i, j, key, len, node, child, subchild; //Create a CodeTreeNode for the root var newCodeTreeNode = new CodeTreeNode("dom", "DocumentNode", null, sourceFile, appId); if (d...
[ "function Hdiode_code_tree(html_div, sources) {\n\n// This object implements a linked-pair of text/code-editor (using codeMirror) \n// and HTML xml tree-editor. The HTML representation of the tree is built using\n// an XSL transform which can be dynamically loaded/reloaded. \n// Optionally, an XSD schema can also ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
bind our event handlers to the web socket service, so that our callbacks get invoked for incoming events
function bindHandlers() { wss.bindHandlers(handlerMap); $log.debug('topo2 event handlers bound'); }
[ "static bindWebsocketEvents () {\n WebsocketsController.setConnectCallback((socket) => {\n socket.emit('publicIp', Restreamer.data.publicIp);\n socket.on('startStream', (options)=> {\n Restreamer.updateUserAction(options.streamType, 'start');\n Restreamer.u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete Role Confirm Dialog
function deleteRoleConfirm(role, ev) { // var confirm = $mdDialog.confirm() var index = vm.contacts.map(function (e) { if(e.hasOwnProperty("roles")){ return e.roles.findIndex(function (x) { return x.id === role.id }); }el...
[ "function deleteRole() {\n let role_id = $(this).data().roleid;\n\n DeleteDialog(\n \"Delete Role from Database\",\n \"Are you sure you want to remove the role from the database? <br> The action can <b>not</b> be reversed.\",\n \"role\",\n role_id\n );\n}", "function deleteRol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Concatenate a list of byte arrays into one.
function concatByteArrays(samplesList) { const length = samplesList.reduce((sum, samples) => sum + samples.length, 0); const allBytes = new Uint8Array(length); let offset = 0; for (const samples of samplesList) { allBytes.set(samples, offset); offset += samples.length; } return a...
[ "function concatBytes(...arrays) {\n if (!arrays.every((a) => a instanceof Uint8Array))\n throw new Error('Uint8Array list expected');\n if (arrays.length === 1)\n return arrays[0];\n const length = arrays.reduce((a, arr) => a + arr.length, 0);\n const result = new Uint8Array(length);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a tile is given, moves to that tile. Otherwise, it moves to a random adjacent tile.
move (tile) { let world = this.tile.world this.calories -= this.movementCost if (tile) { return world.moveObj(this.key, tile.xloc, tile.yloc) } let neighborTiles = this.tile.world.getNeighbors(this.tile.xloc, this.tile.yloc) let index = Tools.getRand(0, neighborTiles.length - 1) ...
[ "function moveTile(tile) {\n var tempCol = tile.col;\n var tempRow = tile.row;\n tile.col = OPEN_COL;\n tile.row = OPEN_ROW;\n OPEN_COL = tempCol;\n OPEN_ROW = tempRow;\n place(tile);\n }", "moveTile() {}", "spawnRandomTile() {\n const position = this.getRandomUnoccupiedPositon();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find the link that carries traffic for this address going to nodes[f] if sender is true coming from nodes[f] if sender if false. Add the link's id to the hops array
addClients(hops, f, val, sender, address) { const nodes = this.traffic.topology.nodes.nodes; if (!nodes[f]) return; const cdir = sender ? "out" : "in"; const uuid = nodes[f].uid(); const key = nodes[f].key; if (!this.traffic.QDRService.management.topology._nodeInfo[key]) return; const links ...
[ "addClients(hops, nodes, f, val, sender, address) {\n if (!nodes[f])\n return;\n const cdir = sender ? \"out\" : \"in\";\n const uuid = nodes[f].uid();\n const key = nodes[f].key;\n const links = this.traffic.QDRService.management.topology._nodeInfo[key][\n \"router.link\"\n ];\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loadEventOverUnderList() will setup the JSON object for list of Event Over/Under flag.
function loadEventOverUnderList() { Lookup.all({where: {'lookup_type':'OVER_UNDER'}}, function(err, lookups){ this.event_overunder_list = lookups; next(); // process the next tick. If you don't put it here, it will stuck at this point. }.bind(this)); }
[ "function loadEventsFromJson() {\n $.getJSON('events.json', (data) => {\n for (var i = 0; i < data.length; i++) {\n loadEvent(\n data[i].id,\n data[i].name,\n data[i].picture,\n data[i].location,\n data[i].price,\n data[i].startTime,\n data[i].salesCurrent,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modify absolute paths so that they work in the WASM file system.
function makeWasmAbsolute(paths, wasmRootFolder) { var pathList = paths; if (typeof paths === 'string') { pathList = paths.split(PATH_LIST_SEPARATOR); } // Rewrite absolute paths to be absolute in the WASM FS. for (var i = 0; i < pathList.length; ++i) { va...
[ "function fixPath(path) {\n // Let the developer write this function\n if (path.match(/^\\\\\\\\\\w+/))\n {\n var fix = path.replace(/(\\w+)(\\\\+)/g,'$1\\\\');\n return fix;\n }\n else\n {\n return false;\n }\n}", "function makeCorrespondingRelativeChange(a0,b0,a1,getCan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change detection ///////////////////////////// If node is an OnPush component, marks its LView dirty.
function markDirtyIfOnPush(lView,viewIndex){var childComponentLView=getComponentViewByIndex(viewIndex,lView);if(!(childComponentLView[FLAGS]&4/* CheckAlways */)){childComponentLView[FLAGS]|=8/* Dirty */;}}
[ "function markDirtyIfOnPush(node) {\n // Because data flows down the component tree, ancestors do not need to be marked dirty\n if (node.data && !(node.data[FLAGS] & 2 /* CheckAlways */)) {\n node.data[FLAGS] |= 4 /* Dirty */;\n }\n}", "function markDirtyIfOnPush(node) {\n // Because data flows...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes link between a reservation and a table as the reservation finishes
function remove(id){ return knex.transaction( async (trx) => { //table where the reservation is seated const table = await knex("tables").where({table_id: id}).first() return knex("reservations") .transacting(trx) .where({reservation_id: table.res...
[ "function deleteReservation(table_id) {\n return db(tableName)\n .where({ table_id })\n .update({ occupied: false, reservation_id: null })\n .then((rows) => rows[0]);\n}", "async function destroyReservation(req, res, next) {\n const reservation_id = res.locals.table.reservation_id;\n const updatedTabl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Same as the above function, but only displays the assignments that have a status of 'upcoming'.
function displayUpcomingAssignments(current_course) { for(var i=0;i<course_list.length;i++){ if(course_list[i] == current_course) { var assignment_list = course_assign_list[i]; } } assignments_section.innerHTML = ``; var j = 0; for(var i=0;i<assignment_list.lengt...
[ "function toggleUpcoming() {\n\t\tvar current_day = new Date().getDay();\n\t\tvar selected_day = $('#day li.active a').first().attr('data-id');\n\t\tvar selected_time = $('#time li.active a').first().attr('data-id');\n\t\tif (current_day != selected_day) {\n\t\t\t$('#time li.upcoming').addClass('hidden');\n\t\t\tif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update_text_labels Updates the storyline's text labels.
function update_text_labels(x,y){ var val = parseFloat($("#line_thickness_slider").val()); var padding = {right: 20, left: 20}; // in px var background = d3.selectAll(".text_label_background") .transition() .attr("x",function(d){ if(d.type === "start") return x(d.x) + Math.ceil(val/2); el...
[ "updateLabelText() { }", "updateLabel() {\n this.text = this._text;\n }", "_updateLabels() {\n this._updateLabel(this._$fixItLabel,\n this._reviewView.hasOpenIssues(),\n 'has-issues');\n this._updateLabel(this._$shipItLabel,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call server to get reports
function get_reports() { var dataObj = { "content" : [ { "session_id" : get_cookie() } ] }; call_server('get_reports', dataObj); }
[ "function requestAllReport() {\n requestReports(\"MX\");\n}", "async getAllReports() {\n return await axios.get(endpoint + \"reports\");\n }", "function getReport () {\n var xmlReq = new XMLHttpRequest()\n\n xmlReq.onload = function () {\n if (xmlReq.status == 200) {\n populateFields(xmlReq.respo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function: to copy a node
function node_copy(_node){ var newnode=null; if (_node===null){ } else { newnode=node_add(nodeInitialPos, default_RADIUSH,default_RADIUSV, defaultFONTSIZE, _node.type); newnode = { id: newnode.id , type: _node.type , x:_node.x , y:_node.y , rx: _node.rx ,ry:_node.ry , s...
[ "function _nodeCopy(n){//Work in progress !!!!\r\n\t\t\tvar new_n={id:n.id};\r\n\t\t\tif(n.coord)\r\n\t\t\t\tnew_n.coord=_copyAssos(n.coord);\r\n\t\t\tif(n.hierarchy){\r\n\t\t\t\tnew_n.hierarchy={};\r\n\t\t\t\tif(n.hierarchy.parents)\r\n\t\t\t\t\tnew_n.hierarchy.abstraction=Object.keys(n.hierarchy.parents);\r\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Closes the shared action menu after a short delay, so when a checkbox is clicked it can be seen to change state before disappearing.
closeMenuSoon_() { const menu = /** @type {!CrActionMenuElement} */ (this.$$('#menu').get()); setTimeout(() => { if (menu.open) { menu.close(); } }, kMenuCloseDelay); }
[ "close_() {\n this.storeService_.dispatch(Action.TOGGLE_SHARE_MENU, false);\n }", "function handleCloseMenu() {\n timeoutRef.current = setTimeout(() => {\n setMenu(false);\n }, 250);\n }", "_hideShowMenuDelayed() {\n if (this.collapseTimeout) {\n clearTimeout(this.collapseTimeout);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set data with a random value
setDataWithRandom() { for (let key in this.qKey) { if (this.qKey[key] === this.field) { this.entryPoint = Number(key); } } var qKey = Math.floor(Math.random() * this.items.length); this.dataPoint = this.items[qKey][this.entryPoint]; this.render(); }
[ "function processRandom (data) {\n setRandom(data)\n}", "function processRandom (data) {\n controls.setRandom(data)\n}", "function updateRandom() {\n series[0].data = getRandomData();\n console.log(series[0].data)\n plot.setData(series);\n plot.draw();\n }", "function upda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove container in window when it's smaller than 992px
function checkWindowSize() { if ($(window).width() < 990) { $("#body").removeClass("container"); } else $("#body").addClass("container") }
[ "function checkWindowSize() {\n if ($(window).width() < 990) {\n $(\"#learning-content\").removeClass(\"container mt-5\");\n } else $(\"#learning-content\").addClass(\"container mt-5\")\n}", "function toggle() {\n if (window.innerWidth < 751) {\n menuStyle.removeAttribute(\"class\", \"respo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find a topic in the tree: the topic is set in topicToDisplay returns true if success
function findTocTopic() { var toc_window = window.frames["ory_toc"]; // check for false is not safe since the value might be undefined if the frame is not loaded yet //if (toc_window.toc_loaded == false ) if ( toc_window.toc_loaded != true ) { //if ( toc_window.toc_loaded == undefined ) //{ // ale...
[ "function _findTopic(id) {\n \n var found = null;\n $.each(_topics, function(i, item){\n if (item.id == id) {\n found = item;\n return false; // this exist the each loop\n }\n \n });\n return found;\n }", "mat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an object with six keyvalue pairs containing the urls (or url mip arrays) for each cube face
async function getImageCubeUrls(getUrl, options) { // Calculate URLs const urls = {}; const promises = []; let index = 0; for (const face in CUBE_FACES) { const faceValues = CUBE_FACES[index]; const promise = Object(_load_image__WEBPACK_IMPORTED_MODULE_1__["getImageUrls"])(getUrl, options, {...faceVa...
[ "function setupTextures() { \r\n cubeTexture = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, cubeTexture);\r\n\r\n const faceInfos = [\r\n {\r\n target: gl.TEXTURE_CUBE_MAP_POSITIVE_X,\r\n url: 'box/pos-x.png'\r\n },\r\n {\r\n target: gl.TEXTURE_CUBE_MAP_NEGATIVE_X,\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The loadSession function is a callback function for the gameSession.php getJSON function. It finds and loads the game box file.
function loadSession(session) { BD18.gm = null; BD18.gm = session; if( !BD18.doneWithLoad ){ BD18.history = [JSON.stringify(BD18.gm)]; BD18.historyPosition = 0; var boxstring = 'box='; boxstring = boxstring + BD18.gm.boxID; $.getJSON("php/gameBox.php", boxstring, loadBox) .fail(function() { var ms...
[ "function loadSession(session) {\n BD18.gm = null;\n BD18.gm = session;\n if( !BD18.doneWithLoad ){\n\tBD18.history = [JSON.stringify(BD18.gm)];\n\tBD18.historyPosition = 0;\n\tvar boxstring = 'box=';\n\tboxstring = boxstring + BD18.gm.boxID;\n\t$.getJSON(\"php/gameBox.php\", boxstring, loadBox)\n\t .fail(fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function to add user marker to the map.
function addMarker(userData){ marker = new google.maps.Marker({ position: userData.location.location, map: map, // types and icons defined in map utilities. icon: icons[types[userData.destination].type].icon }); let contentString = '<strong> Destination : </strong>'+'<strong>'+userData.destination+'</...
[ "addUserMarker() {\n if (!this.longitude) return;\n if (this.userMarker) this.userMarker.remove();\n this.userMarker = new mapboxgl.Marker(\n this.userMarkerOptions[this.userMarkerStyle]\n )\n .setLngLat([this.longitude, this.latitude])\n .setPopup(\n new mapboxgl.Popup().setHTML(`...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function does the "gravityAnimation" routine
function gravityAnimationRoutine() { playerLevelEnvironment.gravityAnimationYModifier = playerLevelEnvironment.gravityAnimationYModifier + gameLevelEnvironment.gravityAnimationFallingSpeed; if (playerLevelEnvironment.gravityAnimationYModifier < gameLevelEnvironment.pixelSize) { drawPlayArea...
[ "function startGravity(){\n\t\tif(!gravity){\n\t\t\tAnimationHandler.setGravitationSpeed(gravitationspeed);\n\t\t\tgravity=true;\n\t\t\tgravitate();\n\t\t} else {\n\t\t\tAnimationHandler.setGravitationSpeed(gravitationspeed/3);\n\t\t}\n\t}", "gravity() {\n // Move down\n this.y += this.speedY;\n // Ondul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_onBlur changes the state on_focus to false and decide if the text is invalid
_onBlur() { if (this.props.enabled === false) { return; } this.setState({on_focus: false}); var message = this._validateAndReturnMessage(this.state.text); if (message) { // error happens this._enableErrorState(message); // call invalid callback if (this.props.invalidCallback)...
[ "_onBlur() {\n this.setState({on_focus:false});\n var message = this._validateAndReturnMessage(this.state.text);\n if (message) { // error happens\n this._enableErrorState(message);\n // call invalid callback\n if (this.props.invalidCallback)\n this.props.invalidCallback();\n } els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test accessibility using gulpaccessibility
function testAccessibility() { return src('./**/*.html') .pipe(access({ force: true })) .on('error', console.log) .pipe(access.report({reportType: 'txt'})) .pipe(rename({ extname: '.txt' })) .pipe(dest('reports/txt')); }
[ "function testAccessibility2() {\n return pa11y(\"./build/index.html\").then((results) => { \n console.log(results);\n })\n}", "function runA11yChecks() {\n return window.axe.run(document, {\n runOnly: {\n type: 'tag',\n values: [\n 'wcag2a',\n 'wcag2aa'\n ]\n },\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assigns temp output to actual output, setting neuron state.
update() { this.output = this.tempOutput; }
[ "function OutputNode(x1,y1) { \n this.x1 = x1;\n this.y1 = y1;\n this.state = low;\n this.eval = function() { return this.state; }; \n this.isInput = false; \n this.isHV = false;\n this.wire = makeWire(x1,y1,this);\n}", "randomise() {\n for(let i = 0; i < this.numOutputs; i++)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set an undefined or wildcarded principal on these statements
function defaultPrincipal(principal, statements) { statements.forEach(s => s.principals.replaceEmpty(principal)); statements.forEach(s => s.principals.replaceStar(principal)); return statements; }
[ "addPrincipalConditions(conditions) {\n // Stringifying the conditions is an easy way to do deep equality\n const theseConditions = JSON.stringify(conditions);\n if (this.principalConditionsJson === undefined) {\n // First principal, anything goes\n this.principalCondition...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an access token for the given URL.
async createToken(url, session) { return PoPToken.issueFor(url, session); }
[ "function AccessTokenGenerator(endPointUrl) {\n var promise = new (require('promise-lite').Promise);\n var query = '?' + require('querystring').stringify({\n \"openid.ns\": 'http://specs.openid.net/auth/2.0',\n \"openid.mode\": \"associate\",\n \"openid.assoc_type\": \"HMAC-SHA1\",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display status messages based on boolean task_status value. Called form within the for loop and applied to individual task objects.
function getStatus(status) { let taskStatus; if (status) { taskStatus = 'Completed'; } else { taskStatus = 'In progress'; } return taskStatus; }
[ "function updateTaskStatus() {\n let foundNextTask = false;\n\n vm.tasks.forEach(task => {\n // Set isForbidden\n task.isForbidden = !task.non_admin_may_edit && User.isNonAdmin();\n\n // Hide controls if hidden from non-admins\n task.isDataHidden = task.data_admin_only_visible ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
insert line break to the current position
insertLinebreak() { this.insertText('\n'); }
[ "function insertLineBreak() {\n lineWidths.push(lineWidth);\n poem = poem.concat(\"\\n\");\n lineWidth = width/2 + 20;\n period();\n}", "function newLine(){\n $(settings.el).delay(settings.speed).queue(function (next){\n var currTextNoCurr = $(this).html().substring(0, $(this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start tracking web vitals
function startTrackingWebVitals(reportAllChanges = false) { const performance = getBrowserPerformanceAPI(); if (performance && browserPerformanceTimeOrigin) { if (performance.mark) { WINDOW.performance.mark('sentry-tracing-init'); } _trackCLS(); _trackLCP(reportAllChanges); _trackF...
[ "function startTracking() {\n\t tracking.startTracking();\n\t }", "function startTrackingWebVitals() {\n const performance = getBrowserPerformanceAPI();\n if (performance && browserPerformanceTimeOrigin) {\n if (performance.mark) {\n WINDOW.performance.mark('sentry-tracing-init');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the state with the task name given by the user
async update_task_name(event) { await this.setState({ task_name: event.target.value}); }
[ "updateTaskName() {\n if (this.taskBlock) {\n let input = this.taskBlock.querySelector(TASK_ITEM_INPUT_SELECTOR);\n if (input.value) {\n this.name = input.value;\n }\n }\n }", "function changeCompleteState(taskName) {\n const taskList = parseJSONFromLocalStorage(\"taskList\", []);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Operations about the CSP2 service [BETA] [See on api.ovh.com](
ListAvailableServices() { let url = `/saas/csp2`; return this.client.request('GET', url); }
[ "function getServiceCatalog () {\n return [\n {\n id: '5E3F917B-9225-4BE4-802F-8F1491F714C0',\n name: 'apigee-edge',\n description: 'Apigee Edge API Platform',\n bindable: true,\n tags: ['api', 'api management', 'api platform'],\n metadata: {\n displayName: 'Apigee Edge API ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the required attributes on the email and telephone elements.
function checkAttrib() { var tel = document.getElementById("phn"); var email = document.getElementById("email"); // If BOTH fields are empty if ((tel.validity.valueMissing && email.validity.valueMissing) || (tel.value === "" && email.value === "")) { // Add the required attributes. tel.s...
[ "function CheckRequiredAttributes() {\n\t\t\t\t\n\t\t\t}", "function setPerfilDataRequired(){\n nomeInp.setAttribute(\"required\",\"\");\n emailInp.setAttribute(\"required\",\"\");\n}", "function removePerfilDataRequired(){\n nomeInp.removeAttribute(\"required\");\n emailInp.removeAttribute(\"requir...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convenience method to get authentication state for a user, which should include the 'user' class property; this method is used in the component.
getAuthState() { return this.user; }
[ "getAuthState() {\n\n return {\n ...this.user\n };\n }", "function getUserState() {\n\treturn UserInfoStore.getUserInfo();\n}", "function getAuthentication(){\n\n // If the user isn't currently authenticated\n if(!AuthService.getAuth().authenticated){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorts the compressed images by most bytes saved.
function sortByBytesSaved(a, b) { var aSaved = a.getBytesSaved(); var bSaved = b.getBytesSaved(); return (aSaved > bSaved) ? -1 : (aSaved == bSaved) ? 0 : 1; }
[ "function logoSort () {\n\t\tvar logImg = $('.logo_tiimg01 img') ;\n\t\tlogImg.each(function(){\n\t\t\t$(this).load( imgSizeChk ) ;\n\t\t}) ;\n\t}", "sortPixels() {\n return this.state.image.pixels.sort(function(a, b){\n return a.id-b.id\n })\n }", "function sortSize(){}", "function sortImgArr(a,b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Does a post to the signup route. If successful, we are redirected to the members page Otherwise we log any errors
function signUpUser(email, password) { $.post("/api/signup", { email: email, password: password }) .then(() => { window.location.replace("/members"); // If there's an error, handle it by throwing up a bootstrap alert }) .catch(handleLoginErr); }
[ "function signUpUser() {\n var userData = {\n email: emailInput.val().trim(),\n first_name: fname.val().trim(),\n last_name: lname.val().trim(),\n address: add.val().trim(),\n city: cty.val().trim(),\n state: st.val().trim(),\n zipcode: zcode.val().trim(),\n cell_phone: cp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the maximum date from the range input.
_getMaxDate() { return this._rangeInput.max; }
[ "function getMaxDate(product) {\n maxDate=valid_date_ranges[product][1]\n return maxDate;\n }", "_getMaxDate() {\n return this._max;\n }", "function findMaxDate() {\n var maxDate;\n\n if (modelParameters.userHasSelectedEndDate) {\n return modelParameters...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }