_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24400 | Translation | train | function Translation(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": ""
} |
q24401 | extractMDNProperties | train | function extractMDNProperties(mdnEntry) {
if (mdnEntry.status === 'standard') {
return {
syntax: mdnEntry.syntax
}
}
return {
status: abbreviateStatus(mdnEntry.status),
syntax: mdnEntry.syntax
}
} | javascript | {
"resource": ""
} |
q24402 | convertEntry | train | function convertEntry(entry) {
entry.description = entry.desc
delete entry.desc
if (entry.values) {
entry.values.forEach(v => {
v.description = v.desc
delete v.desc
if (v.browsers) {
if (v.browsers === 'all') {
delete v.browsers
} else {
v.browsers = entry.browsers.split(',')
if (... | javascript | {
"resource": ""
} |
q24403 | childByName | train | function childByName(node, name) {
var childNodes = node.childNodes;
for (var childKey in childNodes) {
var child = childNodes[childKey];
if (child.nodeName === name) {
return child;
}
}
} | javascript | {
"resource": ""
} |
q24404 | resolveVastAdTagURI | train | function resolveVastAdTagURI(vastAdTagUrl, originalUrl) {
if (!originalUrl) {
return vastAdTagUrl;
}
if (vastAdTagUrl.indexOf('//') === 0) {
var _location = location,
protocol = _location.protocol;
return '' + protocol + vastAdTagUrl;
}
if (vastAdTagUrl.indexOf('://') === -1) {
// R... | javascript | {
"resource": ""
} |
q24405 | mergeWrapperAdData | train | function mergeWrapperAdData(unwrappedAd, wrapper) {
unwrappedAd.errorURLTemplates = wrapper.errorURLTemplates.concat(unwrappedAd.errorURLTemplates);
unwrappedAd.impressionURLTemplates = wrapper.impressionURLTemplates.concat(unwrappedAd.impressionURLTemplates);
unwrappedAd.extensions = wrapper.extensions.concat(un... | javascript | {
"resource": ""
} |
q24406 | parseCreativeNonLinear | train | function parseCreativeNonLinear(creativeElement, creativeAttributes) {
var creative = new CreativeNonLinear(creativeAttributes);
parserUtils.childrenByName(creativeElement, 'TrackingEvents').forEach(function (trackingEventsElement) {
var eventName = void 0,
trackingURLTemplate = void 0;
parserUtils... | javascript | {
"resource": ""
} |
q24407 | parseInLine | train | function parseInLine(inLineElement) {
var childNodes = inLineElement.childNodes;
var ad = new Ad();
ad.id = inLineElement.getAttribute('id') || null;
ad.sequence = inLineElement.getAttribute('sequence') || null;
for (var nodeKey in childNodes) {
var node = childNodes[nodeKey];
switch (node.nodeName)... | javascript | {
"resource": ""
} |
q24408 | parseWrapper | train | function parseWrapper(wrapperElement) {
var ad = parseInLine(wrapperElement);
var wrapperURLElement = parserUtils.childByName(wrapperElement, 'VASTAdTagURI');
if (wrapperURLElement) {
ad.nextWrapperURL = parserUtils.parseNodeText(wrapperURLElement);
} else {
wrapperURLElement = parserUtils.childByName(... | javascript | {
"resource": ""
} |
q24409 | VASTParser | train | function VASTParser() {
classCallCheck(this, VASTParser);
var _this = possibleConstructorReturn(this, (VASTParser.__proto__ || Object.getPrototypeOf(VASTParser)).call(this));
_this.remainingAds = [];
_this.parentURLs = [];
_this.errorURLTemplates = [];
_this.rootErrorURLTemplates = [];
_th... | javascript | {
"resource": ""
} |
q24410 | VASTClient | train | function VASTClient(cappingFreeLunch, cappingMinimumTimeInterval, customStorage) {
classCallCheck(this, VASTClient);
this.cappingFreeLunch = cappingFreeLunch || 0;
this.cappingMinimumTimeInterval = cappingMinimumTimeInterval || 0;
this.defaultOptions = {
withCredentials: false,
timeout: 0
... | javascript | {
"resource": ""
} |
q24411 | VASTTracker | train | function VASTTracker(client, ad, creative) {
var variation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
classCallCheck(this, VASTTracker);
var _this = possibleConstructorReturn(this, (VASTTracker.__proto__ || Object.getPrototypeOf(VASTTracker)).call(this));
_this.ad = ad... | javascript | {
"resource": ""
} |
q24412 | parseExtensions | train | function parseExtensions(collection, extensions) {
extensions.forEach(extNode => {
const ext = new AdExtension();
const extNodeAttrs = extNode.attributes;
const childNodes = extNode.childNodes;
if (extNode.attributes) {
for (const extNodeAttrKey in extNodeAttrs) {
const extNodeAttr = ex... | javascript | {
"resource": ""
} |
q24413 | resolveURLTemplates | train | function resolveURLTemplates(URLTemplates, variables = {}, options = {}) {
const URLs = [];
// Encode String variables, when given
if (variables['ASSETURI']) {
variables['ASSETURI'] = encodeURIComponentRFC3986(variables['ASSETURI']);
}
if (variables['CONTENTPLAYHEAD']) {
variables['CONTENTPLAYHEAD'] ... | javascript | {
"resource": ""
} |
q24414 | copyNodeAttribute | train | function copyNodeAttribute(attributeName, nodeSource, nodeDestination) {
const attributeValue = nodeSource.getAttribute(attributeName);
if (attributeValue) {
nodeDestination.setAttribute(attributeName, attributeValue);
}
} | javascript | {
"resource": ""
} |
q24415 | parseDuration | train | function parseDuration(durationString) {
if (durationString === null || typeof durationString === 'undefined') {
return -1;
}
// Some VAST doesn't have an HH:MM:SS duration format but instead jus the number of seconds
if (util.isNumeric(durationString)) {
return parseInt(durationString);
}
const du... | javascript | {
"resource": ""
} |
q24416 | loadToken | train | async function loadToken (url) {
let tokens
try {
const data = await readFile(credentialsPath)
tokens = JSON.parse(data)
} catch (err) {}
return tokens && tokens[url]
} | javascript | {
"resource": ""
} |
q24417 | validateToken | train | function validateToken (token) {
const header = jwt.decode(token)
const now = Math.floor(Date.now() / 1000)
return header && header.exp > now
} | javascript | {
"resource": ""
} |
q24418 | validateAskPermission | train | function validateAskPermission (token) {
const header = jwt.decode(token)
return validateToken(token) && header[ASK_CLAIM_KEY]
} | javascript | {
"resource": ""
} |
q24419 | getSession | train | async function getSession (url) {
const token = await loadToken(url)
if (!token) return null
const header = jwt.decode(token)
if (!header) return null
const now = Math.floor(Date.now() / 1000)
if (header.exp <= now) return null
return header
} | javascript | {
"resource": ""
} |
q24420 | saveToken | train | async function saveToken (url, token) {
let tokens
try {
const data = await readFile(credentialsPath)
tokens = JSON.parse(data)
} catch (err) {}
// if it was empty or contained `null` for some reason
if (typeof tokens !== 'object' || !tokens) {
tokens = {}
}
tokens[url] = token
await writ... | javascript | {
"resource": ""
} |
q24421 | train | function( arg, type, defaultValue ) {
'use strict';
// If the argument being checked is an array, loop through
// it and ensure all the values are of the correct type,
// falling back to the defaultValue if any aren't.
if ( Array.isArray( arg ) ) {
for ( var i = arg.... | javascript | {
"resource": ""
} | |
q24422 | train | function( arg, instance, defaultValue ) {
'use strict';
// If the argument being checked is an array, loop through
// it and ensure all the values are of the correct type,
// falling back to the defaultValue if any aren't.
if ( Array.isArray( arg ) ) {
for ( var i = ... | javascript | {
"resource": ""
} | |
q24423 | train | function( value, randomise ) {
'use strict';
var epsilon = 0.00001,
result = value;
result = randomise ? Math.random() * epsilon * 10 : epsilon;
if ( value < 0 && value > -epsilon ) {
result = -result;
}
// if ( value === 0 ) {
// r... | javascript | {
"resource": ""
} | |
q24424 | train | function( start, end, delta ) {
'use strict';
var types = this.types,
out;
if ( typeof start === types.NUMBER && typeof end === types.NUMBER ) {
return start + ( ( end - start ) * delta );
}
else if ( start instanceof THREE.Vector2 && end instanceof THRE... | javascript | {
"resource": ""
} | |
q24425 | train | function( n, multiple ) {
'use strict';
var remainder = 0;
if ( multiple === 0 ) {
return n;
}
remainder = Math.abs( n ) % multiple;
if ( remainder === 0 ) {
return n;
}
if ( n < 0 ) {
return -( Math.abs( n ) - rema... | javascript | {
"resource": ""
} | |
q24426 | train | function(
attribute, index, base, radius, radiusSpread, radiusScale, radiusSpreadClamp, distributionClamp
) {
'use strict';
var depth = 2 * Math.random() - 1,
t = 6.2832 * Math.random(),
r = Math.sqrt( 1 - depth * depth ),
rand = this.randomFloat( radius,... | javascript | {
"resource": ""
} | |
q24427 | taskProcessor | train | function taskProcessor(params, isTX) {
if (typeof params.cb !== 'function') {
return $p.reject(new TypeError('Callback function is required.'));
}
if (params.options.reusable) {
return config.$npm.task.callback(obj.ctx, obj, params.cb, config);
... | javascript | {
"resource": ""
} |
q24428 | update | train | function update(start, success, result) {
const c = ctx.ctx;
if (start) {
npm.utils.addReadProp(c, 'start', new Date());
} else {
c.finish = new Date();
c.success = success;
c.result = result;
c.duration = c.finish - c.start;
... | javascript | {
"resource": ""
} |
q24429 | htmlParse | train | function htmlParse(value, config) {
var allow
if (Array.isArray(config)) {
allow = config
} else if (config) {
allow = config.allow
}
return core(
value,
unified()
.use(html)
.use(rehype2retext, makeText(config))
.use(filter, {allow: allow})
)
} | javascript | {
"resource": ""
} |
q24430 | noMarkdown | train | function noMarkdown(value, config) {
var allow
if (Array.isArray(config)) {
allow = config
} else if (config) {
allow = config.allow
}
return core(value, makeText(config).use(filter, {allow: allow}))
} | javascript | {
"resource": ""
} |
q24431 | train | function (err, res) {
if (err) {
cb(err)
} else {
res.stats.includedFiles.forEach(function (file) {
compiler.emit('dependency', file)
})
cb(null, res.css.toString())
}
} | javascript | {
"resource": ""
} | |
q24432 | sortFeatures | train | function sortFeatures({ stage: a, id: aa }, { stage: b, id: bb }) {
return b - a || (aa < bb ? -1 : aa > bb ? 1 : 0);
} | javascript | {
"resource": ""
} |
q24433 | formatFeature | train | function formatFeature(feature) {
return Object.assign({}, feature, {
// format title using marked inline lexer
title: marked.inlineLexer(feature.title, [], {}),
// format description using marked inline lexer
description: marked.inlineLexer(feature.description, [], {}),
// format example as syntax-highlight... | javascript | {
"resource": ""
} |
q24434 | postcssToHTML | train | function postcssToHTML(root, builder) {
function toString(node) {
if ('atrule' === node.type) {
return atruleToString(node);
} if ('rule' === node.type) {
return ruleToString(node);
} else if ('decl' === node.type) {
return declToString(node);
} else if ('comment' === node.type) {
return commentToS... | javascript | {
"resource": ""
} |
q24435 | _merge | train | function _merge(first, second) {
var target = {};
[first, second].forEach(function(obj) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
target[prop] = obj[prop];
}
}
return target;
});
ret... | javascript | {
"resource": ""
} |
q24436 | StackTrace$$get | train | function StackTrace$$get(opts) {
var err = _generateError();
return _isShapedLikeParsableError(err) ? this.fromError(err, opts) : this.generateArtificially(opts);
} | javascript | {
"resource": ""
} |
q24437 | StackTrace$$fromError | train | function StackTrace$$fromError(error, opts) {
opts = _merge(_options, opts);
var gps = new StackTraceGPS(opts);
return new Promise(function(resolve) {
var stackframes = _filtered(ErrorStackParser.parse(error), opts.filter);
resolve(Promise.all(stackfra... | javascript | {
"resource": ""
} |
q24438 | StackTrace$$generateArtificially | train | function StackTrace$$generateArtificially(opts) {
opts = _merge(_options, opts);
var stackFrames = StackGenerator.backtrace(opts);
if (typeof opts.filter === 'function') {
stackFrames = stackFrames.filter(opts.filter);
}
return Promise.resolve(... | javascript | {
"resource": ""
} |
q24439 | StackTrace$$instrument | train | function StackTrace$$instrument(fn, callback, errback, thisArg) {
if (typeof fn !== 'function') {
throw new Error('Cannot instrument non-function object');
} else if (typeof fn.__stacktraceOriginalFn === 'function') {
// Already instrumented, return given Function... | javascript | {
"resource": ""
} |
q24440 | StackTrace$$report | train | function StackTrace$$report(stackframes, url, errorMsg, requestOptions) {
return new Promise(function(resolve, reject) {
var req = new XMLHttpRequest();
req.onerror = reject;
req.onreadystatechange = function onreadystatechange() {
if (req.... | javascript | {
"resource": ""
} |
q24441 | format | train | function format(str, args) {
var keys = Object.keys(args), i;
for (i=0; i<keys.length; i++) {
str = str.replace(new RegExp("\\{" + keys[i] + "\\}", "gi"), args[keys[i]]);
}
return str;
} | javascript | {
"resource": ""
} |
q24442 | randomString | train | function randomString(holder) {
var chars, randomstring, i;
if (!holder) {
throw new Error("cannot create a random attribute name for an undefined object");
}
chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
randomstring = "";
do {
ra... | javascript | {
"resource": ""
} |
q24443 | createNamedToNumberedLookup | train | function createNamedToNumberedLookup(items, radix) {
var i, entity, lookup = {}, base10, base16;
items = items.split(',');
radix = radix || 10;
// Map from named to numbered entities.
for (i = 0; i < items.length; i += 2) {
entity = '&' + items[i + 1] + ';';
... | javascript | {
"resource": ""
} |
q24444 | train | function (vector) {
var len = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
return [vector[0] / len, vector[1] / len];
} | javascript | {
"resource": ""
} | |
q24445 | train | function (passes, fails) {
var _this = this;
passes = passes || function () {};
fails = fails || function () {};
var failsOne = function (rule, message) {
_this._addFailure(rule, message);
};
var resolvedAll = function (allPassed) {
if (allPassed) {
passes();
} else {... | javascript | {
"resource": ""
} | |
q24446 | train | function (rule) {
var msg = this.messages.render(rule);
this.errors.add(rule.attribute, msg);
this.errorCount++;
} | javascript | {
"resource": ""
} | |
q24447 | train | function (obj, path) {
if (Object.prototype.hasOwnProperty.call(obj, path)) {
return obj[path];
}
var keys = path.replace(/\[(\w+)\]/g, ".$1").replace(/^\./, "").split(".");
var copy = {};
for (var attr in obj) {
if (Object.prototype.hasOwnProperty.call(obj, attr)) {
copy[attr] ... | javascript | {
"resource": ""
} | |
q24448 | train | function (rulesArray) {
var rules = [];
for (var i = 0, len = rulesArray.length; i < len; i++) {
if (typeof rulesArray[i] === 'object') {
for (var rule in rulesArray[i]) {
rules.push({
name: rule,
value: rulesArray[i][rule]
});
}
} else {
... | javascript | {
"resource": ""
} | |
q24449 | train | function (attribute, findRules) {
var rules = this.rules[attribute] || [];
for (var i = 0, len = rules.length; i < len; i++) {
if (findRules.indexOf(rules[i].name) > -1) {
return true;
}
}
return false;
} | javascript | {
"resource": ""
} | |
q24450 | train | function (rule, value) {
if (Rules.isImplicit(rule.name)) {
return true;
}
return this.getRule('required').validate(value);
} | javascript | {
"resource": ""
} | |
q24451 | train | function (attribute, rulePassed) {
var stopOnAttributes = this.stopOnAttributes;
if (typeof stopOnAttributes === 'undefined' || stopOnAttributes === false || rulePassed === true) {
return false;
}
if (stopOnAttributes instanceof Array) {
return stopOnAttributes.indexOf(attribute) > -1;
... | javascript | {
"resource": ""
} | |
q24452 | train | function(val, req, attribute) {
if (val) {
req = parseFloat(req);
var size = this.getSize();
return size === req;
}
return true;
} | javascript | {
"resource": ""
} | |
q24453 | train | function(inputValue, ruleValue, attribute, callback) {
var fn = this.isMissed() ? missedRuleValidator : this.fn;
return fn.apply(this, [inputValue, ruleValue, attribute, callback]);
} | javascript | {
"resource": ""
} | |
q24454 | train | function() {
var value = this.inputValue;
if (value instanceof Array) {
return value.length;
}
if (typeof value === 'number') {
return value;
}
if (this.validator._hasNumericRule(this.attribute)) {
return parseFloat(value, 10);
}
return value.length;
} | javascript | {
"resource": ""
} | |
q24455 | train | function(passes, message) {
this.passes = (passes === undefined || passes === true);
this._customMessage = message;
this.callback(this.passes, message);
} | javascript | {
"resource": ""
} | |
q24456 | train | function(name, validator) {
var async = this.isAsync(name);
var rule = new Rule(name, rules[name], async);
rule.setValidator(validator);
return rule;
} | javascript | {
"resource": ""
} | |
q24457 | train | function(name) {
for (var i = 0, len = this.asyncRules.length; i < len; i++) {
if (this.asyncRules[i] === name) {
return true;
}
}
return false;
} | javascript | {
"resource": ""
} | |
q24458 | train | function(attribute, message) {
if (!this.has(attribute)) {
this.errors[attribute] = [];
}
if (this.errors[attribute].indexOf(message) === -1) {
this.errors[attribute].push(message);
}
} | javascript | {
"resource": ""
} | |
q24459 | train | function(index) {
var rule = this.resolvers[index];
if (rule.passes === true) {
this.passed.push(rule);
} else if (rule.passes === false) {
this.failed.push(rule);
this.onFailedOne(rule);
}
this.fire();
} | javascript | {
"resource": ""
} | |
q24460 | ancestors | train | function ancestors(first, second) {
var path = [];
for (var n in first.path) {
if (first.path[n] !== second.path[n]) break;
path.push(first.path[n]);
}
return path;
} | javascript | {
"resource": ""
} |
q24461 | equalForKeys | train | function equalForKeys(a, b, keys) {
if (!keys) {
keys = [];
for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility
}
for (var i=0; i<keys.length; i++) {
var k = keys[i];
if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized
}
return ... | javascript | {
"resource": ""
} |
q24462 | filterByKeys | train | function filterByKeys(keys, values) {
var filtered = {};
forEach(keys, function (name) {
filtered[name] = values[name];
});
return filtered;
} | javascript | {
"resource": ""
} |
q24463 | indexBy | train | function indexBy(array, propName) {
var result = {};
forEach(array, function(item) {
result[item[propName]] = item;
});
return result;
} | javascript | {
"resource": ""
} |
q24464 | pick | train | function pick(obj) {
var copy = {};
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
forEach(keys, function(key) {
if (key in obj) copy[key] = obj[key];
});
return copy;
} | javascript | {
"resource": ""
} |
q24465 | omit | train | function omit(obj) {
var copy = {};
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
for (var key in obj) {
if (indexOf(keys, key) == -1) copy[key] = obj[key];
}
return copy;
} | javascript | {
"resource": ""
} |
q24466 | train | function(state) {
var url = state.url, config = { params: state.params || {} };
if (isString(url)) {
if (url.charAt(0) == '^') return $urlMatcherFactory.compile(url.substring(1), config);
return (state.parent.navigable || root).url.concat(url, config);
}
if (!url || $urlMatcher... | javascript | {
"resource": ""
} | |
q24467 | train | function(state) {
var params = state.url && state.url.params || new $$UMFP.ParamSet();
forEach(state.params || {}, function(config, id) {
if (!params[id]) params[id] = new $$UMFP.Param(id, null, config, "config");
});
return params;
} | javascript | {
"resource": ""
} | |
q24468 | train | function(state) {
var views = {};
forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {
if (name.indexOf('@') < 0) name += '@' + state.parent.name;
views[name] = view;
});
return views;
} | javascript | {
"resource": ""
} | |
q24469 | handleRedirect | train | function handleRedirect(redirect, state, params, options) {
/**
* @ngdoc event
* @name ui.router.state.$state#$stateNotFound
* @eventOf ui.router.state.$state
* @eventType broadcast on root scope
* @description
* Fired when a requested state **cannot be found** using the ... | javascript | {
"resource": ""
} |
q24470 | getSquashPolicy | train | function getSquashPolicy(config, isOptional) {
var squash = config.squash;
if (!isOptional || squash === false) return false;
if (!isDefined(squash) || squash == null) return defaultSquashPolicy;
if (squash === true || isString(squash)) return squash;
throw new Error("Invalid squash policy... | javascript | {
"resource": ""
} |
q24471 | train | function (address) {
var q = $q.defer();
$window.bluetoothSerial.connectInsecure(address, function () {
q.resolve();
}, function (error) {
q.reject(error);
});
return q.promise;
} | javascript | {
"resource": ""
} | |
q24472 | train | function (workout) {
var q = $q.defer();
$window.plugins.healthkit.saveWorkout(workout,
function (success) {
q.resolve(success);
},
function (err) {
q.resolve(err);
}
);
return q.promise;
} | javascript | {
"resource": ""
} | |
q24473 | train | function (promise){
promise.success = function (fn) {
promise.then(fn);
return promise;
};
promise.error = function (fn) {
promise.then(null, fn);
return promise;
};
} | javascript | {
"resource": ""
} | |
q24474 | train | function (key, value, dict) {
var deferred = $q.defer();
var promise = deferred.promise;
function ok(value){
deferred.resolve(value);
}
function errorCallback(error){
deferred.reject(new Error(error));
... | javascript | {
"resource": ""
} | |
q24475 | train | function () {
var deferred = $q.defer();
var promise = deferred.promise;
function ok(value){
deferred.resolve(value);
}
function errorCallback(error){
deferred.reject(new Error(error));
}
... | javascript | {
"resource": ""
} | |
q24476 | triggerEvent | train | function triggerEvent(gesture, eventData){
// create DOM event
var event = ionic.Gestures.DOCUMENT.createEvent('Event');
event.initEvent(gesture, true, true);
event.gesture = eventData;
// trigger on the target if it is in the instance element,
// this is for event delegation tricks... | javascript | {
"resource": ""
} |
q24477 | getDirection | train | function getDirection(touch1, touch2) {
var x = Math.abs(touch1.pageX - touch2.pageX),
y = Math.abs(touch1.pageY - touch2.pageY);
if(x >= y) {
return touch1.pageX - touch2.pageX > 0 ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;
}
else {
return touch1.pa... | javascript | {
"resource": ""
} |
q24478 | isVertical | train | function isVertical(direction) {
return (direction == ionic.Gestures.DIRECTION_UP || direction == ionic.Gestures.DIRECTION_DOWN);
} | javascript | {
"resource": ""
} |
q24479 | stopDefaultBrowserBehavior | train | function stopDefaultBrowserBehavior(element, css_class) {
// changed from making many style changes to just adding a preset classname
// less DOM manipulations, less code, and easier to control in the CSS side of things
// hammer.js doesn't come with CSS, but ionic does, which is why we prefer this me... | javascript | {
"resource": ""
} |
q24480 | detect | train | function detect(eventData) {
if(!this.current || this.stopped) {
return;
}
// extend event data with calculations about scale, distance etc
eventData = this.extendEventData(eventData);
// instance options
var inst_options = this.current.inst.options;
// call ionic.Ge... | javascript | {
"resource": ""
} |
q24481 | stopDetect | train | function stopDetect() {
// clone current data to the store as the previous gesture
// used for the double tap gesture, since this is an other gesture detect session
this.previous = ionic.Gestures.utils.extend({}, this.current);
// reset the current
this.current = null;
// stopped!
... | javascript | {
"resource": ""
} |
q24482 | extendEventData | train | function extendEventData(ev) {
var startEv = this.current.startEvent;
// if the touches change, set the new touches over the startEvent touches
// this because touchevents don't have all the touches on touchstart, or the
// user must place his fingers at the EXACT same time on the screen, which... | javascript | {
"resource": ""
} |
q24483 | train | function(obj) {
var args = Array.prototype.slice.call(arguments, 1);
for (var i = 0; i < args.length; i++) {
var source = args[i];
if (source) {
for (var prop in source) {
obj[prop] = source[prop];
}
}
}
return obj;
} | javascript | {
"resource": ""
} | |
q24484 | train | function() {
var index = uid.length;
var digit;
while (index) {
index--;
digit = uid[index].charCodeAt(0);
if (digit == 57 /*'9'*/) {
uid[index] = 'A';
return uid.join('');
}
if (digit == 90 /*'Z'*/) {
uid[index] = '0';
} ... | javascript | {
"resource": ""
} | |
q24485 | train | function(stepCallback, verifyCallback, completedCallback, duration, easingMethod, root) {
var start = time();
var lastFrame = start;
var percent = 0;
var dropCounter = 0;
var id = counter++;
if (!root) {
root = document.body;
}
// Compacting running db automati... | javascript | {
"resource": ""
} | |
q24486 | train | function() {
// Use publish instead of scrollTo to allow scrolling to out of boundary position
// We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled
this.__publish(this.__scrollLeft, -this.__refreshHeight, this.__zoomLevel, true);
var... | javascript | {
"resource": ""
} | |
q24487 | train | function(level, animate, originLeft, originTop) {
var self = this;
if (!self.options.zooming) {
throw new Error("Zooming is not enabled!");
}
// Stop deceleration
if (self.__isDecelerating) {
zyngaCore.effect.Animate.stop(self.__isDecelerating);
self.__isDecelerating = false;
... | javascript | {
"resource": ""
} | |
q24488 | train | function(left, top, animate, zoom, wasResize) {
var self = this;
// Stop deceleration
if (self.__isDecelerating) {
zyngaCore.effect.Animate.stop(self.__isDecelerating);
self.__isDecelerating = false;
}
// Correct coordinates based on new zoom level
if (zoom != null && zoom !== self... | javascript | {
"resource": ""
} | |
q24489 | train | function() {
var self = this;
clearTimeout(self.__sizerTimeout);
var sizer = function() {
self.resize();
// if ((self.options.scrollingX && !self.__maxScrollLeft) || (self.options.scrollingY && !self.__maxScrollTop)) {
// //self.__sizerTimeout = setTimeout(sizer, 1000);
// }
... | javascript | {
"resource": ""
} | |
q24490 | train | function(target) {
while (target) {
if (target.classList && target.classList.contains(ITEM_CLASS)) {
return target;
}
target = target.parentNode;
}
return null;
} | javascript | {
"resource": ""
} | |
q24491 | train | function(e) {
var _this = this, content, buttons;
if (Math.abs(e.gesture.deltaY) > 5) {
this._didDragUpOrDown = true;
}
// If we get a drag event, make sure we aren't in another drag, then check if we should
// start one
if (!this.isDragging && !this._dragOp) {
this... | javascript | {
"resource": ""
} | |
q24492 | shallowCopy | train | function shallowCopy(src, dst) {
if (isArray(src)) {
dst = dst || [];
for (var i = 0, ii = src.length; i < ii; i++) {
dst[i] = src[i];
}
} else if (isObject(src)) {
dst = dst || {};
for (var key in src) {
if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
dst[key] = s... | javascript | {
"resource": ""
} |
q24493 | getter | train | function getter(obj, path, bindFnToScope) {
if (!path) return obj;
var keys = path.split('.');
var key;
var lastInstance = obj;
var len = keys.length;
for (var i = 0; i < len; i++) {
key = keys[i];
if (obj) {
obj = (lastInstance = obj)[key];
}
}
if (!bindFnToScope && isFunction(obj)) ... | javascript | {
"resource": ""
} |
q24494 | HashMap | train | function HashMap(array, isolatedUid) {
if (isolatedUid) {
var uid = 0;
this.nextUid = function() {
return ++uid;
};
}
forEach(array, this.put, this);
} | javascript | {
"resource": ""
} |
q24495 | directiveIsMultiElement | train | function directiveIsMultiElement(name) {
if (hasDirectives.hasOwnProperty(name)) {
for (var directive, directives = $injector.get(name + Suffix),
i = 0, ii = directives.length; i < ii; i++) {
directive = directives[i];
if (directive.multiElement) {
return true;
... | javascript | {
"resource": ""
} |
q24496 | mergeTemplateAttributes | train | function mergeTemplateAttributes(dst, src) {
var srcAttr = src.$attr,
dstAttr = dst.$attr,
$element = dst.$$element;
// reapply the old attributes to the new element
forEach(dst, function(value, key) {
if (key.charAt(0) != '$') {
if (src[key] && src[key] !== valu... | javascript | {
"resource": ""
} |
q24497 | byPriority | train | function byPriority(a, b) {
var diff = b.priority - a.priority;
if (diff !== 0) return diff;
if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
return a.index - b.index;
} | javascript | {
"resource": ""
} |
q24498 | train | function(event) {
// IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
// it. In particular the event is not fired when backspace or delete key are pressed or
// when cut operation is performed.
// IE10+ implements 'input' event but it erroneously f... | javascript | {
"resource": ""
} | |
q24499 | urlIsSameOrigin | train | function urlIsSameOrigin(requestUrl) {
var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
return (parsed.protocol === originUrl.protocol &&
parsed.host === originUrl.host);
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.