_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q46600
train
function(callback, deferred) { var root = this; var manager = root.__manager__; var rentManager = manager.parent && manager.parent.__manager__; // Allow RAF processing to be shut off using `useRAF`:false. if (this.useRAF === false) { if (manager.queue) { aPush.call(manager.queue, call...
javascript
{ "resource": "" }
q46601
resolveDeferreds
train
function resolveDeferreds() { for (var i = 0; i < manager.deferreds.length; i++){ manager.deferreds[i].resolveWith(root, [root]); } manager.deferreds = []; }
javascript
{ "resource": "" }
q46602
train
function() { var root = this; var manager = root.__manager__; if (manager.rafID != null) { root.cancelAnimationFrame(manager.rafID); } }
javascript
{ "resource": "" }
q46603
train
function(root, force) { // Shift arguments around. if (typeof root === "boolean") { force = root; root = this; } // Allow removeView to be called on instances. root = root || this; // Iterate over all of the nested View's and remove. root.getViews().each(function(view) { ...
javascript
{ "resource": "" }
q46604
train
function(view, force) { var parentViews; // Shorthand the managers for easier access. var manager = view.__manager__; var rentManager = manager.parent && manager.parent.__manager__; // Test for keep. var keep = typeof view.keep === "boolean" ? view.keep : view.options.keep; // In insert mod...
javascript
{ "resource": "" }
q46605
train
function(path, contents) { // If template path is found in the cache, return the contents. if (path in this._cache && contents == null) { return this._cache[path]; // Ensure path and contents aren't undefined. } else if (path != null && contents != null) { return this._cache[path] = contents...
javascript
{ "resource": "" }
q46606
train
function(views) { // Clear out all existing views. _.each(aConcat.call([], views), function(view) { // fire cleanup event to the attached handlers view.trigger("cleanup", view); // Remove all custom events attached to this View. view.unbind(); // Automatically unbind `model`. ...
javascript
{ "resource": "" }
q46607
train
function(options) { _.extend(LayoutManager.prototype, options); // Allow LayoutManager to manage Backbone.View.prototype. if (options.manage) { Backbone.View.prototype.manage = true; } // Disable the element globally. if (options.el === false) { Backbone.View.prototype.el = false; ...
javascript
{ "resource": "" }
q46608
train
function(views, options) { // Ensure that options is always an object, and clone it so that // changes to the original object don't screw up this view. options = _.extend({}, options); // Set up all Views passed. _.each(aConcat.call([], views), function(view) { // If the View has already been...
javascript
{ "resource": "" }
q46609
train
function($root, $el, rentManager, manager) { var $filtered; // If selector is specified, attempt to find it. if (manager.selector) { if (rentManager.noel) { $filtered = $root.filter(manager.selector); $root = $filtered.length ? $filtered : $root.find(manager.selector); } else { ...
javascript
{ "resource": "" }
q46610
train
function(rootView, subViews, selector) { // Shorthand the parent manager object. var rentManager = rootView.__manager__; // Create a simplified manager object that tells partial() where // place the elements. var manager = { selector: selector }; // Get the elements to be inserted into the root...
javascript
{ "resource": "" }
q46611
train
function(e) { el.off('mousemove'); elSlide.off('mouseleave'); elBlob.off('mouseup'); if (!diff && opts['click'] && e.type !== 'mouseleave') { doToggle(); return; } var overBound = active ? diff < -slideLimit : diff > slideLimit; ...
javascript
{ "resource": "" }
q46612
resolveSassPath
train
function resolveSassPath(sassPath, loadPaths, extensions) { // trim sass file extensions var re = new RegExp('(\.('+extensions.join('|')+'))$', 'i'); var sassPathName = sassPath.replace(re, ''); // check all load paths var i, j, length = loadPaths.length, scssPath, partialPath; for (i = 0; i < length; i++) ...
javascript
{ "resource": "" }
q46613
getCookieAuthUrl
train
function getCookieAuthUrl(nextUri) { nextUri = nextUri || config.OSF.redirectUri; const loginUri = `${config.OSF.url}login/?next=${encodeURIComponent(nextUri)}`; return `${config.OSF.cookieLoginUrl}?service=${encodeURIComponent(loginUri)}`; }
javascript
{ "resource": "" }
q46614
buildQueryBody
train
function buildQueryBody(queryParams, filters, queryParamsChanged) { let query = { query_string: { query: queryParams.q || '*', }, }; if (filters.length) { query = { bool: { must: query, filter: filters, }, }...
javascript
{ "resource": "" }
q46615
sortContributors
train
function sortContributors(contributors) { return contributors .sort((b, a) => (b.order_cited || -1) - (a.order_cited || -1)) .map(contributor => ({ users: Object.keys(contributor).reduce( (acc, key) => Ember.assign(acc, { [Ember.String.camelize(key)]: contributor[key] }),...
javascript
{ "resource": "" }
q46616
transformShareData
train
function transformShareData(result) { const transformedResult = Ember.assign(result._source, { id: result._id, type: 'elastic-search-result', workType: result._source['@type'], abstract: result._source.description, subjects: result._source.subjects.map(each => ({ text: each }...
javascript
{ "resource": "" }
q46617
train
function(options) { // Verifying and validating the input object if (!options) { options = {}; } // Creating the options object this.options = {}; // Validating the options this.options.text = options.text || "Hi there!"; // Display message this.options.duration...
javascript
{ "resource": "" }
q46618
train
function() { // Validating if the options are defined if (!this.options) { throw "Toastify is not initialized"; } // Creating the DOM object var divElement = document.createElement("div"); divElement.className = "toastify on " + this.options.className; // Positioning ...
javascript
{ "resource": "" }
q46619
train
function() { // Creating the DOM object for the toast var toastElement = this.buildToast(); // Getting the root element to with the toast needs to be added var rootElement; if (typeof this.options.selector === "undefined") { rootElement = document.body; } else { root...
javascript
{ "resource": "" }
q46620
train
function(toastElement) { // Hiding the element // toastElement.classList.remove("on"); toastElement.className = toastElement.className.replace(" on", ""); // Removing the element from DOM after transition end window.setTimeout( function() { // Remove the elemenf from the...
javascript
{ "resource": "" }
q46621
getSetting
train
function getSetting(value, key, defaultVal, transform) { if (process.env[key] !== undefined) { var envVal = process.env[key]; return (typeof transform === 'function') ? transform(envVal) : envVal; } if (value !== undefined) { return value; } return defaultVal; }
javascript
{ "resource": "" }
q46622
MochaJUnitReporter
train
function MochaJUnitReporter(runner, options) { this._options = configureDefaults(options); this._runner = runner; this._generateSuiteTitle = this._options.useFullSuiteTitle ? fullSuiteTitle : defaultSuiteTitle; this._antId = 0; var testsuites = []; function lastSuite() { return testsuites[testsuites.l...
javascript
{ "resource": "" }
q46623
mandatoryCheck
train
function mandatoryCheck (params = {}) { assert.ok(params.host !== void 0, 'no host given'); assert.ok(params.path !== void 0, 'no path given'); assert.ok(params.wsdl !== void 0, 'no wsdl given'); }
javascript
{ "resource": "" }
q46624
invoke
train
function invoke(actions, message, instance, deepHistory) { if (deepHistory === void 0) { deepHistory = false; } for (var _i = 0, actions_2 = actions; _i < actions_2.length; _i++) { var action = actions_2[_i]; action(message, instance, deepHistory); } }
javascript
{ "resource": "" }
q46625
getEnv
train
function getEnv (key, defaultValue) { let value = process.env[key] if (value === 'undefined') { value = undefined } return (value === undefined) ? defaultValue : value }
javascript
{ "resource": "" }
q46626
processEnv
train
function processEnv (config) { // Grab the CI stuff from env config.computed.ci.buildNumber = getEnv(config.ci.env.buildNumber) config.computed.ci.prNumber = getEnv(config.ci.env.pr, 'false') config.computed.ci.isPr = config.computed.ci.prNumber !== 'false' config.computed.ci.branch = getEnv(config.ci.env.bra...
javascript
{ "resource": "" }
q46627
getFetchOpts
train
function getFetchOpts (config) { const readToken = config.computed.vcs.auth.readToken const headers = {} logger.log(`RO_GH_TOKEN = [${readToken}]`) if (readToken) { headers['Authorization'] = `token ${readToken}` } return {headers} }
javascript
{ "resource": "" }
q46628
convertPr
train
function convertPr (ghPr) { return { number: ghPr.number, description: ghPr.body, url: ghPr.html_url, headSha: ghPr.head.sha } }
javascript
{ "resource": "" }
q46629
addModifiedFile
train
function addModifiedFile (info, filename) { if (info.modifiedFiles.indexOf(filename) === -1) { info.modifiedFiles.push(filename) } }
javascript
{ "resource": "" }
q46630
handlePermissionResults
train
function handlePermissionResults(args) { // get current promise set //noinspection JSUnresolvedVariable const promises = pendingPromises[args.requestCode]; // We have either gotten a promise from somewhere else or a bug has occurred and android has called us twice // In either case we will ignore it... if (!pro...
javascript
{ "resource": "" }
q46631
hasSupportVersion4
train
function hasSupportVersion4() { //noinspection JSUnresolvedVariable if (!android.support || !android.support.v4 || !android.support.v4.content || !android.support.v4.content.ContextCompat || !android.support.v4.content.ContextCompat.checkSelfPermission) { return false; } return true; }
javascript
{ "resource": "" }
q46632
hasAndroidX
train
function hasAndroidX() { //noinspection JSUnresolvedVariable if (!global.androidx || !global.androidx.core || !global.androidx.core.content || !global.androidx.core.content.ContextCompat || !global.androidx.core.content.ContextCompat.checkSelfPermission) { return false; } return true; }
javascript
{ "resource": "" }
q46633
getContext
train
function getContext() { if (application.android.context) { return (application.android.context); } if (typeof application.getNativeApplication === 'function') { let ctx = application.getNativeApplication(); if (ctx) { return ctx; } } //noinspection JSUnresolvedFunction,JSUnresolvedVariable let ctx = ...
javascript
{ "resource": "" }
q46634
proxyLogRewrite
train
function proxyLogRewrite(daArgs) { const args = Array.prototype.slice.call(daArgs); return args.map(arg => { if (typeof arg === 'string') { return arg.replace(/\[HPM\] /g, '').replace(/ {2}/g, ' '); } return arg; }); }
javascript
{ "resource": "" }
q46635
formatMessage
train
function formatMessage(message) { let lines = message.split('\n'); // Remove webpack-specific loader notation from filename. // Before: // ./~/css-loader!./~/postcss-loader!./src/App.css // After: // ./src/App.css if (lines[0].lastIndexOf('!') !== -1) { lines[0] = lines[0].substr(lines[0].lastIndexOf...
javascript
{ "resource": "" }
q46636
validate
train
function validate(options) { if (is.undef(options.validator)) { throw new Error('validator option undefined') } if (!is.function(options.validator) && !is.string(options.validator)) { throw new Error( `validator must be of type function or string, received ${typeof options.validator}` ) } ...
javascript
{ "resource": "" }
q46637
addResourceToMap
train
function addResourceToMap(map, def, start) { var sched = JSON.parse(JSON.stringify(def.available || defaultSched)), nextFn = schedule.memoizedRangeFn(later.schedule(sched).nextRange); map[def.id] = { schedule: sched, next: nextFn, nextAvail: nextFn(start) }; }
javascript
{ "resource": "" }
q46638
getReservation
train
function getReservation(resources, start, min, max) { var reservation, schedules = [], delays = {}, maxTries = 50; initRanges(resources, start, schedules, delays); while(!(reservation = tryReservation(schedules, min, max)).success && --maxTries) { updateRanges(schedules, nextValidStart(schedu...
javascript
{ "resource": "" }
q46639
initRanges
train
function initRanges(resources, start, ranges, delays) { for(var i = 0, len = resources.length; i < len; i++) { var resId = resources[i]; // handles nested resources (OR) if(Array.isArray(resId)) { var subRanges = [], subDelays = {}; initRanges(resId, start, subRanges, subDelays); ...
javascript
{ "resource": "" }
q46640
tryReservation
train
function tryReservation(schedules, min,max) { var reservation = {success: false}, resources = [], start, end; for(var i = 0, len = schedules.length; i < len; i++) { var schedule = schedules[i], range = schedule.range; if(!isInternal(schedule)) { resources.push(schedule.id...
javascript
{ "resource": "" }
q46641
createReservation
train
function createReservation(resources, start, duration) { var end = start + (duration * later.MIN), reservation = { resources: resources, start: start, end: end, duration: duration, success: true }; applyReservation(resources, start, end); re...
javascript
{ "resource": "" }
q46642
updateRanges
train
function updateRanges(resources, start, delays) { for(var i = 0, len = resources.length; i < len; i++) { var res = resources[i]; if(res.range[1] > start) continue; if(res.subRanges) { updateRanges(res.subRanges, start, {}); setEarliestSubRange(res); } else { re...
javascript
{ "resource": "" }
q46643
nextValidStart
train
function nextValidStart(schedules) { var latest; for(var i = 0, len = schedules.length; i < len; i++) { var end = schedules[i].range[1]; latest = !latest || end < latest ? end : latest; } return latest; }
javascript
{ "resource": "" }
q46644
getLongestDelay
train
function getLongestDelay(delays) { var latest, lid; for(var id in delays) { var available = delays[id].available; if(!latest || available < latest) { latest = available; lid = id; } } return lid; }
javascript
{ "resource": "" }
q46645
train
function(arr, prefix, start) { for(var i = 0, len = arr.length; i < len; i++) { var def = typeof arr[i] !== 'object' ? { id: prefix + arr[i] } : { id: prefix + arr[i].id, available: arr[i].available, isNotReservable: arr[i].isNotReservable }; if(!rMap[def.id]) { addR...
javascript
{ "resource": "" }
q46646
train
function(resources, start, min, max) { start = start ? new Date(start) : new Date(); return getReservation(resources, start.getTime(), min || 1, max); }
javascript
{ "resource": "" }
q46647
resources
train
function resources(data) { var items = [], fid = schedule.functor(id), favailable = schedule.functor(available), freserve = schedule.functor(isNotReservable); for(var i = 0, len = data.length; i < len; i++) { var resource = data[i], rId = fid.call(this, resource, i), ...
javascript
{ "resource": "" }
q46648
forwardPassTask
train
function forwardPassTask(task, start) { var resAll = ['_proj', '_task' + task.id], resources = task.resources ? resAll.concat(task.resources) : resAll, duration = task.duration, next = start, scheduledTask = {schedule: [], duration: task.duration}; while(duration) { var r ...
javascript
{ "resource": "" }
q46649
createDependencyGraph
train
function createDependencyGraph(tasks) { var graph = { tasks: {}, roots: [], leaves: [], resources: [], depth: 0, end : 0 }; for(var i = 0, len = tasks.length; i < len; i++) { var t = tasks[i]; graph.tasks[t.id] = { id: t.id, duration: t.durati...
javascript
{ "resource": "" }
q46650
counter
train
function counter(state = 0, action = {}) { switch (action.type) { case INCREMENT_COUNTER: return state + 1; case DECREMENT_COUNTER: return state - 1; default: return state; } }
javascript
{ "resource": "" }
q46651
routeMatcher
train
function routeMatcher(route) { var segments = route.replace(/^\/+|\/+$/, '').split(/\/+/); var names = []; var rules = []; segments.forEach(function(segment){ var rule; if (segment.charAt(0) === ':') { names.push(segment.slice(1)); rules.push('([^\/]+)'); } else if...
javascript
{ "resource": "" }
q46652
exampleBookFunction
train
function exampleBookFunction(element, uniqueId) { expect(element).not.toBeUndefined(); expect(element.length).toBe(1); expect($('.inline-edit-btn-' + uniqueId).length).toBe(2); // two because there are two buttons per section expect($('.inline-edit-btn-' + uniqueId + '-fa-book')....
javascript
{ "resource": "" }
q46653
onEdit
train
function onEdit() { var editor; if (o.wysiwyg && $('#' + uniqueId).find('.wk-container').length === 0) { // insert rich editor var editorOptions = o.editorOptions || {}; editorOptions.textarea = $('#' + uniqueId + ' textarea')[0]; editorOptions.tagsModule = (edito...
javascript
{ "resource": "" }
q46654
train
function () { var target = this.dragTarget; target.off( DRAG_START_EVENT, target._dragStartHandler ); target.getPaper().off( DRAG_END_EVENT, target._dragEndHandler ); delete target._dragStartHandler; delete target._dragEndHandler; this.dragEnabled ...
javascript
{ "resource": "" }
q46655
typedValue
train
function typedValue(value) { if (value[0] == '!') value = value.substr(1) var regex = value.match(/^\/(.*)\/(i?)$/); var quotedString = value.match(/(["'])(?:\\\1|.)*?\1/); if (regex) { return new RegExp(regex[1], regex[2]); } else if (quotedString) { return quotedString[0].substr(1, quotedString[0]....
javascript
{ "resource": "" }
q46656
typedValues
train
function typedValues(svalue) { var commaSplit = /("[^"]*")|('[^']*')|([^,]+)/g var values = [] svalue .match(commaSplit) .forEach(function(value) { values.push(typedValue(value)) }) return values; }
javascript
{ "resource": "" }
q46657
downloadMap
train
function downloadMap(map) { let data = map.exportAsJSON(), json = JSON.stringify(data), blob = new Blob([json], {type: "application/json"}), a = document.createElement("a"); a.download = "example.json"; a.href = URL.createObjectURL(blob); a.click(); }
javascript
{ "resource": "" }
q46658
uploadMap
train
function uploadMap(map, e) { let reader = new window.FileReader(); reader.readAsText(e.target.files[0]); reader.onload = function () { let data = JSON.parse(event.target.result); map.new(data); }; }
javascript
{ "resource": "" }
q46659
downloadImage
train
function downloadImage(map) { map.exportAsImage(function (url) { let a = document.createElement("a"); a.download = "example"; a.href = url; a.click(); }, "jpeg"); }
javascript
{ "resource": "" }
q46660
insertImage
train
function insertImage(map) { let src = map.selectNode().image.src; if (src === "") { let value = prompt("Please enter your name", "example/img/material-icons/add.svg"); if (value) { map.updateNode("imageSrc", value); } } else { map.updateNode("imageSrc", ""); ...
javascript
{ "resource": "" }
q46661
bold
train
function bold(map) { let value = map.selectNode().font.weight !== "bold" ? "bold" : "normal"; map.updateNode("fontWeight", value); }
javascript
{ "resource": "" }
q46662
italic
train
function italic(map) { let value = map.selectNode().font.style !== "italic" ? "italic" : "normal"; map.updateNode("fontStyle", value); }
javascript
{ "resource": "" }
q46663
updateValues
train
function updateValues(node, map) { dom.fontSize[map].value = node.fontSize; dom.imageSize[map].value = node.image.size; dom.backgroundColor[map].value = node.colors.background; dom.branchColor[map].value = node.colors.branch || "#ffffff"; dom.nameColor[map].value = node.colors.name; }
javascript
{ "resource": "" }
q46664
sorter
train
function sorter (a, b) { const aDist = a.distance == null ? -1 : a.distance const bDist = b.distance == null ? -1 : b.distance if (aDist < bDist) { return 1 } if (bDist < aDist) { return -1 } return 0 }
javascript
{ "resource": "" }
q46665
createConnectionObject
train
function createConnectionObject(context) { const { req } = context.bindings; const xForwardedFor = req.headers ? req.headers["x-forwarded-for"] : undefined; return { encrypted : req.originalUrl && req.originalUrl.toLowerCase().startsWith("https"), remoteAddress : removePortFromAddress(xForwardedFor) ...
javascript
{ "resource": "" }
q46666
sanitizeContext
train
function sanitizeContext(context) { const sanitizedContext = { ...context, log : context.log.bind(context) }; // We don't want the developper to mess up express flow // See https://github.com/yvele/azure-function-express/pull/12#issuecomment-336733540 delete sanitizedContext.done; return sanitized...
javascript
{ "resource": "" }
q46667
getLengthAngle
train
function getLengthAngle(x1, x2, y1, y2) { var xDiff = x2 - x1; var yDiff = y2 - y1; return { length: Math.ceil(Math.sqrt(xDiff * xDiff + yDiff * yDiff)), angle: Math.round(Math.atan2(yDiff, xDiff) * 180 / Math.PI) }; }
javascript
{ "resource": "" }
q46668
distEuclidean
train
function distEuclidean(rgb0, rgb1) { var rd = rgb1[0]-rgb0[0], gd = rgb1[1]-rgb0[1], bd = rgb1[2]-rgb0[2]; return Math.sqrt(Pr*rd*rd + Pg*gd*gd + Pb*bd*bd) / euclMax; }
javascript
{ "resource": "" }
q46669
distManhattan
train
function distManhattan(rgb0, rgb1) { var rd = Math.abs(rgb1[0]-rgb0[0]), gd = Math.abs(rgb1[1]-rgb0[1]), bd = Math.abs(rgb1[2]-rgb0[2]); return (Pr*rd + Pg*gd + Pb*bd) / manhMax; }
javascript
{ "resource": "" }
q46670
sortedHashKeys
train
function sortedHashKeys(obj, desc) { var keys = []; for (var key in obj) keys.push(key); return sort.call(keys, function(a,b) { return desc ? obj[b] - obj[a] : obj[a] - obj[b]; }); }
javascript
{ "resource": "" }
q46671
mergeAliases
train
function mergeAliases(stackName, newTemplate, currentTemplate, aliasStackTemplates, currentAliasStackTemplate, removedResources) { const allAliasTemplates = _.concat(aliasStackTemplates, currentAliasStackTemplate); // Get all referenced function logical resource ids const aliasedFunctions = _.flatMap( allAlia...
javascript
{ "resource": "" }
q46672
Cabal
train
function Cabal (storage, key, opts) { if (!(this instanceof Cabal)) return new Cabal(storage, key, opts) if (!opts) opts = {} events.EventEmitter.call(this) var json = { encode: function (obj) { return Buffer.from(JSON.stringify(obj)) }, decode: function (buf) { var str = buf.toString('...
javascript
{ "resource": "" }
q46673
sanitize
train
function sanitize (msg) { if (typeof msg !== 'object') return null if (typeof msg.value !== 'object') return null if (typeof msg.value.content !== 'object') return null if (typeof msg.value.timestamp !== 'number') return null if (typeof msg.value.type !== 'string') return null if (typeof msg.value.content.c...
javascript
{ "resource": "" }
q46674
sanitize
train
function sanitize (msg) { if (typeof msg !== 'object') return null if (typeof msg.value !== 'object') return null if (typeof msg.value.content !== 'object') return null if (typeof msg.value.timestamp !== 'number') return null if (typeof msg.value.type !== 'string') return null return msg }
javascript
{ "resource": "" }
q46675
train
function (core, channel, opts) { opts = opts || {} var t = through.obj() if (opts.gt) opts.gt = 'msg!' + channel + '!' + charwise.encode(opts.gt) + '!' else opts.gt = 'msg!' + channel + '!' if (opts.lt) opts.lt = 'msg!' + channel + '!' + charwise.encode(opts.lt) + '~' ...
javascript
{ "resource": "" }
q46676
Confluence
train
function Confluence(config) { if (!(this instanceof Confluence)) return new Confluence(config); if (!config) { throw new Error("Confluence module expects a config object."); } else if (!config.username || ! config.password) { throw new Error("Confluence module expects a config object wi...
javascript
{ "resource": "" }
q46677
xsltPassThrough
train
function xsltPassThrough(input, template, output, outputDocument) { if (template.nodeType == DOM_TEXT_NODE) { if (xsltPassText(template)) { let node = domCreateTextNode(outputDocument, template.nodeValue); domAppendChild(output, node); } } else if (template.nodeType == D...
javascript
{ "resource": "" }
q46678
find
train
function find (by, value, strict) { return new Promise((resolve, reject) => { if (!(by in findBy)) { reject(new Error(`do not support find by "${by}"`)) } else { findBy[by](value, strict).then(resolve, reject) } }) }
javascript
{ "resource": "" }
q46679
renderNavbar
train
function renderNavbar() { var navbar = $('#navbar ul')[0]; if (typeof (navbar) === 'undefined') { loadNavbar(); } else { $('#navbar ul a.active').parents('li').addClass(active); renderBreadcrumb(); } function loadNavbar() { var navbarPath = $("meta[property='docfx\\:navrel']...
javascript
{ "resource": "" }
q46680
autocenter
train
function autocenter(options) { options = options || {}; var needsCentering = false; var globe = null; var resize = function() { var width = window.innerWidth + (options.extraWidth || 0); var height = window.innerHeight + (options.extraHeight || 0); globe.canvas.width = width; g...
javascript
{ "resource": "" }
q46681
autoscale
train
function autoscale(options) { options = options || {}; return function(planet) { planet.onInit(function() { var width = window.innerWidth + (options.extraWidth || 0); var height = window.innerHeight + (options.extraHeight || 0); planet.projection.scale(Math.min(width, height) / 2)...
javascript
{ "resource": "" }
q46682
train
function() { $module .data(metadata.promise, false) .data(metadata.xhr, false) ; $context .removeClass(className.error) .removeClass(className.loading) ; }
javascript
{ "resource": "" }
q46683
train
function(member) { users = $module.data('users'); if(member.id != 'anonymous' && users[ member.id ] === undefined ) { users[ member.id ] = member.info; if(settings.randomColor && member.info.color === undefined) { member.info.color = settings.templates...
javascript
{ "resource": "" }
q46684
train
function(member) { users = $module.data('users'); if(member !== undefined && member.id !== 'anonymous') { delete users[ member.id ]; $module .data('users', users) ; $userList .find('[data-id='+ member.id + ']...
javascript
{ "resource": "" }
q46685
train
function(members) { users = {}; members.each(function(member) { if(member.id !== 'anonymous' && member.id !== 'undefined') { if(settings.randomColor && member.info.color === undefined) { member.info.color = settings.templates.color(member...
javascript
{ "resource": "" }
q46686
train
function() { $log .animate({ width: (module.width.log - module.width.userList) }, { duration : settings.speed, easing : settings.easing, complete : module.message.scroll.move }) ...
javascript
{ "resource": "" }
q46687
train
function(message) { if( !module.utils.emptyString(message) ) { $.api({ url : settings.endpoint.message, method : 'POST', data : { 'message': { content : message, timestamp : new Dat...
javascript
{ "resource": "" }
q46688
train
function(response) { message = response.data; users = $module.data('users'); loggedInUser = $module.data('user'); if(users[ message.userID] !== undefined) { // logged in user's messages already pushed instantly if(loggedInUser === u...
javascript
{ "resource": "" }
q46689
train
function(message) { $log .append( settings.templates.message(message) ) ; module.message.scroll.test(); $.proxy(settings.onMessage, $log.children().last() )(); }
javascript
{ "resource": "" }
q46690
train
function() { var message = $messageInput.val(), loggedInUser = $module.data('user') ; if(loggedInUser !== undefined && !module.utils.emptyString(message)) { module.message.send(message); // display immediately ...
javascript
{ "resource": "" }
q46691
train
function() { if( !$module.hasClass(className.expand) ) { $expandButton .addClass(className.active) ; module.expand(); } else { $expandButton .removeClass(className.active) ; ...
javascript
{ "resource": "" }
q46692
train
function() { if( !$log.is(':animated') ) { if( !$userListButton.hasClass(className.active) ) { $userListButton .addClass(className.active) ; module.user.list.show(); } else { $userList...
javascript
{ "resource": "" }
q46693
train
function(source, id, url) { module.debug('Changing video to ', source, id, url); $module .data(metadata.source, source) .data(metadata.id, id) .data(metadata.url, url) ; settings.onChange(); }
javascript
{ "resource": "" }
q46694
train
function() { module.debug('Playing video'); var source = $module.data(metadata.source) || false, url = $module.data(metadata.url) || false, id = $module.data(metadata.id) || false ; $embed .html( module.generate.html(s...
javascript
{ "resource": "" }
q46695
train
function(source, id, url) { module.debug('Generating embed html'); var width = (settings.width == 'auto') ? $module.width() : settings.width, height = (settings.height == 'auto') ? $module.height() : sett...
javascript
{ "resource": "" }
q46696
train
function(source) { var api = (settings.api) ? 1 : 0, autoplay = (settings.autoplay) ? 1 : 0, hd = (settings.hd) ? 1 : 0, showUI = (settings.sho...
javascript
{ "resource": "" }
q46697
_getPostings
train
function _getPostings (options, markup) { let $ = cheerio.load(markup), // hostname = options.hostname, posting = {}, postings = [], secure = options.secure; $('div.content') .find('.result-row') .each((i, element) => { let // introducing fix for #11 - Craigslist markup changed details = $(e...
javascript
{ "resource": "" }
q46698
multiplyInteger
train
function multiplyInteger(x, k) { var temp, carry = 0, i = x.length; for (x = x.slice(); i--;) { temp = x[i] * k + carry; x[i] = temp % BASE | 0; carry = temp / BASE | 0; } if (carry) x.unshift(carry); return x; }
javascript
{ "resource": "" }
q46699
getBase10Exponent
train
function getBase10Exponent(x) { var e = x.e * LOG_BASE, w = x.d[0]; // Add the number of digits of the first word of the digits array. for (; w >= 10; w /= 10) e++; return e; }
javascript
{ "resource": "" }