_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q4000
train
function (node, pred) { pred = pred || func.ok; var siblings = []; if (node.previousSibling && pred(node.previousSibling)) { siblings.push(node.previousSibling); } siblings.push(node);
javascript
{ "resource": "" }
q4001
train
function (node, pred) { node = node.parentNode; while (node) { if (nodeLength(node) !== 1) { break; } if (pred(node)) { return node; }
javascript
{ "resource": "" }
q4002
train
function (node, wrapperName) { var parent = node.parentNode; var wrapper = $('<' + wrapperName + '>')[0]; parent.insertBefore(wrapper,
javascript
{ "resource": "" }
q4003
train
function (node, preceding) { var next = preceding.nextSibling, parent = preceding.parentNode; if (next) { parent.insertBefore(node, next); } else
javascript
{ "resource": "" }
q4004
train
function (node, aChild) { $.each(aChild, function (idx, child) {
javascript
{ "resource": "" }
q4005
train
function (point) { if (!isText(point.node)) { return false; }
javascript
{ "resource": "" }
q4006
setVirtualTablePosition
train
function setVirtualTablePosition(rowIndex, cellIndex, baseRow, baseCell, isRowSpan, isColSpan, isVirtualCell) { var objPosition = { 'baseRow': baseRow, 'baseCell': baseCell, 'isRowSpan': isRowSpan, 'isColSpan': isColSpan, 'isVirtual': isVirtualCell };
javascript
{ "resource": "" }
q4007
getActionCell
train
function getActionCell(virtualTableCellObj, resultAction, virtualRowPosition, virtualColPosition) { return { 'baseCell': virtualTableCellObj.baseCell, 'action': resultAction, 'virtualTable': {
javascript
{ "resource": "" }
q4008
recoverCellIndex
train
function recoverCellIndex(rowIndex, cellIndex) { if (!_virtualTable[rowIndex]) { return cellIndex; } if (!_virtualTable[rowIndex][cellIndex]) { return cellIndex;
javascript
{ "resource": "" }
q4009
addCellInfoToVirtual
train
function addCellInfoToVirtual(row, cell) { var cellIndex = recoverCellIndex(row.rowIndex, cell.cellIndex); var cellHasColspan = (cell.colSpan > 1); var cellHasRowspan = (cell.rowSpan > 1); var isThisSelectedCell = (row.rowIndex === _startPoint.rowPos && cell.cellIndex === _startPoint.colPos); setVirtualTablePosition(row.rowIndex, cellIndex, row, cell, cellHasRowspan, cellHasColspan, false); // Add span rows to virtual Table. var rowspanNumber = cell.attributes.rowSpan ? parseInt(cell.attributes.rowSpan.value, 10) : 0; if (rowspanNumber > 1) { for (var rp = 1; rp < rowspanNumber; rp++) { var rowspanIndex = row.rowIndex + rp; adjustStartPoint(rowspanIndex, cellIndex, cell, isThisSelectedCell); setVirtualTablePosition(rowspanIndex, cellIndex, row, cell, true, cellHasColspan, true); } }
javascript
{ "resource": "" }
q4010
adjustStartPoint
train
function adjustStartPoint(rowIndex, cellIndex, cell, isSelectedCell) { if (rowIndex === _startPoint.rowPos
javascript
{ "resource": "" }
q4011
createVirtualTable
train
function createVirtualTable() { var rows = domTable.rows; for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {
javascript
{ "resource": "" }
q4012
train
function (compiled) { // 01. Embed version var version = grunt.config('pkg.version'); compiled = compiled.replace(/@VERSION/g, version);
javascript
{ "resource": "" }
q4013
train
function (name, path, contents) { contents = contents.replace(rDefineStart, ''); if (rDefineEndWithReturn.test(contents)) { contents = contents.replace(rDefineEndWithReturn, '');
javascript
{ "resource": "" }
q4014
train
function (array, pred) { for (var idx = 0, len = array.length; idx < len; idx ++) { var item = array[idx];
javascript
{ "resource": "" }
q4015
train
function (array, fn) { if (!array.length) { return []; } var aTail = tail(array); return aTail.reduce(function (memo, v) { var aLast = last(memo); if (fn(last(aLast), v)) { aLast[aLast.length] = v;
javascript
{ "resource": "" }
q4016
train
function (filepath) { var data = {}; try { data = grunt.file.readJSON(filepath); // The concatenated file won't pass onevar
javascript
{ "resource": "" }
q4017
StatsPlugin
train
function StatsPlugin (output, options, cache) {
javascript
{ "resource": "" }
q4018
train
function() { var listWidth = 0; // The plugin must be visible for a correct calculation pgwSlideshow.plugin.show();
javascript
{ "resource": "" }
q4019
train
function(element) { var elementContainer = pgwSlideshow.plugin.find('.ps-current > ul'); elementContainer.find('li').not('.elt_' + pgwSlideshow.currentSlide).not('.elt_' + element.id).each(function(){ if (typeof $(this).stop == 'function') { $(this).stop(); } $(this).css('position', '').css('z-index', 1).hide(); }); // Current element if (pgwSlideshow.currentSlide > 0) { var currentElement = elementContainer.find('.elt_' + pgwSlideshow.currentSlide); if (typeof currentElement.animate != 'function') { currentElement.animate = function(css, duration, callback) { currentElement.css(css); if (callback) { callback(); } };
javascript
{ "resource": "" }
q4020
train
function(element, direction) { var elementContainer = pgwSlideshow.plugin.find('.ps-current > ul'); if (typeof direction == 'undefined') { direction = 'left'; } if (pgwSlideshow.currentSlide == 0) { elementContainer.find('.elt_1').css({ position : '', left : '', opacity : 1, 'z-index' : 2 }).show(); pgwSlideshow.plugin.find('.ps-list > li.elt_1').css('opacity', '1'); finishElement(element); } else { if (pgwSlideshow.transitionInProgress) { return false; } pgwSlideshow.transitionInProgress = true; // Get direction details var elementWidth = elementContainer.width(); if (direction == 'left') { var elementDest = -elementWidth; var nextOrigin = elementWidth; } else { var elementDest = elementWidth; var nextOrigin = -elementWidth; } var currentElement = elementContainer.find('.elt_' + pgwSlideshow.currentSlide); if (typeof currentElement.animate != 'function') { currentElement.animate = function(css, duration, callback) { currentElement.css(css); if (callback) { callback(); } }; } currentElement.css('position', 'absolute').animate({ left : elementDest, }, pgwSlideshow.config.transitionDuration, function() {
javascript
{ "resource": "" }
q4021
train
function(elementId, apiController, direction) { if (elementId == pgwSlideshow.currentSlide) { return false; } var element = pgwSlideshow.data[elementId - 1]; if (typeof element == 'undefined') { throw new Error('pgwSlideshow - The element ' + elementId + ' is undefined'); return false; } if (typeof direction == 'undefined') { direction = 'left'; } // Before slide if (typeof pgwSlideshow.config.beforeSlide == 'function') {
javascript
{ "resource": "" }
q4022
train
function() { var containerWidth = pgwSlideshow.plugin.find('.ps-list').width(); var listObject = pgwSlideshow.plugin.find('.ps-list > ul'); var listWidth = listObject.width(); var marginLeft = parseInt(listObject.css('margin-left')); var marginRight = parseInt(listObject.css('margin-right')); containerWidth -= (marginLeft + marginRight); var visibleZoneStart = Math.abs(parseInt(listObject.css('left'))); var visibleZoneEnd = visibleZoneStart +
javascript
{ "resource": "" }
q4023
splitPagesPromise
train
function splitPagesPromise (content) { var pages = content.split(/\f/) if (!pages) { var ex = { message: 'pdf-text-extract failed', error: 'no text returned from the pdftotext command', filePath: this.filePath, stack: new Error().stack }
javascript
{ "resource": "" }
q4024
streamResultsPromise
train
function streamResultsPromise (command, args, options, cb) { var output = '' var stderr = '' var child = spawn(command, args, options) child.stdout.setEncoding('utf8') child.stderr.setEncoding('utf8') child.stdout.on('data', stdoutHandler) child.stderr.on('data', stderrHandler) child.on('close', closeHandler) function stdoutHandler (data) { output += data }
javascript
{ "resource": "" }
q4025
train
function (graph, opts, params) { var self = this; var savedNodes = graph.allNodes.filter(function(node) { return node.props[self.db.options.id] != null && !(node.model.uniqueness && node.model.uniqueness.returnOld);
javascript
{ "resource": "" }
q4026
train
function (graph, opts, params) { var self = this; var newNodes = graph.allNodes.filter(function(node) { return node.props[self.db.options.id] == null && !(node.model.uniqueness && node.model.uniqueness.returnOld); }); if (!newNodes.length) return '';
javascript
{ "resource": "" }
q4027
train
function (graph, opts, params) { var self = this; var updatedNodes = graph.allNodes; if (opts.restrictToComp) { updatedNodes = graph.allNodes.filter(function(node) { return node.comp && node.comp.name == opts.restrictToComp; }); } function assign(statements, varName, hash) { params[varName] = hash; if (opts.additive) { _.forEach(hash, function(val, key) { statements.push(varName + '.`' + key + '`={' + varName + '}.`' + key + '`'); }); } else { statements.push(varName + '={' + varName + '}'); } } return 'SET ' + updatedNodes.reduce(function(statements, node) { // set props var
javascript
{ "resource": "" }
q4028
train
function (graph, opts, params) { if (graph.children.length == 0) return ''; function getRels(node) { var rels = []; node.children.forEach(function(childNode) {
javascript
{ "resource": "" }
q4029
beforeCommit
train
function beforeCommit(object, callback) { var self = this; async.waterfall([ this.triggerTransformEvent.bind(this, 'prepare', object), this.triggerProgressionEvent.bind(this, 'validate'), this.triggerEvent.bind(this, 'beforeSave')
javascript
{ "resource": "" }
q4030
Cacher
train
function Cacher(seq, red) { if (!(this instanceof Cacher)) { return new Cacher(seq, red); } this.method =
javascript
{ "resource": "" }
q4031
jsonReplacer
train
function jsonReplacer(key, value) { if (value && (value.DAO
javascript
{ "resource": "" }
q4032
addMethod
train
function addMethod(key) { Cacher.prototype[key] = function() { if (!this.md) {
javascript
{ "resource": "" }
q4033
getPlace
train
function getPlace() { var place = 0; while (takenPlaces.indexOf(place) !== -1) { place++;
javascript
{ "resource": "" }
q4034
hideCreateLinkOnEventItemHover
train
function hideCreateLinkOnEventItemHover() { element.on('mouseenter', function () { element.on('mousemove', checkForEventItemRAF); }); element.on('mouseleave', function () { element.off('mousemove', checkForEventItemRAF); element.removeClass('md-event-hover'); }); var lastHoverItem; var checkForEventItemRAF = $$rAF.throttle(checkForEventItem); function checkForEventItem(e) {
javascript
{ "resource": "" }
q4035
Account
train
function Account(name) { //TODO doc vars this.name = name; //debug name this.token = null; //token after requestFBToken() this.token_expire = 0; //timestamp after requestFBToken() this.token_provider = 1; //provider ID after requester this.c_user = null; //cookie from www.facebook.com this.datr = null;
javascript
{ "resource": "" }
q4036
train
function(client, packet) { var x = packet.readFloat32LE(); var y = packet.readFloat32LE(); var zoom = packet.readFloat32LE(); if(client.debug >= 4) client.log('spectate FOV update: x='
javascript
{ "resource": "" }
q4037
train
function (client, packet) { var line_x = packet.readSInt16LE(); var line_y = packet.readSInt16LE(); if (client.debug >= 4) client.log('debug line drawn
javascript
{ "resource": "" }
q4038
train
function(client, packet) { var highlights = []; var names = []; var count = packet.readUInt32LE(); for(var i=0;i<count;i++) { var highlight = packet.readUInt32LE(); var name = ''; while(1) { var char = packet.readUInt16LE(); if(char == 0) break; name += String.fromCharCode(char); } highlights.push(highlight);
javascript
{ "resource": "" }
q4039
train
function(client, packet) { var teams_count = packet.readUInt32LE(); var teams_scores = []; for (var i=0;i<teams_count;++i) { teams_scores.push(packet.readFloat32LE()); } if(JSON.stringify(client.teams_scores) == JSON.stringify(teams_scores)) return; var old_scores = client.teams_scores; if(client.debug >= 3)
javascript
{ "resource": "" }
q4040
train
function(client, packet) { var min_x = packet.readFloat64LE(); var min_y = packet.readFloat64LE(); var max_x = packet.readFloat64LE(); var max_y = packet.readFloat64LE(); if(client.debug >= 2)
javascript
{ "resource": "" }
q4041
train
function(name) { if(this.debug >= 3) this.log('spawn() called, name=' + name); if(!this.ws || this.ws.readyState !== WebSocket.OPEN) { if(this.debug >= 1) this.log('[warning] spawn() was called when connection was not established, packet will be dropped'); return false; } var buf = new Buffer(1 + 2*name.length); buf.writeUInt8(0, 0); for (var i=0;i<name.length;i++) { buf.writeUInt16LE(name.charCodeAt(i), 1 + i*2); } this.send(buf); //fix for unstable spawn on official servers if(!this.spawn_attempt && this.spawn_interval) { if(this.debug >= 4) this.log('Starting spawn() interval'); var that = this; this.spawn_attempt = 1; this.spawn_interval_id = setInterval(function() { if(that.debug >= 4) that.log('spawn() interval tick, attempt ' + that.spawn_attempt + '/' + that.spawn_attempts);
javascript
{ "resource": "" }
q4042
train
function() { if(!this.ws || this.ws.readyState !== WebSocket.OPEN) { if(this.debug >= 1) this.log('[warning] spectate() was called when connection was not established, packet will be dropped');
javascript
{ "resource": "" }
q4043
Packet
train
function Packet(e) { if(e instanceof Buffer) { this.data = e; this.length = this.data.length; }else if((typeof Buffer) != 'undefined' && e.data instanceof Buffer) { this.data = e.data; this.length = this.data.length; }else{
javascript
{ "resource": "" }
q4044
forKeys
train
function forKeys(obj, f) { for (var key in obj) { if (obj.hasOwnProperty(key) && typeof obj[key] !== 'function') {
javascript
{ "resource": "" }
q4045
processFile
train
function processFile(autogenContext, commentInfo, callback) { fs.readFile(path.resolve(__dirname, "..", autogenContext.filePath), function (readError, sourceFileContentsBuffer) { if (readError) { callback(autogenContext.filePath, readError); return; } processNextAutogenBlock(autogenContext, sourceFileContentsBuffer.toString(), commentInfo, 0, function (result,
javascript
{ "resource": "" }
q4046
processNextAutogenBlock
train
function processNextAutogenBlock(autogenContext, allData, commentInfo, pos, callback) { //Update the position of the next block. If there isn't one, call the callback and break the recursion. pos = utils.regexIndexOf(allData, commentInfo.start, pos); if (pos == -1) { callback(allData); return; } //Extract the information from the autogen definition var matchInfo = commentInfo.start.exec(allData.substring(pos)); //Skip over the start tag pos += matchInfo[0].length; //Get the data from the autogen tag var tagContent = matchInfo[1]; var autogenTagData = utils.parseAutogenTag(tagContent); //Make file name in to a full path var filename = path.resolve(autogenContext.templateDir, autogenTagData.templateFileName + ".liquid"); //Find the end of the line (and the start of content) // Handle both styles of line endings var endOfAutogenLine = utils.regexIndexOf(allData, /[\r|\n]/, pos); var startBlock = utils.regexIndexOf(allData, /[\n]/, endOfAutogenLine) + 1; var endBlock = allData.indexOf(commentInfo.end, startBlock); //Prepare and load the required data var loadedLiquid = fs.readFileSync(filename); //Deep-copy the spec data so that we can add context var dataContext = utils.extend({}, autogenContext.specData); //Populate the autogen data context with property mappings from autogen tag for (var mappingIndex in autogenTagData.propertyMappings) { var propertyMapping = autogenTagData.propertyMappings[mappingIndex]; var propValue = utils.getProp(dataContext, propertyMapping.sourceString); utils.setProp(dataContext, propertyMapping.destString, propValue); } //Populate the autogen data context with value mappings from autogen tag for (var mappingIndex in autogenTagData.valueMappings) { var valueMapping = autogenTagData.valueMappings[mappingIndex]; utils.setProp(dataContext, valueMapping.destString, valueMapping.sourceString);
javascript
{ "resource": "" }
q4047
train
function (input) { function camelCaseSingle(input) { return String(input).toLowerCase().replace(/[-|\s](.)/g, function (match, group1) { return group1.toUpperCase(); }); }
javascript
{ "resource": "" }
q4048
train
function (object, property) { return utils.getProp(object,
javascript
{ "resource": "" }
q4049
synthesize
train
function synthesize ({ name, composition, ast, version: composer, annotations = [] }) { const code = `// generated by composer v${composer} and conductor v${version}\n\nconst composition = ${JSON.stringify(composition, null, 4)}\n\n// do not edit below this point\n\n` + minify(`const main=(${main})(composition)`, { output: { max_line_len: 127 } }).code
javascript
{ "resource": "" }
q4050
inspect
train
function inspect (p) { if (!isObject(p.params)) p.params = { value: p.params } if (p.params.error !== undefined) { p.params = { error: p.params.error } // discard all fields
javascript
{ "resource": "" }
q4051
run
train
function run (f, p) { // handle let/mask pairs const view = [] let n = 0 for (let frame of p.s.stack) { if (frame.let === null) { n++ } else if (frame.let !== undefined) { if (n === 0) { view.push(frame) } else { n-- } } } // update value of topmost matching symbol on stack if any function set (symbol, value) { const element = view.find(element => element.let !== undefined && element.let[symbol] !== undefined)
javascript
{ "resource": "" }
q4052
set
train
function set (symbol, value) { const element = view.find(element => element.let !== undefined && element.let[symbol] !== undefined)
javascript
{ "resource": "" }
q4053
visit
train
function visit (composition, f) { composition = Object.assign({}, composition) // copy const combinator = composition['.combinator']() if (combinator.components) { composition.components = composition.components.map(f) } for (let arg of combinator.args || []) {
javascript
{ "resource": "" }
q4054
label
train
function label (composition) { const label = path => (composition, name, array) => { const p = path + (name !== undefined ? (array ===
javascript
{ "resource": "" }
q4055
declare
train
function declare (combinators, prefix) { if (arguments.length > 2) throw new ComposerError('Too many arguments in "declare"') if (!isObject(combinators)) throw new ComposerError('Invalid argument "combinators" in "declare"', combinators) if (prefix !== undefined && typeof prefix !== 'string') throw new ComposerError('Invalid argument "prefix" in "declare"', prefix) const composer = {} for (let key in combinators) { const type = prefix ? prefix + '.' + key : key const combinator = combinators[key] if (!isObject(combinator) || (combinator.args !== undefined && !Array.isArray(combinator.args))) { throw new ComposerError(`Invalid "${type}" combinator specification in "declare"`, combinator) } for (let arg of combinator.args || []) { if (typeof arg.name !== 'string') throw new ComposerError(`Invalid "${type}" combinator specification in "declare"`, combinator) } composer[key] = function () {
javascript
{ "resource": "" }
q4056
train
function(e) { for (var i=0, ii=touches.length; i<ii; ++i) { if (touches[i].pointerId == e.pointerId) {
javascript
{ "resource": "" }
q4057
train
function(points, firstPoint, lastPoint, tolerance){ var maxDistance = 0; var indexFarthest = 0; for (var index = firstPoint, distance; index < lastPoint; index++) { distance = perpendicularDistance(points[firstPoint], points[lastPoint], points[index]); if (distance > maxDistance) { maxDistance = distance; indexFarthest = index; } } if (maxDistance > tolerance && indexFarthest != firstPoint) { //Add the largest point
javascript
{ "resource": "" }
q4058
train
function() { var tileWidth = this.extent.getWidth() / this.map.getResolution();
javascript
{ "resource": "" }
q4059
train
function(x, y) { OpenLayers.Geometry.Point.prototype.move.apply(this, arguments);
javascript
{ "resource": "" }
q4060
train
function(x, y){ var oldX = this.x, oldY = this.y; OpenLayers.Geometry.Point.prototype.move.call(this, x, y); if(control._moving) { return; } var evt = control.dragControl.handlers.drag.evt; var constrain = (evt && evt.shiftKey) ? 45 : 1; var centerGeometry = control.center; var dx1 = this.x - centerGeometry.x; var dy1 = this.y - centerGeometry.y; var dx0 = dx1 - x; var dy0 = dy1 - y; this.x = oldX; this.y = oldY; var a0 = Math.atan2(dy0, dx0); var a1 = Math.atan2(dy1, dx1); var angle = a1 - a0; angle *= 180 / Math.PI; control._angle = (control._angle + angle) % 360;
javascript
{ "resource": "" }
q4061
train
function(pixel) { if(this.feature === control.feature) { this.feature = control.box;
javascript
{ "resource": "" }
q4062
train
function(feature, pixel) { if(feature === control.box) {
javascript
{ "resource": "" }
q4063
train
function(feature, pixel) { var eligible = !control.geometryTypes || OpenLayers.Util.indexOf(control.geometryTypes, feature.geometry.CLASS_NAME) !== -1; var i = OpenLayers.Util.indexOf(control.handles, feature); i += OpenLayers.Util.indexOf(control.rotationHandles,
javascript
{ "resource": "" }
q4064
train
function(str) { var coords = OpenLayers.String.trim(str).split(this.regExes.spaces);
javascript
{ "resource": "" }
q4065
train
function(str) { var point; var points = OpenLayers.String.trim(str).split(','); var components = []; for(var i=0, len=points.length; i<len; ++i) {
javascript
{ "resource": "" }
q4066
train
function(str) { var points = OpenLayers.String.trim(str).split(','); var components = []; for(var i=0, len=points.length; i<len; ++i) { components.push(this.parse.point.apply(this, [points[i]]).geometry); }
javascript
{ "resource": "" }
q4067
train
function(str) { var line; var lines = OpenLayers.String.trim(str).split(this.regExes.parenComma); var components = []; for(var i=0, len=lines.length; i<len; ++i) { line = lines[i].replace(this.regExes.trimParens, '$1');
javascript
{ "resource": "" }
q4068
train
function(str) { var ring, linestring, linearring; var rings = OpenLayers.String.trim(str).split(this.regExes.parenComma); var components = []; for(var i=0, len=rings.length; i<len; ++i) { ring = rings[i].replace(this.regExes.trimParens, '$1'); linestring = this.parse.linestring.apply(this, [ring]).geometry;
javascript
{ "resource": "" }
q4069
train
function(str) { var polygon; var polygons = OpenLayers.String.trim(str).split(this.regExes.doubleParenComma); var components = []; for(var i=0, len=polygons.length; i<len; ++i) { polygon = polygons[i].replace(this.regExes.trimParens, '$1');
javascript
{ "resource": "" }
q4070
train
function(str) { // separate components of the collection with | str = str.replace(/,\s*([A-Za-z])/g, '|$1'); var wktArray = OpenLayers.String.trim(str).split('|'); var components = []; for(var i=0, len=wktArray.length; i<len; ++i) {
javascript
{ "resource": "" }
q4071
train
function(node, obj) { var name = node.localName || node.nodeName.split(":").pop(); if (!(OpenLayers.Util.isArray(obj[name]))) { obj[name] = []; } var dc_element = {}; var attrs = node.attributes; for(var i=0, len=attrs.length; i<len; ++i) { dc_element[attrs[i].name] = attrs[i].nodeValue;
javascript
{ "resource": "" }
q4072
train
function(node, obj) { var name = node.localName || node.nodeName.split(":").pop(); if (!(OpenLayers.Util.isArray(obj[name]))) {
javascript
{ "resource": "" }
q4073
train
function(theDiv, options) { var topRico = theDiv.parentNode.childNodes[0]; //theDiv would be theDiv.parentNode.childNodes[1] var bottomRico = theDiv.parentNode.childNodes[2];
javascript
{ "resource": "" }
q4074
train
function (image, old) { var data1 = old.data, data2 = image.data, w1 = old.width, w2 = image.width, px1 = old.globalOffset.x, py1 = old.globalOffset.y, px2 = image.globalOffset.x, py2 = image.globalOffset.y, b1 = old.bounds, b2 = image.bounds, px = Math.min(b1.minX + px1, b2.minX + px2), // global offset for new image (by min in bounds) py = Math.min(b1.minY + py1, b2.minY + py2), b = { // bounds for new image include all of the pixels [0,0,width,height] (reduce to bounds) minX: 0, minY: 0, maxX: Math.max(b1.maxX + px1, b2.maxX + px2) - px, maxY: Math.max(b1.maxY + py1, b2.maxY + py2) - py, },
javascript
{ "resource": "" }
q4075
setupGeometry
train
function setupGeometry(regionsData, options) { options = options || {}; var regions = regionsData.regions, dataset = [], postFilter = options.postFilter || (regionsData.meta && regionsData.meta.postFilter ? new Function("region", regionsData.meta.postFilter) : 0), scheme = options.scheme || (regionsData.meta && regionsData.meta.scheme), disputedBorders = (regionsData.meta && regionsData.meta.disputedBorders) || {}, useSetup = options.recombine || options.lang || "en", disputedBorder = typeof useSetup == "string" ? disputedBorders[useSetup] : useSetup, geometry = 0; for (const i in disputedBorders) { var setup = disputedBorders[i]; for (const j in setup) { var regionSet = setup[j]; if (typeof regionSet == "string") { setup[j] = new Function("region", regionSet); } } } for (const i in regions) { if (regions.hasOwnProperty(i)) { if (!postFilter || postFilter(wrapRegion(i, regionsData))) { if (disputedBorder && disputedBorder[+i]) { geometry = recombineRegion(regionsData, { filter: disputedBorder[+i] }); } else if (scheme && scheme[+i]) { var sch = scheme[+i]; geometry = recombineRegion(regionsData, { filter: typeof sch == "string" ? new Function("region", sch) : sch
javascript
{ "resource": "" }
q4076
decodeByteVector
train
function decodeByteVector(x, N) { var point = 0; for (var i = 0; i < N; ++i) {
javascript
{ "resource": "" }
q4077
wrapRegion
train
function wrapRegion(rid, data) { var meta = data.regions[rid], prop = meta.property || {};
javascript
{ "resource": "" }
q4078
load
train
function load(path, callback, errorCallback) { try { var xhr = new XMLHttpRequest(); xhr.open("GET", path, true); xhr.onreadystatechange = function() { if (xhr.readyState === 4) { if (xhr.status === 200 || xhr.status === 304) { try { var response = JSON.parse(xhr.responseText); callback(response); } catch (e) { errorCallback(e); }
javascript
{ "resource": "" }
q4079
getDatumValue
train
function getDatumValue(datum) { for (var i in datasets) { var dataset = datasets[i]; var displayKey =
javascript
{ "resource": "" }
q4080
parseFrameUID
train
function parseFrameUID(device, data, win, fail) { if(data[0] != 0x00) return false; // The UID frame has 18 bytes + 2 bytes reserved for future use // https://github.com/google/eddystone/tree/master/eddystone-uid // Check that we got at least 18 bytes. if(data.byteLength < 18) { fail("UID frame: invalid
javascript
{ "resource": "" }
q4081
train
function () { var shrinkWrapPath = path.resolve(process.cwd(), 'npm-shrinkwrap.json'); if (fs.existsSync(shrinkWrapPath)) { logger.logInfo('[npm] using npm-shrinkwrap.json instead of package.json'); return shrinkWrapPath; } if (getNpmMajorVersion() >= 5)
javascript
{ "resource": "" }
q4082
train
function () { var composerLockPath = path.resolve(process.cwd(), 'composer.lock'); var composerJsonPath = path.resolve(process.cwd(), 'composer.json'); if (isUsingComposerLock === null) { if (fs.existsSync(composerLockPath)) { logger.logInfo('[composer] using composer.lock instead
javascript
{ "resource": "" }
q4083
train
function () { var composerInstallDirectory = 'vendor'; var exists = null; try { exists = fs.statSync(getComposerConfigPath()); } catch (e) {} if (exists !== null) {
javascript
{ "resource": "" }
q4084
train
function () { var version = 'UnknownComposer'; var versionString = shell.exec('composer --version', {silent: true}).output; // Example below: // Composer version 1.0.0-alpha9 2014-12-07 17:15:20 var versionRegex = /Composer version (\S+)/; var result = versionRegex.exec(versionString); if
javascript
{ "resource": "" }
q4085
train
function(elem, name) { if (!elem.attribs || !hasOwn.call(elem.attribs, name))
javascript
{ "resource": "" }
q4086
setCss
train
function setCss(el, prop, val, idx) { if ('string' == typeof prop) { var styles = getCss(el); if (typeof val === 'function') { val = val.call(el, idx, styles[prop]); } if (val === '') { delete styles[prop]; } else if (val != null) { styles[prop]
javascript
{ "resource": "" }
q4087
getCss
train
function getCss(el, prop) { var styles = parse(el.attribs.style); if (typeof prop === 'string') { return styles[prop];
javascript
{ "resource": "" }
q4088
stringify
train
function stringify(obj) { return Object.keys(obj || {}) .reduce(function(str, prop){
javascript
{ "resource": "" }
q4089
parse
train
function parse(styles) { styles = (styles || '').trim(); if (!styles) return {}; return styles .split(';') .reduce(function(obj, str){ var n = str.indexOf(':'); // skip if there is no :, or if it is the first/last character if (n < 1 || n
javascript
{ "resource": "" }
q4090
train
function( e, elem, $pane, $items, pos ){ $prev.add($next).show();
javascript
{ "resource": "" }
q4091
Action
train
function Action(name) { Action.super_.call(this); this.id = ActionUniqueId();
javascript
{ "resource": "" }
q4092
Login
train
function Login(username, secret) { Login.super_.call(this, 'Login');
javascript
{ "resource": "" }
q4093
QueueReload
train
function QueueReload(queue, members, rules, parameters) { QueueReload.super_.call(this, 'QueueReload'); if (undefined !== queue) { this.set('queue', queue); } if (undefined !== members) { this.set('members', members);
javascript
{ "resource": "" }
q4094
QueueStatus
train
function QueueStatus(queue, member) { QueueStatus.super_.call(this, 'QueueStatus'); if (undefined !== queue) { this.set('Queue',
javascript
{ "resource": "" }
q4095
QueueRemove
train
function QueueRemove(asteriskInterface, queue) { QueueRemove.super_.call(this, 'QueueRemove');
javascript
{ "resource": "" }
q4096
QueueAdd
train
function QueueAdd(asteriskInterface, queue, paused, memberName, penalty) { QueueAdd.super_.call(this, 'QueueAdd'); this.set('interface', asteriskInterface); this.set('queue', queue); if (undefined !== paused) { this.set('paused', paused); } if (undefined
javascript
{ "resource": "" }
q4097
MeetmeMute
train
function MeetmeMute(meetme, usernum) { MeetmeMute.super_.call(this, 'MeetmeMute');
javascript
{ "resource": "" }
q4098
MeetmeUnmute
train
function MeetmeUnmute(meetme, usernum) { MeetmeUnmute.super_.call(this,
javascript
{ "resource": "" }
q4099
ConfbridgeKick
train
function ConfbridgeKick(conference, channel) { ConfbridgeKick.super_.call(this,
javascript
{ "resource": "" }