query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
When a message is passed from the content script, show the page action and return the array of favorites to the content script.
function onRequest(request, sender, sendResponse) { // Store the data that was passed via request in a global variable pageData = request; // Show the page action chrome.pageAction.show(sender.tab.id); // Return the array of favorites sendResponse(getFavorites()); }
[ "function showFavourites() {\n\tvar favourites = null;\n\ttry {\n\t\tfavourites = new QueryFavourites(cocoon.parameters[\"user-id\"]);\n\t\tcocoon.sendPage(cocoon.parameters[\"screen\"], {queries: favourites.list()});\n\t} catch (error) {\n\t\tcocoon.log.error(\"BLAH:\" + error);\n\t\tcocoon.sendPage(\"screen/error...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines the score of the given |player|. We rank all participants, both current and new ones in the given |players|, and assign each a score based. The score is based on their ranks in number of kills (45%), damage ratio (20%), shot ratio (20%) and accuracy (15%).
computePlayerScores(players) { const participants = [ ...this.#teamAlpha_.keys(), ...this.#teamBravo_.keys(), ...players ]; const statistics = new Map(); // (1) Store all dimensions for the |player| in the |statistics| map. A separate routine // will sort each of the individual metrics,...
[ "function score(player) {\n return Math.round(\n player.kill * 2 +\n player.sup -\n player.death *2 +\n (player.harm - player.harmed) * 0.03125\n )\n}", "function calculateScore(player) {\n var scores = {\n 2: 2,\n 3: 3,\n 4: 4,\n 5: 5,\n 6: 6,\n 7: 7,\n 8: 8,\n 9: 9,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preferences Manager Check if preferences have been saved lc_getPreferences(lc_Prefs)
function lc_getPreferences(prefs){ if(!GM_getValue) return; // ! remove prefs inadvertantly added by v2.2 ! if(GetPref("0", false)){ GM_log("Removing bad prefs from v2.2"); for(var i=0;i<16;i++){ // no way to delete prefs if(GM_getValue(i)) GM_setValue(i, ""); } if(confirm("Oo...
[ "function CheckUserPrefs(){\r\n if(UserPrefs.storePrefs && GM_getValue){\r\n for(opt in UserPrefs){\r\n // prefs we do not save\r\n if(/^(storePrefs|message)$/.test(opt)) continue;\r\n //UserPrefs[opt] = getuserpref(opt, UserPrefs[opt]);\r\n try{\r\n var curPref = GM_getValue(opt);\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
select if component has delay and return true, otherwise return false. this delay is the time it takes for the component to load in visually.
selectAfterDelay(target) { let delay = parseInt(target.style.transitionDelay); if (delay) { // extra 500ms necessary to avoid losing the focus we set setTimeout(() => { this.ready = true; this.select(0); }, delay + 500); ret...
[ "async isDelayed() {\n return (await isDelayed(this.id)) === 1;\n }", "async elementIsDisplayed(selector) {\n await selector.waitForExist();\n await selector.waitForDisplayed();\n const isDisplayed = await selector.isDisplayed();\n return await browser.waitUntil(async function () {\n return i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return whether or not an image ID exists (regardless of whether or not it was deleted).
async exists(id) { // Please watch out if future versions of sqlite // change the return value to null, which is a more // correct return type than undefined. To defend // myself from this, I have used a `!=` instead of // a `!==`. return (await this._withDb(async (db) => await db.get( 'SE...
[ "function imageExists(image_url){\n\t\tvar http = new XMLHttpRequest();\n\t\thttp.open('HEAD', image_url, false);\n\t\thttp.send();\n\t\treturn http.status != 404;\n\t}", "isExist(src) {\n let existFlag = false;\n let imageObj = new Image();\n imageObj.src = src;\n\n // @TODO how to ju...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Relocates pathes of the `sources` file array in `.js.map` files. Simply said, because `sourcesContent` are inlined in the source maps, it's possible to pass an arbitrary file name and path in the `sources` property. By setting the value to a common prefix,
function relocateSourceMapSources({ artefacts, entryPoint }) { return __awaiter(this, void 0, void 0, function* () { yield json_1.modifyJsonFiles(`${artefacts.stageDir}/+(bundles|esm2015|esm5)/**/*.js.map`, (sourceMap) => { sourceMap.sources = sourceMap.sources .map((path) => { ...
[ "applySourceMap(aSourceMapConsumer,aSourceFile,aSourceMapPath){let sourceFile=aSourceFile;// If aSourceFile is omitted, we will use the file property of the SourceMap\n if(aSourceFile==null){if(aSourceMapConsumer.file==null){throw new Error(\"SourceMapGenerator.prototype.applySourceMap requires either an explicit ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change Layer Anchor Position
function swapAnchor (whichLayer, newAnchor) { // Layer Transform Group var layerTransformGrp = whichLayer.property("ADBE Transform Group"); // Position Layer Anchor Point var theLayerAnchor = layerTransformGrp.property("ADBE Anchor Point"); theLayerAnchor.setValue(newAnchor); }
[ "function swapAnchor (whichLayer, newAnchor) {\n\n\t\t// Layer Transform Group\n\tvar layerTransformGrp = whichLayer.property(\"ADBE Transform Group\");\n\n\t\t// Position Layer Anchor Point\n\tvar theLayerAnchor = layerTransformGrp.property(\"ADBE Anchor Point\");\n\ttheLayerAnchor.setValue(newAnchor);\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Alter an existing table, returns a callback with the blueprint for the user to edit.
alter(schemaName, callable){ const blueprint = new AlterBlueprint(schemaName); callable(blueprint); this.blueprints.push(blueprint); }
[ "enterAlter_table(ctx) {\n\t}", "enterAlterTable(ctx) {\n\t}", "alter() {\n const addColBuilders = this.getColumns();\n const addColumns = addColBuilders.map((col) => col.toSQL());\n const alterColBuilders = this.getColumns('alter');\n const alterColumns = alterColBuilders.map((col) => col.toSQL());...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a wrapper rule that freezes the `context` properties.
create(context) { freezeDeeply(context.options); freezeDeeply(context.settings); freezeDeeply(context.parserOptions); // freezeDeeply(context.languageOptions); ...
[ "create(context) {\n freezeDeeply(context.options);\n freezeDeeply(context.settings);\n freezeDeeply(context.parserOptions);\n\n return (typeof rule === \"function\" ? rule : rule.create)(context);\n }", "function wrapSwatch(fn, options) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getLogAggiornamenti. / prende i dati dell'ultimo aggiornamento delle tabelle
function getLogAggiornamenti (req) { var queryText = 'SELECT ' + 'tabella, to_char(data_aggiornamento,' + '\'' + 'DD-MM-YYYY' + '\'' + ') data_aggiornamento ' + 'FROM pronolegaforum.log_aggiornamenti ' + 'ORDER BY tabella'; return db.any(queryText); }
[ "function aggregate() {\r\n var r = \"\\n\";\r\n for(l in log) {\r\n r = r + log[l] + \"\\n\";\r\n }\r\n return r;\r\n}", "inicializaLog() {\n\t\t//Imprime su ID\n\t\tthis.addToLog(\"Comprador \" + this.id + \" inicializado.\");\n\t\t//Imprime las tiendas iniciales conocidas\n\t\tthis.addToLog(\"Las tienda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to insert data from SL,TR to info_summary_check table
async function createSummaryCheck(obj) { logger.debug('insert to info') let insertData = pgFormat('INSERT INTO public.info_summary_check (ssn, record_dt, sl_flag, tr_flag, sl_header_id, tr_header_id, gen_sum_flag, gen_sum_start_dt, gen_sum_end_dt) VALUES (%L)', obj); (async () => { var client = awai...
[ "function fillSummaryTable() {\n var transaction = db.transaction('studentData', 'readonly');\n var studentdta = transaction.objectStore('studentData');\n var interestLevels = studentdta.index(\"interest\")\n\n var cursor = interestLevels.openCursor();\n\n cursor.onsuccess = function(e) {\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function to get the currentRestaurant data
function getCurrentRestaurant(){ if (menu[0] !== undefined){ return menu[0]; } }
[ "getRestaurantDetails() {\n let url =\n constants.BASE_URL +\n constants.END_POINTS.GET_RESTATRUANT_DETAILS +\n \"?lat=\" +\n this.state.lat +\n \"&lon=\" +\n this.state.lng;\n axios.get(url).then((res) => {\n if (\n res &&\n res.status === 200 &&\n res....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTIONS MADE / initMap FUNCTION initializes the map with a marker along with an accuracy radius. It also includes the path to the desired location this function has access to global variables, in order to update them
function initMap(){ // initializing the map based on current location mapUpdates.map = new google.maps.Map(outputHTML.map, {center: currentLocation.location, zoom: 20}); // displaying the accuracy radius, centered at user's current location mapUpdates.accuracy = new google.maps.Circle({ str...
[ "function initMap() {\n mapObj.initMap(45.753, 4.850);\n getStationLocations(refresh);\n}", "function initMap() {\n setMap(43.2081, -71.5376);\n}", "function initMap() {\r\n\r\n var map = new google.maps.Map(document.getElementById('map'), {\r\n zoom: 3,\r\n mapTypeId: \"satellite\"\r\n });\r\n\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend the circuit by a single node, from the current router
function circuitConnect(routerId, routerAddress, routerPort, incomingRouterSocket, incomingCircuitId) { if (routerId in connectedRouters) { var routerSocket = connectedRouters[routerId]; var newCircuitId = getNewCircuitId(false); routerSocket.write('create ' + newCircuitId); } else { var routerSocke...
[ "connectTo(node) {\n this.connections.push(node);\n node.connections.push(this);\n }", "mu_add_node() {\n //select random connection to break\n if (this.connections.length == 0) return;\n let chosenConIndex = Math.floor(Math.random() * this.connections.length);\n let c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: fullPush Perform a full sync cycle, but only update remote data. Used before disconnecting, to clear local diffs. Fires: ready when the sync queue is empty afterwards conflict when there are two incompatible versions of the same node change when the local store is updated
function fullPush(callback) { return fullSync(callback, true); }
[ "function fullPush(callback) {\n fullSync(callback, true);\n }", "function fullSync(pushOnly) {\n return util.getPromise(function(promise) {\n if(disabled) {\n promise.fulfill();\n return;\n }\n if(! isConnected()) {\n return promise.fulfill();\n }\n\n logger.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call this function to update the actions panel.
async function updateActions() { // Let's go ahead and fade out our content and display our loader // while the new data is being loaded. hidePanel(panel.elements.content, panel.elements.loader, async function() { // Update our panel data to reflect the newest instance. p...
[ "function updateActions() {\n\t\tvar actionType = $(\"#actionSelect\").val();\n\t\tif (actionType == 'Display Message') {\n\t\t\t$(\"#actionArea\").html('<div class=\"head col span_6_of_8 ifSpace\"><textarea id=\"actionText\" cols=\"40\" rows=\"5\" ></textarea></div>');\n\t\t} else if (actionType == 'Display Attrib...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle visibilty of vsp link(show only for acceptance listings)
function handleVSPLinkVisibility() { $(".handleVspHide").remove(); }
[ "function novisibleLista() {\n \n visibilidad('capaListado','O');\n}", "function renderPublicPrivate(item, url) {\n if (viewer.loggedin == \"true\") {\n if (url) item.href = url; \n item.style.visibility = \"visible\";\n } else {\n item.href = \"\";\n item.style.visibility = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets Value of FollowUp Number field need to get working
function followUp() { var fuNum = Xrm.Page.getAttribute("cog_followupnumber"); var firstFU = Xrm.Page.getAttribute("cog_firstfollowup"); if (firstFU.getValue() == null) { fuNum2 = Xrm.Page.getAttribute("cog_followupnumber").getValue(); fuNum.setValue(fuNum2 + 1); fuNum.setSubmitMod...
[ "function set_user_profile_followings_num(followings_num) {\nUSER_PROFILE_FOLLOWING_COUNTER.find(\".profile_stats_num\").html(followings_num);\nUSER_PROFILE_FOLLOWING_COUNTER.find(\".profile_stats_label\").html((followings_num != 1 ? \" Followings\" : \" Following\"));\n}", "function set_user_profile_followers_nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the error message to display
function getErrorMsg() { //this can be null if no property was assigned if (scope.property) { //first try to get the error msg from the server collection var err = serverValidationManager.getPropertyError(scope.property.alias, ""); ...
[ "get message() {\n return (this.error && this.error.message) || \"\";\n }", "function getErrorMsg() {\n //this can be null if no property was assigned\n if (scope.currentProperty) {\n //first try to get the error msg from the server collection\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
welcome message custom toast message with button and callbacks
function showWelcome() { var message = '1) Shake phone to attack!\n2) Touch screen to yell!', buttonText = 'Start', toastId, // button clicked callback onButtonSelected = function() { gong.play(); }, // toast dismissed callback onToastDismissed = function() {}; // toast options options = { butt...
[ "function DisplayLoginToast() {\n Tutorial();\n // show when the button is clicked\n $.toast({\n heading: 'Success',\n text: 'You have been logged in.',\n showHideTransition: 'slide',\n position: 'bottom-right',\n icon: 'success',\n });\n}", "function toast() {\n\tM....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find (if present) the requested iteration of a tutors data set (repetition)
getTutorIterationData(studentId, tutorSfx, iteration) { let data = null; for (let daySfx of this.daySuffix) { // If there is a dataset for this day then see if it is the iteration requested // if (this.tutorData[studentId] && this.tutorData[studentId][tutorSfx] && thi...
[ "findSet() { \n for (let i = 0; i < this.currentBoard.length-3; i++) {\n for (let j = i +1; j < this.currentBoard.length-2; j++) {\n for (let k = j+1; k < this.currentBoard.length-1;k++) {\n let potenSet = [i, j, k];\n let foundSet = this.checkUserMatch(p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fetch api with the input value as query value, return an array of radio4000 channels
getApi(value) { return fetch(`https://api.radio4000.com/v1/channels?title.icontains=${value}`) .then(res => res.json()) .then( propositions => { this.setState({propositions}); }); }
[ "function getChannels() {\n for (var i = 0; i < channels.length; i++) {\n var apiData = $.getJSON(\"https://wind-bow.gomix.me/twitch-api/streams/\"+channels[i]+\"?callback=?\").done(displayResults);\n }\n}", "function fetchChanList() {\n\tchannels = new Array();\n//\tAjaxGet(parseWT,serverAddr+servle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a unit vector that is not x or yaxis.
function UnitVector(x, y) { this.x = x; this.y = y; this.axis = undefined; this.slope = y / x; this.normalSlope = -x / y; Object.freeze(this); }
[ "function UnitVector(x,y){this.x=x;this.y=y;this.axis=undefined;this.slope=y/x;this.normalSlope=-x/y;Object.freeze(this);}", "function UnitVector(x, y) {\n this.x = x;\n this.y = y;\n this.axis = undefined;\n this.slope = y / x;\n this.normalSlope = -x / y;\n Object.freeze(this);\n}", "function vec_unit(v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2. Create a function to add a task in to the array, call it `addTask`, the function has to accept a string and don't have to return anything.
function addTask(task) { return toDoList.push(task); }
[ "function addTask(task, tasks){\n tasks.push(task);\n return tasks;\n}", "function addTask(tasked) {\n //console.log(tasked)\n task.push(tasked);\n //console.log(task)\n console.log('=========== NEW TASK ===========');\n console.log(task[counter] + ': inserted in the list');\n console.log(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy files to and put a fingerprint in the name fileList (input) the list of files to copy and fingerprint manifest (output) the manifest of files errorList (output) list of errors if any return value list of promises for created files
function createFiles(fileList,manifest,errorList) { return fileList.map(function (filename) { return fsp.readFile(filename).then(function (data) { let p; if (npmVersion) { p = getPackageVersion("npm", npmVersion); } else if (bowerVersion) { p = getPackageVersion("bower", bowerVersion); } else { ...
[ "function ensureFiles(){\n\n\treturn new Promise((resolve, reject) => {\n\t\tl();\n\n\t\tlInfo(`I'm copying all the useful files to the directory ${settings.RTT_ROOT.yellow}...`);\n\t\tconst mapping = [\n\t\t\t[path.join(__dirname,'files','thumbsup.jpg'), path.join(settings.RTT_ROOT, 'thumbsup.jpg')],\n\t\t\t[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH Request Increase a token's Likes on the Server and the Page
function increaseLikes(tokenObj) { console.log(tokenObj.id) const newLikesCount = parseInt(tokenObj.likes) + 1; const tokenID = parseInt(tokenObj.id) const API_URL_ID = `http://localhost:3000/tokens/${tokenID}` const patchObj = { method: 'PATCH', headers: { "Content-Type": "applicat...
[ "updateLikes() {\n this.likes++\n return Toy.adapter.patch(this.id, { likes: this.likes })\n }", "function increaseLikes(toyObj) {\n// e.preventDefault();\n console.log(toyObj.id)\n newLikesCount = parseInt(toyObj.likes) + 1; \n const toyID = parseInt(toyObj.id)\n const API_URL_ID = `http:/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans the proto chain for the specified mark.
function bind(mark) { do { var properties = mark.$properties; for (var i = properties.length - 1; i >= 0; i--) { var p = properties[i]; if (!(p.name in seen)) { seen[p.name] = p; switch (p.name) { ...
[ "function bind(mark) {\n do {\n var properties = mark.$properties;\n for (var i = properties.length - 1; i >= 0 ; i--) {\n var p = properties[i];\n if (!(p.name in seen)) {\n seen[p.name] = p;\n switch (p.name) {\n case \"data\": data = p; break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to submit PartList info to database.
function submitinvForm() { // var to reference Firebase db/PartList/~ var partRef = firebase.database().ref().child("PartList"); // Form push - Needs to pull current values and add inv submitted to them. }
[ "function main_getQuickUpdateData(partNumber)\n{\n sendBackendRequest(\"Back_End/RetrieveItemData.php\",\"SID=\"+getSID()+\"&PartNumber=\"+ partNumber);\n main_loadLog();\n return;\n}", "function savePartsInfoToDb(fileObject){\n\n }", "function MPUBORD_Save () {\n console.log(\"=== MPUBORD_Sav...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add style to attr and class
function formatStyle(eleXML, eleHTML) { if ($(eleXML).hasAttr(XML_STYLE)) { var style = $(eleXML).attr(XML_STYLE); $(eleHTML).addClass(style); $(eleHTML).attr(HTML_STYLE, style); } var classProperty = $(eleXML).find('formatelementproperty[key="CLASS"]') if (classProperty.lengt...
[ "function setCss(tag,mystyle){/** setCss * very same as native tag.setAttribute 'style' BUT return tag for chaining ! */\r\n\tseelog('[functional]setCss '+mystyle+' \\n CAUTION : all previous value of tag attribute style will be overide!\\t use fn:styleSet for sharp update.');\r\n\ttag.style=mystyle;\r\n\treturn ta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function which returns new instances of FormatWrap for simple syntax like: require('winston').formats.json();
function createFormatWrap(opts) { return new Format(opts); }
[ "function createFormatWrap(opts) {\n return new Format(opts);\n } //", "function Formatter() {}", "function createFormatter(fn) {\n return createTransform('format', fn);\n}", "registerFormatter(name,formatterFunction){\n WidgetFactory.registerFormatter(name,formatterFunction);\n }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allows all authenticated users access to radio routes
function radioMiddleware(req, res, next){ let cookie = req.cookies.authorization; if (!cookie) { console.debug("Redirecting to login - no cookie") res.redirect('/'); return; } try { const decryptedUserId = jwtFunctions.verify(cookie, secret); db.User.findOne({ wh...
[ "applyRoutes() {\n // Rotas públicas\n this.express.post(\n '/api/authentication/sign_in',\n (request, response, next) => this.signin(request, response, next),\n );\n this.express.post(\n '/api/authentication/sign_up',\n (request, response, next) => this.signup(request, response, nex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init cropper for adjust the avatar image.
initAvatarCropper() { const image = document.getElementById('avatar-image-preview'); this.cropper = new Cropper(image, { aspectRatio: 1, autoCropArea: 1, minContainerWidth: 250, minContainerHeight: 250, zoomable: false, crop: (event...
[ "initializeCropper () {\n this.cropper = new Croppr(this.photoTarget, {\n aspectRatio: this.calculateAspectRatio(this.aspectRatioValue),\n returnMode: 'ratio',\n onCropEnd: (value) => this.updateCrop(value),\n onInitialize: (cropper) => {\n this.fixCropperOverlay();\n this.setIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disconnect from firebase app
function disconnect() { return admin.app().delete(); }
[ "function killConnection() {\n firebase.app().delete().then(function() {\n console.log('connection closed')\n });\n}", "function disconnectParty(party) {\n firebase.database().ref(party).off();\n}", "function logout(){\n var reg = new Firebase (\"https://shiftsapp.firebaseio.com\");\n \n reg.u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handles the join room event
function handleJoinRoom(room_name){ clearErrors(); socket.emit("join_room", room_name); }
[ "onRoomJoin() {\n this._socket.on(SOCKET_EVENTS.JOINED_ROOM, data => {\n //console.log(SOCKET_EVENTS.JOINED_ROOM, data);\n roomJoinedBySelf(data.roomId);\n this._addSelfMediaSource(); \n });\n }", "function joinRoomListener (e) {\n populateList();\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an ISO 8601 representation of this period
toISOString() { return this.toIsoString(); }
[ "function toJSON() {\r\n return this.toISOString();\r\n }", "toIsoString() {\n if (this.amount === 0) {\n return 'PT0S';\n }\n switch (this.unit) {\n case TimeUnit.Seconds: return `PT${this.fractionDuration('S', 60, Duration.minutes)}`;\n case TimeUnit.Min...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the string is uppercase. If given value is not a string, then it returns false.
function isUppercase(value) { return typeof value === 'string' && isUppercase_1.default(value); }
[ "function isUpperCase (value) {\n\tif (isString(value))\n\t\treturn value === value.toUpperCase();\n\telse\n\t\treturn false;\n}", "function isUppercase(value) {\n return typeof value === \"string\" && validator.isUppercase(value);\n }", "function isUpperCase(value){\n if(value < 65 || value > 90) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes disable state of the internal items.
_enableDisableHandler() { const that = this; if (that.disabled) { for (let i = 0; i < that._items.length; i++) { that._items[i].disabled = true; } } else { for (let i = 0; i < that._items.length; i++) { that._items[i].d...
[ "disable() {\n this._is_enabled = false;\n }", "disable() {\n\t\tMenu.disableItem(this.handle);\n\t}", "function resetDisabled() {\n var lists = that.data.lists;\n for (var i = 0, len = lists.length; i < len; i++) {\n setDisabled(true, lists[i]);\n }\n }", "disable() {\n this.e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========================================================================================> HISTORY history push2
function history_push2(href) { history.pushState({},'',href); }
[ "addToHistory() {\n // just save last 5 operations\n if (this.history.length >= 5) this.history.shift();\n\n this.history.push({\n op: `${this.valueOne}${this.operation}${this.valueTwo}`,\n result: `${this.result}`,\n });\n\n $operationList.innerHTML = '';\n this.history.map(operation =>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Uses a 2d matrix of colours to keep track of tile colours edits the tile colour itself and recalulculates the new color after word submission (when it is colled) uses isSurrounded function
function updateColors(matrix, wordTiles, curPlayer, oponent) { var defaultColor1 = colors.gray; var defaultColor2 = colors.lightGray; var count = 0; for (var iTile in wordTiles) { if (iTile != "move") { count = count + 1; var letterX = wordTiles[iTile].row; va...
[ "function newColors() {\r\n // below loops gives a new color to white tiles\r\n for (i = 0; i < 8; i++) {\r\n for (j = 0; j < 8; j++) {\r\n if (allTiles[i][j].color == \"#FFFFFF\") {\r\n allTiles[i][j].color = findColor();\r\n }\r\n }\r\n }\r\n // copy ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END: checkLocalStorageSupport() / HELPER: show only the settings div and hide all the others
function h_showSettingsOnly() { // show settings div $('#div_Settings').hide(); $('#div_Settings').fadeIn(1000); // 1 sec // and hide most other divs $('#div_Gameresult').hide(); $('#div_Info').hide(); $('#div_Highscore').hide(); $('#div_ActionButtons').hide(); $('#div_StatusTable').hide(); $('#div_Market'...
[ "static show_hide_msal_settings() {\r\n const msal_settings = document.getElementById(\"msal_settings\");\r\n if (msal_settings.style.display === \"none\") {\r\n msal_settings.style.display = \"block\";\r\n this.displaySettings = true;\r\n } else {\r\n msal_settings.style.display = \"none\";...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We define our own getter/setter for `checked` because we need to track changes to it synchronously. The order in which the `checked` property is set across radio buttons within the same group is very important. However, we can't rely on UpdatingElement's `updated` callback to observe these changes (which is
set checked(isChecked) { var _a, _b; const oldValue = this._checked; if (isChecked === oldValue) { return; } this._checked = isChecked; if (this.formElement) { this.formElement.checked = isChecked; } (_a = this._selectionController)...
[ "get checked() {\n return this.buttonToggleGroup ? this.buttonToggleGroup._isSelected(this) : this._checked;\n }", "set checked(value) {\n const el = this.element;\n if (el.checked !== value) this.clickElement(el);\n }", "getChecked() {\n return this.getAttribute('checked');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add region layer above district layer ADDING DISTRICT LAYER
function addDistricts(map) { var districtLayer = new L.TopoJSON(); $.getJSON('js/districts.topo.json').done(addDistrictData); function addDistrictData(topoData) { districtLayer.addData(topoData); districtLayer.addTo(map); districtLayer.eachLayer(handleLayer); } functi...
[ "function addDistrictBound() {\r\n dcbndyply = new google.maps.KmlLayer(dcBoundaryKML, { clickable: false, preserveViewport: true, map: map });\r\n}", "function districtLayer() {\n var districtsLayer = new ol.layer.Vector({\n source: new ol.source.Vector({\n url: 'https://raw.githubusercontent.com/codef...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function generates channel artifacts Returns any error message or null
function channel_artifacts_gen(unique_id,peers){ shell.mkdir ('channel-artifacts'); // Genesis block obj = shell.exec("export FABRIC_CFG_PATH=$PWD && "+fabricSamplesPath + "bin/configtxgen -profile " + unique_id + "Genesis -outputBlock ./channel-artifacts/genesis.block"); if(obj.code !== 0) { ...
[ "function construct_message(jenkinsArgs)\n{\n try\n {\n var configData = JSON.parse(fs.readFileSync('config.json'));\n var discord = new Discord(configData);\n var message = new Message();\n message.content = jenkinsArgs.content;\n \n if(jenkinsArgs.succession)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers a custom validation decorator.
function registerDecorator(options) { var constraintCls; if (options.validator instanceof Function) { constraintCls = options.validator; var constraintClasses = getFromContainer(MetadataStorage$1).getTargetValidatorConstraints(options.validator); if (constraintClasses.length > 1) { ...
[ "function registerDecorator(options) {\n var constraintCls;\n if (options.validator instanceof Function) {\n constraintCls = options.validator;\n }\n else {\n var validator_1 = options.validator;\n constraintCls = (function () {\n function CustomConstraint() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ajoute une munition sur le plateau de jeu
ajouterMunition() { this.ajouterElement(this._fabriqueElement.create('munition')); }
[ "ajouterMunition()\r\n\t{\r\n\t\tthis.ajouterElement(this._fabriqueElement.create('munition'));\r\n\t}", "function compteMouvementgereTour() {\r\n jouerSon(); // Bruit de pas\r\n mouvement++; // 1 mouvement de fait\r\n if(mouvement >= maxMouvement) {\r\n jouerSon(); // Bruit de cloche \"ting\"\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return Matrix but filled with random numbers from gaussian
function RandMatrix (n, d, mu, std) { var m = new Matrix(n, d) fillRandn(m, mu, std) // fillRand(m,-std,std); // kind of :P return m }
[ "function gaussianRandom() {\n let u = 0, v = 0;\n while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)\n while(v === 0) v = Math.random();\n return Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );\n }", "function randGaussian(numOfDims...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a frame with standard timestamp and duration values, the default skeleton pose and an empty morph set.
getDefaultPose() { return CASFrame.create(0, 40, this.defaultPose, null); }
[ "getEmptyPose() {\nreturn CASFrame.create(0, 40, [], null);\n}", "function mkEmptyFrame() {\n var frame = new Array();\n for(var i = 0; i < 8; i++) {\n var col = new Array();\n frame[i] = col;\n\n for(var j = 0; j < 8; j++) {\n col[j] = 0;\n }\n }\n\n return frame;\n}", "function createSkel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Created: 22/08/2014 | Developer: reyro | Description: Function create transaction | Request:Ajax
function fnCreateTransaction() { jQuery.ajax({ type: 'POST', url: bittionUrlProjectAndController + 'fnCreateTransaction', // async: false, dataType: 'json', data: { data: jQuery('#AdmTransactionIndexForm').bittionSerializeObjectJson(), c...
[ "function transaction_create (caller) \r\n{\r\n\tif (!is_empty(caller)) \r\n\t{\r\n\t\tlet ajax_file = '/files/ajax/send.transaction_create.php';\r\n\t\tlet call_form = $(caller).closest('#transaction-form');\r\n\t\tlet options = \r\n\t\t{\r\n\t\t\ttype: $(call_form).find('.command-field input').first().val(),\r\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets the data object initialized in the constructor after a post or put request has been made
_resetData () { this.data = {} }
[ "resetRequestData () {\n this.requestData = {\n params: {},\n options: {}\n };\n }", "reset() {\n this.set('data', []);\n this._reset();\n }", "reset() {\n for (let field in this.originalData) {\n if (this.originalData.hasOwnProperty(fiel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display a line graph on `element` showing failure occurrences.
function renderGraph(element, buildsIterator) { // Defer rendering until later if the Charts API isn't available. if (!google.charts.loaded) { setTimeout(() => renderGraph(element, buildsIterator), 100); return; } // Find every build time in the current cluster. var hits = []; var buildsSeen = new ...
[ "function drawNetworkErrors(elementId, machineInfo, stats) {\n if (stats.spec.has_network && !hasResource(stats, 'network')) {\n return;\n }\n\n // Get interface index.\n var interfaceIndex = -1;\n if (stats.stats.length > 0) {\n interfaceIndex = getNetworkInterfaceIndex(\n window.cadvisor.network...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop the car if there is no fuel:
function stopIfNoFuel(){ if (!checkFuel()){ setTimeout(stopCar, 1500); } else { return true; } }
[ "function stopCar() {\n pendingCall = undefined;\n }", "function carStopped() {\n currentSpeed = 0;\n currentState = carStates[0].state;\n //If both pedals inactive end drive interval and stay in stationary state\n if (!carStates[1].pedal && !carStates[2].pedal) {\n clearInter...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles the party being expanded or not. Being expanded means showing the guest list and supply list.
expandParty(){ const expanded = this.state.expanded; this.setState({expanded:!expanded}); }
[ "toggle() {\n this.expanded = !this.expanded;\n }", "open() {\n this.expanded = true;\n }", "onToggleExpanded() {\n this.toggleProperty('isExpanded');\n }", "function expand() {\n setExpanded(true);\n }", "toggle() {\n this._setState({\n expanded: !this.state.expanded...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the HLS rendition to the form.
function addHlsRendition(container) { var renditionCont = getRenditionCont(); renditionCont.attr('class', 'hlsRendition'); form.addInlineInput(renditionCont, 'URL', 'remoteUrl', 50); container.append(renditionCont); }
[ "function addRendition(container) {\n var renditionCont = getRenditionCont(); \n\n form.addInlineInput(renditionCont, 'URL', 'remoteUrl', 50);\n form.addInlineInput(renditionCont, 'Encoding Rate (bps, not kbps)', 'encodingRate', 8);\n renditionCont.append($('</br>'));\n form.addInlineInput(renditionCont, 'Fram...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
manual PageviewTag for off site page tagging. Allows client to supply URL and Referring URL
function cmCreateManualPageviewTag(pageID, categoryID,DestinationURL,ReferringURL,searchTerm) { var cm = new _cm("tid","1","vn2","e4.0"); cm.pi = pageID; cm.cg = categoryID; cm.ul = DestinationURL; cm.rf = ReferringURL; if (searchTerm) { cm.se=searchTerm; } cm.writeImg(); }
[ "function cmCreateManualPageviewTag(pageID, categoryID,DestinationURL,ReferringURL) {\r\n\tcmMakeTag([\"tid\",\"1\",\"pi\",pageID,\"cg\",categoryID,\"ul\",DestinationURL,\"rf\",ReferringURL]);\r\n}", "function tagUrl(tag, page) {\n var url = config.paths.subdir + '/' + config.routeKeywords.tag + '/' +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get computed style of transformOrigin
function getTransformOrigin(el) { // @ts-ignore var transformOrigin = window.getComputedStyle(el)[transformOriginProperty]; return transformOrigin.split(/\s+/).map(parseFloat); }
[ "getTransformOrigin(elemRect, contentAnchorOffset = 0) {\n const { transformOrigin } = this.props;\n\n const vertical =\n this.handleGetOffsetTop(elemRect, transformOrigin.vertical) +\n contentAnchorOffset;\n\n const horizontal = this.handleGetOffsetLeft(\n elemRect,\n transformOrigin.h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a message for the passed lang and key
function getMessage(lang, key) { return messages[key][lang]; }
[ "function getMessage( key ) \n{\t\n\treturn applicationMessages[ locale ][ key ];\n}", "function translate(key) {\n \"use strict\";\n if (langData.hasOwnProperty(lang)) {\n if (langData[lang].hasOwnProperty(key)) {\n return langData[lang][key];\n } else {\n return \"Undef...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close search field (remove class 'search_opened' and close search results)
function trx_addons_search_close(search_wrap) { search_wrap.removeClass('search_opened'); search_wrap.find('.search_results').fadeOut(); }
[ "function trx_addons_search_close(search_wrap) {\n\t\tsearch_wrap.removeClass('search_opened');\n\t\tsearch_wrap.find('.search_results').fadeOut();\n\t}", "closeSearchResults() {\n this._removeAllSearchResults();\n this.inputElement.setValue('');\n this.searchResults.removeClass('open');\n setTimeout(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Xpath for Overview Tab
get overviewTab() {return browser.element("~Overview");}
[ "get X_Axis1_OverviewTab(){return browser.getLocation('//android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[2]/android.widget.HorizontalScrollView/android.view.ViewGroup/android.view.ViewGroup[3]', 'x');}", "get statsTab() {return browser.element(\"//android.widget.HorizontalScrollView/androi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
open a requirement in a popup window
function openLinkedReqWindow(req_id, anchor) { // 20101008 - asimon - BUGID 3311 var width = getCookie("ReqPopupWidth"); var height = getCookie("ReqPopupHeight"); var windowCfg=''; var feature_url = "lib/requirements/reqView.php"; if (anchor == null) { anchor = ''; } else { anchor = '#' + anchor...
[ "function popupInstructions(sArg)\n{\n\tvar sURL = \"../MCCM/InstructionsPopUp.aspx\" + sDbURL + \"&Type=HelpFile&URL=\" + sArg;\n\tvar oInstruct = window.open(sURL, \"Instruct\", \"width=450,height=450,resizable=yes,status=yes\", true);\n\toInstruct.focus();\n}", "function openLinkedReqVersionWindow(req_id, req_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a directory listener that performs a redirect.
function createRedirectDirectoryListener () { return function redirect () { if (this.hasTrailingSlash()) { this.error(404) return } // get original URL var originalUrl = parseUrl.original(this.req) // append trailing slash originalUrl.path = null originalUrl.pathname = collap...
[ "function createRedirectDirectoryListener () {\n\t return function redirect () {\n\t if (this.hasTrailingSlash()) {\n\t this.error(404)\n\t return\n\t }\n\n\t // get original URL\n\t var originalUrl = parseUrl.original(this.req)\n\n\t // append trailing slash\n\t originalUrl.path = null...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate Ruins. Returns modified mapArray.
function generateRuins(mapArray) { let randomCoordX, randomCoordY, neighbors, isRuinAdded = true; for (let i = 0; i < RUINS_NO; i++) { do { isRuinAdded = false; // get a random tile randomCoordX = getRandomValue(MAP_WIDTH); randomCoordY = getR...
[ "createMap() {\n return this.battlefield.map( (item, i) => {\n return this.createRow( i )\n } )\n }", "Create() {\n console.log(this.userMaps);\n var lastBan = this.userMaps[0];\n this.userMaps.splice(0, 1);\n var lastBanIndexInEnemyMaps = this.enemyMaps.fin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a random screenshot of the game as the banner
function getBanner(screenshots){ if (screenshots){ return screenshots[Math.floor(Math.random() * screenshots.length)]; } }
[ "function randomGif() {\n let randomNumber = Math.floor(Math.random() * 12);\n\n return \"images/win-\" + randomNumber + \".gif\";\n }", "static fetchRandomImage() {\n let i = Math.floor(Math.random() * 4050) + 1;\n return `http://img.infinitynewtab.com/wallpaper/${i}.jpg`;\n }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Permite verificar si un select tiene algun valor seleccionado
function verificar_select_seleccionado(){ if($("#id_provincia option:selected").text()!= '-- Seleccione --'){ $('#id_canton').prop('disabled', false); $('#id_parroquia').prop('disabled', false); } }
[ "function checkSelect(select){\n\treturn (select.selectedIndex > 0);\n}", "function corregirSelect(){\r\n var sel = formElement; \r\n if (sel.sel.selectedIndex-1==respuestaSelect) { \r\n darRespuestaHtml(\"La 1a Pregunta de tipo Select: GENIAL!!!\");\r\n nota +=1;\r\n }\r\n else darRespuestaHtml(\"La 1a ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find interactive objects in room
function interactiveObjectsInRoom (roomid) { var roomItems = []; var room = roomById(roomid); if(room.interactiveObjects != undefined){ for (var i = 0; i < Object.keys(room.interactiveObjects).length; i++) { var roomItem = room.interactiveObjects[Object.keys(room.interactiveObjects)[i]]; ...
[ "function getOpenRooms() {\n return $(\".hc-rooms li.hc-room[draggable='true']\");\n }", "static async getAllObjectsInScene(){\n let objectID = RPM.game.hero.system.id; //Gets the hero's ID so that only camera view is considered.\n\n //Portions of the map based on the event's position.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a parent item is hidden from the site (display in sca = F), hide all inventory items associated with it Created by Livio Beqiri on 1.18.2020
function webstore_hide_children() { //Get first related item var child_item_id = nlapiGetLineItemValue('presentationitem', 'presentationitem', 1); //Check if at least one related item exists if (child_item_id != null && child_item_id != '') { var parent_display_website = nlapiGetFieldValu...
[ "function hideDeletedItems() {\n var parent = document.getElementById(TODOS_DELETED_ID);\n if (parent.style.display === 'none') {\n parent.style.display = 'block';\n } else {\n parent.style.display = 'none';\n }\n}", "_hideItems () {\n const firstFour = this.listItems.filter(notHi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Go to new person page
function newPerson() { remote.getCurrentWindow().loadURL(`file://${__dirname}/newPerson.html`) }
[ "function goToAdd()\n{\n location.href = \"addContact.html\";\n}", "function actionOnContactClick () {\n\n window.location = (\"/contacts/\" + lastName)\n \n }", "function newClub() {\n\twindow.location.href = \"newClub.html\";\n}", "addPerson() {\n //Need to n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set option value for checkbox or radio button
function setOption(inputs, value) { var opt = inputs .Select(function (a) { var input = a.asInput; input.checked = false; return input; }) .Where(function (a) { return a.value == value; }) .First; ...
[ "function _setOptionUI($input, option) {\n\tvar optionValue = option.get('value');\n\n\t$input.prop('checked', optionValue);\n}", "function setSelectValue() {\n var values = (hasMultiple) ? $select.val() : [$select.val()];\n clearTemplateOptions();\n $(values).each(function (index, valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reloads a module by name. does not call init() again, use reloadAllModules() if you want to upadate events
reloadModule(name, path) { for (var m in require.cache) { delete require.cache[m] } console.info("Reloading Module: " + name) if (this.modules[name]) { for (var c in this.commands) { var cmd = this.commands[c] if (cmd.module...
[ "reload ( module, name ){\n if (module && typeof module.__reload === 'function')\n if (this.storedValues && this.storedValues.hasOwnProperty(name)){\n module.__reload(this.storedValues[name]);\n delete this.storedValues[name];\n }\n else\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Default noop formatter in case an undefined sequence is requested.
function noopFormatter(style, defaults, palette) { return style; }
[ "defaultFormatter(value) {\n return `${readableNumber(value)}`;\n }", "function defaultFormatter(text){\n return text;\n}", "function formatOrDefault(providedFormat, defaultFormat) {\n if (!providedFormat) {\n return defaultFormat;\n }\n\n var keys = Object.keys(providedFormat);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check all itens in a array to replace weird characters to space
function rmWeirdChar(arr) { for(let i = 0; i < arr.length; i++) { arr[i] = arr[i].replace(/[&\\#+()$~%':*?<>{}]/g, '').trim(); } return arr; }
[ "function fixSpecialChar(word) {\n alpha = [];\n symbols = [];\n // create regex to check whether the characters are alpha\n regex = /[a-zA-Z]/; \n for (let i = 0; i < word.length; i++) {\n //testing the character to check alpha or symbols\n if (regex.test(word[i])) { \n alpha.push(word[i]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show all mines on board
function showAllMines() { for (var i = 0; i < gBoard.length; i++) { for (var j = 0; j < gBoard.length; j++) { if (gBoard[i][j].isMine) { var elNextCell = getCellByCoord(i, j); elNextCell.classList.add('mine'); } } } }
[ "function showMines() {\n\n for (var i = 0; i < gBoard.length; i++) {\n for (var j = 0; j < gBoard.length; j++) {\n if (gBoard[i][j].isMine) {\n gBoard[i][j].isShown = true\n renderCell(i, j)\n }\n }\n }\n}", "function showAllMines() {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
store username in browser local storage replace input element with span
function saveUsername() { const username = input.value; localStorage.setItem('username', username); span.innerText = username; input.replaceWith(span); }
[ "enterUsername () {\n this.username = JSON.parse(window.localStorage.getItem('username'))\n this.shadowRoot.querySelector('#yourUsername').textContent = this.username\n this.shadowRoot.querySelector('#save').addEventListener('click', event => {\n event.preventDefault()\n if (event.target === this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the song audio to the path
async getSongAudioToPath(title, filePath, options = {}) { return this.getSongToPath(title, filePath, 'audio', options); }
[ "async getSongAudioLink(title, options = {}) {\n return this.getSongLink(title, 'audio', options);\n }", "function getAudio() {\n return _config2.default.audio;\n }", "function getAudio(){return _config2.default.audio}", "function getAudio(byteArray) {\n var base64 = arrayBufferToBase64(byteArray...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a MessagePort |port| where the other end is owned by a Remote (see above) turn each incoming MessageEvent into a call on |handler| and post the result back to the calling thread.
function forwardRemoteCalls(port, // tslint:disable-next-line no-any handler) { port.onmessage = (msg) => { const method = msg.data.method; const id = msg.data.responseId; const args = msg.data.args || []; if (method === undefined || id === undefined) { throw new...
[ "function forwardRemoteCalls(port, \n// tslint:disable-next-line no-any\nhandler) {\n port.onmessage = (msg) => {\n const method = msg.data.method;\n const id = msg.data.responseId;\n const args = msg.data.args || [];\n if (method === undefined || id === undefined) {\n thro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render function This is automatically called when JSX is rendered into the page. Each instance will trigger this. This JSX will get converted to HTML and displayed on the page where intended. In the event of other React Components like and , those will get instances of those components, and their render functions will ...
render() { return ( <div> <h3> Name: {this.state.name} </h3> <AddFriend addNew={this.addFriendToContainer} newFriend={''} /> <ShowList names={this.state.friends} /> </div> ) }
[ "render(){\n\t\tif(this.props.loggedIn && !this.props.loadedFriends &&this.props.token){\n\t\t\tthis.props.getFriends(this.props.userId, this.props.token); \n\t\t}\n\t\t//const [dense, setDense] = this.setDense();\n\t\treturn(\n\t\t\t<div className={this.classes.root}>\n\t\t\t\t<Grid container justify = \"center\">...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add onchange events for the mean and median buttons
function setupLineChartMeanMedianButtons() { d3.select("#mean") .attr("onchange", "meanMedianSelected(this)"); d3.select("#median") .attr("onchange", "meanMedianSelected(this)"); }
[ "function meanMedianSelected(item) {\n lineChart.selectedMode = $(item).attr(\"name\");\n updateLineChartVisualisation();\n}", "function weightSumValueChange() {\n $('#sliderSummation').on('input', function () {\n $('.sliderSummationValue').text($(this).val() + \"%\");\n }).on('mouseup', functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler for when the video ends. / \param ev the event that triggered the action / / The event handler is attached to the 'ended` event of a `VIDEO` / element. (If the video is external, in an `IFRAME`, this event / handler cannot be used.) It removes the caption currently shown / in the `cue_elt` element, if any...
function video_ended(ev) { if (!next_talk_elt) return; while (cue_elt.firstChild) cue_elt.removeChild(cue_elt.firstChild); cue_elt.appendChild(next_talk_elt.cloneNode(true)); cue_elt.removeAttribute("lang"); }
[ "function trackVideoEnd() {\n\n flushParams();\n correlateMediaPlaybackEvents();\n s.Media.stop(videoFileName, videoStreamLength);\n s.Media.close(videoFileName);\n }", "function handleOnendedEvent() {\n\n // reset the position to 0 seconds. Need this for video embedded in tabs w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill in section totals
function pageLoaded( event ) { var row_total_elements = document.getElementsByClassName( 'ts_show_total' ); var sec_total_elements = document.getElementsByClassName( 'ts_show_section_total' ); var sections = []; var totals = []; var index, length; element; /* Create an array of sectio...
[ "function register_repeated_section_totals(section, properties) {\n var events = (\n \"sheet:opened\"\n + \" remove:repeating_\" + section\n + \" change:repeating_\" + section + \":isactive\"\n + \" change:repeating_\" + section + \":\" + section + \"_name\"\n );\n properties.fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recreates the events list. Only shows the latest 10 events.
function renderEvents() { $("#event-items").html(""); if (show_events) { var i = 0; // if (eventsLogList.length > 10) { // i = eventsLogList.length - 10; // } for (;i < eventsLogList.length; i++) { var eventsListItem = $("#event-template").clone(); eventsListItem.html(eventsLogList[i]); $("#event...
[ "function listNext10Events() {\n var calendarId = 'primary';\n var now = new Date();\n var events = Calendar.Events.list(calendarId, {\n timeMin: now.toISOString(),\n singleEvents: true,\n orderBy: 'startTime',\n maxResults: 10\n });\n if (events.items && events.items.length > 0) {\n for (var i ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function evaluates if all the parameters are strings
function isStrings(...parameters) { return !parameters.some(parameter => !isString(parameter)); }
[ "function isString() {\n\t\tif (typeof arguments[0] == 'string') return true;\n\t\tif (typeof arguments[0] == 'object') { \n\t\t\tvar criterion = arguments[0].constructor.toString().match(/string/i); \n\t \t\treturn (criterion != null); \n\t \t}\n\t \treturn false;\n\t }", "function isString() {\n if (typeof...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the index of an item in a list
function findIndex(item, list) { if (!item || !list) { return 0; } for (i in list) { let value = list[i]; if (value && value === item) { return i; } } return 0; }
[ "function findIndexByItem(list, item) {\n for (var i = 0, length = list.length; i < length; i++) {\n if (list[i] === item) {\n return i;\n }\n }\n return null;\n }", "function findIndexOfItem(item,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
11.2.2 Reset swimlane form
function resetSwForm() { $(".input-sw.txtName").val(""); $(".input-sw.ddlType").val("1").removeAttr("disabled"); $(".input-sw.ddlDataStatus").val("Standby").removeAttr("disabled"); $("#btnAddSw").val("Add").attr("onclick", "addSwimlane()"); $("#btnCancelSw").val("Close").attr("onclick", "showView(0)...
[ "function resetForm() {\n // Clear all checkboxes and radio buttons\n $('input:checkbox').each(function(index){\n try {\n $(this).attr('checked', false).checkboxradio('refresh',true);\n } catch(e){}\n });\n $('input:radio').each(function(index){\n try {\n $(this).attr('checked', false).checkb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
all children of atoms should include a method that returns their type (base implementation provided for general Atom) but should be specific to implementing atom class
get type() { return Atom; }
[ "function getContainedMetaType(node, self, metaType) {\n\t\tlet core = self.core,\n\t\tchildIds = core.getChildrenRelids(node),\n\t\tnodes = [];\n\n\t\tfor (let i = 0; i < childIds.length; i++) {\n\t\t\tlet child = core.getChild(node, childIds[i]);\n\n\t\t\tif (self.isMetaTypeOf(child, metaType)) {\n\t\t\t\tnodes.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Counter for pie chart number from zero to defined number
function initToCounterPieChart($this){ "use strict"; $j($this).css('opacity', '1'); var $max = parseFloat($j($this).find('.tocounter').text()); $j($this).find('.tocounter').countTo({ from: 0, to: $max, speed: 1500, refreshInterval: 50 }); }
[ "function initToCounterPieChart( pieChart ){\n\n pieChart.css('opacity', '1');\n var counter = pieChart.find('.mkd-to-counter'),\n max = parseFloat(counter.text());\n counter.countTo({\n from: 0,\n to: max,\n speed: 1500,\n refreshInterval:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds all hamburger menu buttons
function findHamburger(){ var els = d.querySelectorAll('.' + proto.classes.hamburger) for(var i = els.length; i--;){ new Hamburger({ el: els[i] }) } }
[ "function findHamburger() {\n var els = d.querySelectorAll('.' + proto.classes.hamburger);\n for (var i = els.length; i--;) {\n new Hamburger({ el: els[i] });\n }\n }", "find_btns()\n\t{\n\t\treturn this.btn_select ? \n\t\t\tthis.tnav.querySelectorAll(this.btn_select) :\n\t\t\tt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a TransactionItem and adds it to the Transaction
function createTransactionItem(database, transaction, item) { // Handle cross reference items const realItem = item.realItem; const transactionItem = database.create('TransactionItem', { id: generateUUID(), item: realItem, transaction: transaction, }); transaction.addItem(transactionItem); datab...
[ "addNewItemTransaction() {\n let transaction = new AddNewItem_Transaction(this);\n \n this.tps.addTransaction(transaction);\n }", "addNewItemTransaction() {\n let transaction = new AddNewItem_Transaction(this);\n this.tps.addTransaction(transaction);\n }", "addNewItemTra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Operations have to be done perchannel, if not, channels will spill onto each other. Once we have our result, in the form of an integer triplet, we create a new Color node to hold the result.
operate(env, op, other) { var result = []; if (!(other instanceof CartoCSS.Tree.Color)) { other = other.toColor(); } for (var c = 0; c < 3; c++) { result[c] = CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]); } return new CartoCSS.Tree.Color(...
[ "apply_colors() {\r\n\tvar i, j;\r\n\t//loop through the vertices and modify the color buffer\r\n\tfor (i = 0; i < this.size; i++) {\r\n\t\tfor (j = 0; j < this.size; j++) {\r\n\t\t\tvar v = [3];\r\n\t\t\t// console.log(\"Index: X(j): [\", j, \"] Y(i): [\", i, \"]\");\r\n\t\t\tthis.getVertex(v, i, j);\r\n\t\t\t// c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
from type=type1 & schema=type1 to ref=type1
convertRefToModel(object, isSchema, isProperty) { if (jsonHelper.isJson(object)) { return object; } // if the object is a string, that means it's a direct ref/type if (typeof object === 'string') { if (this.isValidRefValue(object)) { return { $ref: '#/definitions/' + object }; } else { ...
[ "function referencify(desc) {\n\t\tvar fields = desc['fields'];\n\t\tfor (var i=0; i<fields.length; i++) {\n\t\t\tvar field = fields[i];\n\t\t\tvar type = field['type'];\n\t\t\tif (type['name']=='owner') {\n\t\t\t\ttype['name']='reference';\n\t\t\t\ttype['refersTo']=['Users'];\n\t\t\t}\n\t\t}\n\t\treturn desc;\n\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a list of numbers, the "mode" is the value that occurs most often. If no number in the list is repeated, then there is no mode for the list. For example: List1 = [1, 5, 2, 6, 2, 3, 3, 2, 8, 2] In List1, mode is value 2 which occurs 4 times. List2 = [500, 100, 200, 50, 100, 300, 50, 700, 50, 100, 500] . In List2, ...
function getTheModeValues(listA) { let result = [], maxValue = -Infinity, modesMapList = {} for (let i = 0; i < listA.length; i++) { let number = listA[i] if (modesMapList[number]) { // if the number already exist in the modesMapList we simply increase the count ...
[ "function findMode(arr) {\n const hash = {}; // empty hash table to hold array values\n\n arr.forEach(num => { // loop through array\n if (hash[num]) { // if the key/value pair exists more than once....\n hash[num] += 1; // add a counter for EVERY time it appears in the array. \n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
these 3 functions are used internally to find parent rooms & streets. you should not call these from outside this class.
function pols_get_parent_room(){ if (this.mapParent){ return apiFindObject(this.mapParent).pols_get_parent_room(); } return this; }
[ "RecurseRooms(rooms, parent) {\n for (let r in rooms) {\n let room = rooms[r];\n\n room.parent = parent;\n room.isPlaced = false;\n\n this.roomsToPlace.push(room);\n\n if (room.children && !isObjectEmpty(room.children)) {\n this.RecurseRoo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the function name starts with "nonvirtual thunk to ", remove that part.
function cleanFunctionName(functionName) { var ignoredPrefix = 'non-virtual thunk to '; if (functionName.startsWith(ignoredPrefix)) { return functionName.substr(ignoredPrefix.length); } return functionName; }
[ "function trimFunctionName(ownName) {\r\n\townName = ownName.substr('function '.length);\r\n\townName = ownName.substr(0, ownName.indexOf('('));\r\n\treturn ownName;\r\n}", "tryStrippingName() {\n if (METHOD_NAMES_ARE_QUOTED) {\n // ... then this approach is unnecessary and yields false positive...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a accurate gameState object.
getGameState() { return this.gameState; }
[ "getGameState() {\n\t\tconst gameState = {\n\t\t\tcurrentRoll: this.currentRoll,\n\t\t\tcurrentPlayer: this.currentPlayer,\n\t\t\tscoreboards: this.scoreboards,\n\t\t\trollsLeft: this.rollsLeft,\n\t\t\troundCount: this.roundCount,\n\t\t\tgameEnded: this.gameEnded,\n\t\t\twinner: this.winner,\n\t\t};\n\t\treturn gam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tarkistetaan pari datasetin avulla
function tarkistaPari() { let ovatPari = ekaKortti.dataset.kehys === tokaKortti.dataset.kehys; //jos kortit ovat pari estetään niitä kääntymästä ja //jos kortit eivät ole pari käännetään ne takaisin ovatPari ? disable() : unflip(); }
[ "function tarkistaPari() {\n let ovatPari = ekaKortti.dataset.kehys === tokaKortti.dataset.kehys;\n //jos kortit ovat pari estetään niitä kääntymästä ja\n //jos kortit eivät ole pari käännetään ne takaisin\n ovatPari ? disable() : unflip();\n}", "function tarkasta_leimaus_aika(e) {\n\t// Rastin leimausaika sa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an event and a `map` function, returns another event which maps each element throught the mapping function.
function _map(event, map) { return snapshot(function (listener) { var thisArgs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var disposables = arguments.length > 2 ? arguments[2] : undefined; return event(function (i) { return listener.call(thisArgs, map(i)); }, nul...
[ "function map(event, mapFunc) {\n return Object.assign(function (listener, thisArgs, disposables) { return event(function (i) { return listener.call(thisArgs, mapFunc(i)); }, undefined, disposables); }, {\n maxListeners: 0,\n });\n }", "function map(event, map) {\n return sn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
collect the sequences that are specified by the checked leaf nodes in the species trees. Submits the form in the page which will act on those accessions. The argument should be either "G" or "A", for graphical or sequence alignment view of the collected sequences.
function collectSequences( sStyle, sAcc ) { var seqAccs = ""; var leaves = $A( document.getElementsByClassName( "leafNode", "treeDiv" ) ); leaves.each( function( n ) { var taskNode = nodeMapping[n.id]; if( taskNode.checked ) { seqAccs = seqAccs + nodeSequence...
[ "function collectSequences( sStyle, sAcc ) {\n\n // retrieve all checked nodes in the tree\n var checkedNodes = tree.getNodesByProperty( \"highlightState\", 1 ); \n \n // make sure we have at least one checked node\n if( ! checkedNodes.size() ) {\n $(\"stError\")\n .update( \"Please select some nodes\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets arraySize according to slider and then call generateRandomArray
function changeArraySize() { arraySize=sizeInput.value; generateRandomArray(); }
[ "function fillChartWithRandomArray(size)\n{\n\tif(isSorting)\n\t\treturn;\n\n\tarray = [];\n\tlet current = 0;\n\tsize = ((size==null || typeof(size)!='number') ? $('#size').val() : size);\n\t\n\twhile (current < size)\n\t{\n\t\tarray[current] = randomNumber();\n\t\tcurrent++;\n\t}\n\tupdateChart();\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verify if specified slot exists.
hasSlot(slotName) { let slots = this.getSlots(); let slot = slots[slotName]; // When slot is not recognized, '?' is returned return slot !== void 0 && slot.value !== '?'; }
[ "function checkSlotExist(slots) {\n if (slots == null) {\n return false;\n }\n const slotNickname = slots.nickname;\n if (slotNickname == null) {\n return false;\n }\n return true;\n}", "hasSlot(slot, node) {\n const nodeSlot = get(node, \"props.slot\");\n return Arra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a client position hit test an array of tabs. Returns the index of the first matching node, or `1`.
function hitTestTabs(tabs, clientX, clientY) { for (var i = 0, n = tabs.length; i < n; ++i) { if (phosphor_domutil_1.hitTest(tabs[i].node, clientX, clientY)) return i; } return -1; }
[ "function hitTestButtons(buttons, clientX, clientY) {\n for (var i = 0, n = buttons.length; i < n; ++i) {\n if (phosphor_domutil_1.hitTest(buttons[i].node, clientX, clientY))\n return i;\n }\n return -1;\n}", "function indexOf(arg,tab){\n\tvar i = 0;\n\twhile (i < tab.length && tab[i] !...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the function responsible for counting clicks on the cat image
function countClicks(){ function increaseClicks(updateText, theCounter){ console.log("Image click works!"); counters[theCounter] += 1; updateText.innerHTML = counters[theCounter] + " clicks"; }; if(event.target === document.getElementsByClassName("theCat")[0]){ increaseClicks(document.getElementById("count...
[ "function clickCounter(thisPicture) {\n //totalClicks+=1; is for total number of clicks, to set limit at 25 later on.\n totalClicks+=1;\n //This loop counts the clicks on each images:\n for (var i = 0; i < allProducts.length; i++) {\n if (thisPicture === allProducts[i].name) {\n allProducts[i].clickCoun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End FnGetModelList /End FnGetProtocolList
function FnGetProtocolList(VarFlag) { var VarDeviceModel = $('#deviceModel').val(); var VarMake = $('#deviceMake').val(); var VarDeviceType = $('#deviceType').val(); if(VarFlag == 1){ GblEditProtocol = ''; GblEditVersion = ''; $('#deviceProtocol').html('<option value="">Select protocol </option>')...
[ "function FnGetProtocolList(VarFlag) {\t\t\n\n\tvar VarDeviceModel = $('#model').val();\t\n\t\t\n\t// get previous values\n\tvar VarMake = $('#make').val();\t\n\tvar VarDeviceType = $('#deviceType').val();\n\tvar VarDeviceModel = $('#model').val();\n\tif(VarFlag == 1){\t\n\n\t\tGblEditProtocol = '';\n\t\tGblEditVer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }