query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
This function build player params to put it on map Function buildPlayerParams(playerData)
buildPlayerParams(playerData){ let that = this; let playerParams = {}; let i = 0; return new Promise((resolve, reject) => { Object.keys(playerData).forEach((e) => { let player = playerData[e].data.split('-'); playerParams[i] = {}; playerParams[i].name = player[1]; playerParams[i].x = parseInt...
[ "function buildPlayerMap() {\n var players = collectPlayers();\n\n // add an Object to playerMap for each player, the index is used as key\n _.each(players, function (player, i) {\n playerMap[i] = {};\n playerMap[i][\"name\"] = player;\n playerMap[i][\"connectio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verifies that we're working with a supported breakpoint name Accepts a string. Returns a boolean Valid breakpoints: 'mobile', 'tablet', 'desktop'
function isValidBreakpoint(bp) { if (!bp || typeof bp !== 'string') { return false; } bp = bp.toLowerCase(); return bp === 'mobile' || bp === 'tablet' || bp === 'desktop'; }
[ "function currentBreakpoint(breakpoint) {\r\n if(typeof breakpoint === \"undefined\"){\r\n return false;\r\n }\r\n\r\n switch (breakpoint){\r\n case \"undefined\":\r\n return false;\r\n case \"small-screen\":\r\n return Modernizr.mq('screen and (max-width:499px)');\r\n case \"medium-screen\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ SelectedDateProperty property changed handler. / / DatePicker that changed its SelectedDate. / DependencyPropertyChangedEventArgs. private static void
function OnSelectedDateChanged(/*DependencyObject*/ d, /*DependencyPropertyChangedEventArgs*/ e) { /*DatePicker*/var dp = d instanceof DatePicker ? d : null; // Debug.Assert(dp != null); /*Collection<DateTime>*/var addedItems = new Collection(); /*Collection<DateTime>*/var re...
[ "onDateSelected(value) {\n this.value = value;\n }", "onDateSelectedListen(event) {\n const detail = event.detail;\n this.selectedDate = this.getFormattedDate(detail.month, detail.date, detail.year);\n }", "function OnSelectedDateFormatChanged(/*DependencyObject*/ d, /*DependencyPrope...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the playback offset and elapsed milliseconds counters.
function updatePlaybackOffset(state, dt) { const deltaOffset = dt / state.msPerOffset; return state .update('elapsedMs', (elapsedMs) => elapsedMs + dt) .update('playbackOffset', (offset) => offset + deltaOffset); }
[ "function updateOffsets() {\n if (Status.onBreak) {\n return;\n }\n var workDone = timeDiff(Times.now, Times.start) * Settings.audioRatio;\n Offsets.audio_s += workDone;\n Offsets.break_s += workDone * Settings.breakRatio;\n Times.start = Times.now;\n}", "function timeUpdate() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A generic function to find elment by ID. If element is not found return document.
function findById(id) { var element; if(document.getElementById) var element = document.getElementById(id); return (element)? element : document; }
[ "function find(doc, element, id) {\n if (!element) {\n element = doc.getElementById(id);\n if (!element) {\n throw new Error('Missing element, id=' + id);\n }\n }\n return element;\n}", "function find_element_by_id(element_id) { \n return $('#' + element_id)[0];\n }", "function fin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build the vertex_registry where all the vertices are stored with the name without a hierarchy
_buildVertexRegistry(vertices) { Object.keys(vertices).forEach(vertexName => { const vertex = vertices[vertexName]; vertex.name = vertexName; this.vertices_registry[vertexName] = vertex; if (vertex.vertices) { // check that each element has a 'tdg' element this._buildVertexRegistry(vertex.vertices...
[ "function Vertex(name){\n this.name = name\n this.edges = []\n}", "function createVertices(vertices) {\n\n //For each vertice in the graph\n $.each(vertices, function () {\n\n //create vertex and append it to drawing area\n var tempVertex = jQuery('<div/>',{\n id: this.label,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles new properties being passed into This will be replaced by static getDerivedStateFromProps(nextProps, prevState) in React 17. This sits in the lifecycle right before `shouldComponentUpdate`, `componentWillUpdate`, and most importantly `render`, so this is where we will call the plot's `reload` and `headermod` me...
UNSAFE_componentWillReceiveProps(nextProps) { const { data: currentData, options: currentOptions, layerOptions: currentLayerOptions, } = this.props; const { data: nextData, options: nextOptions, layerOptions: nextLayerOptions, } = nextProps; // if the data chang...
[ "UNSAFE_componentWillReceiveProps(nextProps) {\n const {\n data: currentData,\n options: currentOptions,\n layerOptions: currentLayerOptions,\n } = this.props;\n const {\n data: nextData,\n options: nextOptions,\n layerOptions: nextLayerOptions,\n } = nextProps;\n\n // i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
push the humans coordinates into the map
function createHumanStrict(coords, map) { map.humans.push(coords); map.occupied.push(coords); }
[ "function initialCoords()\r\n{\r\n\t/*for(var i = 0; i !== 1;i++)\r\n\t{\r\n\t\tencounteredCoords[playerLocation].push(duplicatePlayerLocation(playerLocation), levelExitLocation);\r\n\t}*/\r\n}", "function update() {\n for (var i = 0; i < _this.dataMap.length; i++) {\n _this.globe.addPoint(_this.dataM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EZgetKeyValue Description: Looks for a key = value string in the input string and returns the value portion. Parameters: optionsString to be searched keyKey searching for in options Returns: If key is found, the associated value is returned, otherwise return blank string.
function EZgetKeyValue( pOptions, pKey) { var pos; var str; var keyEqual; //----- Search for key= keyEqual = pKey + "="; str = "," + pOptions; pos = str.toLowerCase().indexOf( keyEqual.toLowerCase() ); if (pos == -1) // key not found str = ""; else { //----- Keep everything after = str = pOptions.sub...
[ "function EZgetKeyValue( pOptions, pKey)\n{\n\tvar pos;\n\tvar str;\n\tvar keyEqual;\n\n\t//----- Search for key=\n\tkeyEqual = pKey + \"=\";\n\tstr = \",\" + pOptions;\n\tpos = str.toLowerCase().indexOf( keyEqual.toLowerCase() );\n\n\tif (pos == -1) \t// key not found\n\t\tstr = \"\";\n\telse\n\t{\n\n\t\t//----- K...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Spawns a random unit in a random lane
spawnUnit(){ let laneNum = Math.floor(Math.random() * 3) + 1; return this.gameScene.spawnUnit(this.enemyTypes[Math.floor(Math.random() * this.enemyTypes.length)], -1, this.gameScene.getLane(laneNum)); }
[ "spawnRandomTile() {\n const position = this.getRandomUnoccupiedPositon();\n if (!position) return;\n const { row, column } = position;\n this.createTile(row, column, 2);\n }", "spawn()\n\t{\n\t\t//random point on a rectangle\n\t\tlet spawnPoint = getRandomSpawnPoint();\n\n\t\tlet nextEnemy = new ene...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Take documents returned from nedb and verify NedbStatsListener is populating correctly
function verifyDocs(docs) { expect(docs).to.have.length.above(0); Logger.info('db has docs: ', docs); for (var i = 0; i < docs.length; i++) { var doc = docs[i]; expect(doc).to.have.ownProperty('host'); expect(doc).to.have.ownProperty('v...
[ "async function analyze(callback) {\n console.log(\"querying firestore\")\n var data = await query(db, ref);\n console.log(\"queried!\")\n\n for (var i = 0; i < dataOut.length; i++) {\n var dataObj = dataOut[i];\n var sessions = dataOut[i].sessions;\n console.log(\"Analyzing Demo:\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set G of RGB on hover background.
set HoverG(value) { this._hoverG = value; }
[ "get hoverBackgroundColor() {\n return brushToString(this.i.s7);\n }", "set HoverG(value) {\n this._hoverTextG = value;\n }", "function red_bg(){\n r = 255\nb = 0;\ng=0;\n}", "get actualHoverBackgroundColor() {\n return brushToString(this.i.ne);\n }", "function green_bg()\n{\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SIDE TO SIDE LOGIC
function sideToside () { if (playerTurn === 0) { leftToRight(); } else if (playerTurn === 1) { rightToLeft(); } }
[ "function Side() { }", "getSide() { return 0; }", "function switchSideHandler() {\n msgBox.changeText(\"Sides have been switched! Position your players.\");\n\n //swap colors\n var tempColor = team1Color;\n team1Color = team2Color;\n team2Color = tempColor;\n //swap id\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update UI/check status of all permanents this player controls.
updatePermanents() { //Update UI for all permanents this.permanents.concat(this.lands).forEach(permanent => permanent.update()); }
[ "update() {\n this.updateHealthBar();\n this.pauseMusic();\n this.checkWinCondition();\n \n }", "function updateControls() {\n\tvar numControls = controls.length;\n\n\tfor ( var i = 0; i < numControls; i++ ) {\n\t\tcontrols[ i ].update();\n\t}\n}", "function updatePlayers() {\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add new playlist status music
function displaySongUpdateStatus(data) { var obj = JSON.parse(data); var cssSelector = { jPlayer: "#jquery_jplayer_2", cssSelectorAncestor: "#jp_container_2" }; var playlist = []; var options = { swfPath: "js", supplied: "mp3", useStateClassSkin: true }; var myPlaylist = new jPlayerPlaylist...
[ "function add_to_playlist(file)\n {\n make_command_request (\"add_to_playlist \" + file , response_callback_gen_status);\n }", "function addSongs(){\n handleFolder(player.folder, function(){\n //Making playlist\n player.counter = 0;\n player.playlist = \"\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the activated route proxy for the given component to the new incoming router state
updateActivatedRouteProxy(component, activatedRoute) { const proxy = this.proxyMap.get(component); if (!proxy) { throw new Error(`Could not find activated route proxy for view`); } proxy._futureSnapshot = activatedRoute._futureSnapshot; proxy._routerState = activatedR...
[ "createActivatedRouteProxy(component$, activatedRoute) {\n const proxy = new _angular_router__WEBPACK_IMPORTED_MODULE_4__[\"ActivatedRoute\"]();\n proxy._futureSnapshot = activatedRoute._futureSnapshot;\n proxy._routerState = activatedRoute._routerState;\n proxy.snapshot = activatedRoute...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function expects the Request Express.js object and an array as input. The array is then validated against freemium and protier rate limiting requirements. A boolean is returned to indicate if the array size if valid or not.
validateArraySize (req, array) { const FREEMIUM_INPUT_SIZE = 20 const PRO_INPUT_SIZE = 20 if (req.locals && req.locals.proLimit) { if (array.length <= PRO_INPUT_SIZE) return true } else if (array.length <= FREEMIUM_INPUT_SIZE) { return true } return false }
[ "_isExceededQuota(request) {\n const {\n maxPayloadSize = this._quota.maxPayloadSize,\n maxResponseSize = this._quota.maxResponseSize,\n maxDuration = this._quota.maxDuration\n } = request.quota || {};\n return request.payloadSize > maxPayloadSize || request.responseSize > maxResponseSize ||...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Share the site on facebook with a specific image reference:
function fbShareImage(imageURL) { FB.ui({ method: 'feed', link: 'http://www.unbrokenfilm.com', // description: 'Angelina Jolie directs and produces Unbroken, an epic drama that follows the life of an Olympian and war hero Louis Zamperini. Learn more about the movie Unbroken from the official movie site.',...
[ "function shareToFacebook(){\n var url = window.location.host + vm.url;\n fb_publish(vm.title, vm.detail, url , vm.imgsrc);\n }", "function sharePhoto() {\n\tFB.api(\"me/photos\", \"post\", {\n url: \"https://platformtest.herokuapp.com/1200630.jpg\",\n message: 'My awesome photo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the statement and response to the conversation.
async addToConversation(conversationId, statement, response) { const Statement = this.getModel("statement") const Conversation = this.getModel("conversation") let conversation = await Conversation.get(conversationId) let statementQuery = await Statement.findOne({where: {text: statement.text}}) let ...
[ "addStatement(stmt) {\n this.statements.push(stmt);\n }", "addStatement(stmt) {\n this.statements.push(stmt);\n }", "function addResponse(req, res) {\n var id = req.params.id;\n var responseId = req.params.response_id;\n\n var question1 = Question.findById(id, function(err, questi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Specifies the sequence in which content types are displayed.
get contentTypeOrder() { return tag.configure(SharePointQueryableCollection(this, "contentTypeOrder"), "f.contentTypeOrder"); }
[ "function ALL_TYPE_RECORD$static_(){NavigationTreeCollectionViewExtension.ALL_TYPE_RECORD=( {\n name: com.coremedia.cap.content.ContentTypeNames.CONTENT,\n label: mx.resources.ResourceManager.getInstance().getString('com.coremedia.cms.editor.Editor', 'Navigation_show_all'),\n icon: mx.resources.ResourceMan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all polygons in this BSP tree that are inside the other BSP tree `tree`.
clipTo (tree, alsoRemovecoplanarFront) { let node = this const stack = [] do { if (node.polygontreenodes.length > 0) { tree.rootnode.clipPolygons(node.polygontreenodes, alsoRemovecoplanarFront) } if (node.front) stack.push(node.front) if (node.back) stack.push(node.back) ...
[ "clipPolygons (polygontreenodes, alsoRemovecoplanarFront) {\n let current = { node: this, polygontreenodes: polygontreenodes }\n let node\n const stack = []\n\n do {\n node = current.node\n polygontreenodes = current.polygontreenodes\n\n if (node.plane) {\n const plane = node.plane...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Trims excess whitespace off the ends of the input, and if the input is empty, alerts user. Otherwise, creates a new folder according to the input value of the "newName", and updates the list of folders
function createNewFolder(){ var folder = document.getElementById("newName").value; var folderName = folder.trim(); if (folderName !== ""){ tryCreateNewFolder(folderName); updateFolders(); saveData(); }else{ alert("Can't have a folder name with all whitespace.") } }
[ "function onChangeFolderName() {\n\n\t// Get the folder name and check it.\n\tvar folderName2 = folderNameInput.value;\n\tif (!checkName(folderName2)) {\n\t\tdocument.getElementById('folderNameRules').style.color = 'Red';\n\t\tshowFolderPath(null, folderType);\n\t}\n\telse {\n\t\tdocument.getElementById('folderName...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes an immediate into its value.
function decodeImmediate(value) { if (false /* LOCAL_DEBUG */ ) {} if (value > 1073741823 /* MAX_INT */ ) { switch (value) { case 1073741824 /* FALSE */ : return false; case 1073741825 /* TRUE */ : return true; case 1073741...
[ "function decodeImmediate(value) {\n if (value > 1073741823\n /* MAX_INT */\n ) {\n switch (value) {\n case 1073741824\n /* FALSE */\n :\n return false;\n\n case 1073741825\n /* TRUE */\n :\n return true;\n\n case 1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_ESAbstract.ToNumber 7.1.3. ToNumber ( argument )
function ToNumber(argument) { // eslint-disable-line no-unused-vars return Number(argument); }
[ "function toNum(x) {return Number(x.replace(\",\", \".\"));}", "toNumber() {\r\n return trits_1.Trits.fromTrytes(trytes_1.Trytes.fromString(this._trytes)).toNumber();\r\n }", "function toNumber(str) { //create the function with a string argument\n return Number(str); //convert the string (str) to a n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
THIRD VIEW on veggie submit pull up plot options
function thirdView(){ $('#vegSubmit').on('click', function (){ event.preventDefault(); if(veggieChoices.length <= 15 && veggieChoices.length > 10){ $("#plotChoices2 option[value='twoRows']").remove(); $("#plotChoices2 option[value='oneRow']").remove(); $('#veggieChoices').slideDown(1000, fu...
[ "function fourthView(){\n populateAppropGridOnSubmit();\n populateAppropGridWhenPlotClicked();\n }", "chosen_plot() {\n this.createPlot();\n }", "function secondView(){\n\n $('.veggie').on('click', function (){\n\n $('.veggie').slideDown(1000, function(){\n\n $(this).remove();\n $('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store the email address of the current user, for later use.
function save_user_email(user) { if ($("#userEmail")) { $("#userEmail").html(user.email); } }
[ "function set_user_email(env, email) {\n env.auth.user.user_email = email;\n}", "function set_new_user_email(env, email) {\n init_new_user_storage(env);\n env.auth.new_user.user_email = email;\n}", "get userEmail() {\n var _a;\n return (_a = this._data.email) !== null && _a !== void 0 ? _a : nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
new FileWatcher(filepath: string, delay: number, onchange: ()) Watch a filepath for changes, calling `onchange` when the file changes. Mostly a wrapper around fs.watch / fs.FSWatcher, but with some debounce. delay Milliseconds to wait before calling onchange again. A delay of 0 means onchange will be called immediately...
function FileWatcher(filepath, delay, onchange) { this.filepath = filepath; this.onchange = onchange; this.delay = delay; }
[ "function create_onchange(file_to_watch, file_to_change, last_hash, regex, replace_str_pre)\n {\n return function ()\n {\n if (debugging) {\n console.log((new Error).stack.replace(/[^\\n]*\\n[^\\n]*\\:(\\d+\\:\\d+)[\\s\\S]*/, \"$1\"), file_to_watch);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To add a coroutine, call co.routine(generatorFunction)
routine(generator) { this._stack.add(generator()) }
[ "function coroutine(gen) {\n return function coroutineHandler(...args) {\n const g = gen(...args);\n g.next();\n return g;\n };\n}", "function coroutine (g) {\n // Get a generator and assing it to `it`.\n // Notice `g()` doesn't execute the generator, but returns one instead.\n var it = g()\n\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
let pastDataArrLen = pastDataArr.length console.log(pastDataArr[pastDataArrLen 2].dailyconfirmed) console.log(pastDataArr[pastDataArrLen 1].dailyconfirmed)
function getPreviousData(arr) { let data = [] if (arr) { for (let i = arr.length - 1; i >= 0; i--) { if (arr[i].dailyconfirmed && arr[i].date) { data.push(arr[i]) } } return data } }
[ "function accessesingData3() {\n var date = [];\n for (var i = 0; i < store.length; i++) {\n date.push(store[i].date)\n }\n return date.length\n}", "function accessesingData1() {\n let bananaSaleDates = [];\n for (var i = 0; i < store2['sale dates']['Banana Bunches'].length; i++) {\n bananaSaleDates.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dispatches the audio packet previously prepared by prepareAudioPacket(opusPacket). The audio packet is consumed and cannot be dispatched again.
dispatchAudio() { const state = this.state; if (state.code !== NetworkingStatusCode.Ready) return false; if (typeof state.preparedPacket !== 'undefined') { this.playAudioPacket(state.preparedPacket); state.preparedPacket = undefined; return true; ...
[ "prepareAudioPacket(opusPacket) {\n const state = this.state;\n if (state.code !== NetworkingStatusCode.Ready)\n return;\n state.preparedPacket = this.createAudioPacket(opusPacket, state.connectionData);\n return state.preparedPacket;\n }", "playAudioPacket(audioPacket) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method removes given node from mentioned position in linklist pos > index of node which is to be removed.
remove(pos) { let curr = this.head; let prev; let count = 0; if (pos == 0) { this.head = curr.next; // removes element from head } else if (pos === this.size) { while (count < pos) { prev = curr; curr = curr.next; ...
[ "removeAt(pos) {\n\t\t//empty node\n\t\tif (this.isEmpty()) return;\n\t\telse {\n\t\t\t//pos = 0;\n\t\t\tif (pos === 0) {\n\t\t\t\tlet node = this.getAt(0);\n\t\t\t\tthis.head = node.next;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (pos === this.size()) pos = pos - 1;\n\t\t\tlet prev = this.getAt(pos - 1);\n\t\t\tprev = p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========= UploadToggleStatus ============= PR20230323
function UploadToggleStatus(el_input) { console.log( " ==== UploadToggleStatus ===="); if (permit_dict.permit_approve_comp){ const tblRow = t_get_tablerow_selected(el_input); console.log( " tblRow", tblRow); // - get statusindex of requsr ( statusindex = 1 when auth1 etc ...
[ "[consts.FILE_INDICATOR_UPLOADING](state, val) {\n state.fileUploading = val;\n }", "function toggleUploading(show) {\n uploadImageLabelEl.classList.toggle('uploading', show);\n }", "function isMediaUploadToggle() {\n return AACommonService.isMediaUploadToggle();\n }", "function uploadTo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle clone playlist button
async function btnClonePlaylistClick() { var name = $("#ed-clonename").val(); var errtext = $("#text-cloneerror"); var link = $("#ed-clonelink").val(); var playlist; if (name.trim().length == 0) { errtext.html('<span style="color: yellow;">Please give a name to the new playlist!</span>'); return; }...
[ "function clonePlaylistSelected() {\n $(\"input[name=cloneplaylist]\").each(function() {\n $(this).parent().parent().parent().removeClass(\"playlistsel-selected\");\n });\n $(\"input[name=cloneplaylist]:checked\").parent().parent().parent().addClass(\"playlistsel-selected\");\n $(\"#ed-clonelink\").val(\"\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if payment method is by Credit Card show payment info for Credit Card else if payment method is by PayPal, Bitcoin hide payment info for Credit Card else if payment method is just 'Select Payment Method' hide payment info for Credit Card
function displayPaymentInfo(paymentMethod) { if (paymentMethod == 'Credit Card') { document.querySelector('#credit-card').style.display = 'block'; paypal.style.display = 'none'; bitcoin.style.display = 'none'; } else if (paymentMethod == 'PayPal') { document.querySelector('#credit-card').style.displ...
[ "function showPayment (paymentOption) {\n if (paymentOption === 'credit-card') {\n showCreditCard();\n } else if (paymentOption === 'paypal') {\n paypal.style.display = '';\n bitcoin.style.display = 'none';\n ccPayment.style.display = 'none';\n } else if (paymentOption === 'bitcoin'){\n bitcoin.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a word from a high and low byte.
function word(highByte, lowByte) { return ((highByte & 0xFF) << 8) | (lowByte & 0xFF); }
[ "function mkword(lobyte, hibyte) { return 256*hibyte + lobyte; }", "function lobyte(word) { return word & 0xFF; }", "readWord(address) {\n const lowByte = this.readByte(address);\n const highByte = this.readByte(address + 1);\n return z80_base_1.word(highByte, lowByte);\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Logs user into demo account
function watchDemoBtn() { $('#demo-login').click(event => { const userData = { username: 'demouser1124', password: 'demopassword1124' }; HTTP.loginUser({ userData, onSuccess: res => { const authUser = res.user; authUser.jwtToken = res.jwtToken; CACHE.saveAu...
[ "function login() {\n AccountService.login({ username: ctrl.user.Username, password: ctrl.user.Password });\n }", "function login(){\n\tCloud.Users.login({\n\t login: 'new_username',\n\t password: 'new_password'\n\t\t}, function (e) {\n\t if (e.success) {\n\t var user = e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets whether a value is within the current comparison range.
_isInComparisonRange(value) { return isInRange(value, this.comparisonStart, this.comparisonEnd, this.isRange); }
[ "contains(value) {\n return value >= this._min && value <= this._max;\n }", "function isWithin(value, min, max) {\n return ((value <= min) && (value >= max));\n}", "async isInComparisonRange() {\n return this._hasState('in-comparison-range');\n }", "function isLessThanOrEqualTo(value, other) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that creates a tail Input: none, Output: tail mesh
function createWolfTail(){ var tailGeom = new THREE.CylinderGeometry(wolfParams.tailBottomRadius, wolfParams.tailTopRadius, wolfParams.tailHeight); var tailMaterial = new THREE.MeshPhongMaterial({color:0x7F7770, ...
[ "function buildTail() {\n\t\tvar tailGeom = new THREE.SphereGeometry(bunnyParams.tailRadius,\n\t\t\tbunnyParams.sphereDetail, bunnyParams.sphereDetail);\n\t var tailMesh = new THREE.Mesh(tailGeom, bunnyMat);\n\n\t return tailMesh;\n\t}", "function addTail (body, params) {\n var tailFrame= new THREE.O...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
populate the note dropdowns
function createNoteOptions() { var selects = $('[id^=note]'); for (var i = 0; i < selects.length; i++) { for(var key in notes) { createNoteOption(selects[i], key); } } }
[ "function loadNotes() {\n\t// get existing notes\n\tvar xhr = new XMLHttpRequest();\n\txhr.open('GET', 'http://127.0.0.1:51017/notes/', true);\n\n\txhr.onload = function(e) {\n\n\t\tif (xhr.readyState != 4) { // failed\n\t\t\tconsole.error(xhr.statusText);\n\t\t}\n\t\tresponse = JSON.parse(xhr.response);\n\t\tnotes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if fighter has died
function checkIfDead(fighter){ if (fighter.health > 0){ return true; } else { fighter.isDead = true; } }
[ "function hasUserLost() {\n\tif(_selectedFighterObj.healthPoints <= 0 && _selectedDefenderObj.healthPoints > 0) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}", "dies() {\n\t\tif(this.currentPet.hunger === 10 || this.currentPet.sleepiness === 10 || this.currentPet.boredom === 10){\n\t\t\tthis.stopTimer()\n\t\t\tt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manipulate tower when hovered.
function towerHover(towerMesh){ if(CURRENT_HOVER_MODE == HOVER_ACTIVATE){ var hexColor; if( towerList[towerMesh.towerArrayPosition].onCooldown == 1){hexColor = 0xaa30b5;} else{hexColor = 0xff0000;} for(var i = 0; i < towerMesh.material.materials.length; i++){ towerMesh.material.materials[i].emissive.setHex(...
[ "hover() {\n if (this._isHovering) {\n return;\n }\n\n this._isHovering = true;\n }", "onhover() {\n this.hover = true;\n }", "hover() {\n this.y -= 5;\n }", "set hover(value) {}", "_hoverCallback() {\n this._hovered = tru...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ENCODE ====== var encoded_data = encode('path');
function encode(path) { return encodeURIComponent(path) }
[ "function encode(path) { return encodeURIComponent(path); }", "function encodePath (path) {\n return encode(path, TYPE.PATH);\n}", "function encodeURL(path)\n {\n return encodeURIComponent(path).replace(/%2F/g,'/');\n }", "function encode(path) {\r\n var result = '';\r\n for (var i = 0; i ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw source and sink
function draw_source_and_sink(gctx) { //console.log(source.x_pos) var string1 = ("Source"); var string2 = ("Sink"); gctx.fillText(string1, source.x_pos + 20, source.y_pos + 53); gctx.fillText(string2, sink.x_pos + 20, sink.y_pos + 53); }
[ "drawLine() {\n if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {\n this.ctx.strokeStyle = this.xorColor;\n this.ctx.globalCompositeOperation = this.compositeOp;\n } else\n this.ctx.strokeStyle = this.lineColor;\n\n this.ctx.lineWidth = this.lineWidth;\n\n this.ctx.beginPath();\n this.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
alert(isLoading); alert(temperature); alert(location); this function is used to detect which render message should be return
function renderMessage () { //if isLoading is true - Wait until it get reset to false //by the openWeatherMap.getTemp() alert("Ready to render"); if(isLoading) { alert("Render waiting for return"); return <h3>fetching weather ...</h3> } //if isLoad...
[ "function showLoadingMessage() {}", "function unsureIfthisIsAnActualLoadingScreen() {\n //FrameCount on the loading state to \"waste\" your time\n let wasteOfTime = 120;\n if (frameCount > wasteOfTime) {\n state = `bubblePoppin`;\n }\n\n //The text\n push();\n textSize(30);\n fill(255, 132, 0);\n stro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create Json for Suceess Space List
function sucessJsonList(res, resJson) { let space = {}; let spaceList = []; if (res == "") { spaceList = []; } else { for (let i = 0; i < res.length; i++) { let spaceType = null; if (null != res[i].spacetypeid) { spaceType = { ...
[ "generateJSON() {\n let segJSON = [];\n this.segments.forEach((segment) => {\n segJSON.push({\n a: {\n x: segment.a.x,\n y: segment.a.y\n },\n b: {\n x:segment.b.x,\n y:segment.b.y\n },\n sw: segment.sw,\n col:segment.col\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add an event to the correct timeline. Keep track of the timeline it was added to.
_addEvent(event, timeline) { this._scheduledEvents[event.id.toString()] = { event, timeline, }; timeline.add(event); return event.id; }
[ "_addEvent(event, timeline) {\n this._scheduledEvents[event.id.toString()] = {\n event,\n timeline\n };\n timeline.add(event);\n return event.id;\n }", "add(event) {\n // the event needs to have a time attribute\n Object(_Debug__WEBPACK_IMPORTED_MODULE_2__[\"assert\"])(Reflect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add projects to page using handlebars
function handle(projects) { let source = $("#project-template").html(); let projectTemplate = Handlebars.compile(source); let result = projectTemplate(projects); let container = $('#projects-container'); container.append(result); // call the function to add all interactivity addInteractivi...
[ "function addProjects() {\n\tif (localStorage.projects) {\n\t\tvar projects = JSON.parse(localStorage.projects);\n\n\t\tfor (var i = 0; i < projects.length; i++) {\n\t\t\tvar html = `\n\t\t\t <a href=\"project_show.html\">\n\t\t\t\t\t<div class=\"project-item material-border mb-2 clickable\">\n\t\t\t\t\t\t<div clas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
"check" and "insert" neighbors to a square
function checkInsertNeighbors(i, j) { let s = graph.getSquare(i, j); let up = j + 1; let down = j - 1; let left = i - 1; let rigth = i + 1; if (up < yrange) { s.addNeighbor(graph.getSquare(i, up)); } if (down >= 0) { s.addNeighbor(graph.getSquare(i, down)); } if (rigth < xrange) ...
[ "addNeighbors(game, grid){\r\n this.neighbors = []; // start with empty neighbors\r\n let col = this.loc.x/game.w;\r\n let row = this.loc.y/game.w;\r\n let n,ne,e,se,s,sw,w,nw = null; // all eight neighbors\r\n\r\n if(row > 0 ){\r\n n = grid[col][row-1];\r\n if(!n.occupied && !n....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extract component name from inputting rawname
function componentName(rawname) { var name = rawname.split(':')[0], index = name.replace('\\', '/').indexOf('/'); return (index > 0) ? name.substring(0, index) : name; }
[ "truncatedComponentName(name) {\n\t\tvar truncatedName = name.substring(0, 24);\n\t\treturn truncatedName;\n\t}", "flowBaseName(name) {\n if (!name.includes('\\\\')) return name;\n\n var parts = name.split('\\\\');\n\n return parts[parts.length - 1];\n }", "atomNameToComp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
to bend all libms of the person prior to jumping bend num determines which way the arms bend for the landing and take off of the jump
function bendLimbs(bendNum) { for (var i = 0; i < 2; i++) { if (legAngles[i] < 40) { legAngles[i] += 1; armAngles[i] = -bendNum * legAngles[i]; legAngles[i + 2] -= 1.5; } } if (humanCoordinates[1] > -0.5) { humanCoordinates[1] -= 0.005; } }
[ "function updateBreath() {\n\n if (breathDir === 1) { // breath in\n breathAmt -= breathInc;\n if (breathAmt < -breathMax) {\n breathDir = -1;\n }\n } else { // breath out\n breathAmt += breathInc;\n if (breathAmt > breathMax) {\n breathDir = 1;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
grow() causes the Light to get larger over time
grow() { // grow by reducing the size by a set amount this.size = this.size + this.growRate; // Check if we're larger than the max size if (this.size > this.maxSize) { // If so, we're done for the night this.on = false } }
[ "grow(factor) {\n this.radius = this.radius * factor\n }", "grow() {\n this.crestRadius += this.crestVelocity;\n }", "grow(){\n this.currentValue = growAgainstInflation(this.currentValue, 1, this.growth);\n }", "growHair() {\n\t\tthis.bodyHair.current -= this.bodyHair.growthSpeed.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function that returns the text of the button
function buttonText(){ return document.getElementById("go-button").innerText; }
[ "function getButtonText() {\n var text = window.upmenuSettings.config.text;\n /*if(typeof window.upmenuSettings.text != 'undefined') {\n text = window.upmenuSettings.text;\n }*/\n return text;\n }", "function setTextOfButton(){\n\tvar btn = document.getElementById('button...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
evaluates arithmetic (e.g. 2+2 or 352) on an operation node. Returns a Node.Status object.
function arithmetic(node) { if (!Node.Type.isOperator(node)) { return Node.Status.noChange(node); } if (!node.args.every(child => Node.Type.isConstant(child, true))) { return Node.Status.noChange(node); } // we want to eval each arg so unary minuses around constant nodes become // constant nodes wi...
[ "_parseArithmeticExpression() {\n let leftExpr = this._parseArithmeticTerm();\n if (leftExpr.nodeType === 0) {\n return leftExpr;\n }\n let peekToken = this._peekToken();\n let nextOperator = this._peekOperatorType();\n while (nextOperator === 0 || nextOperator ===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the error class to the given field if it's not set in UserPreferences, or remove the error class if it is.
function setError(key) { var $input = $(options.selectors[key]); if (UserPreferences.getPreference(key)) { $input.removeClass(options.selectors.errorClass); } else if ($input.find(options.selectors.typeaheadText).val().length > 0) { $input.addClass(options.selectors.error...
[ "function addErrorClass(element) {\r\n element.className = 'field error';\r\n }", "function addErrorClassTo(errorFields) {\n let fields = document.querySelectorAll(\".field\");\n\n fields.forEach(field => {\n if (errorFields.includes(field.name)) {\n field.classList.add(\"login...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the next task the cursor can be moved to, after the specified task.
function getNextCursorableTask(tasks, currentKey) { for (let i = 0; i < tasks.length; i++) { if (getTaskKey(tasks[i]) === currentKey) { if (i + 1 < tasks.length) { return tasks[i + 1]; } /* for (let j = i + 1; j < tasks.length; j++) { const task = tasks[j]; ...
[ "function nextTask(databaseRef) {\n return databaseRef\n .child('tasks')\n .orderByChild('_error')\n .equalTo(null)\n .limitToFirst(1)\n .once('value')\n .then(res => res.val())\n .then(res => {\n if (!res) return null\n const id = Object.keys(res).pop()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given individual counts of adults, teens, and kids, return a string in the format "1 adult, 1 teen, 2 kids"
getGuestsString (adultsCount, teensCount, kidsCount) { const guests = { adult: { count: adultsCount, singular: 'adult', plural: 'adults' }, teen: { count: teensCount, singular: 'teen', plural: 'teens' }, kid: { count: kidsCount, ...
[ "function numberOfPatients() {\n return `${patientCatalogue.length} patient(s) in catalogue`;\n}", "function donuts (count) {\n if (count < 10) {\n return 'Number of donuts: ' + count\n }\n return 'Number of donuts: many'\n}", "function countString(counts){\n if(!counts) return '';\n if(!counts.calls &...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Release the B button
*releaseButtonB() { yield this.sendEvent({ type: 0x01, code: 0x131, value: 0 }); }
[ "*releaseButtonA() {\n yield this.sendEvent({ type: 0x01, code: 0x130, value: 0 });\n }", "*releaseButtonL() {\n yield this.sendEvent({ type: 0x01, code: 0x136, value: 0 });\n }", "*pressButtonB() {\n yield this.sendEvent({ type: 0x01, code: 0x131, value: 1 });\n }", "fakeRelease...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when a new tab has been selected in the lefthand menu TODO: Cache the results so we don't have to query the server again when the same dataset is selected in future? Gets the list of variables for a given dataset from the server and populates the correct panel in the lefthand menu
function datasetSelected(expandedTab) { var dataset = expandedTab.titleBar.id; // Get the pretty-printed name of the dataset prettyDsName = expandedTab.titleBar.firstChild.nodeValue; // returns a table of variable names in HTML format downloadUrl('wms', 'REQUEST=GetMetadata&item=variables&dataset=' ...
[ "function datasetSelected(expandedTab)\n{\n var dataset = expandedTab.titleBar.id;\n // Get the pretty-printed name of the dataset\n prettyDsName = expandedTab.titleBar.firstChild.nodeValue;\n // returns a table of variable names in HTML format\n downloadUrl('WMS.py', 'SERVICE=WMS&REQUEST=GetMetadata...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A container made up of two placeholders. It can be used to freely access and modify contents between the two placeholder elements without having any impact on the DOM tree or rendering.
function PlaceholderContainer() { this.placeholderA = new PlaceholderElement(); this.placeholderB = new PlaceholderElement(); }
[ "_attachPlaceholder() {\n let firstNode = this.childNodes[0]\n // Remove old placeholder if necessary\n if (this.placeholderNode) {\n this.placeholderNode.extendProps({\n placeholder: undefined\n })\n }\n\n if (this.childNodes.length === 1 && this.props.placeholder) {\n firstNod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implements the parsing rules in the Operations section. OperationDefinition : SelectionSet OperationType Name? VariableDefinitions? Directives? SelectionSet
function parseOperationDefinition(lexer) { var start = lexer.token; if (peek(lexer, TokenKind.BRACE_L)) { return { kind: Kind.OPERATION_DEFINITION, operation: 'query', name: undefined, variableDefinitions: [], directives: [], selectionSet: parseSelectionSet(lexer), loc...
[ "parseOperationDefinition() {\n const start = this._lexer.token;\n\n if (this.peek(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_6__[\"TokenKind\"].BRACE_L)) {\n return this.node(start, {\n kind: _kinds_mjs__WEBPACK_IMPORTED_MODULE_3__[\"Kind\"].OPERATION_DEFINITION,\n operation: _ast_mjs__WEBPAC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Verificar existencia de url
function urlExists(url) { var http = new XMLHttpRequest(); http.open('HEAD', url, false); http.send(); return http.status!=404; }
[ "function UrlExists(url) {\n var http = new XMLHttpRequest();\n try {\n http.open(\"HEAD\", url, false);\n http.send();\n return http.status != 404;\n } catch (error) {\n return false;\n }\n }", "function urlExists( url ) {\n var http =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve all data from the screenshot table
function getAllScreenshots() { self.getAsyncStatement("getAllScreenshots").executeAsync({ handleResult: function(aResults) { let row = null; while (row = aResults.getNextRow()) { let addon_internal_id = row.getResultByName("addon_internal_id"); if (!(addon_inter...
[ "static all() {\n return fetch(`${REACT_APP_API_URL}/screenshots`).then(res => res.json())\n }", "function getScreenshots() {\n var screenshots = 0;\n\n // hide modal & button so you can take bzkScreenshot\n showFeedbackModal(false);\n\n function getScreenshotForContainer(container) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
+++ Build and place count in controlbar +++ Dynamically build a div that is then placed in the controlbar's spacer element
function placeCountInControlbar(viewsCount) { var spacer, newElement = document.createElement('div'); //Place data in div newElement.innerHTML = "Total Views: " + viewsCount; //Get the spacer in the controlbar spacer = document.getElementsByClassName('vjs-spacer')[0]; //Right...
[ "function placeCountInControlbar(viewsCount) {\n var spacer,\n newElement = document.createElement('div');\n //Place data in div\n newElement.innerHTML = \"Total Views: \" + viewsCount;\n //Get the spacer in the controlbar\n spacer = document.getElementsByClassName('vjs-spacer')[0];\n //Right justify conte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
client The client extends `net.Socket` by adding a method to send a log record over the wire. It opens a connection to the server specified by `path`. This is typically a UNIXsocket but this function is kept unknowing of the details.
function client(path) { var sock = net.connect(path) // Attach method for sending log records, by calling `getMessage` the // message is formatted and cached. sock.sendRecord = function send(record) { record.getMessage() this.write(JSON.stringify(record) + '\n') } // Return the socket return soc...
[ "function serverLog(path, ip)\n{\n // Constructing the activity message\n msg = date + ':' + path + ' was accessed by ' + ip + '\\n';\n\n // Save the activity in the logs\n saveLog(msg);\n}", "function connect(path) {\n if(mySocket != null){\n mySocket.close();\n mySocket = null;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================================// ============================================================================// ============================================================================// ============================================================================// ====...
function init_keys() { // funding_key = new bitcore.PrivateKey('75d79298ce12ea86863794f0080a14b424d9169f7e325fad52f60753eb072afc', network_name); set_funding_key(new bitcore.PrivateKey(network_name)); client_key = new bitcore.PrivateKey(network_name); console.log("Funding address: " + funding_address.toStr...
[ "deriveKeys () {\n this.masterSecret = PRF256(this.preMasterSecret, 'master secret',\n concat([this.clientRandom, this.serverRandom]), 48)\n\n const keys = PRF256(this.masterSecret, 'key expansion',\n concat([this.serverRandom, this.clientRandom]), 2 * (20 + 16) + 16)\n\n this.clientWriteMacKey =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a field if a scale single field. Return `undefined` otherwise.
function getFieldFromDomain(domain) { if (isDataRefDomain(domain) && isString(domain.field)) { return domain.field; } else if (isDataRefUnionedDomain(domain)) { var field$$1 = void 0; for (var _i = 0, _a = domain.fields; _i < _a.length; _i++) { var nonUnionD...
[ "function getFieldFromDomain(domain) {\n if (isDataRefDomain(domain) && isString(domain.field)) {\n return domain.field;\n }\n else if (isDataRefUnionedDomain(domain)) {\n let field;\n for (const nonUnionDomain of domain.fields) {\n if (isDataRefD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort attribute.property based on property
_dynamicSort(property) { let sortOrder = 1; if (property[0] === "-") { sortOrder = -1; property = property.substr(1); } return function (a,b) { let result = (a['attributes'][property] < b['attributes'][property]) ? -1 : (a['attributes'][property] > b['attributes'][property]) ?...
[ "function sortByProperty(property){ \n return function(a,b){ \n if(a[property] > b[property]) \n return 1; \n else if(a[property] < b[property]) \n return -1; \n \n return 0; \n } \n}", "function sortBy(prop){\r\n return function(a,b){\r\n if( a[pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to make bulk API call to MapQuest API (Up to 100 locations per call) then return the two closest cities
function getGeoBulk(qry){ var apiAdd = `http://www.mapquestapi.com/geocoding/v1/batch?key=${key['mapQuest']}`; // Basic get request pulled from Node.js documentation http.get(apiAdd += qry, function(res) { var statusCode = res.statusCode; var contentType = res.headers['content-type']; ...
[ "function getNearestCity(lat, lon) {\n const nearestCityURL = `https://geocodeapi.p.rapidapi.com/GetNearestCities?latitude=${lat}&longitude=${lon}&range=0`;\n const options = {\n \"method\": \"GET\",\n \"headers\": {\n \"x-rapidapi-host\": \"geocodeapi.p.rapidapi.com\",\n \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a function that returns whether the burn chance happens
function BurnChanceHappens() { return RandIntInRange(0, 100) < BURN_CHANCE; } // end function BurnChanceHappens()
[ "function getCollectible() {\n var chance = Math.random();\n if (chance < 0.4) {\n return true;\n }\n return false;\n}", "function weightedBoolean(chance = 0.5) {\n return Math.random() >= 1 - chance;\n}", "function chance(probability) {\n return rand() < (1000.0 * probability);\n}", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add subcaption to each chart
function addSubCaptionToChart(chartObject) { var groupByText = $("#groupBy :selected").text(); if (chartObject) chartObject.chart.subcaption = groupByText; }
[ "drawTitle() {\n d3.select(`#${this.chartData.selector}`)\n .append('text')\n .attr('font-size', '20')\n .attr('x', this.width / 2)\n .attr('y', this.titleHeight - this.titleHeight * 0.1)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers an activity event handler for the _turn_ event, emitted for every incoming activity, regardless of type.
onTurn(handler) { return this.on('Turn', handler); }
[ "function registerActivityHandler() {\n navigator.mozSetMessageHandler('activity', function activityHandler(a) {\n var activityName = a.source.name;\n switch (activityName) {\n case 'browse':\n // The user is probably coming to us from the camera, and she probably\n // wants to see t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API test for 'GetHub', Get hub configuration
function Test_GetHub() { return __awaiter(this, void 0, void 0, function () { var in_rpc_create_hub, out_rpc_create_hub; return __generator(this, function (_a) { switch (_a.label) { case 0: console.log("Begin: Test_GetHub"); in_rpc_...
[ "getHubs (token) {\n\n var url = this._config.endPoints.hubs\n\n return requestAsync({\n token: token,\n json: true,\n url: url\n })\n }", "function hubParams() {\n\tvar hubs = getHubParams();\n\treturn hubs.length ? {hubs} : {};\n}", "function hub_getCurrentHub() {\n // Get main car...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads the previous state of the formlist and server settings
function loadPreviousState() { var i, list, $settings = gui.pages.get( 'settings' ), server = store.getRecord( '__current_server' ); if ( server && server.url ) { $settings.find( '.url-helper li' ).removeClass( 'active' ).find( '[data-value="' + server.helper + '"]' )...
[ "function _loadFromFormState() {\n\n var curTime, \n formState, \n unloadTime;\n \n curTime = new Date().getTime();\n\n formState = $.parseJSON(localStorage.getItem(\"formState\"));\n \n if(formState) {\n\n unloadTime = formState.unloadTime;\n\n if((curTime - unloadTime) < ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a dataset, extract relationship information between items and populate relationship data structures
function detectRelationships(data) { var identical, similar; visible.unique1 = data.unique1; visible.unique2 = data.unique2; identical = data.identical; similar = data.similar; if (identical || similar) { visible.numIdenticalSets = identical.length; ...
[ "function detectRelationships(dataset) {\r\n var identical, similar;\r\n\r\n visible.unique1 = DATASETS[dataset].unique1;\r\n visible.unique2 = DATASETS[dataset].unique2;\r\n identical = DATASETS[dataset].identical;\r\n similar = DATASETS[dataset].similar;\r\n \r\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a window from an element
function getWindow(elem) { return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView; }
[ "function getWindow( element ) {\r\n var doc = getDocument( element );\r\n return (doc.defaultView || doc.parentWindow || doc.window);\r\n}", "function getWindow(elem) {\n return elem.ownerDocument.defaultView || elem.ownerDocument.parentWindow;\n }", "function getWindow(elem) {\n return isWind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
log in bot with settings token
function login() { if (settings.token) { client.login(settings.token); } else { console.log('Error logging in: There may be an issue with your settings.json file'); } }
[ "function login() {\n if (settings.token) {\n client.login(settings.token);\n } else {\n console.log('Error logging in: There may be an issue with your settings file');\n }\n}", "function login() {\n molly.login(config.token);\n}", "login() {\n this.config.findOne({}, (err, doc) => {\n if (!do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Powerup expire event handler
_expire() { this._stopTimer() util.log("power-up", "expired") this.powerup.expire() this.powerup = null this._startTimer() }
[ "async expireTimerEventHandler() {\n const sub = this.redis.getInstance();\n const pub = this.redis.getInstance();\n\n await sub.psubscribe(KEYEVENT_EXPIRE_PATTERN);\n\n sub.on('pmessage', async (pattern, channel, message) => {\n debug('pmessage', message);\n if (R.startsWith(EXPIRE_TIMER, mes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate n new temporary names.
function genTmps(n) { var res = []; for(var i=0;i<n;++i) res[i] = genTmp(); return res; }
[ "function makeCopies(n){\n let str = 'strive'\n return str.repeat(n)\n}", "function nameGen() {\n let first = fName[numGen(fName.length)];\n let last = lName[numGen(lName.length)];\n return first + ' ' + last;\n}", "async modifiedNames (nNumberNames) {\n // wait for completelyUniqueNames funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the rolling history table around the specific day
function updateRollingHistory(){ //Get list of rolling history items var rollingHistoryArray = self.getRollingHistoryArray(); var rhaLen = rollingHistoryArray.length; var pastDate = rollingHistoryArray[rhaLen-1].DATE_OBJ; var futureDate = rollingHistoryArray[0].DATE_OBJ; var rollingHistoryList = self.retrie...
[ "function updateRollingHistory(){\n\t\t//Get list of rolling history items\n\t\tvar rollingHistoryList = self.retrieveHistoryItems(tableStartDate, tableEndDate);\n\t\tself.setRollingHistoryArray(rollingHistoryList);\n\t\t//Build rolling history table\n\t\tvar rollingHistoryTable = self.buildRollingHistoryTable(roll...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Receive mouse down event on results table Note that buttons 1 (middle click) and 2 (right click) also go here e is of type MouseEvent (click)
function resultsMouseDownHandler (e) { let target = e.target; // Type depends .. let className = target.className; //console.log("Result mouse down event: "+e.type+" button: "+e.button+" shift: "+e.shiftKey+" target: "+target+" class: "+className); if ((className != undefined) && (className.length > 0)) { // The...
[ "function resultsMouseHandler (e) {\n let target = e.target; // Type depends ..\n let className = target.className;\n//console.log(\"Result click event: \"+e.type+\" button: \"+e.button+\" shift: \"+e.shiftKey+\" target: \"+target+\" class: \"+className);\n if ((className != undefined) && (className.length > 0))...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decrease the input threshold
decreaseThres() { let newThres = this.state.threshold - 5; this.setState({threshold : newThres}); }
[ "function foldBack(input,threshold) {\n if (input>threshold || input<-threshold) {\n input = Math.abs(Math.abs(utils.fmod(input - threshold, threshold*4)) - threshold*2) - threshold;\n }\n return input;\n}", "function resetPrize(prize) {\n if (prizeThreshold === prize) {\n prize ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns value of the property located in dot separated path of json.
getValueInPath(json, path) { const pathElements = this.pathUtilService.toPathArray(path); let value = json; pathElements.forEach(pathElement => { value = value[pathElement]; if (!value) { throw new Error(`"${pathElement}" of given path not defined in given...
[ "function getValueFromPath(json, path) {\n try {\n var _path = path.split('.')\n\n var cur = json\n _path.forEach(function (field) {\n if (cur[field]) {\n cur = cur[field]\n }\n })\n\n return cur\n } catch (err) {\n throw new Error...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getPlugins is getting plugins from users project node_modules folder
function getPlugins(baseDir){ var componentPlugins = []; if(!fs.existsSync(baseDir + "/node_modules")) return componentPlugins; var nodeModules = fs.readdirSync(baseDir + "/node_modules"); nodeModules.forEach(function(module){ if(!/^component-/.test(module)) return; componentPlugins.push(mod...
[ "loadPlugins () {\n const plugins = __webpack_require__(\"./client/js/plugins sync recursive .*\\\\.js$\")\n plugins.keys().forEach((plugin) => {\n const init = plugins(plugin).default\n init(this)\n })\n }", "function getInstalledPlugins() {\n var fs = require('fs');\n\n var modulePath ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
construct a meeting client with signal client and rtc client
function Client(sclient, rclient, localAccount) { _classCallCheck(this, Client); this.signal = sclient; this.rtc = rclient; this.localAccount = localAccount; // 通话时长 this.netcallDuration = 0; ...
[ "function setupRTC() {\n\trtc = new RTCPeerConnection({\n\t\ticeServers:[\n\t\t\t{\n\t\t\t\turls:[\n\t\t\t\t\t\"stun:stun1.l.google.com:19302\",\n\t\t\t\t\t\"stun:stun1.l.google.com:19305\",\n\t\t\t\t\t\"stun:stun2.l.google.com:19302\",\n\t\t\t\t\t\"stun:stun2.l.google.com:19305\",\n\t\t\t\t\t\"stun:stun3.l.google....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set meals after search in DOM
async function setMealsAfterSearch() { const term = searchBar.value; const mealsAfterSearch = await getMealsByName(term); mealsAfterSearch.map((meal) => { setRandomMeal(meal, false); }); }
[ "function fecthMeals(meal) {\n result.innerHTML = `<p>Searching...</p>`;\n ingredients.innerHTML = \"\"\n info.innerHTML = \"\"\n fetch(`https://www.themealdb.com/api/json/v1/1/search.php?s=${meal}`)\n .then(response => response.json())\n .then(data => showResultUi(data.meals));\n}", "function findMeals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
//////////////////////// CALCULATE RESULTS ///////////////////////// //////////////////////////////////////////////////////////////////// Run a calculation. Done whenever the tally is updated
function calculate() { var servings = 0; var standardDrinks = 0; var calories = 0; $('.calculator-carousel .single-drink').each(function(){ var currentDrinkType = $(this).data('drinktypes').split(',')[$(this).data('currenttype')].split('|'); servings += $(this).data('quantity'); standardDrinks += $(th...
[ "calculate() {\r\n\r\n // Update the user data by getting the input value\r\n data.updateUserData();\r\n\r\n // Update the user result with the calculated value\r\n data.updateUserResult();\r\n }", "function calcResults()\n{\n results_overall = 0.0;\n\n for (var i = 0; i < NUM_SCALES; i++...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return whether the player has the queried wandering counter
function haveWandererCounter(wanderer) { if (deterministicWanderers.includes(wanderer)) { return haveCounter(wanderer); } var begin = wanderer + " window begin"; var end = wanderer + " window end"; return haveCounter(begin) || haveCounter(end); }
[ "hasWon() {\n // if player won (over 100) then return true. Otherwise, return false\n if (this.totalScore() >= 100) {\n return true;\n } else {\n return false;\n }\n }", "function isVoteWandererNow() {\n return kolmafia_1.totalTurnsPlayed() % 11 == 1;\n}", "canPlayerPlay () {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
internal objects //////////////////////////////// / Snapshot contains every bit of information for one tick (entities, events,...). At the moment, it only contains player infos.
function Snapshot(players) { this.players = players; this.toString = function() { var ret = "<strong>snapshot #" + currentIndexPosition + "</strong> :<br>"; ret += "<ol>"; for (var i = 0; i < players.length; i++) { ret ...
[ "function PlayerSnapshot(aPlayer){\n this.id = aPlayer.id;\n this.xCenter = aPlayer.xCenter;\n this.yCenter = aPlayer.yCenter;\n this.size = aPlayer.size;\n}", "getPlayersGraphicsInfo() {\n let current = Date.now();\n let ret = {};\n for (let key in this.players) {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EnemyMech class takes, grid x and grid y
function EnemyMech(x, y) { //default value for the sprite key this.spriteName = 'enemyMech'; //storage for the sprite this.sprite = null; //score 'bounty' this.score = 100; //grid x position this.x = x; //grid y position this.y = y; //pixel x location this.truex = hexGrid...
[ "constructor(x,y,num){\n this.x=x+30;\n this.y=y+30;\n this.enemySpeed=CONFIG.enemySpeed;// 默认敌人移动距离\n this.enemySize=CONFIG.enemySize;// 默认敌人的尺寸\n this.enemyGap=CONFIG.enemyGap;// 默认敌人之间的间距\n this.enemyIcon=CONFIG.enemyIcon;// 怪兽的图像\n this.enemyBoomIcon=CONFIG.enemyBoomIcon;// 怪兽...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
how many jumps from X to Y
function jump(X, Y, D) { // write your code in JavaScript (Node.js 4.0.0) if(Y === X) { return 0; } //can make it one jump else if(D >= (Y-X)) { return 1; } else { var jumps = (Y-X)/D; console.log(jumps) return Math.ceil(jumps); } }
[ "function jumpTo(n){\n let t = Math.abs(n), count = 0;\n for (let pos = 0; pos < t || (pos - t) % 2; count++, pos += count) {}\n return count;\n}", "function minimalJump(X, Y, D) {\n // This is both correct and fast. O(1) time complexity\n let i = Y - X\n let j = Math.floor(i / D)\n // let jumps = Math...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the object passed is a Text node.
function isText(node) { // The property cannot get clobbered on Text nodes. return node.nodeType === Node.TEXT_NODE; }
[ "function isText(node) {\r\n return node.nodeType === 'text';\r\n}", "function isText(node) {\n return node.nodeType === 'text';\n}", "function isText(node) {\n return node.nodeType === 3;\n}", "function isText(node)\n{\n\treturn node && node.nodeType == node.TEXT_NODE;\n}", "function isText(o) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes linear n and bends it into `steppes` smooth steps per whole number.
function steppe(n, steppes) { const i = floor(n * steppes); const f = fract(n * steppes); const smooth_f = smoothstep(0.45, 0.55, f); const stepped = (i + smooth_f) / steppes; return stepped; }
[ "function step(n,min,step){\n return n - subplus(n-min)%step;\n}", "function smooth(n) {\n // Pass n times\n for(let passes = 0; passes < n; passes++) {\n // Smoothing the values with the pixel values on all adjacent sides\n for(let row = 1; row < pixelValues.length-1; row++) {\n for(let co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set own coin listings.
setOwnListing(state, data) { const quote = data.quotes[state.currency]; state.ownListings = state.ownListings.map((item) => { if (item.id === data.id) { return { ...item, priceOfAmount: item.amount * quote.price...
[ "setListings(state, listings) {\r\n state.listings = listings\r\n }", "setCoinData( data = {} ) {\n this._coindata = Object.assign( this._coindata, data );\n }", "coinid() {\n this.initCoinData();\n }", "function createCoinList() {\n placedCoins = [\n placedCoin(600, 150),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cleans the page to return to original Join Page state.
function cleanPage(data) { document.getElementById("joinWrapper").hidden = false; document.getElementById("questionSpace").hidden = true; roomState = data[0]; updateStatList(data); }
[ "function cleanPage() {\n showUserInfo();\n $(\"#docBin\").empty();\n $(\"#inventoryBin\").empty();\n showDetailsPage(false);\n}", "function clearPages() {\n\t\t$(articleContainer).html('');\n\t}", "clear_page_perso()\n\t{\n\t\tjQuery(\"#competences\").empty();\n\t\tjQuery(\"#inventory\").empty();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles callback event when diagonals are enabled in the final path
diagonalsEnabled() { if(!diagonal) { diagonal = true; } else { diagonal = false; } }
[ "function checkDiagonals(){\r\n let diagSum=0;\r\n // negative slope diagonal\r\n if(allChecked()){\r\n if((color(\"#a1\")==color(\"#b2\"))&&(color(\"#a1\")==color(\"#c3\"))){\r\n diagSum=diagSum+parseFloat(document.querySelector(\"#a1\").innerText);\r\n diagSum=diagSum+parseFloat(document.query...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getIgnoreKeywords_allWords_G_Words() Get the common words to ignore that start with: G.
function getIgnoreKeywords_allWords_G_Words() { return [ 'gave', 'general', 'generally', 'generic', 'get', 'gets', 'getting', 'give', 'given', 'gives', 'go', 'goes', 'going', 'goings', 'goings-on', 'goingson', 'goodbye', 'goodly', 'got', 'gotten', 'gradu...
[ "function getIgnoreKeywords_allWords_O_Words() {\n\t\treturn [\n\t\t\t'obstinately',\n\t\t\t'obviously',\n\t\t\t'occasion',\n\t\t\t'occasionally',\n\t\t\t'occassion',\n\t\t\t'occassionally',\n\t\t\t'occur',\n\t\t\t'occuring',\n\t\t\t'occurs',\n\t\t\t'occurred',\n\t\t\t'of',\n\t\t\t'off',\n\t\t\t'oft',\n\t\t\t'often...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the shape given the supplied name.
function setShapeForName(shape, name) { graph.setShapeForName(shape, name); }
[ "setShape(shp) {\n shape = shp;\n}", "function setShapeType(type) {\n shapeType = type;\n}", "set shape(v) {\n this._shape = v;\n\n //If a boundingSahpe was not provided then generate a new one based on the defined shape.\n if (!this._hasBoundingShape) {\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handles closing the facebook dialog when post is clicked
function closeFacebookDialog(e) { props.logClick(e, 9); setIsDialogOpen(false); setIsJewelShown(true); }
[ "function closePost()\n\t{\n\t\tif (!confirm(\"All data will be lost. Continue?\")) return;\n\t\t_cPost();\n\t}", "function handleClose() {\n setDialog(false);\n }", "function close_attach_to_post_window() {\n\tvar src = jQuery(top.document).find(\"#TB_window iframe\").attr('src');\n\tif (src && src.match('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
picture_element_generator.js For each .jpg file in a srcImageDir, create a pictureElements.html file in the that contains the pictureElement HTML for those images. This should happen before the files are actually resized.
function PictureElementGenerator(srcImageDir, remoteFolderName, outputDir) { if (!srcImageDir || !remoteFolderName) { throw new Error('srcImageDir and/or remoteFolderName must be provided.'); } this.srcImageDir = srcImageDir; this.remoteImageDirectory = path.join('/assets/img/', remoteFolderName...
[ "function add_images_in_HTML(){\n for (let i=1; i<=5; i++){\n let parent_item=document.querySelector(\"#thumb-bar\")\n let new_img=document.createElement(\"img\")\n let source=document.createAttribute(\"src\")\n source.value=\"images/pic\"+i+\".jpg\"\n let atr=document.createAt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Invoked everytime the bound view model changes.
viewModelChanged(newValue, oldValue) { this.changes.viewModel = newValue; requestUpdate(this); }
[ "updateModel() {\n this.notifyPropertyChange('model');\n }", "onValueChanged({newValue: newValue, oldValue: oldValue}) {\n this.synchronizeViewFromModel()\n }", "fireChanged () {\n this.$emit ( 'input', this.model );\n }", "onModelStateChanged() {\n if (this.isAttach...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }