query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Safely checks if the number is NaN.
function safeIsNaN(value) { if (NumberAsAny.IsNaN) { return NumberAsAny.IsNaN(value); } else { return typeof value === 'number' && isNaN(value); } }
[ "function number (thing) {\n return typeof thing === 'number' && isNaN(thing) === false;\n }", "function findNaN(number) {\n\treturn number.findIndex(x => isNaN(x));\n}", "function isNaN(x)\n\t {\n\t \treturn x !== x;\n\t }", "function ISERR(value) {\n return value !== error$2.na && value.construct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the element with the largest attack on the opponent's side where the parameter 'largestValue' determines the value of n when nth value is returned
function findMaxOpponentAttack(largestValue) { const opponentCards = document.querySelectorAll('.computer-cardinplay') const numOfOpponentCards = computerCardSlot2.childElementCount; const alliedCards = document.querySelectorAll('player-cardinplay') const numOfAlliedCards = playerCardSlot.childElementCount; l...
[ "function findMaxPlayerAttack(largestValue) {\n const opponentCards = document.querySelectorAll('.computer-cardinplay')\n const numOfOpponentCards = computerCardSlot2.childElementCount;\n const alliedCards = document.querySelectorAll('.player-cardinplay')\n const numOfAlliedCards = playerCardSlot.childElementCo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback function for the message loop service that determines the usage of the past minute and sends it with the time and device status to the IoT Hub.
function messageLoop() { var timeNow = new Date(); var year = timeNow.getFullYear(); var month = timeNow.getMonth() + 1; var day = timeNow.getDate(); var hour = timeNow.getHours(); var minute = timeNow.getMinutes(); var status = deviceState ? "On" : "Off"; var usage = deviceState ? usageRating*(0.9...
[ "async function periodicRefresh(){\n try {\n tsLogger('Refreshing monitor data, monitor data, and missed events...');\n\n //Get daily usage data\n let today = new Date();\n let todayMidnight = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);\n dailyUsa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::S3::Bucket.Transition` resource
function cfnBucketTransitionPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnBucket_TransitionPropertyValidator(properties).assertSuccess(); return { StorageClass: cdk.stringToCloudFormation(properties.storageClass), TransitionDate...
[ "function cfnStorageLensS3BucketDestinationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStorageLens_S3BucketDestinationPropertyValidator(properties).assertSuccess();\n return {\n AccountId: cdk.stringToCloudFormation(properties.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to remove a payment input field
function rmInputField() { if ($(".paymentInput").length > 1) { $(".paymentInput") .last() .remove(); } }
[ "function removeFormField() \n{\n\tid = parseInt(jQuery(\"#cont\").val());\n\tif(id >= 0){\n\t\tid = id - 1;\n\t\t\n\t\t/* pega valor inicial pelas ids dos elementos e guarda em vaiaveis */\n\t\tvar noFaixaEtaria = \"noFaixaEtaria\"+id;\n\t\tvar nuValor\t\t = \"nuValor\"+id;\n\t\t\n\t\tjQuery(\"#\"+noFaixaEtaria)....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DataView(buffer, byteOffset=0, byteLength=undefined) WebIDL: Constructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength)
function DataView(buffer, byteOffset, byteLength) { if (!(buffer instanceof ArrayBuffer || Class(buffer) === 'ArrayBuffer')) throw TypeError(); byteOffset = ToUint32(byteOffset); if (byteOffset > buffer.byteLength) throw RangeError('byteOffset out of range'); if (byteLength === undefined...
[ "function BufferView(buffer, offset, length, byteorder) {\n if (arguments.length < 2 || arguments.length > 4) \n fail(\"Wrong number of argments\");\n if (arguments.length === 2) {\n byteorder = offset;\n offset = 0;\n length = buffer.byteLength;\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new benchmark object in the database. Requires the userAgent provided by the client's browser, and the completion callback.
createBenchmark(userAgent, callback) { // interpret the user agent string sent by client for benchmark metadata. const url = "http://useragentapi.com/api/v4/json/" + process.env.USERAGENT_APIKEY + "/" + encodeURIComponent(userAgent); http.get(url, (res) => { let rawData ...
[ "function BenchmarkSuite(name, reference, benchmarks) {\r\n this.name = name;\r\n this.reference = reference;\r\n this.benchmarks = benchmarks;\r\n BenchmarkSuite.suites.push(this);\r\n}", "function Benchmark() {\n\t\tEventEmitter.call( this );\n\t\treturn this;\n\t}", "function Benchmark(username,a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Api error model factory
function apiError() { return ApiError; /** * Api error model * @param {number} statusCode * @param {string} message */ function ApiError(statusCode, message) { Object.defineProperty(this, 'StatusCode', { value: statusCode, ...
[ "function createSimpleModelError(instance, propertyId, messageFormat, argList) {\r\n\tvar modelMessage = newModelMessage(IStatus.ERROR, \r\n\t\t\tformatString(messageFormat, argList), \r\n\t\t\tinstance, propertyId, null);\r\n\treturn modelMessage;\r\n}", "function ApiHubErr(errIdx, struct, msgInfo, extApiHttpSta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Comparator between two mappings where the generated positions are compared. Optionally pass in `true` as `onlyCompareGenerated` to consider two mappings with the same generated line and column, but different source/name/original line and column the same. Useful when searching for a mapping with a stubbed out mapping.
function compareByGeneratedPositions(mappingA, mappingB, onlyCompareGenerated) { var cmp; cmp = mappingA.generatedLine - mappingB.generatedLine; if (cmp) { return cmp; } cmp = mappingA.generatedColumn - mappingB.generatedColumn; if (cmp || onlyCompareGenerated) { return cmp; } ...
[ "function compileMappings(oldMappings) {\n\t var mappings = oldMappings.slice(0);\n\t\n\t mappings.sort(function(map1, map2) {\n\t if (!map1.attribute) return 1;\n\t if (!map2.attribute) return -1;\n\t\n\t if (map1.attribute !== map2.attribute) {\n\t return map1.attribute < map2.attribut...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UserName Replace Credit to dev.wikia.com
function UserNameReplace() { if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return; $("span.insertusername").html(wgUserName); }
[ "function resolveUsername(username){\n if (username === \"\"){\n return \"\";\n } else {\n return \" by \" + username;\n }\n}", "function getNickName() {\r\n \r\n return $(\"#loggedin\").text().substring(9);\r\n \r\n \r\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given segment intersects with this segment.
intersects(segment) { return this.intersectsLine(segment) && segment.intersectsLine(this) // I suppose since the math is so elegant two line segments that // share a point intersect. But that's not terribly useful for // this algorithm since the rays are created directly to an endpoint ...
[ "function segmentIntersecte(a, b, c, d) {\n var d1 = determinant(b.x - a.x, b.y - a.y, c.x - a.x, c.y - a.y);\n var d2 = determinant(b.x - a.x, b.y - a.y, d.x - a.x, d.y - a.y);\n if (d1 > 0 && d2 > 0) return false;\n if (d1 < 0 && d2 < 0) return false;\n d1 = determinant(d.x - c.x, d.y - c.y, a.x - ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the known topics.
function updateTopics(topics) { topics.forEach(function(d) { d.r = r(d.count); d.cr = Math.max(minRadius, d.r); d.k = fraction(d.parties[0].count, d.parties[1].count); if (isNaN(d.k)) d.k = .5; if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random(); d.bias = .5 - Math.max(.1, Math.min(.9, d.k...
[ "function __refreshUserTopics() {\n VD_API\n .GetUsers(0, _filter.date.start, _filter.date.end)\n .done((users) => {\n users.forEach(__displayUserTopicsCounts);\n })\n .fail((response) => {\n console.error(`Failed to refresh user topic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler that causes a blur on the target if the input has multiple CSS properties as the value.
function blurOnMultipleProperties(e) { setTimeout(() => { let props = parseDeclarations(e.target.value); if (props.length > 1) { e.target.blur(); } }, 0); }
[ "onBlur(event) {\n let payload = Immutable.fromJS(this.props).set('value', this.state.value);\n Dispatcher.dispatch(FIELD_BLUR, payload.toJSON());\n }", "handleBlur() {\n this._focussed = false;\n }", "function blurEditor() {\n if (__entryFocused()) {\n Log.debug(\"dis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init This function creates voters and gets the application ready for use by creating an election from the data files in the data directory.
async init(ctx) { // Initialize election let election = await this.getOrGenerateElection(ctx); await this.generateRegistrars(ctx); let voters = []; let votableItems = await this.generateVotableItems(ctx); //generate ballots for all voters for (let i = 0; i < voters.length; i++) { if (...
[ "async createVoter(ctx, args) {\n\n args = JSON.parse(args);\n\n //create a new voter\n let newVoter = await new Voter(ctx, args.voterId, args.registrarId, args.firstName, args.lastName);\n\n //update state with new voter\n await ctx.stub.putState(newVoter.voterId, Buffer.from(JSON.stringify(newVoter...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End trip and fare calculation function
async onPressEndTrip(item) { this.setState({loadingModal:true}) let location = await Location.getCurrentPositionAsync({}); if(location) { var diff =((this.state.startTime) - (new Date().getTime())) / 1000; diff /= (60 * 1); var totalTimeTaken = Math.abs(Math....
[ "function calculatesFarePrice(startBlock, endBlock){\n totalFeet = distanceTravelledInFeet(startBlock,endBlock)\n // console.log(totalFeet)\n if (totalFeet<400) { return 0}\n else if (totalFeet <= 2000) {return (totalFeet * .02 ) }\n else if (totalFeet <= 2500) {return (25)}\n else { return \"cannot tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Randomizes the ORIGINAL_COLORS array.
function randomizeColors() { for (let i = ORIGINAL_COLORS.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * i); const temp = ORIGINAL_COLORS[i]; ORIGINAL_COLORS[i] = ORIGINAL_COLORS[j]; ORIGINAL_COLORS[j] = temp; } }
[ "function color() {\n\tfor (var i = 0; i < num; i++) {\n\t\tcoloring.push(randomize());\n\t}\n}", "function randomColorGenerator() {\n\t\treturn Math.floor(Math.random() * backgroundColors.length);\n}", "function selectRandomColors() {\n selectedColorsList.innerHTML = '';\n selectedColors = [];\n\n var noDup...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
watch for removal of disabled to register step
disabledWatcher() { this.registerStepperItem(); }
[ "handleRunStopped () {\n const priv = privs.get(this)\n if (priv.state === State.Done) privm.wrapup.call(this)\n }", "onDisabled() {\n this.updateInvalid();\n }", "setStopped() {\n this.condition = 'stopped';\n }", "function resetCheckedStepState (){\n stepInputs....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function checks the values of all 4 gems, and of targetScore. If all gems are Even, AND targetScore is Odd (is NOT Even)...
function userCanWin(gem1,gem2,gem3,gem4,targetScore) { if (isEven(gem1) && isEven(gem2) && isEven(gem3) && !isEven(targetScore) && isEven(gem4)) { // then we take the value of gem4 and subtract 1 to make it Odd. return gem4 - 1; } // If the edg...
[ "isScoreComplete(){\n // if (this.dscore1 == null){\n // return false;\n // }else if (this.dscore2 ==null){\n // return false;\n // }else if (this.fscore1 == null){\n // return false;\n // }else if (this.fscore2 == null){\n // return false;\n // }else if (this.tscore1 == null){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cette fonction parcours le tableau "damier[]" et retourne le nombre de cases "vides" (contenant 'V') du tableau.
function NbCaseVide() { let nombreDeCaseVide = 0; // TODO: parcourir le tableau damier avec une boucle for for (let i = 0 ; i < damier.length ; i++){ // À chaque itération, si la valeur damier[i] est égale 'V': incrémenter nombreDeCaseVide de plus 1 if (damier[i] === 'V'){ nombre...
[ "function visualizarVidasEnPantalla() {\n if (pantalla === 2 || pantalla === 4 || pantalla === 6 || pantalla === 8 ) {\n personaje.mostrarVidas(imgCorazon);\n }\n}", "function declaracionArrayCTV(ele, mod, ambi) {\n var encontreError = false;\n //BUSCANDO VECTOR EN LOS AMBITOS SI NO ESTA SE REALIZA DECLARA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParseradd_modify_drop_column_clauses.
visitAdd_modify_drop_column_clauses(ctx) { return this.visitChildren(ctx); }
[ "visitDrop_column_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function _dropColumn(){\n self._visitingAlter = true;\n var table = self._queryNode.table;\n var result=[\n 'ALTER TABLE',\n self.visit(table.toNode())\n ];\n var columns='DROP COLUMN '+self.visit(alter.nodes[0]....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Asyncronously loads the given url to the given tab. Rteurns a promise that runs resolve after the tab has finished loading.
function goToUrl(tab, url) { browser.tabs.update(tab, { url }); return new Promise(resolve => { browser.tabs.onUpdated.addListener(function onUpdated(id, info) { if (id === tab && info.status === 'complete') { browser.tabs.onUpdated.removeListener(onUpdated); ...
[ "async function tabCompletion (tab) {\n function isComplete (tab) {\n return tab.status === 'complete' && tab.url !== 'about:blank'\n }\n if (!isComplete(tab)) {\n return new Promise((resolve, reject) => {\n const timer = setTimeout(\n function giveUp () {\n browser.tabs.onUpdated.remo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private functions for ParticleCurve / Modify the particle material's shaders so that the particle system can be rendered using its current configuration. At a minimum, the mesh and curve boxes need to be defined.
function setupShaders() { if (!this._mesh || !this._materialSrc || this._boxes.length < 2) { return; } var gl = this.client.renderer.context, chunksVert = shaderChunks.vert, chunksFrag = shaderChunks.frag, material = this._mesh.material, oldProgram = material.program, program = material.program...
[ "buildMaterials () {\n this._meshes.forEach((mesh) => {\n let material = mesh.material;\n\n let position = new THREE.PositionNode();\n let alpha = new THREE.FloatNode(1.0);\n let color = new THREE.ColorNode(0xEEEEEE);\n\n // Compute transformations\n material._positionVaryingNodes.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true of the prop is required, according to its type definition
function isRequiredPropType(path) { return (0, getMembers_1.default)(path).some(member => (!member.computed && member.path.node.name === 'isRequired') || (member.computed && member.path.node.value === 'isRequired')); }
[ "isRequired () {\n\t\tconst definition = this.definition;\n\t\treturn ('required' in definition) && definition.required === true;\n\t}", "function isPropValid()\n{\n\n}", "function isRequiredField(fldId) {\r\n var req;\r\n var reqDefined = true;\r\n //If the element is invisible then it must be not req...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Note: Bound the dosage amount to a value between 1 and 5
changeDosageAmount(event) { let transformedNumber = Number(event.target.value) || 1; if (transformedNumber > 5) { transformedNumber = 5; } if (transformedNumber < 1) { transformedNumber = 1; } this.setState({ dosageAmount: transformedNumber }); this.props.updateDosageInstructions(transformedNumber, ...
[ "function balance_gyros() {\n return;\n if (current_tab != \"Gyro\") {\n return;\n }\n for (i = 4; i < 10; i++) {\n var gyroObj = document.getElementById('sliderID.' + (i - 1));\n\n if ((gyroObj.value) > 6) {\n gyroObj.value = gyroObj.value...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the activeFilter index on state, then updates the attribute to show (this.props function)
updateItemColors(index, val){ console.log(index); this.setState({ activeFilter: index }) this.props.updateAttributeToShow(val) }
[ "function changeFilterActive(){\r\n \tctrl.currentFilter.active = !ctrl.currentFilter.active;\r\n \tapplyFilterChange();\r\n }", "function updateFilter()\r\n\t{\r\n\t\tvar activeCount = filterBox.find(\"input[type=checkbox]\").filter(\":checked\").length;\r\n\r\n\t\tif (activeCount == 0)\r\n\t\t{\r\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The estimated height this widget will have, to be used when / estimating the height of content that hasn't been drawn. May / return 1 to indicate you don't know. The default implementation / returns 1.
get estimatedHeight() { return -1; }
[ "get estimatedHeight() {\n return -1\n }", "_calculateHeight() {\n\t\tif (this.options.height) {\n\t\t\treturn this.jumper.evaluate(this.options.height, { '%': this.jumper.getAvailableHeight() });\n\t\t}\n\n\t\treturn this.naturalHeight() + (this.hasScrollBarX() ? 1 : 0);\n\t}", "get height() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserlob_compression_clause.
visitLob_compression_clause(ctx) { return this.visitChildren(ctx); }
[ "visitModify_lob_storage_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitLob_storage_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitKey_compression(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function receives an object, whose values will all be numbers, and returns the sum of all these numbers.
function sum(object) { let valArray = Object.values(object); let total = 0; valArray.forEach(function (item) { if (typeof (item) === 'number') { total = total + item; } }); return total; }
[ "function sumSalaries(salaries) {\n \n let sum = 0\n for (let value of Object.values(salaries)) {\n sum += value;\n }\n return sum;\n}", "function sumOfNumbers(arr) {\n function sum(total, num) {\n return total + num;\n }\n return arr.reduce(sum);\n}", "function incrementValues(obj) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints a hint about valid latitude values
function printLatitudeHint () { console.log(' "lat" is the north latitude(north is positive, south is negative) in degrees') console.log(' latitudes are between -90 and 90 degrees') console.log(' A typical "lat" looks like: "lat": 40.596') }
[ "function printLongitudeHint () {\n console.log(' \"long\" is the longitude west(west is negative, east is positive) in degrees')\n console.log(' longitudes are between -180 and 180 degrees')\n console.log(' A typical \"long\" looks like: \"long\": -90.596')\n}", "function printOpenWeatherMapsLocationHint (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lookup table for btoa(), which converts a sixbit number into the corresponding ASCII character.
function btoaLookup(idx) { if (idx < 26) { return String.fromCharCode(idx + "A".charCodeAt(0)); } if (idx < 52) { return String.fromCharCode(idx - 26 + "a".charCodeAt(0)); } if (idx < 62) { return String.fromCharCode(idx - 52 + "0".charCodeAt(0)); } if (idx === 62) { return "+"; } if (...
[ "function encode_digit(d, flag) {\n return d + 22 + 75 * (d < 26) - ((flag != 0) << 5);\n // 0..25 map to ASCII a..z or A..Z \n // 26..35 map to ASCII 0..9 \n }", "static bytes26(v) { return b(v, 26); }", "hashFuncUnicodeKeyType(key){\n let hashValue = 0;\n const k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A parser for a regular expression `exp`. The result of the parse, if successful, is mapped using the optional `mapper` function provided.
function re(state, exp, mapper) { var m = rest(state).match(exp), s; if (m) { s = take(state, m[0].length); return mapper ? mapper(s) : s; } else { return ''; } }
[ "function defParser(node_type, parser, mapper){\n\treturn {\n\t\ttype : node_type,\n\t\tparser : parser = parser.mark().map(x => {\n\t\t\tx.value = mapper(x.value);\n\t\t\treturn createAstNode(node_type, x);\n\t\t}),\n\t};\n}", "function parseExpression() {\n let expr;\n //lookahead = lex();\n // if (!lookah...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get some Information from a POI with the Id as paratmeter
static async getPOI(id, getTokenSilently, loginWithPopup) { try { let token = await getTokenSilently(); let response = await fetch( `${process.env.REACT_APP_SERVER_URL}/poi/` + id, { method: "GET", headers: { Accept: "application/json", Authori...
[ "async getIdsForSheet(id) { //x\n try {\n let result = await get(\"QuestionSheet/GetQuestionIdsForSheet\", id);\n return result;\n }\n catch (err) {\n this.handleError(err);\n }\n }", "function extractPositionFromId(id,type) {\n \n var d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to delete a marker given the id
function deleteMarker(id){ markersDictionary[id].setMap(null); markersDictionary[id] = undefined; delete markersDictionary[id]; }
[ "function remove_marker(id) {\n\n\t console.log('removing marker', id);\n\n\t // add marker\n\t delete(troops[id]);\n\t delete(paths[id]);\n\n\t\tgoogle.maps.event.addListener(troops[id], 'click', function() {\n\t\t\tconsole.log('removed marker', id);\n\t\t});\n\n\t}", "removeObsFromDatabase(marker) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function wraps mapToProps in a proxy function which does several things: Detects whether the mapToProps function being called depends on props, which is used by selectorFactory to decide if it should reinvoke on props changes. On first call, handles mapToProps if returns another function, and treats that new funct...
function wrapMapToPropsFunc(mapToProps, methodName) { return function initProxySelector(dispatch, _ref) { var displayName = _ref.displayName; var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) { return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps...
[ "function selectorFactory(dispatch, mapStateToProps, mapDispatchToProps) {\n //cache the DIRECT INPUT for the selector\n //the store state\n let state\n //the container's own props\n let ownProps\n\n //cache the itermediate results from mapping functions\n //the derived props from the state\n let stateProps...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close individual post closeReasonId: 'NeedMoreFocus', 'SiteSpecific', 'NeedsDetailsOrClarity', 'OpinionBased', 'Duplicate' if closeReasonId is 'SiteSpecific', offtopicReasonId : 11norepro, 13nomcve, 16toolrec, 3custom
function closeQuestionAsOfftopic(pid, closeReasonId = 'SiteSpecific', offtopicReasonId = 3, offTopicOtherText = 'I’m voting to close this question because ', duplicateOfQuestionId = null) { return new Promise(function(resolve, reject) { if(!isSO) { reject(); return; } if(typeof pid === '...
[ "function closePopup(popupId)\n{\n\tvar popupTarget = 0; \n\tif ( popupId == 1 ) { popupTarget = primaryTermsPopup; \t\t}\n\tif ( popupId == 2 ) { popupTarget = secondaryTermsPopup; \t}\n\t\n\tif ( popupTarget != 0 )\n\t{\n\t\t//Restore all possibly hidden brs.\n\t\tvar brsToReveal = document.getElementById(popupTa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chapter 101 RopeGroup Knot reponsise when chaste
function C101_KinbakuClub_RopeGroup_HelplessKnot() { if (Common_PlayerChaste) OverridenIntroText = GetText("ChasteKnot"); if (C101_KinbakuClub_RopeGroup_CurrentStage == 830) C101_KinbakuClub_RopeGroup_WaitingForMistress(); else C101_KinbakuClub_RopeGroup_HelplessTime(); }
[ "function C101_KinbakuClub_RopeGroup_HelplessStruggle() {\n\tif (Common_PlayerChaste) OverridenIntroText = GetText(\"ChasteStruggle\");\n\tif (C101_KinbakuClub_RopeGroup_CurrentStage == 830) C101_KinbakuClub_RopeGroup_WaitingForMistress();\n\telse C101_KinbakuClub_RopeGroup_HelplessTime();\n}", "function C101_Kin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function checks the latency of all servers and sets the server to the server with the lowest latency once it is finished.
function getLatency(ret, count) { var tmpUrl=""; if(count >= 0){ var tmplatency=ret[0]/2; tmpUrl=ret[1].replace("images/small.bmp", ""); $latencyArray[count]=tmplatency; console.log("Evaluate_Server "+tmpUrl+ " Mode "+$serverMode + " Latency "+ tmplatency); //console.log("Server: "+tmpUrl+", lat...
[ "function syncWithKnownMasterServer(server){\r\n var VALIDATION = '\\\\gamename\\\\' + server.game +'\\\\location\\\\0\\\\validate\\\\OPNSRCUP\\\\final\\\\'; // Validation answer\r\n var QUERYREQST = '\\\\list\\\\gamename\\\\' + server.game + '\\\\final\\\\' // Query for games list\r\n\r\n var conn = new t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if the socket is disconnected (e.g. user closed browser tab), we manually produce and handle a "leaveRoom" command that will mark the user as "disconnected".
async function onDisconnect(socket) { // socket.rooms is at this moment already emptied (by socket.IO) const mapping = registry.getMapping(socket.id); if (!mapping) { // this happens if user is on landing page, socket was opened, then user leaves - socket disconnects, user never joined a room. Perfec...
[ "function end_game(){\n\tsocket.emit(\"leave_game\");\n}", "function leave () {\n var session = USERS.get(socket.id)\n\n if (session) {\n USERS.del(socket.id)\n\n debug('leave session', session.id, socket.id)\n\n session.leave(socket)\n }\n }", "leavePlayerChannel() {\n this.send...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the distance between ticks on the Y axis:
yTickDelta() { return 1; }
[ "function calculateYScaleAndTranslation() {\n yScale = -graphHeight / (signal.getMaxValue() - signal.getMinValue());\n yTranslation = -yScale * signal.getMaxValue() + topMargin;\n }", "getDeltaY() {\n return (this.getPageY() - ((this.__prevState.pageY !== undefined)\n ? this.__prevS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
util.RegExp.from(string[, flags]) > RegExp string (String): Regular expression pattern. flags (String): Optional flags. Creates a regular expression based on the given `string`. The `string` is escaped (see [[util.RegExp.escape]]) before being parsed. util.RegExp.escape("\\s"); > /\\s/ util.RegExp.escape("\\s", "gm"); ...
function regexpFrom(string, flags) { return new RegExp(core.escapeRegExp(string), flags); }
[ "function getRegExp(pattern, flags) {\n var safeFlags = angular.isString(flags) ? flags : \"\";\n return (angular.isString(pattern) && pattern.length > 0) ? new RegExp(pattern, safeFlags) : null;\n }", "function addFlags(regexp, flags) {\n\n var reg = core.interpretRegExp(regex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accessibility id for Race Overview Tab
get raceOverviewTab() {return browser.element("~Race Overview");}
[ "get X_Axis_raceOverviewTab(){return browser.getLocation('~Race Overview', 'x');}", "clickRaceOverviewTab(){\n this.raceOverviewTab.waitForExist();\n this.raceOverviewTab.click();\n }", "get horseProfile_Form_RaceNo() {return browser.element(\"//android.view.ViewGroup[3]/android.view.ViewGr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hear we call the function to get the output bcz we console inside in the function hello(); calling the function hello; refering a function there we are hard coded my name but we r leave to enter name r give a name
function hello(name){ console.log("hello its my name",name); }
[ "function helloName (name) {\n return 'Hello, ' + name + '!'\n}", "function greeter (name) {\n return \"hoi \" + name + \"!\";\n}", "function greeting(name){\n return \"Welcome \" + name\n}", "function greet(name) {\n return \"Hello \" + name + \"!\";\n}", "function myName(name) {\n console.log(\"H...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The following function is used to identify the card type.
function getCardType ( num ) { var cctype = ""; // Check for Visa if ( num.substring ( 0, 1 ) == '4' ) { if ( ( num.length == '13' ) || ( num.length == '16' ) ) return "visa"; } // Check for Mastercard if ( ( num.substring ( 0, 2 ) >= '51') && ( num.substring ( 0, 2 ) <= '55' ) ) ...
[ "function checkType(cardnum){\n type = null;\n if(cardnum[0]==\"4\"){\n type = \"Visa\";\n }\n if(cardnum[0]==\"3\"){\n if(cardnum[1] == \"4\"){\n type = \"Amex\";\n }\n if(cardnum[1]== \"7\"){\n type = \"Amex\"\n }\n }\n if (cardnum[0] == \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Should friction be used for any contact with the surface?
set useFriction(value) {}
[ "applyFriction(){\n\t\tthis.vel.x *= ((0.8 - 1) * dt) + 1;\n\t}", "set useContactForce(value) {}", "function b2FrictionJoint(def)\r\n{\r\n\tthis.parent.call(this, def);\r\n\r\n\tthis.m_localAnchorA = def.localAnchorA.Clone();\r\n\tthis.m_localAnchorB = def.localAnchorB.Clone();\r\n\r\n\tthis.m_linearImpulse = n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sample an item from `source` every time an item appears in `triggers` source where `source` and `triggers` are both accumulatables. For example, sampling mouse move events that coencide with click events looks like this: sample(on(el, 'mousemove'), on(el, 'click')) Probably only useful for sources where items appear ov...
function sample(source, triggers, assemble) { return accumulatable(function accumulateSamples(next, initial) { // Assemble is a function that will be called with sample and trigger item. // You may specify a sample function. If you don't it will fall back to `id` // which will return the value of the samp...
[ "sampleAction(array) {\n this.action(sample(array.map(e => actions[e])))\n }", "function emitAndSample() {\n return Rx.Observable.interval(100) // emit items every 100 ms\n .sample(500) // only emit one every 500 ms\n .take(5); ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setup orthographical projection camera
function setupCameraOrth() { var viewSize = POS_OrthoCAM.viewSize; var rect = container.getBoundingClientRect(); var ratio = POS_OrthoCAM.ratio*container.clientWidth / container.clientHeight; cameraOrth = new THREE.OrthographicCamera( -ratio*viewSize/2, ratio*viewSize/2, viewSize/2, -viewSize/2, NEAR, FAR); cam...
[ "setupCamera() {\r\n \r\n var camera = new Camera();\r\n camera.setPerspective(FOV, this.vWidth/this.vHeight, NEAR, FAR);\r\n //camera.setOrthogonal(-30, 30, -30, 30, NEAR, FAR);\r\n camera.setView();\r\n\r\n return camera;\r\n }", "function updateOrtho() {\n\t\tvar ha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans the `available_farms` folder, and if a symbolic link doesn't already exist in the `enabled_farms` folder, one is created.
createFarmSymLinks() { let enabledFarmsPath = path.join( commons_constants.TARGET_DISPATCHER_SRC_FOLDER, Constants.CONF_DISPATCHER_D, Constants.ENABLED_FARMS ); let conversionStep = this.createFarmSymLinksSummaryGenerator(); let files = glo...
[ "async function checkDescriptorDir() {\n const saveDir = `${__dirname}/descriptors`;\n if (!fs.existsSync(saveDir)){\n fs.mkdirSync(saveDir);\n RED.log.info(\"[Face-a-pi.js] - Created descriptors directory at \" + saveDir)\n }\n }", "_checkMounts() {\n focalStorage...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createMapMarker(placeData) reads Google Places search results to create map markers. placeData is the array of objects returned from textSearch results. When a marker is clicked, all infoWindows are closed and one appears.
function createMapMarker(placeData) { placeData.forEach(function(place) { // console.log(place); // The next lines save location data from the search result object to local variables var lat = place.geometry.location.lat(); // latitude from the place service var lon = place.geometry.location.lng();...
[ "function createMapMarker(placeData) {\n\n // The next lines save location data from the search result object to local variables\n var lat = placeData.geometry.location.lat(); // latitude from the place service\n var lon = placeData.geometry.location.lng(); // longitude from the place service...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Later resolvePath is called to get back the currentPathDictionary and raw path, and expect to return the prestored storageObject
resolvePath(currentPathDictionary, resolvedPath) { return storageObject; }
[ "storePath(currentVerbPathDictionary, dynamicPath, storageObject) {\n\t\treturn new PathDictionary();\n\t}", "retrieveState(){\n if(this.storePath()){\n this.state = getLocal(this.storePath(), this.state)\n }\n }", "async resolvePath(x, y) {\n assert(typeof x === 'string');\n a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new Employee Node
function NewEmployeeNode(emp : Funcionario, slot : EmployeeList) { var employeeNode : EmployeeNode = new EmployeeNode(); employeeNode.employee = emp.Copy(); employeeNode.actionList = new ActionList(); employeeNode.secActionList = new ActionList(); employeeNode.espActionList = new ActionList(); slot.Add(employ...
[ "function createEmployee(employee) {\n\temployeeList.push(employee);\n\tupdateList();\n}", "create(req, res) {\n Employee.create(req.body)\n .then(function (newEmployee) {\n res.status(200).json(newEmployee);\n })\n .catch(function (error) {\n res.status(500).json(error);\n })...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a fucntion that: Find a book that needs to be stocked (less than 3 in inventory)
function stockFirst(item){ return item.inventory < 3 }
[ "function searchInventory(id, quantity) {\n var query = 'SELECT * FROM products';\n connection.query(query,\n function (err, res) {\n if (err) throw err;\n var itemId = parseInt(id);\n var quantityItem = parseInt(quantity);\n var pickedItem;\n for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the listener property.
get listener() { return this.#listener; }
[ "get isListening() {\n return this.listeners.length > 0;\n }", "function ListenerRule(props) {\n return __assign({ Type: 'AWS::ElasticLoadBalancingV2::ListenerRule' }, props);\n }", "function hasEventListener(type/*:String*/)/*:Boolean*/ {\n return this.listeners$bq6g[type] || this.capt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Synchronizes fill positions so that the outline is always visible on the A and B boxes, and the intersection area is synchronized.
function syncPositions() { // Make sure everything stays in bounds. function bound(outline) { var x_offset = outline.offset().left + outline.width() - (s_outline.offset().left + s_outline.width()); if (x_offset > 0) outline.css('left', (outline.position().left - x_offset) + 'px'); ...
[ "function clear() {\n svg1.call(brush1.clear())\n svg2.call(brush2.clear())\n }", "function checkIntersections(_collection) {\n for (let a = 0; a < _collection.length; a++) {\n for (let b = a + 1; b < _collection.length; b++) {\n let moleculeA = molecules[_collection[a]];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the given [target], and escapes it for literal use in a regexp. Largely copied from Google closure library function.
function escapeRegex(target) { return String(target).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').replace(/\x08/g, '\\x08'); }
[ "function escapeTemplateExp(src) {\n // eslint-disable-next-line\n return src.replace(/[-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, '\\\\$&');\n}", "function escapeSelector(sel) {\n return sel.replace(/[/$]/g, '\\\\$&');\n }", "function matchEndingStringPattern(string, target) {\n // This will find target onl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========= MEXQ_InputLevel ================ PR20210521
function MEXQ_InputLevel(el_input) { //console.log( "===== MEXQ_InputLevel ========= "); //console.log( "el_input.value", el_input.value, typeof el_input.value); mod_MEX_dict.lvlbase_pk = (Number(el_input.value)) ? Number(el_input.value) : null; mod_MEX_dict.lvl_abbrev = (el_input.opti...
[ "function MEXQ_InputQuestion(el_input){\n console.log(\"--- MEXQ_InputQuestion ---\")\n //console.log(\"el_input.id: \", el_input.id)\n // el_input.id = el_input.id: idMEXq_1_1\n //const q_number_str = (el_input.id) ? el_input.id[10] : null;\n const el_id_arr = el_input.id.split(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Type guard to ensure that the given manifest has a valid "private" field.
function hasValidPrivateField(manifest) { return manifest[ManifestFieldNames.Private] === true; }
[ "function hasValidVersionField(manifest) {\n return semver_utils_1.isValidSemver(manifest[ManifestFieldNames.Version]);\n}", "function validateMonorepoPackageManifest(manifest, manifestDirPath) {\n if (!hasValidWorkspacesField(manifest)) {\n throw new Error(`${getManifestErrorMessagePrefix(ManifestFi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prevent the main input from blurring when a menu item or the clear button is clicked. (226 & 310)
function preventInputBlur(e) { e.preventDefault(); }
[ "function option3Blur() {\n return;\n }", "_onInputFocusOut(e) {\n if (this.get('_show')) {\n e.stopPropagation();\n }\n }", "function removeTextInput() {\n $('.has-clear input[type=\"text\"]').on('input propertychange', function() {\n var $this = $(this);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function that calls through to the log method with the specified log level
function logLevelMethod(logLevel) { return function() { var args = [].slice.call(arguments); args.unshift(logLevel); return this.log.apply(this, args); }; }
[ "function buildLogLevelFunction(loadCommand, level) {\n /** Write to stdout for the LOG_LEVEL. */\n var loggingFunction = function () {\n var text = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n text[_i] = arguments[_i];\n }\n runConsoleCommand.apply(void 0, __...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
call the service function to change txt color and render
function onChangeTxtColor(color) { changeTxtColor(color) renderMeme() }
[ "setTextColor(color) { this.textColor = color }", "function changeColor(color) {\n gMeme.currText.color = color\n}", "function _editTextColor ( /*[Object] event*/ e ) {\n\t\tthis.nextElementSibling.style.borderColor = this.value;\n\t\tvar activeObject = cnv.getActiveObject();\n\t\tif ( this.value && activeOb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
has side effect by calling updateScoreWithModel upon response
updateScore() { this.serverComm.updateScore(this.userId, this); }
[ "function updateScore() {\n\n}", "set score(newScore) {\r\n score = newScore;\r\n _scoreChanged();\r\n }", "set score(val) {\n this._score = val;\n console.log('score updated');\n emitter.emit(G.SCORE_UPDATED);\n }", "function updateScore() {\n humanScoreSpan.innerHTML = humanScore;\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return torque cateogries form real categories
function torque_categories(categories) { return _.map(categories, function(c, i) { c = _.clone(c); c.title = i + 1; c.title_type = 'number'; return c; }); }
[ "function getAllCateogorie () {\n return categorie;\n}", "getCategories(reflection) {\n const categories = new Set();\n function extractCategoryTags(comment) {\n if (!comment)\n return;\n (0, utils_1.removeIf)(comment.blockTags, (tag) => {\n if (t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hides user1's statuses from user2, at the request of user1
hideFromUser(user1,user2){ this.users[user1].friendsDontShow.push({name: this.users[user2].name, id: user2}); return true; }
[ "unhideFromUser(user1,user2){\n let changed=false;\n for(var i=0;i<this.users[user1].friendsDontShow.length;i++){\n if(this.users[user1].friendsDontShow[i].id == user2){\n this.users[user1].friendsDontShow.splice(i,1);\n changed=true;\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve payment method transaction ID list [BETA] [See on api.ovh.com](
RetrieveAssociatedPaymentMethodTransactionIDList(paymentMethodId, status) { let url = `/me/payment/transaction?`; const queryParams = new query_params_1.default(); if (paymentMethodId) { queryParams.set('paymentMethodId', paymentMethodId.toString()); } if (status) { ...
[ "async getAllPaymentOptions () {\n return this._api.request('InvoiceService.getAllPaymentOptions')\n }", "ListAvailablePaymentMethodsInThisNicCountry() {\n let url = `/me/availableAutomaticPaymentMeans`;\n return this.client.request('GET', url);\n }", "static async getEthTransactions() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: std_dev Returns standard deviation of all values of an array. Parameters: arr Array consisting of only numbers. Returns: A value of standard deviation.
static std_dev(arr) { let av = Ex.average(arr); return Math.sqrt(Ex.average(arr.map(e => Ex.sq(av - e)))); }
[ "function stDev(arrOfValue) {\n // The standard deviation is calculated using the \"unbiased\" or \"n-1\" method.\n const avg = cap.giveAvg(arrOfValue);\n\n const squareDiffs = arrOfValue.map((value) => {\n const diff = value - avg;\n const sqrDiff = diff * diff;\n return sqrDiff;\n });\n\n // console...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
based on the val (15), sets the coloring of the todo element priority
function setPriorityStyling(todo) { }
[ "getColor(taskType){\n let taskToColor = \n {\"todo\": \"#9be7ff\", \"appointment\": \"#ff8a65\"};\n return taskToColor[taskType];\n }", "updatePriorityColors() {\n // Mutation may have been one that removes the DOM\n if (!getSidebar()) { return; }\n\n const selectedPriorities = new Set();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Auxiliary Functions It toggles between horizontal and vertical orientation of a ship image. Parameters: a ship image element of DOM (ca, v1, v2, s1, s2, s3, c1, c2, c3, c4, b1, b2, b3, b4, b5).
function horiz_vertic_alternate(ship_img_obj){ ship_img_obj.classList.toggle("vertical"); ship_img_obj.classList.toggle("horizontal"); if(ship_img_obj.getAttribute("src").startsWith("images/horiz")){ var src = ship_img_obj.getAttribute("src"); src = src.split("_");...
[ "_configureShipImg(img, size, variant, coords, direction, options = {}) {\n // Clear the initial classes\n img.className = '';\n img.src = `${this._imgSrcRoot}${size}${variant ? variant : ''}.png`;\n img.classList.add('vessel');\n if (direction === GameBoard.Di...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Try to find a selection inside the given node. `pos` points at the position where the search starts. When `text` is true, only return text selections.
function findSelectionIn(doc, node, pos, index, dir, text) { if (node.isTextblock) return new TextSelection(doc.resolve(pos)); for (var i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) { var child = node.child(i); if (!child.type.isLeaf) { var inner = findSelection...
[ "function FIND(find_text) {\n var within_text = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];\n var position = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];\n\n\n // Find the position of the text\n position = within_text.indexOf(find_text, position - 1);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pass through the methods click the upload file button
uploadClick (){ this.upload.click(); }
[ "preUpload(e){\n e.target.closest('.text').querySelector('input[type=\"file\"]').click()\n }", "click() {\n if (this.canSendFile()) {\n (0, _jquery.default)(this.element).closest('.peer').find('input[type=file]').click();\n }\n }", "function uploadProg() {\r\n\r\n // The fileUploa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a reference to the enforcements service
enforcements() { return new OpenFDADrugEnforcements(this.api); }
[ "getServiceRef() {\n return this.service;\n }", "function getGooglePaymentsClient() {\n if (paymentsClient === null) {\n paymentsClient = new google.payments.api.PaymentsClient({ environment: \"TEST\" }); // can be \"TEST\" or \"PRODUCTION\"\n }\n return paymentsClient;\n}", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds a candidate (also known as a song, genre, or category)
function addCandidate(newCandidate) { var name = newCandidate.getName().getName(); message("adding candidate named "); printCandidate(newCandidate); //message("done printing candidate"); candidates[name] = newCandidate; //message("done adding candidate\r\n"); }
[ "function addCandidatePosition(aCandidatePosition) {\n \t var newCandidatePosition = {\n x: parseFloat(aCandidatePosition.x),\n y: parseFloat(aCandidatePosition.y)\n \t };\n candidatePositions.push(newCandidatePosition);\n numCandidates += 1;\n } // addCandidatePosition", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deselects all of the options.
deselectAll() { this._setAllOptionsSelected(false); }
[ "deSelectAll() {\n this.set('isSelecting', false);\n this.deSelectBlocks();\n }", "resetOptions(){\r\n\t\t// reset all extras;\r\n\t\tconst $selects = $('.sm-box').find('select');\r\n\t\t$($selects).each((i, el) => {\r\n\t\t\tconst name = $(el).attr('id');\r\n\t\t\t$(`#${name}`).prop('selectedIndex', 0);\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all comments for a post.
static fetchPostComments(post_id) { return this._getObject(this._POST_COMMENTS_URL(post_id)); }
[ "function getComments(postId) {\n\t\t\t}", "getComments(q = null) {\n if (q === null) {\n // no query, get all comments of the type\n return this.comments;\n } else {\n // comments for a specific post...filter by name\n return this.comments.filter(el => el.name === q);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or sets the amount of left activation border to use for the cell content for this column.
get activationBorderLeftWidth() { return this.i.ba; }
[ "get activationBorderRightWidth() {\n return this.i.bb;\n }", "get actualBorderWidth() {\n return this.i.bu;\n }", "getLength() {\n return this._horizLeftHair.get_width();\n }", "changeCellLeft() {\n const cells = this.get('cells');\n const hoverIndex = this.get('hoverIndex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end ffgRoll generate image tags for die faces for chat message
chatResultFace(faces) { let output = ""; let src = ""; let path = "modules/ffg-roller/images/"; let imgTag = '<img src="fPath" width="36" height="36"/>'; //ability dice for (let i = 0; i < faces.abil.length; i++) { if (faces.abil[i] > 0) { swit...
[ "function drawEmoji(canvas, img, face) {\n // Obtain a 2D context object to draw on the canvas\n var ctx = canvas.getContext('2d');\n let fp_0 = face.featurePoints[0];\t\n let em = face.emojis.dominantEmoji;\n \n ctx.font = '48px serif';\n ctx.fillText(em, fp_0.x-70, fp_0.y);\n}", "function faces(name, tit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find a node of type.
function findNode(nodes, type, name) { for(let i = 0; i < nodes.length; i++) { const node = nodes[i]; if(node.nodeType === type && node.name === name) return node; } return null; }
[ "getNode(name) {\n return this.nodes.find((n) => n.name === name) || null;\n }", "function findNode(label, nodes){\n\tfor (var i = 0; i < nodes.length; i++){\n\t\t//console.log(nodes[i].label,label, nodes[i].label == label);\n\t\tif (nodes[i].label == label) {\n\t\t\treturn nodes[i];\n\t\t}\n\t} \n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
expects product.favorite to be set, and possibly brand.opt
function init(remote_url, product, brand, container, caller, onOpt) { container.html(template({ product: product, brand: brand, caller: caller, active_class: 'glyphicon-heart', inactive_class: 'glyphicon-heart-empty' })); container.fin...
[ "function changeFlavor() {\n var currentFlavor = document.getElementById(\"flavor-select\");\n var productImage = document.getElementById(\"product-image\");\n var currentProduct = document.getElementById(\"product-title\");\n productImage.src = imageDict[currentProduct.innerText.toLowerCase().replace(/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear the LIDAR profile tool.
clearAll() { this.line = null; this.profile.setLine(null); this.profile.cartoHighlight.setPosition(undefined); this.clearMeasure(); this.resetPlot(); }
[ "function clearConsole() {\n // reset drawing title\n abEamTcController.setDrawingPanelTitle(getMessage('noFlSelected'));\n // clear drawing content\n abEamTcController.clearDrawing();\n // clear asset details\n abEamTcController.clearAssetDetailRestriction(true);\n}", "clearAllObject() {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generates a m= SDP from a transceiver.
function writeMediaSection(transceiver, caps, type, stream, dtlsRole) { var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps); // Map ICE parameters (ufrag, pwd) to SDP. sdp += SDPUtils.writeIceParameters( transceiver.iceGatherer.getLocalParameters()); // Map DTLS parameters to SDP. sdp += SDPU...
[ "function writeRejectedMediaSection(transceiver) {\n var sdp = '';\n if (transceiver.kind === 'application') {\n if (transceiver.protocol === 'DTLS/SCTP') { // legacy fmt\n sdp += 'm=application 0 DTLS/SCTP 5000\\r\\n';\n } else {\n sdp += 'm=application 0 ' + transceiver.protocol +\n ' web...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans a directory for axiomatic containers of business logic and loads them into the global scope.
function loadAxioms(dir) { fs.readdirSync(path.join(__dirname, dir)).forEach(function(file) { var name = file.substr(0, file.length - 3); if(dir === 'services' && file === 'CrudService') { return; } global[name] = require('./' + dir + '/' + file); }); }
[ "loadApp() {\n if (fs.existsSync(this.mainDir)) {\n eachDir(this.mainDir, (dirname) => {\n let dir = path.join(this.mainDir, dirname);\n let type = singularize(dirname);\n\n glob.sync('**/*', { cwd: dir }).forEach((filepath) => {\n let modulepath = withoutExt(filepath);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate minimum height of the inputBox
get inputMinHeight(){ var {footer, header} = this.props; var inputMinHeight = this.minHeight; if(footer) inputMinHeight-=1; if(header) inputMinHeight-=1; return inputMinHeight; }
[ "get inputMaxHeight(){\n var {footer, header, maxHeight} = this.props;\n var inputMaxHeight = maxHeight;\n if(footer) inputMaxHeight-=1;\n if(header) inputMaxHeight-=1;\n return inputMaxHeight;\n }", "set requestedHeight(value) {}", "function getHeight() {\n return m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a unique name based on the tagString
function getUniqueName(tagString,tagNameObjsArray) { var frameListSize,objName,dupe=true,counter=1; while (dupe==true){ //check new name against name of all other tagName objs dupe=false; objName = tagString + counter++; //iterates through possible names: tagName1, then tagName2, etc. for (var i=0; ...
[ "function getUuid(htmlid)\n{\n var idInfo = htmlid.split(\"-\");\n var uuid = idInfo[1];\n \n for(var i=2; i < idInfo.length; i++)\n {\n uuid += \"-\"+idInfo[i];\n }\n \n return uuid\n}", "findUniqueIdentifier() {\n const metadataId = this.attributes[\"unique-identifier\"];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sortDate needs to be fixed to properly sort dates. The assumption at this point is that the dates look like this: YYYYMMDD which makes doing a string compare easy
function sortDate(value1, value2) { return sortString(value1, value2); }
[ "function sortByDate(arrayOfMeetups) {\n\tarrayOfMeetups.sort (function (a, b) {\n \tvar asplitwhite = (a.startdate).split(\" \");\n \tvar adatenottime = asplitwhite[0];\n \tvar bsplitwhite = (b.startdate).split(\" \");\n \tvar bdatenottime = bsplitwhite[0];\n \t\tvar aComps = (adatenottime).split(\"/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes canvas and actors
function init() { // Initialize the canvas and context canvas = document.getElementById("mainCanvas"); ctx = canvas.getContext("2d"); ctx.font = "100pt Verdana"; canvas.width = TILE_S * COLS; canvas.height = TILE_S * ROWS; canvas.setAttribute("tabIndex", "0"); canvas.focus(); canvas.addEventListener("keydown...
[ "initCanvas() {\n // Create new canvas object.\n this._canvasContainer = document.getElementById(this._canvasId);\n if (!this._canvasContainer)\n throw new Error(`Canvas \"${this._canvasId}\" not found`);\n // Get rendering context.\n this._canvas = this._canvasContaine...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fills semi colons w/ letter
function fillDisplayWord (letter) { }
[ "function makeSemicolonSeparated(text) {\n return text.replace(/[\\n]/g, ';');\n}", "set surround_seperator(string){ \n this.seperator_prefix = string\n this.seperator_suffix = string\n }", "function repeatSeparator(word, sep, count){\n let s = '';\n for(let i = 0; i < count; i++){\n if(i < c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserpackage_obj_body.
visitPackage_obj_body(ctx) { return this.visitChildren(ctx); }
[ "visitCreate_package_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitData_manipulation_language_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitProcedure_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitType_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
++ | ILIAS open source | ++ | Copyright (c) 19982006 ILIAS open source, University of Cologne | | | | This program is free software; you can redistribute it and/or | | modify it under the terms of the GNU General Public License | | as published by the Free Software Foundation; either version 2 | | of the License, or (a...
function SeqObjectiveMap() { }
[ "function SeqObjective() \r\n{\r\n\tthis.mMaps = new Array();\r\n}", "function SeqObjectiveTracking(iObj,iLearnerID,iScopeID) \r\n{\r\n\tif (iObj != null)\r\n\t{\r\n\t\tthis.mObj = iObj;\r\n\t\tthis.mLearnerID = iLearnerID;\r\n\t\tthis.mScopeID = iScopeID;\r\n\r\n\t\tif (iObj.mMaps != null)\r\n\t\t{\r\n\t\t\tfo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a Saga channel that allows subscribers to be notified whenever the app is resumed.
function resumeChannel(syncActionName) { return eventChannel(listener => { const onAppStateChange = (newState) => { newState === "active" && listener(syncActionName); } AppState.addEventListener("change", onAppStateChange); return () => AppState.removeEventListener("change", onAppStateChange);...
[ "function EventSubscription(props) {\n return __assign({ Type: 'AWS::RDS::EventSubscription' }, props);\n }", "function EventSubscription(props) {\n return __assign({ Type: 'AWS::DMS::EventSubscription' }, props);\n }", "function watcherSaga() {\n return regeneratorRuntime.w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function called repeat which takes two arguments: The first argument should be an arbitrary function, fn The second argument should be a number, n repeat should loop n times Each iteration of the loop, it should call fn Create two more functions called hello and goodbye: hello should log the string 'Hello worl...
function repeat(fn, n) { for(let i=0; i<n; i++) { fn(); } }
[ "repeat (n, f, o) { for (let i = 0; i < n; i++) f(i, o); return o }", "function repeat(input, n){\n var output = ''\n for(var i = 0; i < n; i++){\n output = output + input\n }\n return output\n }", "function repetition(txt, n) {\n return txt.repeat(n);\n}", "function repeat(acti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Basic Requirements 1. Using our new version of each, write a function called indexedExponentials that, when given an array of numbers as an argument, returns a new array of numbers where each number has been raised to the power of its index
function indexedExponentials(array) { // create a new array let raisedElements = []; // iterate over each element in the array, and pass the element and its index to a function each(array, function(num, i) { // raise each by the power of its index // push the element to an new array raisedElements...
[ "function indexedExponentials(numbers) {\n //create new array\n var poweredToIndex = [];\n //loop through numbers array with each()\n each(numbers, function(el,i){\n //push raised ele to power of index\n poweredToIndex.push(Math.pow(el, i));\n });\n //return new array\n return pow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines if the given event can be relocated to the given span (unzoned start/end with other misc data)
function isEventSpanAllowed(span, event) { var source = event.source || {}; var constraint = firstDefined( event.constraint, source.constraint, t.options.eventConstraint ); var overlap = firstDefined( event.overlap, source.overlap, t.options.eventOverlap ); return isSpanAllowed(span, const...
[ "function checkSpanIsRunning (span) {\n let result = span ? span.reqEnd === null : false\n if (result) {\n return true\n }\n\n if (span && span.stacks && span.stacks.length) {\n for (let i = 0; i < span.stacks.length; i++) {\n result = checkSpanIsRunning(span.stacks[i])\n if (res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
switch statement that renders different "scene" based on redux value
function renderSwitch(param) { switch (param) { case 0: return <InitScreen /> case 1: return <Screen1 /> case 2: return <Screen2 /> case 3: return <StatsScreen /> default: return <InitScreen /> } }
[ "sceneSwitcher(t, args) {\n if (args.prep) {\n // fade out\n this.ecs.getSystem(System.Fade).request(1, 500);\n // ask for the legit scene switch\n let nextArgs = {\n prep: false,\n increment: args.increment...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Concat two URI into one.
function concatURI(a, b) { let started = b[0] === "/"; let ended = a[a.length - 1] === "/"; if (started && ended) { return `${a}${b.substr(1)}`; } if (started || ended) { return `${a}${b}`; } return `${a}/${b}`; }
[ "function concatPath(a, b) {\n if (NodePath.sep === \"\\\\\") {\n return NodePath.normalize(a + \"/\" + b).replace(/\\\\/g, \"/\");\n }\n else {\n return NodePath.normalize(a + \"/\" + b);\n }\n}", "function joinPath(portion1, portion2) {\n\tlet a = [...portion1].filter(x => x.match(/[a-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Confirm delete before Ajax request to do it
function DeleteConfirm(url, object_id, csrf_token) { r = confirm("Confirmer") if (r == true) { $('#loading-part').show(); $('html, body').animate( {scrollTop: $('#loading-part').offset().top }, 'slow' ); $.ajax({ type: 'POST', url: ...
[ "function deleteTicket(){\n var ticket_number = $('#selected_ticket_number').text();\n if (confirm(\"Are you sure you want to delete this ticket?\")) {\n $.post( '/newticket', { \"delete_ticket\": ticket_number } ).done(function(response) {\n $(`#ticket_row_${ticket_number}`).hide('fast');\n select...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Purges the perfomance timing records of type "resource".
static _clearPerfTimingData() { performance.clearResourceTimings(); }
[ "function deleteTimeDetails() {\n let timeDetails = myStorage.timeDetails;\n timeDetails = null;\n myStorage.timeDetails = timeDetails;\n myStorage.sync();\n}", "function clearRateLimit(key) {\n\tdelete ratelimit[key];\n}", "deleteRecord() {}", "destruct() {\n var action;\n\n for (action...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Searches address or city puts in $("addressTo") and displays it on map.
function searchAddressTo() { var geocoder = new google.maps.Geocoder(); var address = $("#addressTo").val(); geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var coords = results[0].geometry.location; $("#map"...
[ "function searchAddressFrom() {\n var geocoder = new google.maps.Geocoder();\n var address = $(\"#addressFrom\").val();\n geocoder.geocode( { 'address': address}, function(results, status) {\n if (status == google.maps.GeocoderStatus.OK) {\n var coords = results[0].geometry.location;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Swaps the artist field's value with the title field's value.
function swapSongInfo() { var artistInput = document.getElementById("lastfm-artist"); var titleInput = document.getElementById("lastfm-title"); var oldArtist = artistInput.value; var oldTitle = titleInput.value; artistInput.value = oldTitle; titleInput.value = oldArtist; }
[ "function updatePlaylist(playlist, artistName, songTitle) {\n playlist[artistName] = songTitle\n\n return playlist\n}", "function updatePlaylist(playlist, artistName, songTitle){\n playlist[artistName] = songTitle\n return playlist\n}", "set title(title) {\n if (Lang.isNull(title)) {\n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls the setMessage function according to the errorType. errorType: 1. Overwrite Trans/Job 2. Folder Exists 3. Unable to Save 4. Unable to create folder 5. Delete file confirmation 6. Delete folder confirmation 7. File Exists 8. Unable to delete folder 9. Unable to delete file 10. Unable to rename folder 11. Unable to...
function _setMessages() { vm.breakAll = false; switch (vm.errorType) { case 1:// Overwrite var msg = vm.errorFiles[0].type === "job" ? i18n.get("file-open-save-plugin.error.overwrite.job.top-before.message") + " " : i18n.get("file-open-save-plugin.error.overwrite.tr...
[ "function editError(){\n\tdisplayMessage(\"There has been an error submitting your art.\\nSave your work locally and try again later.\",\n\t\t removePrompt(),removePrompt(),false,false);\n}", "function setUploadMessage(message, type) {\n $('#aui-message-bar').text(\"\");\n\n if (t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Override an event listener from `ClearButtonMixin` to validate and dispatch change on clear.
_onClearButtonClick() { this.value = ''; this._inputValue = ''; this.validate(); this.dispatchEvent(new CustomEvent('change', { bubbles: true })); }
[ "_onChange(event) {\n // For change event on the native <input> blur, after the input is cleared,\n // we schedule change event to be dispatched on date-picker blur.\n if (\n this.inputElement.value === '' &&\n !(event.detail && event.detail.sourceEvent && event.detail.sourceEvent.__fro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
center = initial center position (and rest position for joystick) radius = joystick radius tiltPos = where the user is tilting the joystick
function Joystick(centerX, centerY, radius) { this.centerX = centerX; this.centerY = centerY; this.radius = radius; //this.tiltPosX = centerX; //this.tiltPosY = centerY; this.tiltMagnitude = 0; this.tiltAngle = 0; this.initialTouchX = 0; this.initialTouchY = 0; }
[ "function face_target_rad(mx, my, tx, ty) {\n\tvar rad_angle = Math.atan(Math.abs(ty-my)/(Math.abs(tx-mx)==0?0.00001:Math.abs(tx-mx)) );\n\tif (tx<mx) rad_angle=Math.PI-rad_angle;\n\tif (ty<my) rad_angle=2*Math.PI-rad_angle;\n\treturn rad_angle;\n}", "getCenterY(){ return this.y + (this.height / 2) }", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populates the workflow dropdown
function populateWorkflowDropdown(data) { var dropdown = document.getElementById("myDropdown"); var dropdownContent = document.getElementById("myDropdownContent"); if (dropdownContent.childElementCount != 0) { dropdown.removeChild(dropdownContent); dropdownContent = document.createElement(...
[ "function FillVersionCombo(){\n var objVersionsCombo= document.getElementById(\"ddlWfVersions\");\n \n //Empty version combo.\n for (var i = objVersionsCombo.options.length; i >=0; i--){\n objVersionsCombo.options[i] = null; \n }\n \n\n //Fill version combo:\n //The \"HidWfVersions\" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }