query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Append service specific keys in meta
_appendSpecificMetaData(meta) { return meta; }
[ "addMeta(key, value) {\n this.meta[key] = value;\n }", "setService(value) {\n super.put(\"service\", value);\n }", "function decorateService (rawService) {\n var service = {\n properName: getServiceName(rawService),\n groupName: getServiceGroupName(rawService),\n lastIncidentTime: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Append trace call() AFTER var declaration. Highlight contains entire declaration. Created vars are pushed to visitor state to be included in bindings of this and future trace() calls
VariableDeclaration(path) { // Ignore var declarations we create if (isNewlyCreatedPath(path)) { return; } const scopeId = path.scope.uid; let scopeBindings = this.bindings[scopeId]; if (!scopeBindings) { scopeBindings = this.bindings[scopeId] = []; } sco...
[ "function addVarDecl()\n\t{\n\t\t// Type (int | string | boolean)\n\t\t_AST.addNode(getToken().value, \"branch\");\n\n\t\t// Get the Id, Type, and the line they are on\n\t var type = getToken().value;\n\t var id = getToken(+1).name;\n\t var line = getToken(+1).line;\n\n\t // If the current scope is -1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of initWebview() Creates webview options with local resource roots, etc for vega preview webview display.
getWebviewOptions() { return { enableScripts: true, enableCommandUris: true, retainContextWhenHidden: true, localResourceRoots: this.getLocalResourceRoots() }; }
[ "configure() {\n this.webview.html = this.html;\n // NOTE: let webview fire refresh message\n // when vega preview DOM content is initialized\n // see: this.refresh();\n }", "configure() {\n this.webview.html = this.html;\n // NOTE: let webview fire refresh message\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the SignatureParams object and sets the prefix to "" for the case, that the prefix stays unset
function SignatureParams() { this.prefix = ""; }
[ "initializePrefix(){\n if(this._sigil && !this._prefix.includes(this._sigil))\n this._prefix = this._sigil + this._prefix;\n }", "_createSignature() {\n const nonce = this._generateNonce();\n const message = nonce + this.clientId + this.key;\n const signer = crypto.createHmac(\"sha25...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End autoFillLocDesc For each record, if a country is reported, that country is matched to it's member of the regions object ane the regions in the record and in the object are compared for equality. If the record has no region, it is filled in; if the regions are not equal, the region in the record is checked against k...
function valCountriesAndRegions() { var rcrdsObj = entityObj.curRcrds; var countries = buildCountryRefObj(); for (var locDesc in rcrdsObj) { checkCntryAndRegion(rcrdsObj[locDesc]); } function checkCntryAndRegion(rcrdsAry) { //console....
[ "function wpsc_change_regions_when_country_changes() {\n\twpsc_copy_meta_value_to_similiar( jQuery( this ) );\n\twpsc_update_regions_list_to_match_country( jQuery( this ) );\n\treturn true;\n}", "function assumeRegion(currentRom){\n //this is the logical breakdown - notice the rules order\n //If the localis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PageNav() / BlogIndex object Populates the blog index page. eventually pagination.
function BlogIndex(conf) { var self = this; this.conf = conf; this.genBlogIndex = function() { /* write some HTML to format the data */ var mdBodyObj = document.getElementById(gs_body_id); var ul = document.createElement('ul'); appendAttribute(ul, 'class', 'list-group'); ...
[ "function PageNav(conf) {\n\n var self = this;\n\n this.conf = conf;\n this.pagination_ul = document.getElementById(gs_pagination_links_id);\n this.pagination_div = document.getElementById(gs_pagination_div_id);\n\n /* The nav is a <ul> with items <li> and page links <a>. */\n this.genNavListTags ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check of a value is a `NodeOperation` object.
isNodeOperation(value) { return Operation.isOperation(value) && value.type.endsWith('_node'); }
[ "isNodeOperation(value) {\n return Operation.isOperation(value) && value.type.endsWith(\"_node\");\n }", "isOperation(value) {\n if (!isPlainObject(value)) {\n return false;\n }\n switch (value.type) {\n case \"insert_node\":\n return Path.isPath(value.path) && Node2.isNode(value.nod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
.bar height & .boxstructure_wrapper width
function barheight(){ //.bar height $(".bar").each( function( i ){ var boxesheight = $(this).next(".boxes").innerHeight(); $(this).height( boxesheight - 6 ); // $(this).ellipsis( options={ellipsis:""} ); } ); }
[ "function create_bars()\n{\n // Make the array empty\n arr=[];\n // Make the visible bars empty\n bar.innerHTML=\"\";\n // Take the no of bars from range\n var no_of_bar=arr_size.value;\n var arr_width_size =(500/no_of_bar);\n \n // Set the height\n // we will sort the bars on the basi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
constructor for period selector
function PeriodSelector(control) { this.control = {}; this.rootControl = control; }
[ "function Period() {\n this.days = {};\n}", "period () { return this._period }", "function TimePeriod()\n{\n this.id = \"\";\n this.year = \"\";\n this.events = [];\n this.eventCategories = [];\n}", "constructor({ selector, targetDate }) {\n this.targetDate = targetDate;\n this.select...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::WebACL.CustomHTTPHeader` resource
function cfnWebACLCustomHTTPHeaderPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnWebACL_CustomHTTPHeaderPropertyValidator(properties).assertSuccess(); return { Name: cdk.stringToCloudFormation(properties.name), Value: cdk.stringT...
[ "function cfnWebACLCustomResponsePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_CustomResponsePropertyValidator(properties).assertSuccess();\n return {\n CustomResponseBodyKey: cdk.stringToCloudFormation(properties.customRes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sync up top checkbox with bottom
function syncTopBox(){ var box = document.getElementById("bottomcheckbox").checked; if(box == true) { document.getElementById("topcheckbox").checked = true; } else{ document.getElementById("topcheckbox").checked = false; } }
[ "function syncBottomBox(){\n var box = document.getElementById(\"topcheckbox\").checked;\n if(box == true)\n {\n document.getElementById(\"bottomcheckbox\").checked = true;\n }\n else{\n document.getElementById(\"bottomcheckbox\").checked = false;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the search prefetch library state the first time it is called. Returns the created state on next invocations.
function createSearchPrefetchStateOnce(createdBy, puid) { if (state) { return state; } try { puid = Object(_ms_sp_search_common_lib_getCleanPuid__WEBPACK_IMPORTED_MODULE_0__["default"])(puid); } catch (_a) { puid = 'HostAppFailedToProvidePuid'; } return state = { ...
[ "ensureState() {\n stateCache = stateCache ||\n settings.state ||\n this.context[\"@@SQ_State\"] ||\n createState({});\n }", "static createState(start = 0) {\n return {count: start};\n }", "function createState() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans given source file for ifdef blocks and parses them accordingly
function scanIfDefBlocks (source, regexs, grunt) { var regexType = "array"; var regexs_ = regexs; if (Object.prototype.toString.call(regexs) === "[object Object]") { regexs = [0]; regexType = "object"; } var contents = source; for (var i = 0; i < regexs.length; i++) ...
[ "function IsIFDEFSingle(Linea, nl) {\n // \"_ #ifdef|#ifndef _ {cond} _ then {statement}\";\n var R = new RegExp(/\\s*(#ifdef|#ifndef)\\s+(.*)\\s+then\\s+(.*)/i);\n var match = R.exec(Linea);\n if (match === null)\n return undefined;\n var all = match[0], ifdef = match[1], cond = match[2], sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the editor is editable.
get isEditable() { return this.options.editable && this.view && this.view.editable; }
[ "get isEditable() {\r\n // since plugins are applied after creating the view\r\n // `editable` is always `true` for one tick.\r\n // that’s why we also have to check for `options.editable`\r\n return this.options.editable\r\n && this.view\r\n && this.view.editable;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setMinPersediaan set the minPersediaan variable with value from text input
function setMinPersediaan(params) { minPersediaan = document.getElementById('newMinPersediaan').value; }
[ "function setMinPermintaan () {\n minPermintaan = document.getElementById('newMinPermintaan').value;\n }", "set min(value){Helper.UpdateInputAttribute(this,\"min\",value)}", "function _setMinutos( min )\r\r\r\n{\r\r\r\n\tif( this.validaInt( min, \"Tempo.setMinutos( int ) - Número inválido.\" ) )\r\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change ids to manage duplicates and keep mask working
manageDuplicates(){ // Manage duplicate IDs from swiper loop this.duplicates = this.sliderPastilles.container[0].querySelectorAll('.pastille--image.swiper-slide'); for ( let i = 0; i < this.duplicates.length; i++ ){ // Vars let mask = this.duplicates[i].querySelector('...
[ "function findDuplicatedIDs(){\n\t\tvar count = 0;\n\t\t$('[id]').each(function(){\n\t\t\tvar ids = $('[id=\"'+this.id+'\"]');\n\t\t\tif(ids.length>1 && ids[0]==this){\n\t\t\t\tif(count == 0){\n\t\t\t\t\tduplicatedIDs += this.id;\n\t\t\t\t\t$(this).css(\"cssText\", \"border: 5px solid red\");\n\t\t\t\t} \n\t\t\t\te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
332 333 334 // 335 Helper Functions // 336 337 338 Accordion Open // 339
function accordionOpen(object) { // 340 $panel_headers = $this.find('> li > .collapsible-header'); // 341 if (object.hasClass('active')) { ...
[ "function accordionOpen(object){$panel_headers=$this.find('> li > .collapsible-header');if(object.hasClass('active')){object.parent().addClass('active');}else{object.parent().removeClass('active');}if(object.parent().hasClass('active')){object.siblings('.collapsible-body').stop(true,false).slideDown({duration:350,e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function that checks whether a function is a TypeResolver or not.
function isTypeResolver( // eslint-disable-next-line @typescript-eslint/no-explicit-any fn) { // 1. A type provider must be a function if (typeof fn !== 'function') return false; // 2. A class constructor is not a type provider if (/^class/.test(fn.toString())) return false; // 3. Bu...
[ "function isValidResolver(resolver) {\n return resolver == null || typeof resolver === 'function';\n}", "function isValidResolver(resolver) {\n return resolver == null || typeof resolver === 'function';\n }", "function isFn(f) {\r\n\treturn typeof f === \"function\";\r\n}", "function isFunction(arg) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end xAnimation xAniOpacity, Copyright 20062007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL xAniOpacity Animate an element's opacity.
function xAniOpacity(xa, o, tt, at, qc, oed, oea, oef) { var a = xa.init(xa.e, at, qc, tt, onRun, onRun, oed, oea, oef); a.x1 = xOpacity(a.e); // start opacity a.x2 = o; // end opacity if (a.as) a.start(); return a; function onRun(o) { xOpacity(o.e, o.x); } // (o.x == 1) ? 0.9999 : o.x; // for Gec...
[ "function $opacityFadeIn(obj,opacStart,opacEnd,opacTime,opacSteps,functBusy,functFinish){if(opacStart<opacEnd){$setOpacity(obj,opacStart);eval(functBusy);window.setTimeout(function(){opacStart+=(opacSteps);$opacityFadeIn(obj,opacStart,opacEnd,opacTime,opacSteps,functBusy,functFinish)},opacTime);}else if(opacStart>=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bound posX Prevent the posX from getting modified outside of the timeline boundaries.
function boundPosX(posX) { // Left edge var leftBound = (yearMarkerWidth / 2); if (posX <= leftBound) { posX = leftBound; } // Right edge var rightBound = 1580; if (posX >= rightBound) { posX = rightBound; } return posX; }
[ "boundX(){\n if(this.bounds === null) return;\n if(this.pos[0] < this.bounds[0]) this.pos[0] = this.bounds[0];\n let edge = this.bounds[0] + this.bounds[2];\n if(this.pos[0] > edge) this.pos[0] = edge;\n }", "set FreezePositionX(value) {}", "get xPosition() { return this._xPositio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function loads the couch's base independently
function couchBaseLoader(){ // model base var base__loader = new THREE.OBJLoader(); base__loader.load(baseOBJ, function(base__object) { base__object.traverse(function(child) { if (child instanceof THREE.Mesh) { child.material.map = base__texture; } }); base__object.positio...
[ "function local_couch(cb) {\n // swap for couchr. couchr is adding a query param that couch does not like\n ///$.getJSON('_couchdb', function(data) {\n /// data.url = '_couchdb';\n // cb(null, data);\n //})\n couchr.get('/', function(err, data){\n if (!err ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes current headline elements.
function deleteCurrentHeadlineElements() { // Delete existing elements. let headline_start_container = document.getElementById( "headline-start-container" ); while (headline_start_container.firstChild) { headline_start_container.removeChild(headline_start_container.firstChild); } let headline_end_co...
[ "function headline_delete()\n {\n // grab the .data element of the headline to delete\n var axe_it = $(this).parents(\".card\").data();\n $.ajax(\n {\n method: \"DELETE\",\n url: \"/api/headlines/\" + axe_it._id\n }).then(function(data)\n {\n // re-render if deleted\n if (data...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Data Grid Number Format
function datagridFormatNumber(val,row){ return accounting.formatNumber(val); }
[ "function formatNumber(data) {\n const addDots = data.toString().split(\"\").reverse().map((dataPoint, index) => {\n return (index + 1) % 3 === 0 && index !== String(data).length - 1 ? \".\" + dataPoint : dataPoint;\n })\n\n return addDots.reverse().join(\"\");\n}", "formatNumber (value, format) {\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Encode an RGBA list into UTF8 PNG.
function encodeRGBAtoPNG(image, width, height) { var stream = new PNGStream(); stream.writeIHDRChunk(width, height, 8, /* 8 bit depth*/6, /* True-color with alpha */0 /* No interlace */); image = rowFilter(width, height, 4, image); image = zlibNoCompression(image, image.length); stream.writeIDATChun...
[ "function rgbaToString(array){\n return 'rgba('+array[0]+','+array[1]+','+array[2]+','+array[3]+')'\n }", "function arrayRGBA (array) {\n\t\treturn (\n\t\t\t'rgba(' +\n\t\t\tMath.round(array[0]) + ', ' +\n\t\t\tMath.round(array[1]) + ', ' +\n\t\t\tMath.round(array[2]) + ', ' +\n\t\t\tMath.round(array[3]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Split SVG text into several where string has newline character \n Based on
function linebreak(text) { text.each(function() { var text = d3.select(this), words = text.text().split(/\n/).reverse(), word, lineNumber = 0, lineHeight = 1.1, // ems y = text.attr("y"), x = text.attr("x"), dx = text.attr("dx"), ...
[ "function svgTextString(textEl) {\n var orderedTSpans = textEl.find('./tspan').sort(function(a,b) {\n var ax = parseFloat(a.attr('x').value()) || 0\n , ay = parseFloat(a.attr('y').value()) || 0\n , bx = parseFloat(b.attr('x').value()) || 0\n , by = parseFloat(b.attr('y').value...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert that expected value is not element of an array.
function isNotInArray(arr, expected, message) { if(!Array.isArray(arr)){ throw new Error('Expected array, got ' + typeof arr + ' ' + arr); // If arr is undefined will throw undefined error instead } assert.deepEqual(arr.indexOf(expected), -1, message); }
[ "function isInArray(arr, expected, message) {\n if(!Array.isArray(arr)){\n throw new Error('Expected array, got ' + typeof arr + ' ' + arr); // If arr is undefined will throw undefined error instead\n }\n\n assert.notDeepEqual(arr.indexOf(expected), -1, message);\n}", "function assertNone(arr, att...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets if the provided structure is a FunctionDeclarationOverloadStructure.
static isFunctionDeclarationOverload(structure) { return structure.kind === StructureKind_1.StructureKind.FunctionOverload; }
[ "static isMethodDeclarationOverload(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.MethodOverload;\r\n }", "static isConstructorDeclarationOverload(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.ConstructorOverload;\r\n }", "function isOver...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A nice way to walk through every rule
function walkRules(rules, linters) { rules.forEach(function(rule) { if (rule.rules) { walkRules(rule.rules); } linters.forEach(function(linter){ linter(rule); }); }); }
[ "* rules() {\n\t\tfor(let k_context of Object.values(this.contexts)) {\n\t\t\tyield* k_context.subrules();\n\t\t}\n\t}", "function\trule()\n{\n\t/*\n\t *\tPARSING\n\t */\n}", "verifyRules()\r\n {\r\n for (let rule of RULES) {\r\n for (let entry of this.app.entries()) {\r\n ru...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats a given template and parameters as a string.
function formatTemplate(template, parameters, formatterConfig) { return template.replace(/\${([^{]+[^}])}/g, function (match) { var parameterString = match.substr(2, match.length - 3).trim(); return getParameterValueFromString(parameterString, parameters, formatterConfig); }); }
[ "function formatString(template, fields) {\n var updatedTemplate = template;\n for (var field in fields) {\n var fieldSelector = selector(field);\n var newTemplate = updatedTemplate.replace(fieldSelector, fields[field]);\n while (newTemplate !== updatedTemplate) {\n updatedTemplate = newTemplate;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ROTATE CUBE2 90 DEGREES ===========================================
function rotate2_90 (){ angleRot2 += 90; cube2.style.transform = "translateZ(-170px) rotateY("+ angleRot2 + "deg)";}
[ "function rotate90 (){\n angleRot -= 90;\n cube1.style.transform = \"translateZ(-170px) rotateY(\"+ angleRot + \"deg)\";}", "rotateCounterclockwise() {}", "invertRotation() {\n this.rotation *= -1;\n }", "function rotate90CW( v ) {\n\n var rotM_r0 = [0,0,1]; // first row\n var rotM_r1 =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when get new props also renderDialogContent
componentWillReceiveProps(newProps) { //console.log('this.props.imgSrc: ', this.props.imgSrc); //render the children this.renderDialogContent(newProps); }
[ "componentWillReceiveProps(newProps) {\n //render the children\n this.renderDialogContent(newProps);\n }", "_renderDialog() {\n if (!this.state.dialog) {\n return null;\n }\n const type = this.state.dialog.type;\n switch (type) {\n case 'delete':\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Drain the handler queue entirely, being careful to allow the queue to be extended while it is being processed, and to continue processing until it is truly empty.
function drainQueue() { runHandlers(handlerQueue); handlerQueue = []; }
[ "function drainQueue() {\n\t runHandlers(handlerQueue);\n\t handlerQueue = [];\n\t }", "function drainQueue() {\r\n\t\trunHandlers(handlerQueue);\r\n\t\thandlerQueue = [];\r\n\t}", "drainQueue() {\n while (!this.queue.isEmpty()) {\n this.emit(kDrainMessage, this.queue.dequeue());\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
25.4.2.2 PromiseResolveThenableJob ( promiseToResolve, thenable, then)
function PromiseResolveThenableJob(promiseToResolve, thenable, then) { // SPEC BUG: promise vs. promiseToResolve var resolvingFunctions = CreateResolvingFunctions(promiseToResolve); try { var thenCallResult = then.call(thenable, resolvingFunctions['[[Resolve]]'], ...
[ "function PromiseResolveThenableJob (promiseToResolve, thenable, then) {\n // SPEC BUG: promise vs. promiseToResolve\n var resolvingFunctions = CreateResolvingFunctions(promiseToResolve)\n try {\n var thenCallResult = then.call(thenable, resolvingFunctions['[[Resolve]]'],\n resolvingFunctions['...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Picks a car at random
function randomCar() { return cars[Math.floor(Math.random() * cars.length)]; }
[ "function getRandomCar() {\n // Pick a random car.\n const car = cars[Math.floor(Math.random() * cars.length)];\n\n const carContainer = document.getElementById('js-car-container');\n const carView = buildCarView(car);\n carContainer.replaceWith(carView);\n}", "function getRandomCar() {\n const randomCar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set Media Elements player dimensions
function trx_addons_set_mejs_player_dimensions(video, w, h) { "use strict"; if (mejs) { for (var pl in mejs.players) { if (mejs.players[pl].media.src == video.attr('src')) { if (mejs.players[pl].media.setVideoSize) { mejs.players[pl].media.setVideoSize(w, ...
[ "function setMejsPlayerDimensions(d, a, c) {\n if (mejs) {\n for (var b in mejs.players) {\n if (mejs.players[b].media.src == d.attr(\"src\")) {\n if (mejs.players[b].media.setVideoSize) {\n mejs.players[b].media.setVideoSize(a, c)\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns date by reading provided text argument. only 1 date/time ideally should be present in text. returns null, if text has no date/time.
function getDateAndTimeFromText ( text, adjustForNextDate ) { try { if ( adjustForNextDate == null || adjustForNextDate == undefined || adjustForNextDate === "" ) adjustForNextDate = 1; if ( text != null && text != "" ) { var dateValue = text.match(/\d{1,}\/\d{1,}\/\d{1,}/); // in yyyy/mm/dd format ...
[ "function parseDate(text) {\n let of = 'of';\n return new Date(text.slice(text.indexOf(of) + of.length));\n}", "extractDates(text){\n return text.match(/(\\d{1,4}([.\\-/])\\d{1,2}([.\\-/])\\d{1,4})/gi);\n }", "function extractDate(paragraph) {\n var start = paragraph.indexOf(\"died \") + 5;\n var d ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add Range click event
_addClickEvent() { this.rangeElement.addEventListener('click', event => { event.stopPropagation(); if (event.target.className !== 'tui-image-editor-range') { return; } const touchPx = event.offsetX; const ratio = touchPx / this.rangeWid...
[ "function doExecuteOnRangeBoxClicked(e) {\n const rangeBox = $(e.target);\n rangeBox.children('span').hide();\n rangeBox.children('input').fadeIn(300).select();\n rangeBox.removeClass('clickable').off('click');\n rangeBox.children('input').on('focusout keyup', e => executeOnRangeInputFocusOut(e));\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if and only if a customUrl is not reserved or currently in use. Note: It is possible that the word will become 'used' immediately after this function returns.
async function customUrlAvailable(customUrl) { if (customUrl == "" || customUrl == "index" || customUrl == "index.htm" || customUrl == "index.html") { // reserved for home page return false; } else { return !(await db.isShortUrlUsed(customUrl)); } }
[ "hasUrl(): boolean {\n return this.url != null;\n }", "hasUrl() {\n return this.url != null;\n }", "function checkExcludeURLStatus() {\n var excludeStatus = false,\n urls = settings.excludeURL,\n len = urls.length,\n i = -1,\n href = document.refe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Nodemon will run node whenever watched directory changes
function runServerOnChange() { return plugins.nodemon({ script: "./server.js", watch: "build", ignore: "**/tests" }); }
[ "function watchApp() {\n\tfs.watch('.', function(event, filename) {\n\t\t// Ignore files ending in .log or .err\n\t\tif (\n\t\t\tfilename.indexOf('.log', filename.length-4) === -1 &&\n\t\t\tfilename.indexOf('.err', filename.length-4) === -1 &&\n\t\t\tfilename.indexOf('.out', filename.length-4) === -1\n\t\t) {\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an ampersand.
function list(names){ var output = ""; for (var i = 0; i < names.length; i ++){ if (i < (names.length - 2)){ output = output + names[i]["name"] + ", "; } else if (i == names.length - 2){ output = output + names[i]["name"] + " & "; } else { output = output + names[i]["nam...
[ "function list(names){\n names = names.map(e => e.name)\n if(names.length <= 1)return names.join()\n if(names.length === 2)return names.join(` & `)\n if(names.length > 2){\n let last = ` & ${names.pop()}`\n return names.join(\", \") + last\n }\n}", "function list(names){\n let returnStr = '';\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
button function for the pomodoro
function pomodoro() { pending = true; pauseTimer(); resetTimerHelper(); document.getElementById('timer').innerText = "25:00"; }
[ "function choosePomodoroInterval(e) {\n const element = e.target;\n //remove class active from all btns\n [...element.parentElement.children].forEach(btn => btn.classList.remove('active'));\n if (element.classList.contains('pomodoro-btn')) {\n element.classList.add('active');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Support Funtions Checks if the username and password match a hardcoded set If they do, put the username on the session
function handleLogin(request, response) { var result = {success: false}; // We should do better error checking here to make sure the parameters are present if (request.body.username == "admin" && request.body.password == "password") { request.session.user = request.body.username; result = {success: true};...
[ "function correctCredentials(username, password){\n return username === \"admin\" && password === \"admin\";\n}", "function handleLogin(request, response) {\r\n var result = {success: false};\r\n \r\n console.log(request.body.username, request.body.password);\r\n client.query('SELECT * FROM users WHERE usern...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the country a point belongs to
function getCountryPointBelongsTo(point){ var countries=$scope.countriesJSON["countries"]; for (var countryIndex=0; countryIndex<countries.length; countryIndex++){ var country = countries[countryIndex]; if (countryContainsPoint(point, country)){ retur...
[ "function getAreaPointBelongsTo(country, point){\n if (country == undefined){\n return null;\n }\n \n var areas=country[\"subareas\"];\n for (var areaIndex=0; areaIndex < areas.length; areaIndex++){\n var area=areas[areaIndex];\n var points = area[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the path of specified namespace (for verifying namespace and locating .hx? files)
function getNamespacePath(ns) { var r = ''; try { var oRegSess = new ActiveXObject('HxDs.HxRegisterSession'); oRegSess.CreateTransaction(''); var oRegNS = oRegSess.GetRegistrationObject(0); if ( oRegNS.IsNamespace(ns) ) { r = oRegNS.GetCollec...
[ "function getNsPath(ns) {\n //get the last capitalized word\n var match = ns.match(LAST_UPCASE_PATT);\n if (!!match) {\n if (Object.keys(defaults.extSuffixMap).indexOf(match[2]) !== -1) {\n return `${match[1].replace(DOT_PATT, \"/\")}.${defaults.extSuffixMap[match[2]]}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method post api /sys/fileBucket/update
updateBucket() { let self = this; return co.wrap(function*(req, res, next) { let bucketInfo = req.body; let result = self.result(); let connection = null; try { connection = yield self.getPoolConnection(); let fileBucketService = new FileBucketService(connection); ...
[ "function updateFile(params, cb){\n var resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + \"/submissions/:id/fields/:fieldId/files/:fileId\", params);\n var method = \"PUT\";\n var data = params.fileDetails;\n\n params.resourcePath = resourcePath;\n params.method = method;\n params.data = data;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import NewExpense from "./components/NewExpense.js/NewExpense";
function App() { // const addExpenseHandler = (expense) => { // console.log("In app.js"); // console.log(expense); // }; return ( <div> <div> <title> <h2>Welcome, take a look at your reward points</h2> </title> </div> <div> <Expenses mockData={mo...
[ "function loadStories() {\n require(\"../src/components/Form/Input/Input.stories.tsx\");\n}", "function Inventory () {\n \n return (\n <div>\n <h2> This is the Inventory page</h2>\n </div>\n )\n}", "function component(){\n var ele=document.createElement('div');\n var btn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for update product image height
function updateProductImageHeight() { let productImageWidth = $('.product-image').width(); $('.product-image').css({'height': productImageWidth + 'px'}); }
[ "adjust_feature_img(height) {\n var product = document.getElementsByClassName('product-single');\n var content = product[0].getElementsByClassName('main-content-block')[0];\n var clonedImg = product[0].getElementsByClassName('feature-image')[0].cloneNode(true);\n clonedImg.classList.remo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The URL of the box art of the game.
get boxArtUrl() { return this._data.box_art_url; }
[ "function loadingURL() {\n return settings.assetHost + '/external/zenbox/v2.1/loading.html';\n }", "function quakeUrl(quake)\n{\n return QUAKE_BASE + quake.Src + quake.Eqid + QUAKE_TAIL;\n}", "getURL() {\n return Meteor.absoluteUrl(UploadFS.config.storesPath + '/' + this.name, {\n secure:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(re) subscribe to all known objects. Probably this should be a private method; it's generally only performed after having been disconnected from Zen Spaces and reconnecting.
subscribeAll() { this.subscriptions = new Map(); console.log('Re-subscribing to all'); // Iterate through the object references and re-subscribe this.objectRefs.forEach(objRef => { this.subscribe(objRef); }); }
[ "_refreshSubscriptions() {\n if (!this.registry) return\n for (const {\n args: {eventName, filters}\n } of Object.values(this.registry)) {\n this._subscribe(eventName, filters)\n }\n }", "async subscribeAll() {\n this.subscribe(\n 'invoices',\n 'transactions',\n 'backups',...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display State Assignment Table
function dispState(s, bS, xCol) { let row, h1, h2, c1, c2, tab1; tab1 = document.createElement("table"); tab1.setAttribute("class", "stateTableT2"); row = document.createElement("tr"); h1 = document.createElement("th"); h2 = document.createElement("th"); row.appendChild(h1); row.appendCh...
[ "function showRules() {\n\tlet table='<table>\\n<tr>\\n\\t<th>Event</th><th colspan=\"4\">State</th>' +\n\t\t'</tr>\\n<tr>\\n\\t<th></th>';\n\tfor (let row=0; row < stateNames.length; row++) {\n\t\ttable+='\\t<th>' + stateNames[row] + '</th>\\n'; \n\t}\n\ttable += '</tr>\\n'\n\n\tlet fsm=fsmRules; // save some typi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(void)setTransformM11:(float)m11 m12:(float)m12 m21:(float)m21 m22:(float)m2 dx:(float)dx dy:(float)dy;
setTransform(m11, m12, m21, m22, dx, dy) { CanvasManager.setTransform(findNodeHandle(this), m11, m12, m21, m22, dx, dy) }
[ "transform(m11, m12, m21, m22, dx, dy) {\n CanvasManager.transform(findNodeHandle(this), m11, m12, m21, m22, dx, dy)\n }", "setTransform(_matrix) {\n }", "function setTransform(obj, m) {\n\t// For some very strange reasons conversion to string is 2x faster.\n\tobj.setAttribute(\"transform\", \"matrix(\" + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! Default iterator utilizing `.length` and subscripts.
function defaultIterator() { var self = this; return { length: function(){ return self.length }, get: function(i){ return self[i] } } }
[ "function Iterator()\n{\n\n}", "function Iterable() {}", "function Iterator() {\n\n}", "function EmptyIterator() {}", "function ListIterator() {}", "GetEnumerator() {\n\n }", "function test_toArray_custom_iterator() {\n let arr = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30];\n let iterator = {\n __i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct a new repeat iterator.
function RepeatIterator(value, count) { this._value = value; this._count = count; }
[ "function repeat(value, count) {\r\n\t return new RepeatIterator(value, count);\r\n\t}", "function RepeatIterator(value, count) {\n this._value = value;\n this._count = count;\n }", "function RepeatIterator(value, count) {\r\n\t this._value = value;\r\n\t this._count = count;\r\n\t }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description : Internal function to insert properties table into the current location Author : Hany Elkady Reference : Created : 26NOV2019 Modified : 26NOV2019 Status : WiP
async function insertPropertiesTable() { await Word.run(async (context) => { //Define Table Basic Outline const theTableData = [["Property", "Original Value", "New Value"], ["Title", "", ""], ["Subject", "", ""]]; //Create Table after the current insertion point var thePropertiesTable = conte...
[ "function fnCreatePropertyTableAdmin(jsProperties){\n\n\t// property row template \n\tvar sProperty = '<tr data-id=\"{{id}}\" class=\"row-property\">\\\n\t<td class=\"img-property\">\\\n\t<div class=\"img\"><img src={{image}}></div>\\\n\t</td>\\\n\t<td class=\"lbl-property\" id=\"lbl-property-address\">Address:<br...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pushes all of the elements from `input` into `array`.
function pushAll(array, input) { var length = input.length; for (var i = 0; i < length; ++i) { array.push(input[i]); } }
[ "function pushAll(array, input) {\n var length = input.length;\n\n for (var i = 0; i < length; ++i) {\n array.push(input[i]);\n }\n }", "function pushAll(array, input) {\n var length = input.length;\n\n for (var i = 0; i < length; ++i) {\n array.push(input[i]);\n }\n}", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prey is also a child object of Animal. It adds an initial position to the animal of 5 to give the prey a head start.
function Prey(focus, name, strength, speed){ Animal.call(this, focus, name, strength, speed); this.position = 4; }
[ "function setupPrey() {\n preyX = width / 5;\n preyY = height / 2;\n preyVX = -preyMaxSpeed;\n preyVY = preyMaxSpeed;\n preyHealth = preyMaxHealth;\n}", "function setupPrey() {\n preyX = width/5;\n preyY = height/2;\n preyVX = -preyMaxSpeed;\n preyVY = preyMaxSpeed;\n preyHealth = preyMaxHealth;\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
call this each time the detailed view is load to change what the house buttons will do (buy / sell / grayed out)
function setupHouseButtons() { $("#houseminusbtn").unbind(); $("#houseplusbtn").unbind(); if (current_prop.monopoly === true) { $("#houseminusbtn").removeClass("unavailable"); $("#houseplusbtn").removeClass("unavailable"); $("#houseminusbtn").click(function() { socket.emit('houseSell', { ...
[ "function setupMortgageBtn() {\n if (current_prop.numHouses > 0 || current_prop.hotel === true) {\n $(\"#mortgagebtn\").addClass(\"unavailable\")\n .unbind();\n $(\"#mortgagebtn .btncaption\").html(\"Mortgage\");\n return;\n }\n if (current_prop.mortgaged === true) {\n $(\"#mortga...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Question: Find the indexes of the vowels in te string.
function problem(str) { var vowels = ['a', 'e', 'i', 'o', 'u', 'y', 'A', 'E', 'I', 'O', 'U', 'Y']; var arr = str.split(''); var indexes = []; for (var i = 0; i < arr.length; i++) { for (var j = 0; j < vowels.length; j++) { if (arr[i] === vowels[j]) { indexes.push(i + 1); } } } re...
[ "function vowelIndices(word){\n let indices = [];\n let vowels = ['a', 'e', 'i', 'o', 'u', 'y'];\n word.toLowerCase()\n .split('')\n .map((char, i) => vowels.includes(char) && indices.push(i+1));\n return indices;\n}", "function vowelIndices(word) {\n //your code here\n let arr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
private methods / Protects connections to the server with an ssl certificate
__ssl() { /// TODO: nothing, I guess? }
[ "function silentlyAllowInsecureConnections() {\n if (suppressed) {\n return;\n }\n\n suppressed = true;\n\n process.emitWarning = (warning, ...args) => {\n if (typeof warning === 'string' && warning.indexOf('NODE_TLS_REJECT_UNAUTHORIZED') > -1) {\n // node will only emit the warning once\n // ht...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns first script tag in DOM matching our gtag url pattern.
function findGtagScriptOnPage() { const scriptTags = window.document.getElementsByTagName('script'); for (const tag of Object.values(scriptTags)) { if (tag.src && tag.src.includes(GTAG_URL)) { return tag; } } return null; }
[ "function findGtagScriptOnPage() {\n var scriptTags = window.document.getElementsByTagName('script');\n\n for (var _i = 0, _a = Object.values(scriptTags); _i < _a.length; _i++) {\n var tag = _a[_i];\n\n if (tag.src && tag.src.includes(GTAG_URL)) {\n return tag;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructor for a facade around an underlying TimelineFront.
function LegacyTimelineFront (target) { this._target = target; EventEmitter.decorate(this); }
[ "createTimeline() {\n const scenes = this.getScenes();\n const fps = this.rootConf('fps');\n const timeline = new Timeline(fps);\n timeline.annotate(scenes);\n this.timeline = timeline;\n }", "function TimelineClass() {\n\n\t// variables to keep track of minimum amd maximum dates\n\tthis.firstDate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Acknowledge dialog (single button)
function acknowledgeDialog(options, callback) { if (typeof options == 'string') { options = { message: options }; } if (typeof options.title == 'undefined') { options.title = 'Completed'; } if (typeof options.ok == 'undefined') { options.ok = 'OK'; } var bodyContent = options.message; var ...
[ "function alertBtn(text){\n if(text === 'Start'){\n acknowledge();\n } else {\n closeAlert();\n }\n }", "function showAckDialog(map_name, objectId) {\n showFrontendDialog(oGeneralProperties.path_server\n + '?mod=Action&act=acknowledge&map=' + escapeUr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PRIVATE VARIABLES PRIVATE METHODS Called by the event handler to deal with events on the primary control(s).
function handlePrimaryControlEvent(thisObj, source) { var m = thisObj.getMeta(); var h = thisObj.getHtmlIds(); // The ADE element is multivalued. In this case we are only concerned with whether the // NOVAL was just selected or not, since the NOVAL is mutually exclusive with all values, // includin...
[ "function handlePrimaryControlEvent(thisObj, source) {\n var primaryValue, primaryValues;\n var m = thisObj.getMeta();\n \n // The data element is multivalued. In this situation there is not much to do since there\n // is no ADE to show/hide (since a multivalued data element with an ADE is handled v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move scared monsters randomly away from the player position.
function move_scared(i, j) { /* check for a half-speed monster, and check if not to move. Could be done in the monster list build. */ var monster = monsterAt(i, j); switch (monster.arg) { case TROGLODYTE: case HOBGOBLIN: case METAMORPH: case XVART: case STALKER: case ICELIZARD: ...
[ "function scared_move(x, y) {\n let monster = monsterAt(x, y);\n if (!monster) {\n console.log(`scared_move(): no monster at ${x},${y}`);\n return;\n }\n\n /* move in random direction */\n let nx = x + rnd(3) - 2;\n let ny = y + rnd(3) - 2;\n\n if (nx < 0) nx = 0;\n if (nx >= MAXX) nx = MAXX - 1;\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add distance between queried point and store location for each store and coresponding county for county id Note: also sorts stores by distance ascending
function addStoresDistance(stores, query, callback) { var self = this, pStores = [], si, sl, st, lat, lon, checkDistance = false, fromPoint = null, toPoint = null; lat = query.location ? query.location.lat : undefined; lon = query.location ? query.location.lon : undefined; checkDistance = typeof lat !=...
[ "function sortStoresByDistance(location, stores) {\n var i, s;\n\n for (i = 0; i < stores.length; i++) {\n s = stores[i];\n s.distance = geo.getDistanceInMiles(location,\n { lat:s.latitude, lng:s.longitude });\n }\n\n stores.sort(function(a,b) { return a.distance - b.distance; });\n return stores;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate the header of a kernel message.
function validateHeader(header) { for (var i = 0; i < HEADER_FIELDS.length; i++) { validateProperty(header, HEADER_FIELDS[i], 'string'); } }
[ "function validateKernelHeader(header) {\n for (var i = 0; i < HEADER_FIELDS.length; i++) {\n if (!header.hasOwnProperty(HEADER_FIELDS[i])) {\n throw Error(\"Invalid Kernel message: header missing field \" + HEADER_FIELDS[i]);\n }\n if (typeof header[HEADER_FIELDS[i]] !== 'string'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Do a deep copy of the board so we can make modifications that might be reversed
_cloneBoard(board) { let newBoard = []; board.forEach(row => { let newRow = []; row.forEach(sq => newRow.push(sq)); newBoard.push(newRow); }); return newBoard; }
[ "copyBoard(tmpBoard) {\n for (let r = 0; r < this.height; ++r) {\n for (let c = 0; c < this.height; ++c) {\n this.board[r][c] = tmpBoard[r][c];\n }\n }\n }", "copyBoard() {\n this.pseudoBoard.grid = [];\n for(var i = 0; i < this.board.grid.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function updates the front end project display
function updateProjectDisplay(data) { console.log('THE UPDATE DATA = ', data); convertStage(data); updatedManager = { name: data.manager, id: matchUsernameToPerson(data.manager), }; updatedMCSnumber = data.mcsNum; convertItem(data); }
[ "function updateFrontEnd() {\n\tlet from = getParameterByName(\"from\");\n\tif(from == \"projectData\") getTheProjects();\n\telse {\n\t\tclearAndAddSingleRow(\"Retrieving Projects...\");\n\t\tif (getParameterByName('type') === 'findTaskProject') {\n\t\t\t$('#param-field').before('<h3>Select a Project to Create Task...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Walks the model's tree to find the nodes needed to animate the components and saves them to the motionContoller components for use in the frame loop. When touchpads are found, attaches a touch dot to them.
function findNodes(motionController, scene) { // Loop through the components and find the nodes needed for each components' visual responses Object.values(motionController.components).forEach(function (component) { var type = component.type, touchPointNodeName = component.touchPointNodeName, vis...
[ "function findNodes( motionController, scene ) {\n\n\t// Loop through the components and find the nodes needed for each components' visual responses\n\tObject.values( motionController.components ).forEach( ( component ) => {\n\n\t\tconst { type, touchPointNodeName, visualResponses } = component;\n\n\t\tif ( type ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the AWS client key.
setAccessKey(value) { super.put("access_key", value); }
[ "setKey(key) {\n this.apiKey = key;\n }", "setKey(key){\n this.conf.set('apiKey', key);\n return key;\n }", "function setKey (_key) {\n if (_key) key = _key;\n }", "function changeAWSKey(key) {\n var params = {};\n if (key.key)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use blacklist to detemine ether eligbility stat the file, if virgin touch the file and release the ether if file exists check modified date 60 mins touch the file and release
function releaseEther(ipPath,addrPath) { try { let stats = fs.statSync(addrPath); // if not error this address was used.. return false; } catch (err) { try { let stats = fs.statSync(ipPath); // mtime sample 2017-12-29T14:24:26.472Z var mtime = moment(stats['mtime']); ...
[ "function update_blacklist() {\n //blocked websites stored locally in blacklist.txt\n blocked = fs.readFileSync('./blacklist.txt').toString().split('\\n')\n .filter(function(rx) { return rx.length })\n .map(function(rx) { return RegExp(rx) });\n}", "function loadBlacklist() {\n blac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses a env variable that is a number
function parseEnvNumber(key) { const value = Number(process.env[key]); if (Number.isNaN(value) || value < 0) { return undefined; } return value; }
[ "function nodeNum() {\n let num = process.env.ELIFE_NODE_NUM\n if(num) {\n num = parseInt(num)\n if(isNaN(num)) {\n showErr(\"Environment variable ELIFE_NODE_NUM is not a valid number\")\n return 0\n }\n } else {\n num = 0\n }\n return num\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to create an instance of a PromiseArray.
function promiseArray (promise, label) { return DS.PromiseArray.create({ promise: Promise.resolve (promise, label), }); }
[ "static fromArray (array) {\n const promise = Promise.resolve(array)\n return PromisedArray.fromPromise(promise)\n }", "static fromPromise (promise) {\n Object.assign(promise, promisedArrayPrototype)\n Object.defineProperty(promise, 'length', promisedLength)\n return promise\n }", "function Any...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create setter method to set, or change, username property
set username(newUsername) { if (newUsername && newUsername.length === 0) { throw new Error('username must contain more than 0 characters.') } this.#_username = newUsername }
[ "setUsername(username) {\n this.__username = username || \"\";\n }", "setUsername(newUsername) {\n\t\tthis.userName = newUsername;\n\t}", "function updateUsername() {\n userName = \"Monique\";\n}", "function setUsername(username) {\n var originalUsername = state.get(\"originalUsername\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test whether a kernel message is a `'status'` message.
function isStatusMsg(msg) { return msg.header.msg_type === 'status'; }
[ "function isStatusMessage(msg) {\n return msg.header.msg_type === \"status\";\n}", "function status(msg) {\n if (!ariaContainer) {\n return;\n }\n if (platform_1.isMacintosh) {\n alert(msg); // VoiceOver does not seem to support status role\n }\n else {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterate through a layout list and move the given elements to the given positions.
function applyLayoutList(layoutList) { for(var i=0; i<layoutList.length; i++) { var node = layoutList[i]; var plane = node.plane; plane.mesh.position.copy(node.position); plane.lastPosition.copy(node.position); } }
[ "function moveItems() {\n\tif (questLayout != null) {\n\t\tvar initWidth = questLayout.width;\n\t\tvar currentWidth = document.getElementById('questpathBlockContainer').offsetWidth;\n\t\tvar widthRatio = currentWidth/initWidth;\n\t\ttry {\n\t\t\tfor (var i = 0; i < questLayout.qItemLayout.length; i++) {\n\t\t\t\tva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or Sets the list level number for selected paragraphs.
set listLevelNumber(value) { if (value === this.listLevelNumberIn) { return; } this.listLevelNumberIn = value; this.notifyPropertyChanged('listLevelNumber'); }
[ "function getMsWordListLevel(node) {\n if (node.nodeName.toLowerCase() !== 'p') {\n return;\n }\n\n var style = node.getAttribute('style');\n var levelMatch = style && style.match(/mso-list/i) ? style.match(/level(\\d+)/) : null;\n return levelMatch ? parseInt(levelMatch[1], 10) : undefined;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
test if we should display popup menu (right click) used in 'xulmain.xul'
function mymenu_popupshowing(event) { var element = event.target.triggerNode; // get the clicked object //var isTextArea = element instanceof HTMLTextAreaElement; if (!document.getElementById("mybrowser").contentWindow.should_popupmenu(element)) { //alert(element); event.preventDefault(...
[ "function activatePopUpMenuBy() { // Public method\n showValue = typeof(arguments[0]) == \"number\" && arguments[0] > -1 ? arguments[0] : 0;\n if (arguments.length > 1) {\n hideValue = typeof(arguments[1]) == \"number\" && arguments[1] > -1 ? arguments[1] : 0;\n }\n else {\n hideValue = showValue;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set a style property. Adds a `style` property if necessary.
setStyle(property, value) { if (!this._props.style) this._props.style = {}; this._props.style[property] = value; }
[ "function setStyle(element, property, value) {\n element.style[property] = value;\n }", "setStyle(style) {\n this.style = style;\n }", "function setStyle(element, property, value) {\r\n element.style[property] = value;\r\n}", "function setStyle(element, property, value) {\n element.style[pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a login function that launches the Imgur OAuth flow in a new popup window, which will redirect to the Callback URL after success or failure.
function login() { client_id = localStorage.getItem("client_id"); type = localStorage.getItem("type"); window.open('https://api.imgur.com/oauth2/authorize?client_id=' + client_id + '&response_type=' + type, "", "width=980, height=600"); }
[ "function popupLogin(callback) {\r\n window.location.href = authUrl;\r\n }", "fbLogin(){\n /*OAUTH INITIALIZE*/\n OAuth.initialize('06xEp9h-x2w58YbIALBrQWD-UJw');\n\n OAuth.popup('facebook').done(function(result) {\n /*HANDLE RESULT*/ \n})\n}", "startLogin() {\n this.clearAuth();\n this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start next new word to guess.
function nextGuess () { var pauseMusic = setTimeout(function() { allMusic.stop(); }, 1000); currentWord = wordsToGuess[Math.floor(Math.random() * wordsToGuess.length)]; answerArray = [""]; for (var k = 0; k < currentWord.length; k++) { answerArray[k] = "_"; } // Injecting the cu...
[ "function startNewWord() {\n if (wordGuessGame.gameNum < wordGuessGame.words.length) {\n wait = false;\n wordGuessGame.resetLettersGuessed();\n htmlEl.guessedLetters.textContent = wordGuessGame.lettersGuessed;\n\n wordGuessGame.resetGuessesRemainNum();\n writeGuessRemainNum(wordGuessGame.guessesDefa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An instance of the SourceMapGenerator represents a source map which is being built incrementally. You may pass an object with the following properties: file: The filename of the generated source. sourceRoot: A root for all relative URLs in this source map.
function SourceMapGenerator(aArgs){if(!aArgs){aArgs={};}this._file=util.getArg(aArgs,'file',null);this._sourceRoot=util.getArg(aArgs,'sourceRoot',null);this._skipValidation=util.getArg(aArgs,'skipValidation',false);this._sources=new ArraySet();this._names=new ArraySet();this._mappings=new MappingList();this._sourcesCon...
[ "function SourceMapGenerator(aArgs){if(!aArgs){aArgs = {};}this._file = util.getArg(aArgs,'file',null);this._sourceRoot = util.getArg(aArgs,'sourceRoot',null);this._skipValidation = util.getArg(aArgs,'skipValidation',false);this._sources = new ArraySet();this._names = new ArraySet();this._mappings = new MappingList...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs Search Neighborhood Map Control
function SearchNeighborhoodMapControl(controlNode) { const controlUI = document.createElement("div"); controlUI.setAttribute("id", "search-area-control"); controlUI.className = "map-control"; controlUI.title = "Click to search current neighborhood"; controlUI.textContent = "Search current neighborho...
[ "buildNeighbours() {\n this.neighbours.neighbours = new Map();\n for (let X = this.position.x - 1; X <= this.position.x + 1; X++) {\n for (let Y = this.position.y - 1; Y <= this.position.y + 1; Y++) {\n const outbounds = !this.inBounds({ x: X, y: Y });\n let p;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API test for 'GetHubStatus', Get hub status
function Test_GetHubStatus() { return __awaiter(this, void 0, void 0, function () { var in_rpc_hub_status, out_rpc_hub_status; return __generator(this, function (_a) { switch (_a.label) { case 0: console.log("Begin: Test_GetHubStatus"); ...
[ "function getStatus() {\n\tapi({ data: \"cmd=getstatus\" },syncStatus);\n}", "getStatus() {\n return ApiService.get('healthcheck');\n }", "getDavisBotStatus(token) {\n return rp({\n uri: `https://slack.com/api/users.getPresence?token=${token}`,\n json: true,\n });\n }", "static async stat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a CSS class to the quote based on its bibliography type (e.g. GermanLit)
function AddQuoteTypeCssClasses(topQuoteEl, quotes) { $(quotes).each(function() { var source = $(this).data('source').replace(/^#/, ''); var primaryBibRecord = bibliography[source]; if (typeof primaryBibRecord != 'undefined') $(topQuoteEl).addClass(primaryBibRecord.typ...
[ "function cssClass(mark) {\n return 'mark-' + mark.marktype\n + (mark.role ? ' role-' + mark.role : '')\n + (mark.name ? ' ' + mark.name : '');\n}", "function cssClass(mark) {\n return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : '');\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5 dropRight Creates a slice of array with n elements dropped from the end.
function dropRight(array,n) { var arr=array.slice(n); console.log(arr); }
[ "function dropRight(arr, n = 1) {\r\n return arr.slice(0, -n);\r\n}", "function takeRight(array, n) {\n\treturn array.slice(-n);\n}", "drop(array, n){\n if(n === undefined){\n n = 1;\n }\n const droppedArray = array.slice(n, array.length);\n return droppedArray;\n }", "drop (array,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create map legend for US state data:
function createMapLegend() { }
[ "function createStateMap() {\r\n\t//push states to array map\r\n\t//some of these states arn't listed in dataset!\r\n\tstateMap.set('AL', 'Alabama');\r\n\tstateMap.set('AK', 'Alaska');\r\n\tstateMap.set('AZ', 'Arizona');\r\n\tstateMap.set('AR', 'Arkansas');\r\n\tstateMap.set('CA', 'California');\r\n\tstateMap.set('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds and creates all the effect groups for a given response
function gather_effect_groups(response) { var output = []; var input = $(response).find('[name="effectgroup"]:visible'); for(var i = 0; i < input.length; i++) { output[i] = make_effect_group(input[i]); } return output; }
[ "function make_effect_group(elem)\n{\n\tvar output = [];\n\tvar effects = $(elem).find('[name=\"effect\"]:visible');\n\tfor(var i = 0; i < effects.length; i++)\n\t{\n\t\toutput[i] = populate_object_values(EFFECT_FIELDS, effects[i]);\n\t}\n\treturn output;\n}", "regroup() {\n let sampleCount = 0;\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes spareIds that link two DCSOs. called when you have used the spareId
function removeCommonSpareIds(DCSO1, DCSO2) { if (!DCSO1.hasOwnProperty("spareId") || !DCSO2.hasOwnProperty("spareId")) { console.warn("one has no spare Id. Maybe warning"); return; } var len1 = DCSO1['spareId'].length; var len2; outer: for (var i = 0; i < len1; i++) { len2 = DCSO2['spareId'].le...
[ "checkForReleasedIds(){\n for(let i = 0; i < this[usedIds].length; i++){\n let id = this[usedIds][i];\n if(id.Available === 1){\n this[usedIds].splice(i, 1);//remove from usedlist\n this[unusedIds].push(id);\n }\n }\n this.Amount = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the result grid.
generateResultGrid () { this.results = this.shuffleArray(this.baseNumbers) }
[ "#generateGrid() {\n this.#distinctElements = Grid.#getDistinctArray(this.#rows * this.#columns / 2, 1, 21);\n\n for (let i = 0; i < this.#rows; i++) {\n this.#insertRow();\n }\n\n this.#grid = this.#grid.map( row => {\n return row.map( element => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5.3 Request class typedef (Request or USVString) RequestInfo; Constructor(RequestInfo input, optional RequestInit init)
function Request(input, init) { if (arguments.length < 1) throw TypeError('Not enough arguments'); Body.call(this, null); // readonly attribute ByteString method; this.method = 'GET'; // readonly attribute USVString url; this.url = ''; // readonly attribute Headers headers; this.head...
[ "function UserInfoRequest(username,infoType) {\n this.username = function(){\n return username;\n };\n this.infoType = function(){\n return infoType;\n };\n}", "function RequestInfo() {\n\n\tthis.URL = window.location.href;\n\tthis.queryParams = getQueryParams()\n\tthis.framesURL = URL.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display weather on UI
function showWeather() { // remove loader clearLoader(); // update state state.lastUpdate = Date.now(); // render elements renderElements(); // time state.intervalID = setInterval(updateTime, 1000); }
[ "function displayWeather() {\n\n setAirQualityDescIcon();\n \n weatherLocation.innerHTML = `${weather.city}, ${weather.country}`;\n\n airQualityIndex.innerHTML = weather.pollution;\n\n weatherIcon.innerHTML = `<img src=\"/icons/weather/${weather.iconId}.png\"/>`;\n weatherTempIndex.innerHTML = `${weather.temp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create main menu of category cards
function buildMainMenu(menuList) { menuList.forEach(function(element) { var cardTitle = document.createElement("span"); cardTitle.className += "card-title"; cardTitle.textContent = element.name; var cardImage = document.createElement("img"); cardImage.setAttribute("src", element...
[ "function displayItems(category) {\r\n\r\n\tvar categoryItems = menu_items[category]; // { }\r\n\tconsole.log(menu_items);\r\n\tvar subCategory_names = Object.keys(categoryItems); // \r\n\tvar subCatMenu = `<div id=` +`\"` + category +`\"` + `class=\"tab-pane fade in active\">\r\n\t\t<div class=\"col-md-2\">\r\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function to convert primitives to objects (should we allow only string primitives to be converted? as it stands, the number 100 will be converted to "100" which will return a length of 3.)
function toObject(primitive) { if(typeof primitive == "object" && null != primitive) { return primitive; } else { /* if input isn't null, undefined, boolean, or infinity */ if(typeof primitive != "undefined" && typeof primitive != "boolean" && primitive != Infinity && ...
[ "function coercePrimitiveToObject(obj) {\n\t if(isPrimitiveType(obj)) {\n\t obj = object(obj);\n\t }\n\t if(noKeysInStringObjects && isString(obj)) {\n\t forceStringCoercion(obj);\n\t }\n\t return obj;\n\t }", "function numsToObject(number1, number2, number3) {\n\t\treturn {num1:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the new location of the truck and notify the observers. Calculate the difference between the current location and the new one and add to distanceTravelled.
_setLocation(location){ this.location = location; this.notify(UpdateMessage.Relocated); }
[ "updateDistance() {\n this.previousTargetDistance = this.targetDistance;\n this.targetDistance = this.navigator.currentLocation.distanceTo(this.navigator.targetLocation);\n }", "function updateTravelInfo() {\n\tlet m = data.consts.turbo/10 + 1\n\n\tlet d = data.consts.distance.n\n\tif (d >= data....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use the browser Performance API to get the download time for the player js asset
function getPlayerDownloadTime() { try { var timings = performance['getEntries']('resource'); var re = /playercore.*js/; var downloads = timings.filter(function(t) { return re.exec(t['name']) !== null; }); if (downloads && (downloads.length > 0)) { va...
[ "function s_getLoadTime(){if(!window.s_loadT){var b=new Date().getTime(),o=window.performance?performance.timing:0,a=o?o.requestStart:window.inHeadTS||0;s_loadT=a?Math.round((b-a)/100):'';s_loadT=s_loadT/10}return s_loadT}", "function s_getLoadTime(){if(!window.s_loadT){var b=new Date().getTime(),o=window.perform...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================================== PeerConnectionHandler: Manages an RTCPeerConnection. Initialize with "params", an object holding the parameters. params.peerConnectionConfig configuration options for the RTCPeerConnection params.label optional label for the PeerConnectionHa...
function PeerConnectionHandler(params) { //-------------------------------------------------------------------------- // Properties initialization // Configuration options for the RTCPeerConnection var peerConnectionConfig = params.peerConnectionConfig; // Label for the PeerConnectionHandler ...
[ "initPeerConnectionEventHandlers() {\n this.logger.debug(\"SessionDescriptionHandler.initPeerConnectionEventHandlers\");\n if (!this._peerConnection)\n throw new Error(\"Peer connection undefined.\");\n const peerConnection = this._peerConnection;\n peerConnection.onconnection...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Boolean$prototype$lte :: Boolean ~> Boolean > Boolean
function Boolean$prototype$lte(other) { return typeof this === 'object' ? lte (this.valueOf (), other.valueOf ()) : this === false || other === true; }
[ "function Boolean$prototype$lte(other) {\n return typeof this === 'object' ?\n lte(this.valueOf(), other.valueOf()) :\n this === false || other === true;\n }", "lte(other) { return this.cmp(other) <= 0; }", "function Nothing$prototype$lte(other) {\n return true;\n }", "function Null$prototyp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the user picks scissors, then it gets compared against the AI's choice which is generated within the function aiTurn. The aiChoice and lastRound are then passed into the function endRound.
function useScissors() { let aiChoice = aiTurn(); let lastRound = comparator(2, aiChoice); endRound(aiChoice, lastRound); }
[ "function scissorsChoice() {\n var compChoice = showCompResult();\n // Check for win\n if (compChoice === 2) {\n playerDraws();\n } else if (compChoice === 0) {\n playerLoses();\n } else {\n playerWins();\n }\n}", "function evaluateTurn() {\n // pasted from homework need to fix\n if (userChoi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an input base to test against, which could be a String or Number, return a Function that tests whether a given value is less than the base.
function createLessThanFilter(base) { // YOUR CODE BELOW HERE // // return a function that test whether a value is less than the base return function(val){ if(val < base){ return true; } else { return false; } } // YOUR CODE ABOVE HERE // }
[ "function createLessThanFilter(base) {\n // YOUR CODE BELOW HERE //\n \n //I: base is ether a string or a number \n //O:a function \n // we have to return a function that test whether a given value is less than the base\n return function(input){ //create the function to return\n if (base > ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }