_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q11100 | train | function(selector, all) {
if (!this.querySelector) {bb.warn('Find should be used with DOM elements'); return;}
return all && | javascript | {
"resource": ""
} | |
q11101 | train | function(html, tag) {
var el = document.createElement(tag || 'div');
| javascript | {
"resource": ""
} | |
q11102 | Paginator | train | function Paginator(options) {
debug('initializing from <%s>', __filename);
this.options = options || {};
this.footer = this.options.footer;
if (typeof this.footer !== 'string') {
this.footer = '(Move up and down | javascript | {
"resource": ""
} |
q11103 | getBinPath | train | function getBinPath(cmd, fn) {
which(cmd, function(err, bin) {
if (err) {
return fn(err);
}
fs.exists(bin, function(exists) {
| javascript | {
"resource": ""
} |
q11104 | run | train | function run(cmd, args, opts, fn) {
if (typeof opts === 'function') {
fn = opts;
opts = {};
}
if (typeof args === 'function') {
fn = args;
args = [];
opts = {};
}
getBinPath(cmd, function(err, bin) {
if (err) {
return fn(err);
}
debug('running', {
cmd: cmd,
... | javascript | {
"resource": ""
} |
q11105 | bootstrap | train | function bootstrap(options, cb) {
var adapters = options.adapters || {};
var connections = options.connections || {};
var collections = options.collections || {};
Object.keys(adapters).forEach(function(identity) {
var def = adapters[identity];
// Make sure our adapter defs have `identity` properties
def.... | javascript | {
"resource": ""
} |
q11106 | train | function (name) {
return {
name: name,
component: {
render: function render(h) {
return h('div');
},
| javascript | {
"resource": ""
} | |
q11107 | normalizeModules | train | function normalizeModules(modules) {
var normalized = {};
Object.keys(modules).forEach(function (key) {
var module = modules[key];
// make sure each vuex module has all keys defined
normalized[key] = {
actions: module.actions || {},
getters: module.getters || {}... | javascript | {
"resource": ""
} |
q11108 | findModule | train | function findModule(store, namespace) {
return namespace.split('/').reduce(function (obj, key) {
// root modules will exist directly on the store
if (obj && obj[key]) {
return obj[key];
}
| javascript | {
"resource": ""
} |
q11109 | patchView | train | function patchView (ExpressView, opts) {
var proto = ExpressView.prototype;
function View (name, options) {
options = options || {};
this.name = name;
this.root = options.root;
var engines = options.engines;
this.defaultEngine = options.defaultEngine;
var extensio... | javascript | {
"resource": ""
} |
q11110 | ValidationExtension | train | function ValidationExtension() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$reject = _ref.reject,
reject = _ref$reject === undefined ? false : _ref$reject;
_classCallCheck(this, ValidationExtension);
// Store configuration
var _this = _possi... | javascript | {
"resource": ""
} |
q11111 | validateProperties | train | function validateProperties(entity, properties, changedPropertyName, changedPropertyValue, currentPropertyValue) {
var _this2 = this;
// Validate default property values
_lodash2.default.forEach(properties, function (propertyConfiguration, propertyName) {
if (isValidationProperty(propertyConfiguration)) {
... | javascript | {
"resource": ""
} |
q11112 | resolve | train | function resolve(opts, done) {
debug('resolving paths for globs:\n', JSON.stringify(opts.globs));
var tasks = opts.globs.map(function(pattern) {
return function(cb) {
debug('resolving `%s`...', pattern);
glob(pattern, {}, function(err, files) {
if (err) {
return cb(err);
}
... | javascript | {
"resource": ""
} |
q11113 | getPropertyNamesInParentObjectExpression | train | function getPropertyNamesInParentObjectExpression(node) {
var objectExpression = obj.get(node, "parent.parent");
var ret = []; | javascript | {
"resource": ""
} |
q11114 | toServer | train | function toServer (router) {
assert.equal(typeof router, 'function')
const syms = getOwnSymbols(router)
const sym = syms.length ? syms[0] : router._sym
assert.ok(sym, 'router should be an instance of wayfarer')
emit._subrouters = router._subrouters
emit._routes = router._routes
emit[sym] = true
emit.e... | javascript | {
"resource": ""
} |
q11115 | train | function(location, name) {
this.location = location;
this.name = name;
if (this.isUrl(location)) {
if (this.name)
this.name = require('sanitize-filename')(this.name, {replacement: '_'});
if (typeof window === 'undefined')
this.request = require('request').defaults({headers: {'User... | javascript | {
"resource": ""
} | |
q11116 | train | function(opts, argv, error)
{
var parser = new Parser(opts, argv, | javascript | {
"resource": ""
} | |
q11117 | PowerRadix | train | function PowerRadix (digits, sourceRadix) {
sourceRadix = Array.isArray(sourceRadix) ? sourceRadix : B62.slice(0, sourceRadix);
this._digits = Array.isArray(digits) ? digits : (digits+'').split('');
this._sourceRadixLength = new | javascript | {
"resource": ""
} |
q11118 | makeError | train | function makeError(code, message, data = {}) {
const error = new Error(message); | javascript | {
"resource": ""
} |
q11119 | getIssuerModule | train | function getIssuerModule(parent) {
let issuer = parent;
while (issuer && (issuer.id | javascript | {
"resource": ""
} |
q11120 | applyNodeExtensionResolution | train | function applyNodeExtensionResolution(unqualifiedPath, {extensions}) {
// We use this "infinite while" so that we can restart the process as long as we hit package folders
while (true) {
let stat;
try {
stat = statSync(unqualifiedPath);
} catch (error) {}
// If the file exists and is a file,... | javascript | {
"resource": ""
} |
q11121 | normalizePath | train | function normalizePath(fsPath) {
fsPath = path.normalize(fsPath);
if (process.platform === 'win32') {
fsPath = | javascript | {
"resource": ""
} |
q11122 | cleanupArray | train | function cleanupArray(obj, name) {
var arr = obj[name];
if (!arr) throw new Error(name + ' option is missing');
if (Array.isArray(arr)) {
arr = arr.join(',');
}
if (typeof arr !== 'string') throw new | javascript | {
"resource": ""
} |
q11123 | matchLocale | train | function matchLocale(locale) {
var found = false;
if (!locale) return false;
locale = locale.replace(/_/g, '-').toLowerCase();
if (localesLookup[locale]) return localesLookup[locale];
if (options.matchSubTags) {
while (~locale.indexOf('-')) {
var index = locale.lastIndexOf('-');
... | javascript | {
"resource": ""
} |
q11124 | BindableCollection | train | function BindableCollection (source) {
BindableObject.call(this, this);
this.source = source || [];
this._updateInfo(); | javascript | {
"resource": ""
} |
q11125 | train | function () {
var items = Array.prototype.slice.call(arguments);
this.source.push.apply(this.source, items);
this._updateInfo();
// DEPRECATED
this.emit("insert", items[0], | javascript | {
"resource": ""
} | |
q11126 | train | function () {
var items = Array.prototype.slice.call(arguments);
this.source.unshift.apply(this.source, items); | javascript | {
"resource": ""
} | |
q11127 | train | function (index, count) {
var newItems = Array.prototype.slice.call(arguments, 2),
oldItems = this.source.splice.apply(this.source, arguments);
this._updateInfo();
// DEPRECATED
| javascript | {
"resource": ""
} | |
q11128 | train | function (item) {
var i = this.indexOf(item);
if (!~i) return false;
this.source.splice(i, 1);
this._updateInfo();
| javascript | {
"resource": ""
} | |
q11129 | paperLoadedInit | train | function paperLoadedInit() {
console.log('Paper ready!');
// Set center adjusters based on size of canvas
$('#hcenter').attr({
value: 0,
min: -(robopaint.canvas.width / 2),
max: robopaint.canvas.width / 2
});
$('#vcenter').attr({
value: 0,
min: -(robopaint.canvas.height / 2),
max: ro... | javascript | {
"resource": ""
} |
q11130 | fileAppender | train | function fileAppender(config, layout) {
const appender = new FileAppender(config, layout);
// push file to the | javascript | {
"resource": ""
} |
q11131 | train | function (widgets) {
if (!this.storage) {
return true;
}
var serialized = _.map(widgets, function (widget) {
var widgetObject = {
title: widget.title,
name: widget.name,
style: widget.style,
dataModelOptions:... | javascript | {
"resource": ""
} | |
q11132 | train | function () {
if (!this.storage) {
return null;
}
var serialized;
// try loading storage item
serialized = this.storage.getItem(this.id);
if (serialized) {
// check for promise
if (typeof serialized === 'object' && typeo... | javascript | {
"resource": ""
} | |
q11133 | WidgetModel | train | function WidgetModel(Class, overrides) {
var defaults = {
title: 'Widget',
name: Class.name,
attrs: Class.attrs,
dataAttrName: Class.dataAttrName,
dataModelType: Class.dataModelType,
dataModelArgs: Class.dataModelArgs, // used in data model constructor... | javascript | {
"resource": ""
} |
q11134 | train | function (e) {
var curX = e.clientX;
var pixelChange = curX - initX;
var newWidth = pixelWidth + pixelChange; | javascript | {
"resource": ""
} | |
q11135 | train | function (e) {
// remove listener and marquee
jQuery($window).off('mousemove', mousemove);
$marquee.remove();
// calculate change in units
var curX = e.clientX;
var pixelChange = curX - initX;
var unitChange = Math.round(pixelChange * transformMulti... | javascript | {
"resource": ""
} | |
q11136 | onMouseMove | train | function onMouseMove(event) {
project.deselectAll();
if (event.item) {
| javascript | {
"resource": ""
} |
q11137 | Stack | train | function Stack(trace, options) {
if (!(this instanceof Stack)) return new Stack(trace, options);
if ('object' === typeof trace && !trace.length) {
options = trace;
trace = null;
}
options = options || {};
options.guess = 'guess' in options ? options.guess : true;
if (!trace) {
var imp = new s... | javascript | {
"resource": ""
} |
q11138 | traceFromNode | train | function traceFromNode(name) {
const job = {
node: name,
isValid: true
};
invalidatePendingJobsForNode(pendingJobs, name);
// Ensure the job can be tracked
pendingJobs.push(job);
// Force an asynchronous start to the tracing so that other parts of a
// codebase can synchronous... | javascript | {
"resource": ""
} |
q11139 | pruneNode | train | function pruneNode(name) {
const previousState = state;
// If the node is still pending, invalidate the associated job so
// that it becomes a no-op
if (isNodePending(pendingJobs, name)) {
invalidatePendingJobsForNode(pendingJobs, name);
}
if (isNodeDefined(state, name)) {
let upda... | javascript | {
"resource": ""
} |
q11140 | pruneDisconnectedNodes | train | function pruneDisconnectedNodes() {
const previousState = state;
const disconnected = findNodesDisconnectedFromEntryNodes(state);
let updatedState = previousState;
disconnected.forEach(name => { | javascript | {
"resource": ""
} |
q11141 | setNodeAsEntry | train | function setNodeAsEntry(name) {
const previousState = state;
if (!isNodeDefined(state, name)) {
state = addNode(state, name);
}
| javascript | {
"resource": ""
} |
q11142 | processActionGroup | train | function processActionGroup(_ref2) {
var _ref2$updateSchemaNam = _ref2.updateSchemaName,
updateSchemaName = _ref2$updateSchemaNam === undefined ? undefined : _ref2$updateSchemaNam,
_ref2$store = _ref2.store,
store = _ref2$store === undefined ? _store : _ref2$store,
_ref2$error = _ref2.err... | javascript | {
"resource": ""
} |
q11143 | train | function(year) {
var date = this._validate(year, this.minMonth, this.minDay, $.calendars.local.invalidYear);
year = date.year();
var baktun = Math.floor(year / 400);
year = year % 400;
| javascript | {
"resource": ""
} | |
q11144 | train | function(years) {
years = years.split('.');
if (years.length < 3) {
throw 'Invalid Mayan year';
}
var year = 0;
for (var i = 0; i < years.length; i++) {
var y = parseInt(years[i], 10);
| javascript | {
"resource": ""
} | |
q11145 | train | function(year, month, day) {
var date = this._validate(year, month, day, $.calendars.local.invalidDate);
var jd = date.toJD();
var haab = this._toHaab(jd);
var tzolkin = this._toTzolkin(jd);
return {haabMonthName: this.local.haabMonths[haab[0] - 1],
haabMonth: haab[0], haabDay: | javascript | {
"resource": ""
} | |
q11146 | train | function(jd) {
jd -= this.jdEpoch;
var day = mod(jd + 8 + ((18 - 1) * 20), 365); | javascript | {
"resource": ""
} | |
q11147 | train | function ( source, dest )
{
var that = this;
if ( source.nodeName.toUpperCase() === "TR" || source.nodeName.toUpperCase() === "TH" ||
source.nodeName.toUpperCase() === "TD" || source.nodeName.toUpperCase() === "SPAN" )
{
dest.className = source.className;
| javascript | {
"resource": ""
} | |
q11148 | train | function ( parent, original, clone )
{
var that = this;
var originals = $(parent +' tr', original);
var height;
$(parent+' tr', clone).each( function (k) {
height = originals.eq( k ).css('height');
// This is nasty :-(. IE has a sub-pixel error even when setting
// the height below (the Firefox fix)... | javascript | {
"resource": ""
} | |
q11149 | getCollector | train | function getCollector() {
var collector = new Collector();
if (global['__coverage__']) {
collector.add(global['__coverage__']);
} else {
| javascript | {
"resource": ""
} |
q11150 | template | train | function template(string, options, otherOptions) {
// Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/)
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
const settings = templateSettings;
if (otherOptions && isIterateeCall(string, options, o... | javascript | {
"resource": ""
} |
q11151 | train | function(ctx, force, deep, collapsed){
// ctx.tree.debug("**** PROFILER nodeRender");
var s = this.options.prefix + "render '" + ctx.node + "'";
| javascript | {
"resource": ""
} | |
q11152 | createErrorType | train | function createErrorType(initialize = undefined, ErrorClass = undefined, prototype = undefined) {
ErrorClass = ErrorClass || Error;
let Constructor = function (message) {
let error = Object.create(Constructor.prototype);
error.message = message;
error.stack = (new Error).stack;
... | javascript | {
"resource": ""
} |
q11153 | train | function(target, namespace, graph) {
//if the first param is a string,
//we are including the namespace on Sysmo
if (typeof target == 'string') {
graph = namespace;
namespace = target;
target = Sysmo;
}
//create namespace on target
| javascript | {
"resource": ""
} | |
q11154 | train | function(namespace, target) {
target = target || {};
var names = namespace.split('.'),
context = target;
for (var i = 0; i < names.length; i++) {
var name = names[i];
| javascript | {
"resource": ""
} | |
q11155 | train | function (target, path, traverseArrays) {
// if traversing arrays is enabled and this is an array, loop
// may be a "array-like" node list (or similar), in which case it needs to be converted
if (traverseArrays && Sysmo.isArrayLike(target)) {
target = Sysmo.makeArray(target);
... | javascript | {
"resource": ""
} | |
q11156 | train | function () {
var href = window.location.href,
items = parsedItems(),
id, index;
// get window 'id'
if (href.indexOf('#') > -1) {
id = window.location.hash.replace('#', '');
} else {
id = window.location.pathname.split('/').pop().replace(/\.[^/.]+$/, '');
}
// In case the first menu item isn'... | javascript | {
"resource": ""
} | |
q11157 | sourceRootFn | train | function sourceRootFn (file) {
let sourcePath = file.history[0],
targetPath = path.join(__dirname, '../src/'),
relativePath | javascript | {
"resource": ""
} |
q11158 | DynamicPropertiesExtension | train | function DynamicPropertiesExtension() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$deferred = _ref.deferred,
deferred = _ref$deferred === undefined ? false : _ref$deferred;
_classCallCheck(this, DynamicPropertiesExtension);
return _possibleConst... | javascript | {
"resource": ""
} |
q11159 | readFileAsync | train | async function readFileAsync(...args) {
return new Promise((resolve, reject) => {
fs.readFile(...args, (err, result) => {
if (err) {
| javascript | {
"resource": ""
} |
q11160 | createLoggers | train | function createLoggers(ns) {
var debug = (0, _debug2['default'])(ns + ':debug');
debug.log = function () {
return console.log.apply(console, arguments);
};
var log = (0, _debug2['default'])(ns + ':log');
log.log = function () {
return console.log.apply(console, arguments);
};
var info = (0, _deb... | javascript | {
"resource": ""
} |
q11161 | BruteForceList | train | function BruteForceList(capacity) {
this.intervals = pool.mallocDouble(2 * capacity)
| javascript | {
"resource": ""
} |
q11162 | chaiSupportChainPromise | train | function chaiSupportChainPromise(chai, utils){
function copyChainPromise(promise, assertion){
let protoPromise = Object.getPrototypeOf(promise);
let protoNames = Object.getOwnPropertyNames(protoPromise);
let protoAssertion = Object.getPrototypeOf(assertion);
protoNames.forEach(functi... | javascript | {
"resource": ""
} |
q11163 | RemovePlugin | train | function RemovePlugin (ext_module_id) {
let copy = plugins[ext_module_id]
let runPreWorkflowFunctions = function () {
if (!plugins[ext_module_id].PreRemovePlugin) throw new Error('Error: PreRemovePlugin function must be implemented.')
plugins[ext_module_id].PreRemovePlugin()
}
let runPostWorkflowFunct... | javascript | {
"resource": ""
} |
q11164 | _InternalAddEnvironment | train | function _InternalAddEnvironment (env = new ent.Environment()) {
if (env instanceof ent.Environment) {
em.SetEnvironment(env)
return true
} else {
| javascript | {
"resource": ""
} |
q11165 | AddDetectorToSubEnvironmentOnly | train | function AddDetectorToSubEnvironmentOnly (detector, force = false, subEnvironment) {
| javascript | {
"resource": ""
} |
q11166 | RemoveNotifier | train | function RemoveNotifier (notifier, silent = false) {
let index = em.GetNotifiers().indexOf(notifier)
log.info('Removing Notifier...')
if (index > -1) {
if (!silent) {
em.GetNotifiers()[index].notify('Removing Notifier...')
}
| javascript | {
"resource": ""
} |
q11167 | RemoveDetector | train | function RemoveDetector (detector) {
let index = motionDetectors.indexOf(detector)
log.info('Removing Detector...')
if (index > -1) {
em.GetEnvironment().unbindDetector(detector)
motionDetectors.splice(index, 1)
// Redundant: Motion detectors are also copied to environment!
| javascript | {
"resource": ""
} |
q11168 | GetSubEnvironment | train | function GetSubEnvironment (subEnvironmentName) {
let e = GetSubEnvironments()[subEnvironmentName]
if (!e) {
throw new Error('SubEnvironment does not exist.')
}
if (!(e instanceof | javascript | {
"resource": ""
} |
q11169 | GetMotionDetector | train | function GetMotionDetector (name) {
// It's assumed the number of motion detectors will be sufficiently small to be ok to iterate without major loss of efficiency
console.log("Attention! this function GetMotionDetectors returns a singleton of motion detectors! If you are running several instances only one instance ... | javascript | {
"resource": ""
} |
q11170 | GetFilters | train | function GetFilters () {
let result = []
log.debug(`Fetching filters in the existing ${motionDetectors.length} detector(s)...`)
for (let i in motionDetectors) {
| javascript | {
"resource": ""
} |
q11171 | Reset | train | function Reset () {
log.info('Reseting environment...')
for (let m in motionDetectors) {
RemoveDetector(motionDetectors[m])
}
for (let n in em.GetNotifiers()) {
RemoveNotifier(em.GetNotifiers()[n], true)
}
em.SetNotifiers([])
if (em.GetEnvironment()) {
em.GetEnvironment().removeAllListeners('c... | javascript | {
"resource": ""
} |
q11172 | _StartPlugins | train | function _StartPlugins (e, m, n, f) {
log.info(`Checking if any plugin exists which should be started...`)
let plugins = pm.GetPlugins()
Object.keys(plugins).forEach(function (key) {
let p = plugins[key]
log.info(` Plugin found. Checking plugin signature methods ShouldStart and Start for plugin ${key}...... | javascript | {
"resource": ""
} |
q11173 | SaveAllToConfig | train | function SaveAllToConfig (src, callback, force = false) {
let status = 1
let message
let resultError = function (message) {
message = `Error: ${message}`
log.error(message)
callback(1, message)
}
let resultWarning = function (message) {
message = `Warn: ${message}`
log.warning(message)
... | javascript | {
"resource": ""
} |
q11174 | _InternalSerializeCurrentContext | train | function _InternalSerializeCurrentContext () {
let profile = { default: {} }
// Separate this function into another utils library.
let serializeEntity = function (ent) {
if (ent.constructor.name === 'Array') {
serializeArray()
} else {
profile.default[ent.constructor.name] = ent
}
}
... | javascript | {
"resource": ""
} |
q11175 | train | function (ent) {
if (ent.constructor.name === 'Array') {
serializeArray()
} else {
| javascript | {
"resource": ""
} | |
q11176 | train | function(onHover) {
return function(picker, calendar, inst) {
if ($.isFunction(onHover)) {
var target = this;
var renderer = inst.options.renderer;
picker.find(renderer.daySelector + ' a, ' + renderer.daySelector + ' span').
hover(function() {
| javascript | {
"resource": ""
} | |
q11177 | Store | train | function Store(context, app, data) {
const state = Object.assign({}, defaultState, data);
return {
dispatch(key, payload) {
const reducers = context.reducers[key];
/* istanbul ignore next */
if (!reducers) return;
for (let i = 0, len = reducers.length; i < len; i += 1) {
const ... | javascript | {
"resource": ""
} |
q11178 | error | train | function error(original, fileName) {
if (
original == null ||
original.location == null ||
original.location.start == null
) {
return original;
}
const start = original.location.start;
const lineNumber = start.line == null ? 1 : start.line;
const columnNumber = start.column == null ? 1 : st... | javascript | {
"resource": ""
} |
q11179 | astValue | train | function astValue(node) {
switch (node.type) {
case 'ExpressionStatement':
return astValue(node.expression);
case 'ObjectExpression':
return node.properties.reduce(
(obj, prop) => Object.assign(obj, {[prop.key.value]: astValue(prop.value)}),
{}
);
| javascript | {
"resource": ""
} |
q11180 | remove | train | function remove(file, options, done) {
if (arguments.length === 2 && 'function' === typeof options) {
done = options;
options = {};
}
if ('function' !== typeof done) {
done = function() {};
}
function callfile(file, stats, done) {
fs.unlink(file, done);
}
f... | javascript | {
"resource": ""
} |
q11181 | processFiles | train | function processFiles(bucket, key, transform, cb, currentFileNum=0, lastFileNum=0, arn=null, retries=0) {
const maxRetries = 5
var nextFileNum = (currentFileNum < lastFileNum) ? currentFileNum + 1 : null
//invokeLambda(bucket, key, currentFileNum, lastFileNum, arn)
processFile(
bucket, `${key}${currentFil... | javascript | {
"resource": ""
} |
q11182 | processFile | train | function processFile(bucket, key, transform) {
// get the csv file s3://${bucket}/${key}
console.log(`Processing s3://${bucket}/${key}`)
const s3 = | javascript | {
"resource": ""
} |
q11183 | invokeLambda | train | function invokeLambda(bucket, key, nextFileNum, lastFileNum, arn, retries) {
// figure out if there's a next file to process
if (nextFileNum && arn) {
const stepfunctions = new AWS.StepFunctions()
const params = {
stateMachineArn: arn,
input: JSON.stringify({ bucket, key, currentFile... | javascript | {
"resource": ""
} |
q11184 | connect | train | async function connect() {
let esConfig
let client
// use local client
if (!process.env.ES_HOST) {
client = new elasticsearch.Client({host: 'localhost:9200'})
} else {
await new Promise((resolve, reject) => AWS.config.getCredentials((err) => {
if (err) return reject(err)
resolve()
... | javascript | {
"resource": ""
} |
q11185 | _stringsByCharOrder | train | function _stringsByCharOrder(stringToMatch, givenString) {
const matchingIndexes = getMatchingStringIndexes(stringToMatch, givenString);
if (!matchingIndexes || !matchingIndexes.length) {
| javascript | {
"resource": ""
} |
q11186 | readlin | train | function readlin(options, start, end) {
return readline.createInterface({ | javascript | {
"resource": ""
} |
q11187 | train | function (options) {
var clientShell = this,
context = {},
// Default settings.
defaultSettings = {
namespace: 'shotgun',
debug: false
};
// Override default settings with supplied options.
var settings = clientShell.settings = extend(true, {}, defaultSettings... | javascript | {
"resource": ""
} | |
q11188 | 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 a1 = a[1]
out[1] = a[2]
out[2] = a1
} else {
| javascript | {
"resource": ""
} |
q11189 | _compile | train | function _compile(str, filename) {
var parent = this;
try {
var requires = detective(str);
} catch (ex) {
ex.toString = function() {
return filename + ':' + this.loc.line + '\n ' + ex.message;
}
throw ex;
}
requires.forEach(function(req) {
| javascript | {
"resource": ""
} |
q11190 | store | train | function store(hmap){
var _ = {
// data is a two dimensional array
// a datapoint gets saved as data[point-x-value][point-y-value]
// the value at [point-x-value][point-y-value] is the occurrence of the datapoint
data: [],
// t... | javascript | {
"resource": ""
} |
q11191 | train | function(x, y){
if(x < 0 || y < 0)
return;
var me = this,
heatmap = me.get("heatmap"),
data = me.get("data");
if(!data[x])
data[x] = [];
if(!data[x][y])
... | javascript | {
"resource": ""
} | |
q11192 | heatmap | train | function heatmap(config){
// private variables
var _ = {
radius : 40,
element : {},
canvas : {},
acanvas: {},
ctx : {},
actx : {},
legend: null,
visible : true,
... | javascript | {
"resource": ""
} |
q11193 | train | function(directoryName, cbUpload, cbError) {
this.directory = directoryName;
this.name | javascript | {
"resource": ""
} | |
q11194 | uServicesManager | train | function uServicesManager(){
client.publish('uServicesChannel', 'UPDATE');
listenClient.on('message', function(channel, message) {
client.get('uServices', function(err, reply) {
if (reply !== null) {
uServices = JSON.parse(reply);
| javascript | {
"resource": ""
} |
q11195 | throughWithCallback | train | function throughWithCallback(onData) {
return through.obj(function (chunk, enc, next) {
if (onData) {
| javascript | {
"resource": ""
} |
q11196 | waitObj | train | function waitObj(callback) {
var data = [];
return pipeline.obj(
through.obj(
function transform(chunk, enc, next) {
data.push(chunk);
next();
},
function Flush(next) { | javascript | {
"resource": ""
} |
q11197 | wait | train | function wait(callback) {
return pipeline.obj(
waitObj(),
through.obj(function (chunk, enc, next) {
next(null, Buffer.concat(chunk.map(function (item) {
| javascript | {
"resource": ""
} |
q11198 | shallowEqual | train | function shallowEqual(actual, expected) {
var keys = Object.keys(expected);
var _arr2 = keys;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var key = _arr2[_i2];
| javascript | {
"resource": ""
} |
q11199 | appendToMemberExpression | train | function appendToMemberExpression(member, append, computed) {
member.object = t.memberExpression(member.object, member.property, member.computed);
| javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.