_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q29400 | train | function (key, preserveElems) {
var subViews = (key && (typeof key === "string" || key.cid)) ? this.get(key) : key;
var len;
if (!subViews) { return this; }
if (!isArray(subViews)) {
subViews = [subViews];
}
len = subViews ? subView... | javascript | {
"resource": ""
} | |
q29401 | train | function (keys, preserveElems) {
var i = 0;
var len = keys ? keys.length : 0;
for (i; i < len; i++) {
this.remove(keys[i], preserveElems);
}
return this;
} | javascript | {
"resource": ""
} | |
q29402 | train | function (subViews) {
subViews = subViews || this.subViews;
var i = -1;
var len = subViews.length;
while (++i < len) {
subViews[i].remove();
}
return this;
} | javascript | {
"resource": ""
} | |
q29403 | train | function (key) {
if (key.cid) {
return this._subViewsByCid[key.cid] || this._subViewsByModelCid[key.cid];
}
if (key.indexOf('.') > -1 && this.dotNotation) {
var segs = key.split('.');
var view = this.parent;
while (segs.... | javascript | {
"resource": ""
} | |
q29404 | train | function (subview) {
subview = (subview instanceof View === true) ? subview : this.get(subview);
return subview._subviewtype;
} | javascript | {
"resource": ""
} | |
q29405 | train | function (type) {
var confs = type ? _.pick(this.config, type) : this.config;
each(confs, function (config) {
this.parent.$(config.location).html('');
}, this);
return this;
} | javascript | {
"resource": ""
} | |
q29406 | train | function () {
var html = '';
var template = this.template;
if (isFunction(template)) {
html = template(result(this, 'templateVars')) || '';
}
this.$el.html(html);
this.subs.renderAppend();
return this;
} | javascript | {
"resource": ""
} | |
q29407 | train | function (event) {
var args = slice.call(arguments, 1);
var stopPropogation;
var anscestor;
args.unshift(event);
args.push(this);
anscestor = this;
while (anscestor) {
anscestor.trigger.apply(anscestor, args);
... | javascript | {
"resource": ""
} | |
q29408 | train | function (event) {
var args = slice.call(arguments, 1);
var _trigger = function (subViews) {
var i = -1;
var len = subViews.length;
var subSubs;
var stopPropogation;
var descend;
while (++i < len) {
... | javascript | {
"resource": ""
} | |
q29409 | train | function (fnName, args) {
var func;
var ancestor = this;
var isFunc = isFunction(fnName);
while (ancestor.parentView) {
ancestor = ancestor.parentView;
if (ancestor) {
func = isFunc ? fnName : ancestor[fnName];
... | javascript | {
"resource": ""
} | |
q29410 | train | function (testFn) {
var ancestor = this;
while (ancestor.parentView) {
ancestor = ancestor.parentView;
if (ancestor && testFn(ancestor)) {
return ancestor;
}
}
return null;
} | javascript | {
"resource": ""
} | |
q29411 | train | function (events) {
events = events || result(this, 'viewEvents');
each(events, function (func, event) {
var segs = event.split(' ');
var listenTo = (segs.length > 1) ? this[segs[1]] : this;
func = isFunction(func) ? func : this[func];
... | javascript | {
"resource": ""
} | |
q29412 | train | function (viewInstance) {
console.assert(viewInstance instanceof Backbone.BaseView, 'viewInstance must be an instance of Backbone.BaseView');
var mixins = slice.call(arguments, 1);
_marinate(viewInstance, mixins);
} | javascript | {
"resource": ""
} | |
q29413 | train | function (View, name, eventsObj) { //eslint-disable-line no-shadow
console.assert(View.prototype instanceof Backbone.BaseView, 'View must a Backbone.BaseView constructor');
_addEvents(View.prototype, name, eventsObj);
} | javascript | {
"resource": ""
} | |
q29414 | train | function (viewInstance, name, eventsObj) {
console.assert(viewInstance instanceof Backbone.BaseView, 'viewInstance must be an instance of Backbone.BaseView');
_addEvents(viewInstance, name, eventsObj);
} | javascript | {
"resource": ""
} | |
q29415 | train | function(context, expression, onChange, callbackContext) {
var observer = this.createObserver(expression, onChange, callbackContext || context);
observer.bind(context);
return observer;
} | javascript | {
"resource": ""
} | |
q29416 | train | function(expression, options) {
if (options && options.isSetter) {
return expressions.parseSetter(expression, this.globals, this.formatters, options.extraArgs);
} else if (options && options.extraArgs) {
var allArgs = [expression, this.globals, this.formatters].concat(options.extraArgs);
retur... | javascript | {
"resource": ""
} | |
q29417 | train | function(source, expression, value) {
return this.getExpression(expression, { isSetter: true }).call(source, value);
} | javascript | {
"resource": ""
} | |
q29418 | train | function(callback) {
if (typeof callback === 'function') {
this.afterSync(callback);
}
if (this.pendingSync) {
return false;
}
var fallback = setTimeout(this.syncNow, 500);
this.windows = this.windows.filter(this.removeClosed);
this.pendingSync = this.windows.map(this.queueSync... | javascript | {
"resource": ""
} | |
q29419 | train | function(callback) {
if (typeof callback === 'function') {
this.afterSync(callback);
}
if (this.pendingSync) {
clearTimeout(this.pendingSync.pop());
this.pendingSync.forEach(this.cancelQueue);
this.pendingSync = null;
}
if (this.syncing) {
this.rerun = true;
ret... | javascript | {
"resource": ""
} | |
q29420 | train | function(observer, skipUpdate) {
this.observers.add(observer);
if (!skipUpdate) {
observer.forceUpdateNextSync = true;
observer.sync();
}
} | javascript | {
"resource": ""
} | |
q29421 | configure_logging | train | function configure_logging() {
if ('log' in CONF) {
if ('plugin' in CONF.log) { process.env.NODE_LOGGER_PLUGIN = CONF.log.plugin; }
if ('level' in CONF.log) { process.env.NODE_LOGGER_LEVEL = CONF.log.level; }
if ('customlevels' in CONF.log) {
for (var key in CONF.log.customlevels) {
proc... | javascript | {
"resource": ""
} |
q29422 | errorMessage | train | function errorMessage(fileError) {
var msg = '';
switch (fileError.code) {
case FileError.NOT_FOUND_ERR:
msg = 'File not found';
break;
case FileError.SECURITY_ERR:
// You may need the --allow-file-access-from-files flag
... | javascript | {
"resource": ""
} |
q29423 | train | function(template, delta) {
assert.ok(Array.isArray(template), "'template' is not an array");
assert.ok(Array.isArray(delta), "'delta' is not an array");
/*
* This merge step is inefficient O(n*m) but we are assuming small arrays
* and 'delta' typically smaller than 'template'.
*
* ... | javascript | {
"resource": ""
} | |
q29424 | train | function(template, delta) {
assert.equal(typeof(template), 'object', "'template' is not an object");
assert.equal(typeof(delta), 'object', "'delta' is not an object");
var result = myUtils.deepClone(template);
Object.keys(delta).forEach(function(x) {
result[x] = myUtils.deepClone(delta[x]);
... | javascript | {
"resource": ""
} | |
q29425 | train | function(template, delta, overrideName) {
if (template.name !== delta.name) {
if (!overrideName) {
var err = new Error('mergeObj: description names do not match');
err['template'] = template;
err['delta'] = delta;
throw err;
}
}
/** @type spec... | javascript | {
"resource": ""
} | |
q29426 | train | function(desc, f) {
if (typeof desc === 'object') {
f(desc.env);
if (Array.isArray(desc.components)) {
desc.components.forEach(function(x) { patchEnv(x, f);});
}
} else {
var err = new Error('patchEnv: not an object');
err['desc'] = desc;
throw err;
... | javascript | {
"resource": ""
} | |
q29427 | train | function(prefix, f) {
var retF = function(env) {
Object.keys(env)
.forEach(function(x) {
var val = env[x];
if ((typeof val === 'string') &&
(val.indexOf(prefix) === 0)) {
var propName = val.substring(prefix.length,
... | javascript | {
"resource": ""
} | |
q29428 | getTransport | train | function getTransport(options = {}) {
return new Promise((resolve, reject) => {
try {
const defaultTransport = {
type: 'direct',
transportOptions: { debug: true }
};
const { transportObject = defaultTransport, } = options;
const nodemailerTransporter = nodemailer.createTran... | javascript | {
"resource": ""
} |
q29429 | s_SAFE_COMPUTED_OPERANDS | train | function s_SAFE_COMPUTED_OPERANDS(node)
{
const operands = [];
if (typeof node.computed === 'boolean' && node.computed)
{
// The following will pick up a single literal computed value (string).
if (node.key.type === 'StringLiteral')
{
operands.push(TraitUtil.safeValue(node.key));
... | javascript | {
"resource": ""
} |
q29430 | train | function(_list){
var _result = 0;
_u._$forEach(
_list,function(_size){
if (!_size) return;
if (!_result){
_result = _size;
}else{
_result = Math.min(_result,_size);
... | javascript | {
"resource": ""
} | |
q29431 | injectPaths | train | function injectPaths(paths) {
u.each(paths, function(path) {
if (path.inject) {
// injected css and js sources are always rooted paths
var src = mkSrc(path);
if (/\.css$/i.test(src.path)) return opts.injectCss.push(src);
if (/\.js$|\.es6$|\.jsx$/i.test(src.path)) return opts.in... | javascript | {
"resource": ""
} |
q29432 | watchOpts | train | function watchOpts(src) {
if ((src._pkg && !opts.watchPkgs) || ('watch' in src && !src.watch)) return false;
return (typeof src.watch === 'object') ? src.watch : {};
} | javascript | {
"resource": ""
} |
q29433 | normalizeOptsKey | train | function normalizeOptsKey(aval, basedir, pkg) {
aval = aval || [];
if (!u.isArray(aval)) {
aval = [ aval ];
}
return u.map(u.compact(aval), function(val) {
return normalize(val, basedir, pkg);
});
} | javascript | {
"resource": ""
} |
q29434 | normalize | train | function normalize(val, basedir, pkg) {
if (typeof val === 'string') {
val = { path: val };
}
var originalPath = val.path;
// npm3 treatment of sub-package paths starting with ./node_modules/
var subPkgName = val.path.replace(/^\.\/node_modules\/([^/]+).*/,'$1');
if (subPkgName != origi... | javascript | {
"resource": ""
} |
q29435 | TimeoutError | train | function TimeoutError(message) {
this.message = message;
this.timeout = true;
Error.captureStackTrace(this, arguments.callee);
} | javascript | {
"resource": ""
} |
q29436 | onFunction | train | function onFunction(data, op, iterStr, context) {
var iter,
data;
// Check task
if(!op || !data || !iterStr || !context) {
throw Error('Worker received invalid task');
}
// parse the serialized function
// eval() may be evil but here we don't have much choice
eval('var iter = ' + iterStr);
switch(op) ... | javascript | {
"resource": ""
} |
q29437 | onExec | train | function onExec(funcStr, parStr, context) {
var func,
par,
data,
err = null;
try {
// Check task
if(!funcStr || !context) {
throw Error('Worker received invalid task');
}
par = parStr ? JSON.parse(parStr) : null;
// parse the serialized function
// eval() may be evil but here we don't have mu... | javascript | {
"resource": ""
} |
q29438 | getUserGroups | train | function getUserGroups(user) {
var groups = {};
if (user && user.permissions) {
user.permissions.forEach(function(permission) {
var reg = new RegExp('^(get|update|delete)-group-(.+)$');
var permissionChunks = reg.exec(permission);
if (permissionChunks) {
var operation = permissionChun... | javascript | {
"resource": ""
} |
q29439 | getUserAuthorizedGroups | train | function getUserAuthorizedGroups(user, operation) {
var userGroups = getUserGroups(user);
var groups = [];
for (var groupId in userGroups) {
if (userGroups[groupId].indexOf(operation) >= 0)
groups.push(groupId);
}
return groups;
} | javascript | {
"resource": ""
} |
q29440 | ObservableHash | train | function ObservableHash(observations) {
var enabled = true;
var _observers = [];
_observers.enabled = true;
Object.defineProperties(this, {
_context: { writable: true, value: this },
_observations: { value: observations },
_namespaces: { value: [] },
_observers: { value: _observers },
compu... | javascript | {
"resource": ""
} |
q29441 | train | function() {
this._observers.enabled = true;
this._observers.forEach(this.observersBindHelper.bind(this), this);
// Set namespaced hashes to the same value
this._namespaces.forEach(this.observersStartHelper.bind(this), this);
} | javascript | {
"resource": ""
} | |
q29442 | train | function(clearValues) {
this._observers.enabled = false;
this._observers.forEach(this.observersUnbindHelper.bind(this, clearValues));
// Set namespaced hashes to the same value
this._namespaces.forEach(this.observersStopHelper.bind(this, clearValues), this);
} | javascript | {
"resource": ""
} | |
q29443 | train | function(namespace, map) {
if (typeof namespace === 'string' && typeof map === 'object') {
if (!this[namespace]) {
this[namespace] = new ObservableHash(this._observations);
this[namespace].observersEnabled = this.observersEnabled;
this._namespaces.push(namespace);
}
this._o... | javascript | {
"resource": ""
} | |
q29444 | train | function(expression, onChange, callbackContext) {
var observer = this._observations.createObserver(expression, onChange, callbackContext || this);
this._observers.push(observer);
if (this.observersEnabled) observer.bind(this._context);
return observer;
} | javascript | {
"resource": ""
} | |
q29445 | resultsCallback | train | function resultsCallback() {
var args = slice.call(arguments, 0);
var err = args.shift();
if (err) {
if (config.interrupt === true) {
errors.push(err);
results.push(null);
callback.call(self, errors, results);
return;
} else {
errored = true... | javascript | {
"resource": ""
} |
q29446 | queue | train | function queue(args) {
args.push(resultsCallback);
stack.push({caller: this.caller, args: args});
} | javascript | {
"resource": ""
} |
q29447 | dummy | train | function dummy(caller) {
return function() {
queue.call({caller: caller}, slice.call(arguments, 0));
return self;
}
} | javascript | {
"resource": ""
} |
q29448 | setInitialState | train | function setInitialState(ret) {
var e, r;
// Before resetting, keep a copy of args
if (ret) {
e = (errored ? errors : null);
r = results;
}
// Reset runtime vars to their default state
counter = 0;
errored = false;
errors = [];
results = [];
// Flu... | javascript | {
"resource": ""
} |
q29449 | train | function(_href){
// locked from history back
if (!!_locked){
_locked = !1;
return;
}
var _event = {
oldValue:_location,
newValue:_getLocation()
};
// check ignore beforeurlchange event... | javascript | {
"resource": ""
} | |
q29450 | train | function(){
var _knl = _m._$KERNEL;
_ie7 = _knl.engine=='trident'&&_knl.release<='3.0';
return _isHack()&&('onhashchange' in window)&&!_ie7;
} | javascript | {
"resource": ""
} | |
q29451 | tokenString | train | function tokenString(quote, f) {
return function(stream, state) {
var ch;
if(isInString(state) && stream.current() == quote) {
popStateStack(state);
if(f) state.tokenize = f;
return ret("string", "string");
}
pushStateStack(state, { type: "string", name: quote, toke... | javascript | {
"resource": ""
} |
q29452 | tokenVariable | train | function tokenVariable(stream, state) {
var isVariableChar = /[\w\$_-]/;
// a variable may start with a quoted EQName so if the next character is quote, consume to the next quote
if(stream.eat("\"")) {
while(stream.next() !== '\"'){};
stream.eat(":");
} else {
stream.eatWhile(isVariab... | javascript | {
"resource": ""
} |
q29453 | tokenAttribute | train | function tokenAttribute(stream, state) {
var ch = stream.next();
if(ch == "/" && stream.eat(">")) {
if(isInXmlAttributeBlock(state)) popStateStack(state);
if(isInXmlBlock(state)) popStateStack(state);
return ret("tag", "tag");
}
if(ch == ">") {
if(isInXmlAttributeBlock(state... | javascript | {
"resource": ""
} |
q29454 | train | function(tasksPerProcess) {
this.ttl = tasksPerProcess;
this.available = true;
this.process = fork(__dirname + '/child-process.js', {silent: true});
this.reset = function() {
this.process.kill('SIGKILL');
this.process = fork(__dirname + '/child-process.js', {silent: true});
this.ttl = tasksPerProc... | javascript | {
"resource": ""
} | |
q29455 | train | function(concurrency, tasksPerProcess) {
this.childs = [];
for(var i = 0; i < concurrency; i += 1) {
this.childs[i] = new Child(tasksPerProcess);
}
} | javascript | {
"resource": ""
} | |
q29456 | SQLiteHelper | train | function SQLiteHelper (schemaPath, dbPath) {
let dbFilePath = dbPath,
dbDirPath = path.dirname(dbFilePath),
sql;
/**
* Saves a sql database to the disk.
*
* @param sql {Database}
*/
function saveDB (sql) {
let data = sql.export();
let buffer = new Buffer... | javascript | {
"resource": ""
} |
q29457 | saveDB | train | function saveDB (sql) {
let data = sql.export();
let buffer = new Buffer(data);
mkdirp.sync(dbDirPath, '0755');
fs.writeFileSync(dbFilePath, buffer);
} | javascript | {
"resource": ""
} |
q29458 | query | train | function query (query, params) {
let rows = [];
let stmt = sql.prepare(query);
params = normalizeParams(params);
stmt.bind(params);
while(stmt.step()) {
rows.push(stmt.getAsObject());
}
stmt.free();
return rows;
} | javascript | {
"resource": ""
} |
q29459 | run | train | function run(query, params) {
let stmt = sql.prepare(query);
params = normalizeParams(params);
stmt.run(params);
stmt.free();
} | javascript | {
"resource": ""
} |
q29460 | validateAndCbBackend | train | function validateAndCbBackend (instance, urlPort, cb) {
var backendUrl = instance.dockerUrlForPort(urlPort);
var err = validateContainer(instance.attrs.container);
if (err) {
return cb(err); }
if (!backendUrl) {
err = Boom.create(400, 'port not exposed', urlPort);
return cb(err);
}
cb(null, bac... | javascript | {
"resource": ""
} |
q29461 | train | function () {
if (!self.connections.length) {
self.removeListener('remove', remove);
self.closing = false;
return callback();
}
} | javascript | {
"resource": ""
} | |
q29462 | identifySchema | train | function identifySchema(obj) {
if (obj) {
const code = obj.code;
const action = obj.action;
const category = Dialect[action];
if (category) {
if (action === 'msg' || action == 'invalid-request') {
// First handle the schemas which are a category unto themselves.
return category;... | javascript | {
"resource": ""
} |
q29463 | validate | train | function validate(object, validator, callback) {
if (typeof callback === 'function') {
return Joi.validate(object, validator, callback);
} else {
return Joi.validate(object, validator);
}
} | javascript | {
"resource": ""
} |
q29464 | autoValidate | train | function autoValidate(object) {
const seq = (object) ? object.seq : undefined;
const action = (object) ? object.action : undefined;
const schema = identifySchema(object)
if (schema) {
const {error, value} = validate(object, schema);
if (error) {
return { isValid: false, seq, action, error };
... | javascript | {
"resource": ""
} |
q29465 | parseAndAutoValidate | train | function parseAndAutoValidate(json) {
try {
const obj = JSON.parse(json);
return autoValidate(obj);
} catch (error) {
return { isValid: false, error: error };
}
} | javascript | {
"resource": ""
} |
q29466 | getDirection | train | function getDirection(position1, position2) {
var _getDistanceVector2 = getDistanceVector(position1, position2),
x = _getDistanceVector2.x,
y = _getDistanceVector2.y;
return atan2(y, x);
} | javascript | {
"resource": ""
} |
q29467 | findWord | train | function findWord(cm, lineNum, pos, dir, regexps) {
var line = cm.getLine(lineNum);
while (true) {
var stop = (dir > 0) ? line.length : -1;
var wordStart = stop, wordEnd = stop;
// Find bounds of next word.
for (; pos != stop; pos += dir) {
for (var i = 0; i < regexps.length; ++i... | javascript | {
"resource": ""
} |
q29468 | textObjectManipulation | train | function textObjectManipulation(cm, object, remove, insert, inclusive) {
// Object is the text object, delete object if remove is true, enter insert
// mode if insert is true, inclusive is the difference between a and i
var tmp = textObjects[object](cm, inclusive);
var start = tmp.start;
var end = t... | javascript | {
"resource": ""
} |
q29469 | train | function(_key,_event){
if (_event.state==0){
_doClearAction(_key);
}
_doStateChangeCallback(_key,_event.state);
} | javascript | {
"resource": ""
} | |
q29470 | train | function() {
this.handlers.push(topology.on('bindings-completed', () => {
this.handle('bindings-completed');
}));
this.handlers.push(connection.on('reconnected', () => {
this.transition('reconnecting');
}));
this.handlers.push(this.on('failed', (err) => {
_.each(thi... | javascript | {
"resource": ""
} | |
q29471 | train | function(reject) {
let index = _.indexOf(this.deferred, reject);
if (index >= 0) {
this.deferred.splice(index, 1);
}
} | javascript | {
"resource": ""
} | |
q29472 | train | function() {
let deferred = DeferredPromise();
logger.debug(`Destroy called on exchange ${this.name} - ${connection.name} (${this.published.count()} messages pending)`);
this.handle('destroy', deferred);
return deferred.promise;
} | javascript | {
"resource": ""
} | |
q29473 | train | function(message) {
let publishTimeout = message.timeout || options.publishTimeout || message.connectionPublishTimeout || 0;
logger.silly(`Publish called in state ${this.state}`);
return new Promise((resolve, reject) => {
let timeout;
let timedOut;
if(publishTimeout > 0) {
... | javascript | {
"resource": ""
} | |
q29474 | writeProgress | train | function writeProgress(id, total, completed) {
var percent = Math.round(10 * (100 * completed) / total) / 10;
if(id == lastProgressId) {
readline.cursorTo(process.stdout, 0);
readline.clearLine(process.stdout, 0);
} else {
lastProgressId = id;
process.stdout.write('\n');
... | javascript | {
"resource": ""
} |
q29475 | condition | train | function condition(file){
var suffix = file.path.substr(file.base.length);
var re = new RegExp(specialChars);
var flag = service === "hosting" && re.test(suffix);
var warning = "Warning: Cannot sync files with characters: " + specialChars + " in the file name: ";
if (flag){
var message = warni... | javascript | {
"resource": ""
} |
q29476 | PersonCommunications | train | function PersonCommunications (f1, personID) {
if (!personID) {
throw new Error('PersonCommunications requires a person ID!')
}
Communications.call(this, f1, {
path: '/People/' + personID + '/Communications'
})
} | javascript | {
"resource": ""
} |
q29477 | init | train | function init (router) {
router.use((err, req, res, next) => {
console.error(err.stack || err.message)
res.statusCode = err.statusCode || 500
res.end()
})
} | javascript | {
"resource": ""
} |
q29478 | train | function(table, params, unique) {
unique = unique || [];
let columns = _.keys(params);
let whereStatements = _.map(unique, function(c) { return c + '=:' + c});
let updatedColumns = _.map(_.filter(columns, function(c) { return unique.indexOf(c) }), function(c) { return c + '=:' + c });
... | javascript | {
"resource": ""
} | |
q29479 | train | function(obj, required_props) {
if(typeof obj === 'object') {
required_props = required_props || Object.keys(obj);
for (let prop of required_props) {
if (obj[prop] === undefined || obj[prop] === null || obj[prop] === '') {
throw new Error('Missing requ... | javascript | {
"resource": ""
} | |
q29480 | train | function() {
let resultLangCount = query('select count(*) as count from target_language');
let resultResLvl3Count = query('select count(*) as count from resource where checking_level >= 3');
let resultResCount = query('select count(*) as count from resource');
let result... | javascript | {
"resource": ""
} | |
q29481 | train | function(temp_target_language_slug) {
let result = query('select tl.* from target_language as tl' +
' left join temp_target_language as ttl on ttl.approved_target_language_slug=tl.slug' +
' where ttl.slug=?', [temp_target_language_slug]);
if(result.length > 0) {
... | javascript | {
"resource": ""
} | |
q29482 | train | function(languageSlug, projectSlug) {
// support passing args as an object
if(languageSlug != null && typeof languageSlug == 'object') {
projectSlug = languageSlug.projectSlug;
languageSlug = languageSlug.languageSlug;
}
let result = query... | javascript | {
"resource": ""
} | |
q29483 | train | function(languageSlug) {
let result;
if(languageSlug) {
result = query('select p.*, c.slug as category_slug from project as p' +
' left join category as c on c.id=p.category_id' +
' where p.source_language_id in (select id from source_langu... | javascript | {
"resource": ""
} | |
q29484 | train | function(parentCategoryId, languageSlug, translateMode) {
let preferredSlug = [languageSlug, 'en', '%'];
let categories = [];
if(translateMode) {
categories = query('select \'category\' as type, c.slug as name, \'\' as source_language_slug,' +
' c.... | javascript | {
"resource": ""
} | |
q29485 | train | function(languageSlug, projectSlug, resourceSlug) {
let result = query('select r.*, lri.translation_words_assignments_url from resource as r' +
' left join legacy_resource_info as lri on lri.resource_id=r.id' +
' where r.slug=? and r.project_id in (' +
' sel... | javascript | {
"resource": ""
} | |
q29486 | train | function(languageSlug, versificationSlug) {
let result = query('' +
'select vn.name, v.slug, v.id from versification_name as vn' +
' left join versification as v on v.id=vn.versification_id' +
' left join source_language as sl on sl.id=vn.source_language_id' +... | javascript | {
"resource": ""
} | |
q29487 | train | function(tdId) {
let result = query('select * from questionnaire where td_id=?', [tdId]);
if(result.length > 0) {
let questionnaire = result[0];
questionnaire.language_data = {};
// load data fields
let dataResults = query('select ... | javascript | {
"resource": ""
} | |
q29488 | train | function() {
let results = query('select * from questionnaire');
for(let questionnaire of results) {
// load data fields
questionnaire.language_data = {};
let dataResults = query('select field, question_td_id from questionnaire_data_field where qu... | javascript | {
"resource": ""
} | |
q29489 | train | function(language_slug, project_slug, resource_slug, resource_type, translate_mode, min_checking_level, max_checking_level) {
let condition_max_checking = '';
language_slug = language_slug || '%';
project_slug = project_slug || '%';
resource_slug = resource_slug || '%';
... | javascript | {
"resource": ""
} | |
q29490 | equal | train | function equal(a, b) {
if (a === b) return true;
if (a === undefined || b === undefined) return false;
if (a === null || b === null) return false;
if (a.constructor === String) return a.localeCompare(b) === 0;
if (b.constructor === String) return b.localeCompare(a) === 0;
... | javascript | {
"resource": ""
} |
q29491 | installFilteredMouseMove | train | function installFilteredMouseMove(element) {
element.bind("mousemove", function (e) {
var lastpos = $.data(document, "select2-lastpos");
if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
$(e.target).trigger("mousemove-filtered", e);
}... | javascript | {
"resource": ""
} |
q29492 | ajax | train | function ajax(options) {
var timeout, // current scheduled but not yet executed request
requestSequence = 0, // sequence used to drop out-of-order responses
handler = null,
quietMillis = options.quietMillis || 100;
return function (query) {
window.clearTi... | javascript | {
"resource": ""
} |
q29493 | local | train | function local(options) {
var data = options, // data elements
dataText,
text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
if (!$.isArray(data)) {
text = data.text;
... | javascript | {
"resource": ""
} |
q29494 | train | function () {
function resolveContainerWidth() {
var style, attrs, matches, i, l;
if (this.opts.width === "off") {
return null;
} else if (this.opts.width === "element"){
return this.opts.element.outerWidth() === 0 ? 'a... | javascript | {
"resource": ""
} | |
q29495 | IntervalMonitor | train | function IntervalMonitor(monitor, prefix, interval) {
this.monitor = monitor;
this.prefix = prefix || this.monitor.prefix;
this.interval = interval || this.monitor.interval;
} | javascript | {
"resource": ""
} |
q29496 | each | train | function each(key, interface, fn) {
var stack = interface.stack;
for (var i = 0, len = stack.length; i < len; i++) {
stack[i][key].forEach(fn);
}
} | javascript | {
"resource": ""
} |
q29497 | buildOpeningElementAttributes | train | function buildOpeningElementAttributes (attribs, state) {
var _props = []
while (attribs.length) {
var prop = attribs.shift()
if (t.isJSXSpreadAttribute(prop)) {
prop.argument._isSpread = true
_props.push(t.spreadProperty(prop.argument))
} else {
_props.push(convertAtt... | javascript | {
"resource": ""
} |
q29498 | train | function(_form){
var _result = [];
_u._$reverseEach(
_form.getElementsByTagName('input'),
function(_input){
if (_input.type!='file'){
return;
}
// remove file without name
... | javascript | {
"resource": ""
} | |
q29499 | train | function(_element){
var _id = _element.id;
if (!!_dataset[_id]) return;
var _map = {};
_u._$forEach(
_element.attributes,
function(_node){
var _key = _node.nodeName;
i... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.