query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
DZENALL //////////////////////// ////////////////////// 20080731 ///////////////////////// /////////////////////////////////////////////////////////// /include/javascript/ufloat.js"> /////////////////////////////////////////////////////////// Function: isFloat(valueOfStr). Description: Check out that if the parameter v...
function isFloat(valueOfStr){ var patrn1 = /^([+|-]?\d+)(\.\d+)?$/; try{ //alert("isFloat("+valueOfStr+").patrn="+patrn1.exec(valueOfStr)); if (patrn1.exec(valueOfStr)){ return true; }else{ return false; } }catch(e){ return false; } }
[ "function isFloat(str)\n{\n trimmedStr = trimStr(str);\n\n if (trimmedStr == '')\n {\n return false;\n } else if (trimmedStr == '.' || trimmedStr == '-' || trimmedStr == '+')\n {\n return false;\n }\n\n\n result = /^[\\+\\-]?[0-9]*\\.?[0-9]*$/.test(str);\n\n return result;\n\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION DEFINITIONS "major" function displaying a previous week
function previousWeek () { if(day < 7) { // if current day is less than 7 var previousMonthNumberOfDays = months[month-1].days; // number of days of previous month day = previousMonthNumberOfDays; // changing day to a last day of previous month previousMonth(); // calling a "previous month" function to change th...
[ "function previousWeek() {\n\n let current_date = pullDateFromPage();\n let current_date_arrays = getDates(current_date);\n let previous_sunday = current_date.getDate() - 7;\n let new_date = new Date(current_date.getFullYear(), current_date.getMonth(), previous_sunday);\n let new_date_arrays = getDat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert an address in memory to the original byte offset in the binary. Returns undefined if not found in any chunk.
addressToByteOffset(address) { // Offset in the binary of first byte of chunk. let offset = 0; for (const chunk of this.chunks) { if (chunk instanceof CmdLoadBlockChunk) { if (address >= chunk.address && address < chunk.address + chunk.loadData.length) { ...
[ "addressToByteOffset(address) {\n // Offset in the binary of first byte of chunk.\n let offset = 0;\n for (const chunk of this.chunks) {\n if (chunk.className === \"CmdLoadBlockChunk\") {\n if (address >= chunk.address && address < chunk.address + chunk.loadData.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the van that will execute the ride
static async requestVan (start, fromVB, toVB, destination, walkingTime, passengerCount = 1) { await this.updateVanLocations() // determine best van from all possible vans (the one with the lowest duration) const bestVan = await VanRequestService.requestBestVan(start, fromVB, toVB, walkingTime, passengerCou...
[ "function getuRideFare() {\n}", "getDetectedCurrentRunway() {\n const origin = this.getOrigin();\n\n if (origin && origin.infos instanceof AirportInfo) {\n const runways = origin.infos.oneWayRunways;\n\n if (runways && runways.length > 0) {\n const direction = Simplane.getHeadingM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serializes "content" of this editor so it can be saved.
function serializeContent(editorState) { return { contentState: convertToRaw(editorState.getCurrentContent()) }; }
[ "function save() {\n this.textarea.value = this.content();\n }", "function save() {\r\n this.textarea.value = this.content();\r\n }", "save() {\n this.editSaved.next(this.getEditableContent());\n this.setEditableContent(this.content);\n // Setting editMode to false to switch the editor back to ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to add question text to question element
function showQuestion(question) { questionEl.innerText = question.question; }
[ "function questionText(q) {\n $('.js-top-text').html(`\n <h2>Question #${currentQuestion} / ${STORE.length}</span><span> - Score: ${score} / ${q}</h2>\n <p>${STORE[currentQuestion - 1].question}</p>`\n );\n}", "function AddAnswerText()\n{\n\tif (qAPair != null)\n\t{\n\t\tvar answerHeader = document.ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
start CommAPI for bootstrapframescript bootstrap side crossfilelink55565665464644 start CommAPI for bootstrapcontent bootstrap side crossfilelink0048958576532536411 message method postMessage content is inprocesscontentwindows, transferring works there is a framescript version of this, because framescript cant get aPor...
function contentComm(aContentWindow, aPort1, aPort2, onHandshakeComplete) { // onHandshakeComplete is triggered when handshake is complete // when a new contentWindow creates a contentComm on contentWindow side, it requests whatever it needs on init, so i dont offer a onBeforeInit. I do offer a onHandshakeComplete wh...
[ "function doCrossFrameBootstrap(thisWindow, internalContractVersion) {\n return new Promise(function (resolve, reject) {\n var parent;\n // Normally, we are running inside an iframe. The exception to this is\n // when we are running as an extension inside a dialog as part of the UINamespace...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Funcs / Build redirect URI relative to current request
function getRedirectUri(req) { return req.protocol + "://" + req.get('Host') + "/oauthreturn"; }
[ "function getRedirectUrl() {\n let loc = window.location;\n let url = `${loc.protocol}//${loc.host}${loc.pathname}`;\n return url;\n }", "function getRedirect(request) {\n var redirect = request.query.redirect;\n redirect = redirect || request.headers.referer;\n return redirect || '/'; // defau...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TASK : Write a function called totalAvailability(). It should take in an array of hotel objects as a parameter. Loop through the array. Use the method (implemented as a function) inside the hotel object, which determines the hotel room availablilty, to calculate the total numbers of rooms available across all of the ho...
function totalAvailability(chainOfHotels) { //console.table(chainOfHotels); //console.log(chainOfHotels[0].rooms); var roomsAvailable = 0; var i; for (i = 0; i < chainOfHotels.length; i++) { roomsAvailable = roomsAvailable + (chainOfHotels[i].rooms - chainOfHotels[i].booked); //console.log(chainOfHotels[i].boo...
[ "function Hotel(name,rooms,booked){\n this.name = name;\n this.rooms = rooms;\n this.booked = booked;\n this.checkAvailability=function(){\n return this.rooms - this.booked;\n };\n}", "function Hotel(name, totalRooms, bookedRooms) {\n\tthis.name = name;\n\tthis.rooms = totalRooms;\n\tthis.b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract Subflow definition from JSON data
function getSubflowDef(flow) { const newFlow = []; let sf = null; flow.forEach((item) => { if (item.hasOwnProperty("meta") && item.meta.hasOwnProperty("module")) { if (sf !== null) { throw new Error("unexpected subflow definition"); } s...
[ "function getSubflow(_,ctx){var spec=_.$subflow;return function(dataflow,key$$1,parent){var subctx=parseDataflow(spec,ctx.fork()),op=subctx.get(spec.operators[0].id),p=subctx.signals.parent;if(p)p.set(parent);return op;};}", "function getData() {\r\n\r\n\tvar json_schema={\r\n\t\t\"type\": \"object\",\r\n\t\t\"pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Spanpreserving range clamp. If the span of the input range is less than (max min) and an endpoint exceeds either the min or max value, the range is translated such that the span is preserved and one endpoint touches the boundary of the min/max range. If the span exceeds (max min), the range [min, max] is returned.
function clampRange(range, min, max) { var lo = range[0], hi = range[1], span; if (hi < lo) { span = hi; hi = lo; lo = span; } span = hi - lo; return span >= (max - min) ? [min, max] : [ (lo = Math.min(Math.max(lo, min), max - span)), ...
[ "function clampRange (range, min, max) {\n let lo = range[0],\n hi = range[1],\n span;\n\n if (hi < lo) {\n span = hi;\n hi = lo;\n lo = span;\n }\n\n span = hi - lo;\n return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span];\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tab strip (mouse)move handler.
_tabStripMoveHandler(event) { const that = this; if (that._dragStartDetails && !that._dragStartDetails.checked) { if (Date.now() - that._dragStartDetails.originalTime < 500) { that._endReordering(undefined, undefined); that._dragStartDetails.checked = true; ...
[ "_tabStripHandler(target, event) {\n const that = this,\n eventType = event.type;\n\n if (eventType === 'down' && that._tabToResize !== undefined) {\n that._resizing = true;\n that._tabsHeaderSectionCoordinate = that.$.tabsHeaderSection.getBoundingClientRect()[that._or...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to enable notification buttons
function enableNotifBtns() { $("#notifNo").css("opacity", 1); $("#notifYes").css("opacity", 1); }
[ "function updateBtn() {\n if (Notification.permission === 'denied') {\n pushButton.textContent = 'Push Messaging Blocked.';\n pushButton.disabled = true;\n updateSubscriptionOnServer(null);\n return;\n }\n\n\n if (isSubscribed) {\n pu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init Product List Masonry Shortcode Layout
function qodefInitProductListMasonryShortcode() { var container = $('.qodef-pl-holder.qodef-masonry-layout .qodef-pl-outer'); if (container.length) { container.each(function () { var thisContainer = $(this), size = thisContainer.find('.qodef-pl-sizer').width(); thisContainer.waitForImages(fu...
[ "function mkdfInitProductListMasonryShortcode() {\n\t\tvar container = $('.mkdf-pl-holder.mkdf-masonry-layout .mkdf-pl-outer');\n\t\t\n\t\tif (container.length) {\n\t\t\tcontainer.each(function () {\n\t\t\t\tvar thisContainer = $(this),\n\t\t\t\t\tsize = thisContainer.find('.mkdf-pl-sizer').width();\n\t\t\t\t\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the path given points at a JSON file or accepted include file
function isIncludeFile( path ) { if ( fs.statSync( path ).isFile() && getIncludeFileExtensions().indexOf( getFileExtension( path ) ) !== - 1 ) return true; return false; }
[ "function isJSONFile( path ) {\n if ( fs.statSync( path ).isFile() &&\n path.split( \".\" ).pop().toLowerCase() === \"json\") return true;\n\n return false;\n }", "function dotJson (path) {\n return /\\w+\\.json/.test(path)\n}", "function isJsonFile(file) {\n\treturn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper method. Returns a string matching the direction provided.
static stringFromDirection(direction) { switch(direction) { case Direction.EAST: return 'EAST'; case Direction.SOUTH: return 'SOUTH'; case Direction.WEST: return 'WEST'; case Direction.NORTH: return 'NORTH'; default: throw 'direction is not a valid direction! ' + direction; } }
[ "function getDirectionString(dir){\n\tswitch (dir){\n\t\tcase direction.up:\n\t\t\treturn \"up\";\n\t\tcase direction.down:\n\t\t\treturn \"down\";\n\t\tcase direction.right:\n\t\t\treturn \"right\";\n\t\tcase direction.left:\n\t\t\treturn \"left\";\n\t}\n}", "toDirectionString() {\n let retStr = new Strin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new measure using the song's context
newMeasure() { return new Measure({}, this.context) }
[ "function createMeasure(measure) {\n return function(units) {\n this.every.call(this, units, measure);\n return this;\n };\n }", "function createMeasure(measure) {\n return function (units) {\n this.every.call(this, units, measure);\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove an agent from the agentset, returning the agentset for chaining.
remove (o) { // Remove me from my baseSet if (this.isBreedSet()) util.removeItem(this.baseSet, o, 'id') // Remove me from my set. util.removeItem(this, o, 'id') return this }
[ "function removeAgent(agent) {\r\n updateLoc(agent);\r\n}", "removeAgent(idx) {\n\t if (idx >= 0 && idx < this.m_maxAgents) {\n\t this.m_agents[idx].active = false;\n\t }\n\t }", "function removeTeammate(teammate){\n\tif(selectedAnimal == teammate){\n\t\tdeselectAnimal(teammate);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the build information for a specific build beta details resource.
function readBuildInformationForBuildBetaDetail(api, id, query) { return api_1.GET(api, `/buildBetaDetails/${id}/build`, { query }) }
[ "function readBuildBetaDetailsInformationForBuild(api, id, query) {\n return api_1.GET(api, `/builds/${id}/buildBetaDetail`, { query })\n}", "function getBuildBetaDetailsResourceIDForBuild(api, id) {\n return api_1.GET(api, `/builds/${id}/relationships/buildBetaDetail`)\n}", "function readBuildBetaDetailI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new WindowsTargetDetails. WindowsTargetDetails
constructor() { WindowsTargetDetails.initialize(this); }
[ "function createTarget(target,statistics){\n var newTarget = new Target(target.HOST_GUID,\n\t target.NIC_GUID,\n\t target.BLOCK_DEVICE.BD_NAME,\n\t statistics,\n\t target.PORT['_'],\n\t target.CORE_IP_INDEX['_'],\n\t target.ACTIVE['_']);\n return newTarget;\n}", "constructor() { \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this loop will fire to generate the answerslist
function generateAnswers() { isGameOver() var question = questionsList[questionsIndex].question $("#question").text(question) $("#question").show() for (var i = 0; i < 4; i++) { var answerSelectList = questionsList[questionsIndex].answerChoices[i] var corr...
[ "function setupAnswers(){\n for (var i = 0; i<10; i++){\n //selects the variables for the question\n var randomSelection = Math.floor(Math.random()*countToTen.length);\n var randomLanguage = countToTen[randomSelection].name;\n var correctAnswer ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a product to the gift registry. The product must either be a Product object, or is identified by its product ID using the dictionary key ProductID or, if empty, uses the HTTP parameter "pid".
function addProduct() { var currentHttpParameterMap = request.httpParameterMap; var Product = null; if (Product === null) { if (currentHttpParameterMap.pid.stringValue !== null) { var ProductID = currentHttpParameterMap.pid.stringValue; var GetProductResult = new Pipelet...
[ "function addProduct() {\n var Product = app.getModel('Product');\n var product = Product.get(request.httpParameterMap.pid.stringValue);\n var productOptionModel = product.updateOptionSelection(request.httpParameterMap);\n var alreadyExist = false;\n var ProductList = app.getModel('ProductList');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Traverse through an object calling the handler for all primitive type values.
function traverse(object, handler) { // set default handler to an identity function handler = handler || _.identity; if (_.isObject(object) || _.isArray(object)) { _.each(object, function(value, key, list) { list[key] = traverseRecursive(value, key, list, handler); }); return obje...
[ "static ObjectToPrimitive(obj){\n\t\tif (obj === null){\n\t\t\treturn null;\n\t\t}\n\t\tif (rtl.isScalarValue(obj)){\n\t\t\treturn obj;\n\t\t}\n\t\tif (obj instanceof Vector){\n\t\t\treturn obj.map((value) => {\n\t\t\t\treturn Utils.ObjectToPrimitive(value);\n\t\t\t});\n\t\t}\n\t\tif (obj instanceof Map){\n\t\t\tob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renderer class. Renders HTML and exposes `rules` to allow local modifications.
function Renderer() { this.rules = utils.assign({}, rules); // exported helper, for custom rules only this.getBreak = rules.getBreak; }
[ "function Renderer() {\n this.rules = utils.assign({}, rules);\n\n // exported helper, for custom rules only\n this.getBreak = rules.getBreak;\n}", "function HTMLRenderer(){_classCallCheck(this,HTMLRenderer);return _possibleConstructorReturn(this,(HTMLRenderer.__proto__||Object.getPrototypeOf(HTMLRenderer)).ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all unselected options from Form Status dropdown (used when page is locked but not esigned)
function removeUnselectedFormStatusOptions() { $(':input[name='+getParameterByName('page')+'_complete] option').each(function(){ if ( $(this).prop('selected') == false ) { $(this).remove(); } else { $(this).css('color','gray'); } }); }
[ "function removeUnselectedFormStatusOptions() {\r\n $(':input[name='+getParameterByName('page')+'_complete] option').each(function(){\r\n if ( $(this).prop('selected') == false ) {\r\n $(this).remove();\r\n } else {\r\n $(this).css('color','gray');\r\n }\r\n });\r\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fastest way to clone date
function cloneDate(date) { return new Date(date.getTime()); }
[ "function cloneDate(date) {\n\treturn new Date(+date);\n}", "function copy(date) {\n return new Date(date.getTime()); // todo: check if this is ok. new Date(date) used to strip milliseconds on FF in v3\n }", "function copy_date(date) {\n return new Date(date.getTime());\n }", "function copy(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets to a 2D array.
set2D(a) { for (var i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.m[i][j] = a[i][j]; return this; }
[ "function storeIn2DArray() {\n let k = 0;\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < cols; j++) {\n array2D[i][j] = inputArr[k];\n k++;\n }\n }\n}", "setColFromArray(col, array) {\n\n // Check to make sure dimensions are equal\n if(this.values.length !== array.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shows a single Json object in the debug area
function debugJson(data){ var i; console.log(data); if(typeof data == 'string'){ data = $.parseJSON(data); console.log(data); } for(i in data){ if(typeof data[i] == 'string'){ try{ data[i] = $.parseJSON(data[i]); console.log(data); } catch(e){ console.log('no...
[ "function jnDebugShowObj(obj)\n{\n\tconsole.log(obj);\n}", "function preview()\n\t{\n\t\tif (!EZ.log.json) return;\n\t\t\n\t\tvar msg = json \n\t\t\t\t+ itemSeparator(json)\n\t\t\t\t+ work.jsonGroup \n\t\t\t\t+ itemSeparator(work.jsonGroup) \n\t\t\t\t+ keyValue;\n\t\t\n\t\tconsole.clear();\n\t\tEZ.log(null, msg);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Problem: find all subsets in a collection which sum up to X
function Xsum() { var collection = [1, 2, 3, 4, 5, 6, 7, 8, 9, -2, -3, -5]; var solutions = []; var searchTemp = []; var target = 10; collection.sort(); function xSum(collections, index) { if (sum(searchTemp) === target) { solutions.push(collection.filter((item, index) => { return searchTemp[index] === ...
[ "function all_subsetsums(set, sum, k, partial) {\n var result;\n return (function all_subsetsumsinternal(set, sum, k, partial) {\n partial = partial || [];\n\n partial_sum = partial.reduce((a,b) => a + b, 0);\n\n if (partial_sum > sum || k < 0) {\n return null;\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function searchJson / Not optimised for speed and performance, but will work for now :(
function searchJson(body,searchTerm){ for (var i = 0; i < body.length; i++){ if(body[i].name == searchTerm) { return body[i]; } } }
[ "function searchFromJSON(searchString, searchField, exactMatch){\n if(verboseMode) console.log(thisFileName+\":searchFromJSON()-> Run\")\n if(debugMode) console.log(\"littlehelper:searchFromJSON(): Received searchString = \" +searchString)\n // Array to save result indexes\n var foundAtIndex = [];\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate an id from a handler name
getRouteIdFromHandler (handler, type, config) { const path = Footprints.getControllerPath(handler, config) return `[${type}] ${path} -> ${Footprints.getRouteHandler(handler)}` }
[ "getHandlerName(name) {\n return name.replace(/\\[\\d*\\]/, '');\n }", "function getId(name) {\n\treturn name.split(' ').join('_');\n}", "generateID(original_id) {\n // (it's safer to start names with a letter rather than a number)\n return 'v' + this.visualizerID + '__' + original_id;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EVENT HANDLERS Init click handler on board spaces to record user move
function initBoardClickHandlers() { $('[data-board-position]').click(function(e) { if (activePlayerIndex === 1 && gameType === "Computer") { return; } else { var $clickedBoardPosition = $(e.target); return setPlayerToken($clickedBoardPosition); } }); }
[ "function setMoveClickHandler() {\r\n // Get current user's move\r\n $('.move').click(function(){\r\n // Save the user's move\r\n \tmyMove = $(this).data('move');\r\n \t// Submit the move and return true\r\n \tsubmitMove(gameKey, myMove); \r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change a card label to `done`
function switchToDoneLabel(card, label) { $(card).addClass('issue-list-item-done'); $(card).removeClass('issue-list-item-' + label); }
[ "function switchFromDoneLabel(card, label) {\n $(card).removeClass('issue-list-item-done');\n $(card).addClass('issue-list-item-' + label);\n}", "markAsDoneStyle() {\n this.cardTitle.classList.add(\"done\");\n this.edit.remove();\n this.markAsDone.remove();\n }", "function markAsDone() {\n item.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieving task by Id
getTaskById(taskId) { const foundTask = this.tasks.filter((x) => x.Id === taskId); return foundTask; }
[ "function getTask(id) {\n for (i = 0; i < tasks.length; i++) {\n if (tasks[i].tId == id) {\n return tasks[i];\n }\n }\n }", "getTaskById(id) {\n for (let taskObj of this.queue) {\n if (id === taskObj.id) return taskObj;\n }\n\n return null;\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is free and unencumbered software released into the public domain. See UNLICENSE. Design of the tutorial system. The tutorial is divided into a number of parts. TODO: document transition from current tutorialstep to next tutorialstep current and next are keys into the TUTORIAL.setup object if next == "cancel", the...
function tutorialTransition(current, next) { var setup = TUTORIAL.setup assert(current in setup && (next == "cancel" || next in setup), "tutorialTransition: current in setup && " + "(next == 'cancel' || next in setup)") setup[current].deactivate() if (next == "cancel") { compile() } else { s...
[ "function setupTutorial(data, language) {\n\n LANG = language || 'EN';\n\n var stepCount = data.steps.length;\n var stepBox = document.getElementById('stepBox');\n \n //insert a bullet in the \"bead chain\" for every tutorial step\n for(var i=0; i<stepCount; i++) {\n var step = data.steps[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle the water control for the system
function checkWaterControl(){ var d = new Date(); // swtich between water control systems switch(water_ctrl_mode) { case ctrl_mode_dumb: console.log("Water Control Mode: Dumb") if(water_status_on == false){ if(d.getTime()-last_measured_time >= dumb_water_off_t...
[ "function handleWaterSpout(){\n if (globalProps.boughtWaterSpout){\n toggleWaterSpout();\n return;//quit out here. no need to keep going\n }\n if (dangerIsHighEnough(upgWaterSpoutProps)){//need to track helmetBought variable in a new helmet class. if so, then we don't ever disable this.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
assign CSS class to element when specified number is within given range
function assignClassByNumber(elem, num, classRangeArray) { // start by removing any classes previously assigned by this function for (var c = 0; c < classRangeArray.length; c++) { elem.removeClass(classRangeArray[c][0]); } // check each key for (var i = 0; i < classRangeArray.length; i+...
[ "function assignClassByNumber(elem, num, classRangeArray) {\n\n // start by removing any classes previously assigned by this function\n for (var c = 0; c < classRangeArray.length; c++) {\n elem.removeClass(classRangeArray[c][0]);\n }\n\n // check each key\n for (var i = 0; i < classRangeArray.le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render my position on map after receiving location, include marker image and info window that shows distance to closest station
function renderMap() { mypos = new google.maps.LatLng(mylat, mylng); map.panTo(mypos); var image = 'testmarker2.png'; var marker = new google.maps.Marker({ position: mypos, title: "You are here", icon: image }); marker.setMap(map); var infowindow = new google.maps.InfoWindo...
[ "function renderMap()\n {\n me = new google.maps.LatLng(myLat, myLng);\n \n // Update map and go there...\n map.panTo(me);\n\n marker = new google.maps.Marker({\n position: me,\n title: \"Erin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate the table with the User list
function populateTable(){ var tableContent = ''; $.getJSON('/users/userlist', function(data){ userListArray = data; $.each(data, function(){ tableContent += '<tr>'; tableContent += '<td><a href="#" class="linkshowuser" rel="' + this.username + '">' + this.username + '</a></td>'; tabl...
[ "function populateUserTable() {\n\n // jQuery AJAX call for JSON\n $.getJSON( '/users', function( userListData ) {\n \n // Empty content string\n var table = $('#userList table tbody');\n // Reset table each redraw\n table.html('')\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
will turn off stats by default if bool is true, stats will be visible if battleStats, the battling creature's stats will be shown. if enemy, exp will not be shown
displayStats(bool,battleStats,enemy){ this.clearDisplay(); if(bool){ if(battleStats){ this.enableBattleStats(); this.resetBattleStats(); if(enemy){ this.display.exp.visible=false; ...
[ "function setShortStats() {\n setLongStatsFormat(false);\n}", "function disableStatisticTracking() {\n if (statsCheckBox.checked) {\n storage.set('SendUsageStats', true);\n Nucleus.enableTracking();\n } else {\n storage.set('SendUsageStats', false);\n Nucleus.disableTracking()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mutation for fetching experience if success
[FETCH_EXPERIENCES_SUCCESS](state, {experiences}) { state.experiences = experiences }
[ "[FETCH_EXPERIENCE_ID](state, {experience}) {\n state.experience = experience\n }", "onClick() {\n const { mutate, getMutationInput, validateData, onSuccess, onFail } = this.props;\n this.setInProgress(() => {\n mutate(getMutationInput())\n .then(({ data }) => {\n const errors = val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clear the watch that was started earlier
function clearWatch() { if (watchID !== null) { navigator.geolocation.clearWatch(watchID); watchID = null; } }
[ "clearWatchers() {\n\t\tthis.watch.clear();\n\t}", "clear() {\n\t\tthis.watchList.forEach((item) => item.removeWatcher());\n\t\tthis.watchList = [];\n\n\t\tchannel.appendLocalisedInfo('cleared_all_watchers');\n\t\tthis._updateStatus();\n\t}", "_clearWatchers() {\n\t debug('cleared all watchers');\n\n\t th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
9. Is the Number Less than or Equal to Zero? Create a function that takes a number as its only argument and returns true if it's less than or equal to zero, otherwise return false.
function lessThanOrEqualToZero(num) { if(num <= 0){ return true; } else{ return false; } }
[ "function lessThanOrEqualToZero(num) {\n if (num <= 0) {\n return true;\n } else {\n return false;\n }\n} //end function", "function lessThanOrEqualToZero(num) {\nvar num;\n if(num > 0){\n return false;\n }\n return true;\n}", "function lessThanOrEqualToZero(num) {\n if(num <= 0)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
actually go through and draw each individual segment
display(){ push(); fill(this.color); noStroke(); for(let i = 0; i < this.numOfSegs; i++){ ellipse(this.segments[i].x,this.segments[i].y,this.segments[i].width); } pop(); }
[ "draw() {\n this.segments.forEach((segment) => {\n segment.update();\n segment.draw();\n });\n }", "draw() { //we usually dont pass anything, so it's fine. We only pass argument when we draw other's snakes\n this.segments.forEach((segment) => {\n segment.update();\n segment.draw();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We should denote that a different/separate function is required for all the X,Y,Z characteristics. This is exactly because they are characteristics, which means they aren't synchronized nor read, nor updated at the same time. Using one callback method might result in one of the values not being uptodate compared to the...
function accelIntervalCallbackX(charToRead){ charToRead.read(accelReadDataX); }
[ "function accelCallback(error, characteristics) {\n if (error) {\n console.log(\"Error discovering ACCEL characteristics!\");\n }\n else {\n console.log('Successfully discovered characteristics of ACCEL service!');\n //Depending on the UUID of the characteristic, we distinguish X,Y,Z coordinates\n fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Spaceify Synchronous, 29.7.2015 Spaceify Oy
function SpaceifySynchronous() { var self = this; var methodId = 0; var methods = []; var results = {}; var waiting = null; var finally_ = null; // Start traversing functions in the order they are defined. Functions are executed independently and results are not passed to the next function. // The results ...
[ "function Synchronized () {}", "sync() {\n\n }", "function Synchronized() {}", "synchronize() {}", "function Synchronized() {\n }", "syncSync() {\n // NOP.\n }", "function TrueSpecificationSync() {}", "function SpaceifyService()\r\n{\r\n// NODE.JS / REAL SPACEIFY - - - - - - ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============ Add New Rectangle to canvas ===================
function addRect(){ var newRect = new fabric.Rect({ top : 70, left : 100, width : 200, height : 200, fill : 'rgb(200,200,200)' }); canvas.add(newRect).setActiveObject(newRect); selectObjParam(); canvas.renderAll(); }
[ "addRectangle() {\n console.log(\"salut\")\n this.rectangles.push(new Rectangle(0, 0,\n DEFAULT_RECTANGLE_SIZE, DEFAULT_RECTANGLE_SIZE, this));\n this.selectRectangle(this.rectangles.length - 1);\n }", "function addRectangle() {\n var rect = new fabric.Rect({\n left: 1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates tag with given date and format
function timetag_helper(date, formatName) { return `<time datetime="${this.helpers.date(date, 'iso')}" data-format="${formatName}"` + ` title="${this.helpers.date(date, 'datetime')}">${this.helpers.date(date, formatName)}</time>`; }
[ "function tag(link, date) {\n var parsed = url.parse(link);\n var path = parsed.pathname;\n if (parsed.hash) path += parsed.hash.replace(/\\#/g, '/');\n return 'tag:' + parsed.host + ',' + strftime('%Y-%m-%d', date) + ':' + path;\n}", "function genDate() {\n\t\t\t\t\tvar str = $date_content.html()+\"-\"+dd($d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a channel exists and is online, according to Twitch's API. Also returns their name/display name for ease of use.
function checkIfChannelExistsAndOnline(channel, callback) { var channels = [channel]; twitchAPI.getStreamStatus(channels, function(error, errorType, response) { if (error || response.streams.length === 0) {callback(false);} else { var name = response.streams[0].channel.display_name; if (!name) {name = ...
[ "function checkIfChannelExistsAndOnline(channel, callback) {\n\tvar channels = [channel];\n\t\n\ttwitchAPI.getStreamStatus(channels, function(error, errorType, response) {\n\t\tif (error || response.streams.length === 0) {callback(false);}\n\t\t\n\t\telse {\n\t\t\tvar name = response.streams[0].channel.display_name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Theme name must exist in colorChoices Except for null, which means no theme
function getSanitizedThemeName(name) { return name in colorChoices ? name : null; }
[ "validateTheme(newTheme) {\n if (!newTheme) {\n return;\n }\n if (themeNames.includes(newTheme)) {\n this.buttonTheme = newTheme;\n }\n else {\n console.warn(`Theme \"${newTheme}\" is not valid`);\n }\n }", "static isValidTheme(theme) {\n return ['education'].includes(theme);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a copy of field variable table.
copyTable() { var x = this.table; var copied = {}; Object.keys(x).forEach(function(key) { copied[key] = []; copied[key][0] = x[key][0].slice(0); copied[key][1] = x[key][1]; copied[key][2] = x[key][2]; }); return copied; }
[ "clone() {\n const data = this.type === \"matrix\" ? math.clone(this.mat) : this.mat;\n return new Table(data);\n }", "function deepCopy(field) {\r\n if (field === null || field === undefined)\r\n return field;\r\n if (Values.isArray(field)) {\r\n return [].concat(field....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Branch related code This code has to do with managing the branch ids and ancestry of new branches / Used to create a new branch id when a new branch is created. A new branch is created when: a new folder is opened for the first time the user downloads a playback The id is not guaranteed to be unique among all other sto...
function createRandomBranchId() { //create a 5 digit random number (in base 62: 0-9,a-z,A-Z) between 00000-ZZZZZ or 0-916,132,832 branchId = createRandomNumberBase62(5); }
[ "addBranchName() {\n const branches = this.JSONBranches.filter((b) => { return (b.name !== \"master\"); });\n\n const sortedBranches = branches.map((branch) => {\n const length = this.visitParents(this.SHALookup[branch.commit.sha], () => 1);\n return { sha: branch.commit.sha, name: branch.name, leng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches character's frame data and uses it to create array frameData
function dataFetch(character) { frameData = []; const regChar = character.toLowerCase().replace(/ /g, '_'); fetch(`assets/data/${regChar}.json`) .then(blob => blob.json()) .then(data => frameData.push(...data)) .then(displayData); }
[ "loadArrayIntoNdframe({ data, index, columns, dtypes }) {\n // this.$data = utils.replaceUndefinedWithNaN(data, this.$isSeries);\n this.$data = data;\n if (!this.$config.isLowMemoryMode) {\n //In NOT low memory mode, we transpose the array and save in column format.\n //This makes column data ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterate all keys in storage class.
_iterKeys (callback) { // first check if storage define a 'keys()' function. if it does, use it if (typeof this._storage.keys === 'function') { let keys = this._storage.keys() for (let i = 0; i < keys.length; ++i) { callback(keys[i]) } } else if (typeof Object === 'function' && Obj...
[ "*\n entries() {\n for (let k of this.storageKeys.keys()) {\n yield [k, this.getItem(k)];\n }\n }", "async getKeys() {\n return await AsyncStorage.getAllKeys()\n }", "*\n values() {\n for (let k of this.storageKeys.keys()) {\n yield this.getItem(k);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancels the album creation popup
cancelCreation() { this.state.albumModalFinished(); }
[ "function deleteAlbumPopup(album) {\n console.log('deleteAlbumPopup');\n if (confirm(\"Delete '\" + album.title + \"'?\")) {\n social.deleteAlbum(viewer.id, album.id, function(response) {\n \tpublish('org.apache.shindig.album.deleted', album);\n console.log('delete...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function draws the play area, sometimes with opacity
function drawPlayArea() { // get the canvas const c = document.getElementById("playAreaCanvas"); const ctx = c.getContext("2d"); // clear the canvas ctx.clearRect(0, 0, c.width, c.height); // draw the canvas drawAllBlocksToPlayArea(ctx); }
[ "function draw() {\n\tif (rowRemoved && soundIsOn) {\n\t\trowPopAudio.play()\n\t\trowRemoved = false\n\t}\n\tfor (let y = 0; y < playField.length; y++) {\n\t\tfor (let x = 0; x < playField[y].length; x++) {\n\t\t\tif (playField[y][x] === 1) {\n\t\t\t\tmainCellArr[y][x].style.opacity = '1'\n\t\t\t} else if (playFiel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes the closet depth
changeClosetDepth(depth) { if (depth > 0) { var axesDepth = depth / 2; this.faces.get(FaceOrientation.BASE).changeDepth(depth); this.faces.get(FaceOrientation.TOP).changeDepth(depth); this.faces.get(FaceOrientation.BACK).changeZAxis(-axesDepth); this.f...
[ "setDepth(depth) { this.depth = depth; }", "function setDepth(val) {\n bookshelf.depth = val;\n}", "function changeDepth(node,args){\r\n\tif(args.initDepth + args.delta > node.depth)\r\n\t\tnode.depth += args.delta;\r\n}", "restack (){\n this._layers.forEach( (layer, key, index) => {\n laye...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function adds all answers from the json object to the html document
function showAnswers(json) { document.getElementById("ans").style.display = "block"; let tbody = document.getElementById("ans").childNodes[1].lastChild; while(tbody.hasChildNodes())//delete all old answers tbody.removeChild(tbody.lastChild); for (i in json) { ...
[ "function aptAjaxDataShow(fileName) {\n MainQAContainer.innerHTML=\"\";\n \n let xmlhttp = new XMLHttpRequest();\n xmlhttp.onreadystatechange = function() {\n\n if (this.readyState == 4 && this.status == 200) {\n var myObj = JSON.parse(this.responseText);\n\n let htmlstring=\"\";\n for (let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes 'private/internal' properties used by the earth viewer
_initProperties(){ this.tileGroups = new THREE.Object3D(); this.tileGroup = []; //Toolbox this.tileMeshProvider = new TileMeshProvider(); //Texture loader this.textureLoader = new TileTextureProvider(); //Zoom levels this.zoom = 4; this.lonStam...
[ "_initPublicVars() {\r\n /**\r\n * The origin point of the tilemap for scrolling.\r\n *\r\n * @type Point\r\n */\r\n this.origin = new Point();\r\n /**\r\n * The tileset flags.\r\n *\r\n * @type array\r\n */\r\n this.flags =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Center Point of each logoGrid Cell / Requires: / colId (OPTIONAL): Integer. Id of the column we wish to get the positions for / Returns an object with the following properties: / headerCenter: Array containing objects which hold the center and absolute center coords for each header cell / contentCenter: Array conta...
function getLogoGridColCenter(colId) { let gridCounts = dataGridDisplayGetCounts("logoGrid"); //Get the number of rows and columns for the logoGrid element if (gridCounts === false) { //If false, then we could not return the values, so return false console.log(`function animateLogo failed. Cascade fail...
[ "function getCenterCoords(rowNum, columnNum){\n\t\treturn {y: rowNum*70+75, x: columnNum*70+35};\n}", "cellCenterX(col) {\n return this.cellWidth * 1/2 + this.cellWidth * col\n }", "function cellRoot (col, row) {\n\t\t\t// Since the image is centered, the pins need to be shifted over to be centered to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object. When available, this method will use `Object.assign()` underthehood.
function assign() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i - 0] = arguments[_i]; } if (typeof Object.assign !== 'function') { // use the old-school shallow extend method return _baseExtend(args[0], [].slice.call(args, 1), false); } ...
[ "function assign() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i - 0] = arguments[_i];\n }\n if (typeof Object.assign !== 'function') {\n // use the old-school shallow extend method\n return _baseExtend(args[0], [].slice.call(args, 1), false);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adiciona mascara de cnpj
function MascaraCNPJ(cnpj){ if(mascaraInteiro(cnpj)==false){ event.returnValue = false; } return formataCampo(cnpj, '00.000.000/0000-00', event); }
[ "function MascaraCNPJ(cnpj)\n{\n\tif(mascaraInteiro(cnpj)==false){\n\t\tevent.returnValue = false;\n\t}\n\treturn formataCampo(cnpj, '00.000.000/0000-00', event);\n}", "function MascaraCNPJ(cnpj)\n{\t\n if(mascaraInteiro(cnpj)==false)\n {\t\t\n event.returnValue = false;\t\n }\t\t\n return formataCam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hide the namespace / Date picker manager. Use the singleton instance of this class, $.datepicker, to interact with the date picker. Settings for (groups of) date pickers are maintained in an instance object (DatepickerInstance), allowing multiple different settings on the same page.
function Datepicker() { this.debug = false; // Change this to true to start debugging this._nextId = 0; // Next ID for a date picker instance this._inst = []; // List of instances indexed by ID this._curInst = null; // The current instance in use this._disabledInputs = []; // List of date picker inputs that h...
[ "#hide() {\r\n this.datepicker.style.display = \"none\";\r\n }", "function hide_form_element_date_picker(oEle,boolHide,oJsDate)\r\n{\r\n\tvar undefined;\r\n\tvar doc = app.getEleDoc(oEle);\r\n\tif(doc==null) return;\r\n\tif(boolHide==undefined)\r\n\t{\r\n\t\tvar boolHidden = oEle.getAttribute(\"datehidd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ROLL[] ROLL the top three stack elements 0x8A
function ROLL(state) { var stack = state.stack; var a = stack.pop(); var b = stack.pop(); var c = stack.pop(); if (DEBUG) console.log(state.step, 'ROLL[]'); stack.push(b); stack.push(a); stack.push(c); }
[ "function ROLL(state) {\n\t var stack = state.stack;\n\t var a = stack.pop();\n\t var b = stack.pop();\n\t var c = stack.pop();\n\n\t if (exports.DEBUG) { console.log(state.step, 'ROLL[]'); }\n\n\t stack.push(b);\n\t stack.push(a);\n\t stack.push(c);\n\t}", "function ROLL(state) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind hook actions so cartPreview updates remotely. cannot bind multple events in the standard spaceseparated way.
_bindUtilHooks() { // initial events: when an update button is clicked this.cartChangeHooks.forEach((hook) => { utils.hooks.on(hook, (event) => { this._showOverlay(); }); }); // remote events: when the proper response is sent this.cartChangeRemoteHooks.forEach((hook) => { ...
[ "bindEventListeners()\r\n\t{\r\n\t\tthis.icon.onclick = function(e) {\r\n\t\t\te.preventDefault();\r\n\t\t\tthis.toggleCartPreview();\r\n\t\t}.bind(this);\r\n\r\n\t\tEventManager.subscribe('cart.product.added', function(attributes) {\r\n\t\t\tthis.openCartPreview();\r\n\t\t\tthis.addItem(attributes);\r\n\t\t\tthis....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a constructor. The graphics object keeps all the drawing routines under a single heading and allows us to choose the size of the squares we're drawing on to. This object uses the div ids from the grid array (see below) and assumes a div called "indicator", which displays which mark is placed next.
function graphics(size = 100){ this.clearAll = function(){ for (var i = 0; i < grid.length; i++) { for (var j = 0; j < grid[i].length; j++) { document.getElementById(grid[i][j]).getContext("2d").clearRect(0, 0, size, size); } } document.getElementById("indicator").getContext("2d").clearRect...
[ "constructor(gridSize, gridColumns, gridRows, gridMin) {\n this.gridSize = gridSize\n this.gridColumns = gridColumns\n this.gridRows = gridRows\n this.gridMin = gridMin\n this.rects = []\n this.currentRects = [{\n x: 0,\n y: 0,\n w: this.gridColumns,\n h: this.gridRows\n }]\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tabs hook that provides all the states, and accessibility helpers to keep all things working properly. Its returned object will be passed unto a Context Provider so all child components can read from it. There is no document link yet
function useTabs(props) { var defaultIndex = props.defaultIndex, onChange = props.onChange, index = props.index, isManual = props.isManual, isLazy = props.isLazy, _props$lazyBehavior = props.lazyBehavior, lazyBehavior = _props$lazyBehavior === void 0 ? "unmount" : _props$lazyBehavi...
[ "constructor() {\n super();\n\n /**\n * List of tab names\n * @protected\n * @type {Array<string>}\n */\n this.tabNames = [];\n\n /**\n * List of tab layers\n * @protected\n * @type {Array<Layer>}\n */\n this.tabLayer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
action(s) will be done when timer tikking
onTik(){ console.log('timer tikking') }
[ "function timerExec () {\n console.warn('timer start...');\n $this.data('cnt', 0);\n clearTimer();\n }", "start() {\n\t\t// use this to give the functions the parameter of this tamagotchi\n\t\thungerTimer(this);\n\t\tsickTimer(this);\n\t\tyawnTimer(this);\n\t}", "function doTimer() {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts sidetree's anchor file hashes from a list of Bitcoin transactions
function extractAnchorFileHashes (transactions, prefix) { var hashes = []; for (var i = 0; i < transactions.length; i++) { var tx = transactions[i]; var outputs = tx.outputs; for (var j = 0; j < outputs.length; j++) { var script = outputs[j].script; if (!script || !script.isDataOut()) { ...
[ "function init(transactions) {\n return new Promise((resolve, reject) => {\n const hashes = [];\n // const currentPath = code === 1 ? \"transactionHistory\" : \"blocks\"; \n transactions.forEach(async transaction => {\n try {\n const content = JSON.stringify(transaction);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isHeading :: Object > Boolean
function isHeading(atrule) { return atrule.parent && atrule.parent.selector; }
[ "function isHeading(node) {\n return node.type === 'heading';\n}", "isHeader() {\n return this.hasType('h2') || this.hasType('h3') || this.hasType('h4');\n }", "function isHeading(node)\n{\n\tif (!node.tagName) return false;\n\tif (node.tagName.match(/^h|h\\d$/i))\n\t\treturn true;\n\telse\n\t\treturn fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts data from a contact and returns a Row element
createRow(contact) { let profile = contact.profile; let name = contact.firstName + ' ' + contact.lastName; let email = contact.email; let company = profile.company; let state = 'Not Applicable'; if (profile.hasOwnProperty('address')) { if (profile.address.hasOwnProperty('state')) { ...
[ "function getContactsAndTableBody() {\n tableBody = document.getElementById('tableBody');\n let contactName;\n let contactSurname;\n let contactPhone;\n for (let i = 0; i < tableBody.rows.length; i++) {\n\tcontactName = tableBody.rows[i].cells[0].innerHTML;\n\tcontactSurname = tableBody.rows[i].cells[1].innerH...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Object that can be used to configure the drag items and drop lists within a module or a component.
function DragDropConfig() {}
[ "initialize(options) {\n this._integrationIDs = options.integrationIDs;\n this._integrationsMap = options.integrationsMap;\n\n this.list = new Djblets.Config.List(\n {},\n {\n collection: new this.listItemsCollectionType(\n options.configs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sample reservoir update function
function update(t) { var p, idx; if (res.length < num) { res.push(t); } else { idx = ~~((cnt + 1) * Math.random()); if (idx < res.length && idx >= cap) { p = res[idx]; if (map[Object(__WEBPACK_IMPORTED_MODULE_0_vega_dataflow__["n" /* tupleid */])(p)]) out.rem.push(p); // e...
[ "function replaceRandomSample(sample, reservoir) {\r\n\t\t\t\t// Typically, the new sample replaces the \"evicted\" sample\r\n\t\t\t\t// but below we remove the evicted sample and push the\r\n\t\t\t\t// new value to ensure that reservoir is sorted in the\r\n\t\t\t\t// same order as the input data (ie. iterator or a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete the sales item
async delete(sales_item_id) { return db .query( `DELETE FROM sales_item WHERE sales_item_id = $1`, [sales_item_id] ) .then(Result.count); }
[ "function deleteOrderSales(item) {\n\n ordersRef.child(item.key).remove()\n .then(()=>updateDatabase())\n .then(()=>updateSalesDatabase())\n .then(()=>sendPushNotification(expoPushToken ,`${item.agent} had sold a T-shirt(s)` , \"Item SOLD\"))\n \n }", "function deleteSaleItem(itemId)\n\t{\n\t\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a new version for this Lambda If you want to deploy through CloudFormation and use aliases, you need to add a new version (with a new name) to your Lambda every time you want to deploy an update. An alias can then refer to the newly created Version. All versions should have distinct names, and you should not delete...
addVersion(name, codeSha256, description, provisionedExecutions, asyncInvokeConfig = {}) { return new lambda_version_1.Version(this, 'Version' + name, { lambda: this, codeSha256, description, provisionedConcurrentExecutions: provisionedExecutions, ...a...
[ "function addProductVersion() {\n var url = [refstackApiUrl, '/products/', ctrl.id,\n '/versions'].join('');\n ctrl.addVersionRequest = $http.post(url,\n {'version': ctrl.newProductVersion})\n .success(function (data) {\n ctrl.pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
income(leva), minimun wage, gpa income = 4.5 social scholarship = 35% of minimum wage scholarship of excellent results is a gpa of >= 5.5 amount of scholarship for excellent performance = student gpa 25 Print scholarship with bigger amount of money
function main(incomeLeva, studentGpa, minimumWage) { let socialScholarship = minimumWage * 0.35; let scholarshipExcellentPerformance = studentGpa * 25; if (studentGpa >= 5.5) { if (scholarshipExcellentPerformance >= socialScholarship) { console.log(`You get a scholarship for excell...
[ "function getSlabbedIncome(totalIncome){\n\t\n\tvar taxPayer = document.getElementsByName('partAGEN1.personalInfo.status')[0];\n\t//IN-I,HUF-H\n\tvar resStatus \t\t\t= document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0]; //RES , NRI \n\t\n\tvar age\t= calcAge();\n\t\n\tvar netTxblIncome \t\t= ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: (Union) Mount this module in a given document or shadow root. Can be called multiple times cheaply (the classes will only be added the first time it is called for a given root).
mount(root) { (root.styleModuleStyleSet || new StyleSet(root)).mount(this) }
[ "static mount(root, modules) {\n (root[SET] || new StyleSet(root)).mount(Array.isArray(modules) ? modules : [modules]);\n }", "static mount(root, modules) {\n (root[SET] || new StyleSet(root)).mount(Array.isArray(modules) ? modules : [modules]);\n }", "static mount(root, modules) {\n (root[SET]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true or false based on the presence of "aid" property "aid" is a number that will be null on subleases and not null on promotional properties
function isSublease(aid) { if (aid == null || aid == 0) { return true; }else { return false; } }
[ "get _isEstablishmentIdValid() {\n if (this._establishmentId && Number.isInteger(this._establishmentId) && this._establishmentId > 0) {\n return true;\n } else {\n return false;\n }\n }", "hasId(note) {\n return \"id\" in note && Number.isInteger(note.id)\n }", "function invalidFormat(op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3.Write a JavaScript function that generates all combinations of a string. i'm still working on this i just copied and paste from the web i'll create and upload by myself later.
function combinations(str) { var array1 = []; for (var x = 0, y=1; x < str1.length; x++,y++) { array1[x]=str1.substring(x, y); } var combi = []; var temp= ""; var slent = Math.pow(2, array1.length); for (var i = 0; i < slent ; i++) { temp= ""; for (var j=0;j<array1.length;j++) { if ((i & Ma...
[ "function combinations(str) {\n var fn = function(active, rest, a) {\n if(!active && !rest)\n return;\n if(!rest) {\n a.push(active);\n } else {\n fn(active + rest[0], rest.slice(1), a);\n fn(active, rest.slice(1), a);\n }\n return a;\n }\n return fn(\"\", str, []);\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate energy_matrix information for pixel x,y. Assumes x and y in range.
recalculate(x, y) { var energy_cell = {}; energy_cell.energy = this.energy(x, y); energy_cell.vminsum = Number.POSITIVE_INFINITY; // last row if (y >= this.height-1) { energy_cell.vminsum = energy_cell.energy; energy_cell.minx = 0; } else { ...
[ "function calculateHeat(datax , datay){\n\n // heatArray[datax][datay] = heatArray[datax][datay]+10;\n for (var i = datax-30; i < datax+30; i++) {\n for (var j = datay-30; j < datay+30; j++) {\n if(i<0||j<0){\n continue;\n }\n heatArray[i][j] = heatArray[i][j]+10;\n };\n };\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the user pot and its balance
function updateUserPot(change) { userPot += change; }
[ "function update_user_balance(cost){\r\n\ttake_coins = cost;\r\n\t\r\n\tnew_balance = my_coins - take_coins;\r\n\t\r\n\t$('.coins-amount').html(new_balance);\r\n\t\r\n\tmy_coins = new_balance;\r\n\t\r\n\trefresh_skin_list();\r\n\t\r\n}", "updateBalance() {\n this.balance -= this.totalBet;\n this.updateTotal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Begin update email user
async updateEmailUser(context, { userEmail }) { await firebase .auth() .currentUser.updateEmail(userEmail) .then(() => { context.commit("checkAuthState"); }); }
[ "function serviceUpdateUserEmail(req, resp) {\n\t\tlogger.info(\"<Service> UpdateUserEmail.\");\n\t\tvar userData = parseRequest(req, ['userId', 'email']);\n\t\t\n\t\twriteHeaders(resp);\n\t\tupdateUserEmail(userData.userId, userData.email, function(err, status) {\n\t\t\tif (err) error(2, resp);\n\t\t\telse resp.en...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the focus on an invalid input Processed on saving the dialog Only numerical values are checked An empty URL field disables the Save button and does not need to be checked
_setFocusOnInvalidInput() { var oData = this._oJSONModel.getData(); _aNumericInputFields.some(function(sFieldName) { if (oData[sFieldName].valueState === ValueState.Error) { var oElement = sap.ui.getCore().byId(oData[sFieldName].id); oElement.focus(); return true; } }, this); }
[ "function ew_FocusInvalidElement() {\t\n \tfor (var i=0; i<Page_Validators.length; i++) {\n\t\tif (!Page_Validators[i].isvalid) {\n\t\t\tvar elem = ew_GetElement(Page_Validators[i].controltovalidate);\n\t\t\tew_GotoPageByElement(elem);\n\t\t\tew_SetFocus(elem);\n\t\t\tbreak;\n\t\t}\n\t}\n}", "function markInvalid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Download url content in clipboard
static pasteDownload() { return __awaiter(this, void 0, void 0, function* () { const ctx_type = yield this.getClipboardContentType(); Logger_1.default.log("Clipboard Type:", ctx_type); switch (ctx_type) { case ClipboardType.Html: case Clipboard...
[ "function copy_url_to_clipboard(url) {\n $(url).select();\n document.execCommand(\"copy\");\n}", "copyUrl() {\n copyToClipboard(this.selectedRequest.url);\n }", "function copyToClipboard( text )\n{\n var input = document.getElementById( 'url' );\n input.value = text;\n input.focus();\n inp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: getTotal Args: numTotal, numLast Desc: Takes two numbers and returns the sum.
function getTotal(numTotal, numLast) { return numTotal + numLast; }
[ "function getTotal(num) {\n t += num;\n displayTotal(t);\n return;\n}", "function getTotal() {\n let args = Array.prototype.slice.call(arguments);\n\n if (args.length == 2) return args[0] + args[1];\n else if (args.length == 1) {\n return (num2) => {\n return args[0] + num2;\n };\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Symbolic hook is a helper function which builds concrete results and then, if condition() > true executes a symbolic helper specified by hook Both hook and condition are called with (context (SymbolicExecutor), f, base, args, result) A function which makes up the new function model is returned
function symbolicHook(f, condition, hook, concretize = true, featureDisabled = false) { return function(base, args) { let [result, thrown] = runMethod(f, base, args, concretize); Log.logMid(`Symbolic Testing ${f.name} with base ${ObjectHelper.asString(base)} and ${ObjectHelper.asString(args)} and initial resu...
[ "function symbolicHook(condition, hook, concretize = true, featureDisabled = false) {\n return function(f, base, args, result) {\n\n let thrown = undefined;\n\n //Defer throw until after hook has run\n try {\n const c_base = concretize ? state.getConcrete(base)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this updates the current time and pushes it to the globalCurrentTime array so that it can be used by the checkTime function
function updateCurrentTime () { globalCurrentTime = []; var date = new Date(); var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var ampm = "AM"; if (mon...
[ "function updateCurrentTime() {\n\tdelete garbageTime;\n\tgarbageTime = new Date(); // what we need only for a split second\n\tCURRENT_TIME = Math.floor(garbageTime.getTime()/1000); // what we really want\n}", "function updateCurrentTime()\n{\n currentTime = new Date();\n}", "function updateTime() { currentD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is necessary because the SQL query that provides the data for this resolver is a join across several tables with nonunique column names. In the query, we alias the column names to make them unique. This function creates a copy of the results, replacing keys in the fields map with the original column name, so the r...
function mapQueryFieldsToResolverFields(queryResult, fieldsMap) { const data = _.mapKeys(queryResult, (value, key) => { const newKey = fieldsMap[key]; if (newKey) { return newKey; } return key; }); return data; }
[ "static async rewriteSelect(query, logicalName) {\n if (query.select) {\n const entityAttributes = await this.getEntityAttributes(logicalName),\n clone = query.select.slice();\n for (const attribute of clone) {\n const entityAttribute = entityAttributes[att...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes in score combination and unused array; determines whether combination exists in unused array
function containsAll(combination, unused) { // l is defined up front for speed var l = combination.length; // stores unused dice var un = []; // make a copy of unused array, to avoid changing it for (var i = 0; i < unused.length; i++) { un.push(unused[i]); } // this array stores used dice var used = []...
[ "function isInsufficientMaterial() {\n var insufficientCombinations = [\"BKk\", \"Kbk\", \"KNk\", \"Kkn\", \"Kk\"];\n \n \n var materialCombination = \"\";\n var pieceSet = [];\n boardArray.forEach(function(row) { row.forEach(function(item) { if(item != \" \") { pieceSet.push(item) }})});\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Position the QR Code relative to the button
positionQrCode() { const { element, popover, options } = this; const { position } = options; // read position from elements const elementRect = relativeRect(element); const elementCenter = elementRect.left + elementRect.width / 2; // init offsets const marginLeft = 15; const left = ...
[ "showQrCode() {\n const {\n canvas,\n action,\n actionText,\n closeText,\n parent,\n qrCodeGenerated,\n address\n } = this;\n\n if (qrCodeGenerated) {\n parent.classList.toggle(NavQrButton.HAS_QR_CLASS);\n this.positionQrCode();\n return;\n }\n\n QRCo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcionalidad de modal, mostrar cuando es la prima vez, despues guardaren localstorage para no mostrar
function mostrarModal(){ const noMostrarModal = JSON.parse( localStorage.getItem("noMostrarModal") ) if( !noMostrarModal ){ // bootstrap dice, mandar mensaje en modal $('#modalOferta').modal() } // sino lo quiere no volver a mostrarlo $('#btnNoRegistrar').click( (event)=>{ localStorage.set...
[ "function ocultarModal() {\n //mostrar botones de guardadado\n //document.getElementById('ConvertPDF').style.display = 'inline';\n //document.getElementById('guardar').style.display = 'inline';\n\n // document.getElementById('Formulario').style.display = 'inline';\n document.getElementById('MenuFecha'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets both current map and the current layer based on that map
setCurrentMap(currentMap) { this.currentMap = currentMap; if (this.currentMap == this.houseMap) { this.currentLayer = this.houseLayer; } if (this.currentMap == this.townMap) { this.currentLayer = this.townLayer; } if (this.currentMap == this.forestMap) { this.currentLayer = this.forestLayer; } ...
[ "function updateMap() {\n\t\t\tid = trail_select.value;\n\t\t\tconsole.log(id);\n\t\t\tvar newlayer = layer.getLayer(id);\n\t\t\tnewlayer.removeFrom(map);\n\t\t\tnewlayer.setStyle({\n\t\t\t\t\tweight: 5,\n\t\t\t\t\tcolor: '#00ff00',\n\t\t\t\t\topacity: 1.0\n\t\t\t});\n\t\t\tnewlayer.addTo(map)\n\t\t\tvar prevlayer ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
systeme gravitation du jeu
function gravitation(){ if(checkOverlap(joueur, glissade) || checkOverlap(joueur, glissade2)){ console.log("oui y a me pousse"); J1.velocity_base_x = 1000; J2.velocity_base_x = 1000; } else{ J1.velocity_base_x = 0; J2.velocity_base_x = 0; } }
[ "gravity() {\n // maximum gravitational pull\n this.grav = this.g * this.mass;\n // gravitational acceleration\n // this.gravA = map\n\n }", "grav(satellite) {\n // This needs to be lighting fast\n return (GAMMA_GRAV_CONST * this.mass) *\n Math.pow(this.x - ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the config setting with name. If the setting is not found returns the default value provided.
get(name, default_value) { let return_value = null; try { return_value = this._config.get(name); } catch (err) { return_value = default_value; } if (return_value === null || return_value === undefined) { return_value = default_value; } return return_value; }
[ "function get(name) {\n const value = config.get(name)\n console.assert(value != null && value != undefined, \"Missing config param \" + name)\n return value\n}", "function getConfigurationValue(config, settingPath, defaultValue) {\n function accessSetting(config, path) {\n var current = config;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setup the canvas when the component mounts
componenDidMount () { this.setupCanvas() }
[ "async initCanvas () {\n try {\n this.canvas.height = DEVICE_WIDTH * 0.95;\n this.canvas.width = DEVICE_WIDTH * 0.95;\n this.ctx = await this.canvas.getContext('2d');\n\n } catch (err) {\n console.error(err);\n }\n \n }", "init() {\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads all transactions and sets them to transactions
function loadTransactions() { transaction.getTransactions() .then(res =>{ console.log("TEST" + res.data); setTransactions(res.data)} ) .catch(err => console.log(err)); }
[ "function loadTransactions() {\n transactions.forEach(createTransaction);\n updateValues();\n }", "async function loadTransactions(){\n await getTransacitons();\n }", "function loadTransactions() {\n var transactions = storage.get('transactions')\n if (!transactions) {\n tran...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configure the given analytics handler if one hasn't already been configured.
__configureAnalyticsHandler (handler) { const handlerId = handler.getHandlerId(); // Doesn't make sense to allow more than one analytics handler to be configured. if (this.analytics[handlerId]) { throw new Error(`You have already configured the "${handlerId}" analytics handler.`); } this.analytics[handl...
[ "async configure (handler) {\n\n\t\tif (!(handler instanceof Handler)) { throw new Error(`You can only configure handler objects.`); }\n\n\t\tconst handlerType = handler.getType();\n\n\t\tswitch (handlerType) {\n\t\t\tcase `adapter`: await this.__configureAdapterHandler(handler); break;\n\t\t\tcase `analytics`: awa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detects class members from array literal
function detect_class_members_from_array(cls, ast) { cls["members"] = []; return _.each(ast["elements"], function(el) { detect_method_or_property(cls, key_value(el), el, el); }); }
[ "function detect_class_members_from_object(cls, ast) {\n cls[\"members\"] = []\n return each_pair_in_object_expression(ast, function(key, value, pair) {\n detect_method_or_property(cls, key, value, pair);\n });\n}", "function transformClassMembers(node){var members=[];var constructor=ts.getFirstConstructorW...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
override default minimum width and height in em. If your app is 16:9 you might use responsivem(160,90); and your main div should be 160em by 90em
function responsivem(xem,yem){ resizeemx=xem;resizeemy=yem;$(window).resize(); }
[ "function sizeCM()\n {\n var height = $window.height() - $el.editor.position().top;\n ui.cm.setSize(null, (height < 400 ? 400 : height) + \"px\");\n }", "function setSizes(mgn, vewr, min){\n\t let avlW = window.innerWidth * mgn;\n\t let avlH = window.innerHeight * mgn; \n \n\t let tmpV=avlW*v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tracks the number of categories loaded. It's necessary to wait until all of them are shown to make the elements of the list draggable, and enable the filterinput element
function restaurantsLoadedCallback(){ categoriesLoaded++; if(categoriesLoaded==configuration.categories.length){ //First, we change the class of the disabled anchor images to 'draggable-anchor' Y.all('.draggable-anchor-disabled').each(function (node) { no...
[ "function populateCategoryCountList() {\n\n //reinitialize the array to empty\n categoryCountList = [];\n\n //loop through all categories and use ipc synchronous command to \n //get the count for the current category\n for (i = 0; i < categoryList.length; i++) {\n var newCatCount = ipc.sendSyn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }