_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q53700 | train | function(name) {
var args = _.toArray(arguments).slice(1);
var results = eventsApi(this, 'request', name, args);
if (results) {
return results;
}
var channelName = this.channelName;
var requests = this._requests;
// Check if we should log the request, and if so, do it
if (channelN... | javascript | {
"resource": ""
} | |
q53701 | train | function(name, callback, context) {
if (eventsApi(this, 'replyOnce', name, [callback, context])) {
return this;
}
var self = this;
var once = _.once(function() {
self.stopReplying(name);
return makeCallback(callback).apply(this, arguments);
});
return this.reply(name, once, ... | javascript | {
"resource": ""
} | |
q53702 | isDelimiter | train | function isDelimiter(code) {
return code === 0x22 // '"'
|| code === 0x28 // '('
|| code === 0x29 // ')'
|| code === 0x2C // ','
|| code === 0x2F // '/'
|| code >= 0x3A && code <= 0x40 // ':', ';', '<', '=', '>', ... | javascript | {
"resource": ""
} |
q53703 | isTokenChar | train | function isTokenChar(code) {
return code === 0x21 // '!'
|| code >= 0x23 && code <= 0x27 // '#', '$', '%', '&', '''
|| code === 0x2A // '*'
|| code === 0x2B // '+'
|| code === 0x2D // '-'
|| code === 0x2E // '.'
... | javascript | {
"resource": ""
} |
q53704 | ParseError | train | function ParseError(message, input) {
Error.captureStackTrace(this, ParseError);
this.name = this.constructor.name;
this.message = message;
this.input = input;
} | javascript | {
"resource": ""
} |
q53705 | extractPath | train | function extractPath(schemaPath) {
const subNames = schemaPath.path.split('.');
return reduceRight(subNames, (fields, name, key) => {
const obj = {};
if (schemaPath instanceof mongoose.Schema.Types.DocumentArray) {
const subSchemaPaths = schemaPath.schema.paths;
const fields = extractPaths(sub... | javascript | {
"resource": ""
} |
q53706 | extractPaths | train | function extractPaths(schemaPaths, model) {
return reduce(schemaPaths, (fields, schemaPath) => (
merge(fields, extractPath(schemaPath, model))
), {});
} | javascript | {
"resource": ""
} |
q53707 | getModel | train | function getModel(model) {
const schemaPaths = model.schema.paths;
const name = model.modelName;
const fields = extractPaths(schemaPaths, { name });
return {
name,
fields,
model
};
} | javascript | {
"resource": ""
} |
q53708 | getIdFetcher | train | function getIdFetcher(graffitiModels) {
return function idFetcher(obj, { id: globalId }, context, info) {
const { type, id } = fromGlobalId(globalId);
if (type === 'Viewer') {
return viewer;
} else if (graffitiModels[type]) {
const Collection = graffitiModels[type].model;
return getOne(... | javascript | {
"resource": ""
} |
q53709 | emptyConnection | train | function emptyConnection() {
return {
count: 0,
edges: [],
pageInfo: {
startCursor: null,
endCursor: null,
hasPreviousPage: false,
hasNextPage: false
}
};
} | javascript | {
"resource": ""
} |
q53710 | connectionFromModel | train | async function connectionFromModel(graffitiModel, args, context, info) {
const Collection = graffitiModel.model;
if (!Collection) {
return emptyConnection();
}
const { before, after, first, last, id, orderBy = { _id: 1 }, ...selector } = args;
const begin = getId(after);
const end = getId(before);
... | javascript | {
"resource": ""
} |
q53711 | stringToGraphQLType | train | function stringToGraphQLType(type) {
switch (type) {
case 'String':
return GraphQLString;
case 'Number':
return GraphQLFloat;
case 'Date':
return GraphQLDate;
case 'Buffer':
return GraphQLBuffer;
case 'Boolean':
return GraphQLBoolean;
case 'ObjectID':
return... | javascript | {
"resource": ""
} |
q53712 | listToGraphQLEnumType | train | function listToGraphQLEnumType(list, name) {
const values = reduce(list, (values, val) => {
values[val] = { value: val };
return values;
}, {});
return new GraphQLEnumType({ name, values });
} | javascript | {
"resource": ""
} |
q53713 | getTypeFields | train | function getTypeFields(type) {
const fields = type._typeConfig.fields;
return isFunction(fields) ? fields() : fields;
} | javascript | {
"resource": ""
} |
q53714 | getOrderByType | train | function getOrderByType({ name }, fields) {
if (!orderByTypes[name]) {
// save new enum
orderByTypes[name] = new GraphQLEnumType({
name: `orderBy${name}`,
values: reduce(fields, (values, field) => {
if (field.type instanceof GraphQLScalarType) {
const upperCaseName = field.name.t... | javascript | {
"resource": ""
} |
q53715 | getArguments | train | function getArguments(type, args = {}) {
const fields = getTypeFields(type);
return reduce(fields, (args, field) => {
// Extract non null fields, those are not required in the arguments
if (field.type instanceof GraphQLNonNull && field.name !== 'id') {
field.type = field.type.ofType;
}
if (f... | javascript | {
"resource": ""
} |
q53716 | getTypeFieldName | train | function getTypeFieldName(typeName, fieldName) {
const fieldNameCapitalized = fieldName.charAt(0).toUpperCase() + fieldName.slice(1);
return `${typeName}${fieldNameCapitalized}`;
} | javascript | {
"resource": ""
} |
q53717 | getFields | train | function getFields(graffitiModels, {
hooks = {}, mutation = true, allowMongoIDMutation = false,
customQueries = {}, customMutations = {}
} = {}) {
const types = type.getTypes(graffitiModels);
const { viewer, singular } = hooks;
const viewerFields = reduce(types, (fields, type, key) => {
type.name =... | javascript | {
"resource": ""
} |
q53718 | getSchema | train | function getSchema(mongooseModels, options) {
if (!isArray(mongooseModels)) {
mongooseModels = [mongooseModels];
}
const graffitiModels = model.getModels(mongooseModels);
const fields = getFields(graffitiModels, options);
return new GraphQLSchema(fields);
} | javascript | {
"resource": ""
} |
q53719 | train | function (name) {
var dotPos = name.indexOf('.');
if (dotPos > -1) {
name = name.substring(0, dotPos);
}
return name;
} | javascript | {
"resource": ""
} | |
q53720 | detectDependencies | train | function detectDependencies(config) {
var allDependencies = {};
if (config.get('dependencies')) {
$._.assign(allDependencies, config.get('bower.json').dependencies);
}
if (config.get('dev-dependencies')) {
$._.assign(allDependencies, config.get('bower.json').devDependencies);
}
if (config.get('in... | javascript | {
"resource": ""
} |
q53721 | injectDependencies | train | function injectDependencies(globalConfig) {
config = globalConfig;
var stream = config.get('stream');
globalDependenciesSorted = config.get('global-dependencies-sorted');
ignorePath = config.get('ignore-path');
fileTypes = config.get('file-types');
if (stream.src) {
config.set('stream', {
src: i... | javascript | {
"resource": ""
} |
q53722 | uiTagOffset | train | function uiTagOffset(corners) {
return {
top: corners.top + corners.height / 2 - 10,
left: corners.right - 6
};
} | javascript | {
"resource": ""
} |
q53723 | filterDomElement | train | function filterDomElement(domElement, names, labels) {
/*
Where we look to find a match, in this order:
name, id, <label> tags, placeholder, title
Our searches first conduct fairly liberal "contains" searches:
if the attribute even contains the name or label, we map it.
The names and labels we ch... | javascript | {
"resource": ""
} |
q53724 | turnOffAllClicks | train | function turnOffAllClicks(selectors) {
if (Array.isArray(selectors) || typeof selectors == "object") {
for (var selector in selectors) {
if (selectors.hasOwnProperty(selector)) {
$("body").off("click", selectors[selector]);
}
}
} else if (typeof selectors === "string") {
$("body").off(... | javascript | {
"resource": ""
} |
q53725 | train | function (invokeOn, invokeFunction) {
if (invokeOn && typeof invokeOn !== "function" && invokeFunction) {
if (invokeFunction == "click") {
setTimeout(function () {
$(invokeOn).click(); // Very particular: we MUST fire the native "click" event!
}, 5);
} else if (invokeFunction == "submit")
$(inv... | javascript | {
"resource": ""
} | |
q53726 | train | function (options, patterns) {
// Return all matching filepaths.
var matches = processPatterns(patterns, function (pattern) {
// Find all matching files for this pattern.
return glob.sync(pattern, options);
});
// Filter result set?
if (options.filter) {
matches = matches.filter(func... | javascript | {
"resource": ""
} | |
q53727 | FusionPoseSensor | train | function FusionPoseSensor(kFilter, predictionTime, yawOnly, isDebug) {
this.yawOnly = yawOnly;
this.accelerometer = new MathUtil.Vector3();
this.gyroscope = new MathUtil.Vector3();
this.filter = new ComplementaryFilter(kFilter, isDebug);
this.posePredictor = new PosePredictor(predictionTime, isDebug);
th... | javascript | {
"resource": ""
} |
q53728 | DeviceInfo | train | function DeviceInfo(deviceParams, additionalViewers) {
this.viewer = Viewers.CardboardV2;
this.updateDeviceParams(deviceParams);
this.distortion = new Distortion(this.viewer.distortionCoefficients);
for (var i = 0; i < additionalViewers.length; i++) {
var viewer = additionalViewers[i];
Viewers[viewer.id... | javascript | {
"resource": ""
} |
q53729 | CardboardDistorter | train | function CardboardDistorter(gl, cardboardUI, bufferScale, dirtySubmitFrameBindings) {
this.gl = gl;
this.cardboardUI = cardboardUI;
this.bufferScale = bufferScale;
this.dirtySubmitFrameBindings = dirtySubmitFrameBindings;
this.ctxAttribs = gl.getContextAttributes();
this.meshWidth = 20;
this.meshHeight =... | javascript | {
"resource": ""
} |
q53730 | PosePredictor | train | function PosePredictor(predictionTimeS, isDebug) {
this.predictionTimeS = predictionTimeS;
this.isDebug = isDebug;
// The quaternion corresponding to the previous state.
this.previousQ = new MathUtil.Quaternion();
// Previous time a prediction occurred.
this.previousTimestampS = null;
// The delta quate... | javascript | {
"resource": ""
} |
q53731 | CardboardVRDisplay | train | function CardboardVRDisplay(config) {
var defaults = Util.extend({}, Options);
config = Util.extend(defaults, config || {});
VRDisplay.call(this, {
wakelock: config.MOBILE_WAKE_LOCK,
});
this.config = config;
this.displayName = 'Cardboard VRDisplay';
this.capabilities = new VRDisplayCapabilities({... | javascript | {
"resource": ""
} |
q53732 | ViewerSelector | train | function ViewerSelector(defaultViewer) {
// Try to load the selected key from local storage.
try {
this.selectedKey = localStorage.getItem(VIEWER_KEY);
} catch (error) {
console.error('Failed to load viewer profile: %s', error);
}
//If none exists, or if localstorage is unavailable, use the default k... | javascript | {
"resource": ""
} |
q53733 | ComplementaryFilter | train | function ComplementaryFilter(kFilter, isDebug) {
this.kFilter = kFilter;
this.isDebug = isDebug;
// Raw sensor measurements.
this.currentAccelMeasurement = new SensorSample();
this.currentGyroMeasurement = new SensorSample();
this.previousGyroMeasurement = new SensorSample();
// Set default look directi... | javascript | {
"resource": ""
} |
q53734 | addInstallation | train | async function addInstallation (installations, name, instPath) {
var fileExists = await exists(instPath);
if (fileExists) {
Object.keys(ALIASES).some(alias => {
var { nameRe, cmd, macOpenCmdTemplate, path } = ALIASES[alias];
if (nameRe.test(name)) {
installation... | javascript | {
"resource": ""
} |
q53735 | setClass | train | function setClass(dom, cls, on) {
if (on) dom.classList.add(cls)
else dom.classList.remove(cls)
} | javascript | {
"resource": ""
} |
q53736 | selectionIsInverted | train | function selectionIsInverted(selection) {
if (selection.anchorNode == selection.focusNode) return selection.anchorOffset > selection.focusOffset
return selection.anchorNode.compareDocumentPosition(selection.focusNode) == Node.DOCUMENT_POSITION_FOLLOWING
} | javascript | {
"resource": ""
} |
q53737 | Select | train | function Select(el, options) {
_classCallCheck(this, Select);
// Don't init if browser default version
var _this16 = _possibleConstructorReturn(this, (Select.__proto__ || Object.getPrototypeOf(Select)).call(this, Select, el, options));
if (_this16.$el.hasClass('browser-default')) {
ret... | javascript | {
"resource": ""
} |
q53738 | vPaneController | train | function vPaneController ($scope) {
var ctrl = this;
ctrl.isExpanded = function isExpanded () {
return $scope.isExpanded;
};
ctrl.toggle = function toggle () {
if (!$scope.isAnimating && !$scope.isDisabled) {
$scope.accordionCtrl.toggle($scope);
}
};
ctrl.expand = function expand () {
... | javascript | {
"resource": ""
} |
q53739 | maxDurationMsPerTimelinePx | train | function maxDurationMsPerTimelinePx(earliestTimestamp) {
const durationMsLowerBound = minDurationMsPerTimelinePx();
const durationMsUpperBound = moment.duration(3, 'days').asMilliseconds();
const durationMs = availableTimelineDurationMs(earliestTimestamp) / 400.0;
return clamp(durationMs, durationMsLowerBound, ... | javascript | {
"resource": ""
} |
q53740 | isSubComponent | train | function isSubComponent(resource) {
const [dir, module] = resource.split('/').filter(n => n !== '.');
return dir !== module;
} | javascript | {
"resource": ""
} |
q53741 | ENS | train | function ENS (provider, address, Web3js) {
if (Web3js !== undefined) {
Web3 = Web3js;
}
if (!!/^0\./.exec(Web3.version || (new Web3(provider)).version.api)) {
return utils.construct(ENS_0, [provider, address]);
} else {
return utils.construct(ENS_1, [provider, address]);
}
} | javascript | {
"resource": ""
} |
q53742 | initJasmineWd | train | function initJasmineWd(scheduler, webdriver) {
if (jasmine.JasmineWdInitialized) {
throw Error('JasmineWd already initialized when init() was called');
}
jasmine.JasmineWdInitialized = true;
// Pull information from webdriver instance
if (webdriver) {
WebElement = webdriver.WebElement || WebElement;... | javascript | {
"resource": ""
} |
q53743 | compareDone | train | function compareDone(pass) {
var message = '';
if (!pass) {
if (!result.message) {
args.unshift(expectation.isNot);
args.unshift(name);
message = expectation.util.buildFailureMessage.apply(null, args);
} else {
if (Object.prototype.toString.apply(result... | javascript | {
"resource": ""
} |
q53744 | train | function() {
var w = 0;
// IE
if (typeof( window.innerWidth ) != 'number') {
if (!(document.documentElement.clientWidth === 0)) {
// strict mode
w = document.documentElement.clientWidth;
} else {
// quirks mode
w = document.body.clientWidth;
}
} else {
// w3c
w ... | javascript | {
"resource": ""
} | |
q53745 | train | function(elm) {
if (elm.length === undefined) {
addToStack(elm);
} else {
for (var i = 0; i < elm.length; i++) {
addToStack(elm[i]);
}
}
} | javascript | {
"resource": ""
} | |
q53746 | train | function(elm) {
var brkpt = elm['breakpoint'];
var entr = elm['enter'] || undefined;
// add function to stack
mediaListeners.push(elm);
// add corresponding entry to mediaInit
mediaInit.push(false);
if (testForCurr(brkpt)) {
if (entr !== undefined) {
entr.call(null, {entering : curr, ex... | javascript | {
"resource": ""
} | |
q53747 | train | function() {
var enterArray = [];
var exitArray = [];
for (var i = 0; i < mediaListeners.length; i++) {
var brkpt = mediaListeners[i]['breakpoint'];
var entr = mediaListeners[i]['enter'] || undefined;
var exit = mediaListeners[i]['exit'] || undefined;
if (brkpt === '*') {
if (entr !== u... | javascript | {
"resource": ""
} | |
q53748 | train | function(width) {
var foundBrkpt = false;
// look for existing breakpoint based on width
for (var i = 0; i < mediaBreakpoints.length; i++) {
// if registered breakpoint found, break out of loop
if (width >= mediaBreakpoints[i]['enter'] && width <= mediaBreakpoints[i]['exit']) {
foundBrkpt = tru... | javascript | {
"resource": ""
} | |
q53749 | train | function() {
// get current width
var w = winWidth();
// if there is a change speed up the timer and fire the returnBreakpoint function
if (w !== resizeW) {
resizeTmrSpd = resizeTmrFast;
returnBreakpoint(w);
// otherwise keep on keepin' on
} else {
resizeTmrSpd = resizeTmrSlow;
}
... | javascript | {
"resource": ""
} | |
q53750 | isNotAPattern | train | function isNotAPattern(pattern) {
let set = new Minimatch(pattern).set;
if (set.length > 1) {
return false;
}
for (let j = 0; j < set[0].length; j++) {
if (typeof set[0][j] !== 'string') {
return false;
}
}
return true;
} | javascript | {
"resource": ""
} |
q53751 | Deckgrid | train | function Deckgrid (scope, element) {
var self = this,
watcher,
mql;
this.$$elem = element;
this.$$watchers = [];
this.$$scope = scope;
this.$$scope.columns = [];
//
// The layout configuration will be ... | javascript | {
"resource": ""
} |
q53752 | buildRequiredAssets | train | function buildRequiredAssets(self, context) {
var paths = context.__requiredPaths__.concat([ self.pathname ]),
assets = resolveDependencies(self, paths),
stubs = resolveDependencies(self, context.__stubbedAssets__);
if (stubs.length > 0) {
// exclude stubbed assets if any
assets = _.filter... | javascript | {
"resource": ""
} |
q53753 | computeDependencyDigest | train | function computeDependencyDigest(self) {
return _.reduce(self.requiredAssets, function (digest, asset) {
return digest.update(asset.digest);
}, self.environment.digest).digest('hex');
} | javascript | {
"resource": ""
} |
q53754 | sassError | train | function sassError(ctx /*, options*/) {
if (ctx.line && ctx.message) { // libsass 3.x error object
return new Error('Line ' + ctx.line + ': ' + ctx.message);
}
if (typeof ctx === 'string') { // libsass error string format: path:line: error: message
var error = _.zipObject(
[ 'path', 'line', 'level',... | javascript | {
"resource": ""
} |
q53755 | importArgumentRelativeToSearchPaths | train | function importArgumentRelativeToSearchPaths(importer, importArgument, searchPaths) {
var importAbsolutePath = path.resolve(path.dirname(importer), importArgument);
var importSearchPath = _.find(searchPaths, function (path) {
return importAbsolutePath.indexOf(path) === 0;
});
if (importSearchPath) {
ret... | javascript | {
"resource": ""
} |
q53756 | flattenDepth | train | function flattenDepth (array, depth) {
if (!Array.isArray(array)) {
throw new TypeError('Expected value to be an array')
}
return flattenFromDepth(array, depth)
} | javascript | {
"resource": ""
} |
q53757 | flattenDown | train | function flattenDown (array, result) {
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (Array.isArray(value)) {
flattenDown(value, result)
} else {
result.push(value)
}
}
return result
} | javascript | {
"resource": ""
} |
q53758 | flattenDownDepth | train | function flattenDownDepth (array, result, depth) {
depth--
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (depth > -1 && Array.isArray(value)) {
flattenDownDepth(value, result, depth)
} else {
result.push(value)
}
}
return result
} | javascript | {
"resource": ""
} |
q53759 | matches_filter | train | function matches_filter(filters, logicalPath, filename) {
if (filters.length === 0) {
return true;
}
return _.some(filters, function (filter) {
if (_.isRegExp(filter)) {
return filter.test(logicalPath);
}
if (_.isFunction(filter)) {
return filter(logicalPath, filename);
}
//... | javascript | {
"resource": ""
} |
q53760 | logical_path_for_filename | train | function logical_path_for_filename(self, filename, filters) {
var logical_path = self.attributesFor(filename).logicalPath;
if (matches_filter(filters, logical_path, filename)) {
return logical_path;
}
// If filename is an index file, retest with alias
if (path.basename(filename).split('.').shift() === '... | javascript | {
"resource": ""
} |
q53761 | rewrite_extension | train | function rewrite_extension(source, ext) {
var source_ext = path.extname(source);
return (source_ext === ext) ? source : (source + ext);
} | javascript | {
"resource": ""
} |
q53762 | configuration | train | function configuration(self, name) {
if (!self.__configurations__[name]) {
throw new Error('Unknown configuration: ' + name);
}
return self.__configurations__[name];
} | javascript | {
"resource": ""
} |
q53763 | stub_getter | train | function stub_getter(name) {
getter(Asset.prototype, name, function () {
// this should never happen, as Asset is an abstract class and not
// supposed to be used directly. subclasses must override this getters
throw new Error(this.constructor.name + '#' + name + ' getter is not implemented.');
});
} | javascript | {
"resource": ""
} |
q53764 | end | train | function end(res, code) {
if (code >= 400) {
// check res object contains connect/express request and next structure
if (res.req && res.req.next) {
var error = new Error(http.STATUS_CODES[code]);
error.status = code;
return res.req.next(error);
}
// write human-friendly error messag... | javascript | {
"resource": ""
} |
q53765 | log_event | train | function log_event(req, code, message, elapsed) {
return {
code: code,
message: message,
elapsed: elapsed,
request: req,
url: req.originalUrl || req.url,
method: req.method,
headers: req.headers,
httpVersion: req.httpVersion,
... | javascript | {
"resource": ""
} |
q53766 | getModuleVersionFromConfig | train | function getModuleVersionFromConfig(config) {
if (config.moduleVersion === undefined && config.nodePackageName == CORDOVA) {
// If no version is set, try to get the version from taco.json
// This check is specific to the Cordova module
if (utilities.fileExistsSync(path.join(config.projectPat... | javascript | {
"resource": ""
} |
q53767 | cacheModule | train | function cacheModule(config) {
config = utilities.parseConfig(config);
var moduleCache = utilities.getCachePath();
console.log('Module cache at ' + moduleCache);
var version = getModuleVersionFromConfig(config);
var pkgStr = config.nodePackageName + (version ? '@' + version : '');
return utili... | javascript | {
"resource": ""
} |
q53768 | loadModule | train | function loadModule(modulePath) {
// Setup environment
if (loadedModule === undefined || loadedModulePath != modulePath) {
loadedModule = require(modulePath);
loadedModulePath = modulePath;
return Q(loadedModule);
} else {
return Q(loadedModule);
}
} | javascript | {
"resource": ""
} |
q53769 | getCallArgs | train | function getCallArgs(platforms, args, cordovaVersion) {
// Processes single platform string (or array of length 1) and an array of args or an object of args per platform
args = args || [];
if (typeof (platforms) == 'string') {
platforms = [platforms];
}
// If only one platform is specif... | javascript | {
"resource": ""
} |
q53770 | isCompatibleNpmPackage | train | function isCompatibleNpmPackage(pkgName) {
if (pkgName !== 'cordova' && pkgName.indexOf('cordova@') !== 0) {
return Q(NodeCompatibilityResult.Compatible);
}
// Get the version of npm and the version of cordova requested. If the
// cordova version <= 5.3.3, and the Node version is 5.0.0, the... | javascript | {
"resource": ""
} |
q53771 | applyExecutionBitFix | train | function applyExecutionBitFix(platforms) {
// Only bother if we're on OSX and are after platform add for iOS itself (still need to run for other platforms)
if (process.platform !== "darwin" && process.platform !== 'linux') {
return Q();
}
// Disable -E flag for non-OSX platforms
var regex_f... | javascript | {
"resource": ""
} |
q53772 | prepareProject | train | function prepareProject(cordovaPlatforms, args, /* optional */ projectPath) {
if (typeof (cordovaPlatforms) == "string") {
cordovaPlatforms = [cordovaPlatforms];
}
if (!projectPath) {
projectPath = defaultConfig.projectPath;
}
var appendedVersion = cache.getModuleVersionFromConfig(... | javascript | {
"resource": ""
} |
q53773 | buildProject | train | function buildProject(cordovaPlatforms, args, /* optional */ projectPath) {
if (typeof (cordovaPlatforms) == 'string') {
cordovaPlatforms = [cordovaPlatforms];
}
if (!projectPath) {
projectPath = defaultConfig.projectPath;
}
var appendedVersion = cache.getModuleVersionFromConfig(de... | javascript | {
"resource": ""
} |
q53774 | _addPlatformsToProject | train | function _addPlatformsToProject(cordovaPlatforms, projectPath, cordova) {
var promise = Q();
cordovaPlatforms.forEach(function (platform) {
if (!utilities.fileExistsSync(path.join(projectPath, 'platforms', platform))) {
promise = promise.then(function () { return cordova.raw.platform('add', ... | javascript | {
"resource": ""
} |
q53775 | packageProject | train | function packageProject(cordovaPlatforms, args, /* optional */ projectPath) {
if (typeof (cordovaPlatforms) == 'string') {
cordovaPlatforms = [cordovaPlatforms];
}
if (!projectPath) {
projectPath = defaultConfig.projectPath;
}
return setupCordova().then(function (cordova) {
... | javascript | {
"resource": ""
} |
q53776 | _createIpa | train | function _createIpa(projectPath, args) {
return utilities.getInstalledPlatformVersion(projectPath, 'ios').then(function (version) {
if (semver.lt(version, '3.9.0')) {
var deferred = Q.defer();
glob(projectPath + '/platforms/ios/build/device/*.app', function (err, matches) {
... | javascript | {
"resource": ""
} |
q53777 | Collection | train | function Collection(nameOrExisting, options) {
if (nameOrExisting instanceof Mongo.Collection) {
this._collection = nameOrExisting;
}
else {
this._collection = new Mongo.Collection(nameOrExisting, options);
}
} | javascript | {
"resource": ""
} |
q53778 | IntegrationType | train | function IntegrationType(required, optional = []) {
//convert parameter string values to object
this.required = required.map(transformProps);
this.optional = optional.map(transformProps);
} | javascript | {
"resource": ""
} |
q53779 | train | function(filePaths, importRegexp, System) {
var moduleNames = [];
for (var filePath in filePaths) {
if (filePaths.hasOwnProperty(filePath) && importRegexp.test(filePath)) {
moduleNames.push(adapter.getModuleNameFromPath(filePath, System.baseURL, System));
}
}
return mod... | javascript | {
"resource": ""
} | |
q53780 | train | function(System, Promise, files, importRegexps, strictImportSequence) {
if (strictImportSequence) {
return adapter.sequentialImportFiles(System, Promise, files, importRegexps)
} else {
return adapter.parallelImportFiles(System, Promise, files, importRegexps)
}
} | javascript | {
"resource": ""
} | |
q53781 | train | function(karma, System, Promise) {
// Fail fast if any of the dependencies are undefined
if (!karma) {
(console.error || console.log)('Error: Not setup properly. window.__karma__ is undefined');
return;
}
if (!System) {
(console.error || console.log)('Error: Not setup pr... | javascript | {
"resource": ""
} | |
q53782 | train | function(err, System) {
err = String(err);
// Look for common issues in the error message, and try to add hints to them
switch (true) {
// Some people use ".es6" instead of ".js" for ES6 code
case /^Error loading ".*\.es6" at .*\.es6\.js/.test(err):
return err + '\nHint: If you u... | javascript | {
"resource": ""
} | |
q53783 | Integration | train | function Integration(options) {
if (options && options.addIntegration) {
// plugin
return options.addIntegration(Integration);
}
this.debug = debug('analytics:integration:' + slug(name));
var clonedOpts = {};
extend(true, clonedOpts, options); // deep clone options
this.options = def... | javascript | {
"resource": ""
} |
q53784 | isMixed | train | function isMixed(item) {
if (!is.object(item)) return false;
if (!is.string(item.key)) return false;
if (!has.call(item, 'value')) return false;
return true;
} | javascript | {
"resource": ""
} |
q53785 | toggleCss | train | function toggleCss() {
if (!cssOpen) {
exampleCss.classList.remove(hiddenClass);
showCssBtn.innerHTML = hideText;
cssOpen = true;
} else {
exampleCss.classList.add(hiddenClass);
exampleScss.scrollIntoView();
showCssBtn.innerHTML = showText;
cssOpen = false;
}
} | javascript | {
"resource": ""
} |
q53786 | getSnowflakeIdFromUint8Array | train | function getSnowflakeIdFromUint8Array(Uint8Arr) {
// packaged lib uses base64 not base64URL, so swap the different chars
return base64js.fromByteArray(Uint8Arr).substring(0, 11).replace(/\+/g, '-').replace(/\//g, '_');
} | javascript | {
"resource": ""
} |
q53787 | extractBinaryFields | train | function extractBinaryFields(target, spec, data) {
var offset = 0;
for (var x = 0; x < spec.length; x++) {
var item = spec[x];
if (item.label) {
if (item.type === 'string') {
var bytes = new DataView(data.buffer, offset, item.size);
var str = textDecoder.decode(bytes);
target[... | javascript | {
"resource": ""
} |
q53788 | parseBinaryMessage | train | function parseBinaryMessage(data, knownComputations) {
var msg = {};
var header = new DataView(data, 0, binaryHeaderLength);
var version = header.getUint8(0);
extractBinaryFields(msg, binaryHeaderFormats[version], header);
var type = binaryMessageTypes[msg.type];
if (type === undefined) {
console.warn... | javascript | {
"resource": ""
} |
q53789 | parseBinaryDataMessage | train | function parseBinaryDataMessage(msg, data, bigNumberRequested) {
var offset = extractBinaryFields(msg, binaryDataMessageFormats[msg['version']], data);
msg.logicalTimestampMs = (msg.timestampMs1 * hiMult) + msg.timestampMs2;
delete msg.timestampMs1;
delete msg.timestampMs2;
if (typeof msg.maxDelayMs1 !== 'u... | javascript | {
"resource": ""
} |
q53790 | train | function (msg, knownComputations) {
if (msg.data && msg.data.byteLength) {
// The presence of byteLength indicates data is an ArrayBuffer from a WebSocket data frame.
return parseBinaryMessage(msg.data, knownComputations);
} else if (msg.type) {
// Otherwise it's JSON in a WebSocket text frame... | javascript | {
"resource": ""
} | |
q53791 | SignalFxClient | train | function SignalFxClient(apiToken, options) {
var _this = this;
this.apiToken = apiToken;
var params = options || {};
this.ingestEndpoint = params.ingestEndpoint || conf.DEFAULT_INGEST_ENDPOINT;
this.timeout = params.timeout || conf.DEFAULT_TIMEOUT;
this.batchSize = Math.max(1, (params.batchSize ? params.b... | javascript | {
"resource": ""
} |
q53792 | Datum | train | function Datum(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | {
"resource": ""
} |
q53793 | Dimension | train | function Dimension(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | {
"resource": ""
} |
q53794 | DataPoint | train | function DataPoint(properties) {
this.dimensions = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
th... | javascript | {
"resource": ""
} |
q53795 | DataPointUploadMessage | train | function DataPointUploadMessage(properties) {
this.datapoints = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
... | javascript | {
"resource": ""
} |
q53796 | PointValue | train | function PointValue(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | {
"resource": ""
} |
q53797 | Property | train | function Property(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | {
"resource": ""
} |
q53798 | PropertyValue | train | function PropertyValue(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | {
"resource": ""
} |
q53799 | Event | train | function Event(properties) {
this.dimensions = [];
this.properties = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != nu... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.