_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q56600
finishedInstall
train
function finishedInstall(err) { if (err) { throw new Error(err) } const dictionary = {} for (const i in list) { if (list[i]) { const name = list[i] const transformer = require('jstransformer-' + name) // eslint-disable-line import/no-dynamic-require const formats = transformer.inputFor...
javascript
{ "resource": "" }
q56601
setFilters
train
function setFilters(swig, filters) { for (var
javascript
{ "resource": "" }
q56602
setTags
train
function setTags(swig, tags) { var name, tag; for (name in tags) { tag = tags[name];
javascript
{ "resource": "" }
q56603
setExtensions
train
function setExtensions(swig, extensions) { for (var
javascript
{ "resource": "" }
q56604
train
function (token, context, chain) { var // Parse the output without any filter unfiltered = Twig.parse.apply(this, [token.output, context]), // A regular expression to find closing and opening tags with spaces between them rBetweenTagSpaces = />\s+<...
javascript
{ "resource": "" }
q56605
configContext
train
function configContext (next) { if (options.raw) { // Tmp file is only available within the context of this function tmp.file({ prefix: '_config.', postfix: '.yml' }, function (err, path, fd) { rawConfigFile = path; if (err) { grunt.fail.warn(err); }
javascript
{ "resource": "" }
q56606
train
function(stylesheet, refresh){ if( icons && !refresh ){ return icons; } icons = {}; // get grunticon stylesheet by its href var svgss, rules, cssText, iconClass, iconSVGEncoded, iconSVGRaw; svgss = stylesheet.sheet; if( !svgss ){ return icons; } rules = svgss.cssRules ? svgss.cssRules : sv...
javascript
{ "resource": "" }
q56607
getInstalledPathSync
train
function getInstalledPathSync (name, opts) { if (!isValidString(name)) { throw new TypeError('get-installed-path: expect `name` to be string') } const filePaths = defaults(name, opts) const firstPath = filePaths[0] const modulePath = filePaths.find((filePath) => { let stat = null try {
javascript
{ "resource": "" }
q56608
DragTabs
train
function DragTabs($el, options) { // we are an event emitter assign(this, createEmitter()); this.options = options || {}; this.$el = $el; this._moveTab = bind(this._moveTab, this); this._onDragstart = bind(this._onDragstart,
javascript
{ "resource": "" }
q56609
SMTPPool
train
function SMTPPool(options) { EventEmitter.call(this); options = options || {}; if (typeof options === 'string') { options = { url: options }; } var urlData; var service = options.service; if (typeof options.getSocket === 'function') { this.getSocket = o...
javascript
{ "resource": "" }
q56610
PoolResource
train
function PoolResource(pool) { EventEmitter.call(this); this.pool = pool; this.options = pool.options; this.logger = this.options.logger; this._connection = false;
javascript
{ "resource": "" }
q56611
addReverseLookupsForExtendeds
train
function addReverseLookupsForExtendeds (reverseDict, dict) { Object.keys(dict).forEach(function (key) { let pair = dict[key] let quality = pair[0] let extendedsArr = pair[1] extendedsArr.forEach(function
javascript
{ "resource": "" }
q56612
dist_p_sep
train
function dist_p_sep() { i = s[q] gi = array[ptr+i]
javascript
{ "resource": "" }
q56613
predictOneDT
train
function predictOneDT(inst) { var n=0; for(var i=0;i<this.maxDepth;i++) { var dir= this.testFun(inst, this.models[n]); if(dir === 1) n= n*2+1; // descend left else n= n*2+2; // descend right }
javascript
{ "resource": "" }
q56614
entropy
train
function entropy(labels, ix) { var N= ix.length; var p=0.0; for(var i=0;i<N;i++) {
javascript
{ "resource": "" }
q56615
initConfig
train
function initConfig(conf) { const result = Object.assign({}, conf); if (conf.filename) {
javascript
{ "resource": "" }
q56616
lookupFile
train
function lookupFile(conf, fileRelative) { const relativeToFile = path.resolve(conf.filepath, fileRelative); if (layoutHelper.store.exist(relativeToFile)) { return relativeToFile; } if (conf.settings && conf.settings.views) { if (!Array.isArray(conf.settings.views)) { const fromView = path.resolve...
javascript
{ "resource": "" }
q56617
train
function (req, file, cb) { const id = guid(); file.id = id; fs.writeFileSync(path.normalize(tempFolder + "/" + id
javascript
{ "resource": "" }
q56618
isReactElement
train
function isReactElement(suspectedElement) { var isElem = false; if (React.isValidElement(suspectedElement)) { isElem = true; } else if (Array.isArray(suspectedElement)) {
javascript
{ "resource": "" }
q56619
initialize
train
function initialize(url) { this.socket = Requests[Requests.method](this); // // Open the socket BEFORE adding any properties to the instance as this might // trigger a thrown `InvalidStateError: An attempt was made to use an object // that is not, or is no longer, usable` error in FireFox: // ...
javascript
{ "resource": "" }
q56620
open
train
function open() { var what , slice = true , requests = this , socket = requests.socket; requests.on('stream', function stream(data) { if (!slice) { return requests.emit('data', data); } // // Please note that we need to use a method here that works on both str...
javascript
{ "resource": "" }
q56621
destroy
train
function destroy() { if (!this.socket) return false; this.emit('destroy'); this.socket.abort(); this.removeAllListeners(); this.headers = {}; this.socket
javascript
{ "resource": "" }
q56622
trimActions
train
function trimActions(actions) { // TODO: maybe, instead of doing this, add a last screenshot here. It's // mostly due to mistakes var lastScreenshotIndex = _.findLastIndex(actions, function(a) {
javascript
{ "resource": "" }
q56623
getBrowserName
train
function getBrowserName(driver) { var prom = new Promise(function(resolve, reject) { driver .getCapabilities() .then(function(res) {
javascript
{ "resource": "" }
q56624
defaultWorkflow
train
function defaultWorkflow(opts) { var tasks; var paths; var runnableTasks; var runnablePaths; return execP('git status') .then(function() { return getUnchanged(opts.globs); }) .spread(function(a, b) { tasks = a; paths = b; console.log( 'Executing: ' + '`git stash &&...
javascript
{ "resource": "" }
q56625
filterFilesForUnchangedTasks
train
function filterFilesForUnchangedTasks(before, after, paths) { var pathsRes = []; var tasksRes = []; for (var i = 0; i < before.length; i++) { var unchangedTasks = filterUnchangedTasks(before[i], after[i]); if (unchangedTasks.length > 0)
javascript
{ "resource": "" }
q56626
Struct
train
function Struct () { debug('defining new struct "type"') /** * This is the "constructor" of the Struct type that gets returned. * * Invoke it with `new` to create a new Buffer instance backing the struct. * Pass it an existing Buffer instance to use that as the backing buffer. * Pass in an Object co...
javascript
{ "resource": "" }
q56627
StructType
train
function StructType (arg, data) { if (!(this instanceof StructType)) { return new StructType(arg, data) } debug('creating new struct instance') var store if (Buffer.isBuffer(arg)) { debug('using passed-in Buffer instance to back the struct', arg) assert(arg.length >= StructType.siz...
javascript
{ "resource": "" }
q56628
set
train
function set (buffer, offset, value) { debug('Struct "type" setter for buffer at offset', buffer, offset, value) var isStruct = value instanceof this if (isStruct) { // optimization: copy the buffer contents directly rather // than going through the ref-struct constructor
javascript
{ "resource": "" }
q56629
train
function (out) { var skinObj = this._skinObj, cfg = this._cfg; out.write(['<div class="x', this._skinnableClass, '_', cfg.sclass, '" style="float:left;position:relative', skinObj.border ? ';border:' + skinObj.border : '',
javascript
{ "resource": "" }
q56630
train
function (out) { var skinObj = this._skinObj, cfg = this._cfg; out.write(['<span style="float:left;text-align:', cfg.labelAlign, skinObj.labelMargins ? ';margin:' + skinObj.labelMargins : '', skinObj.labelFontSize ? ';font-size:' + skinObj.labelFontSize + ...
javascript
{ "resource": "" }
q56631
train
function () { if (!this._cfgOk) { return; } var cfg = this._cfg; if (cfg !== null) {
javascript
{ "resource": "" }
q56632
train
function (newValue) { var gaugeSpanIndex = this.showLabel ? 1 : 0; var barEl = this.getDom().childNodes[gaugeSpanIndex].firstChild;
javascript
{ "resource": "" }
q56633
train
function (newValue) { var barEl = this.getDom().childNodes[0]; if (barEl !== null) {
javascript
{ "resource": "" }
q56634
train
function (newValue) { if (!this._cfgOk) { return -1; } var cfg = this._cfg; var res = null; if (cfg !== null) { if (newValue !== null && newValue !== "" && newValue >= cfg.minValue && newValue <= cfg.maxValue) { ...
javascript
{ "resource": "" }
q56635
train
function (skipChangeState) { var state = "normal"; var cfg = this._cfg; if (cfg.disabled) { state = "disabled"; } else if (cfg.tabId === cfg.selectedTab) { state = "selected"; } else {
javascript
{ "resource": "" }
q56636
train
function () { this.changeProperty("selectedTab", this._cfg.tabId); if (this._cfg.waiAria) { // Focusing the Tab before focusing the TabPanel is not enough to make the screen reader read the tab's title first // A sufficient timeout would be necessary, but we
javascript
{ "resource": "" }
q56637
PromisedHandler
train
function PromisedHandler () { this.getSuggestions = function (entry, callback) { this.pendingSuggestion = { entry : entry, callback : callback
javascript
{ "resource": "" }
q56638
resourcesHandlerError
train
function resourcesHandlerError (args) { var scope = args.scope; // resources handler is not an AT class, no need to dispose scope._autoDisposeHandler = false;
javascript
{ "resource": "" }
q56639
resourcesHandlerLoaded
train
function resourcesHandlerLoaded (args) { var scope = args.scope, handler = Aria.getClassInstance(args.classpath); var pendingSuggestion = scope._resourcesHandler.pendingSuggestion; scope._resourcesHandler = handler; scope._autoDisposeHandler = true; if (pendingSuggestion) { ...
javascript
{ "resource": "" }
q56640
delayLoading
train
function delayLoading (args) { ariaCoreTimer.addCallback({ fn : resourcesHandlerLoaded, args : args,
javascript
{ "resource": "" }
q56641
loadResourcesHandler
train
function loadResourcesHandler (classpath, self) { var Handler = Aria.getClassRef(classpath); if (Handler) { return new Handler(); } else { var callbackArgs = { scope : self, classpath : classpath
javascript
{ "resource": "" }
q56642
train
function (resourcesHandler) { if (ariaUtilsType.isString(resourcesHandler)) { resourcesHandler = loadResourcesHandler(resourcesHandler, this);
javascript
{ "resource": "" }
q56643
train
function (internalValue) { var report = new ariaWidgetsControllersReportsControllerReport(); if (internalValue == null) { report.ok = true; this._dataModel.jsDate = null; this._dataModel.displayText = ""; } else if (!ariaUtilsType.isDat...
javascript
{ "resource": "" }
q56644
train
function(receiver, name, state) { if (state == null) { state = true;
javascript
{ "resource": "" }
q56645
train
function(source, destination) { // -------------------------------------------- arguments processing if (destination == null) { destination = this; } // ------------------------------------------------------ processing for (var key in source...
javascript
{ "resource": "" }
q56646
train
function(userAgentWrapper) { // ----------------------------------------------- early termination var cacheKey = userAgentWrapper.ua.toLowerCase(); var values; if (this._propertiesCache.hasOwnProperty(cacheKey)) { values = this._propertiesCache[cacheKey]...
javascript
{ "resource": "" }
q56647
train
function() { this._styleCache = {}; // ----------------------------------------------------------------- this.ua = ""; this.name = ""; this.version = ""; this.majorVersion = 0; /* BACKWARD-COMPATIBILITY-BEGIN (GitHub #1397) */ ...
javascript
{ "resource": "" }
q56648
train
function(userAgent) { var userAgentWrapper = UserAgent.getUserAgentInfo(userAgent); // ----------------------------------------- reset /apply properties this._resetProperties(); var properties = this._getProperties(userAgentWrapper); this._import(properties...
javascript
{ "resource": "" }
q56649
train
function (property) { // ----------------------------------------------------------- cache if (this._styleCache.hasOwnProperty(property)) { return this._styleCache[property]; } // ------------------------------------------------------ processing ...
javascript
{ "resource": "" }
q56650
train
function (coord) { this.posX = coord.x; this.posY = coord.y; this._mouseInitialPosition = { left : coord.x, top : coord.y }; var element = this.getElement(true), movable, document = Aria.$window.document; // This wil...
javascript
{ "resource": "" }
q56651
train
function (evt) { var movable = this.getMovable(); if (movable && movable.style) { var mouseInitPos = this._mouseInitialPosition; var movableInitPos = this._movableInitialGeometry; var offsetX = this._vertical ? 0 : evt.clientX - mouseInitPos.left...
javascript
{ "resource": "" }
q56652
train
function () { var element = this.getElement(); var document = Aria.$window.document; document.onselectstart = Aria.returnTrue; element.onselectstart = Aria.returnTrue; if (this.proxy && this.proxy.overlay) { element.style.top = (this._elementI...
javascript
{ "resource": "" }
q56653
train
function (geometry, cursor, offX, offY) { var geometry = ariaUtilsJson.copy(geometry), trim = ariaUtilsString.trim; cursor = trim(cursor); var offsetX = geometry.width >= this.minWidth ? offX : 0; var offsetY = geometry.height >= this.minHeight ? offY : 0; sw...
javascript
{ "resource": "" }
q56654
train
function (geometry) { var boundary = this._boundary; if (boundary) { var boundaryGeometry = boundary; if (boundary == ariaUtilsDom.VIEWPORT) { var viewportSize = ariaUtilsDom._getViewportSize(); boundaryGeometry = { ...
javascript
{ "resource": "" }
q56655
train
function (element) { var position = ariaUtilsDom.getOffset(element); position.width = element.offsetWidth; position.height = element.offsetHeight; var style = element.style; this._elementInitialPosition = position; style.position = "absolute";
javascript
{ "resource": "" }
q56656
train
function (event, template) { this.moduleCtrl.displayHighlight(template.templateCtxt.getContainerDiv()); this.data.overModuleCtrl = template.moduleCtrl; this.mouseOver(event);
javascript
{ "resource": "" }
q56657
train
function (event, template) { // this.moduleCtrl.clearHighlight(); this.data.overModuleCtrl = null; this.mouseOut(event);
javascript
{ "resource": "" }
q56658
train
function (event, module) { this.data.overTemplates = module.outerTemplateCtxts; this.mouseOver(event); this._refreshTemplatesDisplay();
javascript
{ "resource": "" }
q56659
train
function (classpath) { var basePath = Aria.getLogicalPath(classpath); for (var i = 0, l = atExtensions.length; i < l; i++) { try { var logicalPath = basePath + atExtensions[i]; var cacheItem = require.cache[require.resolve(logicalPath)]; ...
javascript
{ "resource": "" }
q56660
train
function (id) { if (ariaCoreBrowser.isIE7) { this.getElementById = function (id) { var document = Aria.$window.document; var el = document.getElementById(id); if (el) { // If id match, return element ...
javascript
{ "resource": "" }
q56661
train
function (domElt, count) { if (count == null) { count = 1; } while (domElt && count > 0) { domElt = domElt.nextSibling;
javascript
{ "resource": "" }
q56662
train
function (domElt, count) { if (count == null) { count = 1; } while (domElt && count > 0) { domElt = domElt.previousSibling;
javascript
{ "resource": "" }
q56663
train
function (parentNode, index, reverse) { if (!parentNode) { return null; } var childNodes = parentNode.childNodes, count = 0, l = childNodes.length; for (var i = (reverse) ? l - 1 : 0; (reverse) ? i >= 0 : i < l; (reverse) ? i-- : i++) { if ...
javascript
{ "resource": "" }
q56664
train
function (idOrElt, newHTML) { // PROFILING // var msr1 = this.$startMeasure("ReplaceHTML"); var domElt = idOrElt; if (typeof(domElt) == "string") { domElt = this.getElementById(domElt); } if (domElt) { if ((ariaCoreBrowser.isIE...
javascript
{ "resource": "" }
q56665
train
function (oldElt, newElt) { var parentNode = oldElt.parentNode;
javascript
{ "resource": "" }
q56666
train
function (domElt, where, html) { if (Aria.$window.document.body.insertAdjacentHTML) { this.insertAdjacentHTML = function (domElt, where, html) { // PROFILING // var msr = this.$startMeasure("insertAdjacentHTML"); // IE, Chrome, Safari, Opera ...
javascript
{ "resource": "" }
q56667
train
function (domElt, where, newElement) { if (Aria.$window.document.body.insertAdjacentElement) { this.insertAdjacentElement = function (domElt, where, newElement) { domElt.insertAdjacentElement(where, newElement); }; } else { // F...
javascript
{ "resource": "" }
q56668
train
function (src, dest) { // IE has a mergeAttributes method which does exactly that. Let's use it directly. // Note that copying attributes with a loop on attributes and setAttributes has strange results on IE7 (for // example, a TR can appear as disabled) if (Aria.$window....
javascript
{ "resource": "" }
q56669
train
function () { if (ariaCoreBrowser.isIOS || ariaCoreBrowser.isAndroid) { // Initially (without user-initiated zoom) window's dimensions are the same or nearly the same as // documentElement's. // Note however that documentElement's clientWidth/Height is unaffec...
javascript
{ "resource": "" }
q56670
train
function (base) { var document = base && base.ownerDocument ? base.ownerDocument : Aria.$window.document; var scrollLeft = 0; var scrollTop = 0; var documentScroll = this.getDocumentScrollElement(document); if (base != null) { var next = base;...
javascript
{ "resource": "" }
q56671
train
function () { // https://developer.mozilla.org/en/DOM/window.scrollMaxY suggests not to use scrollMaxY // Take the maximum between the document and the viewport srollWidth/Height // PTR 04677501 AT-Release1.0-36 release bug fixing: Safari has the correct scrollWidth and scrollHeight ...
javascript
{ "resource": "" }
q56672
train
function (element, property) { var browser = ariaCoreBrowser; var isIE8orLess = browser.isIE8 || browser.isIE7; if (isIE8orLess) { this.getStyle = function (element, property) { if (property == 'opacity') {// IE<=8 opacity uses filter ...
javascript
{ "resource": "" }
q56673
train
function (size, base) { var viewportSize = this._getViewportSize(); var documentScroll = this._getDocumentScroll(base); return { left : parseInt(documentScroll.scrollLeft + (viewportSize.width - size.width) / 2, 10),
javascript
{ "resource": "" }
q56674
train
function (position, size, base) { var viewportSize = this._getViewportSize(); var documentScroll = this._getDocumentScroll(base); if (position.top < documentScroll.scrollTop || position.left < documentScroll.scrollLeft || position.top + size.height > documentScro...
javascript
{ "resource": "" }
q56675
train
function (needle, haystack) { needle.width = needle.width || 0; needle.height = needle.height || 0; if (haystack == this.VIEWPORT) { return this.isInViewport({ left : needle.x, top : needle.y }, { ...
javascript
{ "resource": "" }
q56676
train
function (position, size, base) { var viewportSize = this._getViewportSize(); var documentScroll = this._getDocumentScroll(base); var minTopValue = documentScroll.scrollTop; var maxTopValue = Math.max(0, documentScroll.scrollTop + viewportSize.height - size.height); ...
javascript
{ "resource": "" }
q56677
train
function (geometry, container) { geometry.width = geometry.width || 0; geometry.height = geometry.height || 0; if (container == this.VIEWPORT) { container = this.getViewportSize(); container.x = container.y = 0; } container.widt...
javascript
{ "resource": "" }
q56678
train
function (child, parent) { if (!(child && child.ownerDocument)) { return false; } var document = child.ownerDocument; var body = document.body; var element = child; while (element && element != body) { if (element ==...
javascript
{ "resource": "" }
q56679
train
function (element, alignTop) { var document = element.ownerDocument; var origin = element, originRect = origin.getBoundingClientRect(); var hasScroll = false; var documentScroll = this.getDocumentScrollElement(document); while (element) { if ...
javascript
{ "resource": "" }
q56680
train
function (element, opacity) { var browser = ariaCoreBrowser; var isIE8OrLess = (browser.isIE8 || browser.isIE7); this.setOpacity = isIE8OrLess ?
javascript
{ "resource": "" }
q56681
train
function (domElt) { // work-around for http://crbug.com/240772 var values = []; var parent = domElt; while (parent && parent.style) { values.push(parent.style.cssText); parent.style.overflow = "hidden";
javascript
{ "resource": "" }
q56682
train
function (widget, msgArgs) { if (widget._context) { if (!msgArgs) { msgArgs = []; }
javascript
{ "resource": "" }
q56683
train
function (id) { var dynamicIds = this._dynamicIds; if (dynamicIds) { var index = arrayUtils.indexOf(dynamicIds, id); if (index != -1) { idMgr.releaseId(id); if (dynamicIds.length == 1) { ...
javascript
{ "resource": "" }
q56684
train
function () { var dynamicIds = this._dynamicIds; if (dynamicIds) { for (var i = dynamicIds.length
javascript
{ "resource": "" }
q56685
train
function (m) { if (this._delegateMap) { if (m || m === 0) { // String cast m = '' + m; var closingIndex = m.indexOf(">"); if (closingIndex != -1) { var delegate...
javascript
{ "resource": "" }
q56686
train
function (event) { var eventWrapper = new ariaTemplatesDomEventWrapper(event), result = true; var targetCallback = delegateMap[event.type]; if (targetCallback) {
javascript
{ "resource": "" }
q56687
train
function (eventName, callback) { // do nothing if no section is defined (partial refresh usecase) if (!this._currentSection) { return; } var delegate = ariaUtilsDelegate; // Fallback mechanism for event that can not b...
javascript
{ "resource": "" }
q56688
train
function () { var res = this._topSection; res.html = this._out.join(""); this._delegate = null; this._out = null;
javascript
{ "resource": "" }
q56689
train
function (domEvt) { if (domEvt.keyCode == aria.DomEvent.KC_ENTER) { if (this._keyPressed) { this._keyPressed = false; if (!this._performAction(domEvt)) {
javascript
{ "resource": "" }
q56690
train
function () { if (__scrollBarsWidth != null) { return __scrollBarsWidth; } var document = Aria.$window.document; var o = document.createElement("div"); // outer div var i = document.createElement("div"); // inner div ...
javascript
{ "resource": "" }
q56691
train
function (request) { var iFrame; var browser = ariaCoreBrowser; var document = Aria.$frameworkWindow.document; // Issue when using document.createElement("iframe") in IE7 if (browser.isIE7) { var container = document.createElement("div"); ...
javascript
{ "resource": "" }
q56692
train
function (request, callback) { var form = request.form; form.target = "xIFrame" + request.id; form.action = request.url; form.method = request.method; if (request.headers["Content-Type"]) { try { // in IE 8, setting form.enc...
javascript
{ "resource": "" }
q56693
train
function (event) { // This method cannot use 'this' because the scope is not aria.core.transport.IFrame when this method is // called. It uses oSelf instead. var event = event || Aria.$frameworkWindow.event; var iFrame = event.target || event.srcElement; if (!...
javascript
{ "resource": "" }
q56694
train
function (id) { var description = this._requests[id]; if (!description) { // The request was aborted return; } var request = description.request; var callback = description.cb; var iFrame = request.iFrame; ...
javascript
{ "resource": "" }
q56695
train
function (request) { var iFrame = request.iFrame; if (iFrame) { var domEltToRemove = request.iFrameContainer || iFrame; domEltToRemove.parentNode.removeChild(domEltToRemove);
javascript
{ "resource": "" }
q56696
train
function (evt) { var args = (this._apply === true && ariaUtilsType.isArray(this._args)) ? this._args.slice() : [this._args]; var resIndex = (this._resIndex === undefined) ? 0 : this._resIndex; if (resIndex > -1) {
javascript
{ "resource": "" }
q56697
train
function (domEvt) { if (domEvt.keyCode == domEvt.KC_ENTER) { if (this._checkTargetBeforeSubmit(domEvt.target)) { var onSubmit = this._cfg.onSubmit; if
javascript
{ "resource": "" }
q56698
train
function (out) { var label = this._cfg.label; if (label && this._cfg.waiAria) {
javascript
{ "resource": "" }
q56699
train
function (out) { this._frame.writeMarkupEnd(out); var label = this._cfg.label; if (label) { var ariaHidden = this._cfg.waiAria ? ' aria-hidden="true"' : '';
javascript
{ "resource": "" }