_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q41000
cdProjectRoot
train
function cdProjectRoot(dir) { var projectRoot = this.isCordova(dir); if (!projectRoot) { throw new CordovaError('Current working directory is not a judpack project.'); } if (!origCwd) { origCwd = process.env.PWD || process.cwd(); } process.env.PWD = projectRoot; process.chdir...
javascript
{ "resource": "" }
q41001
deleteSvnFolders
train
function deleteSvnFolders(dir) { var contents = fs.readdirSync(dir); contents.forEach(function(entry) { var fullpath = path.join(dir, entry); if (fs.statSync(fullpath).isDirectory()) { if (entry == '.svn') { shell.rm('-rf', fullpath); } else module.exports...
javascript
{ "resource": "" }
q41002
findPlugins
train
function findPlugins(pluginPath) { var plugins = [], stats; if (exports.existsSync(pluginPath)) { plugins = fs.readdirSync(pluginPath).filter(function (fileName) { stats = fs.statSync(path.join(pluginPath, fileName)); return fileName != '.svn' && fileName != 'CVS' && sta...
javascript
{ "resource": "" }
q41003
getAvailableNpmVersions
train
function getAvailableNpmVersions(module_name) { var npm = require('npm'); return Q.nfcall(npm.load).then(function () { return Q.ninvoke(npm.commands, 'view', [module_name, 'versions'], /* silent = */ true).then(function (result) { // result is an object in the form: // {'<ver...
javascript
{ "resource": "" }
q41004
execute
train
function execute(req, res) { // TODO: ensure a conflict is triggered on all watched keys this.store.flushall(); res.send(null, Constants.OK); }
javascript
{ "resource": "" }
q41005
bot
train
function bot(job, done) { var jobs = job.data.jobs console.log(job.data.jobs) if (!jobs) { done() return } for (var i = 0; i < jobs.length; i++) { var j = jobs[i] debug('Running : ' + j) } done() }
javascript
{ "resource": "" }
q41006
train
function($li, model) { $li.attr('todo-cid', model.cid); $li.toggleClass('todo-done', model.done); $li.text(model.title); }
javascript
{ "resource": "" }
q41007
train
function (e) { if (e && e.preventDefault) e.preventDefault(); var $el = $(e.target); var cid = $el.attr('todo-cid'); if (cid) { this.options.toggleItem(cid); } return false; }
javascript
{ "resource": "" }
q41008
parseTextBody
train
function parseTextBody(req, res, next){ if (req.body === undefined) { req.body = ''; req.on('data', function(chunk){ req.body += chunk }); req.on('end', next); } else { next(); } }
javascript
{ "resource": "" }
q41009
reload
train
function reload() { var params = {} params[model.primary] = me[model.primary] var act = new NobleMachine(model.find(params)); act.next(function(newInst) { if (newInst) { for (var col in model.columns) { me[col] = newInst[col]; } act.toNext(me); } else { for (var key i...
javascript
{ "resource": "" }
q41010
destroy
train
function destroy() { var act = new NobleMachine(function() { if (me.onDestroy) { var preact = me.onDestroy(); if (preact && preact.start instanceof Function) { act.toNext(preact) return; } } }); act.next(function() { var sql = "DELETE FROM " + model.table + " WHERE...
javascript
{ "resource": "" }
q41011
setValue
train
function setValue(key, val) { //util.log(key + ": " + JSON.stringify(val)); if (val === null) { me.values[key] = null; } else if (val === undefined) { me.values[key] = undefined; } else { type = model.columns[key]['DATA_TYPE']; switch (type) { case 'datetime': case 'timestamp': ...
javascript
{ "resource": "" }
q41012
InteractionManager
train
function InteractionManager(renderer, options) { options = options || {}; /** * The renderer this interaction manager works for. * * @member {SystemRenderer} */ this.renderer = renderer; /** * Should default browser actions automatically be prevented. * * @member {bo...
javascript
{ "resource": "" }
q41013
lower
train
function lower (value) { if (value === null || value === undefined) { return value } return String.prototype.toLowerCase.call(value) }
javascript
{ "resource": "" }
q41014
Reporter
train
function Reporter (opts) { this.events = opts.events; this.config = opts.config; this.temporaryAssertions = []; this.temp = {}; var defaultReportFolder = 'report/dalek'; this.dest = this.config.get('html-reporter') && this.config.get('html-reporter').dest ? this.config.get('html-reporter').dest : defaultRe...
javascript
{ "resource": "" }
q41015
train
function () { // render stylesheets var precss = fs.readFileSync(__dirname + '/themes/default/styl/default.styl', 'utf8'); stylus.render(precss, { filename: 'default.css' }, function(err, css){ if (err) { throw err; } this.styles = css; }.bind(this)); // collect client js...
javascript
{ "resource": "" }
q41016
train
function (data) { this.detailContents.testResult = data; this.detailContents.styles = this.styles; this.detailContents.js = this.js; fs.writeFileSync(this.dest + '/details/' + data.id + '.html', this.templates.detail(this.detailContents), 'utf8'); return this; }
javascript
{ "resource": "" }
q41017
train
function (data) { var body = ''; var contents = ''; var tests = ''; var banner = ''; // add test results var keys = Object.keys(this.output.test); keys.forEach(function (key) { tests += this.output.test[key]; }.bind(this)); // compile the test result template body = this....
javascript
{ "resource": "" }
q41018
train
function (data) { data.assertionInfo = this.temporaryAssertions; data.browser = this.temp.browser; this.output.test[data.id] = this.templates.test(data); this.temporaryAssertions = []; return this; }
javascript
{ "resource": "" }
q41019
train
function() { var src = config.paths.src; var out = config.paths.out; src.base = src.base || 'src/'; src.styles = src.styles || 'styles/'; src.scripts = src.scripts || 'scripts/'; src.esnextExtension = src.esnextExtension || '.es6'; src.views = src.templates || '../views/'; src.partials = src.partials !...
javascript
{ "resource": "" }
q41020
train
function(_gulp, _config) { if (!_gulp) { throw 'Error: A Gulp instance should be passed to the gulpConfig method.'; } gulp = _gulp; config = _config || { paths: { src: {}, out: {} } }; plugins = elaboratePlugins(); paths = elaboratePaths(); lrport = _config.liveReloadPort || lrport; server = _conf...
javascript
{ "resource": "" }
q41021
train
function(addExtraWatchers) { /* Watchers -------------------------------------------------------------- */ gulp.task('watch', ['serve'], function () { gulp.watch(paths.src.es6, ['bundle-js:dev:clean']); gulp.watch(paths.src.js, ['bundle-js:dev:clean']); gulp.watch(paths.src.styles, ['styles']); gulp...
javascript
{ "resource": "" }
q41022
train
function(extensions) { var extensions = extensions || {}, devExts = extensions.development || [], testExts = extensions.test || [], prodExts = extensions.production || []; gulp.task('default', ['development']); gulp.task('post-install-development', [ 'karma:dev', 'styles', 'bundle-js...
javascript
{ "resource": "" }
q41023
train
function(name, resourcesNo, waitForMoreDemandingConsumers, debug){ /** @memberof! qpp.SemaphoreMultiReservation# @var {string} name - name of the semaphore */ this.name = name || "semaphore"; resourcesNo = resourcesNo || 1; /** @memberof! qpp.SemaphoreMultiReservation# @private @var {string} initia...
javascript
{ "resource": "" }
q41024
train
function(resourcesNo, debug){ resourcesNo = resourcesNo || 1; /** @memberof! qpp.SemaphoresHash# @var {Array.<string,QPP.Semaphore>} semaphores - array hash of semaphores */ this.semaphores = {}; /** @memberof! qpp.SemaphoresHash# @private @var {string} initialResources - initial (total) number of r...
javascript
{ "resource": "" }
q41025
buildConfig
train
function buildConfig( config, items, item, inheritableConfigs = {}, visitedItems = [] ) { let { id } = item if (visitedItems.includes(id)) { throw new Error(`Item "${id}" has cyclic dependencies`) } let _extends = item.extends || DEFAULT let inheritedConfig = inheritableConfigs[_extends] visitedItem...
javascript
{ "resource": "" }
q41026
setCliConfiguration
train
function setCliConfiguration() { return yargs .usage('usage: $0 [options] <aws-elasticsearch-cluster-endpoint>') .option('h', { alias: 'host', default: HOST || '127.0.0.1', demand: false, describe: 'Host IP Address', type: 'string', }) .option('p', { alias: 'port', ...
javascript
{ "resource": "" }
q41027
CreateRows
train
function CreateRows(obj) { //Start the output var out = ''; //Get all for(var key in obj) { //Check the out if(out !== '') { //Add a comma out = out + ', '; } //Add the row out = out + key + ' ' + obj[key]; } //Return the output return out; }
javascript
{ "resource": "" }
q41028
train
function () { if (this.settings.parentElement === false) return this.createErrorMessage("No parent element set!"); // This is the container in // which the bar resides this.progressBar = $("<progress>").attr({ "id": "progress-bar", "value": 0, "max": 100 }).appendTo(this.settings.parentEl...
javascript
{ "resource": "" }
q41029
train
function (progress) { var _this = this; this.progressBar.animate({ value: progress }, 1, function() { _this.onProgress(progress); }); this.progress = progress; }
javascript
{ "resource": "" }
q41030
onExec
train
function onExec (err, stdout, stderr) { callback(null, { err: err, stdout: stdout, stderr: stderr }); }
javascript
{ "resource": "" }
q41031
pnbinom
train
function pnbinom(size, prob, lowerTail, logp) { logp = logp === true; lowerTail = lowerTail !== false; return function(x) { if (utils.hasNaN(x, size, prob) || size < 0 || prob <= 0 || prob > 1 || utils.isInfinite(size)) { return NaN; } ...
javascript
{ "resource": "" }
q41032
rnbinom
train
function rnbinom(size, prob) { var rg; if (size <= 0 || prob <= 0 || prob > 1) { return function() { return NaN; }; } if (prob === 1) { return function() { return 0; }; } rg = rgamma(size, (1 - prob) / prob); return function() { return rpois(rg())(); }; }
javascript
{ "resource": "" }
q41033
train
function(size, prob) { return { d: function(x, logp) { return dnbinom(size, prob, logp)(x); }, p: function(q, lowerTail, logp) { return pnbinom(size, prob, lowerTail, logp)(q); }, q: function(p, lowerTail, logp) { return qnbinom(size...
javascript
{ "resource": "" }
q41034
emit
train
function emit(name, next) { var transport = that.transports[name]; if ((transport.level && that.levels[transport.level] <= that.levels[level]) || (!transport.level && that.levels[that.level] <= that.levels[level])) { transport.log(rec, function (err) { if (err) { ...
javascript
{ "resource": "" }
q41035
cb
train
function cb(err) { if (callback) { if (err) return callback(err); callback(null, rec); } callback = null; if (!err) { that.emit('logged', rec); } }
javascript
{ "resource": "" }
q41036
queryTransport
train
function queryTransport(transport, next) { if (options.query) { options.query = transport.formatQuery(query); } transport.query(options, function (err, results) { if (err) { return next(err); } next(null, transport.formatResults(r...
javascript
{ "resource": "" }
q41037
addResults
train
function addResults(transport, next) { queryTransport(transport, function (err, result) { // // queryTransport could potentially invoke the callback // multiple times since Transport code can be unpredictable. // if (next) { result = er...
javascript
{ "resource": "" }
q41038
first
train
function first(FIRST, rule) { var terminals = new Set(); var read = true; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = rule[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iter...
javascript
{ "resource": "" }
q41039
train
function() { this._nextCalled = true; if(this._collection.size() > 0) { if(this._hasNextCalled) { this._hasNextCalled = false; this._pos --; } this._pos ++; this._nextElement = this._collection.getAll()[this._pos]; ...
javascript
{ "resource": "" }
q41040
train
function() { if(this._collection.getAll()[this._pos + 1]) { this._hasNext = true; } else { this._hasNext = false; } if(!this._nextCalled) { this._pos ++; this._hasNextCalled = true; } return this._hasNex...
javascript
{ "resource": "" }
q41041
mkInsert
train
function mkInsert(table, obj) { const ks = Object.keys(obj).map(x => `\`${x}\``); const vs = Object.values(obj).map(toMysqlObj); return `INSERT INTO \`${table}\`(${ks}) VALUES(${vs})`; }
javascript
{ "resource": "" }
q41042
toMysqlObj
train
function toMysqlObj(obj) { if (obj === undefined || obj === null) return "NULL"; switch (obj.constructor) { case Date: return `'${formatDate(obj)}'`; case String: return `'${obj.replace(/'/g, "''")}'`; case Number: return obj; default: throw new TypeError(`${util.inspect(obj)}`); }...
javascript
{ "resource": "" }
q41043
train
function (chain) { if (chain.readable) { chain.chainAfter = chain.chainAfter || Pipe.Chain.prototype.chainAfter; chain.nextChain = chain.nextChain || Pipe.Chain.prototype.nextChain; } if (chain.writable) { // Duplex chain.chainBefore = chain.chainBefore || Pip...
javascript
{ "resource": "" }
q41044
train
function (chain) { if (chain.previousChain) { chain.previousChain.unpipe(chain); chain.previousChain.pipe(this); chain.previousChain.nextChain = this; } if (this.autoEnhance) { this.enhanceForeignStream(chain); } this.pipe(chain)...
javascript
{ "resource": "" }
q41045
train
function(callback) { ftpout.raw.pwd(function(err) { if (err && err.code === 530) { grunt.fatal('bad username or password'); } callback(err); }); }
javascript
{ "resource": "" }
q41046
train
function(callback) { grunt.log.write(wrap('===== saving hashes... ')); ftpout.put(new Buffer(JSON.stringify(localHashes)), 'push-hashes', function(err) { if (err) { done(err); } grunt.log.writeln(wrapRight('[SUCCESS]').green); callback(); }); }
javascript
{ "resource": "" }
q41047
train
function(localHashes, files, done) { fetchRemoteHashes(function(err, remoteHashes) { done(err, localHashes, remoteHashes, files); }); }
javascript
{ "resource": "" }
q41048
rayVsLineSegment
train
function rayVsLineSegment(ray, segment) { var result = lineIntersect.checkIntersection( ray.start.x, ray.start.y, ray.end.x, ray.end.y, segment.start.x, segment.start.y, segment.end.x, segment.end.y ); // definitely no intersection if (result.type == 'none' || result.type == 'parallel') return null; ...
javascript
{ "resource": "" }
q41049
train
function(elem){ if(!this.root){ this.root = struct.Node(elem); this.tail = this.root; this.size = 1; return this; // this.root.isRoot = true; } this.root.prepend(elem); this.root = this.root.previous;...
javascript
{ "resource": "" }
q41050
train
function(elem){ if(!this.root){ this.root = struct.Node(elem); this.tail = this.root; this.size = 1; return this; // this.root.isRoot = true; } // this.add(elem); this.tail.append(elem); th...
javascript
{ "resource": "" }
q41051
train
function(){ if(!this.size) return; var n = this.root, pr = n.previous, nx = n.next; if(this.size === 1){ this.root = this.tail = null; this.size = 0; return n; } nx.previous = pr; delete this.root; this...
javascript
{ "resource": "" }
q41052
markLinkElement
train
function markLinkElement(element, active_nr) { var mark_wrapper; // Always remove the current classes element.classList.remove('active-link'); element.classList.remove('active-sublink'); if (element.parentElement && element.parentElement.classList.contains('js-he-link-wrapper')) { markLinkElement(element.pare...
javascript
{ "resource": "" }
q41053
Target
train
function Target(options = {}) { options = clone(options); let client = new Hipchatter(options.token); let room = options.room; delete options.token; delete options.room; let proto = { message_format: 'html', notify: false }; for (let key in options) { if (!options.hasOwnProperty(key)) { break; } ...
javascript
{ "resource": "" }
q41054
dispatch
train
function dispatch() { var commands = [].slice.call(arguments); return function fn() { var args = [].slice.call(arguments); var result; for (var i = 0; i < commands.length; i++) { result = commands[i].apply(undefined, args); if (result !== undefined) { break; } } ret...
javascript
{ "resource": "" }
q41055
toArray
train
function toArray(obj) { var key, val, arr = []; for (key in obj) { val = obj[key]; if (Array.isArray(val)) for (var i = 0; i < val.length; i++) arr.push([ key, val[i] ]); else arr.push([ key, val ]); } return arr; }
javascript
{ "resource": "" }
q41056
assignDeep
train
function assignDeep(dest, source) { if (source && source.constructor === Object) { var sourceBaseKeys = Object.keys(source); for (var i = 0; i < sourceBaseKeys.length; ++i) { var sourceBaseKey = sourceBaseKeys[i]; var destinationField = dest[sourceBaseKey]; var sourceField = source[sourceBaseKey]; if...
javascript
{ "resource": "" }
q41057
check
train
function check(args, names) { var msg = '', name = '', template = '{{ name }} coud not be empty!', indexOf = Array.prototype.indexOf, lenNames = names.length...
javascript
{ "resource": "" }
q41058
type
train
function type(variable) { var regExp = /\s([a-zA-Z]+)/, str = {}.toString.call(variable), typeBig = str.match(regExp)[1], result = typeBig.toLowerCase(); return result; }
javascript
{ "resource": "" }
q41059
train
function(callback) { var ret, isFunc = Util.type.function(callback), args = [].slice.call(arguments, 1); if (isFunc) ret = callback.apply(null, args); return ret; ...
javascript
{ "resource": "" }
q41060
Sentinel
train
function Sentinel(label, propertiesObject) { if (!(this instanceof Sentinel)) { return new Sentinel(label, propertiesObject); } if (typeof label === 'object' && label) { propertiesObject = label; label = undefined; } if (typeof label === 'number') { label = String(label); } else if (typeof...
javascript
{ "resource": "" }
q41061
_buildPaths
train
function _buildPaths() { var home = os.homedir(); var path1 = path.resolve(home + '/Music/iTunes/iTunes Music Library.xml'); var path2 = path.resolve(home + '/Music/iTunes/iTunes Library.xml'); return [path1, path1]; }
javascript
{ "resource": "" }
q41062
train
function() { var parser, source; source = this.source(); if (source == null) { return; } parser = this.parser(); if (parser != null) { return parser(source); } else { return source; } }
javascript
{ "resource": "" }
q41063
train
function (opts) { // get the browser configuration & the browser module var browserConf = {name: null}; var browser = opts.browserMo; // prepare properties this._initializeProperties(opts); // create a new webdriver client instance this.webdriverClient = new WD(browser, this.events); // listen on bro...
javascript
{ "resource": "" }
q41064
train
function (opts) { // prepare properties this.actionQueue = []; this.config = opts.config; this.lastCalledUrl = null; this.driverStatus = {}; this.sessionStatus = {}; // store injcted options in object properties this.events = opts.events; this.reporterEvents = opts.reporter; this...
javascript
{ "resource": "" }
q41065
train
function (browser) { // issue the kill command to the browser, when all tests are completed this.events.on('tests:complete:sauce:' + this.browserName, browser.kill.bind(browser)); // clear the webdriver session, when all tests are completed this.events.on('tests:complete:sauce:' + this.browserName, this...
javascript
{ "resource": "" }
q41066
train
function () { var deferred = Q.defer(); // store desired capabilities of this session this.desiredCapabilities = this.browserData.getDesiredCapabilities(this.browserName, this.config); this.browserDefaults = this.browserData.driverDefaults; this.browserDefaults.status = this.browserData.getStatusDe...
javascript
{ "resource": "" }
q41067
train
function () { var result = Q.resolve(); // loop through all promises created by the remote methods // this is synchronous, so it waits if a method is finished before // the next one will be executed this.actionQueue.forEach(function (f) { result = result.then(f); }); // flush the que...
javascript
{ "resource": "" }
q41068
train
function (sessionInfo) { var defer = Q.defer(); this.sessionStatus = JSON.parse(sessionInfo).value; this.events.emit('driver:sessionStatus:sauce:' + this.browserName, this.sessionStatus); defer.resolve(); return defer.promise; }
javascript
{ "resource": "" }
q41069
train
function (statusInfo) { var defer = Q.defer(); this.driverStatus = JSON.parse(statusInfo).value; this.events.emit('driver:status:sauce:' + this.browserName, this.driverStatus); defer.resolve(); return defer.promise; }
javascript
{ "resource": "" }
q41070
onError
train
function onError() { // {{{2 O.log.unhandled('LIRC ERROR', arguments); delete this.socket; setTimeout(connect.bind(null, this), 1000); }
javascript
{ "resource": "" }
q41071
extractParameters
train
function extractParameters(header) { var SEPARATOR = /(?: |,)/g; var OPERATOR = /=/; return header.split(SEPARATOR).reduce(function (parameters, property) { var parts = property.split(OPERATOR).map(function (part) { return part.trim(); }); if (parts.length === 2) parameters[parts[0]] = p...
javascript
{ "resource": "" }
q41072
each
train
function each(object, callback) { if (!object) { return true; } if (object.forEach) { return object.forEach(callback); } if (object instanceof Array) { var length = array ? array.length : 0; for(var index = 0; index < length; index++) { callback(array[index], index); } }else{ for(var ke...
javascript
{ "resource": "" }
q41073
every
train
function every(object, callback) { if (!object) { return true; } if (object.every) { return object.every(callback); } if (object instanceof Array) { var length = array ? array.length : 0; for(var index = 0; index < length; index++) { if (!callback(array[index], index)) { return false; } } }...
javascript
{ "resource": "" }
q41074
clone
train
function clone(object, deep) { if (!object) { return object; } var clone = object.prototype ? Object.create(object.prototype.constructor) : {}; for(var key in object) { if (!object.hasOwnProperty(key)) { continue; } clone[key] = deep ? clone(object[key], deep) : object[key]; } return clo...
javascript
{ "resource": "" }
q41075
train
function(paths) { var base = Script.current(this).absolute; each(paths, function(item, index) { var path = paths[index] = URL.absolute(URL.clean(item), base); if (path[path.length - 1] !== '/') { paths[index] += '/'; } }); return paths; }
javascript
{ "resource": "" }
q41076
train
function(script) { if (script.loader !== this) { return script.loader.load(script); } Loader.loaded = false; if (this.loaded[script.id]) { return true; } if (this.failed[script.id]) { throw new Error('No such file: ' + script.url); } this.pending[script.id] = script; return false; ...
javascript
{ "resource": "" }
q41077
train
function() { if (Loader.loading) { return false; } var count = 0; if (some(this.pending, function(script) { count++; if (script.satisfied()) { Loader.loading = script; script.module.install(); script.load(); return true; } return false; }) || count === 0) ...
javascript
{ "resource": "" }
q41078
train
function() { var pending = this.pending, script; for(var name in pending) { if (!pending.hasOwnProperty(name)) { continue; } var cycle = pending[name].cycle(); if (cycle) { cycle[0].allow(cycle[1]); this.load(cycle[0]); return true; } } }
javascript
{ "resource": "" }
q41079
train
function(script) { script.module.uninstall(); if (script.stopped || (!script.callback && Loader.loading !== script)) { script.loader.load(script); Loader.next(); return; } this.loaded[script.id] = script; delete this.pending[script.id]; Loader.loading = null; Loader.next(); ...
javascript
{ "resource": "" }
q41080
train
function(script) { script.module.uninstall(); if (Loader.loading === script) { Loader.loading = null; } script.destroy(); if (!script.next()) { delete this.pending[script.id]; this.failed[script.id] = script; } Loader.next(); }
javascript
{ "resource": "" }
q41081
train
function(url) { var loaded = this.loaded, pending = this.pending, failed = this.failed, relative = this.relative(url); return loaded[relative] || pending[relative] || [failed[relative]]; }
javascript
{ "resource": "" }
q41082
train
function(callback) { var original = Loader.using; Loader.using = this; try{ callback(); }finally{ Loader.using = original; } }
javascript
{ "resource": "" }
q41083
train
function(url) { var paths = this.paths; for(var index = 0; index < paths.length; index++) { var path = paths[index]; if (path === url.substring(0, path.length)) { return url.substring(path.length); } } return url; }
javascript
{ "resource": "" }
q41084
train
function() { if (!this.remain.length) { return false; } var next = this.remain.shift(); this.absolute = URL.absolute(this.url, next); return true; }
javascript
{ "resource": "" }
q41085
train
function() { delete this.stopped; if (this.callback) { try{ this.module.exports = this.callback(); }catch(e) { if (e === STOP_EVENT) { this.onfail(); }else{ return this.onfail(); } } return this.onload(); }else{ this.create(); this.bind(); ...
javascript
{ "resource": "" }
q41086
train
function() { if (this.events) { return; } var tag = this.tag, script = this, prefix = '', method = 'addEventListener'; // The alternative is nuking Redmond from orbit, its the only way to // be sure... if (!tag.addEventListener) { prefix = 'on'; method = 'attachEvent'; ...
javascript
{ "resource": "" }
q41087
train
function() { var depends = this.depends, allowed = this.allowed; return every(depends, function(depend) { return depend.loader.loaded[depend.id] || depend.loader.failed[depend.id] || allowed[depend.id]; }); }
javascript
{ "resource": "" }
q41088
train
function(requesters, parent) { if (this.satisfied()) { return null; } requesters = requesters || {}; var id = this.id; if (requesters[id] && !parent.allowed[id]) { return [parent, this]; } requesters[id] = this; var depends = this.depends; for(var name in depends) { if (!de...
javascript
{ "resource": "" }
q41089
train
function() { this.loaded = false; this.stopped = true; var current = Script.current(this.loader); // Unbind and remove the relevant tag, if any. this.destroy(); // Welcome traveller! You've discovered the ugly truth! This is // the 'magic' of the require script, allowing execution t...
javascript
{ "resource": "" }
q41090
train
function(url, base) { if (!url || url.indexOf('://') !== -1) { return url; } var anchor = document.createElement('a'); anchor.href = (base || location.href); var protocol = anchor.protocol + '//', host = anchor.host, path = anchor.pathname, parts = filter(path.split('/'), function(...
javascript
{ "resource": "" }
q41091
train
function(url) { var index = url ? url.lastIndexOf('/') : -1; return index == -1 ? url : url.substring(0, index + 1); }
javascript
{ "resource": "" }
q41092
extract
train
function extract(type) { for(var index = 0; index < 3; index++) { if (typeof args[index] === type) { return args[index]; } } }
javascript
{ "resource": "" }
q41093
getBasicInfo
train
function getBasicInfo() { const result = {}; for (const key in info) { if (info.hasOwnProperty(key)) { result[key] = info[key](); } } return result; }
javascript
{ "resource": "" }
q41094
checkPlatformSupported
train
function checkPlatformSupported(version, platform) { const url = `${base}/${version}`; if (platform === 'darwin') { platform = 'osx64'; } return new Promise((resolve, reject) => { https.get(url, (res) => { let body = ''; res.on('error', reject); res.on('data', (d) => body += d.toStr...
javascript
{ "resource": "" }
q41095
train
function () { return function (scribe) { var jumpLinkCommand = new scribe.api.Command('createLink'); jumpLinkCommand.nodeName = 'A'; jumpLinkCommand.execute = function () { var selection = new scribe.api.Selection(), that = this; var fullString = selection.selection.ba...
javascript
{ "resource": "" }
q41096
train
function (svg) { return svg .replace(/zIndex="[^"]+"/g, '') .replace(/isShadow="[^"]+"/g, '') .replace(/symbolName="[^"]+"/g, '') .replace(/jQuery[0-9]+="[^"]+"/g, '') .replace(/url\([^#]+#/g, 'url(#') .replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ') .replace(/ (NS[0-9]+\:)?h...
javascript
{ "resource": "" }
q41097
train
function (options, chartOptions) { var svg = this.getSVGForExport(options, chartOptions); // merge the options options = merge(this.options.exporting, options); // do the post Highcharts.post(options.url, { filename: options.filename || 'chart', type: options.type, width: options.width || 0, // ...
javascript
{ "resource": "" }
q41098
train
function () { var chart = this, container = chart.container, origDisplay = [], origParent = container.parentNode, body = doc.body, childNodes = body.childNodes; if (chart.isPrinting) { // block the button while in printing mode return; } chart.isPrinting = true; fireEvent(chart, 'beforeP...
javascript
{ "resource": "" }
q41099
train
function (options) { var chart = this, renderer = chart.renderer, btnOptions = merge(chart.options.navigation.buttonOptions, options), onclick = btnOptions.onclick, menuItems = btnOptions.menuItems, symbol, button, symbolAttr = { stroke: btnOptions.symbolStroke, fill: btnOptions.symbolFil...
javascript
{ "resource": "" }