_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q49200 | denormalizeIterable | train | function denormalizeIterable(items, entities, schema, bag) {
const isMappable = typeof items.map === 'function';
const itemSchema = Array.isArray(schema) ? schema[0] : schema.schema;
// Handle arrayOf iterables
if (isMappable) {
return items.map(o => denormalize(o, entities, itemSchema, bag));
}
// H... | javascript | {
"resource": ""
} |
q49201 | denormalizeObject | train | function denormalizeObject(obj, entities, schema, bag) {
let denormalized = obj;
const schemaDefinition = typeof schema.inferSchema === 'function'
? schema.inferSchema(obj)
: (schema.schema || schema)
;
Object.keys(schemaDefinition)
// .filter(attribute => attribute.substring(0, 1) !== '_')
.f... | javascript | {
"resource": ""
} |
q49202 | denormalizeEntity | train | function denormalizeEntity(entityOrId, entities, schema, bag) {
const key = schema.key;
const { entity, id } = resolveEntityOrId(entityOrId, entities, schema);
if (!bag.hasOwnProperty(key)) {
bag[key] = {};
}
if (!bag[key].hasOwnProperty(id)) {
// Ensure we don't mutate it non-immutable objects
... | javascript | {
"resource": ""
} |
q49203 | train | function (elm, conf) {
conf.sitekey = conf.key || config.key;
conf.theme = conf.theme || config.theme;
conf.stoken = conf.stoken || config.stoken;
conf.size = conf.size || config.size;
conf.type = conf.type || config.ty... | javascript | {
"resource": ""
} | |
q49204 | train | function() {
App.currentUser.signOut();
App.viewStack.clear();
App.router.redirect('/');
$('#fill_profile_invitation').hide();
} | javascript | {
"resource": ""
} | |
q49205 | train | function(nodemon) {
nodemon.on('log', function(event) {
console.log(event.colour);
});
// opens browser on initial server start
nodemon.on('config:update', function() {
// Delay before server listens on port
setTimeout(function()... | javascript | {
"resource": ""
} | |
q49206 | constuctIdListString | train | function constuctIdListString (items) {
var idArr = []
forEach(items, item => {
idArr.push(item.getId())
})
idArr.sort()
return idArr.join(',')
} | javascript | {
"resource": ""
} |
q49207 | zoomed | train | function zoomed () {
// Get the height and width
height = el.clientHeight
width = el.clientWidth
// Set the map tile size
tile.size([width, height])
// Get the current display bounds
var bounds = display.llBounds()
// Project the bounds based on the current projection
var psw = pr... | javascript | {
"resource": ""
} |
q49208 | matrix3d | train | function matrix3d (scale, translate) {
var k = scale / 256
var r = scale % 1 ? Number : Math.round
return 'matrix3d(' + [k, 0, 0, 0, 0, k, 0, 0, 0, 0, k, 0, r(translate[0] *
scale), r(translate[1] * scale), 0, 1] + ')'
} | javascript | {
"resource": ""
} |
q49209 | prefixMatch | train | function prefixMatch (p) {
var i = -1
var n = p.length
var s = document.body.style
while (++i < n) {
if (p[i] + 'Transform' in s) return '-' + p[i].toLowerCase() + '-'
}
return ''
} | javascript | {
"resource": ""
} |
q49210 | generateInspectStyle | train | function generateInspectStyle(originalMapStyle, coloredLayers, opts) {
opts = Object.assign({
backgroundColor: '#fff'
}, opts);
var backgroundLayer = {
'id': 'background',
'type': 'background',
'paint': {
'background-color': opts.backgroundColor
}
};
var sources = {};
Object.keys... | javascript | {
"resource": ""
} |
q49211 | brightColor | train | function brightColor(layerId, alpha) {
var luminosity = 'bright';
var hue = null;
if (/water|ocean|lake|sea|river/.test(layerId)) {
hue = 'blue';
}
if (/state|country|place/.test(layerId)) {
hue = 'pink';
}
if (/road|highway|transport/.test(layerId)) {
hue = 'orange';
}
if (/contour|bu... | javascript | {
"resource": ""
} |
q49212 | setApi | train | function setApi() {
self.api = {};
if(process && process.env && process.env.APPVEYOR_API_URL) {
var fullUrl = process.env.APPVEYOR_API_URL;
var urlParts = fullUrl.split("/")[2].split(":");
self.api = {
host: urlParts[0],
... | javascript | {
"resource": ""
} |
q49213 | postSpecsToAppVeyor | train | function postSpecsToAppVeyor() {
log.info(inColor("Posting spec batch to AppVeyor API", "magenta"));
var postData = JSON.stringify(self.unreportedSpecs);
var options = {
host: self.api.host,
path: self.api.endpoint,
port: self.api.por... | javascript | {
"resource": ""
} |
q49214 | getOutcome | train | function getOutcome(spec) {
var outcome = "None";
if(isFailed(spec)) {
outcome = "Failed";
}
if(isDisabled(spec)) {
outcome = "Ignored";
}
if(isSkipped(spec)) {
outcome = "Skipped";
}
... | javascript | {
"resource": ""
} |
q49215 | mapSpecToResult | train | function mapSpecToResult(spec) {
var firstFailedExpectation = spec.failedExpectations[0] || {};
var result = {
testName: spec.fullName,
testFramework: "jasmine2",
durationMilliseconds: elapsed(spec.__startTime, spec.__endTime),
ou... | javascript | {
"resource": ""
} |
q49216 | tclog | train | function tclog(message, attrs) {
var str = "##teamcity[" + message;
if (typeof(attrs) === "object") {
if (!("timestamp" in attrs)) {
attrs.timestamp = new Date();
}
for (var prop in attrs) {
if (attrs.hasOwnP... | javascript | {
"resource": ""
} |
q49217 | train | function (value, options) {
// Check the parameters and reassign if needed
if (typeof value === 'object') {
options = value;
value = true;
}
var selectHandler = this.remember('_selectHandler') || new SelectHandler(this);
selectHandler.init(value === und... | javascript | {
"resource": ""
} | |
q49218 | handle | train | function handle(route, file) {
route.status = 'starting';
route.emit('handle', file);
for (let layer of route.stack) {
route.emit('layer', layer, file);
layer.handle(file);
}
route.status = 'finished';
route.emit('handle', file);
return file;
} | javascript | {
"resource": ""
} |
q49219 | toRegexpSource | train | function toRegexpSource(val, keys, options) {
if (Array.isArray(val)) {
return arrayToRegexp(val, keys, options);
}
if (val instanceof RegExp) {
return regexpToRegexp(val, keys, options);
}
return stringToRegexp(val, keys, options);
} | javascript | {
"resource": ""
} |
q49220 | stringToRegexp | train | function stringToRegexp(str, keys, options = {}) {
let tokens = parse(str, options);
let end = options.end !== false;
let strict = options.strict;
let delimiter = options.delimiter ? escapeString(options.delimiter) : '\\/';
let delimiters = options.delimiters || './';
let endsWith = [].concat(options.endsWi... | javascript | {
"resource": ""
} |
q49221 | arrayToRegexp | train | function arrayToRegexp(arr, keys, options) {
let parts = [];
arr.forEach(ele => parts.push(toRegexpSource(ele, keys, options)));
return new RegExp(`(?:${parts.join('|')})`, flags(options));
} | javascript | {
"resource": ""
} |
q49222 | regexpToRegexp | train | function regexpToRegexp(regex, keys, options) {
if (!Array.isArray(keys)) return regex.source;
let groups = regex.source.match(/\((?!\?)/g);
if (!groups) return regex.source;
let i = 0;
let group = () => ({
name: i++,
prefix: null,
delimiter: null,
optional: false,
repeat: false,
par... | javascript | {
"resource": ""
} |
q49223 | getSyncMethod | train | function getSyncMethod(model, options = {}) {
const forceAjaxSync = options.ajaxSync;
const hasLocalStorage = getLocalStorage(model);
return !forceAjaxSync && hasLocalStorage ? localSync : ajaxSync;
} | javascript | {
"resource": ""
} |
q49224 | _formatResponse | train | function _formatResponse (rawMapboxResponse) {
if (!rawMapboxResponse.features.length) {
return [];
}
return [{
boundingbox: _getBoundingBox(rawMapboxResponse.features[0]),
center: _getCenter(rawMapboxResponse.features[0]),
type: _getType(rawMapboxResponse.features[0])
}];
} | javascript | {
"resource": ""
} |
q49225 | Layer | train | function Layer (source, style, options = {}) {
Base.apply(this, arguments);
_checkSource(source);
_checkStyle(style);
this._client = undefined;
this._engine = undefined;
this._internalModel = undefined;
this._source = source;
this._style = style;
this._visible = _.isBoolean(options.visible) ? optio... | javascript | {
"resource": ""
} |
q49226 | _getInteractivityFields | train | function _getInteractivityFields (columns) {
var fields = columns.map(function (column, index) {
return {
name: column,
title: true,
position: index
};
});
return {
fields: fields
};
} | javascript | {
"resource": ""
} |
q49227 | _validateAggregationColumnsAndInteractivity | train | function _validateAggregationColumnsAndInteractivity (aggregationColumns, clickColumns, overColumns) {
var aggColumns = (aggregationColumns && Object.keys(aggregationColumns)) || [];
_validateColumnsConcordance(aggColumns, clickColumns, 'featureClick');
_validateColumnsConcordance(aggColumns, overColumns, 'featu... | javascript | {
"resource": ""
} |
q49228 | parseCategoryData | train | function parseCategoryData (data, count, max, min, nulls, operation) {
if (!data) {
return null;
}
/**
* @typedef {object} carto.dataview.CategoryData
* @property {number} count - The total number of categories
* @property {number} max - Maximum category value
* @property {number} min - Minimum ca... | javascript | {
"resource": ""
} |
q49229 | Client | train | function Client (settings) {
settings.serverUrl = (settings.serverUrl || DEFAULT_SERVER_URL).replace(/{username}/, settings.username || '');
_checkSettings(settings);
this._layers = new Layers();
this._dataviews = [];
this._engine = new Engine({
apiKey: settings.apiKey,
username: settings.username,
... | javascript | {
"resource": ""
} |
q49230 | train | function (deps) {
if (!deps.mapModel) throw new Error('mapModel is required');
if (!deps.tooltipModel) throw new Error('tooltipModel is required');
if (!deps.infowindowModel) throw new Error('infowindowModel is required');
this._mapModel = deps.mapModel;
this._tooltipModel = deps.tooltipModel;
this._infowi... | javascript | {
"resource": ""
} | |
q49231 | Categories | train | function Categories (rule) {
var categoryBuckets = rule.getBucketsWithCategoryFilter();
var defaultBuckets = rule.getBucketsWithDefaultFilter();
/**
* @typedef {object} carto.layer.metadata.Category
* @property {number|string} name - The name of the category
* @property {string} value - The value of the... | javascript | {
"resource": ""
} |
q49232 | Response | train | function Response (windshaftSettings, serverResponse) {
this._windshaftSettings = windshaftSettings;
this._layerGroupId = serverResponse.layergroupid;
this._layers = serverResponse.metadata.layers;
this._dataviews = serverResponse.metadata.dataviews;
this._analyses = serverResponse.metadata.analyses;
this._... | javascript | {
"resource": ""
} |
q49233 | _formatResponse | train | function _formatResponse (rawTomTomResponse) {
if (!rawTomTomResponse.results.length) {
return [];
}
const bestCandidate = rawTomTomResponse.results[0];
return [{
boundingbox: _getBoundingBox(bestCandidate),
center: _getCenter(bestCandidate),
type: _getType(bestCandidate)
}];
} | javascript | {
"resource": ""
} |
q49234 | _getType | train | function _getType (result) {
let type = result.type;
if (TYPES[type]) {
if (type === 'Geography' && result.entityType) {
type = type + ':' + result.entityType;
}
return TYPES[type];
}
return 'default';
} | javascript | {
"resource": ""
} |
q49235 | Base | train | function Base (source, layer, options) {
options = options || {};
this._id = options.id || Base.$generateId();
} | javascript | {
"resource": ""
} |
q49236 | parseHistogramData | train | function parseHistogramData (data, nulls, totalAmount) {
if (!data) {
return null;
}
var compactData = _.compact(data);
var maxBin = _.max(compactData, function (bin) { return bin.freq || 0; });
var maxFreq = _.isFinite(maxBin.freq) && maxBin.freq !== 0
? maxBin.freq
: null;
/**
* @descripti... | javascript | {
"resource": ""
} |
q49237 | Base | train | function Base (type, rule) {
this._type = type || '';
this._column = rule.getColumn();
this._mapping = rule.getMapping();
this._property = rule.getProperty();
} | javascript | {
"resource": ""
} |
q49238 | serialize | train | function serialize (layersCollection, dataviewsCollection) {
var analysisList = AnalysisService.getAnalysisList(layersCollection, dataviewsCollection);
return _generateUniqueAnalysisList(analysisList);
} | javascript | {
"resource": ""
} |
q49239 | _generateUniqueAnalysisList | train | function _generateUniqueAnalysisList (analysisList) {
var analysisIds = {};
return _.reduce(analysisList, function (list, analysis) {
if (!analysisIds[analysis.get('id')] && !_isAnalysisPartOfOtherAnalyses(analysis, analysisList)) {
analysisIds[analysis.get('id')] = true; // keep a set of already added an... | javascript | {
"resource": ""
} |
q49240 | _isAnalysisPartOfOtherAnalyses | train | function _isAnalysisPartOfOtherAnalyses (analysis, analysisList) {
return _.any(analysisList, function (otherAnalysisModel) {
if (!analysis.equals(otherAnalysisModel)) {
return otherAnalysisModel.findAnalysisById(analysis.get('id'));
}
return false;
});
} | javascript | {
"resource": ""
} |
q49241 | train | function (defer) {
if (this.t0 !== null) {
Profiler.new_value(this.name, this._elapsed(), 't', defer);
this.t0 = null;
}
} | javascript | {
"resource": ""
} | |
q49242 | train | function () {
++this.count;
if (this.t0 === null) {
this.start();
return;
}
var elapsed = this._elapsed();
if (elapsed > 1) {
Profiler.new_value(this.name, this.count);
this.count = 0;
this.start();
}
} | javascript | {
"resource": ""
} | |
q49243 | train | function (coord, zoom, ownerDocument) {
var key = zoom + '/' + coord.x + '/' + coord.y;
if (!this.cache[key]) {
var img = this.cache[key] = new Image(256, 256);
this.cache[key].src = this._getTileUrl(coord, zoom);
this.cache[key].setAttribute('gTileKey', key);
this.cache[key]... | javascript | {
"resource": ""
} | |
q49244 | SQL | train | function SQL (query) {
_checkQuery(query);
this._query = query;
Base.apply(this, arguments);
this._appliedFilters.on('change:filters', () => this._updateInternalModelQuery(this._getQueryToApply()));
} | javascript | {
"resource": ""
} |
q49245 | train | function (settings) {
validatePresenceOfOptions(settings, ['urlTemplate', 'userName']);
if (settings.templateName) {
this.endpoints = {
get: [WindshaftConfig.MAPS_API_BASE_URL, 'named', settings.templateName, 'jsonp'].join('/'),
post: [WindshaftConfig.MAPS_API_BASE_URL, 'named', settings.templateNa... | javascript | {
"resource": ""
} | |
q49246 | Buckets | train | function Buckets (rule) {
var rangeBuckets = rule.getBucketsWithRangeFilter();
/**
* @typedef {object} carto.layer.metadata.Bucket
* @property {number} min - The minimum range value
* @property {number} max - The maximum range value
* @property {number|string} value - The value of the bucket
* @api
... | javascript | {
"resource": ""
} |
q49247 | parseFormulaData | train | function parseFormulaData (nulls, operation, result) {
/**
* @description
* Object containing formula data
*
* @typedef {object} carto.dataview.FormulaData
* @property {number} nulls - Number of null values in the column
* @property {string} operation - Operation used
* @property {number} result ... | javascript | {
"resource": ""
} |
q49248 | GoogleMapsMapType | train | function GoogleMapsMapType (layers, engine, map) {
this._layers = layers;
this._engine = engine;
this._map = map;
this._hoveredLayers = [];
this.tileSize = new google.maps.Size(256, 256);
this._internalView = new GMapsCartoDBLayerGroupView(this._engine._cartoLayerGroup, {
nativeMap: map
});
this._... | javascript | {
"resource": ""
} |
q49249 | _checkAndTransformColumns | train | function _checkAndTransformColumns (columns) {
var returnValue = null;
if (columns) {
_checkColumns(columns);
returnValue = {};
Object.keys(columns).forEach(function (key) {
returnValue[key] = _columnToSnakeCase(columns[key]);
});
}
return returnValue;
} | javascript | {
"resource": ""
} |
q49250 | _getListedError | train | function _getListedError (cartoError, errorList) {
var errorListkeys = _.keys(errorList);
var key;
for (var i = 0; i < errorListkeys.length; i++) {
key = errorListkeys[i];
if (!(errorList[key].messageRegex instanceof RegExp)) {
throw new Error('MessageRegex on ' + key + ' is not a RegExp.');
}
... | javascript | {
"resource": ""
} |
q49251 | _buildErrorCode | train | function _buildErrorCode (cartoError, key) {
var fragments = [];
fragments.push(cartoError && cartoError.origin);
fragments.push(cartoError && cartoError.type);
fragments.push(key);
fragments = _.compact(fragments);
return fragments.join(':');
} | javascript | {
"resource": ""
} |
q49252 | train | function (deps) {
if (!deps.mapView) throw new Error('mapView is required');
if (!deps.mapModel) throw new Error('mapModel is required');
this._mapView = deps.mapView;
this._mapModel = deps.mapModel;
// Map to keep track of clickable layers that are being feature overed
this._clickableLayersBeingFeatureOv... | javascript | {
"resource": ""
} | |
q49253 | BoundingBoxGoogleMaps | train | function BoundingBoxGoogleMaps (map) {
if (!_isGoogleMap(map)) {
throw new Error('Bounding box requires a Google Maps map but got: ' + map);
}
// Adapt the Google Maps map to offer unique:
// - getBounds() function
// - 'boundsChanged' event
var mapAdapter = new GoogleMapsBoundingBoxAdapter(map);
// U... | javascript | {
"resource": ""
} |
q49254 | parse | train | function parse(uriStr) {
var m = ('' + uriStr).match(URI_RE_);
if (!m) { return null; }
return new URI(
nullIfAbsent(m[1]),
nullIfAbsent(m[2]),
nullIfAbsent(m[3]),
nullIfAbsent(m[4]),
nullIfAbsent(m[5]),
nullIfAbsent(m[6]),
nullIfAbsent(m[7]));
} | javascript | {
"resource": ""
} |
q49255 | create | train | function create(scheme, credentials, domain, port, path, query, fragment) {
var uri = new URI(
encodeIfExists2(scheme, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),
encodeIfExists2(
credentials, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),
encodeIfExists(domain),
port > 0 ? port.toString(... | javascript | {
"resource": ""
} |
q49256 | encodeIfExists2 | train | function encodeIfExists2(unescapedPart, extra) {
if ('string' == typeof unescapedPart) {
return encodeURI(unescapedPart).replace(extra, encodeOne);
}
return null;
} | javascript | {
"resource": ""
} |
q49257 | resolve | train | function resolve(baseUri, relativeUri) {
// there are several kinds of relative urls:
// 1. //foo - replaces everything from the domain on. foo is a domain name
// 2. foo - replaces the last part of the path, the whole query and fragment
// 3. /foo - replaces the the path, the query and fragment
// 4. ?foo -... | javascript | {
"resource": ""
} |
q49258 | URI | train | function URI(
rawScheme,
rawCredentials, rawDomain, port,
rawPath, rawQuery, rawFragment) {
this.scheme_ = rawScheme;
this.credentials_ = rawCredentials;
this.domain_ = rawDomain;
this.port_ = port;
this.path_ = rawPath;
this.query_ = rawQuery;
this.fragment_ = rawFragment;
/**
* @type {A... | javascript | {
"resource": ""
} |
q49259 | lookupEntity | train | function lookupEntity(name) {
// TODO: entity lookup as specified by HTML5 actually depends on the
// presence of the ";".
if (ENTITIES.hasOwnProperty(name)) { return ENTITIES[name]; }
var m = name.match(decimalEscapeRe);
if (m) {
return String.fromCharCode(parseInt(m[1], 10));
} else if (... | javascript | {
"resource": ""
} |
q49260 | makeSaxParser | train | function makeSaxParser(handler) {
// Accept quoted or unquoted keys (Closure compat)
var hcopy = {
cdata: handler.cdata || handler['cdata'],
comment: handler.comment || handler['comment'],
endDoc: handler.endDoc || handler['endDoc'],
endTag: handler.endTag || handler['endTag'],
pcd... | javascript | {
"resource": ""
} |
q49261 | parseTimeSeriesData | train | function parseTimeSeriesData (data, nulls, totalAmount, offset) {
if (!data) {
return null;
}
var compactData = _.compact(data);
var maxBin = _.max(compactData, function (bin) { return bin.freq || 0; });
var maxFreq = _.isFinite(maxBin.freq) && maxBin.freq !== 0
? maxBin.freq
: null;
/**
* @... | javascript | {
"resource": ""
} |
q49262 | Dataset | train | function Dataset (tableName) {
_checkTableName(tableName);
this._tableName = tableName;
Base.apply(this, arguments);
this._appliedFilters.on('change:filters', () => this._updateInternalModelQuery(this._getQueryToApply()));
} | javascript | {
"resource": ""
} |
q49263 | Histogram | train | function Histogram (source, column, options) {
this._initialize(source, column, options);
this._bins = this._options.bins;
this._start = this._options.start;
this._end = this._options.end;
} | javascript | {
"resource": ""
} |
q49264 | train | function (deps, options) {
deps = deps || {};
options = options || {};
if (!deps.engine) throw new Error('engine is required');
if (!deps.mapModel) throw new Error('mapModel is required');
if (!deps.infowindowModel) throw new Error('infowindowModel is required');
if (!deps.tooltipModel) throw new Error('too... | javascript | {
"resource": ""
} | |
q49265 | BoundingBoxLeaflet | train | function BoundingBoxLeaflet (map) {
if (!_isLeafletMap(map)) {
throw new Error('Bounding box requires a Leaflet map but got: ' + map);
}
// Adapt the Leaflet map to offer unique:
// - getBounds() function
// - 'boundsChanged' event
var mapAdapter = new LeafletBoundingBoxAdapter(map);
// Use the adapte... | javascript | {
"resource": ""
} |
q49266 | getMetadataFromRules | train | function getMetadataFromRules (rulesData) {
var metadata = [];
rulesData.forEach(function (ruleData) {
var rule = new Rule(ruleData);
if (_isBucketsMetadata(rule)) {
metadata.push(new BucketsMetadata(rule));
} else if (_isCategoriesMetadata(rule)) {
metadata.push(new CategoriesMetadata(rul... | javascript | {
"resource": ""
} |
q49267 | pongHistogram_UpdateBars | train | function pongHistogram_UpdateBars( divId, dta, xMin, xMax ) {
log( "pongHistogram", "UpdateBars "+divId);
var pmd = moduleConfig[ divId ];
var cnt = ( pmd.blockCount ? pmd.blockCount : 10 );
// get y-axis scaling
var yMax = pmd.yAxisMax;
if ( !yMax || yMax == 'auto' ) {
yMax = 0;
for ( var i = 0; ... | javascript | {
"resource": ""
} |
q49268 | loadIncludes | train | function loadIncludes() {
for ( var module in reqModules ) {
if ( module && module != 'pong-tableXX' ) { // just to exclude modules, for debugging it's better to include them hardcoded in index.html
// extra CSS files
if ( moduleMap[ module ] ) {
if ( moduleMap[ module ].css ) {
for... | javascript | {
"resource": ""
} |
q49269 | getUrlGETparams | train | function getUrlGETparams() {
var vars = {}, hash;
var hashes = window.location.href.slice( window.location.href.indexOf('?') + 1 ).split('&');
for( var i = 0; i < hashes.length; i++ ) {
hash = hashes[i].split('=');
vars[ hash[0] ] = hash[1];
// switch on console logging
if ( ... | javascript | {
"resource": ""
} |
q49270 | publishEvent | train | function publishEvent( channelName, eventObj ) {
var broker = getEventBroker( 'main' )
eventObj.channel = channelName
broker.publish( eventObj );
} | javascript | {
"resource": ""
} |
q49271 | feedbackEvtCallback | train | function feedbackEvtCallback( evt ) {
log( "pong-feedback", "feedbackEvtCallback" )
if ( evt && evt.text ) {
log( "pong-feedback", "feedbackEvtCallback "+evt.text )
if ( pongLastFeedbackTxt.indexOf( evt.text ) >= 0 ) {
if ( evt.text.length > 0 ) {
var feedbackTxt = $.i18n( evt.text )
... | javascript | {
"resource": ""
} |
q49272 | train | function ( count, forms ) {
var pluralRules,
pluralFormIndex,
index,
explicitPluralPattern = new RegExp('\\d+=', 'i'),
formCount,
form;
if ( !forms || forms.length === 0 ) {
return '';
}
// Handle for Explicit 0= & 1= values
for ( index = 0; index < forms.length; index++ ) {
... | javascript | {
"resource": ""
} | |
q49273 | train | function ( number, pluralRules ) {
var i,
pluralForms = [ 'zero', 'one', 'two', 'few', 'many', 'other' ],
pluralFormIndex = 0;
for ( i = 0; i < pluralForms.length; i++ ) {
if ( pluralRules[pluralForms[i]] ) {
if ( pluralRuleParser( pluralRules[pluralForms[i]], number ) ) {
return pluralFor... | javascript | {
"resource": ""
} | |
q49274 | train | function ( num, integer ) {
var tmp, item, i,
transformTable, numberString, convertedNumber;
// Set the target Transform table:
transformTable = this.digitTransformTable( $.i18n().locale );
numberString = '' + num;
convertedNumber = '';
if ( !transformTable ) {
return num;
}
// Check ... | javascript | {
"resource": ""
} | |
q49275 | initializeTheSearch | train | function initializeTheSearch( divId, type , params ) {
if ( params && params.get && params.get.search ) {
//alert( JSON.stringify( moduleConfig[ divId ] ) )
var cfg = moduleConfig[ divId ];
if ( cfg.update ) {
for ( var i= 0; i < cfg.update.length; i++ ) {
var p = {}
p[ cfg.update[i... | javascript | {
"resource": ""
} |
q49276 | addSearchHeaderRenderHtml | train | function addSearchHeaderRenderHtml( divId, type , params, config ) {
log( "PoNG-Search", "add content " );
if ( ! config.page ) return;
var html = [];
var lang = '';
html.push( '<div class="pongSearch" id="'+divId+'">' );
html.push( '<form id="'+divId+'Form">' );
html.push( '<input type="hidden" name="layou... | javascript | {
"resource": ""
} |
q49277 | pongSrcCodeDivRenderHTML | train | function pongSrcCodeDivRenderHTML( divId, resourceURL, params, cfg ) {
log( "Pong-SrcCode", "load source code" );
if ( ! cfg.type ) { cfg.type = "plain"; }
$.get( resourceURL, params )
.done(
function ( srcData ) {
jQuerySyntaxInsertCode( divId, srcData, cfg.type, cfg.options||{} );
}
).fail( funct... | javascript | {
"resource": ""
} |
q49278 | pongListDivHTML | train | function pongListDivHTML( divId, resourceURL, params ) {
log( "PoNG-List", "divId="+divId+" resourceURL="+resourceURL );
pongTableInit( divId, "PongList" );
if ( moduleConfig[ divId ] != null ) {
renderPongListDivHTML( divId, resourceURL, params, moduleConfig[ divId ] );
} else {
$.getJSON(
resourceUR... | javascript | {
"resource": ""
} |
q49279 | train | function( locale, messages ) {
if ( !this.messages[locale] ) {
this.messages[locale] = messages;
} else {
this.messages[locale] = $.extend( this.messages[locale], messages );
}
} | javascript | {
"resource": ""
} | |
q49280 | pongOnTheFlyAddActionBtn | train | function pongOnTheFlyAddActionBtn(id, modalName, resourceURL, params) {
log( "PoNG-OnTheFly", "modalFormAddActionBtn " + id );
if ( !modalName ) {
modalName = "OnTheFly";
}
var buttonLbl = modalName;
if ( params && params.showConfig ) {
buttonLbl = 'Show the configruation of this view...';
}
var ... | javascript | {
"resource": ""
} |
q49281 | pongOnTheFlyCreModalFromMeta | train | function pongOnTheFlyCreModalFromMeta(id, modalName, resourceURL) {
log( "PoNG-OnTheFly", "Create modal view content " + resourceURL );
if ( !modalName ) {
modalName = "OnTheFly";
}
if ( resourceURL ) {
log( "PoNG-OnTheFly", "Get JSON for " + id );
// var jsonCfg = pongOnTheFlyFindSubJSON( layoutOr... | javascript | {
"resource": ""
} |
q49282 | train | function () {
var i18n = this;
// Set locale of String environment
String.locale = i18n.locale;
// Override String.localeString method
String.prototype.toLocaleString = function () {
var localeParts, localePartIndex, value, locale, fallbackIndex,
tryingLocale, message;
value = this.valueO... | javascript | {
"resource": ""
} | |
q49283 | train | function ( key, parameters ) {
var message = key.toLocaleString();
// FIXME: This changes the state of the I18N object,
// should probably not change the 'this.parser' but just
// pass it to the parser.
this.parser.language = $.i18n.languages[$.i18n().locale] || $.i18n.languages['default'];
if( messag... | javascript | {
"resource": ""
} | |
q49284 | train | function ( message, parameters ) {
return message.replace( /\$(\d+)/g, function ( str, match ) {
var index = parseInt( match, 10 ) - 1;
return parameters[index] !== undefined ? parameters[index] : '$' + match;
} );
} | javascript | {
"resource": ""
} | |
q49285 | choice | train | function choice ( parserSyntax ) {
return function () {
var i, result;
for ( i = 0; i < parserSyntax.length; i++ ) {
result = parserSyntax[i]();
if ( result !== null ) {
return result;
}
}
return null;
};
} | javascript | {
"resource": ""
} |
q49286 | sequence | train | function sequence ( parserSyntax ) {
var i, res,
originalPos = pos,
result = [];
for ( i = 0; i < parserSyntax.length; i++ ) {
res = parserSyntax[i]();
if ( res === null ) {
pos = originalPos;
return null;
}
result.push( res );
}
return result;
} | javascript | {
"resource": ""
} |
q49287 | nOrMore | train | function nOrMore ( n, p ) {
return function () {
var originalPos = pos,
result = [],
parsed = p();
while ( parsed !== null ) {
result.push( parsed );
parsed = p();
}
if ( result.length < n ) {
pos = originalPos;
return null;
}
return result;
... | javascript | {
"resource": ""
} |
q49288 | pongTableCmpFields | train | function pongTableCmpFields( a, b ) {
var cellValA = getSubData( a, pongTable_sc );
var cellValB = getSubData( b, pongTable_sc );
log( "Pong-Table", 'Sort: '+pongTable_sc+" "+cellValA+" "+cellValB );
if ( Number( cellValA ) && Number( cellValB ) ) {
if ( ! isNaN( parseFloat( cellValA ) ) && ! isNaN( parseFl... | javascript | {
"resource": ""
} |
q49289 | pongListUpdateRow | train | function pongListUpdateRow( divId, divs, rowDta, r, cx, i, tblDiv ) {
log( "PoNG-List", 'upd-div row='+r+'/'+cx );
for ( var c = 0; c < divs.length; c ++ ) {
log( "PoNG-List", 'upd-div '+cx+'/'+c );
if ( divs[c].cellType == 'div' ) {
log( "PoNG-List", 'upd-div-x '+divs[c].id );
if ( divs[c].divs... | javascript | {
"resource": ""
} |
q49290 | encryptSecrects | train | function encryptSecrects(server, cryptoSecret, oldSever) {
const updatedServer = { ...server };
/* eslint no-param-reassign:0 */
if (server.password) {
const isPassDiff = (oldSever && server.password !== oldSever.password);
if (!oldSever || isPassDiff) {
updatedServer.password = crypto.encrypt(ser... | javascript | {
"resource": ""
} |
q49291 | BundleFile | train | function BundleFile() {
var location = getTempFileName('.browserify.js');
function write(content) {
fs.writeFileSync(location, content);
}
function exists() {
return fs.existsSync(location);
}
function remove() {
if (exists()) {
fs.unlinkSync(location);
}
}
function touch() {
... | javascript | {
"resource": ""
} |
q49292 | extractSourceMap | train | function extractSourceMap(bundleContents) {
var start = bundleContents.lastIndexOf('//# sourceMappingURL');
var sourceMapComment = start !== -1 ? bundleContents.substring(start) : '';
return sourceMapComment && convert.fromComment(sourceMapComment);
} | javascript | {
"resource": ""
} |
q49293 | addBundleFile | train | function addBundleFile(bundleFile, config) {
var files = config.files,
preprocessors = config.preprocessors;
// list of patterns using our preprocessor
var patterns = reduce(preprocessors, function(matched, val, key) {
if (val.indexOf('browserify') !== -1) {
matched.push(key);
... | javascript | {
"resource": ""
} |
q49294 | framework | train | function framework(emitter, config, logger) {
log = logger.create('framework.browserify');
if (!bundleFile) {
bundleFile = new BundleFile();
}
bundleFile.touch();
log.debug('created browserify bundle: %s', bundleFile.location);
b = createBundle(config);
// TODO(Nikku): hook into k... | javascript | {
"resource": ""
} |
q49295 | bundlePreprocessor | train | function bundlePreprocessor(config) {
var debug = config.browserify && config.browserify.debug;
function updateSourceMap(file, content) {
var map;
if (debug) {
map = extractSourceMap(content);
file.sourceMap = map && map.sourcemap;
}
}
return function(content, fil... | javascript | {
"resource": ""
} |
q49296 | Dropdown | train | function Dropdown(element, completer, option) {
this.$el = Dropdown.createElement(option);
this.completer = completer;
this.id = completer.id + 'dropdown';
this._data = []; // zipped data.
this.$inputEl = $(element);
this.option = option;
// Override setPosition method.... | javascript | {
"resource": ""
} |
q49297 | train | function (e) {
var $el = $(e.target);
e.preventDefault();
if (!$el.hasClass('textcomplete-item')) {
$el = $el.closest('.textcomplete-item');
}
this._index = parseInt($el.data('index'), 10);
this._activateIndexedItem();
} | javascript | {
"resource": ""
} | |
q49298 | train | function (func) {
var memo = {};
return function (term, callback) {
if (memo[term]) {
callback(memo[term]);
} else {
func.call(this, term, function (data) {
memo[term] = (memo[term] || []).concat(data);
callback.apply(null, arguments);
});
}
};
... | javascript | {
"resource": ""
} | |
q49299 | train | function (value, strategy, e) {
var pre = this.getTextFromHeadToCaret();
// use ownerDocument instead of window to support iframes
var sel = this.el.ownerDocument.getSelection();
var range = sel.getRangeAt(0);
var selection = range.cloneRange();
selection.selectNodeContents(ra... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.