_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q54500 | flattenPath | train | function flattenPath(file, opts) {
var fileName = path.basename(file.path);
var dirs;
if (!opts.includeParents && !opts.subPath) {
return fileName;
}
dirs = path.dirname(file.relative).split(path.sep);
| javascript | {
"resource": ""
} |
q54501 | train | function(r) {
if (!seenConnectionBanner) {
self.emit('connected', r);
seenConnectionBanner = true;
deferredSetup.resolve(r);
return;
}
if (r.hasOwnProperty("rx") && self.serialPortData === null) {
self.ignoredResponses--;
if (!self.timedSendsOnly) {
self.linesReq... | javascript | {
"resource": ""
} | |
q54502 | train | function (k, v) {
promiseChain = promiseChain.then(function() {
return self.set(k, v);
}).catch(function (e) {
// console.log("Caught error setting {", k, | javascript | {
"resource": ""
} | |
q54503 | getFormat | train | function getFormat (obj) {
//undefined format - no format-related props, for sure
if (!obj) return {}
//if is string - parse format
if (typeof obj === 'string' || obj.id) {
return parse(obj.id || obj)
}
//if audio buffer - we know it’s format
else if (isAudioBuffer(obj)) {
var arrayFormat = fromTypedArray(... | javascript | {
"resource": ""
} |
q54504 | equal | train | function equal (a, b) {
return (a.id | javascript | {
"resource": ""
} |
q54505 | toArrayBuffer | train | function toArrayBuffer (audioBuffer, format) {
if (!isNormalized(format)) format = normalize(format)
var data
//convert to arraybuffer
if (audioBuffer._data) data = audioBuffer._data.buffer;
else {
var floatArray = audioBuffer.getChannelData(0).constructor;
data = new floatArray(audioBuffer.length * audioBu... | javascript | {
"resource": ""
} |
q54506 | toAudioBuffer | train | function toAudioBuffer (buffer, format) {
if (!isNormalized(format)) format = normalize(format)
buffer = convert(buffer, format, {
channels: format.channels,
sampleRate: format.sampleRate,
interleaved: false,
float: true
})
var len = Math.floor(buffer.byteLength * .25 / format.channels)
var audioBuffer ... | javascript | {
"resource": ""
} |
q54507 | convert | train | function convert (buffer, from, to) {
//ensure formats are full
if (!isNormalized(from)) from = normalize(from)
if (!isNormalized(to)) to = normalize(to)
//convert buffer/alike to arrayBuffer
var data
if (buffer instanceof ArrayBuffer) {
data = buffer
}
else if (ArrayBuffer.isView(buffer)) {
if (buffer.byt... | javascript | {
"resource": ""
} |
q54508 | fromTypedArray | train | function fromTypedArray (array) {
if (array instanceof Int8Array) {
return {
float: false,
signed: true,
bitDepth: 8
}
}
if ((array instanceof Uint8Array) || (array instanceof Uint8ClampedArray)) {
return {
float: false,
signed: false,
bitDepth: 8
}
}
if (array instanceof Int16Array) {
... | javascript | {
"resource": ""
} |
q54509 | fromObject | train | function fromObject (obj) {
//else retrieve format properties from object
var format = {}
formatProperties.forEach(function (key) {
if (obj[key] != null) format[key] = obj[key]
})
//some AudioNode/etc-specific options
if (!format.channels && (obj.channelCount || obj.numberOfChannels)) {
format.channels | javascript | {
"resource": ""
} |
q54510 | isObject | train | function isObject (arg) {
return arg === Object(arg) | javascript | {
"resource": ""
} |
q54511 | removeKeysFrom | train | function removeKeysFrom (val, props, recursive = false) {
// Replace circular values with '[Circular]'
const obj = fclone(val)
if (isObject(obj)) {
return | javascript | {
"resource": ""
} |
q54512 | removeKeysFromObject | train | function removeKeysFromObject (obj, props, recursive = false) {
const res = {}
const keys = Object.keys(obj)
const isRecursive = !!recursive
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
const val = obj[key]
const hasKey = props.indexOf(key) === -1
if (isRecursiv... | javascript | {
"resource": ""
} |
q54513 | removeKeysFromArray | train | function removeKeysFromArray (array, props, recursive = false) {
const res = []
let val = {}
if (!array.length) {
return res
}
for (let i = 0; i < array.length; i++) {
if (isObject(array[i])) {
val = removeKeysFromObject(array[i], props, recursive)
} else if (isArray(arra... | javascript | {
"resource": ""
} |
q54514 | assertEqual | train | function assertEqual (_super) {
return function (val) {
const props = utils.flag(this, 'excludingProps')
if (utils.flag(this, 'excluding')) {
val = removeKeysFrom(val, props)
} else if (utils.flag(this, 'excludingEvery')) {
| javascript | {
"resource": ""
} |
q54515 | getStorageObj | train | function getStorageObj(client, namespace) {
return {
get: function(id, cb) {
client.hget(namespace, id, function(err, res) {
cb(err, res ? JSON.parse(res) : null);
});
},
save: function(object, cb) {
if (!object.id) {
return... | javascript | {
"resource": ""
} |
q54516 | inTag | train | function inTag(stream, state) {
var ch = stream.next();
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
state.jsxTag.depth -= 1;
state.tokenize = tokenBase;
return ret(ch == ">" ? "endTag" : "selfcloseTag", "tag bracket");
} else if (ch == "=") {
type = "equals";
return null... | javascript | {
"resource": ""
} |
q54517 | applyPropDoclets | train | function applyPropDoclets(props, propName) {
let prop = props[propName];
let doclets = prop.doclets;
let value;
// the @type doclet to provide a prop type
// Also allows enums (oneOf) if string literals are provided
// ex: @type {("optionA"|"optionB")}
if (doclets.type) {
value = cleanDocletValue(doc... | javascript | {
"resource": ""
} |
q54518 | generateHTML | train | function generateHTML(fileName) {
return new Promise( resolve => {
const location = fileName === 'index.html' ? '/' : `/${fileName}`;
match({routes, location}, (error, redirectLocation, renderProps) => {
let html = ReactDOMServer.renderToString(
<RouterContext {...renderProps} />
);
| javascript | {
"resource": ""
} |
q54519 | AuthTicket | train | function AuthTicket(json) {
var self = this;
if (!(this instanceof AuthTicket)) return new AuthTicket(json);
for (var p in json) {
if (json.hasOwnProperty(p)) {
self[p] = p.indexOf('Expiration') | javascript | {
"resource": ""
} |
q54520 | Delegate | train | function Delegate(root) {
/**
* Maintain a map of listener
* lists, keyed by event name.
*
* @type Object
*/
this.listenerMap = [{}, {}];
if (root) {
| javascript | {
"resource": ""
} |
q54521 | loadPartials | train | function loadPartials(template, templatePath) {
var templateDir = path.dirname(templatePath)
var partialRegexp = new RegExp(
escapeRegex(mustache.tags[0]) +
'>\\s*(\\S+)\\s*' +
escapeRegex(mustache.tags[1]),
'g'
)
var partialMatch
while ((partialMatch = partialRegexp.ex... | javascript | {
"resource": ""
} |
q54522 | notifySlack | train | function notifySlack ({ channel, text, webhook }) {
return fetch(webhook, {
body: JSON.stringify({
channel,
text
}),
headers: {
'Content-Type': 'application/json'
},
method: 'POST'
})
| javascript | {
"resource": ""
} |
q54523 | findFile | train | function findFile (filename) {
const file = configDirectory + '/' + filename
if (fs.existsSync(file)) return file
const defaultFile = | javascript | {
"resource": ""
} |
q54524 | loadYaml | train | function loadYaml (filename) {
const file = findFile(`${filename}.yml`) | javascript | {
"resource": ""
} |
q54525 | overrideWithEnvironment | train | function overrideWithEnvironment (object, environment) {
if (object.environments && object.environments[environment]) {
const newObject = Object.assign(
{},
| javascript | {
"resource": ""
} |
q54526 | parseImportLine | train | function parseImportLine (line) {
if (IS_IMPORT.test(line)) {
// could be either depending on whether default import was before or after named imports
const [, default0, named, default1] = IMPORT.exec(line)
const defaultImport = default0 || default1
const namedImports = []
if (named) {
let n... | javascript | {
"resource": ""
} |
q54527 | lintFileContents | train | function lintFileContents (messages, js) {
// what was messages imported as
let importedAtRootAs = false
let importedMembersAs
const importedMembersLookup = new Map()
let namedMatcher, rootMatcher
// TODO handle importing members, e.g. import { analysis } from messages
const foundMessages = []
let l... | javascript | {
"resource": ""
} |
q54528 | svgToString | train | function svgToString (filename) {
if (!/\.svg$/i.test(filename)) {
return through()
}
return through(function (buf, enc, next) | javascript | {
"resource": ""
} |
q54529 | yamlTransform | train | function yamlTransform (filename) {
if (!/\.yml|\.yaml$/i.test(filename)) {
return through()
}
return through(function (buf, enc, next) {
this.push(
| javascript | {
"resource": ""
} |
q54530 | logAndSend | train | function logAndSend ({ err, res }) {
logger.error('flyle >> | javascript | {
"resource": ""
} |
q54531 | sendImg | train | function sendImg ({ path, res }) {
res.writeHead(STATUS_OK, {
'Content-Type': 'image/png'
| javascript | {
"resource": ""
} |
q54532 | classifyFile | train | function classifyFile (file) {
return stat(file).then(({ err, stats }) => {
if (err) {
if (err.code === 'ENOENT') | javascript | {
"resource": ""
} |
q54533 | globPromise | train | function globPromise (file) {
return new Promise((resolve, reject) => {
glob(file, (err, files) | javascript | {
"resource": ""
} |
q54534 | globFile | train | function globFile (file) {
return stat(file).then(({ err, stats }) => {
if (err) throw err
if (stats.isDirectory()) {
// TODO what if file is already slash-terminated?
switch (file) {
case './':
return globPromise('./*.js')
| javascript | {
"resource": ""
} |
q54535 | clearTimeouts | train | function clearTimeouts() {
// stop tracking time for network operations
self._networkTime = contimer.stop(self._timerCtx, self.buildTimerId('network'));
if (socketTimeout) {
clearTimeout(socketTimeout);
| javascript | {
"resource": ""
} |
q54536 | breakRequest | train | function breakRequest(retryReason) {
clearTimeouts();
// mark this request as rejected, response must not be built in this case
httpRequest.rejected = true;
// force agent "freeness" (e.g. release) in Node.js<0.12 and dump response object internally
httpRequest.abort();
| javascript | {
"resource": ""
} |
q54537 | upload | train | function upload ({ body, s3bucket, cloudfront, outfile }) {
const bucketUrl = `https://s3.amazonaws.com/${s3bucket}`
return new Promise((resolve, reject) => {
const s3object = new AWS.S3({
params: {
ACL: 'public-read',
Body: body,
Bucket: s3bucket,
ContentType: mime.getType... | javascript | {
"resource": ""
} |
q54538 | bytesToSize | train | function bytesToSize (bytes) {
const sizes = ['bytes', 'kb', 'mb', 'gb', 'tb']
if (bytes === 0) return '0 byte'
const i = parseInt(Math.floor(Math.log(bytes) / | javascript | {
"resource": ""
} |
q54539 | getUrl | train | function getUrl (value) {
const reg = /url\((\s*)(['"]?)(.+?)\2(\s*)\)/g | javascript | {
"resource": ""
} |
q54540 | browserifyIt | train | function browserifyIt ({ config, entry, env, instrument }) {
return browserify(entry, {
basedir: process.cwd(),
cache: {},
debug: true,
fullPaths: env === 'development',
packageCache: {},
paths: [
| javascript | {
"resource": ""
} |
q54541 | transformDir | train | function transformDir ({ config, entry, outdir }) {
return glob.sync(`${entry[0]}/**/*.js`).map(filename =>
transformFile({
config,
| javascript | {
"resource": ""
} |
q54542 | transformFile | train | function transformFile ({ config, entry, outdir }) {
const filename = entry[0]
const filepath = entry[1] || `${outdir}/${filename}`
const results = babel.transform(
fs.readFileSync(filename, 'utf8'),
Object.assign({}, config, { filename, sourceMaps: true })
)
mkdirp.sync(path.dirname(filepath))
| javascript | {
"resource": ""
} |
q54543 | dirParseSync | train | function dirParseSync(startDir, result) {
var files;
var i;
var tmpPath;
var currFile;
// initialize the `result` object if it is the first iteration
if (result === undefined) {
result = {};
result[localSep] = [];
}
// check if `startDir` is a valid location
if (!fs.exi... | javascript | {
"resource": ""
} |
q54544 | train | function() {
this.plugin('done', stats => {
fs.writeFileSync(
path.join(targetConfig.output.path, | javascript | {
"resource": ""
} | |
q54545 | createCache | train | function createCache (cacheForMilliSeconds) {
var cache = {}
var newRemove = new Set()
var oldRemove = new Set()
function use (id) {
newRemove.delete(id)
oldRemove.delete(id)
}
function release (id) {
newRemove.add(id)
}
var timer = setInterval(() => {
oldRemove.forEach(id => {
... | javascript | {
"resource": ""
} |
q54546 | getIndex | train | function getIndex(index) {
if (this[_privateKey]._options.keysIgnoreCase && typeof index === 'string') {
const indexLowerCase = index.toLowerCase();
for (const key in this[_privateKey]._schema) {
if (typeof | javascript | {
"resource": ""
} |
q54547 | detectCustomErrorMessage | train | function detectCustomErrorMessage(key) {
if (typeof properties[key] === 'object' && properties[key].errorMessage && properties[key].value) {
return properties[key];
}
else if (_.isArray(properties[key])) {
return {
value: pro... | javascript | {
"resource": ""
} |
q54548 | addToSchema | train | function addToSchema(index, properties) {
this[_privateKey]._schema[index] = normalizeProperties.call(this, properties, index);
| javascript | {
"resource": ""
} |
q54549 | defineGetter | train | function defineGetter(index, properties) {
// If the field type is an alias, we retrieve the value through the alias's index.
let indexOrAliasIndex = properties.type === 'alias' ? properties.index : index;
this.__defineGetter__(index, () => {
// If accessing object or array, la... | javascript | {
"resource": ""
} |
q54550 | defineSetter | train | function defineSetter(index, properties) {
this.__defineSetter__(index, (value) => {
// Don't proceed if readOnly is true.
if (properties.readOnly) {
return;
}
try {
// this[_privateKey]._this[index] is used instead of this... | javascript | {
"resource": ""
} |
q54551 | train | function(where, name) {
var orig = [][name];
DefineList.prototype[name] = function() {
if (!this._length) {
// For shift and pop, we just return undefined without
// triggering events.
return undefined;
}
var args = getArgs(arguments),
len = where && this._length ? this._length - 1 : 0,
... | javascript | {
"resource": ""
} | |
q54552 | train | function(key, handler, queue) {
var translationHandler;
if (isNaN(key)) {
return onKeyValue.apply(this, arguments);
}
else {
translationHandler = function() {
handler(this[key]);
};
//!steal-remove-start
if(process.env.NODE_ENV !== 'production') {
Object.defineProperty(translationHandler,... | javascript | {
"resource": ""
} | |
q54553 | train | function(key, handler, queue) {
var translationHandler;
if ( isNaN(key)) {
return offKeyValue.apply(this, arguments);
}
else {
| javascript | {
"resource": ""
} | |
q54554 | train | function(prop, get, defaultValueFn) {
return function() {
var map = this,
defaultValue = defaultValueFn && defaultValueFn.call(this),
observable, computeObj;
if(get.length === 0) {
observable = new Observation(get, map);
} else if(get.length === 1) {
observable = new SettableObservable(get,... | javascript | {
"resource": ""
} | |
q54555 | train | function(definition, behavior, value) {
if(behavior === "enumerable") {
// treat enumerable like serialize
definition.serialize = !!value;
}
else if(behavior === "type") {
var behaviorDef = value;
if(typeof behaviorDef === "string") {
behaviorDef = define.types[behaviorDef];
if(typeof behaviorDef === "... | javascript | {
"resource": ""
} | |
q54556 | BufferObject | train | function BufferObject(data, getUpdate, maxAge) {
if (!Object.is(typeof getUpdate, 'function')) {
throw new Error('BufferObject requires an update function');
}
maxAge = maxAge || 6e4;
return {
lastUpdate: data ? Date.now() : 0,
data: data || null,
set(setData) {
... | javascript | {
"resource": ""
} |
q54557 | train | function() {
var ctx = u.context(SMALL);
logger.debugf('Invoke iterator.close(msgId=%d,iteratorId=%s) on %s', ctx.id, iterId, conn.toString());
return futurePinned(
| javascript | {
"resource": ""
} | |
q54558 | train | function(k) {
var ctx = u.context(SMALL);
logger.debugf('Invoke containsKey(msgId=%d,key=%s)', ctx.id, u.str(k));
| javascript | {
"resource": ""
} | |
q54559 | train | function(k) {
var ctx = u.context(SMALL);
logger.debugf('Invoke getWithMetadata(msgId=%d,key=%s)', ctx.id, u.str(k));
| javascript | {
"resource": ""
} | |
q54560 | train | function(k, opts) {
var ctx = u.context(SMALL);
logger.debugl(function() {return ['Invoke remove(msgId=%d,key=%s,opts=%s)',
ctx.id, u.str(k), JSON.stringify(opts)]; });
| javascript | {
"resource": ""
} | |
q54561 | train | function(k, v, version, opts) {
var ctx = u.context(MEDIUM);
logger.debugl(function() { return ['Invoke replaceWithVersion(msgId=%d,key=%s,value=%s,version=0x%s,opts=%s)',
ctx.id, u.str(k), u.str(v), version.toString('hex'), JSON.stringify(opts)]; }); | javascript | {
"resource": ""
} | |
q54562 | train | function(pairs, opts) {
var ctx = u.context(BIG);
logger.debugl(function() { return ['Invoke putAll(msgId=%d,pairs=%s,opts=%s)',
| javascript | {
"resource": ""
} | |
q54563 | train | function(batchSize, opts) {
var ctx = u.context(SMALL);
logger.debugf('Invoke iterator(msgId=%d,batchSize=%d,opts=%s)', ctx.id, batchSize, u.str(opts));
var remote = future(ctx, 0x31, p.encodeIterStart(batchSize, opts), p.decodeIterId);
| javascript | {
"resource": ""
} | |
q54564 | train | function(event, listener, opts) {
var ctx = u.context(SMALL);
return _.has(opts, 'listenerId') | javascript | {
"resource": ""
} | |
q54565 | train | function(listenerId) {
var ctx = u.context(SMALL);
logger.debugf('Invoke removeListener(msgId=%d,listenerId=%s) remotely', ctx.id, listenerId);
var conn = p.findConnectionListener(listenerId);
if (!f.existy(conn))
return Promise.reject(
new Error('No server connecti... | javascript | {
"resource": ""
} | |
q54566 | train | function(scriptName, params) {
var ctx = u.context(SMALL);
logger.debugf('Invoke execute(msgId=%d,scriptName=%s,params=%s)', ctx.id, scriptName, u.str(params));
// TODO update jsdoc, value does not need | javascript | {
"resource": ""
} | |
q54567 | train | function(transport) {
return {
/**
* Get the server topology identifier.
*
* @returns {Number} Topology identifier.
* @memberof Topology#
* @since 0.3
*/
getTopologyId: function() {
return transport.getTopologyId();
},
/**
* Get the li... | javascript | {
"resource": ""
} | |
q54568 | train | function(values) {
if (values.length < 3) {
logger.tracef("Not enough to read (not array): %s", values);
return undefined;
}
| javascript | {
"resource": ""
} | |
q54569 | train | function(values) {
if (values.length < 2) {
logger.tracef("Not enough to read (not array): %s", values);
return | javascript | {
"resource": ""
} | |
q54570 | toHex | train | function toHex(bignum) {
var tmp0 = bignum[0] < 0 ? (bignum[0]>>>0) : bignum[0];
| javascript | {
"resource": ""
} |
q54571 | waitIdleTimeExpire | train | function waitIdleTimeExpire(key, timeout) {
return function(client) {
var contains = true;
t.sleepFor(200); // sleep required
waitsFor(function() {
client.containsKey(key).then(function(success) {
contains | javascript | {
"resource": ""
} |
q54572 | validSemverTag | train | function validSemverTag(list, tag) {
if (semver.valid(tag)) {
| javascript | {
"resource": ""
} |
q54573 | release | train | function release(type) {
target.test();
echo("Generating new version");
const newVersion = execSilent("npm version " + type).trim();
target.changelog();
// add changelog to commit
exec("git add CHANGELOG.md");
exec("git commit --amend --no-edit");
// replace existing tag
exec("gi... | javascript | {
"resource": ""
} |
q54574 | reportPath | train | function reportPath(node) {
const moduleName = node.value.trim();
const customMessage = restrictedPathMessages[moduleName];
const message = customMessage
? CUSTOM_MESSAGE_TEMPLATE
: DEFAULT_MESSAGE_TEMPLATE;
| javascript | {
"resource": ""
} |
q54575 | isStringLiteralArray | train | function isStringLiteralArray(node) {
return isArrayExpr(node) && | javascript | {
"resource": ""
} |
q54576 | hasParams | train | function hasParams(node) {
return isObject(node) &&
| javascript | {
"resource": ""
} |
q54577 | hasCallback | train | function hasCallback(node) {
return isObject(node) &&
isArray(node.arguments) &&
| javascript | {
"resource": ""
} |
q54578 | ancestor | train | function ancestor(predicate, node) {
while ((node = node.parent)) {
| javascript | {
"resource": ""
} |
q54579 | nearest | train | function nearest(predicate, node) {
while ((node = node.parent)) {
| javascript | {
"resource": ""
} |
q54580 | throttle | train | function throttle(fn) {
var called = false;
var throttled = false;
var timeout = 10000;
function unthrottled() {
throttled = false;
maybeCall();
}
function maybeCall() {
if (called && !throttled) {
called | javascript | {
"resource": ""
} |
q54581 | train | function (node, key) {
'use strict';
var i, k;
if (node.key === key) {
return node;
} else {
for (i = 0; i < node.children.length; i += 1) {
| javascript | {
"resource": ""
} | |
q54582 | irishPub | train | function irishPub(root) {
root = root || process.cwd();
var out = new PassThrough();
getMetadata(root, function(err, | javascript | {
"resource": ""
} |
q54583 | focusWithTimeout | train | function focusWithTimeout(props, el, timeout = 0) {
setTimeout(() => {
if (props.stopScroll) {
el.focus({ preventScroll: true });
} else {
const x | javascript | {
"resource": ""
} |
q54584 | train | function (target) {
var elem = $(target);
var maxValue = 0;
var position, value;
while (elem.length && elem[0] !== document) {
position = elem.css("position");
if (position === "absolute" || position === | javascript | {
"resource": ""
} | |
q54585 | train | function(type, pattern, data) {
if (type == 'tag') { // case-insensitive match on tag name
return pattern && pattern.toLowerCase() | javascript | {
"resource": ""
} | |
q54586 | convertBinaryToBase36 | train | function convertBinaryToBase36(binary)
{
var result = '';
for (var i = 0; i < 25; i++)
{
var c;
if (typeof binary == 'string')
{
c = binary.charCodeAt(i) % 36;
}
else
{
c = binary[i] % 36;
}
if (c < 10)
{
| javascript | {
"resource": ""
} |
q54587 | Mark | train | function Mark(typeName, props, contents) {
// handle special shorthand
if (arguments.length === 1 && (typeName[0] === '{' || typeName[0] === '[' || ws.indexOf(typeName[0]) >= 0)) {
return MARK.parse(typeName);
}
// 1. prepare the constructor
if (typeof typeName !== 'string') {
if (this instanceof M... | javascript | {
"resource": ""
} |
q54588 | isNameChar | train | function isNameChar(c) {
return ('a' <= c && c <= 'z') || ('A' <= c | javascript | {
"resource": ""
} |
q54589 | resolveRequest | train | function resolveRequest({ requestKey, res, err }) {
const handlers = requests[requestKey] || [];
handlers.forEach(handler => {
if (res) {
handler.resolve(res);
} else {
handler.reject(err);
}
});
// This list of | javascript | {
"resource": ""
} |
q54590 | byName | train | function byName(a, b) {
if (a === INDEX_FILE) {
return a === b ? 0 : -1;
}
if (b === INDEX_FILE) {
return 1;
| javascript | {
"resource": ""
} |
q54591 | log | train | function log() {
if (typeof print === 'function') {
print.apply(this, arguments)
} else {
| javascript | {
"resource": ""
} |
q54592 | buildCSS | train | function buildCSS(src, filename, dest, applyHeader) {
dest = dest || config.dist.cssPath;
applyHeader = applyHeader || false;
return gulp.src(src)
.pipe(sass({
includePaths: [config.src.scssPath, config.packagesPath]
})
.on('error', sass.logError))
.pipe(cleanCSS())
.pipe(autoprefixer... | javascript | {
"resource": ""
} |
q54593 | buildJS | train | function buildJS(src, filename, dest, applyHeader, forceIncludePaths) {
dest = dest || config.dist.jsPath;
applyHeader = applyHeader || false;
forceIncludePaths = forceIncludePaths || false;
return gulp.src(src)
.pipe(gulpif(
forceIncludePaths,
include({
includePaths: [
path.d... | javascript | {
"resource": ""
} |
q54594 | buildDocsIndex | train | function buildDocsIndex(dataPath, indexPath, done) {
dataPath = dataPath || `${config.docsLocalPath}/search-data.json`;
indexPath = indexPath || `${config.docsLocalPath}/search-index.json`;
const documents = JSON.parse(fs.readFileSync(dataPath));
| javascript | {
"resource": ""
} |
q54595 | fastCheck | train | function fastCheck() {
for (var i = watchArray.length - 1; i >= 0; i--) {
if (!watchArray[i].inited) continue;
var deltaTop = Math.abs(getDocOffsetTop(watchArray[i].clone) - watchArray[i].docOffsetTop),
| javascript | {
"resource": ""
} |
q54596 | train | function($container) {
var styles = window.getComputedStyle($container, null);
var position = styles.getPropertyValue("position");
var overflow = styles.getPropertyValue("overflow");
var display = styles.getPropertyValue("display");
if (!position || position === "static") {
$container.style.p... | javascript | {
"resource": ""
} | |
q54597 | train | function(axis, $media, objectPosition) {
var position, other, start, end, side;
objectPosition = objectPosition.split(" ");
if (objectPosition.length < 2) {
objectPosition[1] = objectPosition[0];
}
if (axis === "x") {
position = objectPosition[0];
other = objectPosition[1];
... | javascript | {
"resource": ""
} | |
q54598 | train | function($media) {
// Fallbacks, IE 10- data
var fit = ($media.dataset) ? $media.dataset.objectFit : $media.getAttribute("data-object-fit");
var position = ($media.dataset) ? $media.dataset.objectPosition : $media.getAttribute("data-object-position");
fit = fit || "cover";
position = position || "50... | javascript | {
"resource": ""
} | |
q54599 | fastHash | train | function fastHash(str) {
let hash = 5381;
for (let j = str.length - | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.