query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Send an `input_reply` message. Notes See [Messaging in Jupyter](
sendInputReply(content) { if (this.status === 'dead') { throw new Error('Kernel is dead'); } let options = { msgType: 'input_reply', channel: 'stdin', username: this._username, session: this._clientId }; let msg = messag...
[ "function chat(){\n // if (speechRec.resultValue){\n let input = speechRec.resultString;\n bot.reply(\"local-user\", input).then(function(reply) {\n console.log(\"Bot>\", reply);\n // output.html(reply);\n speech.speak(reply)\n });\n \n // }\n }", "function onKeyUpInput...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Controller function to update the content including new uploads.
function updateContent() { var objData = _buildDataObject(vm.modelContent, 'updateContentBasic'); objData.content._id = vm.modelContent._id.toString(); return CioContentService.updateContent(objData, function(objErr, objResult, objPendingEvent) { ...
[ "update() {\n view.updateTitle(view.currentPost.title);\n view.updateContent(view.currentPost.content);\n\n view.removeBlogPosts();\n if (view.currentPost.slug === 'blog') {\n // Append blog posts to blog page\n view.loadBlogPosts();\n }\n }", "SET_CONTENT(state, editedDo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Currently supports HTMLattributes: patternMismatch, tooLong, tooShort, valueMissing
function setValidationMessagesFromHTMLAttributes(key) { if (field.hasAttribute(key)) { return field.getAttribute(key); } return ''; }
[ "function validateAttributeString(attrStr,options){//console.log(\"start:\"+attrStr+\":end\");\n//if(attrStr.trim().length === 0) return true; //empty string\nvar matches=util.getAllMatches(attrStr,validAttrStrRegxp);var attrNames={};for(var i=0;i<matches.length;i++){if(matches[i][1].length===0){//nospace before at...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::IAM::User.LoginProfile` resource
function cfnUserLoginProfilePropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnUser_LoginProfilePropertyValidator(properties).assertSuccess(); return { Password: cdk.stringToCloudFormation(properties.password), PasswordResetRequired:...
[ "function cfnUserPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnUserPropsValidator(properties).assertSuccess();\n return {\n Groups: cdk.listMapper(cdk.stringToCloudFormation)(properties.groups),\n LoginProfile: cfnUserLoginPro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve requests tagged to announcement
async getRequests(announcementId) { try { const response = await axios.get( `${globalVariable.announcementApi}all-requests/${announcementId}` ); const requests = response.data; const sortedRequests = await requests.sort( (a, b) => new Date(b.createdAt) - new Date(a.createdAt)...
[ "function getPendingRequests() {\n return {\n 'foia:PendingRequestQuantity': { '$t': 0 },\n 'foia:PendingRequestMedianDaysValue': { '$t': 0 },\n 'foia:PendingRequestAverageDaysValue': { '$t': 0 },\n }\n}", "function respondToAllTag(bidRequest) {\n var tags = bidRequest.tags;\n res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provides information about an error while working with a hamburger. Details are stored in the message property.
function HamburgerException(errorMessage) { this.errorMessage = errorMessage; }
[ "get message() {\n return this.result.message;\n }", "handleSnackBarClose () {\n\t\tthis.setState({ message: null });\n\t}", "editMessageError(options) {\n // check if a custom error was given\n if (options.error && options.error.custom_error) {\n // check which custom error\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates an effect loop
function loop(effects, rep = 1) { return new EffectLoop(effects, { num: rep }); }
[ "function loopAnim() {\n // flake.animate({\n // top: 0,\n // left: thisLeft + Math.floor(Math.random() * (max - min + 1)) + min\n // }, 0)\n // .animate({\n // top: '100%',\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct an async function with the given body
function fun(body) { return "async function foo() { " + body + " }"; }
[ "async function asyncFunc() {\n return 123;\n}", "async function makeCoffee(){...}", "function make_compound_function(parameters, locals, body, env) {\n return list(\"compound_function\",\n parameters, locals, body, env);\n}", "visitCreate_function_body(ctx) {\n\t return this.visitChildr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for quickevaluate always returns a string
function qeval(expression) { "use strict"; return evaluate(expressionToTree(expression)).toString(); }
[ "function compile_lit(env, expr) { \n \n if (expr === undefined || expr === null) {\n return JSON.stringify(expr); \n }\n\n if (expr.constructor === Number || expr.constructor == Boolean) {\n return JSON.stringify(expr);\n }\n\n return undefined;\n}", "function qexpr(expr) {\n if(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTIONS BandsinTown Event Search
function bandsInTown(search) { // Use Axios to get BandsinTown API Call axios.get("https://rest.bandsintown.com/artists/" + search + "/events?app_id=codingbootcamp").then( function (response) { for (i = 0; i < response.data.length; i++) { console.log("Event #" + [i + 1] + "\n...
[ "function getEventSearch(eventName) {\n if (dbPromise) {\n dbPromise.then(function (db) {\n var transaction = db.transaction('EVENT_OS', \"readonly\");\n var store = transaction.objectStore('EVENT_OS');\n var index = store.index('title');\n var request = index.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This class defines a complete listener for a parse tree produced by VoyagerParser.
function VoyagerListener() { antlr4.tree.ParseTreeListener.call(this); return this; }
[ "function YalcilListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}", "function JavaScriptBaseParserListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}", "function miniPythonParserListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all favorite movies
function getFavoriteMovies() { let movieId = $('.movie-id').val(); $.ajax({ url: "/favorites/all", method: "GET", contentType: "application/json", dataType: 'json', complete : function(data){ jQuery.each(data.responseJSON, function(index, item) { //favoriteMovies(item.movieId, item.user....
[ "static getMovies() {\n let movies;\n if (localStorage.getItem('movies') === null) {\n movies = [];\n } else {\n movies = JSON.parse(localStorage.getItem('movies'));\n }\n return movies;\n }", "GetPopularMovies () {\n return { type: types.GET_POPULAR_MOVIES }\n }", "function Browse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get user Data from certificate for main page This will also render a response indicating if no cert was provided from the client
function getUserData(req){ if (req.client.authorized){ var subject = req.connection.getPeerCertificate().subject; return{ user: subject.CN }; } else { return{user: "NO CERT!"}; } }
[ "function loadCertificates() {\n\n // Call the listCertificates() method to list the user's certificates. For more information see:\n // http://webpki.lacunasoftware.com/Help/classes/LacunaWebPKI.html#method_listCertificates\n pki.listCertificates({\n\n // The ID of the <select> elem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update goto card item
updateGotoCard(stepId, action, key, value) { var data = {}; data['update_type'] = 'card_item'; data['type'] = 'go-to-card'; data['_id'] = stepId; data['action'] = action; data[key] = value; //console.log(data) this.stepService.update(this.botId, stepId, da...
[ "updateInfoCard(stepId, action, key, value, index) {\n var data = {};\n data['update_type'] = 'card_item';\n data['type'] = 'info-card';\n data['_id'] = stepId;\n data['action'] = action;\n data['index'] = index;\n data[key] = value;\n //console.log(data)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add a "label" key (which is necessary to render labels or tooltips to data the "key" argument is what you want the data to be based on
addLabelFromKey() { let { data, labelFromKey } = this.props; return data.map((d) => { d.label = `$${ (d[labelFromKey] / 1000).toPrecision(3) }k` }) }
[ "function bindLabels(data) {\n $scope.langproLables = data.labels;\n }", "updateLegendLabel(color, label) {\n let currentLegendData = cloneDeep(this.state.pluginData[\"Legend\"]);\n currentLegendData[this.state.activeEntry][color] = label;\n this.updatePluginData(\"Legend\", currentLegendData);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats all the tables in the text editor.
formatAll(options) { this._textEditor.transact(() => { const re = exports._createIsTableRowRegex(options.leftMarginChars); let pos = this._textEditor.getCursorPosition(); let lines = []; let startRow = undefined; let lastRow = this._textEditor.getLastR...
[ "format(options) {\n this._withTable(options, ({ range, lines, table, focus }) => {\n let newFocus = focus;\n // complete\n const completed = formatter.completeTable(table, options);\n if (completed.delimiterInserted && newFocus.row > 0) {\n newFocus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Task Detail to Bind Items
function getDetail() { Tasks.get({id: $routeParams.taskId}, function(data) { $scope.task = data; }); }
[ "function generateTaskDetail(t) {\n // save selected task\n $scope.selectedTask = t;\n // save scroll position\n $scope.taskDetail.scrollTop = t.scrollTop;\n // Open task details state\n $scope.taskDetail.enabled = true;\n // show task det...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the address of the shield contract
async function getShieldAddress(account) { const fTokenShieldInstance = shield[account] ? shield[account] : await FTokenShield.deployed(); return fTokenShieldInstance.address; }
[ "function getDeployedAddress(contractJSON) { \n return contractJSON[\"networks\"][`${NETWORK_IDS[NETWORK]}`][\"address\"];\n}", "getVendorAddress(address) {\n //\n }", "async getContract() {\n let res = await axios(`${rahatServer}/api/v1/app/contracts/Rahat`);\n const { abi } = res.data;\n res =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the component based on the current selected page
GetSelectedPage() { if (this.page === 'DEPARTMENTS') return <EventRegistration key={ this.state.key } />; if (this.page === 'LOGIN') return <Login key={ this.state.key } Login={ this.props.Login } />; }
[ "function getActivePage() {\n\t\treturn document.querySelector('li[data-active-page=\"true\"]');\n\t}", "function getActivePage() {\n return $.mobile.pageContainer.pagecontainer('getActivePage');\n}", "function getSelectedPageIndex() {\n return selectedPageIndex;\n}", "function getPage() {\n\tvar sPath ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return matchQueue array for person at index, of personsArray:
function createMatchQueue(personsArray, index) { return personsArray[index][3].split(","); }
[ "function matchParticipants(participant, index, array) {\n\t\n\t//Check for last participant in array & push with first participant in array\n\tif (index === array.length - 1) {\n\t\tparticipant.push(array[0][0]);\n\t\tconsole.log(participant);\n\t} else {\n\t\tparticipant.push(array[index + 1][0]);\n\t\tconsole.lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Note: Load does duplicate a lot of parse. Works like parse but can call `loadAndParse` for parsers that need to do their own loading it can also call fetchFile on string urls, which `parse` won't do.
async function load(url, loaders, options) { // Signature: load(url, options) if (!Array.isArray(loaders) && !Object(_loader_utils_normalize_loader__WEBPACK_IMPORTED_MODULE_2__["isLoaderObject"])(loaders)) { options = loaders; loaders = null; } // Extract a url for auto detection const autoUrl = Obje...
[ "load(url) {\n return __awaiter(this, void 0, void 0, function* () {\n const file = this.files.get(utils_1.parseUrl(url).pathname || '/');\n if (file == null) {\n if (this.fallbackLoader) {\n if (this.fallbackLoader.canLoad(url)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_______________________________________________________ updateSettings sends the updateSettings event to ipc, upon receiving the event exportDone, executes the export python file, and displays an alert given it's results Return Value void ___________________________________________________________
function updateSettings(settings){ ipc.send('updateSettings', { settings: settings }) }
[ "function sendFileExportConfigs() {\n\t// send configs - one after each other - we could not make simultanous post requests to work - so it's done sequentially now\n\t// config form onload will be used to finally notify via flag (and trigger callback) when all configs are created\n\tif (sendQueueConfigsFileExportMo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtiene los dias disponibles en la base de datos por medio de una consulta al API Parametro > consulta > Url del api correspondiente a dias totales en la BD Retorno > cantidad de dias registrados en la BD
ObtenerDias(consulta) { var httpRequest = new XMLHttpRequest(); httpRequest.open('GET', consulta, false); httpRequest.send(); var cons = JSON.parse(httpRequest.response); var dias = cons.data[0].dias_disponibles; return dias; }
[ "ObtenerVariables(consulta, listaEnlaces, nombresMedios) {\n var dias = []\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.open('GET', consulta, false);\n httpRequest.send();\n var cons = JSON.parse(httpRequest.response);\n dias.push(cons.data[0].dias_sin_mujeres);\n\n for (var i = 0;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `CfnApiCacheProps`
function CfnApiCachePropsValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.strin...
[ "function CfnResolver_CachingConfigPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateStablecoinData() / Function: calcPlatformData Description: Calculate the total value on each platform
function calcPlatformData(scoin_list) { let all_platforms = []; let mcap_sum = 0; /*---------------------------------------------------- Loop each coin ----------------------------------------------------*/ scoin_list.forEach((scoin) => { /*----------------------------------------------...
[ "async function update() {\n try {\n let coins = await fetchStablecoins();\n DATA.stablecoins = updateStablecoinData(coins, DATA.stablecoins);\n DATA.metrics = calcMetrics(DATA.stablecoins);\n DATA.platform_data = calcPlatformData(DATA.stablecoins);\n console.info('Data Updated...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Export the Headers object in a form that Node.js can consume.
function exportNodeCompatibleHeaders(headers) { const obj = Object.assign({ __proto__: null }, headers[MAP]); // http.request() only supports string as Host header. This hack makes // specifying custom Host header possible. const hostHeaderKey = find(headers[MAP], "Host"); if (h...
[ "function readHeaders(req) {\n const headers = {};\n\n req.forEach((k, v) => {\n headers[k] = v;\n });\n\n return headers;\n}", "getHeaders() {\n const isHeaderStorageEnabled = !(this.features & CurlFeature_1.CurlFeature.NoHeaderStorage);\n const isHeaderParsingEnabled = !(this.features & Cur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom function to set the shadow data
function setShadow(data, clock) { clock.rotateElement(shadow, data.angle); shadow.style.opacity = data.opacity; }
[ "function updateShadowAttribute($element, prop, value) {\n prop = 'data-ui-' + _.caseDash(prop)\n if ( value == null ) {\n $element.removeAttr(prop)\n }\n else {\n $element.attr(prop, typeof value == 'object' ?\n JSON.stringify(value) : value\n )\n }\n}", "initShadow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
listener for input events on the row AND col range sliders. This function will trigger the changing of the number of rows and columns in the minesweeper grid and then start a new game
function sliderInputListener(event) { if (event.target.id === 'row-slider') { rowOutput.innerText = event.target.value; num_rows = event.target.valueAsNumber; } if (event.target.id === 'col-slider') { colOutput.innerText = event.target.value; num_cols = event.target.valueAsNu...
[ "function gridClickListener(event) {\n const ctx = canvas.getContext('2d');\n\n let [row, col] = translateClickPosition(event);\n\n console.log(\"clicked [\",row ,\"][\",col, \"]\");\n\n // start the timer once a grid cell is clicked (if it hasn't been started already)\n if (!timer) setTimer();\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all centers on specific date
function getAvailableAppointmentCentersByDate (date,isEncryptResponse, encryptionPassword){ var bodyRequest ="<sch:getAvailableAppointmentCentersRequest>"; bodyRequest +="<sch:date>" + date + "</sch:date>"; bodyRequest +="</sch:getAvailableAppointmentCentersRequest>"; var request = getRequestString(bodyRequest); ...
[ "function centerData()\n{\n var CENTERS_KEY=\"centers\"\n var firestore=firebaseConnection();\n const allCentres = firestore.query(CENTERS_KEY).execute();\n //Logger.log(allCentres);\n return allCentres;\n}", "static getCenterDetails (req, res) {\n centers\n .findAll({\n include: [{\n model...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check for banned IP timeout.
handleBanTimeouts() { var timeout = Date.now() - this.options.banTimeout; Object.keys(this.bans).forEach(key => { if (this.bans[key].timestamp < timeout) { this.logger.info('Releasing IP ban for %s.', key); delete this.bans[key]; } }); ...
[ "function isIpBlocked( )\n{\n //global config;\n result = false;\n ipaddress = _SERVER.REMOTE_ADDR; \n //foreach (config.BLOCKED_IPS as ip)\n //{\n // if (preg_match( \"/\"+ip+\"/\", ipaddress ))\n // {\n // error( \"Your ip address has been blocked from making changes!\" );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the number of obstacles from HTML input
function changeObstacles (plusMinus){ if ( numObstacles > 10){ return; } else{ numObstacles += plusMinus; resetBoids(); } return new vec(x,y); }
[ "function drawObstacles(){\n if(obstacles.length>0){\n obstacles.forEach(obstacle => {\n obstacle.draw();\n });\n }\n}", "arrangeNextObstacle() {\n const now = new Date().getTime();\n const next = Math.floor((now - this.startTime)/60);\n this.nextObstacle -= (1 + (next * 0.001));\n\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO consider passing the value node eventually not doing it now to simplify assignment's like +=
constructor(idNode, value) { this.idNode = idNode; this.value = value; // ideally valueNode would be cloned otherwise it can get // reset during interpretation of certain node types like while loops // the work around for now is to have a value as well as the valueNode // this.valueNode = value...
[ "function appendNumberOrOperator(value) {\n resultInput.value += value;\n}", "_add_assignment_statement_subtree_to_ast(cst_current_node) {\n var _a;\n this.verbose[this.verbose.length - 1].push(new NightingaleCompiler.OutputConsoleMessage(SEMANTIC_ANALYSIS, INFO, `Adding assignment statemen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send vThingID data_context Aggregated Value
async function sendDataMQTT_AggregatedValue(){ try { var vThingIDValue = "" var totalFreeParkingSpaces = 0 var maxObservedAt = "" var dateObserved var testObservedAt = false var date = new Date(); dateObserved = util.ISODateString(date) for(var ...
[ "async function sendCreateVThingMessages() {\n try {\n\n console.log(\"\")\n\n var vThingIDArray = []\n\n //The TV sends a \"TV/<ID>/c_out createVThing\" message per vThing.\n for(var i = 0; i < vThingList.length;i++) {\n //\"/vThing/vThingID/c_out\" topic\n\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks the last time user was asked to review or if they have already and asks again if nessesary.
function checkReview(){ chrome.storage.sync.get(['reviewed','reviewDateDays'], function(r) { if(r.reviewed != true && (r.reviewDateDays !== undefined )){ //there is a valid date var currDaysNum = convertDateToDays(new Date()); var daysBetween = (currDaysNum - r.reviewDateDays); if((daysBetween) < 0){ ...
[ "function askToReview(){\n\tchrome.runtime.sendMessage({method: \"reviewNotify\",\n\t\ttitle:'',\n\t\tmessage:'',\n\t\tdecay:'-1',\n\t\tonClick: ''\n\t}, function() {});\n}", "function hsReviewTaskPrev() {\n hsReviewTaskNext(true);\n}", "function validateAnswer(){\n let userChoice = this.value\n let co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click event for the checked task
'click .toggle-checked'() { let checked = { taskId: this._id, setChecked: !this.checked, }; Meteor.call('tasks.setChecked', checked, (error, result) => { if (result === false) Bert.alert( 'Good job, task done!', 'default', 'growl-top-right' ); }); }
[ "function clickTaskCard(event) {\r\n // Display view task\r\n popUpView.style.display = \"block\";\r\n\r\n // get local storage\r\n let LocalStorageTaskArray = getLocalStorage(\"task\");\r\n // Get index of taskcard clicked\r\n let index = LocalStorageTaskArray.findIndex(obj => obj.name === event....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets linked properties with the values found in the repository. Those that lack data in the repository are returned by this function as an array.
function updateLinkedPropsOrGetMissingProperties() { var missing = []; // check repository first, we may already have linked resources foreach(properties, function (p) { var r; ...
[ "getItemProperties() {\n const apiUrl = `/item_properties/${this.state.id}`;\n\n service\n .get(apiUrl)\n .then(response => {\n let property_list = response.data.map(property => {\n return {\n property_id: property.property_id,\n value: property.value,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate short ID by hashing body, converting to base62 then truncating.
function shortId(body, length) { var hmac = __webpack_require__(/*! crypto */ "crypto").createHmac('sha1', body).digest(); var base62 = __webpack_require__(/*! base-x */ "base-x")('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'); var fullkey = base62.encode(hmac); return fullkey.slice(0...
[ "function shortId() {\n\treturn crypto\n\t\t.randomBytes(5)\n\t\t.toString(\"base64\")\n\t\t.replace(/\\//g, \"_\")\n\t\t.replace(/\\+/g, \"-\")\n\t\t.replace(/=+$/, \"\");\n}", "function shortenID(mid) {\n var id1 = parseInt(mid.substr(0,9), 16).toString(36)\n if (isNaN(id1)) { // conversion failed\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inject transform function into classes (ie, make it almost Loki)
static lokify() { var args = Array.prototype.slice.call(arguments) if (args && args.length > 0) { args.forEach((klass) => { klass.prototype.transform = Loki.prototype.transform }) } }
[ "function toTransformation(a, b, c, d) {\r\n return new Transformation(a, b, c, d);\r\n}", "function Transform() {\n stream.Transform.call(this, {objectMode: true});\n }", "function makeChainTransform (chain) {\n const trsfs = chain.fields.transformationFunctions.map((trsf) => {\n if (trsf.fields.isE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send fake shutter message
sendShutterMessage(dest, src, event, groupId, deviceType) { const state = event ? "10" : "12"; if (groupId === "00") { return this.sendMsg("30",src,dest,state,"00","00",deviceType); } else { return this.sendMsg("30",src,dest,state,groupId,"06",deviceType); } }
[ "sendAttendeeHandState() {\n let data = {\n handRaised: attendee.handRaised,\n session_id: attendee.session_id\n };\n callFrame.sendAppMessage(data, '*');\n }", "function shovelToBitcoin(message) {\n console.log(`shoveling to bitcoin ${message}`);\n datacash.send({\n data: [\"0x6d02...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add or uodate a feature If a feature with this category and name doesn't exist, add it Otherwise, modify the existing feature
function addOrUpdateFeature(feature) { try { var foundFeature = getFeature(feature.category, feature.name); foundFeature.value = feature.value; } catch (err) { self.features.push(feature); } }
[ "processNewFeature(newFeature) {\n //Notify listeners\n this.notifyFeatureListeners(newFeature);\n //Get corresponding old version of the feature\n let oldFeature = this.getFeatureById(newFeature.getId());\n //Check if old version of the fea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a string message from the form data
createMessage(){ let message = ((this.formData.name !=="") ? ("Mr/Ms "+this.formData.name+ " wants to make a reservation,") : "") +((this.formData.partySize !=="") ? ("for "+this.formData.partySize+" people.\n") : "") +((this.formData.email !=="") ? ("Email:...
[ "function createPubText() {\n const pubText = document.createElement('input')\n pubText.value = pubName\n // Hide the input element within the form\n pubText.type = 'hidden'\n pubText.name = 'pub_name'\n return pubText\n }", "function constructResponse(msg) {\n\n //Example of rep...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find all instances of a URLreferenced `stroke` in the svg. In 2.0, all gradient strokes have a round `strokelinejoin` and `strokelinecap`... for some reason.
_setGradientStrokeRoundedness () { const elements = this._collectElements(); for (const elt of elements) { if (!elt.style) continue; const stroke = elt.style.stroke || elt.getAttribute('stroke'); if (stroke && stroke.match(/^url\(#.*\)$/)) { elt.style...
[ "function SVGWriterGradientMap() {\n\n var findMatchingDistributedNSegs = function (stops) {\n var maxNumSegs = 100;\n var matched = false;\n for (var nSegs = 1; !matched && nSegs <= maxNumSegs; nSegs++) {\n var segSize = maxNumSegs / nSegs;\n ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save load drawings update html loadbox
function update_loadbox() { if (px.ids.length > 0) { var html = ''; // async loop to load drawings // http://blog.chaoscollective.org/post/40284901138/webninja-tutorial-asynchronous-for-loops // https://gist.github.com/akumpf/4514343#file-forloop_jquery_callback-js (function(){ var i = 0; function for...
[ "function load() {\n var $b = $('.background-edit');\n pW = $b.width();\n pH = $b.height();\n var offset = $b.offset();\n pX = offset.left;\n pY = offset.top;\n Raphael('design', pW, pH, preDraw);\n}", "load(callback) {\n\t\t\t\tlet element = timeline._activePart.element;\n\t\t\t\tlet points = timeline._ac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
provides video for Background and styling
function BackgroundVideo(props) { // sets prop for calling component in parent const { video, poster } = props; return ( <video className="absolute z-negative1 w-screen h-screen object-cover" autoPlay loop muted poster={poster} > <source src={video} type="video/mp4" />...
[ "setVideoProperties() {\n this.el.setAttribute('preload', 'metadata');\n this.el.setAttribute('loop', 'true');\n this.el.setAttribute('autoplay', 'true');\n this.el.style.position = 'absolute';\n this.el.style.zIndex = '1';\n }", "static prepareVideoElement(videoElem){const videoElemen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load svg templates .....TODO: DRY this??
function loadSVGtemplate1() { fetch("img/template_1.svg") .then(response => response.text()) .then(svgdata => { console.log("loadSVGtemplate_1"); document.querySelector("#temp").insertAdjacentHTML("afterbegin", svgdata); loadSVGtemplate2(); }); }
[ "function injectSVGs() {\n\tvar mySVGsToInject = document.querySelectorAll('img.iconic-sprite');\n\tSVGInjector(mySVGsToInject);\n}", "async function loadSVG() {\n const response = await fetch(\"coloringBook.svg\");\n const svgData = await response.text();\n\n document.querySelector(\"#placeSvg\").innerHTML = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resets all player stats stored in localStorage
function resetPlayerStats() { localStorage.streak1 = 0; localStorage.streak2 = 0; localStorage.currentPlayer = 2; }
[ "resetStats() {\n\t\tthis.gameDataList = [];\n\t\tthis.curGameData = null;\n\t}", "function clear(){\n localStorage.clear();\n highScores=[];\n highScoreParent.innerHTML=\"\";\n }", "function clearScore(){\n localStorage.setItem('highscore','');\n localStorage.setItem('highscoreName','');\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the actual events for the given prefix and events list
_createEvents(prefix, events) { for(let eventName in events) { events[eventName] = new Event(prefix + '_' + eventName, this); } }
[ "function setPrefixEvents() {\n prefixEvent.transitionend = 'transitionend webkitTransitionEnd oTransitionEnd msTransitionEnd';\n // log prefix events to the log\n console.dir(prefixEvent);\n }", "function normalizeOnEventArgs(args) {\n if (typeof args[0] === 'object') {\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rotateColors: Return a copy of a color array, rotated by the offset:
function rotateColors(colors, offset) { const goodOffset = clamp(offset, 0, colors.length); return colors.slice(goodOffset).concat(colors.slice(0, goodOffset)); }
[ "static FromArray(array, offset = 0) {\n return new Color4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\n }", "function randomizeColors() {\n for (let i = ORIGINAL_COLORS.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i);\n const temp = ORIGINAL_C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load step list for current task
function loadStepList() { var id = $('#form').find('input[name="task_id"]').val(); if(!id) { return; } $.get('/task-steps/' + id, function(steps) { for(var i = 0; i < steps.length; i++) { appendStep(steps[i]); } }); }
[ "load_tasks() {\n this.create_header();\n this.clear_tasks();\n this.get_tasks();\n }", "setupSteps() {\n // Functions for setting up the DOM for each step. Order is important\n this.steps = [() => this.fileUploadStep(), () => this.requiredInfoStep(), () => this.resultsStep()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
required props.url optional props.onload and props.onupdate
constructor (props) { this.url = props.url; this.onload = props.onload; this.onupdate = props.onupdate; }
[ "async setBannerImageFromExternalUrl(url, props) {\n // validate and parse our input url\n const fileUrl = new URL(url);\n // get our page name without extension, used as a folder name when creating the file\n const pageName = this.json.FileName.replace(/\\.[^/.]+$/, \"\");\n // g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: DOMElement > OBJECT Returns OBJECT of attributes from the given DOM Element:
function getAttributes(elem) { return Array.from(elem.attributes).reduce((result, attrib) => { result[attrib.name] = attrib.value; return result; }, {}); }
[ "_getAttributes(elem, mandatory, optional=[]) {\n var res = {};\n for (let i = 0; i < mandatory.length; i++) {\n if (elem.hasAttribute(mandatory[i])) {\n let val = elem.getAttribute(mandatory[i]);\n res[mandatory[i]] = val;\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a delegate (formerly known as remote) account's address, gets the AccountMetaDataPair for the account for which the given account is the delegate account. If the given account address is not a delegate account for any account, the request returns the AccountMetaDataPair for the given address.
getOriginalAccountDataFromDelegatedAccountAddress(address) { return rxjs_1.of("get/forwarded?address=" + address.plain()) .pipe(operators_1.flatMap((url) => requestPromise.get(this.nextNode() + url, { json: true })), operators_1.retryWhen(this.replyWhenRequestError), operators_1.map((accountMetaData...
[ "queryDelegation(delegator_addr, validator_addr) {\n if (is.undefined(validator_addr)) {\n throw new errors_1.SdkError('validator address can not be empty');\n }\n if (is.undefined(delegator_addr)) {\n throw new errors_1.SdkError('delegator address can not be empty');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::LookoutMetrics::AnomalyDetector.RDSSourceConfig` resource
function cfnAnomalyDetectorRDSSourceConfigPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAnomalyDetector_RDSSourceConfigPropertyValidator(properties).assertSuccess(); return { DBInstanceIdentifier: cdk.stringToCloudFormation(properties.d...
[ "function CfnAnomalyDetector_RDSSourceConfigPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets up the box0 for the scene.
setupBox0() { // Box var box0 = BABYLON.Mesh.CreateBox("Box0", 3, src_1.MfgScene.scene); box0.position = new BABYLON.Vector3(3, 30, 0); box0.material = src_1.MfgMaterial.materialWood; this.shadowGenerator1.getShadowMap().renderList.push(box0); box0.physicsImpostor = new B...
[ "buildTeamBoxes(){\n new TeamBox(this, \"team goes here\", 80, 70).create()\n .setInteractive().on('pointerup', ()=>{\n this.scene.sleep('battle')\n this.scene.launch('switch')\n },this);\n new TeamBox(this, \"enemy team goes here\", 530, 70).create(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Telnyx Call Control Answer Call
function call_control_answer_call(f_call_control_id, f_client_state_s) { var l_cc_action = 'answer'; var l_client_state_64 = null; if (f_client_state_s) l_client_state_64 = Buffer.from(f_client_state_s).toString('base64'); var options = { url: 'https://api.telnyx.com/calls/' + ...
[ "function call_control_speak(f_call_control_id, f_tts_text) {\n\n var cc_action = 'speak'\n\n var options = {\n url: 'https://api.telnyx.com/calls/' +\n f_call_control_id +\n '/actions/' +\n cc_action,\n auth: {\n username: f_telnyx_api_key_v1,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create and add Scoreboard for both teams in DOM
function generateScoreBoard() { const tabs = `<p class="alert alert-info small text-center p-0 mt-2 mb-0">🛈 Click team name to Edit</p> <div class="pt-2"> <ul class="nav nav-tabs nav-justified mb-3" id="scoreTab" role="tablist"> <li class="nav-item" role="presentation"> <a class...
[ "function create_scoreboard( player )\n{\n\tvar section = document.createElement('div');\n\tvar name_section = document.createElement('div');\n\tvar first_section = document.createElement('div');\n\tvar second_section = document.createElement('div');\n\tvar third_section = document.createElement('div');\n\n\t$(sect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Window_BattleStatusTS The window for displaying the unit status on the battle screen.
function Window_BattleStatusTS() { this.initialize.apply(this, arguments); }
[ "function QuestBoard_StatusWindow () {\n this.initialize.apply (this, arguments);\n }", "function Window_MiniBattleStatus() {\n this.initialize.apply(this, arguments);\n}", "function Window_BattleInfoTS() {\n this.initialize.apply(this, arguments);\n}", "function Window_BattleItemTS() {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assigns userType based on the radio button selected. If userType == educator and a valid key hasn't been input, the Firebase login widget won't be displayed. If a valid key has been input, the widget is displayed and fully functional (always the case for students, who aren't required to input a key).
function checkUserType() { if ($("#educator-radio").attr("checked") == "checked") { userType = "educator"; if (validKey == false) { showKeyElements(); } else { hideKeyElements(); } } else { userType = "student"; hideKeyElements(); } }
[ "function educatorSelected() {\n userType = \"educator\";\n sessionStorage.setItem(\"selection\", JSON.stringify({ \"studentRadio\": \"unchecked\" }));\n showKeyElements();\n}", "function onSignUpClicked (event) {\n let isValid = true;\n let userType = 'student';\n\n $(getClassName(userType, 'si...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the village associated with this player
setVillage(village) { this.village = village; }
[ "setPlayerLobby(player) {\n var game = this;\n //If lobby count is 0, creates a lobby and puts the player in it\n if (game._lobbies.length == 0) {\n var lobby = game.createLobby();\n\n lobby.addPlayer(player);\n } else {\n var playerJoinedFreeLobby = fals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Migrate and Save data
save(data) { console.log('MigratableLocalStorage.save', data); data = this.migrate(data); localStorage.setItem(this.key, JSON.stringify(data)); return data; }
[ "function migrate() {\n migrateNowPlaying();\n migratePlaylist();\n }", "async migrate() {\n const ts = await this.maxTs();\n\n const str = `insert into productSalesInfo(shopId, transId, productId, ts, price, quantity, amount)\n select b.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rANDI: live regions ANDI // Created By Social Security Administration // ==========================================// NOTE: This only contains the code for finding errors and none for displaying the error code
function init_module() { var rANDI = new AndiModule("4.1.4", "r"); //create rANDI instance rANDI.index = 1; //This object class is used to store data about each live region. Object instances will be placed into an array. function LiveRegion(element, index, containerElement, innerText, containsForm, ale...
[ "function checkError(errorCode) {\n switch(errorCode) {\n case 0:\n return 'Geen watertoevoer';\n case 1:\n return 'Temperatuur te laag';\n case 2:\n return 'Koffiebonen op';\n case 3:\n return 'Afvalbak vol';\n case 4:\n return 'Geen druk';\n default:\n return 'Onbe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove final newline characters from `value`.
function trimTrailingLines(value) { return String(value).replace(/\n+$/, '') }
[ "function fixPerLine(item)\n{\n if( item.value.match(/\\r\\n/) )\n {\n var strings = item.value.split(\"\\r\\n\");\n\n item.value = '';\n\n for( var i = 0; i < strings.length; i++ )\n {\n if( strings[i] != '' )\n {\n strings[i] = strings[i].repl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Routerlevel Middleware lists all movies or movies that are currently showing
async function list(req, res, next) { try { const data = await moviesService.list(); const { is_showing } = req.query; const byResult = is_showing ? (movie) => movie.is_showing == true : () => true; // if given query parameter is_showing, return only movies with is_showing == true res.json...
[ "async function list(req, res) {\n const { movieId } = req.params;\n\n if (movieId)\n {\n let results = await service.listWithCritic();\n const byResult = movieId\n ? (result) => result.movie_id == movieId\n : () => true;\n\n results = results.filter(byResult);\n\n const reduceReviewsAndCritics...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listener responsible for setting the email address into the view model
function setEmail() { vm.email = _emailField.value; }
[ "setEmailFields(el, subject, body){\n el.find('#email-subject').val(subject);\n el.find('#email-body').val(body);\n\t}", "SET_PROFILE_EMAIL(state, payload) {\n state.Profile.email = payload;\n }", "sendSignInLinkEmail (voterEmailAddress) {\n Dispatcher.loadEndpoint('voterEmailAddressSave', ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CodeMirror, copyright (c) by Marijn Haverbeke and others Distributed under an MIT license: Swift mode created by Michael Kaminsky
function Swift(CodeMirror) { function wordSet(words) { var set = {}; for (var i = 0; i < words.length; i++) set[words[i]] = true; return set } var keywords = wordSet(["_","var","let","class","enum","extension","import","protocol","struct","func","typealias","associatedtype", ...
[ "function codemirror_init() {\n Boa.editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\n\tmode: { name: \"python\",\n\t\tversion: 3,\n\t\tsingleLineStringErrors: false},\n\tlineNumbers: true,\n\tindentUnit: 4,\n\tmatchBrackets: true\n });\n}", "setupEditor() {\r\n this.fancyEditor ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
take an input parameter for a string 'item' add the new item to the global array basket return true indicating the item was added
function addItem(item){ basket.push(item); return true; }
[ "addItem(itemId, quntity){\n if (itemId in this.items){\n this.items[itemId].quntity += quntity;\n return true;\n }else if (itemId in productList){\n var itemInfo = productList[itemId];\n this.items[itemId] = {unitPrice: itemInfo.unitPrice,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove o Primeiro valor da fila quando clicado sobre ele
function removePri(nomeBotao){ var priValor = fila.peek(); if(priValor == nomeBotao){ document.getElementById("entrada").innerHTML = ""; fila.pop(); fila.print(); msg = "Removido com Sucesso!"; tipo = "alert-success"; document.getElementById("avisos").innerHTML = ...
[ "function disminuirCantidad(etiquetaCantidad) {\n if (etiquetaCantidad.innerHTML >= 1) {\n etiquetaCantidad.innerHTML--;\n }\n}", "desencolar()\r\n {\r\n if(this.primero === this.final)\r\n {\r\n return null;\r\n } \r\n const info = this.elemento[this.primero];\r\n delete this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a .ts source that defines the VERSION and SCM_REVISION constants.
function genVersion() { const cmd = 'python3'; const args = [VERSION_SCRIPT, '--ts_out', pjoin(cfg.outGenDir, 'perfetto_version.ts')]; addTask(exec, [cmd, args]); }
[ "function getVersion() {\n var contents = grunt.file.read(\"formulate.meta/Constants.cs\");\n var versionRegex = new RegExp(\"Version = \\\"([0-9.]+)\\\";\", \"gim\");\n return versionRegex.exec(contents)[1];\n }", "function generatePotHeader(options) {\n\n\t// Get the date\n\tvar d = new ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show suggestions for current input.
function showSuggestions() { var v = getNeedle(); if (v.length == 0) { box.css('display', 'none'); return; } suggestions = 0; box.empty(); options.filters.each(function(i, f) { if (suggestions == options.size) { return; } list.every(function(o) { ...
[ "function changeSuggest() {\r\n var suggest = \"\";\r\n if(listIndex == -1) {\r\n suggest = curPattern;\r\n } else {\r\n var acList = document.getElementById(\"ac-list\");\r\n if(acList && acList.childNodes.length > listIndex) suggest = acList.childNodes[listIndex].textContent;\r\n }\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the msid of the stream attached to the JitsiTrack object or null if no stream is attached.
getMSID() { const streamId = this.getStreamId(); const trackId = this.getTrackId(); return streamId && trackId ? `${streamId} ${trackId}` : null; }
[ "static getDeviceIdFromMediaStreamTrack(mediaStreamTrack) {\n if (mediaStreamTrack.getSettings && mediaStreamTrack.getSettings() && mediaStreamTrack.getSettings().deviceId) {\n return mediaStreamTrack.getSettings().deviceId;\n }\n else if (mediaStreamTrack.getConstraints && mediaStre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sub menu toggle for level created list This can be used than more than just the level creator if menus are in a similar style
function toggleLevelCreatorListSubMenu(listIndex) { var menuArea = document.getElementsByClassName('hidden-options-area')[listIndex]; if(menuArea.style.display == 'none') { playEffect(0); menuArea.style.display = 'block'; } else { playEffect(1); menuArea.style.display = 'none'; } }
[ "function toggle_recursive() {\n\n var menu = $(this)\n if (menu.is('li')) {\n var ul = menu.children(\"ul\");\n var has_ul = (ul.length > 0);\n if (ul.length > 0) {\n var link = menu.children(\"a\");\n link.css({\n \"position\": \"relative\",\n }).before(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the player object from the playerSpawn location
function createPlayer(playerSpawn) { player = this.physics.add.sprite(playerSpawn.x, playerSpawn.y, 'player', 4); player.setCollideWorldBounds(true); createPlayerAnimations.call(this); }
[ "function SetSpawn()\n{\nDebug.Log(\"LEAVE SETSPAWN FUNCTION ALONE WE SLEEPING KAY!\");\n\ttempX = boardPosition.X;\n\ttempZ = boardPosition.Y;\n\t\n\ttarget = new Point(tempX, tempZ);\n \tif(ProgramGUI.setNewSpawnPoint)\n \t{\n \tDebug.Log(\"X:\" + newSpawnPointX + \"\\nY:\" + newSpawnPointY + \"\\nRotation:\" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serverview: Serverhome: Client Ban
function clientBan(clid) { var time = $('#inputBanTime').val(); var message = $('#inputMessageBan').val(); if(time == '') time = 0; var dataString = 'action=clientBan&message='+message+'&time='+time+'&instanz='+instanz+'&port='+port+'&clid='+clid; $.ajax({ type: "POST", url: "functionsTeamspeakP...
[ "function unbanUser(ip, name)\n {\n if (ip)\n {\n var user = objectWithKeyAndValue(banList, 'ip', ip);\n if (user)\n {\n var index = banList.indexOf(user);\n banList.splice(index, 1);\n sendServerMsgUser(\"You unbanned \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO 1: Initialize state having an array with name "numberCards" which has three values. These values are being displayed inside each card. Keep the initial value as "Click" for each card.
constructor(){ super(); this.state={numberCards: ['click','click','click']}; }
[ "incrementCard() {\n if (this.state.cardIndex + 1 >= this.state.total) return;\n this.setState((prevState) => ({ cardIndex: prevState.cardIndex + 1 }));\n }", "press() {\n this.setState({ cardIndex: 0 });\n }", "clickCard(index) {\n\t\t let flipped = this.flipped(this.state.cards);\n if (fl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_blockedWrite` replaces `_write` after the writer has been closed
_blockedWrite() { throw new Error('Cannot write because the writer has been closed.'); }
[ "async flush() {\n if (this.err !== null)\n throw this.err;\n if (this.n === 0)\n return;\n let n = 0;\n try {\n n = await this.wr.write(this.buf.subarray(0, this.n));\n }\n catch (e) {\n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display Videos By Title
function displayVideosByTitle(title){ var filteredVideos = []; $.each(videos, function (i, video) { if(video.title.includes(title)){ filteredVideos.push(video); } }); displayVideos(filteredVideos); }
[ "function retrieveVideoTitle(videoID) {\n var actionURL = 'https://www.googleapis.com/youtube/v3/videos?id=' + videoID +\n '&key=' + GOOGLE_API_KEY + '&fields=items(snippet(title))&par' + //eslint-disable-line no-undef\n 't=snippet';\n var submitMethod = 'get';\n return Promise.reso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function handle get all center details
static getCenterDetails (req, res) { centers .findAll({ include: [{ model: events, as: 'events', }], }) .then(center => res.status(200).send(center)) .catch(err => res.status(400).send(err)); }
[ "function centerData()\n{\n var CENTERS_KEY=\"centers\"\n var firestore=firebaseConnection();\n const allCentres = firestore.query(CENTERS_KEY).execute();\n //Logger.log(allCentres);\n return allCentres;\n}", "function getMapCenter()\n{\n\tvar mapcenter = \n\t{\n\t\t\"point_x\": map.getCenter().lng,\n\t\t\"p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redirects the current page to a phishing information page
function redirectToPhishingWarning() { console.log('DefiMask - routing to Phishing Warning component'); var extensionURL = extension.runtime.getURL('phishing.html'); window.location.href = extensionURL + '#' + querystring.stringify({ hostname: window.location.hostname, href: window.location.href }); }
[ "function redirect() {\n var redirectUrl = encodeURIComponent(location.href);\n location.href = 'cache.html?redirect_url=' + redirectUrl;\n }", "function SafeCallPage(mPage, cPage)\n{\n //fix cms bug.\n if (THIS_PAGE.indexOf(\"cms.htm\") == 0)\n {\n //add other variable\n var ix = THIS_PAGE.indexO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========================================== pop up window ==========================================
function PopUp(url, name, width,height,center,resize,scroll,posleft,postop) { showx = ""; showy = ""; if (posleft != 0) { X = posleft } if (postop != 0) { Y = postop } if (!scroll) { scroll = 1 } if (!resize) { resize = 1 } if ((parseInt (navigator.appVersion) >= 4 ) && (center)) { X = (s...
[ "static set popup(value) {}", "function openFlashWin(winFile,winName,myWidth,myHeight) {\r\n\tmyPopup = window.open(winFile,winName,'status=no,toolbar=no,scrollbars=no,width=' + myWidth + ',height=' + myHeight);\r\n}", "function aePopupModalWindow(aParentWindow, aUri, aWinName, aWidth, aHeight, aResizable, aPar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscribing with specific topicID endpoint with new Web Socket
function subscribe(topicID) { return new WebSocket(`ws://${SERVER_HOST}:${SERVER_PORT}/${topicID}`); }
[ "function subscribe(topicId) {\n return new WebSocket(`ws://locatlhost:3001/${topicId}`);\n}", "function subscribe(token, topic) {\n\t\tfetch('https://iid.googleapis.com/iid/v1/'+ token +'/rel/topics/' + topic, {\n\t\t\tmethod: 'POST',\n\t\t\t// Authorization: key=<your_server_key>\n\t\t\theaders: new Headers({\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a new bigInt equal to (x mod n) for bigInts x and n.
function mod(x,n) { var ans=dup(x); mod_(ans,n); return trim(ans,1); }
[ "function mod(x, n) {\n return (x % n + n) % n;\n}", "function inverseMod(x,n) {\r\n var ans=expand(x,n.length);\r\n var s;\r\n s=inverseMod_(ans,n);\r\n return s ? trim(ans,1) : null;\r\n }", "function divInt_(x,n) {\r\n var i,r=0,s;\r\n for (i=x.length-1;i>=0;i--) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Geocode Given Location and dispatch MAP_ADDRESS_CHANGED action.
function geocodeLocation(location, mainDispatch, fromGeoLocation) { geocoder.geocode({ location: location }, function (results, status) { if (status === "OK") { var place = results[0]; var address = {}; var isBetweenAddress = -1; isBetweenAddress = place.forma...
[ "function processAddress()\n{\n\tvar address = getAddress();\n\n\t//creating a geocoder object\n\tvar geocoder = new google.maps.Geocoder();\n\n\tgeocoder.geocode({'address': address}, function(results, status)\n\t{\n\t\t//If this was successful, then...\n\t\tif (status === 'OK')\n\t\t{\n\t\t\t//get the latitude an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a new `ZonedDateTime` with the given duration added to it.
add(duration) { return (0, $5c0571aa5b6fb5da$export$96b1d28349274637)(this, duration); }
[ "add(duration) {\n return (0, $5c0571aa5b6fb5da$export$7ed87b6bc2506470)(this, duration);\n }", "subtract(duration) {\n return (0, $5c0571aa5b6fb5da$export$4e2d2ead65e5f7e3)(this, duration);\n }", "subtract(duration) {\n return (0, $5c0571aa5b6fb5da$export$6814caac34ca03c7)(this, dura...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
eventPreventer() Prevents the default event, if the event passed in is a real event.
function eventPreventer(event) { if ( typeof event.target === 'object' && event.target ) { event.preventDefault(); } }
[ "function cancelDefault(event) {\r\n\r\n if (event.preventDefault) {\r\n event.preventDefault();\r\n } else {\r\n event.returnValue = false;\r\n }\r\n}", "function preventDefaultWrapper(fn) {\n return function(e) {\n if (e && e.preventDefault) {\n e.preventDefault();\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
onclick for decrease duration button, simply decrease if > 1
function decreaseDuration() { let durationDisplay = $("selectedDuration"); let duration = parseInt(durationDisplay.textContent); if (duration > 1) { durationDisplay.textContent = (duration - 1) + " hour(s) long"; } }
[ "function decrement() {\n qTimer--;\n $(\"#timer\").html(\"<h2>\" + qTimer + \"</h2>\");\n\n if (qTimer === 0) {\n stop();\n } \n }", "function onClickDecreaseButton() {\n \t\tconsole.log(\"onClickDecreaseButton meldet\");\n \t\tconst daysTillReminding = dayjs_min(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The unpadded base64 encoded shared secret.
get encodedSharedSecret() { return this._sharedSecret; }
[ "function hex2base64(s){ return Crypto.util.bytesToBase64(hex2bytes(s)) }", "generatePrivateKey() {\n // Generates 64 hexadecimal values then concatenates all 64 values\n let r = [];\n for (let i = 0; i < 64; i++) {\n r.push(this.random.integer(0, 15).toString(16));\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Infer the types of vall variables and expressions that don't have types listed. Also attaches function call signatures to function calls. Runs over several passes, until it has stopped finding new hints to infer through the tree.
function InferTypes () { ASTTransform.call(this); this.varDefs = {}; this.fnSignatures = {}; this.fnTypeHints = {}; this.fnRenaming = {}; this.runAgain = false; }
[ "function collectTypes (path: NodePath): void {\n path.traverse({\n InterfaceDeclaration (path: NodePath) {\n path.scope.setData(`typechecker:${path.node.id.name}`, path);\n },\n TypeAlias (path: NodePath) {\n path.scope.setData(`typechecker:${path.node.id.name}`, path);\n },\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isRpcSecret returns true if obj is a wrapped secret value (i.e. it's an object with the special key set).
function isRpcSecret(obj) { return obj && obj[exports.specialSigKey] === exports.specialSecretSig; }
[ "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === EncryptionConfig.__pulumiType;\n }", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DESCRIPTION: Loads assets for the Options menu PARAMS: game (I,REQ) Game object
function preloadOptions(game) { game.load.image('game-bg', 'assets/bg/blue-bg.png'); game.load.image("screentint", "assets/ui/screentint-alpha-50.png"); game.load.image("screentint75", "assets/ui/screentint-alpha-75.png"); game.load.image('black', 'assets/ui/black.png'); game.load.image("button-back", "asset...
[ "function createOptions(game) {\n // Data\n var music = game._music;\n var playerData = game._playerData;\n\n // Background\n fadeSceneIn(game, null, null, true);\n game.add.image(0, 0, 'game-bg').setOrigin(0, 0);\n\n\n // Menu sounds\n var sounds = {\n select: game.sound.add(\"menu-select\", { volume: 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
state list saved in .ics file for import to calender.
createEventFile(){ let icsMSG = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Our Company//NONSGML v1.0//EN\n" Object.keys(this.state.savedEvents).map(eventId => { let item = this.state.savedEvents[eventId]; console.log("icsMSG" ,item); icsMSG += "BEGIN:VEVENT\nUID:me@google.com\nDTSTAMP:...
[ "async changeState(cal) {\n this.setState({ chosenCal: cal });\n localStorage.setItem(\"chosenCalendar\", cal);\n this.getCalendarEvents(cal);\n }", "function storeCal() {\n localStorage.setItem(\"calEvents\", JSON.stringify(calEvents));\n }", "function saveState(){\n writeToFile(userFile...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In JSX true/false We cannot write statements inside JSX Statement? if..else, for, while JSX allows only expression how to write if condition
function Home() { return ( <div> {/* Comment in JSX */} <p>Welcome to product store</p> <p>number: {10}</p> <p> number exp : {10 + 5} </p> <p> func call : { add(10, 30)} </p> <p>Boolean True {true.toString()} </p> <p>Boolea...
[ "render() {\n\n // if & else\n\n // if(this.state.isLoggedIn){\n // return (\n // <div>\n // <h1> Hello Manoj </h1>\n // </div>\n // )\n // }\n // else{\n // return (\n // <div>\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the specified element is a member of the specified class. This function is optimized for the common case in which the className property contains only a single classname. But it also handles the case in which it is a list of whitespaceseparated classes.
function isMember(element, classname) { var classes = element.className; // Get a list of the classes if (!classes) return false; if ( classes == classname ) return true; // We didn't match exactly, so if there is no whitespace, then // this element is not a member of the class. ...
[ "function hasSomeParentTheClass(element, classname) {\n element = element.target;\n if (element.className.split(' ').indexOf(classname)>=0) return true;\n return element.parentNode && hasSomeParentTheClass(element.parentNode, classname);\n}", "function ensureHasClass(element, statedClass) {\n if (!eleme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset the state of the form Submit button
function _btnSubmitReset() { ef.btnSaved = false; ef.btnSubmitText = _isCreate ? 'Submit' : 'Update'; }
[ "function resetForm() {\n setInputs(initial);\n }", "function clearForm() {\n form.reset();\n }", "function resetForm() {\n\t//Reset body to hue-neutral till next qestion in answered\n\tclearStatusClass(document.body);\n\tnextQuestionBtn.classList.add('hide');\n\twhile (solutionButtonsElement....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove default action of submit button If no breed is entered into the form, return a message stating that a breed is needed, stop rest of app from working If breed is entered, run getDogImage function
function watchForm() { $("form").submit(event => { event.preventDefault(); let x = document.getElementById("breedname").value if (x === "") { alert("Enter in a breed name, dog lover!"); } else { getDogImage(); } }); }
[ "function validateBreedAndUpdateDOM(responseJson) {\n if(responseJson.status===\"error\" && responseJson.code===404) {\n $('.result-status').text(\"Uh-oh! The specified breed could not be found.\")\n return;\n }\n $('.result-status').text(\"Found the breed! Here is a picture\") \n $('.dog-im...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new FlowLog. Describes a flow log.
constructor() { FlowLog.initialize(this); }
[ "function FlowLog(props) {\n return __assign({ Type: 'AWS::EC2::FlowLog' }, props);\n }", "constructor(db, log, level) {\n\n if (typeof log === 'object') {\n Object.keys(log).forEach(key => {\n if (key === 'db' || key === 'level') {\n throw new TypeError(`Invalid key: ${k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replaces current rules with two random rules
function twoRandomRules(){ rules = [ randomRule("F",{symbol:"A",forceInclude:true},{symbol:"",forceInclude:false},true), randomRule("A",{symbol:"A",forceInclude:false},{symbol:"",forceInclude:false},true) ] displayCurrents() }
[ "function threeRandomRules(){\n\trules = [\n\t\trandomRule(\"F\",{symbol:\"A\",forceInclude:true},{symbol:\"\",forceInclude:false},true),\n\t\trandomRule(\"A\",{symbol:\"B\",forceInclude:true},{symbol:\"\",forceInclude:false},true),\n\t\trandomRule(\"B\",{symbol:\"A\",forceInclude:false},{symbol:\"B\",forceInclude:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use the AWS::IoT::Thing resource to declare an AWS IoT thing. Documentation:
function Thing(props) { return __assign({ Type: 'AWS::IoT::Thing' }, props); }
[ "function thing (name, model, implementation)\n{\n console.log(\"creating: \" + name);\n\n var options = url.parse(url.resolve(base, name));\n \n var thing = new function Thing () {\n this._name = name;\n this._uri = options.href;\n this._model = model;\n this._observers = {};\n this._properties ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function sorts all of the meals into there specific days
function mealSorter(meals){ //now loop through meals and sort them into days? let meal_day = meals[0].day let day = []; let sortedMeals = []; for (let meal of meals) { console.log('day of meal:', meal.day); console.log('meal_day:', meal_day); if (meal.day == meal_day) { ...
[ "function processdailyforecastsByDay(data) {\n\t\n\t//Separate Daily Forecasts By Day\n\tlet forecastSplitByDay = separateForecastsByDay(data.list);\n\n\t//Traverse through list\n\tfor(let forecastKey in forecastSplitByDay) {\n\t\t\n\t\t//Store current forecast\n\t\tlet forecast = forecastSplitByDay[forecastKey];\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CONVERT USER TWITTER PIC TO TEXTURE FOR GEOMETRY
function getUserPicture( URL ) { $.ajax({ type: "GET", url: "/convert?image_url=" + URL }).done( function( data ) { var canvas = document.createElement('canvas'); canvas.height = window.innerHeight; canvas.width = window.innerWidth; var context = canvas.getContext('2d'); var imgSrc = "da...
[ "map (tu, tv) {\n if (this.internalBuffer) { \n // using a % operator to cycle/repeat the texture if needed\n let u = Math.abs(((tu * this.width) % this.width)) >> 0;\n let v = Math.abs(((tv * this.height) % this.height)) >> 0;\n\n let pos = (u + v * this.width) * ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implements the parsing rules in the Types section. Type : NamedType ListType NonNullType
function parseType(parser) { var start = parser.token.start; var type = undefined; if (skip(parser, _lexer.TokenKind.BRACKET_L)) { type = parseType(parser); expect(parser, _lexer.TokenKind.BRACKET_R); type = { kind: _kinds.LIST_TYPE, type: type, loc: loc(parser, start) }; } els...
[ "function parseTypeExpressionList() {\n var elements = [];\n elements.push(parseTop());\n\n while (token === Token.COMMA) {\n consume(Token.COMMA);\n elements.push(parseTop());\n }\n\n return elements;\n } // TypeName :=", "consoleParseTypes(input) { return Parser.parse(i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }