repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
pagespace/pagespace | static/bower_components/angular-schema-form/dist/schema-form.js | 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 | 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... | [
"function",
"(",
"schema",
",",
"form",
")",
"{",
"var",
"asyncTemplates",
"=",
"[",
"]",
";",
"var",
"merged",
"=",
"schemaForm",
".",
"merge",
"(",
"schema",
",",
"form",
",",
"ignore",
",",
"scope",
".",
"options",
",",
"undefined",
",",
"asyncTempl... | Common renderer function, can either be triggered by a watch or by an event. | [
"Common",
"renderer",
"function",
"can",
"either",
"be",
"triggered",
"by",
"a",
"watch",
"or",
"by",
"an",
"event",
"."
] | 943c45ddd9aaa4f3136e1ba4c2593aa0289daf43 | https://github.com/pagespace/pagespace/blob/943c45ddd9aaa4f3136e1ba4c2593aa0289daf43/static/bower_components/angular-schema-form/dist/schema-form.js#L2580-L2599 | train | |
pagespace/pagespace | static/bower_components/angular-schema-form/dist/schema-form.js | 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 | 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;
... | [
"function",
"(",
"viewValue",
")",
"{",
"//console.log('validate called', viewValue)",
"//Still might be undefined",
"if",
"(",
"!",
"form",
")",
"{",
"return",
"viewValue",
";",
"}",
"// Omit TV4 validation",
"if",
"(",
"scope",
".",
"options",
"&&",
"scope",
".",
... | Validate against the schema. | [
"Validate",
"against",
"the",
"schema",
"."
] | 943c45ddd9aaa4f3136e1ba4c2593aa0289daf43 | https://github.com/pagespace/pagespace/blob/943c45ddd9aaa4f3136e1ba4c2593aa0289daf43/static/bower_components/angular-schema-form/dist/schema-form.js#L2749-L2785 | train | |
newworldcode/waterline-jsonapi | lib/utils.js | get_association_keys | 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 | 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... | [
"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 attrib... | Get the keys that are associations.
@param {Waterline.Collection} collection to get keys from.
@return {Array} Array of the keys that have model, collection or foreignKey properties. | [
"Get",
"the",
"keys",
"that",
"are",
"associations",
"."
] | 9e198cf0f80f1905354b101d2315f205b43f6dcd | https://github.com/newworldcode/waterline-jsonapi/blob/9e198cf0f80f1905354b101d2315f205b43f6dcd/lib/utils.js#L8-L20 | train |
newworldcode/waterline-jsonapi | lib/utils.js | get_associated_collections | 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 | 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... | [
"function",
"get_associated_collections",
"(",
"collection",
")",
"{",
"const",
"map",
"=",
"new",
"Map",
"(",
")",
"get_association_keys",
"(",
"collection",
")",
"// Return the identity to the related resource.",
".",
"forEach",
"(",
"key",
"=>",
"{",
"// Get the at... | Get the collections assigned to each association
within the collection.
@param {Waterline.Collection} collection to get associations from.
@return {Map} Map of the collections that have `model|collection` properties and their type. | [
"Get",
"the",
"collections",
"assigned",
"to",
"each",
"association",
"within",
"the",
"collection",
"."
] | 9e198cf0f80f1905354b101d2315f205b43f6dcd | https://github.com/newworldcode/waterline-jsonapi/blob/9e198cf0f80f1905354b101d2315f205b43f6dcd/lib/utils.js#L28-L52 | train |
yoshuawuyts/inject-lr-script-stream | index.js | streamInjectLrScript | 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 | 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 += '://'
... | [
"function",
"streamInjectLrScript",
"(",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
"assert",
".",
"equal",
"(",
"typeof",
"opts",
",",
"'object'",
")",
"const",
"protocol",
"=",
"opts",
".",
"protocol",
"||",
"'http'",
"const",
"host",
"=",
... | Streamingly inject a livereload script into html obj -> stream | [
"Streamingly",
"inject",
"a",
"livereload",
"script",
"into",
"html",
"obj",
"-",
">",
"stream"
] | 87460e8c5c812789597d4a42d76e66607cc9bcb4 | https://github.com/yoshuawuyts/inject-lr-script-stream/blob/87460e8c5c812789597d4a42d76e66607cc9bcb4/index.js#L8-L28 | train |
fent/node-streamin | lib/index.js | isStream | 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 | 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)
);
... | [
"function",
"isStream",
"(",
"io",
")",
"{",
"return",
"typeof",
"io",
"===",
"'object'",
"&&",
"(",
"// Readable stream.",
"(",
"typeof",
"io",
".",
"pipe",
"===",
"'function'",
"&&",
"typeof",
"io",
".",
"readable",
"===",
"'boolean'",
"&&",
"io",
".",
... | Returns true if `io` is a stream.
@param {Stream|Object} io
@return {Boolean} | [
"Returns",
"true",
"if",
"io",
"is",
"a",
"stream",
"."
] | be71158a6758805bc146b3047c444eafa8c0c3c2 | https://github.com/fent/node-streamin/blob/be71158a6758805bc146b3047c444eafa8c0c3c2/lib/index.js#L13-L23 | train |
SolarNetwork/solarnetwork-d3 | src/api/node/urlHelper.js | reportableIntervalURL | 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 | 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;
} | [
"function",
"reportableIntervalURL",
"(",
"sourceIds",
")",
"{",
"var",
"url",
"=",
"(",
"baseURL",
"(",
")",
"+",
"'/range/interval?nodeId='",
"+",
"nodeId",
")",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"sourceIds",
")",
")",
"{",
"url",
"+=",
"'&... | Get a URL for the "reportable interval" for this node, optionally limited to a specific source ID.
@param {Array} sourceIds An array of source IDs to limit query to. If not provided then all available
sources will be returned.
@returns {String} the URL to find the reportable interval
@memberOf sn.api.node.nodeUrlHelpe... | [
"Get",
"a",
"URL",
"for",
"the",
"reportable",
"interval",
"for",
"this",
"node",
"optionally",
"limited",
"to",
"a",
"specific",
"source",
"ID",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/api/node/urlHelper.js#L60-L66 | train |
insin/concur | lib/concur.js | mixin | function mixin(dest, src) {
if (type(src) == 'function') {
extend(dest, src.prototype)
}
else {
extend(dest, src)
}
} | javascript | function mixin(dest, src) {
if (type(src) == 'function') {
extend(dest, src.prototype)
}
else {
extend(dest, src)
}
} | [
"function",
"mixin",
"(",
"dest",
",",
"src",
")",
"{",
"if",
"(",
"type",
"(",
"src",
")",
"==",
"'function'",
")",
"{",
"extend",
"(",
"dest",
",",
"src",
".",
"prototype",
")",
"}",
"else",
"{",
"extend",
"(",
"dest",
",",
"src",
")",
"}",
"... | Mixes in properties from one object to another. If the source object is a
Function, its prototype is mixed in instead. | [
"Mixes",
"in",
"properties",
"from",
"one",
"object",
"to",
"another",
".",
"If",
"the",
"source",
"object",
"is",
"a",
"Function",
"its",
"prototype",
"is",
"mixed",
"in",
"instead",
"."
] | 86e816f1a0cb90ec227371bee065cc76e7234b7c | https://github.com/insin/concur/blob/86e816f1a0cb90ec227371bee065cc76e7234b7c/lib/concur.js#L31-L38 | train |
insin/concur | lib/concur.js | inheritFrom | 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 | 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... | [
"function",
"inheritFrom",
"(",
"parentConstructor",
",",
"childConstructor",
",",
"prototypeProps",
",",
"constructorProps",
")",
"{",
"// Create a child constructor if one wasn't given",
"if",
"(",
"childConstructor",
"==",
"null",
")",
"{",
"childConstructor",
"=",
"fu... | Inherits another constructor's prototype and sets its prototype and
constructor properties in one fell swoop.
If a child constructor is not provided via prototypeProps.constructor,
a new constructor will be created. | [
"Inherits",
"another",
"constructor",
"s",
"prototype",
"and",
"sets",
"its",
"prototype",
"and",
"constructor",
"properties",
"in",
"one",
"fell",
"swoop",
"."
] | 86e816f1a0cb90ec227371bee065cc76e7234b7c | https://github.com/insin/concur/blob/86e816f1a0cb90ec227371bee065cc76e7234b7c/lib/concur.js#L64-L92 | train |
spacemaus/postvox | vox-common/hubclient.js | saveUserProfileInCache | function saveUserProfileInCache(userProfile) {
var old = userProfileCache.peek(userProfile.nick);
if (old && old.updatedAt > userProfile.updatedAt) {
return;
}
userProfileCache.set(userProfile.nick, userProfile);
} | javascript | function saveUserProfileInCache(userProfile) {
var old = userProfileCache.peek(userProfile.nick);
if (old && old.updatedAt > userProfile.updatedAt) {
return;
}
userProfileCache.set(userProfile.nick, userProfile);
} | [
"function",
"saveUserProfileInCache",
"(",
"userProfile",
")",
"{",
"var",
"old",
"=",
"userProfileCache",
".",
"peek",
"(",
"userProfile",
".",
"nick",
")",
";",
"if",
"(",
"old",
"&&",
"old",
".",
"updatedAt",
">",
"userProfile",
".",
"updatedAt",
")",
"... | Caches the UserProfile, but only if it is newer than the existing cached
version. | [
"Caches",
"the",
"UserProfile",
"but",
"only",
"if",
"it",
"is",
"newer",
"than",
"the",
"existing",
"cached",
"version",
"."
] | de98e5ed37edaee1b1edadf93e15eb8f8d21f457 | https://github.com/spacemaus/postvox/blob/de98e5ed37edaee1b1edadf93e15eb8f8d21f457/vox-common/hubclient.js#L40-L46 | train |
chrishayesmu/DubBotBase | src/dubtrack.js | Bot | 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 | 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 = ... | [
"function",
"Bot",
"(",
"credentials",
",",
"globalObject",
",",
"initializationCompleteCallback",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Attempting to log in with email {}\"",
",",
"credentials",
".",
"username",
")",
";",
"new",
"DubAPI",
"(",
"credentials",
",",
... | Creates a new instance of the bot which will automatically connect to dubtrack.fm
and set up some event handling. | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"bot",
"which",
"will",
"automatically",
"connect",
"to",
"dubtrack",
".",
"fm",
"and",
"set",
"up",
"some",
"event",
"handling",
"."
] | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/dubtrack.js#L42-L96 | train |
chrishayesmu/DubBotBase | src/dubtrack.js | _createEventDispatcher | 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 | 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;
... | [
"function",
"_createEventDispatcher",
"(",
"internalEventName",
",",
"translator",
",",
"globalObject",
")",
"{",
"return",
"function",
"(",
"event",
")",
"{",
"var",
"handlers",
"=",
"this",
".",
"eventHandlers",
"[",
"internalEventName",
"]",
";",
"if",
"(",
... | Creates a function which dispatches the given event to its listeners.
@param {string} internalEventName - The event name from the Event enum
@param {function} translator - A function which translates from the DubAPI event to an internal model
@param {object} globalObject - The object representing global application st... | [
"Creates",
"a",
"function",
"which",
"dispatches",
"the",
"given",
"event",
"to",
"its",
"listeners",
"."
] | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/dubtrack.js#L309-L330 | train |
gyandeeps/load-perf | lib/cli.js | printResults | 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 | 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),
... | [
"function",
"printResults",
"(",
"results",
")",
"{",
"var",
"output",
"=",
"\"\"",
";",
"var",
"dependenciesTimes",
"=",
"[",
"]",
";",
"var",
"devDependenciesTimes",
"=",
"[",
"]",
";",
"dependenciesTimes",
"=",
"Object",
".",
"keys",
"(",
"results",
"."... | Prints the results of the run to the console
@param {object} results - Results object from main
@returns {void} | [
"Prints",
"the",
"results",
"of",
"the",
"run",
"to",
"the",
"console"
] | 045eb27e79699db621f57175db7e62e3857c10c0 | https://github.com/gyandeeps/load-perf/blob/045eb27e79699db621f57175db7e62e3857c10c0/lib/cli.js#L18-L55 | train |
gyandeeps/load-perf | lib/cli.js | execute | 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 | 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));
}
} | [
"function",
"execute",
"(",
"args",
")",
"{",
"var",
"options",
"=",
"optionator",
".",
"parse",
"(",
"args",
")",
";",
"if",
"(",
"options",
".",
"help",
")",
"{",
"console",
".",
"log",
"(",
"optionator",
".",
"generateHelp",
"(",
")",
")",
";",
... | Executes the grouch based on the options passed in.
@param {string|Array|Object} args - The arguments to process.
@returns {void} | [
"Executes",
"the",
"grouch",
"based",
"on",
"the",
"options",
"passed",
"in",
"."
] | 045eb27e79699db621f57175db7e62e3857c10c0 | https://github.com/gyandeeps/load-perf/blob/045eb27e79699db621f57175db7e62e3857c10c0/lib/cli.js#L62-L74 | train |
msemenistyi/grunt-grep | tasks/grep.js | grepLines | 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 | 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,
... | [
"function",
"grepLines",
"(",
"src",
",",
"ext",
",",
"destFile",
")",
"{",
"src",
"=",
"grunt",
".",
"util",
".",
"normalizelf",
"(",
"src",
")",
";",
"var",
"lines",
"=",
"src",
".",
"split",
"(",
"grunt",
".",
"util",
".",
"linefeed",
")",
",",
... | go through file and remove lines matching patterns, both single- and multi-line | [
"go",
"through",
"file",
"and",
"remove",
"lines",
"matching",
"patterns",
"both",
"single",
"-",
"and",
"multi",
"-",
"line"
] | d21530a8a7dd35e60d672118dc15d1e8c26035b2 | https://github.com/msemenistyi/grunt-grep/blob/d21530a8a7dd35e60d672118dc15d1e8c26035b2/tasks/grep.js#L83-L149 | train |
joaquimserafim/superagent-bunyan | index.js | onResponse | 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 | 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'
)
... | [
"function",
"onResponse",
"(",
"res",
")",
"{",
"endTime",
"=",
"getTimeMs",
"(",
"endTime",
")",
"res",
"=",
"Object",
".",
"assign",
"(",
"res",
",",
"{",
"opDuration",
":",
"endTime",
"}",
")",
"if",
"(",
"res",
".",
"error",
")",
"{",
"appendRes"... | in case of res.error should fallback to the error emitter and should pass the res object | [
"in",
"case",
"of",
"res",
".",
"error",
"should",
"fallback",
"to",
"the",
"error",
"emitter",
"and",
"should",
"pass",
"the",
"res",
"object"
] | b19ba4415cdb9933d78d50043468965cddc2d681 | https://github.com/joaquimserafim/superagent-bunyan/blob/b19ba4415cdb9933d78d50043468965cddc2d681/index.js#L78-L94 | train |
ForbesLindesay/code-mirror | mode/puppet.js | define | function define(style, string) {
var split = string.split(' ');
for (var i = 0; i < split.length; i++) {
words[split[i]] = style;
}
} | javascript | function define(style, string) {
var split = string.split(' ');
for (var i = 0; i < split.length; i++) {
words[split[i]] = style;
}
} | [
"function",
"define",
"(",
"style",
",",
"string",
")",
"{",
"var",
"split",
"=",
"string",
".",
"split",
"(",
"' '",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"split",
".",
"length",
";",
"i",
"++",
")",
"{",
"words",
"[",
"... | Takes a string of words separated by spaces and adds them as keys with the value of the first argument 'style' | [
"Takes",
"a",
"string",
"of",
"words",
"separated",
"by",
"spaces",
"and",
"adds",
"them",
"as",
"keys",
"with",
"the",
"value",
"of",
"the",
"first",
"argument",
"style"
] | d790ea213aa354756adc7d4d9fcfffcfdc2f1278 | https://github.com/ForbesLindesay/code-mirror/blob/d790ea213aa354756adc7d4d9fcfffcfdc2f1278/mode/puppet.js#L10-L15 | train |
goliatone/winston-honeybadger | lib/wiston-honeybadger.js | Honey | 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 | 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... | [
"function",
"Honey",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"assert",
".",
"isString",
"(",
"options",
".",
"apiKey",
",",
"'Honeybadger transport needs an \"apiKey\" config option'",
")",
";",
"this",
".",
"name",
"=",
"'hon... | Honeybadger transport constructor.
@param {Object} options Config object
@throws Error If options.apiKey is not present | [
"Honeybadger",
"transport",
"constructor",
"."
] | dd1b36949dd4581ba6c231c2eba47932e6bb1a66 | https://github.com/goliatone/winston-honeybadger/blob/dd1b36949dd4581ba6c231c2eba47932e6bb1a66/lib/wiston-honeybadger.js#L22-L37 | train |
fczbkk/parse-relative-time | lib/index.js | parseInput | 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 | 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... | [
"function",
"parseInput",
"(",
"input",
")",
"{",
"var",
"match",
"=",
"re",
".",
"exec",
"(",
"input",
")",
";",
"if",
"(",
"match",
"!==",
"null",
")",
"{",
"var",
"_match",
"=",
"_slicedToArray",
"(",
"match",
",",
"6",
")",
",",
"pre_keyword",
... | Parses value and unit from human-readable relative time.
@param {string} input
@return {parsed_input | null} Returns `null` if input can not be parsed. | [
"Parses",
"value",
"and",
"unit",
"from",
"human",
"-",
"readable",
"relative",
"time",
"."
] | 77f197c2b94ab07a51ac688f52b2b3c08c6a49bd | https://github.com/fczbkk/parse-relative-time/blob/77f197c2b94ab07a51ac688f52b2b3c08c6a49bd/lib/index.js#L58-L84 | train |
fczbkk/parse-relative-time | lib/index.js | sanitizeValue | 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 | 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
});
} | [
"function",
"sanitizeValue",
"(",
"_ref",
")",
"{",
"var",
"value",
"=",
"_ref",
".",
"value",
",",
"operator_keyword",
"=",
"_ref",
".",
"operator_keyword",
",",
"post_keyword",
"=",
"_ref",
".",
"post_keyword",
";",
"return",
"parseInt",
"(",
"value",
",",... | Makes sure that the value is a number.
@param {object} config
@param {string} config.value
@param {operator_keyword} [config.operator_keyword]
@param {post_keyword} [config.post_keyword]
@return {number} | [
"Makes",
"sure",
"that",
"the",
"value",
"is",
"a",
"number",
"."
] | 77f197c2b94ab07a51ac688f52b2b3c08c6a49bd | https://github.com/fczbkk/parse-relative-time/blob/77f197c2b94ab07a51ac688f52b2b3c08c6a49bd/lib/index.js#L95-L103 | train |
fczbkk/parse-relative-time | lib/index.js | getMultiplier | function getMultiplier(_ref2) {
var operator_keyword = _ref2.operator_keyword,
post_keyword = _ref2.post_keyword;
return operator_keyword === '-' || post_keyword === 'ago' ? -1 : 1;
} | javascript | function getMultiplier(_ref2) {
var operator_keyword = _ref2.operator_keyword,
post_keyword = _ref2.post_keyword;
return operator_keyword === '-' || post_keyword === 'ago' ? -1 : 1;
} | [
"function",
"getMultiplier",
"(",
"_ref2",
")",
"{",
"var",
"operator_keyword",
"=",
"_ref2",
".",
"operator_keyword",
",",
"post_keyword",
"=",
"_ref2",
".",
"post_keyword",
";",
"return",
"operator_keyword",
"===",
"'-'",
"||",
"post_keyword",
"===",
"'ago'",
... | Gets multiplier based on whether the value is in past or future.
@param {object} config
@param {operator_keyword} config.operator_keyword
@param {post_keyword} config.post_keyword
@return {number} | [
"Gets",
"multiplier",
"based",
"on",
"whether",
"the",
"value",
"is",
"in",
"past",
"or",
"future",
"."
] | 77f197c2b94ab07a51ac688f52b2b3c08c6a49bd | https://github.com/fczbkk/parse-relative-time/blob/77f197c2b94ab07a51ac688f52b2b3c08c6a49bd/lib/index.js#L113-L117 | train |
fczbkk/parse-relative-time | lib/index.js | _default | 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 | 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;
} | [
"function",
"_default",
"(",
"input",
")",
"{",
"var",
"parsed_input",
"=",
"parseInput",
"(",
"input",
")",
";",
"if",
"(",
"parsed_input",
"!==",
"null",
")",
"{",
"var",
"value",
"=",
"parsed_input",
".",
"value",
",",
"unit",
"=",
"parsed_input",
"."... | Parse simple relative time in human readable format to milliseconds.
@name parseRelativeTime
@param {string} input - Human readable format of relative time
@returns {null | number}
@example
parseRelativeTime('2 days'); // --> 172800000
parseRelativeTime('-2 days');
parseRelativeTime('in 2 days');
parseRelativeTime('2 ... | [
"Parse",
"simple",
"relative",
"time",
"in",
"human",
"readable",
"format",
"to",
"milliseconds",
"."
] | 77f197c2b94ab07a51ac688f52b2b3c08c6a49bd | https://github.com/fczbkk/parse-relative-time/blob/77f197c2b94ab07a51ac688f52b2b3c08c6a49bd/lib/index.js#L131-L141 | train |
Strider-CD/strider-runner-core | lib/job.js | function (text, plugin) {
debug(`Job "${this.id}" comments:`, plugin || '<no plugin>', text);
this.status('command.comment', {
comment: text,
plugin: plugin,
time: new Date()
});
} | javascript | function (text, plugin) {
debug(`Job "${this.id}" comments:`, plugin || '<no plugin>', text);
this.status('command.comment', {
comment: text,
plugin: plugin,
time: new Date()
});
} | [
"function",
"(",
"text",
",",
"plugin",
")",
"{",
"debug",
"(",
"`",
"${",
"this",
".",
"id",
"}",
"`",
",",
"plugin",
"||",
"'<no plugin>'",
",",
"text",
")",
";",
"this",
".",
"status",
"(",
"'command.comment'",
",",
"{",
"comment",
":",
"text",
... | command execution stuff | [
"command",
"execution",
"stuff"
] | 6fb14677186fb2d3becdf10fd8d14f09c3184a0c | https://github.com/Strider-CD/strider-runner-core/blob/6fb14677186fb2d3becdf10fd8d14f09c3184a0c/lib/job.js#L165-L172 | train | |
Strider-CD/strider-runner-core | lib/job.js | 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 | 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) {
... | [
"function",
"(",
"pluginName",
",",
"env",
",",
"path",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"context",
"=",
"{",
"status",
":",
"this",
".",
"status",
".",
"bind",
"(",
"this",
")",
",",
"out",
":",
"this",
".",
"out",
".",
"bind",
... | job running stuff | [
"job",
"running",
"stuff"
] | 6fb14677186fb2d3becdf10fd8d14f09c3184a0c | https://github.com/Strider-CD/strider-runner-core/blob/6fb14677186fb2d3becdf10fd8d14f09c3184a0c/lib/job.js#L296-L352 | train | |
serganus/RunGruntTask | index.js | RunGruntTask | 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 | 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... | [
"function",
"RunGruntTask",
"(",
"taskname",
",",
"absolutePath",
")",
"{",
"var",
"exec",
"=",
"require",
"(",
"'child_process'",
")",
".",
"exec",
";",
"var",
"gruntarg",
"=",
"' --gruntfile '",
";",
"var",
"space",
"=",
"' '",
";",
"if",
"(",
"os",
"=... | This would look for the GruntFile.js in your application structure | [
"This",
"would",
"look",
"for",
"the",
"GruntFile",
".",
"js",
"in",
"your",
"application",
"structure"
] | ce9d002524e63b7ea5a88e4f2cfba3cbbc5f80a9 | https://github.com/serganus/RunGruntTask/blob/ce9d002524e63b7ea5a88e4f2cfba3cbbc5f80a9/index.js#L7-L38 | train |
brycebaril/transaction-tracer | examples/lib/worker.js | fetch | 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 | 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()
} | [
"function",
"fetch",
"(",
"url",
",",
"id",
")",
"{",
"var",
"req",
"=",
"http",
".",
"request",
"(",
"url",
",",
"function",
"(",
"res",
")",
"{",
"res",
".",
"pipe",
"(",
"terminus",
".",
"concat",
"(",
"function",
"(",
"contents",
")",
"{",
"t... | passing the id here not because that's a good practice but intead to show that the transaction tracer is idempotent accross requires by different files. it would probably make more sense to simply have all the tracing logic in one of the two places used here for a real application. | [
"passing",
"the",
"id",
"here",
"not",
"because",
"that",
"s",
"a",
"good",
"practice",
"but",
"intead",
"to",
"show",
"that",
"the",
"transaction",
"tracer",
"is",
"idempotent",
"accross",
"requires",
"by",
"different",
"files",
".",
"it",
"would",
"probabl... | f3c4a33b5e1cea940be08589297e7555c40fe1d7 | https://github.com/brycebaril/transaction-tracer/blob/f3c4a33b5e1cea940be08589297e7555c40fe1d7/examples/lib/worker.js#L12-L19 | train |
doowb/ask-once | index.js | Ask | 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 | 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... | [
"function",
"Ask",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Ask",
")",
")",
"{",
"return",
"new",
"Ask",
"(",
"options",
")",
";",
"}",
"this",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"questi... | Returns a question-asking function that only asks a question
if the answer is not already stored, or if forced.
```js
var ask = new Ask({questions: questions});
```
@param {Object} `options`
@param {Object} `options.questions` (optional) Options to be passed to [question-cache][]
@param {Object} `options.store` (opti... | [
"Returns",
"a",
"question",
"-",
"asking",
"function",
"that",
"only",
"asks",
"a",
"question",
"if",
"the",
"answer",
"is",
"not",
"already",
"stored",
"or",
"if",
"forced",
"."
] | 622d18243be7485fda965a87cd3467f6790eafef | https://github.com/doowb/ask-once/blob/622d18243be7485fda965a87cd3467f6790eafef/index.js#L27-L48 | train |
JimmyRobz/mokuai | utils/basename.js | basename | function basename(file){
var extname = path.extname(file);
return path.basename(file, extname);
} | javascript | function basename(file){
var extname = path.extname(file);
return path.basename(file, extname);
} | [
"function",
"basename",
"(",
"file",
")",
"{",
"var",
"extname",
"=",
"path",
".",
"extname",
"(",
"file",
")",
";",
"return",
"path",
".",
"basename",
"(",
"file",
",",
"extname",
")",
";",
"}"
] | Utility function to get basename of file | [
"Utility",
"function",
"to",
"get",
"basename",
"of",
"file"
] | 02ba6dfd6fb61b4a124e15a8252cff7e940132ac | https://github.com/JimmyRobz/mokuai/blob/02ba6dfd6fb61b4a124e15a8252cff7e940132ac/utils/basename.js#L4-L7 | train |
supercrabtree/tie-dye | hexToRgb.js | hexToRgb | 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 | 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
};
} | [
"function",
"hexToRgb",
"(",
"hex",
")",
"{",
"var",
"match",
"=",
"hex",
".",
"toString",
"(",
"16",
")",
".",
"match",
"(",
"/",
"[a-f0-9]{6}",
"/",
"i",
")",
";",
"if",
"(",
"!",
"match",
")",
"{",
"return",
"{",
"r",
":",
"0",
",",
"g",
"... | Convert a color from hexidecimal to RGB
@param {string} hex - A string containing six hexidecimal characters
@returns {object} With the signature {r: 0-255, g: 0-255, b: 0-255} | [
"Convert",
"a",
"color",
"from",
"hexidecimal",
"to",
"RGB"
] | 1bf045767ce1a3fcf88450fbf95f72b5646f63df | https://github.com/supercrabtree/tie-dye/blob/1bf045767ce1a3fcf88450fbf95f72b5646f63df/hexToRgb.js#L7-L25 | train |
jobsteven/promisify-git | index.js | 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 | 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)
... | [
"function",
"(",
"dir_path",
")",
"{",
"return",
"fs",
".",
"statAsync",
"(",
"dir_path",
")",
".",
"call",
"(",
"'isDirectory'",
")",
".",
"then",
"(",
"function",
"(",
"isDirectory",
")",
"{",
"if",
"(",
"isDirectory",
")",
"{",
"return",
"fs",
".",
... | get all file in a directory recursively | [
"get",
"all",
"file",
"in",
"a",
"directory",
"recursively"
] | 86dab46e33f35eced2bc5f290f1959060253e32c | https://github.com/jobsteven/promisify-git/blob/86dab46e33f35eced2bc5f290f1959060253e32c/index.js#L45-L74 | train | |
azendal/argon | argon/association.js | hasMany | function hasMany(config) {
var association;
association = {
type : 'HAS_MANY',
name : config.name || config,
cardinality : 'many',
targetModel : config.targetModel || config,
localProperty : config.localProperty || 'i... | javascript | function hasMany(config) {
var association;
association = {
type : 'HAS_MANY',
name : config.name || config,
cardinality : 'many',
targetModel : config.targetModel || config,
localProperty : config.localProperty || 'i... | [
"function",
"hasMany",
"(",
"config",
")",
"{",
"var",
"association",
";",
"association",
"=",
"{",
"type",
":",
"'HAS_MANY'",
",",
"name",
":",
"config",
".",
"name",
"||",
"config",
",",
"cardinality",
":",
"'many'",
",",
"targetModel",
":",
"config",
... | Creates a hasMany method on the class running the method, this creates the "associationName"
method on the object running the method. This is a factory method
@method <public> hasMany
@argument <required> [Object] ({}) config
@return this | [
"Creates",
"a",
"hasMany",
"method",
"on",
"the",
"class",
"running",
"the",
"method",
"this",
"creates",
"the",
"associationName",
"method",
"on",
"the",
"object",
"running",
"the",
"method",
".",
"This",
"is",
"a",
"factory",
"method"
] | 0cfd3a3b3731b69abca55c956c757476779ec1bd | https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/association.js#L53-L81 | train |
dan-nl/yeoman-prompting-helpers | src/prompting-helper.js | promptingHelper | 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 | 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 );
}
);
} | [
"function",
"promptingHelper",
"(",
"generator",
",",
"generator_prompts",
")",
"{",
"var",
"prompts",
"=",
"filterPrompts",
"(",
"generator",
".",
"options",
".",
"PromptAnswers",
",",
"generator_prompts",
")",
";",
"return",
"generator",
".",
"prompt",
"(",
"p... | filters prompts for a generator
compares prompts in the provided generator_prompts with those in generator.options.PromptAnswers.
if a prompt.name already exists in generator.options.PromptAnswers.answers, then it’s not
presented again to the user. the generator can retrieve the previously answered prompt with
generat... | [
"filters",
"prompts",
"for",
"a",
"generator"
] | 6b698989f7350f736705bae66d8481d01512612c | https://github.com/dan-nl/yeoman-prompting-helpers/blob/6b698989f7350f736705bae66d8481d01512612c/src/prompting-helper.js#L21-L30 | train |
reid/onyx | lib/onyx.js | xfer | 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 | 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);
});
} | [
"function",
"xfer",
"(",
"res",
",",
"files",
",",
"cb",
")",
"{",
"var",
"file",
"=",
"files",
".",
"shift",
"(",
")",
";",
"if",
"(",
"!",
"file",
")",
"{",
"return",
"cb",
"(",
"null",
")",
";",
"}",
"fs",
".",
"createReadStream",
"(",
"file... | Implementation of the actual file transfer. | [
"Implementation",
"of",
"the",
"actual",
"file",
"transfer",
"."
] | 25fd002b4389e62f4a8bf3eabb8a2c9c9b06f8a0 | https://github.com/reid/onyx/blob/25fd002b4389e62f4a8bf3eabb8a2c9c9b06f8a0/lib/onyx.js#L116-L130 | train |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/floatpanel/plugin.js | 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 | 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.... | [
"function",
"(",
"editor",
",",
"parentElement",
",",
"definition",
",",
"level",
")",
"{",
"definition",
".",
"forceIFrame",
"=",
"1",
";",
"// In case of editor with floating toolbar append panels that should float\r",
"// to the main UI element.\r",
"if",
"(",
"definitio... | Creates a floatPanel class instance.
@constructor
@param {CKEDITOR.editor} editor
@param {CKEDITOR.dom.element} parentElement
@param {Object} definition Definition of the panel that will be floating.
@param {Number} level | [
"Creates",
"a",
"floatPanel",
"class",
"instance",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/floatpanel/plugin.js#L50-L96 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/floatpanel/plugin.js | 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 | 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... | [
"function",
"(",
")",
"{",
"// Webkit requires to blur any previous focused page element, in\r",
"// order to properly fire the \"focus\" event.\r",
"if",
"(",
"CKEDITOR",
".",
"env",
".",
"webkit",
")",
"{",
"var",
"active",
"=",
"CKEDITOR",
".",
"document",
".",
"getAct... | Restores last focused element or simply focus panel window. | [
"Restores",
"last",
"focused",
"element",
"or",
"simply",
"focus",
"panel",
"window",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/floatpanel/plugin.js#L427-L438 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/floatpanel/plugin.js | 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 | 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() ... | [
"function",
"(",
"panel",
",",
"blockName",
",",
"offsetParent",
",",
"corner",
",",
"offsetX",
",",
"offsetY",
")",
"{",
"// Skip reshowing of child which is already visible.\r",
"if",
"(",
"this",
".",
"_",
".",
"activeChild",
"==",
"panel",
"&&",
"panel",
"."... | Shows specified panel as a child of one block of this one.
@param {CKEDITOR.ui.floatPanel} panel
@param {String} blockName
@param {CKEDITOR.dom.element} offsetParent Positioned parent.
@param {Number} corner
* For LTR (left to right) oriented editor:
* `1` = top-left
* `2` = top-right
* `3` = bottom-right
* `4` = bot... | [
"Shows",
"specified",
"panel",
"as",
"a",
"child",
"of",
"one",
"block",
"of",
"this",
"one",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/floatpanel/plugin.js#L515-L543 | train | |
olizilla/instagrab | bin/instagrab.js | grabUrls | function grabUrls (opts) {
opts.shortcode.forEach(function (shortcode) {
instagrab.url(shortcode, opts.size, function (err, url) {
console.log(err || url)
})
})
} | javascript | function grabUrls (opts) {
opts.shortcode.forEach(function (shortcode) {
instagrab.url(shortcode, opts.size, function (err, url) {
console.log(err || url)
})
})
} | [
"function",
"grabUrls",
"(",
"opts",
")",
"{",
"opts",
".",
"shortcode",
".",
"forEach",
"(",
"function",
"(",
"shortcode",
")",
"{",
"instagrab",
".",
"url",
"(",
"shortcode",
",",
"opts",
".",
"size",
",",
"function",
"(",
"err",
",",
"url",
")",
"... | Log out the urls. | [
"Log",
"out",
"the",
"urls",
"."
] | fe21a57a0aeecacaaa37eccc9d06822889d78ba6 | https://github.com/olizilla/instagrab/blob/fe21a57a0aeecacaaa37eccc9d06822889d78ba6/bin/instagrab.js#L86-L92 | train |
olizilla/instagrab | bin/instagrab.js | grabImages | function grabImages (opts) {
if (!opts.quiet) console.log(multiline(function () {/*
_ _| | |
| __ \ __| __| _` | _` | __| _` | __ \
| | | \__ \ | ( | ( | | ( | | |
___| _| _| ____/ \__| \__,_| \__,... | javascript | function grabImages (opts) {
if (!opts.quiet) console.log(multiline(function () {/*
_ _| | |
| __ \ __| __| _` | _` | __| _` | __ \
| | | \__ \ | ( | ( | | ( | | |
___| _| _| ____/ \__| \__,_| \__,... | [
"function",
"grabImages",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"opts",
".",
"quiet",
")",
"console",
".",
"log",
"(",
"multiline",
"(",
"function",
"(",
")",
"{",
"/*\n\n _ _| | |\n | __ \\ __| __| _` |... | otherwise, start the fanfare and save the images | [
"otherwise",
"start",
"the",
"fanfare",
"and",
"save",
"the",
"images"
] | fe21a57a0aeecacaaa37eccc9d06822889d78ba6 | https://github.com/olizilla/instagrab/blob/fe21a57a0aeecacaaa37eccc9d06822889d78ba6/bin/instagrab.js#L95-L122 | train |
meisterplayer/js-dev | gulp/copy.js | createCopy | 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 | 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));
};
} | [
"function",
"createCopy",
"(",
"inPath",
",",
"outPath",
")",
"{",
"if",
"(",
"!",
"inPath",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Input path(s) argument is required'",
")",
";",
"}",
"if",
"(",
"!",
"outPath",
")",
"{",
"throw",
"new",
"Error",
"(",... | Higher order function to create gulp function that copies files from one location to another.
@param {string|string[]} inPath The globs to the files that need to be copied
@param {string} outPath The destination path for the copies
@return {function} Function that can be used as a gulp task | [
"Higher",
"order",
"function",
"to",
"create",
"gulp",
"function",
"that",
"copies",
"files",
"from",
"one",
"location",
"to",
"another",
"."
] | c2646678c49dcdaa120ba3f24824da52b0c63e31 | https://github.com/meisterplayer/js-dev/blob/c2646678c49dcdaa120ba3f24824da52b0c63e31/gulp/copy.js#L9-L21 | train |
restorecommerce/service-config | index.js | logConfigFile | 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 | 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.... | [
"function",
"logConfigFile",
"(",
"configFile",
",",
"logger",
")",
"{",
"let",
"message",
";",
"if",
"(",
"process",
".",
"env",
".",
"WORKER_ID",
"!==",
"undefined",
")",
"{",
"message",
"=",
"`",
"${",
"process",
".",
"env",
".",
"WORKER_ID",
"}",
"... | log config file usages | [
"log",
"config",
"file",
"usages"
] | f7ae2183ceaf78e2b6cb9d426c8606b71377ea87 | https://github.com/restorecommerce/service-config/blob/f7ae2183ceaf78e2b6cb9d426c8606b71377ea87/index.js#L9-L22 | train |
acos-server/acos-kelmu | static/kelmu.editor.js | function() {
element.find('a, button').mousemove(function(e) {
if (buttonPickerEnabled) {
if (e.target !== buttonToPickElement) {
buttonToPickCounter = 0;
buttonToPickElement = e.target;
}
buttonToPickCounter += 1;
if (buttonToPickCounter > ... | javascript | function() {
element.find('a, button').mousemove(function(e) {
if (buttonPickerEnabled) {
if (e.target !== buttonToPickElement) {
buttonToPickCounter = 0;
buttonToPickElement = e.target;
}
buttonToPickCounter += 1;
if (buttonToPickCounter > ... | [
"function",
"(",
")",
"{",
"element",
".",
"find",
"(",
"'a, button'",
")",
".",
"mousemove",
"(",
"function",
"(",
"e",
")",
"{",
"if",
"(",
"buttonPickerEnabled",
")",
"{",
"if",
"(",
"e",
".",
"target",
"!==",
"buttonToPickElement",
")",
"{",
"butto... | Traces mouse moves above buttons in order to bind animation buttons with Kelmu. | [
"Traces",
"mouse",
"moves",
"above",
"buttons",
"in",
"order",
"to",
"bind",
"animation",
"buttons",
"with",
"Kelmu",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L101-L146 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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... | [
"function",
"(",
")",
"{",
"var",
"elem",
"=",
"$",
"(",
"this",
")",
";",
"var",
"data",
"=",
"window",
".",
"kelmu",
".",
"data",
"[",
"id",
"]",
";",
"data",
".",
"selectedElementNumber",
"=",
"parseInt",
"(",
"elem",
".",
"attr",
"(",
"'data-an... | Clears the CSS rotation of an element. The function should be called
so that `this` referes to the element. | [
"Clears",
"the",
"CSS",
"rotation",
"of",
"an",
"element",
".",
"The",
"function",
"should",
"be",
"called",
"so",
"that",
"this",
"referes",
"to",
"the",
"element",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L164-L176 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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'));... | [
"function",
"(",
")",
"{",
"var",
"elem",
"=",
"$",
"(",
"this",
")",
";",
"var",
"data",
"=",
"window",
".",
"kelmu",
".",
"data",
"[",
"id",
"]",
";",
"data",
".",
"selectedElementNumber",
"=",
"parseInt",
"(",
"elem",
".",
"attr",
"(",
"'data-an... | Updates the position definition for the selected element.
The function should be called so that `this` referes to the element. | [
"Updates",
"the",
"position",
"definition",
"for",
"the",
"selected",
"element",
".",
"The",
"function",
"should",
"be",
"called",
"so",
"that",
"this",
"referes",
"to",
"the",
"element",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L205-L217 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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... | [
"function",
"(",
")",
"{",
"container",
".",
"find",
"(",
"'.kelmu-annotation, .kelmu-button'",
")",
".",
"mousedown",
"(",
"resetRotation",
")",
";",
"container",
".",
"find",
"(",
"'.kelmu-annotation, .kelmu-button'",
")",
".",
"mouseup",
"(",
"restoreRotation",
... | Makes the annotations to be moveable in the editor. | [
"Makes",
"the",
"annotations",
"to",
"be",
"moveable",
"in",
"the",
"editor",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L223-L244 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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... | [
"function",
"(",
")",
"{",
"container",
".",
"find",
"(",
"'.kelmu-annotation'",
")",
".",
"resizable",
"(",
"{",
"start",
":",
"function",
"(",
")",
"{",
"var",
"elem",
"=",
"$",
"(",
"this",
")",
";",
"var",
"data",
"=",
"window",
".",
"kelmu",
"... | Makes the annotations to be resizable in the editor. | [
"Makes",
"the",
"annotations",
"to",
"be",
"resizable",
"in",
"the",
"editor",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L250-L267 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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);
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"ctrlKey",
")",
"{",
"return",
";",
"}",
"event",
".",
"preventDefault",
"(",
")",
";",
"var",
"elem",
"=",
"$",
"(",
"this",
")",
";",
"var",
"data",
"=",
"window",
".",
"kelmu",
".",
... | Selects and changes the current element after clicking it.
The function should be called so that `this` referes to the element. | [
"Selects",
"and",
"changes",
"the",
"current",
"element",
"after",
"clicking",
"it",
".",
"The",
"function",
"should",
"be",
"called",
"so",
"that",
"this",
"referes",
"to",
"the",
"element",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L274-L283 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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... | [
"function",
"(",
"text",
",",
"container",
",",
"name",
",",
"value",
",",
"type",
",",
"noBr",
")",
"{",
"var",
"idNumber",
"=",
"idCounter",
";",
"if",
"(",
"!",
"noBr",
")",
"{",
"$",
"(",
"'<br>'",
")",
".",
"appendTo",
"(",
"container",
")",
... | A helper function for adding input elements to the editor pane. | [
"A",
"helper",
"function",
"for",
"adding",
"input",
"elements",
"to",
"the",
"editor",
"pane",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L492-L506 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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,... | [
"function",
"(",
")",
"{",
"// Remove the element",
"return",
"$",
"(",
"'<button></button>'",
")",
".",
"text",
"(",
"'Remove'",
")",
".",
"addClass",
"(",
"'btn'",
")",
".",
"click",
"(",
"function",
"(",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",... | A helper function for creating remove buttons | [
"A",
"helper",
"function",
"for",
"creating",
"remove",
"buttons"
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L807-L818 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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... | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"window",
".",
"kelmu",
".",
"data",
"[",
"id",
"]",
";",
"var",
"elemData",
"=",
"data",
".",
"definitions",
"[",
"'step'",
"+",
"data",
".",
"stepNumber",
"]",
"[",
"data",
".",
"subStepNumber",
"]",
... | Creates the action editor pane for the selected event. | [
"Creates",
"the",
"action",
"editor",
"pane",
"for",
"the",
"selected",
"event",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L954-L1002 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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'... | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"window",
".",
"kelmu",
".",
"data",
"[",
"id",
"]",
";",
"var",
"elemData",
"=",
"data",
".",
"definitions",
"[",
"'step'",
"+",
"data",
".",
"stepNumber",
"]",
"[",
"data",
".",
"subStepNumber",
"]",
... | Creates the action editor pane for the selected arrow. | [
"Creates",
"the",
"action",
"editor",
"pane",
"for",
"the",
"selected",
"arrow",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L1008-L1054 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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');
... | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"window",
".",
"kelmu",
".",
"data",
"[",
"id",
"]",
";",
"var",
"elemData",
"=",
"data",
".",
"definitions",
"[",
"'step'",
"+",
"data",
".",
"stepNumber",
"]",
"[",
"data",
".",
"subStepNumber",
"]",
... | Creates the action editor pane for the selected line. | [
"Creates",
"the",
"action",
"editor",
"pane",
"for",
"the",
"selected",
"line",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L1060-L1103 | train | |
acos-server/acos-kelmu | static/kelmu.editor.js | 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 | 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')... | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"window",
".",
"kelmu",
".",
"data",
"[",
"id",
"]",
";",
"var",
"elemData",
"=",
"data",
".",
"definitions",
"[",
"'step'",
"+",
"data",
".",
"stepNumber",
"]",
"[",
"data",
".",
"subStepNumber",
"]",
... | Creates the action editor pane for the selected sound. | [
"Creates",
"the",
"action",
"editor",
"pane",
"for",
"the",
"selected",
"sound",
"."
] | 71105b5b43027c517a1da99d6cb0a7687fe253b9 | https://github.com/acos-server/acos-kelmu/blob/71105b5b43027c517a1da99d6cb0a7687fe253b9/static/kelmu.editor.js#L1109-L1170 | train | |
jtrussell/bepacked | lib/bepacked.js | 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 | 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... | [
"function",
"(",
"$",
",",
"$ln",
",",
"contents",
")",
"{",
"var",
"ln",
"=",
"$ln",
"[",
"0",
"]",
",",
"attrKeys",
"=",
"Object",
".",
"keys",
"(",
"ln",
".",
"attribs",
")",
",",
"$s",
"=",
"$",
"(",
"'<style type=\"text/css\"></style>'",
")",
... | Replace a link tag with a script tag with the give contents | [
"Replace",
"a",
"link",
"tag",
"with",
"a",
"script",
"tag",
"with",
"the",
"give",
"contents"
] | 66749847ba1fd9ea38aa1f4cd3bb1ad98e7d5b65 | https://github.com/jtrussell/bepacked/blob/66749847ba1fd9ea38aa1f4cd3bb1ad98e7d5b65/lib/bepacked.js#L69-L87 | train | |
miguelcobain/IPapp | templates/hello/display/script/script.js | 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 | 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').... | [
"function",
"(",
")",
"{",
"// Let's fade out the splash screen div...",
"$",
"(",
"'.splash'",
")",
".",
"fadeOut",
"(",
"'slow'",
",",
"function",
"(",
")",
"{",
"// ...stop the pulsing effect...",
"$",
"(",
"'.splash .circle'",
")",
".",
"stop",
"(",
")",
"."... | onEnd will run whenever the splash screen ends | [
"onEnd",
"will",
"run",
"whenever",
"the",
"splash",
"screen",
"ends"
] | 5abee62aeeec66b674b2976c2dfdc94a4515e35c | https://github.com/miguelcobain/IPapp/blob/5abee62aeeec66b674b2976c2dfdc94a4515e35c/templates/hello/display/script/script.js#L68-L83 | train | |
zjhiphop/grunt-nest-proxy | lib/multi-data.js | getFormDataForPost | 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 | 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... | [
"function",
"getFormDataForPost",
"(",
"fields",
",",
"files",
")",
"{",
"function",
"encodeFieldPart",
"(",
"boundary",
",",
"name",
",",
"value",
")",
"{",
"var",
"return_part",
"=",
"\"--\"",
"+",
"boundary",
"+",
"\"\\r\\n\"",
";",
"return_part",
"+=",
"... | Converts a list of parameters to forum data
- `fields` - a property map of key value pairs
- `files` - a list of property maps of content
- `type` - the type of file data
- `keyname` - the name of the key corresponding to the file
- `valuename` - the name of the value corresponding to the file
- `data` - the data of th... | [
"Converts",
"a",
"list",
"of",
"parameters",
"to",
"forum",
"data",
"-",
"fields",
"-",
"a",
"property",
"map",
"of",
"key",
"value",
"pairs",
"-",
"files",
"-",
"a",
"list",
"of",
"property",
"maps",
"of",
"content",
"-",
"type",
"-",
"the",
"type",
... | 95083ea47854c59e1381bf867c261dca43399c5f | https://github.com/zjhiphop/grunt-nest-proxy/blob/95083ea47854c59e1381bf867c261dca43399c5f/lib/multi-data.js#L14-L59 | train |
zjhiphop/grunt-nest-proxy | lib/multi-data.js | postData | 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 | 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... | [
"function",
"postData",
"(",
"fields",
",",
"files",
",",
"options",
",",
"headers",
",",
"callback",
")",
"{",
"var",
"headerparams",
"=",
"getFormDataForPost",
"(",
"fields",
",",
"files",
")",
";",
"var",
"totalheaders",
"=",
"headerparams",
".",
"headers... | Sends a post form request via http
- `fields` - a property map of key value pairs
- `files` - a list of property maps of content
- `type` - the type of file data
- `keyname` - the name of the key corresponding to the file
- `valuename` - the name of the value corresponding to the file
- `data` - the data of the file
- ... | [
"Sends",
"a",
"post",
"form",
"request",
"via",
"http",
"-",
"fields",
"-",
"a",
"property",
"map",
"of",
"key",
"value",
"pairs",
"-",
"files",
"-",
"a",
"list",
"of",
"property",
"maps",
"of",
"content",
"-",
"type",
"-",
"the",
"type",
"of",
"file... | 95083ea47854c59e1381bf867c261dca43399c5f | https://github.com/zjhiphop/grunt-nest-proxy/blob/95083ea47854c59e1381bf867c261dca43399c5f/lib/multi-data.js#L78-L107 | train |
zjhiphop/grunt-nest-proxy | lib/multi-data.js | postImage | 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 | 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;
}
... | [
"function",
"postImage",
"(",
"options",
",",
"filename",
",",
"headers",
",",
"cb",
")",
"{",
"Step",
"(",
"function",
"readImage",
"(",
")",
"{",
"fs",
".",
"readFile",
"(",
"filename",
",",
"this",
")",
";",
"}",
",",
"function",
"(",
"err",
",",
... | Sends a post form request via http
- `options` is a set of options
- host
- port
- path
- method
- encoding
- `filename` filename being uploaded
- `headers` headers to be sent with the request | [
"Sends",
"a",
"post",
"form",
"request",
"via",
"http",
"-",
"options",
"is",
"a",
"set",
"of",
"options",
"-",
"host",
"-",
"port",
"-",
"path",
"-",
"method",
"-",
"encoding",
"-",
"filename",
"filename",
"being",
"uploaded",
"-",
"headers",
"headers",... | 95083ea47854c59e1381bf867c261dca43399c5f | https://github.com/zjhiphop/grunt-nest-proxy/blob/95083ea47854c59e1381bf867c261dca43399c5f/lib/multi-data.js#L120-L142 | train |
entrinsik-org/nonce | lib/nonce.js | Nonce | function Nonce(cache, ttl) {
this.cache = cache;
this.ttl = ttl;
if (this.ttl && this.ttl > TTLMAX) {
this.ttl = TTLMAX;
}
} | javascript | function Nonce(cache, ttl) {
this.cache = cache;
this.ttl = ttl;
if (this.ttl && this.ttl > TTLMAX) {
this.ttl = TTLMAX;
}
} | [
"function",
"Nonce",
"(",
"cache",
",",
"ttl",
")",
"{",
"this",
".",
"cache",
"=",
"cache",
";",
"this",
".",
"ttl",
"=",
"ttl",
";",
"if",
"(",
"this",
".",
"ttl",
"&&",
"this",
".",
"ttl",
">",
"TTLMAX",
")",
"{",
"this",
".",
"ttl",
"=",
... | Nonce is a UUID that is created and cached until used. When used, it is removed so that
a request cannot perform the same action more than once. There is a TTL on the cache, so the store
does not continue to grow.
@param cache - the hapi server cache
@param ttl - optional, the ttl for the nonces generated
@construct... | [
"Nonce",
"is",
"a",
"UUID",
"that",
"is",
"created",
"and",
"cached",
"until",
"used",
".",
"When",
"used",
"it",
"is",
"removed",
"so",
"that",
"a",
"request",
"cannot",
"perform",
"the",
"same",
"action",
"more",
"than",
"once",
".",
"There",
"is",
"... | 271c28bade513bf269997cf867ddc3454eed0e30 | https://github.com/entrinsik-org/nonce/blob/271c28bade513bf269997cf867ddc3454eed0e30/lib/nonce.js#L15-L21 | train |
gabmontes/coincap-lib | src/index.js | createCoincap | 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 | 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'
... | [
"function",
"createCoincap",
"(",
")",
"{",
"const",
"socket",
"=",
"io",
"(",
"baseUrl",
",",
"{",
"autoConnect",
":",
"false",
"}",
")",
"const",
"api",
"=",
"{",
"}",
"// Add JSON API supported endpoints",
";",
"[",
"{",
"method",
":",
"'coins'",
",",
... | Constructs the CoinCap API object.
@return {Object} | [
"Constructs",
"the",
"CoinCap",
"API",
"object",
"."
] | 7397e369b7683e4456fea378b9f6521a34e7ddba | https://github.com/gabmontes/coincap-lib/blob/7397e369b7683e4456fea378b9f6521a34e7ddba/src/index.js#L12-L58 | train |
ahwayakchih/serve-files | benchmarks/index.js | logInfo | 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 | 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... | [
"function",
"logInfo",
"(",
")",
"{",
"console",
".",
"log",
"(",
"`",
"${",
"process",
".",
"version",
"}",
"${",
"os",
".",
"cpus",
"(",
")",
"[",
"0",
"]",
".",
"model",
"}",
"${",
"os",
".",
"cpus",
"(",
")",
".",
"length",
"}",
"`",
")",... | Show info about environment and tested packages.
@private | [
"Show",
"info",
"about",
"environment",
"and",
"tested",
"packages",
"."
] | cd949252a37210bec229146ab519534ef641e942 | https://github.com/ahwayakchih/serve-files/blob/cd949252a37210bec229146ab519534ef641e942/benchmarks/index.js#L148-L212 | train |
ahwayakchih/serve-files | benchmarks/index.js | fakeTask | function fakeTask () {
return callback => server.get(filename, (err, res) => callback(err, res));
} | javascript | function fakeTask () {
return callback => server.get(filename, (err, res) => callback(err, res));
} | [
"function",
"fakeTask",
"(",
")",
"{",
"return",
"callback",
"=>",
"server",
".",
"get",
"(",
"filename",
",",
"(",
"err",
",",
"res",
")",
"=>",
"callback",
"(",
"err",
",",
"res",
")",
")",
";",
"}"
] | Fake task, that simply calls back asynchronously.
@private | [
"Fake",
"task",
"that",
"simply",
"calls",
"back",
"asynchronously",
"."
] | cd949252a37210bec229146ab519534ef641e942 | https://github.com/ahwayakchih/serve-files/blob/cd949252a37210bec229146ab519534ef641e942/benchmarks/index.js#L239-L241 | train |
emmoistner/serverless-endpoint | lib/endpoint/res.js | send | function send(statusCode, body) {
if (body) {
body = JSON.stringify(body);
}
return {
statusCode,
body
};
} | javascript | function send(statusCode, body) {
if (body) {
body = JSON.stringify(body);
}
return {
statusCode,
body
};
} | [
"function",
"send",
"(",
"statusCode",
",",
"body",
")",
"{",
"if",
"(",
"body",
")",
"{",
"body",
"=",
"JSON",
".",
"stringify",
"(",
"body",
")",
";",
"}",
"return",
"{",
"statusCode",
",",
"body",
"}",
";",
"}"
] | Formats statusCode, body to be sent as a HTTP response back to Api Gateway.
The body parameter can be a a String, an object, or an Array.
@name send
@function
@param {number} statusCode Http Response code - https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
@param {string|Object|Object[]} body string, Object, or A... | [
"Formats",
"statusCode",
"body",
"to",
"be",
"sent",
"as",
"a",
"HTTP",
"response",
"back",
"to",
"Api",
"Gateway",
".",
"The",
"body",
"parameter",
"can",
"be",
"a",
"a",
"String",
"an",
"object",
"or",
"an",
"Array",
"."
] | c79caaba58e2ffdc87d3ca0cf9095709e6b8b7f0 | https://github.com/emmoistner/serverless-endpoint/blob/c79caaba58e2ffdc87d3ca0cf9095709e6b8b7f0/lib/endpoint/res.js#L29-L39 | train |
kyasuda2003/taurus-express-light | Gruntfile.js | 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 | 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;
}
... | [
"function",
"(",
"src",
",",
"dest",
",",
"isfile",
")",
"{",
"//console.log('test');",
"if",
"(",
"isfile",
")",
"{",
"grunt",
".",
"file",
".",
"copy",
"(",
"src",
",",
"dest",
"+",
"'/'",
"+",
"src",
",",
"{",
"}",
")",
";",
"console",
".",
"l... | copy dicts pattern designed | [
"copy",
"dicts",
"pattern",
"designed"
] | 985fa80c0ba0eddbe6112ebb7b29ca299880cdc6 | https://github.com/kyasuda2003/taurus-express-light/blob/985fa80c0ba0eddbe6112ebb7b29ca299880cdc6/Gruntfile.js#L59-L74 | train | |
melvincarvalho/rdf-shell | bin/tail.js | tail | 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 | 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 () {
... | [
"function",
"tail",
"(",
"argv",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"argv",
"[",
"2",
"]",
")",
"{",
"console",
".",
"error",
"(",
"'url is required'",
")",
"console",
".",
"error",
"(",
"'Usage : tail <url>'",
")",
"process",
".",
"exit",
"(",... | tail gets list of files for a given container
@param {String} argv[2] url
@callback {bin~cb} callback | [
"tail",
"gets",
"list",
"of",
"files",
"for",
"a",
"given",
"container"
] | bf2015f6f333855e69a18ce3ec9e917bbddfb425 | https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/bin/tail.js#L12-L45 | train |
vorg/hammersley | index.js | radicalInverse_VdC | 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 | 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... | [
"function",
"radicalInverse_VdC",
"(",
"i",
")",
"{",
"bits",
"[",
"0",
"]",
"=",
"i",
";",
"bits",
"[",
"0",
"]",
"=",
"(",
"(",
"bits",
"[",
"0",
"]",
"<<",
"16",
")",
"|",
"(",
"bits",
"[",
"0",
"]",
">>",
"16",
")",
")",
">>>",
"0",
"... | Van der Corput radical inverse | [
"Van",
"der",
"Corput",
"radical",
"inverse"
] | 300047be38d59e99f7e3c3424f0b9b65597f2bbe | https://github.com/vorg/hammersley/blob/300047be38d59e99f7e3c3424f0b9b65597f2bbe/index.js#L4-L12 | train |
ugate/releasebot | lib/coopt.js | genEnvOptions | 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 | 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(),
... | [
"function",
"genEnvOptions",
"(",
"commitMsg",
")",
"{",
"return",
"{",
"pluginName",
":",
"globalOpts",
".",
"pluginName",
",",
"pluginDesc",
":",
"globalOpts",
".",
"pluginDesc",
",",
"pkgPath",
":",
"'package.json'",
",",
"pkgPathBower",
":",
"'bower.json'",
... | Generates environment options for a commit
@param commitMsg
the commit message (optional)
@returns {___anonymous1480_2103} | [
"Generates",
"environment",
"options",
"for",
"a",
"commit"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/coopt.js#L64-L89 | train |
ugate/releasebot | lib/coopt.js | genTaskOptions | 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 | 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 ... | [
"function",
"genTaskOptions",
"(",
"env",
")",
"{",
"var",
"mp",
"=",
"env",
".",
"pluginName",
"+",
"': '",
";",
"return",
"{",
"name",
":",
"'<%= commit.versionTag %>'",
",",
"pkgCurrVerBumpMsg",
":",
"mp",
"+",
"'Updating <%= env.pkgPath %> version to match relea... | Generates task options
@param env
the environment options
@returns {___anonymous3636_5131} | [
"Generates",
"task",
"options"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/coopt.js#L98-L138 | train |
ugate/releasebot | lib/coopt.js | getLineReplRegExp | 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 | 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... | [
"function",
"getLineReplRegExp",
"(",
"rxa",
",",
"tasks",
")",
"{",
"var",
"r",
"=",
"''",
",",
"sf",
"=",
"null",
";",
"function",
"rxItem",
"(",
"o",
",",
"i",
",",
"a",
")",
"{",
"var",
"s",
"=",
"util",
".",
"isRegExp",
"(",
"o",
")",
"?",... | Creates a regular expression for replacing line items
@param rxa
the optional {Array} of {RegExp} or strings (strings will be
escaped) that will be included in the final expression
(concatenated via OR in final expression)
@param tasks
an optional {Array} of task names to replace using the generated
sequence syntax (c... | [
"Creates",
"a",
"regular",
"expression",
"for",
"replacing",
"line",
"items"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/coopt.js#L223-L243 | train |
hoodiehq-archive/hoodie.admin.js | src/hoodie.admin.js | applyExtensions | function applyExtensions(hoodie) {
for (var i = 0; i < extensions.length; i++) {
extensions[i](hoodie);
}
} | javascript | function applyExtensions(hoodie) {
for (var i = 0; i < extensions.length; i++) {
extensions[i](hoodie);
}
} | [
"function",
"applyExtensions",
"(",
"hoodie",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"extensions",
".",
"length",
";",
"i",
"++",
")",
"{",
"extensions",
"[",
"i",
"]",
"(",
"hoodie",
")",
";",
"}",
"}"
] | detect available extensions and attach to Hoodie Object. | [
"detect",
"available",
"extensions",
"and",
"attach",
"to",
"Hoodie",
"Object",
"."
] | eb3444d8fb1df6cbff112bb6dac17f0213c3de93 | https://github.com/hoodiehq-archive/hoodie.admin.js/blob/eb3444d8fb1df6cbff112bb6dac17f0213c3de93/src/hoodie.admin.js#L108-L112 | train |
commenthol/streamss | lib/writearray.js | WriteArray | 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 | 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 = ... | [
"function",
"WriteArray",
"(",
"options",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"WriteArray",
")",
")",
"{",
"return",
"new",
"WriteArray",
"(",
"options",
",",
"callback",
")",
"}",
"if",
"("... | Write stream into an Array
@constructor
@param {Object} [options] - Stream Options `{encoding, highWaterMark, decodeStrings, objectMode, ...}`
@param {Function} callback - callback function `function({Error}err, {Array}array)` called on `finish` or `error` event.
@return {Writable} A writable stream | [
"Write",
"stream",
"into",
"an",
"Array"
] | cfef5d0ed30c7efe002018886e2e843c91d3558f | https://github.com/commenthol/streamss/blob/cfef5d0ed30c7efe002018886e2e843c91d3558f/lib/writearray.js#L19-L48 | train |
angeloocana/joj-core | dist/Move.js | getGameAfterMoves | function getGameAfterMoves(game, moves) {
return moves.reduce(function (lastGame, move) {
return getGameAfterMove(lastGame, move);
}, game);
} | javascript | function getGameAfterMoves(game, moves) {
return moves.reduce(function (lastGame, move) {
return getGameAfterMove(lastGame, move);
}, game);
} | [
"function",
"getGameAfterMoves",
"(",
"game",
",",
"moves",
")",
"{",
"return",
"moves",
".",
"reduce",
"(",
"function",
"(",
"lastGame",
",",
"move",
")",
"{",
"return",
"getGameAfterMove",
"(",
"lastGame",
",",
"move",
")",
";",
"}",
",",
"game",
")",
... | Get game after n moves. | [
"Get",
"game",
"after",
"n",
"moves",
"."
] | 14bc7801c004271cefafff6cc0abb0c3173c805a | https://github.com/angeloocana/joj-core/blob/14bc7801c004271cefafff6cc0abb0c3173c805a/dist/Move.js#L154-L158 | train |
thotzl/grunt-css-statistics | tasks/cssstats.js | sortFontSizes | 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 | 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, ''... | [
"function",
"sortFontSizes",
"(",
"fontSizes",
")",
"{",
"var",
"r",
"=",
"{",
"}",
";",
"var",
"temp",
"=",
"[",
"]",
";",
"var",
"size",
"=",
"0",
";",
"var",
"biggest",
"=",
"0",
";",
"for",
"(",
"var",
"prop",
"in",
"fontSizes",
")",
"{",
"... | sorts the font sizes from big too small
@param fontSizes
@returns {{}} | [
"sorts",
"the",
"font",
"sizes",
"from",
"big",
"too",
"small"
] | 6b0c9057bded1d5df20d43baaa015b51926888ad | https://github.com/thotzl/grunt-css-statistics/blob/6b0c9057bded1d5df20d43baaa015b51926888ad/tasks/cssstats.js#L238-L294 | train |
thotzl/grunt-css-statistics | tasks/cssstats.js | getValueCount | 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 | 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... | [
"function",
"getValueCount",
"(",
"values",
",",
"property",
")",
"{",
"var",
"arr",
"=",
"{",
"}",
";",
"property",
"=",
"property",
"?",
"property",
":",
"''",
";",
"if",
"(",
"!",
"values",
")",
"{",
"grunt",
".",
"log",
".",
"writeln",
"(",
"ap... | sets the css property as key
set the amount of the property as value
@param values
@returns {{}} | [
"sets",
"the",
"css",
"property",
"as",
"key",
"set",
"the",
"amount",
"of",
"the",
"property",
"as",
"value"
] | 6b0c9057bded1d5df20d43baaa015b51926888ad | https://github.com/thotzl/grunt-css-statistics/blob/6b0c9057bded1d5df20d43baaa015b51926888ad/tasks/cssstats.js#L303-L325 | train |
raineorshine/striate | index.js | deindentBlocks | 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 | function deindentBlocks(input) {
var indent = detectIndent(input).indent
return input.replace(regex.blocks, function (match, start, body, end) {
return start + deindent(body, indent) + end
})
} | [
"function",
"deindentBlocks",
"(",
"input",
")",
"{",
"var",
"indent",
"=",
"detectIndent",
"(",
"input",
")",
".",
"indent",
"return",
"input",
".",
"replace",
"(",
"regex",
".",
"blocks",
",",
"function",
"(",
"match",
",",
"start",
",",
"body",
",",
... | replace blocks as long as there is a match | [
"replace",
"blocks",
"as",
"long",
"as",
"there",
"is",
"a",
"match"
] | 44819f3fc248e7cb02ceac7e2f4ff792c69bd130 | https://github.com/raineorshine/striate/blob/44819f3fc248e7cb02ceac7e2f4ff792c69bd130/index.js#L18-L23 | train |
deepjs/deep-restful | lib/relations.js | 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 | 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... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"relations",
"=",
"utils",
".",
"argToArr",
".",
"call",
"(",
"arguments",
")",
";",
"var",
"func",
"=",
"function",
"(",
"s",
",",
"e",
")",
"{",
"if",
"(",
"!",
"s",
")",
"ret... | retrieve relations described in schema links.
Inject as success in chain an object that hold each relation, their result and the associated (parsed) request object
@method getRelations
@chainable
@example
var schema3 = {
properties:{
id:{ type:"string", required:false, indexed:true },
label:{ type:"string" },
plan... | [
"retrieve",
"relations",
"described",
"in",
"schema",
"links",
"."
] | 44c5e1e5526a821522ab5e3004f66ffc7840f551 | https://github.com/deepjs/deep-restful/blob/44c5e1e5526a821522ab5e3004f66ffc7840f551/lib/relations.js#L175-L214 | train | |
deepjs/deep-restful | lib/relations.js | 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 | 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;... | [
"function",
"(",
"map",
",",
"delimitter",
")",
"{",
"if",
"(",
"!",
"delimitter",
")",
"delimitter",
"=",
"\".\"",
";",
"var",
"self",
"=",
"this",
";",
"var",
"relations",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"in",
"map",
")",
"relations",... | map relations in current entries values
@method mapRelations
@chainable
@param {Object} map the map (see examples)
@param {String} delimitter (optional) the paths delimitter
@return {NodesChain} this
@example
var schema3 = {
properties:{
id:{ type:"string", required:false, indexed:true },
label:{ type:... | [
"map",
"relations",
"in",
"current",
"entries",
"values"
] | 44c5e1e5526a821522ab5e3004f66ffc7840f551 | https://github.com/deepjs/deep-restful/blob/44c5e1e5526a821522ab5e3004f66ffc7840f551/lib/relations.js#L255-L307 | train | |
posttool/currentcms | lib/public/js/browse.js | create_header_col | 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 | 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;
... | [
"function",
"create_header_col",
"(",
"m",
")",
"{",
"var",
"$e",
"=",
"$$",
"(",
"'hcol nowrap'",
")",
";",
"$e",
".",
"css",
"(",
"{",
"width",
":",
"p",
"}",
")",
";",
"if",
"(",
"m",
".",
"options",
")",
"{",
"$e",
".",
"css",
"(",
"m",
"... | last header clicked | [
"last",
"header",
"clicked"
] | 9afc9f907bad3b018d961af66c3abb33cd82b051 | https://github.com/posttool/currentcms/blob/9afc9f907bad3b018d961af66c3abb33cd82b051/lib/public/js/browse.js#L99-L136 | train |
posttool/currentcms | lib/public/js/browse.js | make_page | 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 | 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-'+... | [
"function",
"make_page",
"(",
"i",
",",
"total",
")",
"{",
"var",
"$p",
"=",
"$$",
"(",
"'page'",
",",
"{",
"el",
":",
"'span'",
"}",
")",
";",
"if",
"(",
"i",
"==",
"page",
")",
"{",
"$p",
".",
"addClass",
"(",
"'selected'",
")",
";",
"$lp",
... | last page clicked | [
"last",
"page",
"clicked"
] | 9afc9f907bad3b018d961af66c3abb33cd82b051 | https://github.com/posttool/currentcms/blob/9afc9f907bad3b018d961af66c3abb33cd82b051/lib/public/js/browse.js#L207-L226 | train |
finalclass/com | index.js | 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 | 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;
} | [
"function",
"(",
"object",
")",
"{",
"object",
".",
"id",
"=",
"object",
".",
"id",
"||",
"this",
".",
"generateId",
"(",
")",
";",
"this",
".",
"data",
".",
"push",
"(",
"object",
")",
";",
"this",
".",
"mapValues",
"[",
"object",
".",
"id",
"]"... | adds the object
@public
@param {Object} object
@return {Com} | [
"adds",
"the",
"object"
] | 15e080f1a8353c72d9f9216dee830c0efe6ad93a | https://github.com/finalclass/com/blob/15e080f1a8353c72d9f9216dee830c0efe6ad93a/index.js#L105-L113 | train | |
finalclass/com | index.js | 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 | 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... | [
"function",
"(",
"object",
")",
"{",
"var",
"index",
"=",
"this",
".",
"data",
".",
"indexOf",
"(",
"object",
")",
";",
"if",
"(",
"index",
"!==",
"-",
"1",
")",
"{",
"this",
".",
"data",
".",
"splice",
"(",
"index",
",",
"1",
")",
";",
"}",
... | Removes the object
@public
@param {Object} object
@return {Com} | [
"Removes",
"the",
"object"
] | 15e080f1a8353c72d9f9216dee830c0efe6ad93a | https://github.com/finalclass/com/blob/15e080f1a8353c72d9f9216dee830c0efe6ad93a/index.js#L124-L134 | train | |
finalclass/com | index.js | 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 | 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();
} | [
"function",
"(",
"id",
",",
"length",
")",
"{",
"length",
"=",
"length",
"||",
"8",
";",
"id",
"=",
"id",
"||",
"words",
".",
"generate",
"(",
"length",
")",
";",
"while",
"(",
"this",
".",
"mapValues",
"[",
"id",
"]",
"!==",
"undefined",
")",
"{... | Generate random, unique id
@private
@param {String} [id=null]
@param {Number} [length=8]
@return {String} | [
"Generate",
"random",
"unique",
"id"
] | 15e080f1a8353c72d9f9216dee830c0efe6ad93a | https://github.com/finalclass/com/blob/15e080f1a8353c72d9f9216dee830c0efe6ad93a/index.js#L161-L172 | train | |
finalclass/com | index.js | function (mapName, index) {
if (this.maps[mapName][index] === undefined) {
return [];
}
return this.maps[mapName][index].slice(); //slice() makes a copy of the array
} | javascript | function (mapName, index) {
if (this.maps[mapName][index] === undefined) {
return [];
}
return this.maps[mapName][index].slice(); //slice() makes a copy of the array
} | [
"function",
"(",
"mapName",
",",
"index",
")",
"{",
"if",
"(",
"this",
".",
"maps",
"[",
"mapName",
"]",
"[",
"index",
"]",
"===",
"undefined",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"this",
".",
"maps",
"[",
"mapName",
"]",
"[",
"inde... | Returns all the records stored in the `mapName` with the map value
equal to `index`
@public
@param {String} mapName
@param {String} index
@return {Object[]} | [
"Returns",
"all",
"the",
"records",
"stored",
"in",
"the",
"mapName",
"with",
"the",
"map",
"value",
"equal",
"to",
"index"
] | 15e080f1a8353c72d9f9216dee830c0efe6ad93a | https://github.com/finalclass/com/blob/15e080f1a8353c72d9f9216dee830c0efe6ad93a/index.js#L202-L207 | train | |
finalclass/com | index.js | function (callback) {
var mapName;
for (mapName in this.maps) {
if (this.maps.hasOwnProperty(mapName)) {
callback.call(this, this.maps[mapName], mapName);
}
}
} | javascript | function (callback) {
var mapName;
for (mapName in this.maps) {
if (this.maps.hasOwnProperty(mapName)) {
callback.call(this, this.maps[mapName], mapName);
}
}
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"mapName",
";",
"for",
"(",
"mapName",
"in",
"this",
".",
"maps",
")",
"{",
"if",
"(",
"this",
".",
"maps",
".",
"hasOwnProperty",
"(",
"mapName",
")",
")",
"{",
"callback",
".",
"call",
"(",
"this",
",... | Iterates through all the maps
@private
@param {Function(Object[], String)} callback | [
"Iterates",
"through",
"all",
"the",
"maps"
] | 15e080f1a8353c72d9f9216dee830c0efe6ad93a | https://github.com/finalclass/com/blob/15e080f1a8353c72d9f9216dee830c0efe6ad93a/index.js#L228-L236 | train | |
finalclass/com | index.js | function (callback) {
var i;
for (i = 0; i < this.data.length; i += 1) {
callback.call(this, this.data[i], i);
}
return this;
} | javascript | function (callback) {
var i;
for (i = 0; i < this.data.length; i += 1) {
callback.call(this, this.data[i], i);
}
return this;
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"data",
".",
"length",
";",
"i",
"+=",
"1",
")",
"{",
"callback",
".",
"call",
"(",
"this",
",",
"this",
".",
"data",
"[",
"i",
"... | Iterates through all the objects
@public
@param {Function(Object, Number)} callback
@return {Com} | [
"Iterates",
"through",
"all",
"the",
"objects"
] | 15e080f1a8353c72d9f9216dee830c0efe6ad93a | https://github.com/finalclass/com/blob/15e080f1a8353c72d9f9216dee830c0efe6ad93a/index.js#L247-L254 | train | |
finalclass/com | index.js | function (mapName, object) {
var mapFunction = this.mapFunctions[mapName],
index,
value,
emit = function (idx, val) {
index = idx;
value = val;
};
mapFunction.call(object, object, emit);
... | javascript | function (mapName, object) {
var mapFunction = this.mapFunctions[mapName],
index,
value,
emit = function (idx, val) {
index = idx;
value = val;
};
mapFunction.call(object, object, emit);
... | [
"function",
"(",
"mapName",
",",
"object",
")",
"{",
"var",
"mapFunction",
"=",
"this",
".",
"mapFunctions",
"[",
"mapName",
"]",
",",
"index",
",",
"value",
",",
"emit",
"=",
"function",
"(",
"idx",
",",
"val",
")",
"{",
"index",
"=",
"idx",
";",
... | Adds object to `mapName` map
@private
@param {String} mapName
@param {Object} object
@return {Com} | [
"Adds",
"object",
"to",
"mapName",
"map"
] | 15e080f1a8353c72d9f9216dee830c0efe6ad93a | https://github.com/finalclass/com/blob/15e080f1a8353c72d9f9216dee830c0efe6ad93a/index.js#L266-L283 | train | |
finalclass/com | index.js | 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 | 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;
} | [
"function",
"(",
"mapName",
",",
"object",
")",
"{",
"var",
"mapValue",
"=",
"this",
".",
"mapValues",
"[",
"object",
".",
"id",
"]",
"[",
"mapName",
"]",
",",
"index",
"=",
"this",
".",
"maps",
"[",
"mapName",
"]",
"[",
"mapValue",
"]",
".",
"inde... | Removes object from `mapName` map
@private
@param {String} mapName
@param {Object} object
@return {Com} | [
"Removes",
"object",
"from",
"mapName",
"map"
] | 15e080f1a8353c72d9f9216dee830c0efe6ad93a | https://github.com/finalclass/com/blob/15e080f1a8353c72d9f9216dee830c0efe6ad93a/index.js#L295-L304 | train | |
frisb/fdboost | lib/enhance/encoding/adapters/abstract.js | AbstractAdapter | 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 | 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);
}
} | [
"function",
"AbstractAdapter",
"(",
"valueOrBuffer",
",",
"pos",
")",
"{",
"this",
".",
"pos",
"=",
"pos",
"!=",
"null",
"?",
"pos",
":",
"0",
";",
"this",
".",
"data",
"=",
"null",
";",
"if",
"(",
"Buffer",
".",
"isBuffer",
"(",
"valueOrBuffer",
")"... | Extend an AbstractAdapter instance for encoding and decoding typed values.
@abstract
@param {(Buffer|undefined|string|integer|double|boolean|null|date|array|object)} valueOrBuffer Value to encode or buffer instance to decode.
@param {integer} [pos=0] Buffer position to start writing data.
@property {Buffer} data Encode... | [
"Extend",
"an",
"AbstractAdapter",
"instance",
"for",
"encoding",
"and",
"decoding",
"typed",
"values",
"."
] | 66cfb6552940aa92f35dbb1cf4d0695d842205c2 | https://github.com/frisb/fdboost/blob/66cfb6552940aa92f35dbb1cf4d0695d842205c2/lib/enhance/encoding/adapters/abstract.js#L28-L36 | train |
Industryswarm/isnode-mod-data | lib/mongodb/mongodb-core/lib/auth/plain.js | 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 | 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);
} | [
"function",
"(",
"authStore",
",",
"session",
")",
"{",
"var",
"found",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"authStore",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"authStore",
"[",
"i",
"]",
".",
"equal... | Add to store only if it does not exist | [
"Add",
"to",
"store",
"only",
"if",
"it",
"does",
"not",
"exist"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb-core/lib/auth/plain.js#L119-L130 | train | |
Industryswarm/isnode-mod-data | lib/mysql/bignumber.js/bignumber.js | maxOrMin | 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 | 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, ... | [
"function",
"maxOrMin",
"(",
"args",
",",
"method",
")",
"{",
"var",
"m",
",",
"n",
",",
"i",
"=",
"0",
";",
"if",
"(",
"isArray",
"(",
"args",
"[",
"0",
"]",
")",
")",
"args",
"=",
"args",
"[",
"0",
"]",
";",
"m",
"=",
"new",
"BigNumber",
... | Handle BigNumber.max and BigNumber.min. | [
"Handle",
"BigNumber",
".",
"max",
"and",
"BigNumber",
".",
"min",
"."
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mysql/bignumber.js/bignumber.js#L1071-L1091 | train |
Industryswarm/isnode-mod-data | lib/mysql/bignumber.js/bignumber.js | raise | function raise( caller, msg, val ) {
var error = new Error( [
'new BigNumber', // 0
'cmp', // 1
'config', // 2
'div', // 3
'divToInt', // 4
'eq', ... | javascript | function raise( caller, msg, val ) {
var error = new Error( [
'new BigNumber', // 0
'cmp', // 1
'config', // 2
'div', // 3
'divToInt', // 4
'eq', ... | [
"function",
"raise",
"(",
"caller",
",",
"msg",
",",
"val",
")",
"{",
"var",
"error",
"=",
"new",
"Error",
"(",
"[",
"'new BigNumber'",
",",
"// 0\r",
"'cmp'",
",",
"// 1\r",
"'config'",
",",
"// 2\r",
"'div'",
",",
"// 3\r",
"'divToInt'",
",",
"// 4\r",... | Throw a BigNumber Error. | [
"Throw",
"a",
"BigNumber",
"Error",
"."
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mysql/bignumber.js/bignumber.js#L1189-L1223 | train |
Industryswarm/isnode-mod-data | lib/mysql/bignumber.js/bignumber.js | coeffToString | 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 | 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... | [
"function",
"coeffToString",
"(",
"a",
")",
"{",
"var",
"s",
",",
"z",
",",
"i",
"=",
"1",
",",
"j",
"=",
"a",
".",
"length",
",",
"r",
"=",
"a",
"[",
"0",
"]",
"+",
"''",
";",
"for",
"(",
";",
"i",
"<",
"j",
";",
")",
"{",
"s",
"=",
... | Return a coefficient array as a string of base 10 digits. | [
"Return",
"a",
"coefficient",
"array",
"as",
"a",
"string",
"of",
"base",
"10",
"digits",
"."
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mysql/bignumber.js/bignumber.js#L2570-L2586 | train |
mgesmundo/authorify-client | lib/class/Authorization.js | 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 | 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 ... | [
"function",
"(",
")",
"{",
"var",
"secret",
";",
"if",
"(",
"!",
"this",
".",
"getSecret",
"(",
")",
")",
"{",
"throw",
"new",
"CError",
"(",
"'missing secret'",
")",
".",
"log",
"(",
")",
";",
"}",
"try",
"{",
"secret",
"=",
"this",
".",
"encode... | Get the payload property of the header.
@return {Object} The payload property of the header | [
"Get",
"the",
"payload",
"property",
"of",
"the",
"header",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/lib/class/Authorization.js#L82-L109 | train | |
mgesmundo/authorify-client | lib/class/Authorization.js | function(data) {
if (!data) {
data = this.getContent();
}
return this.encoder.encryptAes(JSON.stringify(data), this.getSecret());
} | javascript | function(data) {
if (!data) {
data = this.getContent();
}
return this.encoder.encryptAes(JSON.stringify(data), this.getSecret());
} | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"data",
"=",
"this",
".",
"getContent",
"(",
")",
";",
"}",
"return",
"this",
".",
"encoder",
".",
"encryptAes",
"(",
"JSON",
".",
"stringify",
"(",
"data",
")",
",",
"this",
".... | Encrypt data or content
@param {Object} [data] The data to encrypt or content if missing
@return {String} The encrypted result in Base64 format | [
"Encrypt",
"data",
"or",
"content"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/lib/class/Authorization.js#L135-L140 | train | |
skerit/alchemy-styleboost | assets/scripts/medium-insert/embeds.js | function (options) {
this.options = $.extend(this.defaults, options);
this.$el = $.fn.mediumInsert.insert.$el;
this.setEmbedButtonEvents();
this.preparePreviousEmbeds();
} | javascript | function (options) {
this.options = $.extend(this.defaults, options);
this.$el = $.fn.mediumInsert.insert.$el;
this.setEmbedButtonEvents();
this.preparePreviousEmbeds();
} | [
"function",
"(",
"options",
")",
"{",
"this",
".",
"options",
"=",
"$",
".",
"extend",
"(",
"this",
".",
"defaults",
",",
"options",
")",
";",
"this",
".",
"$el",
"=",
"$",
".",
"fn",
".",
"mediumInsert",
".",
"insert",
".",
"$el",
";",
"this",
"... | Embeds initial function
@return {void} | [
"Embeds",
"initial",
"function"
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/assets/scripts/medium-insert/embeds.js#L18-L23 | train | |
gahlotnikhil/bower-component-files | lib/Component.js | Component | function Component(bowerObj, files) {
this.bowerObj = bowerObj;
this.files = files;
this.name = bowerObj['name'];
this.version = bowerObj['version'];
} | javascript | function Component(bowerObj, files) {
this.bowerObj = bowerObj;
this.files = files;
this.name = bowerObj['name'];
this.version = bowerObj['version'];
} | [
"function",
"Component",
"(",
"bowerObj",
",",
"files",
")",
"{",
"this",
".",
"bowerObj",
"=",
"bowerObj",
";",
"this",
".",
"files",
"=",
"files",
";",
"this",
".",
"name",
"=",
"bowerObj",
"[",
"'name'",
"]",
";",
"this",
".",
"version",
"=",
"bow... | Class to represent individual component.
@constructor
@param {Object} bowerObj
@param {Array<String>} files | [
"Class",
"to",
"represent",
"individual",
"component",
"."
] | f57111e2718517d2c86995975be0d862dc83c7bd | https://github.com/gahlotnikhil/bower-component-files/blob/f57111e2718517d2c86995975be0d862dc83c7bd/lib/Component.js#L10-L15 | train |
AltaModaTech/azure-metrics-for-node | lib/services/metricsservice.js | MetricsService | 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 | 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... | [
"function",
"MetricsService",
"(",
"storageAccount",
",",
"storageAccessKey",
",",
"host",
",",
"authenticationProvider",
")",
"{",
"if",
"(",
"!",
"host",
")",
"{",
"// Dev Stg does not support metrics",
"host",
"=",
"azure",
".",
"ServiceClient",
".",
"CLOUD_TABLE... | Creates a new MetricsService object.
If no storageaccount or storageaccesskey are provided, the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables will be used.
@constructor
@extends {ServiceClient}
@param {string} [storageAccount] The storage account.
@param {string} [storageAccessKey]... | [
"Creates",
"a",
"new",
"MetricsService",
"object",
".",
"If",
"no",
"storageaccount",
"or",
"storageaccesskey",
"are",
"provided",
"the",
"AZURE_STORAGE_ACCOUNT",
"and",
"AZURE_STORAGE_ACCESS_KEY",
"environment",
"variables",
"will",
"be",
"used",
"."
] | f2eb49cb34448575b106ac972dee40b914490bb0 | https://github.com/AltaModaTech/azure-metrics-for-node/blob/f2eb49cb34448575b106ac972dee40b914490bb0/lib/services/metricsservice.js#L49-L60 | train |
Industryswarm/isnode-mod-data | lib/mongodb/mongodb/lib/bulk/unordered.js | executeBatch | 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 | 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);
... | [
"function",
"executeBatch",
"(",
"bulkOperation",
",",
"batch",
",",
"options",
",",
"callback",
")",
"{",
"function",
"resultHandler",
"(",
"err",
",",
"result",
")",
"{",
"// Error is a driver related error not a bulk op error, terminate",
"if",
"(",
"(",
"(",
"er... | Execute the command
@param {UnorderedBulkOperation} bulkOperation
@param {object} batch
@param {object} options
@param {function} callback | [
"Execute",
"the",
"command"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb/lib/bulk/unordered.js#L141-L161 | train |
Industryswarm/isnode-mod-data | lib/mongodb/mongodb/lib/bulk/unordered.js | executeBatches | 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 | 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... | [
"function",
"executeBatches",
"(",
"bulkOperation",
",",
"options",
",",
"callback",
")",
"{",
"let",
"numberOfCommandsToExecute",
"=",
"bulkOperation",
".",
"s",
".",
"batches",
".",
"length",
";",
"// Execute over all the batches",
"for",
"(",
"let",
"i",
"=",
... | Execute all the commands
@param {UnorderedBulkOperation} bulkOperation
@param {object} options
@param {function} callback | [
"Execute",
"all",
"the",
"commands"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb/lib/bulk/unordered.js#L170-L190 | train |
crysalead-js/dom-event-manager | spec/helper/trigger-event.js | triggerEvent | 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 | 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... | [
"function",
"triggerEvent",
"(",
"name",
",",
"element",
")",
"{",
"var",
"eventType",
";",
"switch",
"(",
"name",
")",
"{",
"case",
"\"click\"",
":",
"case",
"\"mousedown\"",
":",
"case",
"\"mouseup\"",
":",
"eventType",
"=",
"\"MouseEvents\"",
";",
"break"... | Trigger an event on the specified element.
@param String name The name of the event to trigger the "on" (e.g., "focus")
@param Object element The DOM element to trigger the event on. | [
"Trigger",
"an",
"event",
"on",
"the",
"specified",
"element",
"."
] | e61e6b23ea7baef6e55ebd6df3762473c47a9a99 | https://github.com/crysalead-js/dom-event-manager/blob/e61e6b23ea7baef6e55ebd6df3762473c47a9a99/spec/helper/trigger-event.js#L7-L30 | train |
sandcastle/vs_projectname | index.js | isValid | 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 | 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);
} | [
"function",
"isValid",
"(",
"ch",
")",
"{",
"var",
"code",
"=",
"ch",
".",
"charCodeAt",
"(",
"0",
")",
";",
"return",
"is_letter",
"(",
"code",
")",
"||",
"is_digit",
"(",
"code",
")",
"||",
"(",
"ch",
"===",
"'.'",
")",
"||",
"(",
"ch",
"===",
... | Tests if the specified character is valid.
@param {String} ch The character to test.
@returns {Boolean} The | [
"Tests",
"if",
"the",
"specified",
"character",
"is",
"valid",
"."
] | 405531a6de45e9ca140fb58529986b2fcf048d60 | https://github.com/sandcastle/vs_projectname/blob/405531a6de45e9ca140fb58529986b2fcf048d60/index.js#L52-L62 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.