_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q29100 | getCzechForm | train | function getCzechForm (c) {
if (c === 1) {
return 0
} else if (Math.floor(c) !== c) {
return 1
} else if (c | javascript | {
"resource": ""
} |
q29101 | getPolishForm | train | function getPolishForm (c) {
if (c === 1) {
return 0
} else if (Math.floor(c) !== c) {
| javascript | {
"resource": ""
} |
q29102 | getSlavicForm | train | function getSlavicForm (c) {
if (Math.floor(c) !== c) {
return 2
} else if ((c % 100 >= 5 && c % 100 <= 20) || (c % 10 >= 5 && c % 10 <= 9) || c % 10 === 0) {
return 0
} else if (c % 10 | javascript | {
"resource": ""
} |
q29103 | getLithuanianForm | train | function getLithuanianForm (c) {
if (c === 1 || (c % 10 === 1 && c % 100 > 20)) {
return 0
} else if (Math.floor(c) !== c || (c % 10 >= 2 && c % 100 | javascript | {
"resource": ""
} |
q29104 | makeDateFromString | train | function makeDateFromString(config) {
parseISO(config);
if (config._isValid === false) {
delete config._isValid;
| javascript | {
"resource": ""
} |
q29105 | train | function (key) {
var newLocaleData;
if (key === undefined) {
return this._locale._abbr;
} else {
newLocaleData = moment.localeData(key);
if | javascript | {
"resource": ""
} | |
q29106 | train | function (number) {
var b = number,
output = '',
lookup = [
'', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed
'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed
... | javascript | {
"resource": ""
} | |
q29107 | weight | train | function weight(kernel, bandwidth, x_0, x_i) {
const arg = (x_i - x_0) | javascript | {
"resource": ""
} |
q29108 | copy | train | function copy(out, a) {
out[0] = a[0];
out[1] = a[1];
out[2] = a[2];
out[3] | javascript | {
"resource": ""
} |
q29109 | fromValues | train | function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
var out = new glMatrix.ARRAY_TYPE(9);
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] | javascript | {
"resource": ""
} |
q29110 | set | train | function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] = m10;
out[4] = m11;
| javascript | {
"resource": ""
} |
q29111 | identity | train | function identity(out) {
out[0] = 1;
out[1] = 0;
out[2] = 0;
| javascript | {
"resource": ""
} |
q29112 | transpose | train | function transpose(out, a) {
// If we are transposing ourselves we can skip a few steps but have to cache some values
if (out === a) {
var a01 = a[1],
a02 = a[2],
a12 = a[5];
out[1] = a[3];
out[2] = a[6];
out[3] = a01;
out[5] = a[7];
out[6] = a02;
out[7] = | javascript | {
"resource": ""
} |
q29113 | multiply | train | function multiply(out, a, b) {
var a00 = a[0],
a01 = a[1],
a02 = a[2];
var a10 = a[3],
a11 = a[4],
a12 = a[5];
var a20 = a[6],
a21 = a[7],
a22 = a[8];
var b00 = b[0],
b01 = b[1],
b02 = b[2];
var b10 = b[3],
b11 = b[4],
b12 = b[5];
var b20 = b[6],
... | javascript | {
"resource": ""
} |
q29114 | rotate | train | function rotate(out, a, rad) {
var a00 = a[0],
a01 = a[1],
a02 = a[2],
a10 = a[3],
a11 = a[4],
a12 = a[5],
a20 = a[6],
a21 = a[7],
a22 = a[8],
s = Math.sin(rad),
c = Math.cos(rad);
out[0] = c * a00 + s * a10;
out[1] = c * a01 + s | javascript | {
"resource": ""
} |
q29115 | scale | train | function scale(out, a, v) {
var x = v[0],
y = v[1];
out[0] = x * a[0];
out[1] = x * a[1];
out[2] = x * a[2];
out[3] = y * a[3];
out[4] | javascript | {
"resource": ""
} |
q29116 | fromMat2d | train | function fromMat2d(out, a) {
out[0] = a[0];
out[1] = a[1];
out[2] = 0;
out[3] = a[2];
out[4] = a[3];
out[5] = 0;
| javascript | {
"resource": ""
} |
q29117 | projection | train | function projection(out, width, height) {
out[0] = 2 / width;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = -2 / height;
out[5] = | javascript | {
"resource": ""
} |
q29118 | str | train | function str(a) {
return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] | javascript | {
"resource": ""
} |
q29119 | add | train | function add(out, a, b) {
out[0] = a[0] + b[0];
out[1] = a[1] + b[1];
out[2] = a[2] + b[2];
out[3] = a[3] + b[3];
out[4] = a[4] + b[4];
out[5] = a[5] + b[5]; | javascript | {
"resource": ""
} |
q29120 | subtract | train | function subtract(out, a, b) {
out[0] = a[0] - b[0];
out[1] = a[1] - b[1];
out[2] = a[2] - b[2];
out[3] = a[3] - b[3];
out[4] = a[4] - b[4];
out[5] = a[5] - | javascript | {
"resource": ""
} |
q29121 | multiplyScalar | train | function multiplyScalar(out, a, b) {
out[0] = a[0] * b;
out[1] = a[1] * b;
out[2] = a[2] * b;
out[3] = a[3] * b;
out[4] = a[4] * b;
out[5] | javascript | {
"resource": ""
} |
q29122 | multiplyScalarAndAdd | train | function multiplyScalarAndAdd(out, a, b, scale) {
out[0] = a[0] + b[0] * scale;
out[1] = a[1] + b[1] * scale;
out[2] = a[2] + b[2] * scale;
out[3] = a[3] + b[3] * scale;
out[4] = a[4] + b[4] * scale; | javascript | {
"resource": ""
} |
q29123 | equals | train | function equals(a, b) {
var a0 = a[0],
a1 = a[1],
a2 = a[2],
a3 = a[3],
a4 = a[4],
a5 = a[5],
a6 = a[6],
a7 = a[7],
a8 = a[8];
var b0 = b[0],
b1 = b[1],
b2 = b[2],
b3 = b[3],
b4 = b[4],
b5 = b[5],
b6 = b[6],
b7 = b[7],
b... | javascript | {
"resource": ""
} |
q29124 | add | train | function add(out, a, b) {
out[0] = a[0] + b[0];
out[1] = a[1] + b[1];
| javascript | {
"resource": ""
} |
q29125 | subtract | train | function subtract(out, a, b) {
out[0] = a[0] - b[0];
out[1] = a[1] - b[1];
| javascript | {
"resource": ""
} |
q29126 | multiply | train | function multiply(out, a, b) {
out[0] = a[0] * b[0];
out[1] = a[1] * b[1];
| javascript | {
"resource": ""
} |
q29127 | ceil | train | function ceil(out, a) {
out[0] = Math.ceil(a[0]); | javascript | {
"resource": ""
} |
q29128 | floor | train | function floor(out, a) {
out[0] = Math.floor(a[0]); | javascript | {
"resource": ""
} |
q29129 | round | train | function round(out, a) {
out[0] = Math.round(a[0]); | javascript | {
"resource": ""
} |
q29130 | scale | train | function scale(out, a, b) {
out[0] = a[0] * b;
out[1] = a[1] * b; | javascript | {
"resource": ""
} |
q29131 | hermite | train | function hermite(out, a, b, c, d, t) {
var factorTimes2 = t * t;
var factor1 = factorTimes2 * (2 * t - 3) + 1;
var factor2 = factorTimes2 * (t - 2) + t;
var factor3 = factorTimes2 * (t - 1);
var factor4 = factorTimes2 * (3 - 2 * t);
out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4... | javascript | {
"resource": ""
} |
q29132 | rotate | train | function rotate(out, a, b, c) {
//Translate point to the origin
var p0 = a[0] - b[0],
p1 = a[1] - b[1],
sinC = Math.sin(c),
cosC = Math.cos(c);
//perform rotation and translate to correct | javascript | {
"resource": ""
} |
q29133 | angle | train | function angle(a, b) {
var x1 = a[0],
y1 = a[1],
x2 = b[0],
y2 = b[1];
var len1 = x1 * x1 + y1 * y1;
if (len1 > 0) {
//TODO: evaluate use of glm_invsqrt here?
len1 = 1 / Math.sqrt(len1);
}
var len2 = x2 * x2 + y2 * y2;
if (len2 > 0) {
//TODO: evaluate use of glm_invsqrt here?... | javascript | {
"resource": ""
} |
q29134 | flatten | train | function flatten(arr) {
if (!isArray(arr)) {
return arr;
}
var result = [];
each(arr, function (item) {
if (isArray(item)) {
each(item, function (subItem) {
| javascript | {
"resource": ""
} |
q29135 | pick | train | function pick(object, keys) {
if (object === null || !isPlaineObject(object)) {
return {};
}
var | javascript | {
"resource": ""
} |
q29136 | getPath | train | function getPath(cfg, smooth) {
var path = void 0;
var points = cfg.points;
var isInCircle = cfg.isInCircle;
var first = points[0]; | javascript | {
"resource": ""
} |
q29137 | hrtimer | train | function hrtimer() {
const start = process.hrtime();
return () => {
const durationComponents = process.hrtime(start);
const seconds = durationComponents[0];
const nanoseconds | javascript | {
"resource": ""
} |
q29138 | sanitizeTags | train | function sanitizeTags(value, telegraf) {
const blacklist = telegraf ? /:|\|/g : /:|\||@|,/g;
// Replace reserved chars with | javascript | {
"resource": ""
} |
q29139 | formatTags | train | function formatTags(tags, telegraf) {
if (Array.isArray(tags)) {
return tags;
} else {
| javascript | {
"resource": ""
} |
q29140 | formatDate | train | function formatDate(date) {
let timestamp;
if (date instanceof Date) {
// Datadog expects seconds.
timestamp = Math.round(date.getTime() / 1000);
} else if (date instanceof Number) {
// Make | javascript | {
"resource": ""
} |
q29141 | intToIP | train | function intToIP(int) {
const part1 = int & 255;
const part2 = ((int >> 8) & 255);
| javascript | {
"resource": ""
} |
q29142 | getDefaultRoute | train | function getDefaultRoute() {
try {
const fileContents = fs.readFileSync('/proc/net/route', 'utf8'); // eslint-disable-line no-sync
const routes = fileContents.split('\n');
for (const routeIdx in routes) {
const fields = routes[routeIdx].trim().split('\t');
if (fields[1] === '00000000') {
... | javascript | {
"resource": ""
} |
q29143 | onSend | train | function onSend(error, bytes) {
completed += 1;
if (calledback) {
return;
}
if (error) {
if (typeof callback === 'function') {
calledback = true;
callback(error);
} else if (self.errorHandler) {
calledback = true;
self.errorHandler(error);
| javascript | {
"resource": ""
} |
q29144 | getBuildGradlePath | train | function getBuildGradlePath() {
var target = path.join("platforms", "android", "app", "build.gradle");
if (fs.existsSync(target)) {
return target;
| javascript | {
"resource": ""
} |
q29145 | train | function(platform) {
var platformConfigPath = path.join("..", "..", "..", platform + ".json");
var platformConfig = require(platformConfigPath);
var pluginId = this.getPluginId();
var apiKey = platformConfig.installed_plugins[pluginId].FABRIC_API_KEY;
| javascript | {
"resource": ""
} | |
q29146 | json2html | train | function json2html(json, options) {
var html = '';
if (typeof json === 'string') {
// Escape tags
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
if (options.withLinks && isUrl(json)) {
html += '<a href="' + json + '" class="json-string" target="_blank">... | javascript | {
"resource": ""
} |
q29147 | train | function () {
return _.map([].concat(this.pkgs, this.devPkgs), function (pkg) {
| javascript | {
"resource": ""
} | |
q29148 | train | function () {
var pkgs = this.pkgs;
var configNames = _.chain(pkgs)
.map(function (pkg) { return _.keys(pkg.config); })
.flatten()
.uniq()
.value();
// Take "first" config value in arrays as "winning" value.
return _.chain(configNames)
.map(function (name... | javascript | {
"resource": ""
} | |
q29149 | train | function (flagKey) {
var flags = _.isUndefined(flagKey) ? FLAGS.general : FLAGS[flagKey];
| javascript | {
"resource": ""
} | |
q29150 | train | function(url, org, space) {
var targetObject = {
'Url': url
};
if (org) targetObject.Org = | javascript | {
"resource": ""
} | |
q29151 | train | function(target, name, contentLocation, manifest, packager, instrumentation) {
var pushReq = {};
if (name)
pushReq.Name = name;
if (contentLocation)
pushReq.ContentLocation = contentLocation;
if (target)
pushReq.Target = target;
if(manifest)
pushReq.Manifest = manifest;
... | javascript | {
"resource": ""
} | |
q29152 | TextModel | train | function TextModel(text, lineDelimiter) {
this._lastLineIndex = -1;
this._text = [""];
this._lineOffsets = [0];
| javascript | {
"resource": ""
} |
q29153 | train | function() {
var count = 0;
for (var i = 0; i<this._text.length; | javascript | {
"resource": ""
} | |
q29154 | getBundles | train | function getBundles(buildObj) {
var _self = self;
var bundles = (buildObj.bundles || []);
return bundles.map(function(bundle) {
bundle = project.replaceProperties(bundle);
var dir = project.resolveFile(bundle + Packages.java.io.File.separator + "web");
if (!dir.exists() || !dir.isDirectory()) {
_self... | javascript | {
"resource": ""
} |
q29155 | train | function() {
if (this.textView) {
this.textView.removeEventListener("ModelChanging", this.listener.onModelChanging);
this.textView.removeEventListener("ModelChanged", this.listener.onModelChanged);
this.textView.removeEventListener("Destroy", this.listener.onDestroy);
this.textView.removeEventListene... | javascript | {
"resource": ""
} | |
q29156 | sendStatus | train | function sendStatus(code, res){
try{
if (httpCodeMapping) {
code = mapHttpStatusCode(code);
}
addStrictTransportHeaders(res); | javascript | {
"resource": ""
} |
q29157 | writeResponse | train | function writeResponse(code, res, headers, body, needEncodeLocation, noCachedStringRes) {
try{
if (res.headerSent) {
logger.error("header Sent:", res.req.method, res.req.originalUrl);
}
if (typeof code === 'number') {
if (httpCodeMapping) {
code = mapHttpStatusCode(code);
}
res.status(code);
}
... | javascript | {
"resource": ""
} |
q29158 | writeError | train | function writeError(code, res, msg) {
try{
if (res.headerSent) {
logger.error("header Sent:", res.req.method, res.req.originalUrl);
}
if (httpCodeMapping) {
code = mapHttpStatusCode(code);
}
msg = msg instanceof Error ? msg.message : msg;
addStrictTransportHeaders(res);
setResponseNoCache(res);
i... | javascript | {
"resource": ""
} |
q29159 | train | function(annotationModel, start, end) {
var iter = annotationModel.getAnnotations(start, end);
var annotation, annotations = [];
while (iter.hasNext()) {
annotation = iter.next();
if (!this.isAnnotationTypeVisible(annotation.type)) { continue; }
annotations.push(annotation);
}
| javascript | {
"resource": ""
} | |
q29160 | train | function(type) {
if (this.getAnnotationTypePriority(type) === 0) return false;
return !this._visibleAnnotationTypes || | javascript | {
"resource": ""
} | |
q29161 | train | function(type, visible) {
if (typeof type === "object") {
this._visibleAnnotationTypes = type;
} else {
| javascript | {
"resource": ""
} | |
q29162 | AnnotationModel | train | function AnnotationModel(textModel) {
this._annotations = [];
var self = this;
this._listener = {
onChanged: function(modelChangedEvent) {
| javascript | {
"resource": ""
} |
q29163 | train | function(textModel) {
if (this._model) {
this._model.removeEventListener("Changed", this._listener.onChanged); //$NON-NLS-0$
}
this._model = textModel;
if (this._model) {
| javascript | {
"resource": ""
} | |
q29164 | AnnotationStyler | train | function AnnotationStyler (view, annotationModel) {
this._view = view;
this._annotationModel = annotationModel;
var self = this;
this._listener = {
onDestroy: function(e) {
self._onDestroy(e);
},
onLineStyle: function(e) {
| javascript | {
"resource": ""
} |
q29165 | train | function(name, color, location, displayedLocation, editing) {
this.name = name;
this.color = color;
// Remove trailing "/"
if(location.substr(-1) === | javascript | {
"resource": ""
} | |
q29166 | train | function(model, callback) {
var self = this;
model.getRoot(function(root) {
// Find the existing ID reversely
var location = self.location;
while (location.length > 0) {
// Create a fake item
// NOTE: it's a hack because we don't have any efficient
// way to get the actual file no... | javascript | {
"resource": ""
} | |
q29167 | train | function() {
var element = document.createElement('div');
element.innerHTML = mUIUtils.getNameInitial(this.name);
element.style.backgroundColor = this.color;
element.classList.add('collabAnnotation');
| javascript | {
"resource": ""
} | |
q29168 | train | function(kb) {
if (!kb) { return false; }
if (this.keyCode !== kb.keyCode) { return false; }
if (this.mod1 !== kb.mod1) { return false; }
if (this.mod2 !== kb.mod2) { return false; }
if (this.mod3 !== | javascript | {
"resource": ""
} | |
q29169 | train | function(kb) {
if (!kb.keys) { return false; }
if (kb.keys.length !== this.keys.length) { return | javascript | {
"resource": ""
} | |
q29170 | train | function(category) {
var settingsMap = this.settingsMap;
var pids = typeof category === 'string' ? this.categories[category] : Object.keys(settingsMap); //$NON-NLS-0$
if (!pids) { | javascript | {
"resource": ""
} | |
q29171 | train | function(category) {
var settings = this.getSettings(category);
for (var i = 0; i < settings.length; | javascript | {
"resource": ""
} | |
q29172 | train | function(client, socket) {
OrionSocketAdapter.call(this, client);
var self = this;
this.socket = socket;
this.authenticated = false;
// Register incoming message handler | javascript | {
"resource": ""
} | |
q29173 | Reference | train | function Reference(ident, scope, flag,writeExpr, maybeImplicitGlobal, partial, init) {
/**
* Identifier syntax node.
* @member {esprima#Identifier} Reference#identifier
*/
this.identifier = ident;
/**
* Reference to the enclosing Scope.
* @member {Scope} Reference#fr... | javascript | {
"resource": ""
} |
q29174 | analyze | train | function analyze(tree, providedOptions) {
var scopeManager, referencer, options;
options = updateDeeply(defaultOptions(), providedOptions);
scopeManager = new ScopeManager(options);
referencer = new Referencer(options, scopeManager);
referencer.visit(tree); | javascript | {
"resource": ""
} |
q29175 | addProject | train | function addProject(project) {
var hub = generateUniqueHubId();
//TODO Also add name of project owner? Replace by projectJSON all over the file.
var query = sharedProject.findOne({location: project});
| javascript | {
"resource": ""
} |
q29176 | removeProject | train | function removeProject(project) {
return sharedProject.findOne({'location': project}).exec()
.then(function(doc) {
if (doc.users.length > 0) {
return userProjectsCollection.removeProjectReferences(doc.users, | javascript | {
"resource": ""
} |
q29177 | generateUniqueHubId | train | function generateUniqueHubId() {
//TODO ensure generated hub id is unique (not in db)
// do {
var length = 10;
var letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV0123456789';
var s = '';
for (var i=0; i<length; i++) {
s | javascript | {
"resource": ""
} |
q29178 | getUsersInProject | train | function getUsersInProject(project) {
return sharedProject.findOne({'location': | javascript | {
"resource": ""
} |
q29179 | addUserToProject | train | function addUserToProject(user, project) {
return addProject(project)
.then(function(doc) {
if (doc.users.indexOf(user) === -1) {
return sharedProject.findOneAndUpdate({'location': project}, {$addToSet: {'users': user} }, {
safe: true,
w: 'majority'
}).exec();
}
});
// return sharedProj... | javascript | {
"resource": ""
} |
q29180 | removeUserFromProject | train | function removeUserFromProject(user, project) {
return sharedProject.findOne({'location': project}).exec()
.then(function(doc) | javascript | {
"resource": ""
} |
q29181 | EditorView | train | function EditorView(options) {
this._parent = options.parent;
if(typeof this._parent === "string") {
this._parent = document.getElementById(options.parent);
}
this.id = options.id || "";
this.activateContext = options.activateContext;
this.renderToolbars = options.renderToolbars;
this.serviceRe... | javascript | {
"resource": ""
} |
q29182 | train | function(node) {
var lhs = node.left,
affectsProto;
if (lhs.type !== "MemberExpression" || lhs.object.type !== "MemberExpression") {
return;
}
affectsProto = lhs.object.computed ?
lhs.object.property.type === "Literal" && lhs.object.property.value === "prototype" :
lhs.object.prope... | javascript | {
"resource": ""
} | |
q29183 | isValidExpression | train | function isValidExpression(node) {
if (allowTernary) {
// Recursive check for ternary and logical expressions
if (node.type === "ConditionalExpression") {
return isValidExpression(node.consequent) && isValidExpression(node.alternate);
}
}
if (allowShortCircuit) {
if (node.type === "Logical... | javascript | {
"resource": ""
} |
q29184 | OutputTerminal | train | function OutputTerminal(options, components) {
this.element = components.element;
this.requisition = components.requisition;
this.requisition.commandOutputManager.onOutput.add(this.outputted, this);
var document = components.element.ownerDocument;
if (outputViewCss != null) {
| javascript | {
"resource": ""
} |
q29185 | OutputView | train | function OutputView(outputData, outputTerminal) {
this.outputData = outputData;
this.outputTerminal = outputTerminal;
this.url = util.createUrlLookup(module);
// Elements attached to this by template().
this.elems = {
rowin: null,
rowout: null,
hide: null,
show: null,
duration: null,
... | javascript | {
"resource": ""
} |
q29186 | getOptions | train | function getOptions(serviceRegistry, serviceID) {
var options = Object.create(null);
getReferences(serviceRegistry, serviceID).forEach(function(serviceRef) {
serviceRef.getPropertyKeys().forEach(function(key) { | javascript | {
"resource": ""
} |
q29187 | Display | train | function Display(options) {
var doc = options.document || document;
this.displayStyle = undefined;
if (displayCss != null) {
this.displayStyle = util.importCss(displayCss, doc, 'gcli-css-display');
}
// Configuring the document is complex because on the web side, there is an
// active desire to have n... | javascript | {
"resource": ""
} |
q29188 | find | train | function find(doc, element, id) {
if (!element) {
element = doc.getElementById(id);
| javascript | {
"resource": ""
} |
q29189 | insert | train | function insert(sibling, element, id) {
var doc = sibling.ownerDocument;
if (!element) {
element = doc.getElementById('gcli-row-complete');
if (!element) {
element = util.createElement(doc, 'div');
| javascript | {
"resource": ""
} |
q29190 | train | function(node) {
this.currentNode = node;
// Updates the code path due to node's position in its parent node.
if (node.parent) {
preprocess(this, node);
}
// Updates the code path.
// | javascript | {
"resource": ""
} | |
q29191 | train | function(node) {
this.currentNode = node;// Updates the code path.
// And emits onCodePathStart/onCodePathSegmentStart events.
processCodePathToExit(this, node);
// Emits node events.
this.original.leaveNode(node);
// | javascript | {
"resource": ""
} | |
q29192 | train | function(fromSegment, toSegment) {
if (fromSegment.reachable && toSegment.reachable) { | javascript | {
"resource": ""
} | |
q29193 | isAdmin | train | function isAdmin(options, username) {
return (options.configParams.get("orion.auth.user.creation") | javascript | {
"resource": ""
} |
q29194 | userJSON | train | function userJSON(user, options) {
return {
FullName: user.fullname,
UserName: user.username,
Location: api.join(options.usersRoot, user.username),
Email: user.email,
EmailConfirmed: emailConfirmed(user),
| javascript | {
"resource": ""
} |
q29195 | oauth | train | function oauth(id, username, email, req, done) {
if (req.params["0"] === "/link") {
return done(null, {
__linkUser: true,
email: email,
username: username,
id: id
});
}
fileUtil.getMetastoreSafe(req).then(function(store) {
store.getUserByOAuth(id, function(err, user) {
if (err) {
return done... | javascript | {
"resource": ""
} |
q29196 | configureGithubOAuth | train | function configureGithubOAuth(app, options) {
if (options.configParams.get("orion.oauth.github.client")) {
const GithubStrategy = require('passport-github2').Strategy;
passport.use(new GithubStrategy({
clientID: options.configParams.get("orion.oauth.github.client"),
clientSecret: options.configParams.get("or... | javascript | {
"resource": ""
} |
q29197 | checkUserAccess | train | function checkUserAccess(req, res, next) {
const isadmin = isAdmin(options, req.user.username);
if (!req.user || !(req.params.id === req.user.username || isadmin)) {
return api.writeResponse(403, res);
}
const contextPath = | javascript | {
"resource": ""
} |
q29198 | train | function() {
var combined = Status.VALID;
for (var i = 0; i < arguments.length; i++) {
var status = arguments[i];
if (Array.isArray(status)) {
status = | javascript | {
"resource": ""
} | |
q29199 | train | function(options, callback) {
if (typeof options === "function") {
callback = options;
options = null;
}
options = options || {};
var startSegment = options.first || this.internal.initialSegment;
var lastSegment = options.last;
var item = null;
var index = 0;
var end = 0;
var segmen... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.