_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q10200 | where | train | function where() {
var wheres = this.grouped.where;
if (!wheres) {
return undefined;
}
var i = -1,
sql = [];
while (++i < wheres.length) {
var stmt = wheres[i];
var val = this[stmt.type](stmt);
if (val) {
if (sql.length === 0) {
| javascript | {
"resource": ""
} |
q10201 | having | train | function having() {
var havings = this.grouped.having;
if (!havings) {
return '';
}
var sql = ['having'];
for (var i = 0, l = havings.length; i < l; i++) {
var str = '',
s = havings[i];
if (i !== 0) {
str = s.bool + ' ';
}
if (s.type === 'havingBasic')... | javascript | {
"resource": ""
} |
q10202 | _union | train | function _union() {
var onlyUnions = this.onlyUnions();
var unions = this.grouped.union;
if (!unions) {
return '';
}
var sql = '';
for (var i = 0, l = unions.length; i < l; i++) {
var union = unions[i];
if (i > 0) {
sql += ' ';
}
if (i > 0 || !onlyUnions) {
... | javascript | {
"resource": ""
} |
q10203 | del | train | function del() {
// Make sure tableName is processed by the formatter first.
var tableName = this.tableName;
var wheres = this.where();
var sql = 'delete from ' + tableName + (wheres ? ' ' + | javascript | {
"resource": ""
} |
q10204 | _counter | train | function _counter() {
var counter = this.single.counter;
var toUpdate = {};
toUpdate[counter.column] = this.client.raw(this.formatter.wrap(counter.column) | javascript | {
"resource": ""
} |
q10205 | whereBasic | train | function whereBasic(statement) {
return this._not(statement, '') + this.formatter.wrap(statement.column) + ' ' + | javascript | {
"resource": ""
} |
q10206 | _prepUpdate | train | function _prepUpdate(data) {
var vals = [];
var sorted = Object.keys(data).sort();
var i = -1;
| javascript | {
"resource": ""
} |
q10207 | _groupsOrders | train | function _groupsOrders(type) {
var items = this.grouped[type];
if (!items) {
return '';
}
var formatter = this.formatter;
var sql = items.map(function (item) {
return (item.value instanceof Raw ? formatter.unwrapRaw(item.value) : formatter.columnize(item.value)) + (type === 'order' && it... | javascript | {
"resource": ""
} |
q10208 | columnInfo | train | function columnInfo() {
var column = this.single.columnInfo;
return {
sql: 'select * from information_schema.columns where table_name = ? and table_catalog = ?',
bindings: [this.single.table, this.client.database()],
output: function output(resp) {
| javascript | {
"resource": ""
} |
q10209 | fixRoute | train | function fixRoute(route) {
//protect special chars while we replace
return route.replace(/\s*OR\s*/g,'__OR__'). | javascript | {
"resource": ""
} |
q10210 | train | function(callback, timeout){
var id = index++;
if(timeout > MAX_INT){
timeouts[id] = setTimeout(set.bind(undefined, callback, timeout - MAX_INT), MAX_INT);
}else{
if(timeout < 0) timeout = 0;
| javascript | {
"resource": ""
} | |
q10211 | train | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof SourceDescription)){
return new SourceDescription(json);
}
// If the given object is | javascript | {
"resource": ""
} | |
q10212 | from | train | function from(renderFn, name = renderFn.name) {
if (typeof name === 'function') {
[renderFn, name] = [name, renderFn];
} else if (typeof renderFn !== 'function') {
throw InvalidArgType({ renderFn }, 'a function');
}
name = String(name);
if (!name) {
throw InvalidArgValue({ name }, 'should not be ... | javascript | {
"resource": ""
} |
q10213 | ApiDox | train | function ApiDox() {
this.settings = {
input: '',
inputText: null,
inputTitle: '',
output: '',
fullSourceDescription: false
};
this.anchors = {};
this.comments = [];
this.curSection = null; | javascript | {
"resource": ""
} |
q10214 | forceEnd | train | function forceEnd(path, response) {
// Send a custom response for gateway timeout
new $CustomResponse().head(504, null, {
'Content-Type': 'text/html'
| javascript | {
"resource": ""
} |
q10215 | train | function(opts){
//defaults
opts = opts || {};
this.username = opts.username || '';
this.password = opts.password || '';
// oAuth Token
this.accessToken = opts.accessToken | javascript | {
"resource": ""
} | |
q10216 | train | function( type, handler ) {
if( handler === void 0 || handler === null )
throw new Error( 'Missing argument "handler"' )
if( typeof handler !== 'function' && typeof handler.handleEvent !== 'function' )
throw new TypeError( 'Handler must be a function.' )
this._events[ type ] ?
... | javascript | {
"resource": ""
} | |
q10217 | train | function( type, handler ) {
if( handler === void 0 || handler === null )
throw new Error( 'Missing argument "handler"' )
if( typeof handler !== 'function' && typeof handler.handleEvent !== 'function' )
throw new TypeError( 'Handler must be a function.' )
function wrapper() {
... | javascript | {
"resource": ""
} | |
q10218 | train | function( type ) {
var emitter = this
var listeners = this._events[ type ]
if( type === 'error' && !listeners ) {
if( !this._events.error ) {
throw !( arguments[1] instanceof Error ) ?
new Error( 'Unhandled "error" event.' ) :
arguments[1]
}
} ... | javascript | {
"resource": ""
} | |
q10219 | train | function( type, handler ) {
var handlers = this._events[ type ]
var position = handlers.indexOf( handler )
if( handlers && ~position ) {
if( handlers.length === 1 ) {
this._events[ type ] = undefined
| javascript | {
"resource": ""
} | |
q10220 | train | function( type ) {
if( arguments.length === 0 ) {
for( type in this._events ) {
this.removeAllListeners( type ) | javascript | {
"resource": ""
} | |
q10221 | getOptions | train | function getOptions(options) {
var opts = {
include: [
{
chars: [[0x0000, 0xFFFF]],
min: 0
}
],
exclude: []
};
// Merge the properties of our options
for (var property in options) {
// Ignore options that are not in our opts set or are not an ... | javascript | {
"resource": ""
} |
q10222 | generateString | train | function generateString(set, length) {
var content = '';
// Cannot generate a string from an empty set
if (set.length <= 0) {
return content;
}
for (var i = 0; i < length; i++) {
content | javascript | {
"resource": ""
} |
q10223 | getCharacterList | train | function getCharacterList(options) {
var regen = regenerate();
var include = options.include;
for (var i in include) {
for (var j in include[i].chars) {
// There should always be a 0th-index element
if (include[i].chars[j][0] === undefined) {
continue;
| javascript | {
"resource": ""
} |
q10224 | getCharacterSets | train | function getCharacterSets(options) {
var regen;
var include = options.include;
var sets = [];
for (var i in include) {
regen = regenerate();
for (var j in include[i].chars) {
// There should always be a 0th-index element
if (include[i].chars[j][0] === undefined) {
| javascript | {
"resource": ""
} |
q10225 | train | function() {
var objectDescriptor = arguments[arguments.length - 1];
var klass = objectDescriptor.constructor !== Object? objectDescriptor.constructor: function Class(toCast) {
if (!(this instanceof klass)) {
return klass.asInstance(toCast);
}
... | javascript | {
"resource": ""
} | |
q10226 | train | function(obj) {
if (obj === null || obj === void 0)
return false;
return Object(obj) instanceof this | javascript | {
"resource": ""
} | |
q10227 | train | function(object) {
if (object === null || object === void 0)
return object;
| javascript | {
"resource": ""
} | |
q10228 | train | function(obj) {
if (!obj.constructor.Bind) {
try {
var descr = {};
Bind.each(obj, function(name, method) {
descr[name] = {
get : function() {
... | javascript | {
"resource": ""
} | |
q10229 | train | function(svg, options) {
var widthCfg;
// the svg element to render charts to
this._svg = svg.classed('facet-layout',true);
this._attributes = options || {};
this._animDuration = commonOptionDefaults.duration;
// outer margins
this._margin = {
top: 0,
bottom: 50,
l... | javascript | {
"resource": ""
} | |
q10230 | applyGroupedDelta | train | function applyGroupedDelta(groupedDelta, callback) {
var createdCandidates = [];
logger.debug('Applying grouped delta', {category: 'sync-delta'});
async.eachSeries(groupedDelta, (node, cb) => {
if(node.actions.create && utility.isExcludeFile(utility.getNameFromPath(node.actions.create.path))) {
//do n... | javascript | {
"resource": ""
} |
q10231 | updateNode | train | function updateNode(node, callback) {
syncDb.update(node._id, node, (err, result) => {
| javascript | {
"resource": ""
} |
q10232 | resolveConflicts | train | function resolveConflicts(err, syncedNode, callback) {
if(err) return callback(err);
if(!syncedNode) return callback(null);
async.series([
(cb) => {
if(syncedNode.directory === true) {
resolveDirectoryConflicts(syncedNode, cb);
} else {
resolveFileConflicts(syncedNode, cb);
| javascript | {
"resource": ""
} |
q10233 | resolveDirectoryConflicts | train | function resolveDirectoryConflicts(node, callback) {
var rActions = node.remoteActions;
var lActions = node.localActions;
if(rActions && lActions) {
if(rActions.create && lActions.create) {
//on both sides created, we just need to add remoteId and remoteParent
node.remoteId = rActions.create.remo... | javascript | {
"resource": ""
} |
q10234 | resolveFileConflicts | train | function resolveFileConflicts(node, callback) {
var rActions = node.remoteActions;
var lActions = node.localActions;
if(!rActions || !lActions) {
//only one side changed, no conflicts
return callback(null);
}
if(rActions.create && lActions.create) {
//on both sides created or updated
var cur... | javascript | {
"resource": ""
} |
q10235 | renameConflictNode | train | function renameConflictNode(newParent, oldPath, name, node, conflictingNode, callback) {
var newLocalName = utility.renameConflictNode(newParent, name);
try {
fsWrap.renameSync(oldPath, utility.joinPath(newParent, newLocalName));
} catch(err) {
return renameRemoteNode(node, name, callback);
}
confli... | javascript | {
"resource": ""
} |
q10236 | renameRemoteNode | train | function renameRemoteNode(node, name, callback) {
var rActions = node.remoteActions || {};
var newLocalName = utility.renameConflictNodeRemote(name);
var oldLocalName = node.name;
var newLocalPath = utility.joinPath(node.parent, newLocalName);
var oldLocalPath = utility.joinPath(node.parent, oldLocalName);
... | javascript | {
"resource": ""
} |
q10237 | train | function(dirPath, lastCursor, callback) {
async.parallel([
(cb) => {
localDelta.getDelta(dirPath, cb);
},
(cb) => {
remoteDelta.getDelta(lastCursor, cb);
}
], (err, results) => {
logger.info('getDelta ended', {category: 'sync-delta'});
if(err) return callback... | javascript | {
"resource": ""
} | |
q10238 | train | function (auth, org, repo, ref, options, callback) {
if (typeof options == 'function') {
callback = options
options = {}
| javascript | {
"resource": ""
} | |
q10239 | getOldManifest | train | async function getOldManifest () {
try {
var data = await getFile('.manifest.json.gz')
} catch (err) {
if (err.code === 'NoSuchKey') return {}
else throw err | javascript | {
"resource": ""
} |
q10240 | upload | train | function upload (uploadables) {
var promises = uploadables.map((uploadable) | javascript | {
"resource": ""
} |
q10241 | toCassandraValues | train | function toCassandraValues(metadata, values) {
if (values === null || values === undefined) {
return null;
}
var specs = metadata.columnSpecs;
var list = [];
for (var i = 0; i < specs.length; i++) {
var value = values[i];
if (value === null || value === undefined) {
list.push(null);
| javascript | {
"resource": ""
} |
q10242 | singleline | train | function singleline(multiLineString, noSpaces) {
const delimiter = noSpaces ? '' : ' ';
| javascript | {
"resource": ""
} |
q10243 | closestButNotGreaterThan | train | function closestButNotGreaterThan(numbers, maxNumber) {
var positiveNumbers = numbers.map(function(number){
return Math.abs(number);
});
var positiveMaxNumber = Math.abs(maxNumber);
var winner = positiveMaxNumber;
var winningDifference = positiveMaxNumber;
for (var i=0; i < positiveNum... | javascript | {
"resource": ""
} |
q10244 | closestToZero | train | function closestToZero(numbers, maxNumber) {
//returns the index of value closest to 0
var positiveNumbers = numbers.map(function(number) {
return Math.abs(number);
});
| javascript | {
"resource": ""
} |
q10245 | findArcHeight | train | function findArcHeight(distance, radius, maxArcHeight, greaterThan180) {
var heightOptions = [];
heightOptions.push(radius + Math.sqrt(Math.pow(radius,2) - Math.pow(distance,2)));
heightOptions.push(radius - Math.sqrt(Math.pow(radius,2) - Math.pow(distance,2)));
if(greaterThan180){
| javascript | {
"resource": ""
} |
q10246 | negotiateLanguage | train | function negotiateLanguage( acceptable, supported, engineDefault ) {
var candidates = [];
var enumeration = acceptable || '';
if (enumeration) {
// Create list of candidate locales.
var re = /;q=[01]\.\d,?/g;
var matches = enumeration.match( re );
if (matches)
// Create weighted list of local... | javascript | {
"resource": ""
} |
q10247 | CruxTaskEntry | train | function CruxTaskEntry(name) {
this.autorun = true; // we can disable auto running.
this.name = name;
this.debug = false;
this.type = 'serial'; // the type of this task. Can be: serial or parallel
this.__queue = [];
this.__actions = {};
this.__hasActions = false;
this.__started = false;
this.__schedu... | javascript | {
"resource": ""
} |
q10248 | xgminer | train | function xgminer(host, port, options) {
this.host = host || this.defaults.host;
this.port | javascript | {
"resource": ""
} |
q10249 | encodeSpecialCharacters | train | function encodeSpecialCharacters (str) {
return encodeURI(str).replace(/[!'()* | javascript | {
"resource": ""
} |
q10250 | insertStaticSegments | train | function insertStaticSegments( components, segments, languages ) {
for (var componentName in components) {
if (components.hasOwnProperty( componentName )) {
var language;
var appliedTokens = [ ];
var component = components[ componentName ];
// Determine the language of the component.
... | javascript | {
"resource": ""
} |
q10251 | Conversation | train | function Conversation (config) {
if (!(this instanceof Conversation)) {
throw new SyntaxError('Constructor must be called with the new operator');
}
// public properties
this.id = config && config.id || uuid.v4();
this.self = config && config.self || null;
this.other = config && ... | javascript | {
"resource": ""
} |
q10252 | setDeveloperRoutes | train | function setDeveloperRoutes( app, filingCabinet, paths, develop ) {
// Create document template for resources.
var head = '\n' +
' <link rel="stylesheet" href="' + develop.cssBootstrap + '" />\n' +
' <link rel="stylesheet" href="' + develop.cssHighlight + '">\n';
var foot = '\n' +
' <script src="'... | javascript | {
"resource": ""
} |
q10253 | train | function(){ // the generator we will return
var res=f(); // get the first result
if(cond(res)&&failed){ // if we've failed twice, then we're done
return; // return an undefined result
}else if(cond(res)){ // otherwise, if we fail, try moving on
f=function(){return next();... | javascript | {
"resource": ""
} | |
q10254 | train | function(){ // the main generator you'll return
var res=kid(); // call the child function and store the result
if(cond(res)&&failed){ // if both generators have failed
return done(); // then you're done
}else if(cond(res)){ // if just the child has failed
par(); // regene... | javascript | {
"resource": ""
} | |
q10255 | removeHiddenColumns | train | function removeHiddenColumns(oldSorted, hiddenColumns){
var dirty = false;
oldSorted.forEach(function(i) {
var j = 0,
colIndex;
while (j < hiddenColumns.length) {
colIndex = hiddenColumns[j].index + 1; //hack to get around 0 index
| javascript | {
"resource": ""
} |
q10256 | solve | train | function solve() {
while (true) {
// establish vars for current loop
//----------------------------------------------------------
const row = this.state.i % this.state.rows
const col = Math.floor(this.state.i / this.state.rows)
const str = this.props.ar[this.state.i]
const len = str.length
... | javascript | {
"resource": ""
} |
q10257 | isInvalidInboundAddress | train | function isInvalidInboundAddress(inboundAddress) {
if (fuse.config.restrict_inbound === | javascript | {
"resource": ""
} |
q10258 | getEventType | train | function getEventType(inboundMessage) {
let recipientAddresses = _.map(inboundMessage.recipients, 'email');
let ccAddresses = _.map(inboundMessage.cc, 'email');
if (_.max([recipientAddresses.indexOf(fuse.config.inbound_address),
recipientAddresses.indexOf(inboundMessage.to.email)]) >= 0) {
... | javascript | {
"resource": ""
} |
q10259 | addFromAddress | train | function addFromAddress(inboundMessage, outboundMessage) {
if (inboundMessage && _.has(inboundMessage, 'from')) { | javascript | {
"resource": ""
} |
q10260 | defaultConfiguration | train | function defaultConfiguration(config) {
config = _.defaults({}, config, {
name: 'Sparky',
endpoint: '/relay',
convos: [],
sending_address: config.address,
inbound_address: config.address,
transport: 'sparkpost',
restrict_inbound: true,
logger: 'verbose',
size_limit: '50mb'
});
| javascript | {
"resource": ""
} |
q10261 | Decision | train | function Decision (arg1, arg2) {
var decision, choices;
if (!(this instanceof Decision)) {
throw new SyntaxError('Constructor must be called with the new operator');
}
if (typeof arg1 === 'function') {
decision = arg1;
choices = arg2;
}
else {
decision = null;
choices = arg1;
}
if... | javascript | {
"resource": ""
} |
q10262 | train | function (projectName, files, params, callback) {
if (callback === undefined) {
callback = params;
params = {};
}
var filesInformation = {};
files.forEach(function (fileName) {
var index = "files[" + fileName + "]";
filesInformation[index... | javascript | {
"resource": ""
} | |
q10263 | train | function (projectName, fileNameOrStream, callback) {
if (typeof fileNameOrStream === "string") {
fileNameOrStream = fs.createReadStream(fileNameOrStream);
}
| javascript | {
"resource": ""
} | |
q10264 | handleError | train | function handleError(reject) {
return (e) => {
// prevent global error throw https://bugzilla.mozilla.org/show_bug.cgi?id=872873
| javascript | {
"resource": ""
} |
q10265 | train | function(newData, limit) {
if ((this.buffer.length + newData.length) > options.limit) {
this.buffer = this.buffer.concat(newData.slice(0, options.limit - this.buffer.length));
| javascript | {
"resource": ""
} | |
q10266 | addReconnectOnReadonly | train | function addReconnectOnReadonly(cfg) {
const noop = () => false;
const userReconn = (typeof cfg.reconnectOnError === 'function') ? cfg.reconnectOnError : noop;
cfg.reconnectOnError = err => {
const shouldReconnect = (isReadonlyError(err) || | javascript | {
"resource": ""
} |
q10267 | _drawLine | train | function _drawLine(v0, v1, color) {
var p = new Primitive();
p.vertices = [v0, v1];
| javascript | {
"resource": ""
} |
q10268 | _drawArrow | train | function _drawArrow(pStart, pEnd, arrowSize, color) {
var p = new Primitive();
p.color = toColor(color);
p.vertices.push(pStart);
p.vertices.push(pEnd);
var dir = new THREE.Vector3();
dir.subVectors(pEnd, pStart);
dir.normalize();
var right = new THREE.... | javascript | {
"resource": ""
} |
q10269 | _drawSphere | train | function _drawSphere(pos, r, color) {
var p = new Primitive();
p.color = toColor(color);
// Decreasing these angles will increase complexity of sphere.
var dtheta = 35; var dphi = 35;
for (var theta = -90; theta <= (90 - dtheta); theta += dtheta) {
for (var phi = 0;... | javascript | {
"resource": ""
} |
q10270 | train | function(position, velocity, dt) {
| javascript | {
"resource": ""
} | |
q10271 | train | function( p, q ) {
var wurzel = Math.sqrt((p * p / 4) - q);
var vorwurzel = (-p / 2);
var result = [];
if( wurzel > 0 ) {
result = | javascript | {
"resource": ""
} | |
q10272 | train | function(myPos, myVelo, targetPos, targetVelo) {
var relTargetPos = mf.sub(targetPos, myPos);
var a = mf.lengthSquared(targetVelo) - myVelo * myVelo;
var b = 2.0 * mf.dot(targetVelo, relTargetPos);
var c = mf.lengthSquared(relTargetPos);
if( a === 0 ) {
if( b !== 0 ) {
var time = -c /... | javascript | {
"resource": ""
} | |
q10273 | train | function(myPos, myVelo, targetPos, targetVelo) {
var ticpt = this.calcInterceptTime(myPos, myVelo, targetPos, | javascript | {
"resource": ""
} | |
q10274 | train | function(myPos, myVelo, targetPos, targetVelo ) {
var distance = Math.sqrt(mf.lengthSquared(mf.sub(targetPos, myPos)));
var approachSpeed = this.calcApproachSpeed(myPos, myVelo, targetPos, targetVelo);
| javascript | {
"resource": ""
} | |
q10275 | train | function(myPos, myVelo, targetPos, targetVelo) {
var posDiff = mf.sub(targetPos, myPos);
var veloDiff = mf.sub(targetVelo, myVelo);
| javascript | {
"resource": ""
} | |
q10276 | train | function (partialString) {
var edgeQuotesMatcher = /^["']|["']$/g;
var partialIDWithQuotes = partialString.replace(this.findPartialsRE, '$1');
var partialID = | javascript | {
"resource": ""
} | |
q10277 | formatInboundRecipients | train | function formatInboundRecipients(recipients) {
return _.map(recipients, (recipient) => {
if (_.isString(recipient)) {
return {
email: recipient,
name: '',
};
}
| javascript | {
"resource": ""
} |
q10278 | train | function (webpackConfig, paths) {
var defaultWebpackConfig = {
output: {
filename: paths.output.name,
},
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
]
... | javascript | {
"resource": ""
} | |
q10279 | train | function(index, placeholder) {
if (typeof this.config.indexes[index] === 'undefined') {
console.log('LUNR: getLunrSearchPage will not work unless you specify a valid index from plugins.lunr.indexes in your Docpad configuration file.');
return;
}
placeholder = placeholder || 'Search terms';
v... | javascript | {
"resource": ""
} | |
q10280 | handle2dkeys | train | function handle2dkeys (keys, value, step, min, max) {
//up and right - increase by one
if (keys[38]) {
value[1] = inc(value[1], plainify(step, 1), 1);
}
if (keys[39]) {
value[0] = inc(value[0], plainify(step, 0), 1);
}
if (keys[40]) {
value[1] = inc(value[1], plainify(step, 1), -1);
}
if (keys[37]) {
va... | javascript | {
"resource": ""
} |
q10281 | handle1dkeys | train | function handle1dkeys (keys, value, step, min, max) {
step = step || 1;
//up and right - increase by one
if (keys[38] || keys[39]) {
value = inc(value, step, 1);
}
//down and left - decrease by one
if (keys[40] || keys[37]) {
value = inc(value, step, -1);
}
//home - min
if (keys[36]) {
value = min;
}... | javascript | {
"resource": ""
} |
q10282 | train | function(el, options) {
// default options for the line
var defaults = require('../utils/default-options')();
// if we don't pass options, just
// make it an empty object
if (typeof options === 'undefined' ) {
options = {};
}
options = _.defaults(options, defaults);
this.width ... | javascript | {
"resource": ""
} | |
q10283 | scanFolders | train | function scanFolders(rootFolderPath, folders, folderFileExtensions, callback) {
var result = [];
console.log('Scanning:: Folders', folders);
console.log('Scanning:: Root folder path', rootFolderPath);
var fileExtensions = self.fileExtensions.slice();
scanFolder();
funct... | javascript | {
"resource": ""
} |
q10284 | Slidy | train | function Slidy(target, options) {
//force constructor
if (!(this instanceof Slidy)) return new Slidy(target, options);
var self = this;
//ensure target & options
if (!options) {
if (target instanceof Element) {
options = {};
}
else {
options = target;
target = doc.createElement('div');
}
}
/... | javascript | {
"resource": ""
} |
q10285 | detectStep | train | function detectStep (min, max) {
var range = getTransformer(function (a, b) {
return Math.abs(a - b);
})(max, min);
var step | javascript | {
"resource": ""
} |
q10286 | detectValue | train | function detectValue (min, max) {
return getTransformer(function (a, b) {
| javascript | {
"resource": ""
} |
q10287 | setDefault | train | function setDefault (opts, key, val) {
if (opts.schema) {
opts.prompts = opts.schema;
delete opts.schema;
}
const prompts = opts.prompts || (opts.prompts = {});
if (!prompts[key] || typeof prompts[key] !== 'object') {
| javascript | {
"resource": ""
} |
q10288 | consumeIdent | train | function consumeIdent(stream) {
stream.start = stream.pos;
stream.eatWhile(isIdentPrefix);
stream.eatWhile(isIdent);
return | javascript | {
"resource": ""
} |
q10289 | consumeValue | train | function consumeValue(stream) {
const values = new CSSValue();
let value;
while (!stream.eof()) {
// use colon as value separator
stream.eat(COLON);
if (value = consumeNumericValue(stream) || consumeColor(stream)) {
// edge case: a dash after unit-less numeric value or color should
// be treated as valu... | javascript | {
"resource": ""
} |
q10290 | fract32 | train | function fract32 (arr) {
if (arr.length) {
var fract = float32(arr)
for (var i = 0, l = fract.length; i < l; i++) {
fract[i] = arr[i] - fract[i]
} | javascript | {
"resource": ""
} |
q10291 | float32 | train | function float32 (arr) {
if (arr.length) {
if (arr instanceof Float32Array) return arr
var float = new Float32Array(arr)
| javascript | {
"resource": ""
} |
q10292 | corsPrefetch | train | function corsPrefetch(req, res, next) {
res.header('Access-Control-Allow-Origin', req.headers.origin);
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, *'); | javascript | {
"resource": ""
} |
q10293 | writePCBuffer | train | function writePCBuffer(client, buffer) {
var length = pcbuffer.createBuffer();
length.writeVarInt(buffer.buffer().length);
| javascript | {
"resource": ""
} |
q10294 | sendContent | train | function sendContent(res, args, action, padId, padURL, resultDb) {
console.debug("starting sendContent: args ->", action, " / ", padId, " / ", padURL, " / ", resultDb);
if (action == 'subscribe') {
var actionMsg = "Subscribing '" + resultDb.email + "' to pad " + padId;
} else {
var actionMsg = "Unsubscri... | javascript | {
"resource": ""
} |
q10295 | preferencesReset | train | function preferencesReset() {
return this.initializedPromise.then(function() {
this.prefs = Object.create(DEFAULT_PREFERENCES);
| javascript | {
"resource": ""
} |
q10296 | preferencesGet | train | function preferencesGet(name) {
return this.initializedPromise.then(function () {
var defaultValue = DEFAULT_PREFERENCES[name];
if (defaultValue === undefined) {
throw new Error('preferencesGet: \'' + name + '\' is undefined.');
} else {
var | javascript | {
"resource": ""
} |
q10297 | secondaryToolbarSetMaxHeight | train | function secondaryToolbarSetMaxHeight(container) {
if (!container || !this.buttonContainer) {
return;
}
this.newContainerHeight = container.clientHeight;
if (this.previousContainerHeight === this.newContainerHeight) {
return;
}
| javascript | {
"resource": ""
} |
q10298 | PDFPresentationMode_request | train | function PDFPresentationMode_request() {
if (this.switchInProgress || this.active ||
!this.viewer.hasChildNodes()) {
return false;
}
this._addFullscreenChangeListeners();
this._setSwitchInProgress();
this._notifyStateChange();
if (this.container.requestFullscreen) ... | javascript | {
"resource": ""
} |
q10299 | isLeftMouseReleased | train | function isLeftMouseReleased(event) {
if ('buttons' in event && isNotIEorIsIE10plus) {
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons
// Firefox 15+
// Internet Explorer 10+
return !(event.buttons | 1);
}
| javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.