_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q12500 | buildIncompleteRedeem | train | function buildIncompleteRedeem(network, txid, address, value) {
const bitcoinNetwork = bitcoin.networks[network];
// NB: storemen address validation requires that vout is 0
const vout = 0;
const txb = new bitcoin.TransactionBuilder(bitcoinNetwork); | javascript | {
"resource": ""
} |
q12501 | buildRedeemTx | train | function buildRedeemTx(network, txid, value, redeemScript, x, publicKey, signedSigHash, toAddress) {
const bitcoinNetwork = bitcoin.networks[network];
// if toAddress is not supplied, derive it from the publicKey
if (! toAddress) {
const { address } = bitcoin.payments.p2pkh({
network: bitcoinNetwork,
... | javascript | {
"resource": ""
} |
q12502 | solveLinearIntersect | train | function solveLinearIntersect(a,b, c, d,e, f) {
// ax + by = c;
// dx + ey = d;
console.log('WORKED: ', arguments);
if(a === 0) {
var y = c/b;
var x = (d-e*y)/x;
return [x, y];
}
var denom = e-d/a * b;
| javascript | {
"resource": ""
} |
q12503 | fromString | train | function fromString(str) {
const bytes = [];
for (let n = 0, l = str.length; n < l; n++) {
const hex | javascript | {
"resource": ""
} |
q12504 | isValidAtomicRule | train | function isValidAtomicRule(rule) {
const decls = rule.nodes.filter(node => node.type === "decl");
if (decls.length < 0) {
return { isValid: true };
}
for (let i = 1; i < decls.length; i++) {
const current = decls[i].prop;
const prev = decls[i - 1].prop;
if (current < prev) {
const loc = {... | javascript | {
"resource": ""
} |
q12505 | html | train | function html(obj, indents) {
indents = indents || 1;
function indent() {
return Array(indents).join(' ');
}
if ('string' == typeof obj) {
var str = escape(obj);
if (urlRegex().test(obj)) {
str = '<a href="' + str + '">' + str + '</a>';
}
return span('string value', '"' + str + '"')... | javascript | {
"resource": ""
} |
q12506 | train | function(sort) {
this._array = [];
this._sort = sort;
Object.defineProperty(this, 'length', {
enumerable: true,
get: function() { return this._array.length },
});
if | javascript | {
"resource": ""
} | |
q12507 | autoStartLine | train | function autoStartLine(name) {
var pre = new Array(Math.floor((60 - name.length) / 2) - 3).join('-');
var post = new Array(60 - pre.length - name.length).join('-');
| javascript | {
"resource": ""
} |
q12508 | makeBackup | train | function makeBackup(filePath) {
var dateString = new Date().toISOString().replace(/:/g, '.').replace('Z', '').replace('T', ' ');
try { fs.mkdirSync(path.join(path.dirname(filePath), 'BACKUP')); }
catch(err) { if (err.code != 'EEXIST') { throw err } } | javascript | {
"resource": ""
} |
q12509 | getPart | train | function getPart(name, fileContent, options) {
if (!name || !options) { throw new Error('name and options are required.'); }
var parts = fileContent.match(getRegularExpression(name));
if ( parts ) { // Aranan bölüm varsa
var fileContentDigest = calculateMD5(parts[3], options);
... | javascript | {
"resource": ""
} |
q12510 | fileExists | train | function fileExists(file) {
try {
var targetStat = fs.statSync(file);
if (targetStat.isDirectory() ) {
throw new Error("File exists but it's a driectory: " + file);
}
}
catch(err) {
if (err.code | javascript | {
"resource": ""
} |
q12511 | walk | train | function walk (newNode, oldNode) {
// if (DEBUG) {
// console.log(
// 'walk\nold\n %s\nnew\n %s',
// oldNode && oldNode.outerHTML,
// newNode && newNode.outerHTML
// )
// }
if (!oldNode) {
return newNode
} else if (!newNode) {
return null
} else if (newNode.isSameNode && newNode.is... | javascript | {
"resource": ""
} |
q12512 | Link | train | function Link (rel, value) {
if (!(this instanceof Link)) {
return new Link(rel, value);
}
if (!rel) throw new Error('Required <link> attribute "rel"');
this.rel = rel;
if (typeof value === 'object') {
// If value is a hashmap, just copy properties
if (!value.href) throw new Er... | javascript | {
"resource": ""
} |
q12513 | Resource | train | function Resource (object, uri) {
// new Resource(resource) === resource
if (object instanceof Resource) {
return object;
}
// Still work if "new" is omitted
if (!(this instanceof Resource)) {
return new Resource(object, uri);
}
// Initialize _links and _embedded properties
... | javascript | {
"resource": ""
} |
q12514 | resourceToJsonObject | train | function resourceToJsonObject (resource) {
var result = {};
for (var prop in resource) {
if (prop === '_links') {
if (Object.keys(resource._links).length > 0) {
// Note: we need to copy data to remove "rel" property without corrupting original Link object
result._links = Obje... | javascript | {
"resource": ""
} |
q12515 | resourceToXml | train | function resourceToXml (resource, rel, currentIndent, nextIndent) {
// Do not add line feeds if no indentation is asked
var LF = (currentIndent || nextIndent) ? '\n' : '';
// Resource tag
var xml = currentIndent + '<resource';
// Resource attributes: rel, href, name
if (rel) xml += ' rel="' + ... | javascript | {
"resource": ""
} |
q12516 | init | train | function init() {
// Retrieve any arguments passed in via the command line
args = cliConfig.getArguments();
// Supply usage info if help argument was passed
if (args.help) {
console.log(cliConfig.getUsage());
process.exit(0);
}
getClientAuth(function(data) {
parseClientAuth(data, function(err,... | javascript | {
"resource": ""
} |
q12517 | getClientAuth | train | function getClientAuth(callback) {
console.log("This script will create a section named '" + args.section + "'" +
"in the local file " + args.path + ".\n");
// Read the client authorization file. If not found, notify user.
if (args.file) {
clientAuthData = fs.readFileSync(args.file, 'utf8');
console.... | javascript | {
"resource": ""
} |
q12518 | parseClientAuth | train | function parseClientAuth(data, callback) {
authParser.parseAuth(data, function(err, data) {
if (err) | javascript | {
"resource": ""
} |
q12519 | writeEdgerc | train | function writeEdgerc(data, callback) {
try {
edgercWriter.writeEdgercSection(
args.path,
args.section,
| javascript | {
"resource": ""
} |
q12520 | groupBy | train | function groupBy(handlebars) {
var helpers = {
/**
* @method group
* @param {Array} list
* @param {Object} options
* @param {Object} options.hash
* @param {String} options.hash.by
* @return {String} Rendered partial.
*/
group: function (list, options) {
options = options || {};
var fn =... | javascript | {
"resource": ""
} |
q12521 | markDuplicateVariableNames | train | function markDuplicateVariableNames (row, i, rows) {
var ast = row[kAst]
var scope = scan.scope(ast)
if (scope) { | javascript | {
"resource": ""
} |
q12522 | detectCycles | train | function detectCycles (rows) {
var cyclicalModules = new Set()
var checked = new Set()
rows.forEach(function (module) {
var visited = []
check(module)
function check (row) {
var i = visited.indexOf(row)
if (i !== -1) {
checked.add(row)
for (; i < visited.length; i++) {
... | javascript | {
"resource": ""
} |
q12523 | createSectionObj | train | function createSectionObj(
host,
secret,
accessToken,
clientToken,
maxBody) {
var section = {};
section.client_secret = secret;
section.host = host;
| javascript | {
"resource": ""
} |
q12524 | VideoConverter | train | function VideoConverter(options) {
var _this = this;
this.name = function() {
return options.name;
};
this.extName = function () {
return options.ext;
};
/**
* Generate a stream from the video converter
* @param size
* @returns {*}
*/
this.toStream = f... | javascript | {
"resource": ""
} |
q12525 | initAsyncResource | train | function initAsyncResource(asyncId, type, triggerAsyncId, resource) {
if (wakingup) { | javascript | {
"resource": ""
} |
q12526 | getUrl | train | function getUrl(version = current) {
const name = `native-ext-v${version}-${os}-${arch}.${ext}`;
return | javascript | {
"resource": ""
} |
q12527 | train | function(satoshi) {
//validate arg
var satoshiType = typeof satoshi;
if (satoshiType === 'string') {
satoshi = toNumber(satoshi);
satoshiType = 'number';
}
if (satoshiType !== 'number'){
throw new TypeError('toBitcoin must be called on a number or string, got ' + satoshiType);
... | javascript | {
"resource": ""
} | |
q12528 | train | function(bitcoin) {
//validate arg
var bitcoinType = typeof bitcoin;
if (bitcoinType === 'string') {
bitcoin = toNumber(bitcoin);
bitcoinType = 'number'; | javascript | {
"resource": ""
} | |
q12529 | createArguments | train | function createArguments() {
var cli = commandLineArgs([{
name: 'file',
alias: 'f',
type: String,
defaultValue: "",
description: "Full path to the credentials file.",
required: true
}, {
name: 'section',
alias: 's',
type: String,
defaultValue: "default",
description: "Tit... | javascript | {
"resource": ""
} |
q12530 | Device | train | function Device(id, version, label, type, node_id, senders, receivers) {
this.id = this.generateID(id);
this.version = this.generateVersion(version);
this.label = this.generateLabel(label);
/**
* [Device type]{@link deviceTypes} URN.
* @type {string}
* @readonly
*/
this.type = this.generateType(ty... | javascript | {
"resource": ""
} |
q12531 | pack | train | function pack(payload_obj) {
var payload_plist = plist.build(payload_obj)
, payload_buf = new Buffer(payload_plist);
var header = {
len: payload_buf.length + 16,
version: 1,
request: 8,
tag: 1
};
var header_buf = new Buffer(16);
header_buf.fill(0);
header_buf.writ... | javascript | {
"resource": ""
} |
q12532 | UsbmuxdError | train | function UsbmuxdError(message, number) {
this.name = 'UsbmuxdError';
this.message = message;
if (number) {
this.number = number;
this.message += ', Err #' + number;
}
if (number === 2) this.message += ": | javascript | {
"resource": ""
} |
q12533 | createListener | train | function createListener() {
var conn = net.connect(address)
, req = protocol.listen;
/**
* Handle complete messages from usbmuxd
* @function
*/
var parse = protocol.makeParser(function onMsgComplete(msg) {
debug.listen('Response: \n%o', msg);
// first response always acknowledges / denies t... | javascript | {
"resource": ""
} |
q12534 | connect | train | function connect(deviceID, devicePort) {
return Q.Promise(function(resolve, reject) {
var conn = net.connect(address)
, req = protocol.connect(deviceID, devicePort);
/**
* Handle complete messages from usbmuxd
* @function
*/
var parse = protocol.makeParser(function onMsgComplete(msg)... | javascript | {
"resource": ""
} |
q12535 | Relay | train | function Relay(devicePort, relayPort, opts) {
if (!(this instanceof Relay)) return new Relay(arguments);
this._devicePort = | javascript | {
"resource": ""
} |
q12536 | initAngular | train | function initAngular(angular) {
// Define the layerXDKController
const controllers = angular.module('layerXDKControllers', []);
// Setup the properties for the given widget that is being generated
function setupProps(scope, elem, attrs, props) {
/*
* For each property we are going to do the followin... | javascript | {
"resource": ""
} |
q12537 | setupProps | train | function setupProps(scope, elem, attrs, props) {
/*
* For each property we are going to do the following:
*
* 1. See if there is an initial value
* 2. Evaluate it against the scope via scope.$eval() so we have a resolved value
* 3. $observe() for any changes in the property
* 4. $watc... | javascript | {
"resource": ""
} |
q12538 | setupDomNodes | train | function setupDomNodes() {
this.nodes = {};
this._findNodesWithin(this, (node, isComponent) => {
const layerId = node.getAttribute && node.getAttribute('layer-id');
if (layerId) this.nodes[layerId] = node;
| javascript | {
"resource": ""
} |
q12539 | _findNodesWithin | train | function _findNodesWithin(node, callback) {
const children = node.childNodes;
for (let i = 0; i < children.length; i++) {
const innerNode = children[i];
if (innerNode instanceof HTMLElement) {
const isLUIComponent = Boolean(ComponentsHash[innerNode.tagName.toLowerCase()]);
const resu... | javascript | {
"resource": ""
} |
q12540 | getTemplate | train | function getTemplate() {
const tagName = this.tagName.toLocaleLowerCase();
if (ComponentsHash[tagName].style) {
const styleNode = document.createElement('style');
styleNode.id = 'style-' + | javascript | {
"resource": ""
} |
q12541 | trigger | train | function trigger(eventName, details) {
const evt = new CustomEvent(eventName, {
detail: details,
bubbles: true,
cancelable: true,
| javascript | {
"resource": ""
} |
q12542 | toggleClass | train | function toggleClass(...args) {
const cssClass = args[0];
const enable = (args.length === 2) ? args[1] | javascript | {
"resource": ""
} |
q12543 | createElement | train | function createElement(tagName, properties) {
const node = document.createElement(tagName);
node.parentComponent = this;
const ignore = ['parentNode', 'name', 'classList', 'noCreate'];
Object.keys(properties).forEach((propName) => {
if (ignore.indexOf(propName) === -1) node[propName] = properties... | javascript | {
"resource": ""
} |
q12544 | destroy | train | function destroy() {
if (this.properties._internalState.onDestroyCalled) return;
if (this.parentNode) {
this.parentNode.removeChild(this);
}
Object.keys(this.nodes || {}).forEach((name) => {
| javascript | {
"resource": ""
} |
q12545 | _registerAll | train | function _registerAll() {
if (!registerAllCalled) {
registerAllCalled = true;
Object.keys(ComponentsHash)
.filter(tagName => typeof | javascript | {
"resource": ""
} |
q12546 | onRender | train | function onRender() {
try {
// Setup the layer-sender-name
if (this.nodes.sender) {
this.nodes.sender.innerHTML = this.item.sender.displayName;
}
if (this.nodes.avatar) {
this.nodes.avatar.users = [this.item.sender];
}
// Setup the layer-date
... | javascript | {
"resource": ""
} |
q12547 | Versionned | train | function Versionned(id, version, label) {
/**
* Globally unique UUID identifier for the resource.
* @type {string}
* @readonly
*/
this.id = this.generateID(id);
/**
* String formatted PTP timestamp (<<em>seconds</em>>:<<em>nanoseconds</em>>)
* indicating precisely when an attribute o... | javascript | {
"resource": ""
} |
q12548 | initClass | train | function initClass(newClass, className, namespace) {
// Make sure our new class has a name property
try {
if (newClass.name !== className) newClass.altName = className;
} catch (e) {
// No-op
}
// Make sure our new class has a _supportedEvents, _ignoredEvents, _inObjectIgnore and EVENTS properties
... | javascript | {
"resource": ""
} |
q12549 | Receiver | train | function Receiver(id, version, label, description,
format, caps, tags, device_id, transport, subscription) {
// Globally unique identifier for the Receiver
this.id = this.generateID(id);
// String formatted PTP timestamp (<seconds>:<nanoseconds>) indicating
// precisely when an attribute of the resource... | javascript | {
"resource": ""
} |
q12550 | registerResources | train | function registerResources(rs) {
registerPromise = registerPromise.then(() => {
return | javascript | {
"resource": ""
} |
q12551 | info | train | function info() {
if (argv.verbose !== 1) return;
var args = Array.prototype.slice.call(arguments); | javascript | {
"resource": ""
} |
q12552 | onErr | train | function onErr(err) {
// local port is in use
if (err.code === 'EADDRINUSE') {
panic('Local port is in use \nFailing...');
}
// usbmux not there
if (err.code === 'ECONNREFUSED' || err.code === 'EADDRNOTAVAIL') {
| javascript | {
"resource": ""
} |
q12553 | listenForDevices | train | function listenForDevices() {
console.log('Listening for connected devices... \n');
usbmux.createListener()
.on('error', onErr)
.on('attached', function(udid) {
console.log('Device found: ', udid); | javascript | {
"resource": ""
} |
q12554 | startRelay | train | function startRelay(portPair) {
var devicePort = portPair[0]
, relayPort = portPair[1];
console.log('Starting relay from local port: %s -> device port: %s',
relayPort, devicePort);
new usbmux.Relay(devicePort, relayPort, {udid: argv.udid})
.on('error', onErr)
.on('warning', console.log.bind(cons... | javascript | {
"resource": ""
} |
q12555 | Source | train | function Source(id, version, label, description,
format, caps, tags, device_id, parents) {
// Globally unique identifier for the Source
this.id = this.generateID(id);
// String formatted PTP timestamp (<seconds>:<nanoseconds>) indicating
// precisely when an attribute of the resource last changed
... | javascript | {
"resource": ""
} |
q12556 | validStore | train | function validStore(store) {
return store &&
typeof store.getNodes === 'function' &&
typeof store.getNode === 'function' &&
typeof store.getDevices === 'function' &&
typeof store.getDevice === 'function' &&
typeof store.getSources === 'function' &&
typeof store.getSource =... | javascript | {
"resource": ""
} |
q12557 | checkSkip | train | function checkSkip (skip, keys) {
if (skip && typeof skip === 'string') skip = +skip;
if (!skip || Number(skip) !== skip || skip % 1 !== 0 ||
skip | javascript | {
"resource": ""
} |
q12558 | checkLimit | train | function checkLimit (limit, keys) {
if (limit && typeof limit === 'string') limit = +limit;
if (!limit || Number(limit) !== limit || limit % 1 !== 0 ||
limit | javascript | {
"resource": ""
} |
q12559 | getCollection | train | function getCollection(items, query, cb, argsLength) {
var skip = 0, limit = Number.MAX_SAFE_INTEGER;
setImmediate(function() {
if (argsLength === 1) {
cb = query;
} else {
skip = (query.skip) ? query.skip : 0;
limit = (query.limit) ? query.limit : Number.MAX_SAFE_INTEGER;
}
var so... | javascript | {
"resource": ""
} |
q12560 | Node | train | function Node(id, version, label, href, hostname, caps, services) {
this.id = this.generateID(id);
this.version = this.generateVersion(version);
this.label = this.generateLabel(label);
/**
* HTTP access href for the Node's API.
* @type {string}
* @readonly
*/
this.href = this.generateHref(... | javascript | {
"resource": ""
} |
q12561 | Flow | train | function Flow(id, version, label, description, format,
tags, source_id, parents) {
this.id = this.generateID(id);
this.version = this.generateVersion(version);
this.label = this.generateLabel(label);
/**
* Detailed description of the Flow.
* @type {string}
* @readonly
*/
this.descrip... | javascript | {
"resource": ""
} |
q12562 | generateNames | train | function generateNames(model, prefix, name) {
if (name === void 0) { name = ""; }
model.fullPackageName = prefix + (name != "." ? name : "");
// Copies the settings (I'm lazy)
model.properties = argv.properties;
model.explicitRequired = argv.explicitRequired;
model.camelCaseProperties = argv.cam... | javascript | {
"resource": ""
} |
q12563 | _allocate | train | function _allocate(bytes) {
var address = Module._malloc(bytes.length);
| javascript | {
"resource": ""
} |
q12564 | doRun | train | function doRun() {
if (Module['calledRun']) return; // run may have just been called while the async setStatus time below was happening
Module['calledRun'] = true;
if (ABORT) return;
ensureInitRuntime();
| javascript | {
"resource": ""
} |
q12565 | wrapReplEval | train | function wrapReplEval(replServer) {
const defaultEval = replServer.eval;
return function(code, context, file, cb) {
return defaultEval.call(this, code, context, file, (err, result) => {
if (!result || !result.then) {
return cb(err, result);
}
result.then(resolved => {
resolve... | javascript | {
"resource": ""
} |
q12566 | getNextId | train | function getNextId(db, collectionName, fieldName, callback) {
if (typeof fieldName == "function") {
callback = fieldName;
fieldName = null;
}
fieldName = fieldName || getOption(collectionName, "field");
var collection = db.collection(defaultSettings.collection);
var step = getOption... | javascript | {
"resource": ""
} |
q12567 | mkNumber | train | function mkNumber(val) {
var sign = 1;
if (val.charAt(0) == '-') {
sign = -1;
val = val.substring(1);
}
if (Lang.NUMBER_DEC.test(val))
return sign * parseInt(val, 10);
else if (Lang.NUMBER_HEX.test(val))
... | javascript | {
"resource": ""
} |
q12568 | setOption | train | function setOption(options, name, value) {
if (typeof options[name] === 'undefined')
options[name] = value;
else {
if (!Array.isArray(options[name]))
| javascript | {
"resource": ""
} |
q12569 | train | function(builder, parent, name) {
/**
* Builder reference.
* @type {!ProtoBuf.Builder}
* @expose
*/
this.builder = builder;
/**
* Parent object.
* @type {?ProtoBuf.Reflect.T}
* @e... | javascript | {
"resource": ""
} | |
q12570 | train | function(builder, parent, name, options, syntax) {
T.call(this, builder, parent, name);
/**
* @override
*/
this.className = "Namespace";
/**
* Children inside the namespace.
* @type {!Array.<ProtoBuf.Reflect.... | javascript | {
"resource": ""
} | |
q12571 | train | function(type, resolvedType, isMapKey, syntax) {
/**
* Element type, as a string (e.g., int32).
* @type {{name: string, wireType: number}}
*/
this.type = type;
/**
* Element type reference to submessage or enum definition... | javascript | {
"resource": ""
} | |
q12572 | mkLong | train | function mkLong(value, unsigned) {
if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
&& value.low === value.low && value.high === value.high)
return new ProtoBuf.Long(value.low, value.high, typeof unsigned =... | javascript | {
"resource": ""
} |
q12573 | train | function(builder, parent, name, options, isGroup, syntax) {
Namespace.call(this, builder, parent, name, options, syntax);
/**
* @override
*/
this.className = "Message";
/**
* Extensions range.
* @type {!Array... | javascript | {
"resource": ""
} | |
q12574 | train | function(values, var_args) {
ProtoBuf.Builder.Message.call(this);
// Create virtual oneof properties
for (var i=0, k=oneofs.length; i<k; ++i)
this[oneofs[i].name] = null;
// Create fields and set default value... | javascript | {
"resource": ""
} | |
q12575 | cloneRaw | train | function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
if (obj === null || typeof obj !== 'object') {
// Convert enum values to their respective names
if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
... | javascript | {
"resource": ""
} |
q12576 | skipTillGroupEnd | train | function skipTillGroupEnd(expectedId, buf) {
var tag = buf.readVarint32(), // Throws on OOB
wireType = tag & 0x07,
id = tag >>> 3;
switch (wireType) {
case ProtoBuf.WIRE_TYPES.VARINT:
do tag = buf.readUint8();
... | javascript | {
"resource": ""
} |
q12577 | train | function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
T.call(this, builder, message, name);
/**
* @override
*/
this.className = "Message.Field";
/**
* Message field required flag.
... | javascript | {
"resource": ""
} | |
q12578 | train | function(builder, message, rule, type, name, id, options) {
Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
/**
* Extension reference.
| javascript | {
"resource": ""
} | |
q12579 | train | function(builder, parent, name, options, syntax) {
Namespace.call(this, builder, parent, name, options, syntax);
/**
* @override
| javascript | {
"resource": ""
} | |
q12580 | train | function(builder, enm, name, id) {
T.call(this, builder, enm, name);
/**
* @override
*/
this.className = "Enum.Value";
/**
| javascript | {
"resource": ""
} | |
q12581 | train | function(builder, root, name, options) {
Namespace.call(this, builder, root, name, options);
/**
* @override
*/
this.className = "Service";
/**
| javascript | {
"resource": ""
} | |
q12582 | train | function(rpcImpl) {
ProtoBuf.Builder.Service.call(this);
/**
* Service implementation.
* @name ProtoBuf.Builder.Service#rpcImpl
* @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Buil... | javascript | {
"resource": ""
} | |
q12583 | train | function(builder, svc, name, options) {
T.call(this, builder, svc, name);
/**
* @override
*/
this.className = "Service.Method";
/**
| javascript | {
"resource": ""
} | |
q12584 | train | function(builder, svc, name, request, response, request_stream, response_stream, options) {
Method.call(this, builder, svc, name, options);
/**
* @override
*/
this.className = "Service.RPCMethod";
/**
* Request message nam... | javascript | {
"resource": ""
} | |
q12585 | train | function(options) {
/**
* Namespace.
* @type {ProtoBuf.Reflect.Namespace}
* @expose
*/
this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
/**
* Namespace pointer.
* @type {Pro... | javascript | {
"resource": ""
} | |
q12586 | propagateSyntax | train | function propagateSyntax(parent) {
if (parent['messages']) {
parent['messages'].forEach(function(child) {
child["syntax"] = parent["syntax"];
propagateSyntax(child);
});
}
if (parent['enums']) {
| javascript | {
"resource": ""
} |
q12587 | train | function(field, contents) {
if (!field.map)
throw Error("field is not a map");
/**
* The field corresponding to this map.
* @type {!ProtoBuf.Reflect.Field}
*/
this.field = field;
/**
* Elemen... | javascript | {
"resource": ""
} | |
q12588 | getCompressedStream | train | function getCompressedStream(req, res) {
var encoding = req.headers['accept-encoding'] || '';
var stream;
var contentEncodingHeader = res.getHeader('Content-Encoding');
if ((contentEncodingHeader === 'gzip') || /\bgzip\b/.test(encoding)) {
if (!contentEncodingHeader) {
res.setHeader('Content-Encoding'... | javascript | {
"resource": ""
} |
q12589 | concatStreams | train | function concatStreams(array) {
var concat = new stream.PassThrough();
function pipe(i) {
if (i < array.length - 1) {
array[i].pipe(concat, {end: false});
array[i].on('end', function () { pipe(i + 1) });
| javascript | {
"resource": ""
} |
q12590 | augmentServer | train | function augmentServer(server, opts) {
server.templateReader = opts.templateReader || templateReader;
server.documentRoot = opts.documentRoot || p.join(process.cwd(), 'web');
server.saveRequestChunks = !!opts.saveRequestChunks;
server.template = template;
server.stack = [];
server.stackInsertion = 0;
| javascript | {
"resource": ""
} |
q12591 | listener | train | function listener(server, req, res) {
augmentReqRes(req, res, server);
var ask = new Ask(server, req, res); | javascript | {
"resource": ""
} |
q12592 | bubble | train | function bubble(ask, layer) {
ask.server.stack[layer](ask.req, ask.res, function next() {
if (ask.server.stack.length > layer + 1) bubble(ask, layer + 1);
else {
| javascript | {
"resource": ""
} |
q12593 | genericUnit | train | function genericUnit (server) {
var processors = [];
server.handler = function (f) { processors.push(f); };
return function genericLayer (req, res, next) { | javascript | {
"resource": ""
} |
q12594 | socketUnit | train | function socketUnit (server) {
var io = server.io;
// Client-side: <script src="/$socket.io/socket.io.js"></script>
return function socketLayer (req, res, next) {
// Socket.io doesn't care | javascript | {
"resource": ""
} |
q12595 | wsUnit | train | function wsUnit (server) {
var chanPool = server.wsChannels = {};
// Main WebSocket API:
// ws(channel :: String, conListener :: function(socket))
server.ws = function ws (channel, conListener) {
if (channel[0] !== '/') {
channel = '/$websocket:' + channel; // Deprecated API.
}
if (chanPool[c... | javascript | {
"resource": ""
} |
q12596 | ajaxUnit | train | function ajaxUnit (server) {
var ajax = server.ajax = new EventEmitter();
// Register events to be fired before loading the ajax data.
var ajaxReq = server.ajaxReq = new EventEmitter();
return function ajaxLayer (req, res, next) {
if (req.path[1] !== '$') { return next(); }
var action = req.path.slice(... | javascript | {
"resource": ""
} |
q12597 | staticUnit | train | function staticUnit (server) {
return function staticLayer | javascript | {
"resource": ""
} |
q12598 | routeUnit | train | function routeUnit (server) {
var regexes = [];
var callbacks = [];
function route (paths, literalCall) {
regexes.push(RegExp(paths));
callbacks.push(literalCall);
}
server.route = route;
return function routeLayer (req, res, next) {
var matched = null;
var cbindex = -1;
for (var i = ... | javascript | {
"resource": ""
} |
q12599 | removeJob | train | function removeJob(self,id) {
if(id === undefined) {
id = self.queue.shift().id ;
}
else {
// Search queue for id and remove if exists
for(var i=0;i<self.queue.length;i++) {
if(self.queue[i].id === id) {
self.queue.splice(i,1) ;
break ;
}
}
}
return new Promise(function(resolve,reject) {
i... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.