_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q7200
train
function(scopes) { console.log('iamInterface.group.addScopes', scopes); corbel.validate.value('id', this.id); return this.request({ url: this._buildUriWithDomain(this.uri, this.id) + '/scope',
javascript
{ "resource": "" }
q7201
train
function(email) { console.log('iamInterface.email.availability', email); corbel.validate.value('email', email); return this.request({ url: this._buildUriWithDomain(this.uri, email), method: corbel.request.method.HEAD
javascript
{ "resource": "" }
q7202
train
function(srcType, srcId, destType, destId) { var urlBase = this.driver.config.getCurrentEndpoint(corbel.Resources.moduleName, this._buildPort(this.driver.config)); var domain = this.driver.config.get(corbel.Iam.IAM_DOMAIN, 'unauthenticated'); var customDomain = this.dri...
javascript
{ "resource": "" }
q7203
train
function(destId, relationData, options) { options = this.getDefaultOptions(options); corbel.validate.value('destId', destId); var args = corbel.utils.extend(options, { url: this.buildUri(this.type, this.srcId, this.destType, destId), ...
javascript
{ "resource": "" }
q7204
train
function(relationData, options) { options = this.getDefaultOptions(options); var args = corbel.utils.extend(options, { url: this.buildUri(this.type, this.srcId, this.destType),
javascript
{ "resource": "" }
q7205
train
function(destId, pos, options) { corbel.validate.value('destId', destId); var positionStartId = destId.indexOf('/'); if (positionStartId !== -1) { destId = destId.substring(positionStartId + 1); } options = this.getDefa...
javascript
{ "resource": "" }
q7206
train
function(data, options) { options = this.getDefaultOptions(options); var args = corbel.utils.extend(options, { url: this.buildUri(this.type), method: corbel.request.method.POST, contentType: options.dataType, ...
javascript
{ "resource": "" }
q7207
train
function(data, options) { options = this.getDefaultOptions(options); var args = corbel.utils.extend(options, { url: this.buildUri(this.type), method: corbel.request.method.PUT,
javascript
{ "resource": "" }
q7208
train
function(acl) { var args = { url: this.buildUri(this.type, this.id), method: corbel.request.method.PUT, data: acl,
javascript
{ "resource": "" }
q7209
train
function() { console.log('oauthInterface.authorization.dialog'); var that = this; return this.request({ url: this._buildUri(this.uri + '/authorize'), method: corbel.request.method.GET, dataType: 'tex...
javascript
{ "resource": "" }
q7210
train
function(username, password, setCookie, redirect) { console.log('oauthInterface.authorization.login', username + ':' + password); if (username) { this.params.data.username = username; } if (password) { this.params....
javascript
{ "resource": "" }
q7211
train
function() { console.log('oauthInterface.authorization.signOut'); delete this.params.data; return this.request({ url: this._buildUri(this.uri + '/signout'), method: corbel.request.method.GET,
javascript
{ "resource": "" }
q7212
train
function(user) { console.log('oauthInterface.user.create', user); return this.request({ url: this._buildUri(this.uri), method: corbel.request.method.POST, headers: { Authorization: 'Basic...
javascript
{ "resource": "" }
q7213
train
function(notification) { console.log('notificationsInterface.notification.sendNotification', notification); this.uri += '/send'; return this.request({
javascript
{ "resource": "" }
q7214
train
function(couponIds) { console.log('ecInterface.order.prepare'); corbel.validate.value('id', this.id); return this.request({ url: this._buildUri(this.uri, this.id, '/prepare'),
javascript
{ "resource": "" }
q7215
train
function(data) { console.log('ecInterface.order.checkout'); if (!data.paymentMethodIds) { return Promise.reject(new Error('paymentMethodIds lists needed')); } if (!data.paymentMethodIds.length) { return Promise.reje...
javascript
{ "resource": "" }
q7216
train
function(product) { console.log('ecInterface.product.create', product); return this.request({ url: this._buildUri(this.uri), method: corbel.request.method.POST,
javascript
{ "resource": "" }
q7217
train
function(eventData) { if (!eventData) { throw new Error('Send event require data'); } console.log('evciInterface.publish', eventData); corbel.validate.value('eventType', this.eventType); return this.request({ ...
javascript
{ "resource": "" }
q7218
train
function(id) { var resource = new corbel.Borrow.BorrowBuilder(id); resource.driver =
javascript
{ "resource": "" }
q7219
train
function(id) { var lender = new corbel.Borrow.LenderBuilder(id); lender.driver =
javascript
{ "resource": "" }
q7220
train
function(id) { var user = new corbel.Borrow.UserBuilder(id); user.driver =
javascript
{ "resource": "" }
q7221
train
function(license) { console.log('borrowInterface.resource.addLicense', license); corbel.validate.value('id', this.id); return this.request({ url: this._buildUri(this.uri, this.id, 'license'),
javascript
{ "resource": "" }
q7222
train
function() { console.log('borrowInterface.user.getAllLoans', this.id); return this.request({
javascript
{ "resource": "" }
q7223
train
function(lender) { console.log('borrowInterface.lender.update'); return this.request({ url: this._buildUri(this.uri, this.id),
javascript
{ "resource": "" }
q7224
train
function(id) { var phraseBuilder = new corbel.CompoSR.PhraseBuilder(id); phraseBuilder.driver =
javascript
{ "resource": "" }
q7225
train
function() { var requestBuilder = new corbel.CompoSR.RequestBuilder(Array.prototype.slice.call(arguments));
javascript
{ "resource": "" }
q7226
train
function(params) { corbel.validate.value('id', this.id); var options = params ? corbel.utils.clone(params) : {}; var args = corbel.utils.extend(options, { url: this._buildUriWithDomain(this.id),
javascript
{ "resource": "" }
q7227
train
function(driver) { this.driver = driver; return function(id) {
javascript
{ "resource": "" }
q7228
FunctionCall
train
function FunctionCall( fn , isAsync , thisArg , ... args ) { this.function = fn ; this.isAsync = isAsync ; this.this = thisArg ; this.args = args ; this.hasThrown = false ; this.error = undefined ; this.return = undefined ; try { this.return = this.function.call( this.this || null , ... this.args ) ; } cat...
javascript
{ "resource": "" }
q7229
train
function (commandName, fn) { var config = this.config;
javascript
{ "resource": "" }
q7230
WPCOMUnpublished
train
function WPCOMUnpublished( token, reqHandler ) { if ( ! ( this instanceof WPCOMUnpublished ) ) { return new WPCOMUnpublished( token,
javascript
{ "resource": "" }
q7231
toUrl
train
function toUrl(mId) { const parsed = parse(mId); let url = parsed.bareId; if (url[0] !== '/' && !url.match(/^https?:\/\//)) url = _baseUrl + url;
javascript
{ "resource": "" }
q7232
runtimeReq
train
function runtimeReq(mId) { const parsed = parse(mId); return _fetch(parsed.cleanId) .then(response => { // ensure default user space define.switchToUserSpace(); for (let i = 0, len = _translators.length; i < len; i++) { const result = _translators[i](parsed, response); if (result && typeo...
javascript
{ "resource": "" }
q7233
userReqFromBundle
train
function userReqFromBundle(mId) { const possibleIds = nodejsIds(mId); const bundleName = Object.keys(_bundles).find(bn => { const {nameSpace, user} = _bundles[bn]; return possibleIds.some(d => { if (nameSpace) { const parsed = parse(d); if (parsed.bareId.slice(0, nameSpace.length + 1) ...
javascript
{ "resource": "" }
q7234
packageReqFromBundle
train
function packageReqFromBundle(mId) { const possibleIds = nodejsIds(mId); const bundleName = Object.keys(_bundles).find(bn => possibleIds.some(d => { const pack = _bundles[bn].package; if (pack.hasOwnProperty(d)) return true; const p = parse(d); // For module with unknown plugin prefix, t...
javascript
{ "resource": "" }
q7235
loadBundle
train
function loadBundle(bundleName) { if (!_bundleLoad[bundleName]) { const mappedBundleName = _paths[bundleName] || bundleName; const url = toUrl(mappedBundleName); const {nameSpace} = _bundles[bundleName] || {}; let job; // I really hate this. // Use script tag, not fetch, only to support sourc...
javascript
{ "resource": "" }
q7236
nameSpacedDefine
train
function nameSpacedDefine(nameSpace, id, deps, callback) { // only add name space for modules in user space // also skip any ext: plugin (a dumber-module-loader feature) if (currentSpace === userSpace && id.slice(0, 4) !== 'ext:') { const parsed
javascript
{ "resource": "" }
q7237
requireFunc
train
function requireFunc() { if (typeof arguments[0] === 'string') { const dep = arguments[0]; const got = defined(dep); if (got) return got.val;
javascript
{ "resource": "" }
q7238
loadWasm
train
function loadWasm(name, req, load) { req(['raw!' + name], response => { response.arrayBuffer().then(buffer => WebAssembly.instantiate(buffer, /*importObject*/) )
javascript
{ "resource": "" }
q7239
config
train
function config(opts) { if (!opts) return; if (opts.baseUrl) _baseUrl = parse(opts.baseUrl).bareId + '/'; if (opts.paths) { Object.keys(opts.paths).forEach(path => { let alias = opts.paths[path]; _paths[cleanPath(path)] = cleanPath(alias); }); } if (opts.bundles) { Object.keys(opts.b...
javascript
{ "resource": "" }
q7240
train
function () { var name, index = i; if (input.charAt(i) === '@' && (name = $(/^@@?[\w-]+/))) {
javascript
{ "resource": "" }
q7241
validateComponent
train
function validateComponent(def, name) { let e = 'Invalid component definition: ' + name; // Check that it's an object if (typeof def !== 'object' && def !== null && def !== undefined) { throw new Error(e + ' must be an object, null or undefined'); } // Check that is object has a setup function if (!(def...
javascript
{ "resource": "" }
q7242
renderGraph
train
function renderGraph(componentDirectory, sortedComponents) { let dot = [ '// This graph shows all dependencies for this loader.', '// You might find http://www.webgraphviz.com/ useful!', '', 'digraph G {', ]; for (let component of sortedComponents) { dot.push(util.format(' "%s"', component))...
javascript
{ "resource": "" }
q7243
load
train
function load(target) { if (!loaded[target]) { var def = componentDirectory[target]; // Initialize component, this won't cause an infinite loop because // we've already check that the componentDirectory is a DAG let requires = def.requires || []; return loaded[target] = Pro...
javascript
{ "resource": "" }
q7244
train
function (element) { var self = this; var $el = self.$el; // 隐藏当然不包含了 // 隐藏当然不包含了 if (!self.get('visible') || !$el) { return false; } if ($el && ($el[0] === element || $el.contains(element))) { return true; ...
javascript
{ "resource": "" }
q7245
afterHighlightedItemChange
train
function afterHighlightedItemChange(e) { if (e.target.isMenu) { var el =
javascript
{ "resource": "" }
q7246
train
function (v, e) { var self = this; self.callSuper(v, e); // sync // sync if (!e) { return; } if (e.fromMouse) { return; } if (v && !e.fromKeyboard) {
javascript
{ "resource": "" }
q7247
train
function (e) { var self = this, menu = self.get('menu'), menuChildren, menuChild, hasKeyboardControl_ = menu.get('visible'), keyCode = e.keyCode; if (!hasKeyboardControl_) { // right if (keyCode === KeyCode.RIGHT) { showMenu.call(self); ...
javascript
{ "resource": "" }
q7248
forEach
train
function forEach(callback, thisArg = UNDEFINED, defaultReturn = UNDEFINED) { const savedReturn = BREAK.clearDefault(defaultReturn); const iMax = this.length; let result = thisArg; for (let i = 0; i < iMax; i++) { const value = this[i]; const returned = callback.call(thisArg, value, i, th...
javascript
{ "resource": "" }
q7249
SiteWordAdsTOS
train
function SiteWordAdsTOS( sid, wpcom ) { if ( ! ( this instanceof SiteWordAdsTOS ) ) { return new SiteWordAdsTOS( sid,
javascript
{ "resource": "" }
q7250
train
function (a, override) { var b = a.slice(); if (override) { b.reverse(); } var i = 0, n, item; while (i < b.length) { item = b[i]; while ((n = util.lastIndexOf(item, b)) !== i) { b.splice(n, 1...
javascript
{ "resource": "" }
q7251
train
function (r, varArgs) { var args = util.makeArray(arguments), len = args.length - 2, i = 1, proto, arg, ov = args[len], wl = args[len + 1]; args[1] = varArgs; if (!util.isArray(wl)) { ov = wl; wl = undef; len++;
javascript
{ "resource": "" }
q7252
train
function (id, fn) { id = (id + EMPTY).match(RE_ID_STR)[1]; var retryCount = 1; var timer = util.later(function () { if (++retryCount > POLL_RETIRES) { timer.cancel(); return; }
javascript
{ "resource": "" }
q7253
getUrlForRouter
train
function getUrlForRouter(urlStr) { urlStr = urlStr || location.href; var uri = url.parse(urlStr); if (!globalConfig.useHash &&
javascript
{ "resource": "" }
q7254
train
function (fragment, urlRoot) { return location.protocol + '//' + location.host
javascript
{ "resource": "" }
q7255
saveBoxed
train
function saveBoxed(onDoneCallback = UNDEFINED) { const boxed = this.boxed; if (boxed) { const modified = boxed[boxedImmutable.BOXED_GET_THIS].valueOfModified(); if (modified !== UNDEFINED) { this.boxed = UNDEFINED;
javascript
{ "resource": "" }
q7256
cancelBoxed
train
function cancelBoxed() { const boxed = this.boxed; this.boxed = UNDEFINED; return boxed &&
javascript
{ "resource": "" }
q7257
train
function (target, prop, receiver) { if (isBoxedState(target)) { if (prop === BOXED_GET_THIS) return target; if (prop === target.saveBoxedProp) return target.saveBoxed; if (prop === target.cancelBoxedProp) return target.cancelBoxed; if (prop === target.boxOptionsPr...
javascript
{ "resource": "" }
q7258
Layer
train
function Layer(name, fn) { this.length = fn.length;
javascript
{ "resource": "" }
q7259
Supply
train
function Supply(provider, options) { if (!this) return new Supply(provider, options); options = options || {}; this.provider = provider || this; this.layers = []; this.length =
javascript
{ "resource": "" }
q7260
next
train
function next(err, done) { var layer = supply.layers[i++]; if (err || done || !layer) { return fn(err, !!done); } if (layer.length > length) { return layer.fn.apply(supply.provider, args.concat(next)); } else
javascript
{ "resource": "" }
q7261
Angle
train
function Angle(value, parameters) { abstractions.Element.call(this, utilities.types.ANGLE, parameters); // analyze the value if (value === undefined) value = 0; // default value if (!isFinite(value)) { throw new utilities.Exception({ $module: '/bali/elements/Angle', $pr...
javascript
{ "resource": "" }
q7262
bench
train
function bench(callback){ conn.connect(function(err, keyspace){ if(err){ throw(err); } console.time('Helenus ' + times + ' writes'); function cb(err, results){ if(err){ console.log('Error encountered at: ' + completed); throw(err); } completed += 1; ...
javascript
{ "resource": "" }
q7263
Pattern
train
function Pattern(value, parameters) { abstractions.Element.call(this, utilities.types.PATTERN, parameters); value = value || '^none$'; // the default value matches nothing if (typeof value === 'string') value = new RegExp(value);
javascript
{ "resource": "" }
q7264
run
train
function run(key, selfie) { if (!options[key]) return; if ('string' === typeof options[key]) options[key] = options[key].split(split); if ('function' === typeof options[key]) return options[key].call(selfie); for (var i = 0, type, what; i < options[key].length; i++) { what = options[key][i]; ...
javascript
{ "resource": "" }
q7265
Association
train
function Association(key, value) { abstractions.Composite.call(this, utilities.types.ASSOCIATION); key = this.convert(key); value = this.convert(value); // access to this component's attributes is tightly
javascript
{ "resource": "" }
q7266
train
function(credentials, mocha) { var that = this; this._connection = new taskcluster.PulseConnection(credentials); this._listeners = null; this._promisedMessages = null; // **Note**, the before(), beforeEach(9, afterEach() and after() functions // below are mocha hooks. Ie. they are called by...
javascript
{ "resource": "" }
q7267
vNumber
train
function vNumber(func, type, str, range) { let success = true; let checkType = true; let errmsg; // 先验证类型 if (!func(str)) { errmsg = localData.em_type({ desc, str, type, }); checkType = false; success = false; } // 再验证类型范围 // if (range &&...
javascript
{ "resource": "" }
q7268
Percent
train
function Percent(value, parameters) { abstractions.Element.call(this, utilities.types.PERCENT, parameters); value = value || 0; // the default value // since this element
javascript
{ "resource": "" }
q7269
train
function(name, value, timestamp, ttl){ /** * The name of the column, can be any type, for composites use Array */ this.name = name; /** * The value of
javascript
{ "resource": "" }
q7270
train
function (queueDef) { if (isString(queueDef)) { return true
javascript
{ "resource": "" }
q7271
train
function (queues, name) { var result = queues.filter(function
javascript
{ "resource": "" }
q7272
formatLines
train
function formatLines(string, indentation) { indentation = indentation ? indentation : ''; var formatted = ''; const length = string.length; if (length > LINE_WIDTH) { for (var index = 0; index < length; index += LINE_WIDTH) { formatted += EOL + indentation;
javascript
{ "resource": "" }
q7273
train
function (progressListener) { var self = this, listeners = self[PROMISE_PROGRESS_LISTENERS]; if (listeners === false) { return self; } if
javascript
{ "resource": "" }
q7274
train
function (callback) { return when(this, function (value) { return callback(value, true); }, function (reason) {
javascript
{ "resource": "" }
q7275
when
train
function when(value, fulfilled, rejected) { var defer = new Defer(), done = 0; // wrap user's callback to catch exception // wrap user's callback to catch exception function _fulfilled(value) { try { return fulfilled ? fulfilled.call(this, value) : // propagate ...
javascript
{ "resource": "" }
q7276
_fulfilled
train
function _fulfilled(value) { try { return fulfilled ? fulfilled.call(this, value) : // propagate value; } catch (e) {
javascript
{ "resource": "" }
q7277
train
function (promises) { var count = promises.length; if (!count) { return null; } var defer = new Defer(); for (var i = 0; i < promises.length; i++) { /*jshint loopfunc:true*/ (function (promise, i) { ...
javascript
{ "resource": "" }
q7278
train
function (generatorFunc) { return function () { var generator = generatorFunc.apply(this, arguments); function doAction(action, arg) { var result; // in case error on first // in case error on first try { ...
javascript
{ "resource": "" }
q7279
Version
train
function Version(value, parameters) { abstractions.Element.call(this, utilities.types.VERSION, parameters); value = value || [1]; // the default value if (value.indexOf(0) >= 0) { throw new utilities.Exception({ $module: '/bali/elements/Version', $procedure: '$Version', ...
javascript
{ "resource": "" }
q7280
Tag
train
function Tag(value, parameters) { abstractions.Element.call(this, utilities.types.TAG, parameters); value = value || 20; // the default number of bytes var bytes, numberOfBytes, hash; switch (typeof value) { case 'number': numberOfBytes = value; bytes = utilities.random....
javascript
{ "resource": "" }
q7281
train
function (msg, cat, logger) { if ('@DEBUG@') { var matched = 1; if (logger) { var list, i, l, level, minLevel, maxLevel, reg; cat = cat || 'debug'; level = loggerLevel[cat] || loggerLevel.debug; i...
javascript
{ "resource": "" }
q7282
train
function (name, cfg) { var module = mods[name]; if (!module) { name = normalizeName(name); module = mods[name]; } if (module) { mix(module, cfg); // module definition changes requires if (cf...
javascript
{ "resource": "" }
q7283
train
function () { var self = this; if (!self.url) { self.url =
javascript
{ "resource": "" }
q7284
cssPoll
train
function cssPoll() { for (var url in monitors) { var callbackObj = monitors[url], node = callbackObj.node; if (isCssLoaded(node, url)) { if (callbackObj.callback) { callbackObj.callback.call(node); } dele...
javascript
{ "resource": "" }
q7285
train
function (moduleName) { var requiresModule = createModule(moduleName); var mods
javascript
{ "resource": "" }
q7286
SiteWordAdsEarnings
train
function SiteWordAdsEarnings( sid, wpcom ) { if ( ! ( this instanceof SiteWordAdsEarnings
javascript
{ "resource": "" }
q7287
_raco
train
function _raco (iter, args, callback, opts) { var self = this var trycatch = true var isYieldable = true var yielded = false var nothrow = !!opts.nothrow /** * internal callback stepper * * @param {object} err - callback error object * @param {...*} val - callback value(s) */ function step ...
javascript
{ "resource": "" }
q7288
step
train
function step (err, val) { if (iter) { // generator step yielded = false isYieldable = false var state if (trycatch) { try { if (nothrow) state = iter.next(slice.call(arguments)) else state = err ? iter.throw(err) : iter.next(val) } catch (err) { ...
javascript
{ "resource": "" }
q7289
next
train
function next () { var args = slice.call(arguments) if (!isYieldable) { // only handle callback if not yieldable if (iter && yielded) { // no need defer when yielded step.apply(self, args) } else { // need next tick if not defered
javascript
{ "resource": "" }
q7290
raco
train
function raco (genFn, opts) { if (!isGeneratorFunction(genFn)) { if (isFunction(genFn)) throw new Error('Generator function required') else if (!isGenerator(genFn)) return factory(genFn) }
javascript
{ "resource": "" }
q7291
columnParent
train
function columnParent(cf, column) { var args = { column_family: cf.name }; if (cf.isSuper && column)
javascript
{ "resource": "" }
q7292
columnPath
train
function columnPath(cf, column, subcolumn) { var args = { column_family: cf.name }; if (column) args.column = cf.columnMarshaller.serialize(column); if (cf.isSuper && subcolumn)
javascript
{ "resource": "" }
q7293
normalizeParameters
train
function normalizeParameters(list) { list = _.toArray(list); return _.reduce(list, function(args, value, index) { if (_.isObject(value) && !Array.isArray(value)) { var options = args.options, timestamp = value.timestamp, consistency = value.c...
javascript
{ "resource": "" }
q7294
train
function() { var stable = []; for (var i=0;i<physicsSimulators.length; i++) { stable.push(physicsSimulators[i].step()); } // Check if all simulators are stable //console.log(stable);
javascript
{ "resource": "" }
q7295
train
function (nodeId) { var layer = getLayer(nodeId); var body =
javascript
{ "resource": "" }
q7296
train
function() { graph.off('changed', onGraphChanged); for (var i=0;i<physicsSimulators.length; i++) {
javascript
{ "resource": "" }
q7297
train
function (tplContent, name) { if (tplContent) { var ret; try { ret = parser.parse(tplContent, name); } catch (err) { var e; if (err instanceof Error) {
javascript
{ "resource": "" }
q7298
Queue
train
function Queue(parameters) { parameters = parameters || new composites.Parameters(new Catalog()); if (!parameters.getParameter('$type')) parameters.setParameter('$type', '/bali/collections/Queue/v1'); abstractions.Collection.call(this, utilities.types.QUEUE, parameters); // the capacity and array are p...
javascript
{ "resource": "" }
q7299
train
function (type, code) { $sgCodeTitles.removeClass('sg-code-title-active'); switch (type) { case 'e': $sgCodeTitleHtml.addClass('sg-code-title-active'); break; case 'm': $sgCodeTitleMustache.addClass('sg-code-title-active');
javascript
{ "resource": "" }