_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q41900 | train | function(schema, form) {
var asyncTemplates = [];
var merged = schemaForm.merge(schema, form, ignore, scope.options, undefined, asyncTemplates);
if (asyncTemplates.length > 0) {
// Pre load all async templates and put them on the form for the builder to use.
$q.all... | javascript | {
"resource": ""
} | |
q41901 | train | function(viewValue) {
//console.log('validate called', viewValue)
//Still might be undefined
if (!form) {
return viewValue;
}
// Omit TV4 validation
if (scope.options && scope.options.tv4Validation === false) {
return viewValue;
... | javascript | {
"resource": ""
} | |
q41902 | get_association_keys | train | function get_association_keys(collection) {
// Loop over the keys, filter irrelevant ones and fetch alias'
return Object.keys(collection._attributes || collection.attributes)
// We only care about attributes with model, collection or foreignKey properties.
.filter(key =>
collection._attributes[key].ha... | javascript | {
"resource": ""
} |
q41903 | get_associated_collections | train | function get_associated_collections(collection) {
const map = new Map()
get_association_keys(collection)
// Return the identity to the related resource.
.forEach(key => {
// Get the attributes
const collection_attributes = collection._attributes[key]
// Most of the time, it's a one to on... | javascript | {
"resource": ""
} |
q41904 | streamInjectLrScript | train | function streamInjectLrScript (opts) {
opts = opts || {}
assert.equal(typeof opts, 'object')
const protocol = opts.protocol || 'http'
const host = opts.host || 'localhost'
const port = opts.port || 35729
var lrTag = '<script type="text/javascript"'
lrTag += 'src="'
lrTag += protocol
lrTag += '://'
... | javascript | {
"resource": ""
} |
q41905 | isStream | train | function isStream(io) {
return typeof io === 'object' &&
(
// Readable stream.
(typeof io.pipe === 'function' && typeof io.readable === 'boolean' &&
io.readable) ||
// Writable stream.
(typeof io.write === 'function' && typeof io.writable === 'boolean' &&
io.writable)
);
... | javascript | {
"resource": ""
} |
q41906 | reportableIntervalURL | train | function reportableIntervalURL(sourceIds) {
var url = (baseURL() +'/range/interval?nodeId=' +nodeId);
if ( Array.isArray(sourceIds) ) {
url += '&sourceIds=' + sourceIds.map(function(e) { return encodeURIComponent(e); }).join(',');
}
return url;
} | javascript | {
"resource": ""
} |
q41907 | mixin | train | function mixin(dest, src) {
if (type(src) == 'function') {
extend(dest, src.prototype)
}
else {
extend(dest, src)
}
} | javascript | {
"resource": ""
} |
q41908 | inheritFrom | train | function inheritFrom(parentConstructor, childConstructor, prototypeProps, constructorProps) {
// Create a child constructor if one wasn't given
if (childConstructor == null) {
childConstructor = function() {
parentConstructor.apply(this, arguments)
}
}
// Make sure the new prototype has the corre... | javascript | {
"resource": ""
} |
q41909 | saveUserProfileInCache | train | function saveUserProfileInCache(userProfile) {
var old = userProfileCache.peek(userProfile.nick);
if (old && old.updatedAt > userProfile.updatedAt) {
return;
}
userProfileCache.set(userProfile.nick, userProfile);
} | javascript | {
"resource": ""
} |
q41910 | Bot | train | function Bot(credentials, globalObject, initializationCompleteCallback) {
LOG.info("Attempting to log in with email {}", credentials.username);
new DubAPI(credentials, (function(err, _bot) {
if (err) {
throw new Error("Error occurred when logging in: " + err);
}
this.bot = ... | javascript | {
"resource": ""
} |
q41911 | _createEventDispatcher | train | function _createEventDispatcher(internalEventName, translator, globalObject) {
return function(event) {
var handlers = this.eventHandlers[internalEventName];
if (!translator) {
LOG.error("Could not find a translator for internalEventName {}", internalEventName);
return;
... | javascript | {
"resource": ""
} |
q41912 | printResults | train | function printResults(results){
var output = "";
var dependenciesTimes = [];
var devDependenciesTimes = [];
dependenciesTimes = Object.keys(results.moduleTimes.dependencies).map(function(depen){
var val = results.moduleTimes.dependencies[depen];
return [
chalk.gray(depen),
... | javascript | {
"resource": ""
} |
q41913 | execute | train | function execute(args){
var options = optionator.parse(args);
if(options.help){
console.log(optionator.generateHelp());
}
else if(options.version){
console.log("v" + require("../package.json").version);
}
else{
printResults(loadPerf(options));
}
} | javascript | {
"resource": ""
} |
q41914 | grepLines | train | function grepLines(src, ext, destFile){
src = grunt.util.normalizelf(src);
var lines = src.split(grunt.util.linefeed),
dest = [],
//pattern for all comments containing denotation
denotationPattern = updatePattern({
pattern: options.pattern,
ext: ext,
... | javascript | {
"resource": ""
} |
q41915 | onResponse | train | function onResponse (res) {
endTime = getTimeMs(endTime)
res = Object.assign(res, { opDuration: endTime })
if (res.error) {
appendRes = res
} else {
log.info(
{
res: res,
duration: endTime
},
'end of the request'
)
... | javascript | {
"resource": ""
} |
q41916 | define | train | function define(style, string) {
var split = string.split(' ');
for (var i = 0; i < split.length; i++) {
words[split[i]] = style;
}
} | javascript | {
"resource": ""
} |
q41917 | Honey | train | function Honey(options) {
options = options || {};
assert.isString(options.apiKey, 'Honeybadger transport needs an "apiKey" config option');
this.name = 'honeybadger';
this.apiKey = options.apiKey;
if(!options.logger) {
options.logger = console;
}
this.remote = new Badger(options... | javascript | {
"resource": ""
} |
q41918 | parseInput | train | function parseInput(input) {
var match = re.exec(input);
if (match !== null) {
var _match = _slicedToArray(match, 6),
pre_keyword = _match[1],
operator_keyword = _match[2],
value = _match[3],
unit = _match[4],
post_keyword = _match[5];
if (pre_keyword && post_keywor... | javascript | {
"resource": ""
} |
q41919 | sanitizeValue | train | function sanitizeValue(_ref) {
var value = _ref.value,
operator_keyword = _ref.operator_keyword,
post_keyword = _ref.post_keyword;
return parseInt(value, 10) * getMultiplier({
operator_keyword: operator_keyword,
post_keyword: post_keyword
});
} | javascript | {
"resource": ""
} |
q41920 | getMultiplier | train | function getMultiplier(_ref2) {
var operator_keyword = _ref2.operator_keyword,
post_keyword = _ref2.post_keyword;
return operator_keyword === '-' || post_keyword === 'ago' ? -1 : 1;
} | javascript | {
"resource": ""
} |
q41921 | _default | train | function _default(input) {
var parsed_input = parseInput(input);
if (parsed_input !== null) {
var value = parsed_input.value,
unit = parsed_input.unit;
return relative_time_units[unit] * value;
}
return null;
} | javascript | {
"resource": ""
} |
q41922 | train | function (text, plugin) {
debug(`Job "${this.id}" comments:`, plugin || '<no plugin>', text);
this.status('command.comment', {
comment: text,
plugin: plugin,
time: new Date()
});
} | javascript | {
"resource": ""
} | |
q41923 | train | function (pluginName, env, path) {
var self = this;
var context = {
status: this.status.bind(this),
out: this.out.bind(this),
comment: function (text) {
self.comment(text, pluginName);
},
cmd: function (cmd, next) {
if (typeof(cmd) === 'string' || cmd.command) {
... | javascript | {
"resource": ""
} | |
q41924 | RunGruntTask | train | function RunGruntTask(taskname,absolutePath) {
var exec = require('child_process').exec;
var gruntarg = ' --gruntfile ';
var space = ' ';
if (os === 'Windows_NT') {
gruntPath = 'node_modules\\grunt-cli\\bin\\grunt' || absolutePath;
var ShellTask = gruntPath + space + gruntarg + gruntfil... | javascript | {
"resource": ""
} |
q41925 | fetch | train | function fetch(url, id) {
var req = http.request(url, function (res) {
res.pipe(terminus.concat(function (contents) {
tx.end(id, {type: "fetch", url: url, code: res.statusCode})
}))
})
req.end()
} | javascript | {
"resource": ""
} |
q41926 | Ask | train | function Ask(options) {
if (!(this instanceof Ask)) {
return new Ask(options);
}
this.options = options || {};
this.questions = utils.questions(this.options.questions);
var store = this.options.store;
var name = store && store.name;
if (!name) name = 'ask-once.' + utils.project(process.cwd());
th... | javascript | {
"resource": ""
} |
q41927 | basename | train | function basename(file){
var extname = path.extname(file);
return path.basename(file, extname);
} | javascript | {
"resource": ""
} |
q41928 | hexToRgb | train | function hexToRgb(hex) {
var match = hex.toString(16).match(/[a-f0-9]{6}/i);
if (!match) {
return {r: 0, g: 0, b: 0};
}
var integer = parseInt(match[0], 16);
var r = (integer >> 16) & 0xFF;
var g = (integer >> 8) & 0xFF;
var b = integer & 0xFF;
return {
r: r,
g: g,
b: b
};
} | javascript | {
"resource": ""
} |
q41929 | train | function (dir_path) {
return fs.statAsync(dir_path)
.call('isDirectory')
.then(function (isDirectory) {
if (isDirectory) {
return fs.readdirAsync(dir_path)
.map(function (file_name) {
var file_path = dir_path + '/' + file_name;
return fs.statAsync(file_path)
... | javascript | {
"resource": ""
} | |
q41930 | hasMany | train | function hasMany(config) {
var association;
association = {
type : 'HAS_MANY',
name : config.name || config,
cardinality : 'many',
targetModel : config.targetModel || config,
localProperty : config.localProperty || 'i... | javascript | {
"resource": ""
} |
q41931 | promptingHelper | train | function promptingHelper( generator, generator_prompts ) {
var prompts = filterPrompts( generator.options.PromptAnswers, generator_prompts );
return generator.prompt( prompts )
.then(
function ( answers ) {
addPromptAnswers( generator.options.PromptAnswers, answers );
}
);
} | javascript | {
"resource": ""
} |
q41932 | xfer | train | function xfer (res, files, cb) {
var file = files.shift();
if (!file) {
return cb(null);
}
fs.createReadStream(file
).on("data", function (chunk) {
res.write(chunk);
}).on("error", cb
).on("close", function xferClose () {
xfer(res, files, cb);
});
} | javascript | {
"resource": ""
} |
q41933 | train | function( editor, parentElement, definition, level ) {
definition.forceIFrame = 1;
// In case of editor with floating toolbar append panels that should float
// to the main UI element.
if ( definition.toolbarRelated && editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE )
parentElement = CKEDITOR.... | javascript | {
"resource": ""
} | |
q41934 | train | function() {
// Webkit requires to blur any previous focused page element, in
// order to properly fire the "focus" event.
if ( CKEDITOR.env.webkit ) {
var active = CKEDITOR.document.getActive();
active && !active.equals( this._.iframe ) && active.$.blur();
}
// Restore last focus... | javascript | {
"resource": ""
} | |
q41935 | train | function( panel, blockName, offsetParent, corner, offsetX, offsetY ) {
// Skip reshowing of child which is already visible.
if ( this._.activeChild == panel && panel._.panel._.offsetParentId == offsetParent.getId() )
return;
this.hideChild();
panel.onHide = CKEDITOR.tools.bind( function() ... | javascript | {
"resource": ""
} | |
q41936 | grabUrls | train | function grabUrls (opts) {
opts.shortcode.forEach(function (shortcode) {
instagrab.url(shortcode, opts.size, function (err, url) {
console.log(err || url)
})
})
} | javascript | {
"resource": ""
} |
q41937 | grabImages | train | function grabImages (opts) {
if (!opts.quiet) console.log(multiline(function () {/*
_ _| | |
| __ \ __| __| _` | _` | __| _` | __ \
| | | \__ \ | ( | ( | | ( | | |
___| _| _| ____/ \__| \__,_| \__,... | javascript | {
"resource": ""
} |
q41938 | createCopy | train | function createCopy(inPath, outPath) {
if (!inPath) {
throw new Error('Input path(s) argument is required');
}
if (!outPath) {
throw new Error('Output path argument is required');
}
return function copyFiles() {
return gulp.src(inPath).pipe(gulp.dest(outPath));
};
} | javascript | {
"resource": ""
} |
q41939 | logConfigFile | train | function logConfigFile(configFile, logger) {
let message;
if (process.env.WORKER_ID !== undefined) {
message = `Worker ${process.env.WORKER_ID} uses configuration file: ${configFile}`;
} else {
message = `Supervisor uses configuration file: ${configFile}`;
}
if (logger && logger.verbose) {
logger.... | javascript | {
"resource": ""
} |
q41940 | train | function() {
element.find('a, button').mousemove(function(e) {
if (buttonPickerEnabled) {
if (e.target !== buttonToPickElement) {
buttonToPickCounter = 0;
buttonToPickElement = e.target;
}
buttonToPickCounter += 1;
if (buttonToPickCounter > ... | javascript | {
"resource": ""
} | |
q41941 | train | function() {
var elem = $(this);
var data = window.kelmu.data[id];
data.selectedElementNumber = parseInt(elem.attr('data-annotation'), 10);
var elemData = data.definitions['step' + data.stepNumber][data.subStepNumber][data.selectedElementNumber];
if (elemData.rotate) {
elem.css('t... | javascript | {
"resource": ""
} | |
q41942 | train | function() {
var elem = $(this);
var data = window.kelmu.data[id];
data.selectedElementNumber = parseInt(elem.attr('data-annotation'), 10);
var elemData = data.definitions['step' + data.stepNumber][data.subStepNumber][data.selectedElementNumber];
elemData.top = parseFloat(elem.css('top'));... | javascript | {
"resource": ""
} | |
q41943 | train | function() {
container.find('.kelmu-annotation, .kelmu-button').mousedown(resetRotation);
container.find('.kelmu-annotation, .kelmu-button').mouseup(restoreRotation);
container.find('.kelmu-annotation, .kelmu-button').draggable({
start: function() {
var elem = $(this);
var... | javascript | {
"resource": ""
} | |
q41944 | train | function() {
container.find('.kelmu-annotation').resizable({
start: function() {
var elem = $(this);
var data = window.kelmu.data[id];
data.selectedElementNumber = parseInt(elem.attr('data-annotation'), 10);
if (elem.css('background-color') === 'transparent' || elem... | javascript | {
"resource": ""
} | |
q41945 | train | function(event) {
if (event.ctrlKey) {
return;
}
event.preventDefault();
var elem = $(this);
var data = window.kelmu.data[id];
data.selectedElementNumber = parseInt(elem.attr('data-annotation'), 10);
updateView(false, true);
} | javascript | {
"resource": ""
} | |
q41946 | train | function(text, container, name, value, type, noBr) {
var idNumber = idCounter;
if (!noBr) {
$('<br>').appendTo(container);
}
$('<label></label>').attr('for', animationId + '-' + name + '-' + idNumber).text(text).appendTo(container);
if (type === 'text') {
$('<input type="te... | javascript | {
"resource": ""
} | |
q41947 | train | function() {
// Remove the element
return $('<button></button>').text('Remove').addClass('btn').click(function(e) {
e.preventDefault();
var data = window.kelmu.data[id];
data.definitions['step' + data.stepNumber][data.subStepNumber].splice(window.kelmu.data[id].selectedElementNumber,... | javascript | {
"resource": ""
} | |
q41948 | train | function() {
var data = window.kelmu.data[id];
var elemData = data.definitions['step' + data.stepNumber][data.subStepNumber][data.selectedElementNumber];
editor.find('.kelmu-editor-pane').remove();
var actionEditor = $('<div></div>').addClass('kelmu-action-editor').addClass('kelmu-editor-pane... | javascript | {
"resource": ""
} | |
q41949 | train | function() {
var data = window.kelmu.data[id];
var elemData = data.definitions['step' + data.stepNumber][data.subStepNumber][data.selectedElementNumber];
editor.find('.kelmu-editor-pane').remove();
var arrowEditor = $('<div></div>').addClass('kelmu-arrow-editorr').addClass('kelmu-editor-pane'... | javascript | {
"resource": ""
} | |
q41950 | train | function() {
var data = window.kelmu.data[id];
var elemData = data.definitions['step' + data.stepNumber][data.subStepNumber][data.selectedElementNumber];
editor.find('.kelmu-editor-pane').remove();
var lineEditor = $('<div></div>').addClass('kelmu-line-editor').addClass('kelmu-editor-pane');
... | javascript | {
"resource": ""
} | |
q41951 | train | function() {
var data = window.kelmu.data[id];
var elemData = data.definitions['step' + data.stepNumber][data.subStepNumber][data.selectedElementNumber];
editor.find('.kelmu-editor-pane').remove();
var soundEditor = $('<div></div>').addClass('kelmu-sound-editor').addClass('kelmu-editor-pane')... | javascript | {
"resource": ""
} | |
q41952 | train | function($, $ln, contents) {
var ln = $ln[0]
, attrKeys = Object.keys(ln.attribs)
, $s = $('<style type="text/css"></style>')
, attrs = []
, ix;
for(ix = attrKeys.length; ix--;) {
$s.attr(attrKeys[ix], ln.attribs[attrKeys[ix]]);
}
// Save the origin href
// ...
$s.attr('data... | javascript | {
"resource": ""
} | |
q41953 | train | function() {
// Let's fade out the splash screen div...
$('.splash').fadeOut('slow', function() {
// ...stop the pulsing effect...
$('.splash .circle').stop().css({
opacity : 1
});
// and fade in the content div.
$('.content').... | javascript | {
"resource": ""
} | |
q41954 | getFormDataForPost | train | function getFormDataForPost(fields, files) {
function encodeFieldPart(boundary, name, value) {
var return_part = "--" + boundary + "\r\n";
return_part += "Content-Disposition: form-data; name=\"" + name + "\"\r\n\r\n";
return_part += value + "\r\n";
return return_part;
}
fun... | javascript | {
"resource": ""
} |
q41955 | postData | train | function postData(fields, files, options, headers, callback) {
var headerparams = getFormDataForPost(fields, files);
var totalheaders = headerparams.headers;
for (var key in headers) totalheaders[key] = headers[key];
var post_options = {
host: options.host,
port: options.port,
p... | javascript | {
"resource": ""
} |
q41956 | postImage | train | function postImage(options, filename, headers, cb) {
Step(
function readImage() {
fs.readFile(filename, this);
},
function(err, filecontents) {
if (err) {
console.log('Unable to read file', __dirname);
return;
}
... | javascript | {
"resource": ""
} |
q41957 | Nonce | train | function Nonce(cache, ttl) {
this.cache = cache;
this.ttl = ttl;
if (this.ttl && this.ttl > TTLMAX) {
this.ttl = TTLMAX;
}
} | javascript | {
"resource": ""
} |
q41958 | createCoincap | train | function createCoincap () {
const socket = io(baseUrl, { autoConnect: false })
const api = {}
// Add JSON API supported endpoints
;[
{
method: 'coins',
url: () => '/coins'
},
{
method: 'map',
url: () => '/map'
},
{
method: 'front',
url: () => '/front'
... | javascript | {
"resource": ""
} |
q41959 | logInfo | train | function logInfo () {
console.log(`Running on node ${process.version} with ${os.cpus()[0].model} x ${os.cpus().length}`);
console.log('');
console.log('Testing:');
var columns = columnsCreate(['name', 'version', 'homepage']);
var infoStatic = require('serve-static/package.json');
infoStatic.version = 'v' + info... | javascript | {
"resource": ""
} |
q41960 | fakeTask | train | function fakeTask () {
return callback => server.get(filename, (err, res) => callback(err, res));
} | javascript | {
"resource": ""
} |
q41961 | send | train | function send(statusCode, body) {
if (body) {
body = JSON.stringify(body);
}
return {
statusCode,
body
};
} | javascript | {
"resource": ""
} |
q41962 | train | function(src,dest, isfile){
//console.log('test');
if (isfile){
grunt.file.copy(src,dest+'/'+src,{});
console.log('File has been created as '+dest+'/'+src);
return;
}
... | javascript | {
"resource": ""
} | |
q41963 | tail | train | function tail (argv, callback) {
if (!argv[2]) {
console.error('url is required')
console.error('Usage : tail <url>')
process.exit(-1)
}
var uri = argv[2]
var wss = 'wss://' + uri.split('/')[2] + '/'
var s = new ws(wss, {
origin: 'http://websocket.org'
})
s.on('open', function open () {
... | javascript | {
"resource": ""
} |
q41964 | radicalInverse_VdC | train | function radicalInverse_VdC(i) {
bits[0] = i;
bits[0] = ((bits[0] << 16) | (bits[0] >> 16))>>>0;
bits[0] = ((bits[0] & 0x55555555) << 1) | ((bits[0] & 0xAAAAAAAA) >>> 1) >>>0;
bits[0] = ((bits[0] & 0x33333333) << 2) | ((bits[0] & 0xCCCCCCCC) >>> 2) >>>0;
bits[0] = ((bits[0] & 0x0F0F0F0F) << 4) | ((b... | javascript | {
"resource": ""
} |
q41965 | genEnvOptions | train | function genEnvOptions(commitMsg) {
return {
pluginName : globalOpts.pluginName,
pluginDesc : globalOpts.pluginDesc,
pkgPath : 'package.json',
pkgPathBower : 'bower.json',
pkgPropSync : [ 'name', 'version', 'repository' ],
gitCliSubstitute : '',
buildDir : process.env.TRAVIS_BUILD_DIR || process.cwd(),
... | javascript | {
"resource": ""
} |
q41966 | genTaskOptions | train | function genTaskOptions(env) {
var mp = env.pluginName + ': ';
return {
name : '<%= commit.versionTag %>',
pkgCurrVerBumpMsg : mp
+ 'Updating <%= env.pkgPath %> version to match release version <%= commit.version %> <%= commit.skipTaskGen(options.releaseSkipTasks) %>',
pkgNextVerBumpMsg : mp
+ 'Bumping ... | javascript | {
"resource": ""
} |
q41967 | getLineReplRegExp | train | function getLineReplRegExp(rxa, tasks) {
var r = '', sf = null;
function rxItem(o, i, a) {
var s = util.isRegExp(o) ? o.source : escapeRegExp(o);
if (s) {
r += (sf ? sf(true, s) : '(?:' + s + ')') + (i < (a.length - 1) ? '|' : '');
}
}
if (Array.isArray(rxa) && rxa.length) {
rxa.forEach(rxItem);
// joi... | javascript | {
"resource": ""
} |
q41968 | applyExtensions | train | function applyExtensions(hoodie) {
for (var i = 0; i < extensions.length; i++) {
extensions[i](hoodie);
}
} | javascript | {
"resource": ""
} |
q41969 | WriteArray | train | function WriteArray (options, callback) {
var self = this
if (!(this instanceof WriteArray)) {
return new WriteArray(options, callback)
}
if (typeof options === 'function') {
callback = options
options = {}
}
options = Object.assign({}, options)
Writable.call(self, options)
self.array = ... | javascript | {
"resource": ""
} |
q41970 | getGameAfterMoves | train | function getGameAfterMoves(game, moves) {
return moves.reduce(function (lastGame, move) {
return getGameAfterMove(lastGame, move);
}, game);
} | javascript | {
"resource": ""
} |
q41971 | sortFontSizes | train | function sortFontSizes(fontSizes) {
var r = {};
var temp = [];
var size = 0;
var biggest = 0;
for (var prop in fontSizes) {
if (fontSizes.hasOwnProperty(prop)) {
size++;
var val = prop.replace(/[^0-9.\/]/g, '').replace(/\/[0-9]/g, ''... | javascript | {
"resource": ""
} |
q41972 | getValueCount | train | function getValueCount(values, property) {
var arr = {};
property = property ? property : '';
if (!values) {
grunt.log.writeln(app.chalkWarn('no ' + property + ' defined in your css'));
return arr;
}
values.forEach(function (v) {
v = v.repl... | javascript | {
"resource": ""
} |
q41973 | deindentBlocks | train | function deindentBlocks(input) {
var indent = detectIndent(input).indent
return input.replace(regex.blocks, function (match, start, body, end) {
return start + deindent(body, indent) + end
})
} | javascript | {
"resource": ""
} |
q41974 | train | function() {
var self = this;
var relations = utils.argToArr.call(arguments);
var func = function(s, e) {
if(!s)
return s;
var alls = [];
var doGet = function(entry) {
if (!entry.schema || !entry.schema.links)
return;
var r = {
value: entry.value,
schema: entry.sche... | javascript | {
"resource": ""
} | |
q41975 | train | function(map, delimitter) {
if (!delimitter)
delimitter = ".";
var self = this;
var relations = [];
for (var i in map)
relations.push(i);
//console.log("mapRelations : relations : ", relations);
var func = function(s, e) {
if(!s || (!s._deep_query_node_ && !s._deep_array_))
return s;... | javascript | {
"resource": ""
} | |
q41976 | create_header_col | train | function create_header_col(m) {
var $e = $$('hcol nowrap');
$e.css({width: p});
if (m.options) {
$e.css(m.options);
}
$e.text(m.name);
var hilight = function () {
if (!order)
return;
if (order == m.name)
{
$e.addClass('order asc');
$lh = $e;
... | javascript | {
"resource": ""
} |
q41977 | make_page | train | function make_page(i, total) {
var $p = $$('page', {el: 'span'});
if (i == page) {
$p.addClass('selected');
$lp = $p;
}
var top = Math.min(i*pagesize+pagesize, total);
$p.text((i*pagesize+1)+'-'+top);
$p.text(i+1);
$p.click(function () {
page = i;
zcookie.set('page-'+... | javascript | {
"resource": ""
} |
q41978 | train | function (object) {
object.id = object.id || this.generateId();
this.data.push(object);
this.mapValues[object.id] = {};
this.eachMap(function (map, mapName) {
this.addObjectToMap(mapName, object);
});
return this;
} | javascript | {
"resource": ""
} | |
q41979 | train | function (object) {
var index = this.data.indexOf(object);
if (index !== -1) {
this.data.splice(index, 1);
}
this.eachMap(function (map, mapName) {
this.removeObjectFromMap(mapName, object);
});
delete this.mapValues... | javascript | {
"resource": ""
} | |
q41980 | train | function (id, length) {
length = length || 8;
id = id || words.generate(length);
while (this.mapValues[id] !== undefined) {
id = words.generate(length);
length += 1;
}
return id.toString();
} | javascript | {
"resource": ""
} | |
q41981 | train | function (mapName, index) {
if (this.maps[mapName][index] === undefined) {
return [];
}
return this.maps[mapName][index].slice(); //slice() makes a copy of the array
} | javascript | {
"resource": ""
} | |
q41982 | train | function (callback) {
var mapName;
for (mapName in this.maps) {
if (this.maps.hasOwnProperty(mapName)) {
callback.call(this, this.maps[mapName], mapName);
}
}
} | javascript | {
"resource": ""
} | |
q41983 | train | function (callback) {
var i;
for (i = 0; i < this.data.length; i += 1) {
callback.call(this, this.data[i], i);
}
return this;
} | javascript | {
"resource": ""
} | |
q41984 | train | function (mapName, object) {
var mapFunction = this.mapFunctions[mapName],
index,
value,
emit = function (idx, val) {
index = idx;
value = val;
};
mapFunction.call(object, object, emit);
... | javascript | {
"resource": ""
} | |
q41985 | train | function (mapName, object) {
var mapValue = this.mapValues[object.id][mapName],
index = this.maps[mapName][mapValue].indexOf(object);
if (index !== -1) {
this.maps[mapName][mapValue].splice(index, 1);
}
return this;
} | javascript | {
"resource": ""
} | |
q41986 | AbstractAdapter | train | function AbstractAdapter(valueOrBuffer, pos) {
this.pos = pos != null ? pos : 0;
this.data = null;
if (Buffer.isBuffer(valueOrBuffer)) {
this.value = this.getValue(valueOrBuffer);
} else {
this.loadData(valueOrBuffer);
}
} | javascript | {
"resource": ""
} |
q41987 | train | function(authStore, session) {
var found = false;
for (var i = 0; i < authStore.length; i++) {
if (authStore[i].equal(session)) {
found = true;
break;
}
}
if (!found) authStore.push(session);
} | javascript | {
"resource": ""
} | |
q41988 | maxOrMin | train | function maxOrMin( args, method ) {
var m, n,
i = 0;
if ( isArray( args[0] ) ) args = args[0];
m = new BigNumber( args[0] );
for ( ; ++i < args.length; ) {
n = new BigNumber( args[i] );
// If any number is NaN, ... | javascript | {
"resource": ""
} |
q41989 | raise | train | function raise( caller, msg, val ) {
var error = new Error( [
'new BigNumber', // 0
'cmp', // 1
'config', // 2
'div', // 3
'divToInt', // 4
'eq', ... | javascript | {
"resource": ""
} |
q41990 | coeffToString | train | function coeffToString(a) {
var s, z,
i = 1,
j = a.length,
r = a[0] + '';
for ( ; i < j; ) {
s = a[i++] + '';
z = LOG_BASE - s.length;
for ( ; z--; s = '0' + s );
r += s;
}
// Determine tra... | javascript | {
"resource": ""
} |
q41991 | train | function() {
var secret;
if (!this.getSecret()) {
throw new CError('missing secret').log();
}
try {
secret = this.encoder.encryptRsa(this.getSecret());
} catch (e) {
throw new CError({
body: {
code: 'ImATeapot',
message: 'unable to ... | javascript | {
"resource": ""
} | |
q41992 | train | function(data) {
if (!data) {
data = this.getContent();
}
return this.encoder.encryptAes(JSON.stringify(data), this.getSecret());
} | javascript | {
"resource": ""
} | |
q41993 | train | function (options) {
this.options = $.extend(this.defaults, options);
this.$el = $.fn.mediumInsert.insert.$el;
this.setEmbedButtonEvents();
this.preparePreviousEmbeds();
} | javascript | {
"resource": ""
} | |
q41994 | Component | train | function Component(bowerObj, files) {
this.bowerObj = bowerObj;
this.files = files;
this.name = bowerObj['name'];
this.version = bowerObj['version'];
} | javascript | {
"resource": ""
} |
q41995 | MetricsService | train | function MetricsService(storageAccount, storageAccessKey, host, authenticationProvider) {
if (!host) {
// Dev Stg does not support metrics
host = azure.ServiceClient.CLOUD_TABLE_HOST;
}
MetricsService.super_.call(this, host, storageAccount, storageAccessKey, authenticationProvider);
if (!this.authenti... | javascript | {
"resource": ""
} |
q41996 | executeBatch | train | function executeBatch(bulkOperation, batch, options, callback) {
function resultHandler(err, result) {
// Error is a driver related error not a bulk op error, terminate
if (((err && err.driver) || (err && err.message)) && !(err instanceof MongoWriteConcernError)) {
return handleCallback(callback, err);
... | javascript | {
"resource": ""
} |
q41997 | executeBatches | train | function executeBatches(bulkOperation, options, callback) {
let numberOfCommandsToExecute = bulkOperation.s.batches.length;
// Execute over all the batches
for (let i = 0; i < bulkOperation.s.batches.length; i++) {
executeBatch(bulkOperation, bulkOperation.s.batches[i], options, function(err) {
// Count... | javascript | {
"resource": ""
} |
q41998 | triggerEvent | train | function triggerEvent(name, element) {
var eventType;
switch (name) {
case "click":
case "mousedown":
case "mouseup":
eventType = "MouseEvents";
break;
case "focus":
case "change":
case "blur":
case "select":
eventType = "HTMLEvents";
break;
default:
throw... | javascript | {
"resource": ""
} |
q41999 | isValid | train | function isValid(ch){
var code = ch.charCodeAt(0);
return is_letter(code)
|| is_digit(code)
|| (ch === '.')
|| (ch === '_')
|| is_unicode_connector_punctuation(ch)
|| is_unicode_format(ch)
|| is_unicode_combining_mark(ch)
|| is_unicode_digit(ch);
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.