id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,500 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/xml/plugin.js | function( xpath, contextNode )
{
var baseXml = this.baseXml;
if ( contextNode || ( contextNode = baseXml ) )
{
if ( CKEDITOR.env.ie || contextNode.selectSingleNode ) // IE
return contextNode.selectSingleNode( xpath );
else if ( baseXml.evaluate ) // Others
{
var result ... | javascript | function( xpath, contextNode )
{
var baseXml = this.baseXml;
if ( contextNode || ( contextNode = baseXml ) )
{
if ( CKEDITOR.env.ie || contextNode.selectSingleNode ) // IE
return contextNode.selectSingleNode( xpath );
else if ( baseXml.evaluate ) // Others
{
var result ... | [
"function",
"(",
"xpath",
",",
"contextNode",
")",
"{",
"var",
"baseXml",
"=",
"this",
".",
"baseXml",
";",
"if",
"(",
"contextNode",
"||",
"(",
"contextNode",
"=",
"baseXml",
")",
")",
"{",
"if",
"(",
"CKEDITOR",
".",
"env",
".",
"ie",
"||",
"contex... | Get a single node from the XML document, based on a XPath query.
@param {String} xpath The XPath query to execute.
@param {Object} [contextNode] The XML DOM node to be used as the context
for the XPath query. The document root is used by default.
@returns {Object} A XML node element or null if the query has no results.... | [
"Get",
"a",
"single",
"node",
"from",
"the",
"XML",
"document",
"based",
"on",
"a",
"XPath",
"query",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/xml/plugin.js#L76-L92 | |
47,501 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/xml/plugin.js | function( xpath, contextNode )
{
var baseXml = this.baseXml,
nodes = [];
if ( contextNode || ( contextNode = baseXml ) )
{
if ( CKEDITOR.env.ie || contextNode.selectNodes ) // IE
return contextNode.selectNodes( xpath );
else if ( baseXml.evaluate ) // Others
{
var... | javascript | function( xpath, contextNode )
{
var baseXml = this.baseXml,
nodes = [];
if ( contextNode || ( contextNode = baseXml ) )
{
if ( CKEDITOR.env.ie || contextNode.selectNodes ) // IE
return contextNode.selectNodes( xpath );
else if ( baseXml.evaluate ) // Others
{
var... | [
"function",
"(",
"xpath",
",",
"contextNode",
")",
"{",
"var",
"baseXml",
"=",
"this",
".",
"baseXml",
",",
"nodes",
"=",
"[",
"]",
";",
"if",
"(",
"contextNode",
"||",
"(",
"contextNode",
"=",
"baseXml",
")",
")",
"{",
"if",
"(",
"CKEDITOR",
".",
... | Gets a list node from the XML document, based on a XPath query.
@param {String} xpath The XPath query to execute.
@param {Object} [contextNode] The XML DOM node to be used as the context
for the XPath query. The document root is used by default.
@returns {ArrayLike} An array containing all matched nodes. The array will... | [
"Gets",
"a",
"list",
"node",
"from",
"the",
"XML",
"document",
"based",
"on",
"a",
"XPath",
"query",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/xml/plugin.js#L110-L133 | |
47,502 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/xml/plugin.js | function( xpath, contextNode )
{
var node = this.selectSingleNode( xpath, contextNode ),
xml = [];
if ( node )
{
node = node.firstChild;
while ( node )
{
if ( node.xml ) // IE
xml.push( node.xml );
else if ( window.XMLSerializer ) // Others
xml.push( ( new... | javascript | function( xpath, contextNode )
{
var node = this.selectSingleNode( xpath, contextNode ),
xml = [];
if ( node )
{
node = node.firstChild;
while ( node )
{
if ( node.xml ) // IE
xml.push( node.xml );
else if ( window.XMLSerializer ) // Others
xml.push( ( new... | [
"function",
"(",
"xpath",
",",
"contextNode",
")",
"{",
"var",
"node",
"=",
"this",
".",
"selectSingleNode",
"(",
"xpath",
",",
"contextNode",
")",
",",
"xml",
"=",
"[",
"]",
";",
"if",
"(",
"node",
")",
"{",
"node",
"=",
"node",
".",
"firstChild",
... | Gets the string representation of hte inner contents of a XML node,
based on a XPath query.
@param {String} xpath The XPath query to execute.
@param {Object} [contextNode] The XML DOM node to be used as the context
for the XPath query. The document root is used by default.
@returns {String} The textual representation o... | [
"Gets",
"the",
"string",
"representation",
"of",
"hte",
"inner",
"contents",
"of",
"a",
"XML",
"node",
"based",
"on",
"a",
"XPath",
"query",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/xml/plugin.js#L149-L168 | |
47,503 | nodejitsu/npm-search-pagelet | httpsgc.js | request | function request(url, using, fn, disk) {
if ('function' === typeof using) {
disk = fn;
fn = using;
using = null;
}
if (!using) {
if (curl) using = 'curl';
else if (wget) using = 'wget';
else using = 'node';
}
debug('requesting '+ url +' using '+ using);
request[using + ( disk ? 'd'... | javascript | function request(url, using, fn, disk) {
if ('function' === typeof using) {
disk = fn;
fn = using;
using = null;
}
if (!using) {
if (curl) using = 'curl';
else if (wget) using = 'wget';
else using = 'node';
}
debug('requesting '+ url +' using '+ using);
request[using + ( disk ? 'd'... | [
"function",
"request",
"(",
"url",
",",
"using",
",",
"fn",
",",
"disk",
")",
"{",
"if",
"(",
"'function'",
"===",
"typeof",
"using",
")",
"{",
"disk",
"=",
"fn",
";",
"fn",
"=",
"using",
";",
"using",
"=",
"null",
";",
"}",
"if",
"(",
"!",
"us... | Request a HTTP resource and return it's contents.
@param {String} url The HTTPS URL that we need to fetch.
@param {String} using Optionally force which fetch engine we should use.
@param {Function} fn Completion callback.
@param {Boolean} disk Store file to disk instead of streaming spawns.
@api private | [
"Request",
"a",
"HTTP",
"resource",
"and",
"return",
"it",
"s",
"contents",
"."
] | a6086c627b69c36c0cf638dc994c25f3d9d5df72 | https://github.com/nodejitsu/npm-search-pagelet/blob/a6086c627b69c36c0cf638dc994c25f3d9d5df72/httpsgc.js#L40-L55 |
47,504 | lazd/PseudoClass | source/Class.js | extendThis | function extendThis() {
var i, ni, objects, object, prop;
objects = arguments;
for (i = 0, ni = objects.length; i < ni; i++) {
object = objects[i];
for (prop in object) {
this[prop] = object[prop];
}
}
return this;
} | javascript | function extendThis() {
var i, ni, objects, object, prop;
objects = arguments;
for (i = 0, ni = objects.length; i < ni; i++) {
object = objects[i];
for (prop in object) {
this[prop] = object[prop];
}
}
return this;
} | [
"function",
"extendThis",
"(",
")",
"{",
"var",
"i",
",",
"ni",
",",
"objects",
",",
"object",
",",
"prop",
";",
"objects",
"=",
"arguments",
";",
"for",
"(",
"i",
"=",
"0",
",",
"ni",
"=",
"objects",
".",
"length",
";",
"i",
"<",
"ni",
";",
"i... | Extend the current context by the passed objects | [
"Extend",
"the",
"current",
"context",
"by",
"the",
"passed",
"objects"
] | 6cb3ac83d18b8782d3943b7461cc4ee0d8f6ce08 | https://github.com/lazd/PseudoClass/blob/6cb3ac83d18b8782d3943b7461cc4ee0d8f6ce08/source/Class.js#L40-L51 |
47,505 | lazd/PseudoClass | source/Class.js | defineAndInheritProperties | function defineAndInheritProperties(Component, properties) {
var constructor,
descriptor,
property,
propertyDescriptors,
propertyDescriptorHash,
propertyDescriptorQueue;
// Set properties
Component.properties = properties;
// Traverse the chain of constructors and gather all property descriptor... | javascript | function defineAndInheritProperties(Component, properties) {
var constructor,
descriptor,
property,
propertyDescriptors,
propertyDescriptorHash,
propertyDescriptorQueue;
// Set properties
Component.properties = properties;
// Traverse the chain of constructors and gather all property descriptor... | [
"function",
"defineAndInheritProperties",
"(",
"Component",
",",
"properties",
")",
"{",
"var",
"constructor",
",",
"descriptor",
",",
"property",
",",
"propertyDescriptors",
",",
"propertyDescriptorHash",
",",
"propertyDescriptorQueue",
";",
"// Set properties",
"Compone... | Merge and define properties | [
"Merge",
"and",
"define",
"properties"
] | 6cb3ac83d18b8782d3943b7461cc4ee0d8f6ce08 | https://github.com/lazd/PseudoClass/blob/6cb3ac83d18b8782d3943b7461cc4ee0d8f6ce08/source/Class.js#L61-L105 |
47,506 | lazd/PseudoClass | source/Class.js | function(name, func, superPrototype) {
return function PseudoClass_setStaticSuper() {
// Store the old super
var previousSuper = this._super;
// Use the method from the superclass' prototype
// This strategy allows monkey patching (modification of superclass prototypes)
this._super = superPrototype[na... | javascript | function(name, func, superPrototype) {
return function PseudoClass_setStaticSuper() {
// Store the old super
var previousSuper = this._super;
// Use the method from the superclass' prototype
// This strategy allows monkey patching (modification of superclass prototypes)
this._super = superPrototype[na... | [
"function",
"(",
"name",
",",
"func",
",",
"superPrototype",
")",
"{",
"return",
"function",
"PseudoClass_setStaticSuper",
"(",
")",
"{",
"// Store the old super",
"var",
"previousSuper",
"=",
"this",
".",
"_super",
";",
"// Use the method from the superclass' prototype... | Bind an overriding method such that it gets the overridden method as its first argument | [
"Bind",
"an",
"overriding",
"method",
"such",
"that",
"it",
"gets",
"the",
"overridden",
"method",
"as",
"its",
"first",
"argument"
] | 6cb3ac83d18b8782d3943b7461cc4ee0d8f6ce08 | https://github.com/lazd/PseudoClass/blob/6cb3ac83d18b8782d3943b7461cc4ee0d8f6ce08/source/Class.js#L116-L134 | |
47,507 | lazd/PseudoClass | source/Class.js | function(properties) {
// If a class-like object is passed as properties.extend, just call extend on it
if (properties && properties.extend)
return properties.extend.extend(properties);
// Otherwise, just create a new class with the passed properties
return PseudoClass.extend(properties);
} | javascript | function(properties) {
// If a class-like object is passed as properties.extend, just call extend on it
if (properties && properties.extend)
return properties.extend.extend(properties);
// Otherwise, just create a new class with the passed properties
return PseudoClass.extend(properties);
} | [
"function",
"(",
"properties",
")",
"{",
"// If a class-like object is passed as properties.extend, just call extend on it",
"if",
"(",
"properties",
"&&",
"properties",
".",
"extend",
")",
"return",
"properties",
".",
"extend",
".",
"extend",
"(",
"properties",
")",
";... | The base Class implementation acts as extend alias, with the exception that it can take properties.extend as the Class to extend | [
"The",
"base",
"Class",
"implementation",
"acts",
"as",
"extend",
"alias",
"with",
"the",
"exception",
"that",
"it",
"can",
"take",
"properties",
".",
"extend",
"as",
"the",
"Class",
"to",
"extend"
] | 6cb3ac83d18b8782d3943b7461cc4ee0d8f6ce08 | https://github.com/lazd/PseudoClass/blob/6cb3ac83d18b8782d3943b7461cc4ee0d8f6ce08/source/Class.js#L187-L194 | |
47,508 | EightMedia/discodip | lib/render.js | render | function render(q) {
if (!q.length) {
complete();
return;
}
const item = q.shift();
// render HTML file
fs.writeFile(`${item.file}.html`, item.html, err => {
if (err) throw err;
// if prerendering is enabled
if (typeof options.prerender === "object" && options.prerender !== null) {
... | javascript | function render(q) {
if (!q.length) {
complete();
return;
}
const item = q.shift();
// render HTML file
fs.writeFile(`${item.file}.html`, item.html, err => {
if (err) throw err;
// if prerendering is enabled
if (typeof options.prerender === "object" && options.prerender !== null) {
... | [
"function",
"render",
"(",
"q",
")",
"{",
"if",
"(",
"!",
"q",
".",
"length",
")",
"{",
"complete",
"(",
")",
";",
"return",
";",
"}",
"const",
"item",
"=",
"q",
".",
"shift",
"(",
")",
";",
"// render HTML file",
"fs",
".",
"writeFile",
"(",
"`"... | Recursive render
generates component html file
and json file after that | [
"Recursive",
"render",
"generates",
"component",
"html",
"file",
"and",
"json",
"file",
"after",
"that"
] | 9311bf6c7cb774c8663e40fed1c158dffe2690cb | https://github.com/EightMedia/discodip/blob/9311bf6c7cb774c8663e40fed1c158dffe2690cb/lib/render.js#L174-L222 |
47,509 | EightMedia/discodip | lib/render.js | complete | function complete() {
quit();
const deleteQueue = [];
fs.readdir(paths.output, (err, files) => {
if (files) {
// lookup array for quick search inside existing component names
const componentsLookup = components.map(item => {
return slugify(item.meta.name);
});
// loop over fi... | javascript | function complete() {
quit();
const deleteQueue = [];
fs.readdir(paths.output, (err, files) => {
if (files) {
// lookup array for quick search inside existing component names
const componentsLookup = components.map(item => {
return slugify(item.meta.name);
});
// loop over fi... | [
"function",
"complete",
"(",
")",
"{",
"quit",
"(",
")",
";",
"const",
"deleteQueue",
"=",
"[",
"]",
";",
"fs",
".",
"readdir",
"(",
"paths",
".",
"output",
",",
"(",
"err",
",",
"files",
")",
"=>",
"{",
"if",
"(",
"files",
")",
"{",
"// lookup a... | Clean up unused files and shut down | [
"Clean",
"up",
"unused",
"files",
"and",
"shut",
"down"
] | 9311bf6c7cb774c8663e40fed1c158dffe2690cb | https://github.com/EightMedia/discodip/blob/9311bf6c7cb774c8663e40fed1c158dffe2690cb/lib/render.js#L228-L271 |
47,510 | EightMedia/discodip | lib/render.js | removeFile | function removeFile(q) {
if (!q.length) {
process.send(true);
return;
}
const file = q.shift();
rimraf(path.resolve(paths.output, file), { read: false }, () => {
removeFile(q);
});
} | javascript | function removeFile(q) {
if (!q.length) {
process.send(true);
return;
}
const file = q.shift();
rimraf(path.resolve(paths.output, file), { read: false }, () => {
removeFile(q);
});
} | [
"function",
"removeFile",
"(",
"q",
")",
"{",
"if",
"(",
"!",
"q",
".",
"length",
")",
"{",
"process",
".",
"send",
"(",
"true",
")",
";",
"return",
";",
"}",
"const",
"file",
"=",
"q",
".",
"shift",
"(",
")",
";",
"rimraf",
"(",
"path",
".",
... | remove file by passing shorter queue | [
"remove",
"file",
"by",
"passing",
"shorter",
"queue"
] | 9311bf6c7cb774c8663e40fed1c158dffe2690cb | https://github.com/EightMedia/discodip/blob/9311bf6c7cb774c8663e40fed1c158dffe2690cb/lib/render.js#L257-L267 |
47,511 | EightMedia/discodip | lib/render.js | slugify | function slugify(str) {
return str
.toString()
.toLowerCase()
.replace(/\s+/g, "-") // Replace spaces with -
.replace(/[^\w-]+/g, "") // Remove all non-word chars
.replace(/--+/g, "-") // Replace multiple - with single -
.replace(/^-+/, "") // Trim - from start of text
.replace(/-+$/, "");... | javascript | function slugify(str) {
return str
.toString()
.toLowerCase()
.replace(/\s+/g, "-") // Replace spaces with -
.replace(/[^\w-]+/g, "") // Remove all non-word chars
.replace(/--+/g, "-") // Replace multiple - with single -
.replace(/^-+/, "") // Trim - from start of text
.replace(/-+$/, "");... | [
"function",
"slugify",
"(",
"str",
")",
"{",
"return",
"str",
".",
"toString",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"replace",
"(",
"/",
"\\s+",
"/",
"g",
",",
"\"-\"",
")",
"// Replace spaces with -",
".",
"replace",
"(",
"/",
"[^\\w-]+",
"/",... | Basic slugify function
Used to build the output filenames | [
"Basic",
"slugify",
"function",
"Used",
"to",
"build",
"the",
"output",
"filenames"
] | 9311bf6c7cb774c8663e40fed1c158dffe2690cb | https://github.com/EightMedia/discodip/blob/9311bf6c7cb774c8663e40fed1c158dffe2690cb/lib/render.js#L278-L287 |
47,512 | saggiyogesh/nodeportal | lib/PageScript/index.js | PageScript | function PageScript(req) {
var codeList = [], bottomScriptList = [], cacheKey;
/**
* Add plugin load code. Called for each configured plugin on page.
* @param pluginOptions {Object} Plugin options object described in plugin properties
*/
this.addPluginLoad = function (pluginOptions) {
... | javascript | function PageScript(req) {
var codeList = [], bottomScriptList = [], cacheKey;
/**
* Add plugin load code. Called for each configured plugin on page.
* @param pluginOptions {Object} Plugin options object described in plugin properties
*/
this.addPluginLoad = function (pluginOptions) {
... | [
"function",
"PageScript",
"(",
"req",
")",
"{",
"var",
"codeList",
"=",
"[",
"]",
",",
"bottomScriptList",
"=",
"[",
"]",
",",
"cacheKey",
";",
"/**\n * Add plugin load code. Called for each configured plugin on page.\n * @param pluginOptions {Object} Plugin options obj... | Constructor to create a PageScript object for each request.
Client js code added will be rendered at last in the html.
@param req {Object} Request object
@constructor | [
"Constructor",
"to",
"create",
"a",
"PageScript",
"object",
"for",
"each",
"request",
".",
"Client",
"js",
"code",
"added",
"will",
"be",
"rendered",
"at",
"last",
"in",
"the",
"html",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/PageScript/index.js#L25-L104 |
47,513 | saggiyogesh/nodeportal | lib/PageScript/index.js | renderHTML | function renderHTML(callback) {
async.map(codeList, function (locals, n) {
locals.req = req;
ViewHelper.render({
cache: true,
path: SCRIPT_JADE
}, locals, n)
}, function (err, buf) {
if (!err)... | javascript | function renderHTML(callback) {
async.map(codeList, function (locals, n) {
locals.req = req;
ViewHelper.render({
cache: true,
path: SCRIPT_JADE
}, locals, n)
}, function (err, buf) {
if (!err)... | [
"function",
"renderHTML",
"(",
"callback",
")",
"{",
"async",
".",
"map",
"(",
"codeList",
",",
"function",
"(",
"locals",
",",
"n",
")",
"{",
"locals",
".",
"req",
"=",
"req",
";",
"ViewHelper",
".",
"render",
"(",
"{",
"cache",
":",
"true",
",",
... | Function renders html.
@param callback {Function} callback function - arguments - err, html | [
"Function",
"renders",
"html",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/PageScript/index.js#L76-L92 |
47,514 | boneskull/angular-autoselect | demo/demo.js | run | function run($templateCache) {
angular.forEach(examples, function (example) {
$templateCache.put(example.id + '-template', example.html);
$templateCache.put(example.id + '-description', example.description);
});
} | javascript | function run($templateCache) {
angular.forEach(examples, function (example) {
$templateCache.put(example.id + '-template', example.html);
$templateCache.put(example.id + '-description', example.description);
});
} | [
"function",
"run",
"(",
"$templateCache",
")",
"{",
"angular",
".",
"forEach",
"(",
"examples",
",",
"function",
"(",
"example",
")",
"{",
"$templateCache",
".",
"put",
"(",
"example",
".",
"id",
"+",
"'-template'",
",",
"example",
".",
"html",
")",
";",... | Puts the templates into the template cache | [
"Puts",
"the",
"templates",
"into",
"the",
"template",
"cache"
] | ebd8682012ae7d056470410ebecd3269babddd3a | https://github.com/boneskull/angular-autoselect/blob/ebd8682012ae7d056470410ebecd3269babddd3a/demo/demo.js#L44-L49 |
47,515 | boneskull/angular-autoselect | demo/demo.js | ExampleCtrl | function ExampleCtrl($scope, $timeout) {
var pomo_nonsense = 'The fallacy of disciplinary boundaries thematizes the figuralization of civil society.',
regex = /(of\s.+\sboundaries|eht)/;
$scope.reset = function reset() {
delete $scope.data.pomo_nonsense;
$timeout(function () {
$scope.... | javascript | function ExampleCtrl($scope, $timeout) {
var pomo_nonsense = 'The fallacy of disciplinary boundaries thematizes the figuralization of civil society.',
regex = /(of\s.+\sboundaries|eht)/;
$scope.reset = function reset() {
delete $scope.data.pomo_nonsense;
$timeout(function () {
$scope.... | [
"function",
"ExampleCtrl",
"(",
"$scope",
",",
"$timeout",
")",
"{",
"var",
"pomo_nonsense",
"=",
"'The fallacy of disciplinary boundaries thematizes the figuralization of civil society.'",
",",
"regex",
"=",
"/",
"(of\\s.+\\sboundaries|eht)",
"/",
";",
"$scope",
".",
"rese... | Controls a singular example | [
"Controls",
"a",
"singular",
"example"
] | ebd8682012ae7d056470410ebecd3269babddd3a | https://github.com/boneskull/angular-autoselect/blob/ebd8682012ae7d056470410ebecd3269babddd3a/demo/demo.js#L55-L76 |
47,516 | boneskull/angular-autoselect | demo/demo.js | MainCtrl | function MainCtrl($scope, $location) {
$scope.select = function select(id) {
$scope.selected = $scope.selected === id ? null : id;
$location.path('/' + id);
};
$scope.examples = examples;
$scope.select($location.path().substring(1) || examples[0].id);
} | javascript | function MainCtrl($scope, $location) {
$scope.select = function select(id) {
$scope.selected = $scope.selected === id ? null : id;
$location.path('/' + id);
};
$scope.examples = examples;
$scope.select($location.path().substring(1) || examples[0].id);
} | [
"function",
"MainCtrl",
"(",
"$scope",
",",
"$location",
")",
"{",
"$scope",
".",
"select",
"=",
"function",
"select",
"(",
"id",
")",
"{",
"$scope",
".",
"selected",
"=",
"$scope",
".",
"selected",
"===",
"id",
"?",
"null",
":",
"id",
";",
"$location"... | Controls the example navigation | [
"Controls",
"the",
"example",
"navigation"
] | ebd8682012ae7d056470410ebecd3269babddd3a | https://github.com/boneskull/angular-autoselect/blob/ebd8682012ae7d056470410ebecd3269babddd3a/demo/demo.js#L81-L91 |
47,517 | boneskull/angular-autoselect | demo/demo.js | code | function code($window) {
return {
restrict: 'E',
require: '?ngModel',
/**
*
* @param {$rootScope.Scope} scope Element Scope
* @param {angular.element} element AngularJS element
* @param {$compile.directive.Attributes} attrs AngularJS Attributes object
* @param {N... | javascript | function code($window) {
return {
restrict: 'E',
require: '?ngModel',
/**
*
* @param {$rootScope.Scope} scope Element Scope
* @param {angular.element} element AngularJS element
* @param {$compile.directive.Attributes} attrs AngularJS Attributes object
* @param {N... | [
"function",
"code",
"(",
"$window",
")",
"{",
"return",
"{",
"restrict",
":",
"'E'",
",",
"require",
":",
"'?ngModel'",
",",
"/**\n *\n * @param {$rootScope.Scope} scope Element Scope\n * @param {angular.element} element AngularJS element\n * @param {$compile.... | Renders source code with highlight.js
@example
$scope.foo = "var bar = 'baz';";
// <source ng-model="foo" lang="js"></source> | [
"Renders",
"source",
"code",
"with",
"highlight",
".",
"js"
] | ebd8682012ae7d056470410ebecd3269babddd3a | https://github.com/boneskull/angular-autoselect/blob/ebd8682012ae7d056470410ebecd3269babddd3a/demo/demo.js#L100-L127 |
47,518 | levilindsey/physx | src/collisions/src/collision-utils.js | detectIntersection | function detectIntersection(a, b) {
if (a instanceof Sphere) {
if (b instanceof Sphere) {
return sphereCollisionDetection.sphereVsSphere(a, b);
} else if (b instanceof Aabb) {
return sphereCollisionDetection.sphereVsAabb(a, b);
} else if (b instanceof Capsule) {
return sphereCollisionDet... | javascript | function detectIntersection(a, b) {
if (a instanceof Sphere) {
if (b instanceof Sphere) {
return sphereCollisionDetection.sphereVsSphere(a, b);
} else if (b instanceof Aabb) {
return sphereCollisionDetection.sphereVsAabb(a, b);
} else if (b instanceof Capsule) {
return sphereCollisionDet... | [
"function",
"detectIntersection",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"a",
"instanceof",
"Sphere",
")",
"{",
"if",
"(",
"b",
"instanceof",
"Sphere",
")",
"{",
"return",
"sphereCollisionDetection",
".",
"sphereVsSphere",
"(",
"a",
",",
"b",
")",
";",... | This module defines a collection of static utility functions for detecting and responding to
collisions.
@param {Collidable} a
@param {Collidable} b
@returns {boolean} | [
"This",
"module",
"defines",
"a",
"collection",
"of",
"static",
"utility",
"functions",
"for",
"detecting",
"and",
"responding",
"to",
"collisions",
"."
] | 62df9f6968082ed34aa784a23f3db6c8feca6f3a | https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/src/collision-utils.js#L32-L94 |
47,519 | psastras/swagger2aglio | index.js | convert | function convert(program, callback) {
// define no-op callback
if (!callback) {
callback = function (err, blueprint) { }
}
// Read in the file
refparser.parse(program.input, function (err, schema) {
if (err) isMain ? halt(err) : callback(err);
// Read in aglio options
var options = {
t... | javascript | function convert(program, callback) {
// define no-op callback
if (!callback) {
callback = function (err, blueprint) { }
}
// Read in the file
refparser.parse(program.input, function (err, schema) {
if (err) isMain ? halt(err) : callback(err);
// Read in aglio options
var options = {
t... | [
"function",
"convert",
"(",
"program",
",",
"callback",
")",
"{",
"// define no-op callback",
"if",
"(",
"!",
"callback",
")",
"{",
"callback",
"=",
"function",
"(",
"err",
",",
"blueprint",
")",
"{",
"}",
"}",
"// Read in the file",
"refparser",
".",
"parse... | End program
Helper functions | [
"End",
"program",
"Helper",
"functions"
] | 42869876ecd28526a68814c07a93ccf188127f06 | https://github.com/psastras/swagger2aglio/blob/42869876ecd28526a68814c07a93ccf188127f06/index.js#L44-L117 |
47,520 | psastras/swagger2aglio | index.js | check_input | function check_input(input, message) {
if (!input) {
error('\n Error: ' + message);
program.outputHelp(colors.red);
process.exit(1);
}
} | javascript | function check_input(input, message) {
if (!input) {
error('\n Error: ' + message);
program.outputHelp(colors.red);
process.exit(1);
}
} | [
"function",
"check_input",
"(",
"input",
",",
"message",
")",
"{",
"if",
"(",
"!",
"input",
")",
"{",
"error",
"(",
"'\\n Error: '",
"+",
"message",
")",
";",
"program",
".",
"outputHelp",
"(",
"colors",
".",
"red",
")",
";",
"process",
".",
"exit",
... | Checks that the given input is defined. If it is defined, this is a no-op. Else
this prints the error message and halts the program with exit code 1.
@param {input} input - The input to check
@param {message} txt - The text to display if the check fails | [
"Checks",
"that",
"the",
"given",
"input",
"is",
"defined",
".",
"If",
"it",
"is",
"defined",
"this",
"is",
"a",
"no",
"-",
"op",
".",
"Else",
"this",
"prints",
"the",
"error",
"message",
"and",
"halts",
"the",
"program",
"with",
"exit",
"code",
"1",
... | 42869876ecd28526a68814c07a93ccf188127f06 | https://github.com/psastras/swagger2aglio/blob/42869876ecd28526a68814c07a93ccf188127f06/index.js#L125-L131 |
47,521 | slideme/rorschach | lib/builders/create.js | adjustPath | function adjustPath(builder, path) {
if (builder.protection) {
var pathAndNode = utils.pathAndNode(path);
var nodeName = getProtectedPrefix(builder.protectedId) + pathAndNode.node;
path = utils.join(pathAndNode.path, nodeName);
}
return path;
} | javascript | function adjustPath(builder, path) {
if (builder.protection) {
var pathAndNode = utils.pathAndNode(path);
var nodeName = getProtectedPrefix(builder.protectedId) + pathAndNode.node;
path = utils.join(pathAndNode.path, nodeName);
}
return path;
} | [
"function",
"adjustPath",
"(",
"builder",
",",
"path",
")",
"{",
"if",
"(",
"builder",
".",
"protection",
")",
"{",
"var",
"pathAndNode",
"=",
"utils",
".",
"pathAndNode",
"(",
"path",
")",
";",
"var",
"nodeName",
"=",
"getProtectedPrefix",
"(",
"builder",... | Get final path
@param {CreateBuilder} builder
@param {String} path | [
"Get",
"final",
"path"
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/builders/create.js#L98-L105 |
47,522 | slideme/rorschach | lib/builders/create.js | findNode | function findNode(children, path, protectedId) {
var prefix = getProtectedPrefix(protectedId);
var i = 0;
var node;
while ((node = children[i++])) {
if (node.indexOf(prefix) === 0) {
return utils.join(path, node);
}
}
return null;
} | javascript | function findNode(children, path, protectedId) {
var prefix = getProtectedPrefix(protectedId);
var i = 0;
var node;
while ((node = children[i++])) {
if (node.indexOf(prefix) === 0) {
return utils.join(path, node);
}
}
return null;
} | [
"function",
"findNode",
"(",
"children",
",",
"path",
",",
"protectedId",
")",
"{",
"var",
"prefix",
"=",
"getProtectedPrefix",
"(",
"protectedId",
")",
";",
"var",
"i",
"=",
"0",
";",
"var",
"node",
";",
"while",
"(",
"(",
"node",
"=",
"children",
"["... | Find znode among children list with given prefix.
@param {Array.<String>} children
@param {String} path
@param {String} protectedId
@returns {String|null} | [
"Find",
"znode",
"among",
"children",
"list",
"with",
"given",
"prefix",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/builders/create.js#L173-L183 |
47,523 | slideme/rorschach | lib/builders/create.js | findProtectedNode | function findProtectedNode(builder, path, callback) {
var zk = builder.client.zk;
var pathAndNode = utils.pathAndNode(path);
zk.getChildren(pathAndNode.path, afterCheck);
function afterCheck(err, children) {
if (err && err.getCode() === Exception.NO_NODE) {
callback();
}
else if (err) {
... | javascript | function findProtectedNode(builder, path, callback) {
var zk = builder.client.zk;
var pathAndNode = utils.pathAndNode(path);
zk.getChildren(pathAndNode.path, afterCheck);
function afterCheck(err, children) {
if (err && err.getCode() === Exception.NO_NODE) {
callback();
}
else if (err) {
... | [
"function",
"findProtectedNode",
"(",
"builder",
",",
"path",
",",
"callback",
")",
"{",
"var",
"zk",
"=",
"builder",
".",
"client",
".",
"zk",
";",
"var",
"pathAndNode",
"=",
"utils",
".",
"pathAndNode",
"(",
"path",
")",
";",
"zk",
".",
"getChildren",
... | Try to find protected node with same `protectedId`.
@param {CreateBuilder} builder Builder instance
@param {String} path Desired path
@param {Function} callback Callback function: <code>(err, nodePath)</code> | [
"Try",
"to",
"find",
"protected",
"node",
"with",
"same",
"protectedId",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/builders/create.js#L195-L215 |
47,524 | slideme/rorschach | lib/builders/create.js | performCreate | function performCreate(builder, path, data, callback) {
var client = builder.client;
var zk = client.zk;
var firstTime = true;
client.retryLoop(exec, callback);
function exec(cb) {
if (firstTime && builder.protection) {
findProtectedNode(builder, path, createIfNotExist);
}
else {
cre... | javascript | function performCreate(builder, path, data, callback) {
var client = builder.client;
var zk = client.zk;
var firstTime = true;
client.retryLoop(exec, callback);
function exec(cb) {
if (firstTime && builder.protection) {
findProtectedNode(builder, path, createIfNotExist);
}
else {
cre... | [
"function",
"performCreate",
"(",
"builder",
",",
"path",
",",
"data",
",",
"callback",
")",
"{",
"var",
"client",
"=",
"builder",
".",
"client",
";",
"var",
"zk",
"=",
"client",
".",
"zk",
";",
"var",
"firstTime",
"=",
"true",
";",
"client",
".",
"r... | Create node and it's parents if needed.
@param {CreateBuilder} builder
@param {String} path Node path
@param {Buffer} data Node data
@param {Function} callback Callback function: <code>(err)</code> | [
"Create",
"node",
"and",
"it",
"s",
"parents",
"if",
"needed",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/builders/create.js#L290-L332 |
47,525 | fvsch/gulp-task-maker | example/tasks/mincss/index.js | mincss | function mincss(config, tools) {
return tools.simpleStream(config, [
config.autoprefixer && autoprefixer(config.autoprefixer),
config.concat && concat(config.concat),
config.minify && csso(config.csso)
])
} | javascript | function mincss(config, tools) {
return tools.simpleStream(config, [
config.autoprefixer && autoprefixer(config.autoprefixer),
config.concat && concat(config.concat),
config.minify && csso(config.csso)
])
} | [
"function",
"mincss",
"(",
"config",
",",
"tools",
")",
"{",
"return",
"tools",
".",
"simpleStream",
"(",
"config",
",",
"[",
"config",
".",
"autoprefixer",
"&&",
"autoprefixer",
"(",
"config",
".",
"autoprefixer",
")",
",",
"config",
".",
"concat",
"&&",
... | Make a CSS build, optionally concatenated and minified
@param {object} config - task configuration
@param {object} tools - gtm utility functions
@return {object} | [
"Make",
"a",
"CSS",
"build",
"optionally",
"concatenated",
"and",
"minified"
] | 20ab4245f2d75174786ad140793e9438c025d546 | https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/example/tasks/mincss/index.js#L11-L17 |
47,526 | saggiyogesh/nodeportal | lib/Renderer/PageRenderer.js | PageRenderer | function PageRenderer(req, res) {
var page = req.attrs.page;
Object.defineProperties(this, {
req: {
value: req
},
res: {
value: res
},
page: {
value: _.clone(page)
},
themeDBAction: {
value: DBActions.getInst... | javascript | function PageRenderer(req, res) {
var page = req.attrs.page;
Object.defineProperties(this, {
req: {
value: req
},
res: {
value: res
},
page: {
value: _.clone(page)
},
themeDBAction: {
value: DBActions.getInst... | [
"function",
"PageRenderer",
"(",
"req",
",",
"res",
")",
"{",
"var",
"page",
"=",
"req",
".",
"attrs",
".",
"page",
";",
"Object",
".",
"defineProperties",
"(",
"this",
",",
"{",
"req",
":",
"{",
"value",
":",
"req",
"}",
",",
"res",
":",
"{",
"v... | Constructor to create PageRenderer to render page for current request
@param req
@param res
@constructor | [
"Constructor",
"to",
"create",
"PageRenderer",
"to",
"render",
"page",
"for",
"current",
"request"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/Renderer/PageRenderer.js#L35-L69 |
47,527 | Ajedi32/metalsmith-matters | lib/index.js | extractFrontmatter | function extractFrontmatter(file, filePath, options, grayMatterOptions){
if (utf8(file.contents)) {
var parsed;
try {
parsed = matter(file.contents.toString(), grayMatterOptions);
} catch (e) {
var errMsg = 'Invalid frontmatter in file';
if (filePath !== undefined) errMsg += ": " + file... | javascript | function extractFrontmatter(file, filePath, options, grayMatterOptions){
if (utf8(file.contents)) {
var parsed;
try {
parsed = matter(file.contents.toString(), grayMatterOptions);
} catch (e) {
var errMsg = 'Invalid frontmatter in file';
if (filePath !== undefined) errMsg += ": " + file... | [
"function",
"extractFrontmatter",
"(",
"file",
",",
"filePath",
",",
"options",
",",
"grayMatterOptions",
")",
"{",
"if",
"(",
"utf8",
"(",
"file",
".",
"contents",
")",
")",
"{",
"var",
"parsed",
";",
"try",
"{",
"parsed",
"=",
"matter",
"(",
"file",
... | Assign metadata in `file` based on the YAML frontmatter in `file.contents`.
@param {Object} file The Metalsmith file object to extract frontmatter from
@param {string} filePath The path to the file represented by `file`
@param {Object} options Options for the extraction routine
@param {Object} grayMatterOptions Option... | [
"Assign",
"metadata",
"in",
"file",
"based",
"on",
"the",
"YAML",
"frontmatter",
"in",
"file",
".",
"contents",
"."
] | 42393d7c0ebf7df35c4eccef40018075c160b31c | https://github.com/Ajedi32/metalsmith-matters/blob/42393d7c0ebf7df35c4eccef40018075c160b31c/lib/index.js#L19-L42 |
47,528 | Ajedi32/metalsmith-matters | lib/index.js | frontmatter | function frontmatter(opts){
var options = {}, grayMatterOptions = {};
Object.keys(opts || {}).forEach(function(key){
if (key === 'namespace'){
options[key] = opts[key];
} else {
grayMatterOptions[key] = opts[key];
}
});
return each(function(file, filePath){
extractFrontmatter(file, ... | javascript | function frontmatter(opts){
var options = {}, grayMatterOptions = {};
Object.keys(opts || {}).forEach(function(key){
if (key === 'namespace'){
options[key] = opts[key];
} else {
grayMatterOptions[key] = opts[key];
}
});
return each(function(file, filePath){
extractFrontmatter(file, ... | [
"function",
"frontmatter",
"(",
"opts",
")",
"{",
"var",
"options",
"=",
"{",
"}",
",",
"grayMatterOptions",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"opts",
"||",
"{",
"}",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"if",
... | Metalsmith plugin to extract metadata from frontmatter in file contents.
@param {Object} options - `Namespace` is used, the rest is passed on to `gray-matter`
@return {Function} | [
"Metalsmith",
"plugin",
"to",
"extract",
"metadata",
"from",
"frontmatter",
"in",
"file",
"contents",
"."
] | 42393d7c0ebf7df35c4eccef40018075c160b31c | https://github.com/Ajedi32/metalsmith-matters/blob/42393d7c0ebf7df35c4eccef40018075c160b31c/lib/index.js#L50-L63 |
47,529 | saggiyogesh/nodeportal | lib/plugins.js | loadPlugin | function loadPlugin(id) {
var plugin = PLUGINS[id];
plugin.exec.load(plugin.id, {
id: plugin.id
});
} | javascript | function loadPlugin(id) {
var plugin = PLUGINS[id];
plugin.exec.load(plugin.id, {
id: plugin.id
});
} | [
"function",
"loadPlugin",
"(",
"id",
")",
"{",
"var",
"plugin",
"=",
"PLUGINS",
"[",
"id",
"]",
";",
"plugin",
".",
"exec",
".",
"load",
"(",
"plugin",
".",
"id",
",",
"{",
"id",
":",
"plugin",
".",
"id",
"}",
")",
";",
"}"
] | After adding a plugin, it also should be loaded, otherwise it'll raise an err for listenload event | [
"After",
"adding",
"a",
"plugin",
"it",
"also",
"should",
"be",
"loaded",
"otherwise",
"it",
"ll",
"raise",
"an",
"err",
"for",
"listenload",
"event"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/plugins.js#L45-L50 |
47,530 | yuanqing/modal | modal.js | bindToClick | function bindToClick(selector, handler) {
var elems = document.querySelectorAll(selector);
var i = -1;
var len = elems.length;
while (++i < len) {
elems[i].addEventListener('click', handler);
}
} | javascript | function bindToClick(selector, handler) {
var elems = document.querySelectorAll(selector);
var i = -1;
var len = elems.length;
while (++i < len) {
elems[i].addEventListener('click', handler);
}
} | [
"function",
"bindToClick",
"(",
"selector",
",",
"handler",
")",
"{",
"var",
"elems",
"=",
"document",
".",
"querySelectorAll",
"(",
"selector",
")",
";",
"var",
"i",
"=",
"-",
"1",
";",
"var",
"len",
"=",
"elems",
".",
"length",
";",
"while",
"(",
"... | Binds the given `handler` to all elements that match the `selector`. | [
"Binds",
"the",
"given",
"handler",
"to",
"all",
"elements",
"that",
"match",
"the",
"selector",
"."
] | f9a4913a427e022d649956d11c160ceed33213d3 | https://github.com/yuanqing/modal/blob/f9a4913a427e022d649956d11c160ceed33213d3/modal.js#L26-L33 |
47,531 | shlomiassaf/resty-stone | lib/decoration/sessionDecorator.js | sessionDecorator | function sessionDecorator() {
// save token header to be used in cookieParserDecorator middleware.
tokenHeaderName = rs.keystone.get('resty token header');
rs.keystone.session = RestySession.factory(rs.keystone);
rs.keystone.set('session', rs.keystone.session.persist);
} | javascript | function sessionDecorator() {
// save token header to be used in cookieParserDecorator middleware.
tokenHeaderName = rs.keystone.get('resty token header');
rs.keystone.session = RestySession.factory(rs.keystone);
rs.keystone.set('session', rs.keystone.session.persist);
} | [
"function",
"sessionDecorator",
"(",
")",
"{",
"// save token header to be used in cookieParserDecorator middleware.",
"tokenHeaderName",
"=",
"rs",
".",
"keystone",
".",
"get",
"(",
"'resty token header'",
")",
";",
"rs",
".",
"keystone",
".",
"session",
"=",
"RestySes... | Replaces keystone session API with a proxy to handle authentication different the cookie auth.
@param keystone | [
"Replaces",
"keystone",
"session",
"API",
"with",
"a",
"proxy",
"to",
"handle",
"authentication",
"different",
"the",
"cookie",
"auth",
"."
] | 9ab093272ea7b68c6fe0aba45384206571896295 | https://github.com/shlomiassaf/resty-stone/blob/9ab093272ea7b68c6fe0aba45384206571896295/lib/decoration/sessionDecorator.js#L14-L20 |
47,532 | shlomiassaf/resty-stone | lib/decoration/sessionDecorator.js | cookieParserDecorator | function cookieParserDecorator(req, res, next) {
// run express.cookieParser() only when were not visiting the api.
if (req.isResty) {
// get token from headers.
var token = req.headers[tokenHeaderName] || undefined;
if (token) {
try {
// decode token, it hol... | javascript | function cookieParserDecorator(req, res, next) {
// run express.cookieParser() only when were not visiting the api.
if (req.isResty) {
// get token from headers.
var token = req.headers[tokenHeaderName] || undefined;
if (token) {
try {
// decode token, it hol... | [
"function",
"cookieParserDecorator",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"// run express.cookieParser() only when were not visiting the api.",
"if",
"(",
"req",
".",
"isResty",
")",
"{",
"// get token from headers.",
"var",
"token",
"=",
"req",
".",
"header... | Replace the default cookie parser with a proxy cookie parser middleware.
The proxy is then used to decide what parser is right for the task.
If we are not in the api realm, use the default cookie parser.
In any other case, use the appropriate one.
This approach is used to create fake "cookie" data.
By faking cookie da... | [
"Replace",
"the",
"default",
"cookie",
"parser",
"with",
"a",
"proxy",
"cookie",
"parser",
"middleware",
".",
"The",
"proxy",
"is",
"then",
"used",
"to",
"decide",
"what",
"parser",
"is",
"right",
"for",
"the",
"task",
".",
"If",
"we",
"are",
"not",
"in"... | 9ab093272ea7b68c6fe0aba45384206571896295 | https://github.com/shlomiassaf/resty-stone/blob/9ab093272ea7b68c6fe0aba45384206571896295/lib/decoration/sessionDecorator.js#L34-L71 |
47,533 | ForbesLindesay/stop | lib/status-codes.js | statusCodes | function statusCodes(allowed, ignored, options) {
var stream = new Transform({objectMode: true});
var errored = false;
stream._transform = function (page, _, callback) {
if (errored) return callback(null);
if (ignored && ignored.indexOf(page.statusCode) !== -1) return callback(null);
if (!allowed || ... | javascript | function statusCodes(allowed, ignored, options) {
var stream = new Transform({objectMode: true});
var errored = false;
stream._transform = function (page, _, callback) {
if (errored) return callback(null);
if (ignored && ignored.indexOf(page.statusCode) !== -1) return callback(null);
if (!allowed || ... | [
"function",
"statusCodes",
"(",
"allowed",
",",
"ignored",
",",
"options",
")",
"{",
"var",
"stream",
"=",
"new",
"Transform",
"(",
"{",
"objectMode",
":",
"true",
"}",
")",
";",
"var",
"errored",
"=",
"false",
";",
"stream",
".",
"_transform",
"=",
"f... | Limit status codes to a list of allowed status codes
@param {Array.<Number>} allowed
@param {Array.<Number>} ignored
@returns {TransformStream} | [
"Limit",
"status",
"codes",
"to",
"a",
"list",
"of",
"allowed",
"status",
"codes"
] | 61db8899bdde604dc45cfc8f11fffa1beaa27abb | https://github.com/ForbesLindesay/stop/blob/61db8899bdde604dc45cfc8f11fffa1beaa27abb/lib/status-codes.js#L14-L31 |
47,534 | slideme/rorschach | lib/ReadWriteLock.js | ReadWriteLock | function ReadWriteLock(client, basePath) {
var readLockDriver = new ReadLockDriver(this);
var writeLockDriver = new SortingLockDriver();
/**
* Read mutex.
*
* @type {Lock}
*/
this.readMutex = new Lock(client, basePath, READ_LOCK_NAME, readLockDriver);
this.readMutex.setMaxLeases(Infinity);
/... | javascript | function ReadWriteLock(client, basePath) {
var readLockDriver = new ReadLockDriver(this);
var writeLockDriver = new SortingLockDriver();
/**
* Read mutex.
*
* @type {Lock}
*/
this.readMutex = new Lock(client, basePath, READ_LOCK_NAME, readLockDriver);
this.readMutex.setMaxLeases(Infinity);
/... | [
"function",
"ReadWriteLock",
"(",
"client",
",",
"basePath",
")",
"{",
"var",
"readLockDriver",
"=",
"new",
"ReadLockDriver",
"(",
"this",
")",
";",
"var",
"writeLockDriver",
"=",
"new",
"SortingLockDriver",
"(",
")",
";",
"/**\n * Read mutex.\n *\n * @type {L... | Implementation of re-entrant readers-writer mutex.
@constructor
@param {Rorschach} client Rorschach instance
@param {String} basePath Base lock path | [
"Implementation",
"of",
"re",
"-",
"entrant",
"readers",
"-",
"writer",
"mutex",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/ReadWriteLock.js#L42-L63 |
47,535 | shinout/LineStream | LineStream.js | emit | function emit() {
if (arguments.length) this.emitted.push(arguments);
while (!this.paused && this.emitted.length && this.readable) {
var emitArgs = this.emitted.shift();
this.emit.apply(this, emitArgs);
if (emitArgs[0] == 'end') {
this.readable = false;
}
}
} | javascript | function emit() {
if (arguments.length) this.emitted.push(arguments);
while (!this.paused && this.emitted.length && this.readable) {
var emitArgs = this.emitted.shift();
this.emit.apply(this, emitArgs);
if (emitArgs[0] == 'end') {
this.readable = false;
}
}
} | [
"function",
"emit",
"(",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
")",
"this",
".",
"emitted",
".",
"push",
"(",
"arguments",
")",
";",
"while",
"(",
"!",
"this",
".",
"paused",
"&&",
"this",
".",
"emitted",
".",
"length",
"&&",
"this",
"."... | add emit events to the event queue.
(private method) | [
"add",
"emit",
"events",
"to",
"the",
"event",
"queue",
"."
] | 7df667d67521b9c2145901117ea61a35b2d4b55c | https://github.com/shinout/LineStream/blob/7df667d67521b9c2145901117ea61a35b2d4b55c/LineStream.js#L220-L229 |
47,536 | shinout/LineStream | LineStream.js | emitLine | function emitLine(line, isEnd) {
if (this.filters.every(function(fn) { return fn(line) }))
emit.call(this, 'data', line, !!isEnd);
} | javascript | function emitLine(line, isEnd) {
if (this.filters.every(function(fn) { return fn(line) }))
emit.call(this, 'data', line, !!isEnd);
} | [
"function",
"emitLine",
"(",
"line",
",",
"isEnd",
")",
"{",
"if",
"(",
"this",
".",
"filters",
".",
"every",
"(",
"function",
"(",
"fn",
")",
"{",
"return",
"fn",
"(",
"line",
")",
"}",
")",
")",
"emit",
".",
"call",
"(",
"this",
",",
"'data'",
... | emit data event if the given line is valid.
(private method) | [
"emit",
"data",
"event",
"if",
"the",
"given",
"line",
"is",
"valid",
"."
] | 7df667d67521b9c2145901117ea61a35b2d4b55c | https://github.com/shinout/LineStream/blob/7df667d67521b9c2145901117ea61a35b2d4b55c/LineStream.js#L237-L240 |
47,537 | Raynos/contract | src/contract.js | _create | function _create(f) {
var c = Object.create(Contract);
c._wrapped = f;
return c;
} | javascript | function _create(f) {
var c = Object.create(Contract);
c._wrapped = f;
return c;
} | [
"function",
"_create",
"(",
"f",
")",
"{",
"var",
"c",
"=",
"Object",
".",
"create",
"(",
"Contract",
")",
";",
"c",
".",
"_wrapped",
"=",
"f",
";",
"return",
"c",
";",
"}"
] | ContractFactory generates a new Contract based on the passed function `f` | [
"ContractFactory",
"generates",
"a",
"new",
"Contract",
"based",
"on",
"the",
"passed",
"function",
"f"
] | 4e41fffe494e2844fd6df7924ef43cfa1d6936b9 | https://github.com/Raynos/contract/blob/4e41fffe494e2844fd6df7924ef43cfa1d6936b9/src/contract.js#L77-L81 |
47,538 | Raynos/contract | src/contract.js | defineProperties | function defineProperties(obj) {
Object.defineProperties(obj, {
"pre": {
value: Contract.pre,
configurable: true
},
"post": {
value: Contract.post,
configurable: true
},
"invariant": {
value: Contract.invariant,
... | javascript | function defineProperties(obj) {
Object.defineProperties(obj, {
"pre": {
value: Contract.pre,
configurable: true
},
"post": {
value: Contract.post,
configurable: true
},
"invariant": {
value: Contract.invariant,
... | [
"function",
"defineProperties",
"(",
"obj",
")",
"{",
"Object",
".",
"defineProperties",
"(",
"obj",
",",
"{",
"\"pre\"",
":",
"{",
"value",
":",
"Contract",
".",
"pre",
",",
"configurable",
":",
"true",
"}",
",",
"\"post\"",
":",
"{",
"value",
":",
"C... | Define the pre, post & invariant objects onto an object. | [
"Define",
"the",
"pre",
"post",
"&",
"invariant",
"objects",
"onto",
"an",
"object",
"."
] | 4e41fffe494e2844fd6df7924ef43cfa1d6936b9 | https://github.com/Raynos/contract/blob/4e41fffe494e2844fd6df7924ef43cfa1d6936b9/src/contract.js#L104-L119 |
47,539 | EightMedia/discodip | lib/puppeteer.js | getHeight | async function getHeight(url) {
await page.goto(url);
const height = await page.evaluate(() => {
return document.body.getBoundingClientRect().height;
});
return height;
} | javascript | async function getHeight(url) {
await page.goto(url);
const height = await page.evaluate(() => {
return document.body.getBoundingClientRect().height;
});
return height;
} | [
"async",
"function",
"getHeight",
"(",
"url",
")",
"{",
"await",
"page",
".",
"goto",
"(",
"url",
")",
";",
"const",
"height",
"=",
"await",
"page",
".",
"evaluate",
"(",
"(",
")",
"=>",
"{",
"return",
"document",
".",
"body",
".",
"getBoundingClientRe... | Get page height | [
"Get",
"page",
"height"
] | 9311bf6c7cb774c8663e40fed1c158dffe2690cb | https://github.com/EightMedia/discodip/blob/9311bf6c7cb774c8663e40fed1c158dffe2690cb/lib/puppeteer.js#L26-L34 |
47,540 | fvsch/gulp-task-maker | add.js | defineTasksForConfig | function defineTasksForConfig(taskData) {
// Define gulp tasks (build and optionally watch)
// For the task name:
// - single config, no 'name' key: <callback>
// - single config, 'name' key: <callback>_<name>
// - multiple configs, no 'name' key: <callback>_<index>
const { callback, name, normalizedConfigs... | javascript | function defineTasksForConfig(taskData) {
// Define gulp tasks (build and optionally watch)
// For the task name:
// - single config, no 'name' key: <callback>
// - single config, 'name' key: <callback>_<name>
// - multiple configs, no 'name' key: <callback>_<index>
const { callback, name, normalizedConfigs... | [
"function",
"defineTasksForConfig",
"(",
"taskData",
")",
"{",
"// Define gulp tasks (build and optionally watch)",
"// For the task name:",
"// - single config, no 'name' key: <callback>",
"// - single config, 'name' key: <callback>_<name>",
"// - multiple configs, no 'name' key: <callback>_<in... | Register matching 'build' and 'watch' gulp tasks
@param {object} taskData | [
"Register",
"matching",
"build",
"and",
"watch",
"gulp",
"tasks"
] | 20ab4245f2d75174786ad140793e9438c025d546 | https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/add.js#L107-L142 |
47,541 | fvsch/gulp-task-maker | add.js | getTaskCallback | function getTaskCallback(callback) {
let result = null
// Get the callback function; throw errors, because we can't log them
// later until we have identified a task name
if (typeof callback === 'function') {
result = callback
} else if (typeof callback === 'string') {
let id = callback.trim()
// ... | javascript | function getTaskCallback(callback) {
let result = null
// Get the callback function; throw errors, because we can't log them
// later until we have identified a task name
if (typeof callback === 'function') {
result = callback
} else if (typeof callback === 'string') {
let id = callback.trim()
// ... | [
"function",
"getTaskCallback",
"(",
"callback",
")",
"{",
"let",
"result",
"=",
"null",
"// Get the callback function; throw errors, because we can't log them",
"// later until we have identified a task name",
"if",
"(",
"typeof",
"callback",
"===",
"'function'",
")",
"{",
"r... | Check that a declared task uses a valid callback function
@param {string|Function} callback
@return {Function}
@throws {Error} | [
"Check",
"that",
"a",
"declared",
"task",
"uses",
"a",
"valid",
"callback",
"function"
] | 20ab4245f2d75174786ad140793e9438c025d546 | https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/add.js#L150-L191 |
47,542 | jlewczyk/git-hooks-js-win | lib/git-hooks.js | function (workingDirectory) {
var gitPath = getClosestGitPath(workingDirectory);
if (!gitPath) {
throw new Error('git-hooks must be run inside a git repository');
}
var hooksPath = path.resolve(gitPath, HOOKS_DIRNAME);
var hooksOldPath = path.resolve(gitPath, HOOKS_... | javascript | function (workingDirectory) {
var gitPath = getClosestGitPath(workingDirectory);
if (!gitPath) {
throw new Error('git-hooks must be run inside a git repository');
}
var hooksPath = path.resolve(gitPath, HOOKS_DIRNAME);
var hooksOldPath = path.resolve(gitPath, HOOKS_... | [
"function",
"(",
"workingDirectory",
")",
"{",
"var",
"gitPath",
"=",
"getClosestGitPath",
"(",
"workingDirectory",
")",
";",
"if",
"(",
"!",
"gitPath",
")",
"{",
"throw",
"new",
"Error",
"(",
"'git-hooks must be run inside a git repository'",
")",
";",
"}",
"va... | Uninstalls git hooks.
@param {String} [workingDirectory]
@throws {Error} | [
"Uninstalls",
"git",
"hooks",
"."
] | e156f88ad7aec76c9180c70656c5568ad89f9de7 | https://github.com/jlewczyk/git-hooks-js-win/blob/e156f88ad7aec76c9180c70656c5568ad89f9de7/lib/git-hooks.js#L96-L115 | |
47,543 | jlewczyk/git-hooks-js-win | lib/git-hooks.js | spawnHook | function spawnHook(hookName, args) {
var stats = fs.statSync(hookName);
var command = hookName;
var opts = args;
var hook;
if (isWin32) {
hook = fs.readFileSync(hookName).toString();
if (!require('shebang-regex').test(hook)) {
throw new Error('Cannot find shebang in hook... | javascript | function spawnHook(hookName, args) {
var stats = fs.statSync(hookName);
var command = hookName;
var opts = args;
var hook;
if (isWin32) {
hook = fs.readFileSync(hookName).toString();
if (!require('shebang-regex').test(hook)) {
throw new Error('Cannot find shebang in hook... | [
"function",
"spawnHook",
"(",
"hookName",
",",
"args",
")",
"{",
"var",
"stats",
"=",
"fs",
".",
"statSync",
"(",
"hookName",
")",
";",
"var",
"command",
"=",
"hookName",
";",
"var",
"opts",
"=",
"args",
";",
"var",
"hook",
";",
"if",
"(",
"isWin32",... | Spawns hook as a separate process.
@param {String} hookName
@param {String[]} args
@returns {ChildProcess} | [
"Spawns",
"hook",
"as",
"a",
"separate",
"process",
"."
] | e156f88ad7aec76c9180c70656c5568ad89f9de7 | https://github.com/jlewczyk/git-hooks-js-win/blob/e156f88ad7aec76c9180c70656c5568ad89f9de7/lib/git-hooks.js#L185-L205 |
47,544 | jlewczyk/git-hooks-js-win | lib/git-hooks.js | getClosestGitPath | function getClosestGitPath(currentPath) {
currentPath = currentPath || process.cwd();
var dirnamePath = path.join(currentPath, '.git');
if (fsHelpers.exists(dirnamePath)) {
return dirnamePath;
}
var nextPath = path.resolve(currentPath, '..');
if (nextPath === currentPath) {
r... | javascript | function getClosestGitPath(currentPath) {
currentPath = currentPath || process.cwd();
var dirnamePath = path.join(currentPath, '.git');
if (fsHelpers.exists(dirnamePath)) {
return dirnamePath;
}
var nextPath = path.resolve(currentPath, '..');
if (nextPath === currentPath) {
r... | [
"function",
"getClosestGitPath",
"(",
"currentPath",
")",
"{",
"currentPath",
"=",
"currentPath",
"||",
"process",
".",
"cwd",
"(",
")",
";",
"var",
"dirnamePath",
"=",
"path",
".",
"join",
"(",
"currentPath",
",",
"'.git'",
")",
";",
"if",
"(",
"fsHelpers... | Returns the closest git directory.
It starts looking from the current directory and does it up to the fs root.
It returns undefined in case where the specified directory isn't found.
@param {String} [currentPath] Current started path to search.
@returns {String|undefined} | [
"Returns",
"the",
"closest",
"git",
"directory",
".",
"It",
"starts",
"looking",
"from",
"the",
"current",
"directory",
"and",
"does",
"it",
"up",
"to",
"the",
"fs",
"root",
".",
"It",
"returns",
"undefined",
"in",
"case",
"where",
"the",
"specified",
"dir... | e156f88ad7aec76c9180c70656c5568ad89f9de7 | https://github.com/jlewczyk/git-hooks-js-win/blob/e156f88ad7aec76c9180c70656c5568ad89f9de7/lib/git-hooks.js#L215-L231 |
47,545 | saggiyogesh/nodeportal | public/js/fileuploader.js | function(parent, type){
var element = qq.getByClass(parent, this._options.classes[type])[0];
if (!element){
throw new Error('element not found ' + type);
}
return element;
} | javascript | function(parent, type){
var element = qq.getByClass(parent, this._options.classes[type])[0];
if (!element){
throw new Error('element not found ' + type);
}
return element;
} | [
"function",
"(",
"parent",
",",
"type",
")",
"{",
"var",
"element",
"=",
"qq",
".",
"getByClass",
"(",
"parent",
",",
"this",
".",
"_options",
".",
"classes",
"[",
"type",
"]",
")",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"element",
")",
"{",
"throw"... | Gets one of the elements listed in this._options.classes | [
"Gets",
"one",
"of",
"the",
"elements",
"listed",
"in",
"this",
".",
"_options",
".",
"classes"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/js/fileuploader.js#L542-L549 | |
47,546 | saggiyogesh/nodeportal | public/js/fileuploader.js | function(){
var self = this,
list = this._listElement;
qq.attach(list, 'click', function(e){
e = e || window.event;
var target = e.target || e.srcElement;
if (qq.hasClass(target, self._classes.cancel)){ ... | javascript | function(){
var self = this,
list = this._listElement;
qq.attach(list, 'click', function(e){
e = e || window.event;
var target = e.target || e.srcElement;
if (qq.hasClass(target, self._classes.cancel)){ ... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"list",
"=",
"this",
".",
"_listElement",
";",
"qq",
".",
"attach",
"(",
"list",
",",
"'click'",
",",
"function",
"(",
"e",
")",
"{",
"e",
"=",
"e",
"||",
"window",
".",
"event",
";",
... | delegate click event for cancel link | [
"delegate",
"click",
"event",
"for",
"cancel",
"link"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/js/fileuploader.js#L647-L663 | |
47,547 | saggiyogesh/nodeportal | public/js/fileuploader.js | function(id){
// We can't use following code as the name attribute
// won't be properly registered in IE6, and new window
// on form submit will open
// var iframe = document.createElement('iframe');
// iframe.setAttribute('name', id);
var iframe = qq.toElement('<iframe ... | javascript | function(id){
// We can't use following code as the name attribute
// won't be properly registered in IE6, and new window
// on form submit will open
// var iframe = document.createElement('iframe');
// iframe.setAttribute('name', id);
var iframe = qq.toElement('<iframe ... | [
"function",
"(",
"id",
")",
"{",
"// We can't use following code as the name attribute",
"// won't be properly registered in IE6, and new window",
"// on form submit will open",
"// var iframe = document.createElement('iframe');",
"// iframe.setAttribute('name', id);",
"var",
"iframe",
"=",
... | Creates iframe with unique name | [
"Creates",
"iframe",
"with",
"unique",
"name"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/js/fileuploader.js#L1074-L1090 | |
47,548 | slawrence/grunt-properties-reader | tasks/properties_reader.js | _convertStringIfTrue | function _convertStringIfTrue(original) {
var str;
if (original && typeof original === "string") {
str = original.toLowerCase().trim();
return (str === "true" || str === "false") ? (str === "true") : original;
}
return original;
} | javascript | function _convertStringIfTrue(original) {
var str;
if (original && typeof original === "string") {
str = original.toLowerCase().trim();
return (str === "true" || str === "false") ? (str === "true") : original;
}
return original;
} | [
"function",
"_convertStringIfTrue",
"(",
"original",
")",
"{",
"var",
"str",
";",
"if",
"(",
"original",
"&&",
"typeof",
"original",
"===",
"\"string\"",
")",
"{",
"str",
"=",
"original",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"return"... | If a string is "true" "TRUE", or " TrUE" convert to boolean type else
leave as is | [
"If",
"a",
"string",
"is",
"true",
"TRUE",
"or",
"TrUE",
"convert",
"to",
"boolean",
"type",
"else",
"leave",
"as",
"is"
] | e8da99c688e2609838d76ea3b1c69a3e6027692e | https://github.com/slawrence/grunt-properties-reader/blob/e8da99c688e2609838d76ea3b1c69a3e6027692e/tasks/properties_reader.js#L15-L22 |
47,549 | slawrence/grunt-properties-reader | tasks/properties_reader.js | convertPropsToJson | function convertPropsToJson(text) {
var configObject = {};
if (text && text.length) {
// handle multi-line values terminated with a backslash
text = text.replace(/\\\r?\n\s*/g, '');
text.split(/\r?\n/g).forEach(function (line) {
var props,
name,
... | javascript | function convertPropsToJson(text) {
var configObject = {};
if (text && text.length) {
// handle multi-line values terminated with a backslash
text = text.replace(/\\\r?\n\s*/g, '');
text.split(/\r?\n/g).forEach(function (line) {
var props,
name,
... | [
"function",
"convertPropsToJson",
"(",
"text",
")",
"{",
"var",
"configObject",
"=",
"{",
"}",
";",
"if",
"(",
"text",
"&&",
"text",
".",
"length",
")",
"{",
"// handle multi-line values terminated with a backslash",
"text",
"=",
"text",
".",
"replace",
"(",
"... | Convert properties string into a json object
Only supports boolean and string types | [
"Convert",
"properties",
"string",
"into",
"a",
"json",
"object",
"Only",
"supports",
"boolean",
"and",
"string",
"types"
] | e8da99c688e2609838d76ea3b1c69a3e6027692e | https://github.com/slawrence/grunt-properties-reader/blob/e8da99c688e2609838d76ea3b1c69a3e6027692e/tasks/properties_reader.js#L28-L47 |
47,550 | jchook/virtual-dom-handlebars | lib/VTree.js | VTree | function VTree(body, config) {
var i;
config = extend({ allowJSON: false }, config);
Object.defineProperty(this, 'config', { enumerable: false, value: config });
if (body && body.length) {
for (i=0; i<body.length; i++) {
this.push(body[i]);
}
}
} | javascript | function VTree(body, config) {
var i;
config = extend({ allowJSON: false }, config);
Object.defineProperty(this, 'config', { enumerable: false, value: config });
if (body && body.length) {
for (i=0; i<body.length; i++) {
this.push(body[i]);
}
}
} | [
"function",
"VTree",
"(",
"body",
",",
"config",
")",
"{",
"var",
"i",
";",
"config",
"=",
"extend",
"(",
"{",
"allowJSON",
":",
"false",
"}",
",",
"config",
")",
";",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"'config'",
",",
"{",
"enumerab... | Array of VText, VNode, and Block Expressions | [
"Array",
"of",
"VText",
"VNode",
"and",
"Block",
"Expressions"
] | d1c2015449bad8489572114fe3d8facef2cce367 | https://github.com/jchook/virtual-dom-handlebars/blob/d1c2015449bad8489572114fe3d8facef2cce367/lib/VTree.js#L6-L15 |
47,551 | jchook/virtual-dom-handlebars | lib/Runtime.js | function(object, options) {
var i, r = [];
for (i in object) {
if (object.hasOwnProperty(i)) {
r = r.concat(options.fn(object[i]));
}
}
return r;
} | javascript | function(object, options) {
var i, r = [];
for (i in object) {
if (object.hasOwnProperty(i)) {
r = r.concat(options.fn(object[i]));
}
}
return r;
} | [
"function",
"(",
"object",
",",
"options",
")",
"{",
"var",
"i",
",",
"r",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"in",
"object",
")",
"{",
"if",
"(",
"object",
".",
"hasOwnProperty",
"(",
"i",
")",
")",
"{",
"r",
"=",
"r",
".",
"concat",
"(",
... | Block helpers always return an array of VNodes | [
"Block",
"helpers",
"always",
"return",
"an",
"array",
"of",
"VNodes"
] | d1c2015449bad8489572114fe3d8facef2cce367 | https://github.com/jchook/virtual-dom-handlebars/blob/d1c2015449bad8489572114fe3d8facef2cce367/lib/Runtime.js#L85-L93 | |
47,552 | wilmoore/dotsplit.js | index.js | dotsplit | function dotsplit (string) {
var idx = -1
var str = compact(normalize(string).split('.'))
var end = str.length
var out = []
while (++idx < end) {
out.push(todots(str[idx]))
}
return out
} | javascript | function dotsplit (string) {
var idx = -1
var str = compact(normalize(string).split('.'))
var end = str.length
var out = []
while (++idx < end) {
out.push(todots(str[idx]))
}
return out
} | [
"function",
"dotsplit",
"(",
"string",
")",
"{",
"var",
"idx",
"=",
"-",
"1",
"var",
"str",
"=",
"compact",
"(",
"normalize",
"(",
"string",
")",
".",
"split",
"(",
"'.'",
")",
")",
"var",
"end",
"=",
"str",
".",
"length",
"var",
"out",
"=",
"[",... | Transform dot-delimited strings to array of strings.
@param {String} string
Dot-delimited string.
@return {Array}
Array of strings. | [
"Transform",
"dot",
"-",
"delimited",
"strings",
"to",
"array",
"of",
"strings",
"."
] | 5334735bd130dbb9089bdf2ccdc73723f1a49419 | https://github.com/wilmoore/dotsplit.js/blob/5334735bd130dbb9089bdf2ccdc73723f1a49419/index.js#L15-L26 |
47,553 | wilmoore/dotsplit.js | index.js | compact | function compact (arr) {
var idx = -1
var end = arr.length
var out = []
while (++idx < end) {
if (arr[idx]) out.push(arr[idx])
}
return out
} | javascript | function compact (arr) {
var idx = -1
var end = arr.length
var out = []
while (++idx < end) {
if (arr[idx]) out.push(arr[idx])
}
return out
} | [
"function",
"compact",
"(",
"arr",
")",
"{",
"var",
"idx",
"=",
"-",
"1",
"var",
"end",
"=",
"arr",
".",
"length",
"var",
"out",
"=",
"[",
"]",
"while",
"(",
"++",
"idx",
"<",
"end",
")",
"{",
"if",
"(",
"arr",
"[",
"idx",
"]",
")",
"out",
... | Drop empty values from array.
@param {Array} array
Array of strings.
@return {Array}
Array of strings (empty values dropped). | [
"Drop",
"empty",
"values",
"from",
"array",
"."
] | 5334735bd130dbb9089bdf2ccdc73723f1a49419 | https://github.com/wilmoore/dotsplit.js/blob/5334735bd130dbb9089bdf2ccdc73723f1a49419/index.js#L52-L62 |
47,554 | IonicaBizau/read-file-cache | lib/index.js | readFileCache | function readFileCache (path, noCache, cb) {
path = abs(path);
if (typeof noCache === "function") {
cb = noCache;
noCache = false;
}
// TODO: Callback buffering
if (_cache[path] && noCache !== true) {
return cb(null, _cache[path]);
}
read(path, (err, data) => {
... | javascript | function readFileCache (path, noCache, cb) {
path = abs(path);
if (typeof noCache === "function") {
cb = noCache;
noCache = false;
}
// TODO: Callback buffering
if (_cache[path] && noCache !== true) {
return cb(null, _cache[path]);
}
read(path, (err, data) => {
... | [
"function",
"readFileCache",
"(",
"path",
",",
"noCache",
",",
"cb",
")",
"{",
"path",
"=",
"abs",
"(",
"path",
")",
";",
"if",
"(",
"typeof",
"noCache",
"===",
"\"function\"",
")",
"{",
"cb",
"=",
"noCache",
";",
"noCache",
"=",
"false",
";",
"}",
... | readFileCache
Reads the file asyncronously.
@name readFileCache
@function
@param {String} path The file path.
@param {Boolean} noCache If `true`, the file will be read from the disk.
@param {Function} cb The callback function. | [
"readFileCache",
"Reads",
"the",
"file",
"asyncronously",
"."
] | 3bc33aa244169bdf6a48dad96b6a94dcf91d8d59 | https://github.com/IonicaBizau/read-file-cache/blob/3bc33aa244169bdf6a48dad96b6a94dcf91d8d59/lib/index.js#L19-L36 |
47,555 | ryanseys/node-jawbone-up | index.js | function(options, callback) {
request({
method: 'post',
url: options.url,
headers: {
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/x-www-form-urlencoded'
},
form: options.data
},
function(error, response, body) {
callback(error, b... | javascript | function(options, callback) {
request({
method: 'post',
url: options.url,
headers: {
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/x-www-form-urlencoded'
},
form: options.data
},
function(error, response, body) {
callback(error, b... | [
"function",
"(",
"options",
",",
"callback",
")",
"{",
"request",
"(",
"{",
"method",
":",
"'post'",
",",
"url",
":",
"options",
".",
"url",
",",
"headers",
":",
"{",
"'Authorization'",
":",
"'Bearer '",
"+",
"access_token",
",",
"'Content-Type'",
":",
"... | Makes a POST request to the API with options.
@private
@param {Object} options Options that includes the `url` to POST and
`data` object to include in POST request.
@param {Function} callback Function to callback with response. | [
"Makes",
"a",
"POST",
"request",
"to",
"the",
"API",
"with",
"options",
"."
] | 6856b7960530e43682e7dd9bf8d4f97e852637cf | https://github.com/ryanseys/node-jawbone-up/blob/6856b7960530e43682e7dd9bf8d4f97e852637cf/index.js#L102-L115 | |
47,556 | dailymotion/react-collider | lib/client.js | reanderPage | function reanderPage(Handler, data) {
React.render(React.createElement(Handler, { data: data }), document);
} | javascript | function reanderPage(Handler, data) {
React.render(React.createElement(Handler, { data: data }), document);
} | [
"function",
"reanderPage",
"(",
"Handler",
",",
"data",
")",
"{",
"React",
".",
"render",
"(",
"React",
".",
"createElement",
"(",
"Handler",
",",
"{",
"data",
":",
"data",
"}",
")",
",",
"document",
")",
";",
"}"
] | Client side rendering | [
"Client",
"side",
"rendering"
] | 00cea5d25928d4a3ff0c68b6535edbc231d2b0a1 | https://github.com/dailymotion/react-collider/blob/00cea5d25928d4a3ff0c68b6535edbc231d2b0a1/lib/client.js#L26-L28 |
47,557 | francois2metz/node-spore | lib/httpclient.js | function(path, params) {
var queryString = this.query_string;
for (var param in params) {
var re = new RegExp(":"+ param)
var found = false;
if (path.search(re) != -1) {
path = path.replace(re, params[param]);
found = true;
... | javascript | function(path, params) {
var queryString = this.query_string;
for (var param in params) {
var re = new RegExp(":"+ param)
var found = false;
if (path.search(re) != -1) {
path = path.replace(re, params[param]);
found = true;
... | [
"function",
"(",
"path",
",",
"params",
")",
"{",
"var",
"queryString",
"=",
"this",
".",
"query_string",
";",
"for",
"(",
"var",
"param",
"in",
"params",
")",
"{",
"var",
"re",
"=",
"new",
"RegExp",
"(",
"\":\"",
"+",
"param",
")",
"var",
"found",
... | Format uri with params
add orphelin params in query string | [
"Format",
"uri",
"with",
"params",
"add",
"orphelin",
"params",
"in",
"query",
"string"
] | a74df36300852d8bab70c83506e4a3301137b6a0 | https://github.com/francois2metz/node-spore/blob/a74df36300852d8bab70c83506e4a3301137b6a0/lib/httpclient.js#L41-L68 | |
47,558 | francois2metz/node-spore | lib/httpclient.js | function(headers, params) {
var newHeaders = {};
for (var header in headers)
newHeaders[header] = headers[header];
for (var param in params) {
var re = new RegExp(":"+ param);
for (var header in newHeaders) {
if (newHeaders[header].search(re) !... | javascript | function(headers, params) {
var newHeaders = {};
for (var header in headers)
newHeaders[header] = headers[header];
for (var param in params) {
var re = new RegExp(":"+ param);
for (var header in newHeaders) {
if (newHeaders[header].search(re) !... | [
"function",
"(",
"headers",
",",
"params",
")",
"{",
"var",
"newHeaders",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"header",
"in",
"headers",
")",
"newHeaders",
"[",
"header",
"]",
"=",
"headers",
"[",
"header",
"]",
";",
"for",
"(",
"var",
"param",
... | format final headers | [
"format",
"final",
"headers"
] | a74df36300852d8bab70c83506e4a3301137b6a0 | https://github.com/francois2metz/node-spore/blob/a74df36300852d8bab70c83506e4a3301137b6a0/lib/httpclient.js#L72-L85 | |
47,559 | tradle/zlorp | lib/peer.js | Peer | function Peer (options) {
EventEmitter.call(this)
bindFns(this)
extend(this, options)
var addr = this.address
var hp = addr.split(':')
this.host = hp[0]
this.port = Number(hp[1])
this._deliveryTrackers = []
this.setMaxListeners(0)
this._debug('new peer')
} | javascript | function Peer (options) {
EventEmitter.call(this)
bindFns(this)
extend(this, options)
var addr = this.address
var hp = addr.split(':')
this.host = hp[0]
this.port = Number(hp[1])
this._deliveryTrackers = []
this.setMaxListeners(0)
this._debug('new peer')
} | [
"function",
"Peer",
"(",
"options",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
"bindFns",
"(",
"this",
")",
"extend",
"(",
"this",
",",
"options",
")",
"var",
"addr",
"=",
"this",
".",
"address",
"var",
"hp",
"=",
"addr",
".",
"split",
... | A connection with whoever can prove ownership of a pubKey
@param {[type]} options [description] | [
"A",
"connection",
"with",
"whoever",
"can",
"prove",
"ownership",
"of",
"a",
"pubKey"
] | 6d23d855fdafed49cb6d77a0e1930f6465f11d6e | https://github.com/tradle/zlorp/blob/6d23d855fdafed49cb6d77a0e1930f6465f11d6e/lib/peer.js#L29-L41 |
47,560 | levilindsey/physx | src/collisions/collision-detection/src/sphere-collision-detection.js | sphereVsPoint | function sphereVsPoint(sphere, point) {
return vec3.squaredDistance(point, sphere.centerOfVolume) <= sphere.radius * sphere.radius;
} | javascript | function sphereVsPoint(sphere, point) {
return vec3.squaredDistance(point, sphere.centerOfVolume) <= sphere.radius * sphere.radius;
} | [
"function",
"sphereVsPoint",
"(",
"sphere",
",",
"point",
")",
"{",
"return",
"vec3",
".",
"squaredDistance",
"(",
"point",
",",
"sphere",
".",
"centerOfVolume",
")",
"<=",
"sphere",
".",
"radius",
"*",
"sphere",
".",
"radius",
";",
"}"
] | This module defines utility methods for detecting whether intersection has occurred between
spheres and other shapes.
@param {Sphere} sphere
@param {vec3} point
@returns {boolean} | [
"This",
"module",
"defines",
"utility",
"methods",
"for",
"detecting",
"whether",
"intersection",
"has",
"occurred",
"between",
"spheres",
"and",
"other",
"shapes",
"."
] | 62df9f6968082ed34aa784a23f3db6c8feca6f3a | https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/collision-detection/src/sphere-collision-detection.js#L15-L17 |
47,561 | joelcolucci/geolocation-distance-between | lib/index.js | _haversineCalculation | function _haversineCalculation(coordinateOne, coordinateTwo) {
// Credits
// https://www.movable-type.co.uk/scripts/latlong.html
// https://en.wikipedia.org/wiki/Haversine_formula
let latitudeOneRadians = _convertDegreesToRadians(coordinateOne.latitude);
let latitudeTwoRadians = _convertDegreesToRadians(coordinateT... | javascript | function _haversineCalculation(coordinateOne, coordinateTwo) {
// Credits
// https://www.movable-type.co.uk/scripts/latlong.html
// https://en.wikipedia.org/wiki/Haversine_formula
let latitudeOneRadians = _convertDegreesToRadians(coordinateOne.latitude);
let latitudeTwoRadians = _convertDegreesToRadians(coordinateT... | [
"function",
"_haversineCalculation",
"(",
"coordinateOne",
",",
"coordinateTwo",
")",
"{",
"// Credits",
"// https://www.movable-type.co.uk/scripts/latlong.html",
"// https://en.wikipedia.org/wiki/Haversine_formula",
"let",
"latitudeOneRadians",
"=",
"_convertDegreesToRadians",
"(",
... | Return distance between two coordinates using Haversine formula
@param {Object} coordinateOne Object containing latitude, and longitude keys
@param {Object} coordinateTwo Object containing latitude, and longitude keys
@return {Float} | [
"Return",
"distance",
"between",
"two",
"coordinates",
"using",
"Haversine",
"formula"
] | 8f5437c1a87176891febbee4dc06e51af73c7f8d | https://github.com/joelcolucci/geolocation-distance-between/blob/8f5437c1a87176891febbee4dc06e51af73c7f8d/lib/index.js#L19-L42 |
47,562 | slideme/rorschach | lib/utils.js | join | function join(args) {
var arg;
var i = 0;
var path = '';
if (arguments.length === 0) {
return utils.sep;
}
while ((arg = arguments[i++])) {
if (typeof arg !== 'string') {
throw new TypeError('utils.join() expects string arguments');
}
path += utils.sep + arg;
}
path = path.repl... | javascript | function join(args) {
var arg;
var i = 0;
var path = '';
if (arguments.length === 0) {
return utils.sep;
}
while ((arg = arguments[i++])) {
if (typeof arg !== 'string') {
throw new TypeError('utils.join() expects string arguments');
}
path += utils.sep + arg;
}
path = path.repl... | [
"function",
"join",
"(",
"args",
")",
"{",
"var",
"arg",
";",
"var",
"i",
"=",
"0",
";",
"var",
"path",
"=",
"''",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"0",
")",
"{",
"return",
"utils",
".",
"sep",
";",
"}",
"while",
"(",
"(",
"... | Join paths.
@param {...String} args Paths
@returns {String} | [
"Join",
"paths",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/utils.js#L113-L135 |
47,563 | wprl/wainwright | index.js | extractMetadata | function extractMetadata (content, callback) {
var end;
var result;
var metadata = '';
var body = content;
// Metadata is defined by either starting and ending line,
if (content.slice(0, 3) === '---') {
result = content.match(/^-{3,}\s([\s\S]*?)-{3,}(\s[\s\S]*|\s?)$/);
if (result && result.length =... | javascript | function extractMetadata (content, callback) {
var end;
var result;
var metadata = '';
var body = content;
// Metadata is defined by either starting and ending line,
if (content.slice(0, 3) === '---') {
result = content.match(/^-{3,}\s([\s\S]*?)-{3,}(\s[\s\S]*|\s?)$/);
if (result && result.length =... | [
"function",
"extractMetadata",
"(",
"content",
",",
"callback",
")",
"{",
"var",
"end",
";",
"var",
"result",
";",
"var",
"metadata",
"=",
"''",
";",
"var",
"body",
"=",
"content",
";",
"// Metadata is defined by either starting and ending line,",
"if",
"(",
"co... | Also from the wintersmith markdown plugin. | [
"Also",
"from",
"the",
"wintersmith",
"markdown",
"plugin",
"."
] | 4a87298d3f097e27acf741157fe0e0b495ff4df9 | https://github.com/wprl/wainwright/blob/4a87298d3f097e27acf741157fe0e0b495ff4df9/index.js#L52-L82 |
47,564 | romainhild/node-xmlrpc-socket | lib/client.js | Client | function Client(host, port) {
// Invokes with new if called without
if (false === (this instanceof Client)) {
return new Client(host, port)
}
this.host = host;
this.port = port;
} | javascript | function Client(host, port) {
// Invokes with new if called without
if (false === (this instanceof Client)) {
return new Client(host, port)
}
this.host = host;
this.port = port;
} | [
"function",
"Client",
"(",
"host",
",",
"port",
")",
"{",
"// Invokes with new if called without",
"if",
"(",
"false",
"===",
"(",
"this",
"instanceof",
"Client",
")",
")",
"{",
"return",
"new",
"Client",
"(",
"host",
",",
"port",
")",
"}",
"this",
".",
... | Creates a Client object for making XML-RPC method calls via socket
@constructor
@param {String} host host to connect
@param {Number} port port to connect
@return {Client} | [
"Creates",
"a",
"Client",
"object",
"for",
"making",
"XML",
"-",
"RPC",
"method",
"calls",
"via",
"socket"
] | 44a1112632a1db332bea3754c913609f05570d0a | https://github.com/romainhild/node-xmlrpc-socket/blob/44a1112632a1db332bea3754c913609f05570d0a/lib/client.js#L14-L22 |
47,565 | UsabilityDynamics/node-wordpress-client | lib/wordpress-client.js | Client | function Client(settings, callback) {
this.debug('new Client', settings.url);
var self = this;
// Mixing settings and emitter into instance.
require('object-emitter').mixin(this);
require('object-settings').mixin(this);
// Set defaults and instance settings.
this.set(Client.defaults).set(settings);
/... | javascript | function Client(settings, callback) {
this.debug('new Client', settings.url);
var self = this;
// Mixing settings and emitter into instance.
require('object-emitter').mixin(this);
require('object-settings').mixin(this);
// Set defaults and instance settings.
this.set(Client.defaults).set(settings);
/... | [
"function",
"Client",
"(",
"settings",
",",
"callback",
")",
"{",
"this",
".",
"debug",
"(",
"'new Client'",
",",
"settings",
".",
"url",
")",
";",
"var",
"self",
"=",
"this",
";",
"// Mixing settings and emitter into instance.",
"require",
"(",
"'object-emitter... | WordPress Client.
@todo Add support for 30X redirect.
### Events
* ready - Once client instance created.
* connected - Once client instance created and list of supported methods is returned.
* authenticated - Once client instance created and list of supported methods is returned.
* error - Emi... | [
"WordPress",
"Client",
"."
] | 2b47a7c5cadd3d8f2cfd255f997f36af14a5d843 | https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/lib/wordpress-client.js#L30-L88 |
47,566 | UsabilityDynamics/node-wordpress-client | lib/wordpress-client.js | onceReady | function onceReady(error, methods) {
this.debug(error ? 'No methods (%d) found, unable to connect to %s.' : 'onceReady: Found %d methods on %s.', ( methods ? methods.length : 0 ), this.get('url'));
// Set Methods.
this.set('methods', this.common.trim(methods));
if (error) {
this.emit('... | javascript | function onceReady(error, methods) {
this.debug(error ? 'No methods (%d) found, unable to connect to %s.' : 'onceReady: Found %d methods on %s.', ( methods ? methods.length : 0 ), this.get('url'));
// Set Methods.
this.set('methods', this.common.trim(methods));
if (error) {
this.emit('... | [
"function",
"onceReady",
"(",
"error",
",",
"methods",
")",
"{",
"this",
".",
"debug",
"(",
"error",
"?",
"'No methods (%d) found, unable to connect to %s.'",
":",
"'onceReady: Found %d methods on %s.'",
",",
"(",
"methods",
"?",
"methods",
".",
"length",
":",
"0",
... | Callback for Connection Verification.
@param error
@param methods
@returns {*} | [
"Callback",
"for",
"Connection",
"Verification",
"."
] | 2b47a7c5cadd3d8f2cfd255f997f36af14a5d843 | https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/lib/wordpress-client.js#L103-L118 |
47,567 | UsabilityDynamics/node-wordpress-client | lib/wordpress-client.js | callbackWrapper | function callbackWrapper(error, response) {
self.debug('methodCall->callbackWrapper', error, response);
// TODO: error should be customized to handle more error types
if (error /*&& error.code === "ENOTFOUND" && error.syscall === "getaddrinfo"*/) {
error.message = "Unable to connect to... | javascript | function callbackWrapper(error, response) {
self.debug('methodCall->callbackWrapper', error, response);
// TODO: error should be customized to handle more error types
if (error /*&& error.code === "ENOTFOUND" && error.syscall === "getaddrinfo"*/) {
error.message = "Unable to connect to... | [
"function",
"callbackWrapper",
"(",
"error",
",",
"response",
")",
"{",
"self",
".",
"debug",
"(",
"'methodCall->callbackWrapper'",
",",
"error",
",",
"response",
")",
";",
"// TODO: error should be customized to handle more error types",
"if",
"(",
"error",
"/*&& error... | Handle RPC Method Callback.
@param {Error} error
@param {string} response
@returns {*} | [
"Handle",
"RPC",
"Method",
"Callback",
"."
] | 2b47a7c5cadd3d8f2cfd255f997f36af14a5d843 | https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/lib/wordpress-client.js#L193-L206 |
47,568 | UsabilityDynamics/node-wordpress-client | lib/wordpress-client.js | nextTick | function nextTick(callback) {
var context = this;
var args = Array.prototype.slice.call(arguments, 1);
// Do not schedule callback if not a valid function.
if ('function' !== typeof callback) {
return this;
}
// Execute callback on next tick.
process.nextTick(functio... | javascript | function nextTick(callback) {
var context = this;
var args = Array.prototype.slice.call(arguments, 1);
// Do not schedule callback if not a valid function.
if ('function' !== typeof callback) {
return this;
}
// Execute callback on next tick.
process.nextTick(functio... | [
"function",
"nextTick",
"(",
"callback",
")",
"{",
"var",
"context",
"=",
"this",
";",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"// Do not schedule callback if not a valid function.",
"if",... | Call Method on Next Tick.
@param callback
@returns {*} | [
"Call",
"Method",
"on",
"Next",
"Tick",
"."
] | 2b47a7c5cadd3d8f2cfd255f997f36af14a5d843 | https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/lib/wordpress-client.js#L435-L454 |
47,569 | levilindsey/physx | src/collisions/contact-calculation/src/capsule-contact-calculation.js | capsuleVsSphere | function capsuleVsSphere(contactPoint, contactNormal, capsule, sphere) {
const sphereCenter = sphere.centerOfVolume;
findClosestPointOnSegmentToPoint(contactPoint, capsule.segment, sphereCenter);
vec3.subtract(contactNormal, sphereCenter, contactPoint);
vec3.normalize(contactNormal, contactNormal);
vec3.scale... | javascript | function capsuleVsSphere(contactPoint, contactNormal, capsule, sphere) {
const sphereCenter = sphere.centerOfVolume;
findClosestPointOnSegmentToPoint(contactPoint, capsule.segment, sphereCenter);
vec3.subtract(contactNormal, sphereCenter, contactPoint);
vec3.normalize(contactNormal, contactNormal);
vec3.scale... | [
"function",
"capsuleVsSphere",
"(",
"contactPoint",
",",
"contactNormal",
",",
"capsule",
",",
"sphere",
")",
"{",
"const",
"sphereCenter",
"=",
"sphere",
".",
"centerOfVolume",
";",
"findClosestPointOnSegmentToPoint",
"(",
"contactPoint",
",",
"capsule",
".",
"segm... | Finds the closest point on the surface of the capsule to the sphere center.
@param {vec3} contactPoint Output param.
@param {vec3} contactNormal Output param.
@param {Capsule} capsule
@param {Sphere} sphere | [
"Finds",
"the",
"closest",
"point",
"on",
"the",
"surface",
"of",
"the",
"capsule",
"to",
"the",
"sphere",
"center",
"."
] | 62df9f6968082ed34aa784a23f3db6c8feca6f3a | https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/contact-calculation/src/capsule-contact-calculation.js#L39-L45 |
47,570 | levilindsey/physx | src/collisions/contact-calculation/src/capsule-contact-calculation.js | capsuleVsAabb | function capsuleVsAabb(contactPoint, contactNormal, capsule, aabb) {
// tmpVec1 represents the closest point on the capsule to the AABB. tmpVec2
// represents the closest point on the AABB to the capsule.
//
// Check whether the two capsule ends intersect the AABB (sphere vs AABB) (addresses the
// capsule-v... | javascript | function capsuleVsAabb(contactPoint, contactNormal, capsule, aabb) {
// tmpVec1 represents the closest point on the capsule to the AABB. tmpVec2
// represents the closest point on the AABB to the capsule.
//
// Check whether the two capsule ends intersect the AABB (sphere vs AABB) (addresses the
// capsule-v... | [
"function",
"capsuleVsAabb",
"(",
"contactPoint",
",",
"contactNormal",
",",
"capsule",
",",
"aabb",
")",
"{",
"// tmpVec1 represents the closest point on the capsule to the AABB. tmpVec2",
"// represents the closest point on the AABB to the capsule.",
"//",
"// Check whether the two c... | Finds the closest point on the surface of the capsule to the AABB.
NOTE: This implementation cheats by checking whether vertices from one shape lie within the
other. Due to the tunnelling problem, it is possible that intersection occurs without any
vertices lying within the other shape. However, (A) this is unlikely, ... | [
"Finds",
"the",
"closest",
"point",
"on",
"the",
"surface",
"of",
"the",
"capsule",
"to",
"the",
"AABB",
"."
] | 62df9f6968082ed34aa784a23f3db6c8feca6f3a | https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/contact-calculation/src/capsule-contact-calculation.js#L60-L103 |
47,571 | levilindsey/physx | src/collisions/contact-calculation/src/capsule-contact-calculation.js | capsuleVsCapsule | function capsuleVsCapsule(contactPoint, contactNormal, capsuleA, capsuleB) {
findClosestPointsFromSegmentToSegment(tmpVec1, tmpVec2,
capsuleA.segment, capsuleB.segment);
vec3.subtract(contactNormal, tmpVec2, tmpVec1);
vec3.normalize(contactNormal, contactNormal);
vec3.scaleAndAdd(contactPoint, tmpVec1, co... | javascript | function capsuleVsCapsule(contactPoint, contactNormal, capsuleA, capsuleB) {
findClosestPointsFromSegmentToSegment(tmpVec1, tmpVec2,
capsuleA.segment, capsuleB.segment);
vec3.subtract(contactNormal, tmpVec2, tmpVec1);
vec3.normalize(contactNormal, contactNormal);
vec3.scaleAndAdd(contactPoint, tmpVec1, co... | [
"function",
"capsuleVsCapsule",
"(",
"contactPoint",
",",
"contactNormal",
",",
"capsuleA",
",",
"capsuleB",
")",
"{",
"findClosestPointsFromSegmentToSegment",
"(",
"tmpVec1",
",",
"tmpVec2",
",",
"capsuleA",
".",
"segment",
",",
"capsuleB",
".",
"segment",
")",
"... | Finds the closest point on the surface of capsule A to capsule B.
@param {vec3} contactPoint Output param.
@param {vec3} contactNormal Output param.
@param {Capsule} capsuleA
@param {Capsule} capsuleB | [
"Finds",
"the",
"closest",
"point",
"on",
"the",
"surface",
"of",
"capsule",
"A",
"to",
"capsule",
"B",
"."
] | 62df9f6968082ed34aa784a23f3db6c8feca6f3a | https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/contact-calculation/src/capsule-contact-calculation.js#L124-L130 |
47,572 | GochoMugo/elbow | src/lib/index.js | loadSchema | function loadSchema(uri) {
return new Promise(function(resolve, reject) {
request.get(uri).end(function(error, response) {
if (error || !response.ok) {
error = error || new Error(response.body);
debug("error fetching remote schema:", error);
return reject(error);
}
return... | javascript | function loadSchema(uri) {
return new Promise(function(resolve, reject) {
request.get(uri).end(function(error, response) {
if (error || !response.ok) {
error = error || new Error(response.body);
debug("error fetching remote schema:", error);
return reject(error);
}
return... | [
"function",
"loadSchema",
"(",
"uri",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"request",
".",
"get",
"(",
"uri",
")",
".",
"end",
"(",
"function",
"(",
"error",
",",
"response",
")",
"{",
"if",
... | Loads schema from remote server using a HTTP URI.
@private
@param {String} uri - HTTP URI to schema
@return {Promise}
@see https://github.com/epoberezkin/ajv#asynchronous-schema-compilation | [
"Loads",
"schema",
"from",
"remote",
"server",
"using",
"a",
"HTTP",
"URI",
"."
] | 2211c50c6019dc45acb192e07f765ab0daabe3cd | https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L44-L55 |
47,573 | GochoMugo/elbow | src/lib/index.js | requireAll | function requireAll(schemaDir, options, callback) {
debug("loading schemas");
if (!callback) {
callback = options;
options = {};
}
const opts = _.assign({
extensions: ["json"],
}, options);
let files;
try {
files = fs.readdirSync(schemaDir);
} catch(errReaddir) {
return callback(err... | javascript | function requireAll(schemaDir, options, callback) {
debug("loading schemas");
if (!callback) {
callback = options;
options = {};
}
const opts = _.assign({
extensions: ["json"],
}, options);
let files;
try {
files = fs.readdirSync(schemaDir);
} catch(errReaddir) {
return callback(err... | [
"function",
"requireAll",
"(",
"schemaDir",
",",
"options",
",",
"callback",
")",
"{",
"debug",
"(",
"\"loading schemas\"",
")",
";",
"if",
"(",
"!",
"callback",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"const",
"o... | Loads all the Schemas into memory.
@param {String} schemaDir - path to directory holding schemas
@param {Object} [options]
@param {String[]} [options.extensions=["json"]] Extension of schema files
@param {Function} callback - callback(err, schemas) | [
"Loads",
"all",
"the",
"Schemas",
"into",
"memory",
"."
] | 2211c50c6019dc45acb192e07f765ab0daabe3cd | https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L66-L108 |
47,574 | GochoMugo/elbow | src/lib/index.js | expandVars | function expandVars(target, options) {
const vars = options.vars || {};
const regexp = /\$\{(\w+)\}/g;
if (typeof target === "string") {
return _expand(target);
}
for (let key in target) {
target[key] = _expand(target[key]);
}
return target;
function _expand(val) {
let expanded = val;
... | javascript | function expandVars(target, options) {
const vars = options.vars || {};
const regexp = /\$\{(\w+)\}/g;
if (typeof target === "string") {
return _expand(target);
}
for (let key in target) {
target[key] = _expand(target[key]);
}
return target;
function _expand(val) {
let expanded = val;
... | [
"function",
"expandVars",
"(",
"target",
",",
"options",
")",
"{",
"const",
"vars",
"=",
"options",
".",
"vars",
"||",
"{",
"}",
";",
"const",
"regexp",
"=",
"/",
"\\$\\{(\\w+)\\}",
"/",
"g",
";",
"if",
"(",
"typeof",
"target",
"===",
"\"string\"",
")"... | Expand variables, using variables from the `options` object,
or process environment.
Modifies the passed object in place.
@private
@param {String|Object} target - object with parameters
@param {Object} options - test configurations
@return {String|Object} | [
"Expand",
"variables",
"using",
"variables",
"from",
"the",
"options",
"object",
"or",
"process",
"environment",
".",
"Modifies",
"the",
"passed",
"object",
"in",
"place",
"."
] | 2211c50c6019dc45acb192e07f765ab0daabe3cd | https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L183-L210 |
47,575 | GochoMugo/elbow | src/lib/index.js | validateResponse | function validateResponse(schema, response, options, done) {
debug(`validating response for ${schema.endpoint}`);
// testing status code
if (schema.status) {
should(response.status).eql(schema.status);
}
return validator.compileAsync(schema).then((validate) => {
const valid = validate(response.body);
... | javascript | function validateResponse(schema, response, options, done) {
debug(`validating response for ${schema.endpoint}`);
// testing status code
if (schema.status) {
should(response.status).eql(schema.status);
}
return validator.compileAsync(schema).then((validate) => {
const valid = validate(response.body);
... | [
"function",
"validateResponse",
"(",
"schema",
",",
"response",
",",
"options",
",",
"done",
")",
"{",
"debug",
"(",
"`",
"${",
"schema",
".",
"endpoint",
"}",
"`",
")",
";",
"// testing status code",
"if",
"(",
"schema",
".",
"status",
")",
"{",
"should... | Validate a Http response using schema.
This handles the actual JSON schema validation.
@private
@param {Object} schema - schema used to validate against
@param {*} response - http response
@param {Object} options - test configurations
@param {Function} done - called once validation is completed
@TODO Remove our "... | [
"Validate",
"a",
"Http",
"response",
"using",
"schema",
".",
"This",
"handles",
"the",
"actual",
"JSON",
"schema",
"validation",
"."
] | 2211c50c6019dc45acb192e07f765ab0daabe3cd | https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L226-L249 |
47,576 | GochoMugo/elbow | src/lib/index.js | makeRequest | function makeRequest(baseUrl, method, schema, options, done) {
debug(`making ${method.toUpperCase()} request to ${schema.endpoint}`);
const endpoint = expandVars(schema.endpoint, options);
const apiPath = url.resolve(baseUrl + "/", _.trimStart(endpoint, "/"));
const headers = Object.assign({}, options.headers, ... | javascript | function makeRequest(baseUrl, method, schema, options, done) {
debug(`making ${method.toUpperCase()} request to ${schema.endpoint}`);
const endpoint = expandVars(schema.endpoint, options);
const apiPath = url.resolve(baseUrl + "/", _.trimStart(endpoint, "/"));
const headers = Object.assign({}, options.headers, ... | [
"function",
"makeRequest",
"(",
"baseUrl",
",",
"method",
",",
"schema",
",",
"options",
",",
"done",
")",
"{",
"debug",
"(",
"`",
"${",
"method",
".",
"toUpperCase",
"(",
")",
"}",
"${",
"schema",
".",
"endpoint",
"}",
"`",
")",
";",
"const",
"endpo... | Make a HTTP request against the remote server and validate the
response.
@private
@param {String} baseUrl - base url e.g. "http://localhost:9090/"
@param {String} method - http method to use for request e.g. "get"
@param {Object} schema - schema used to validate response
@param {Object} options - test configuratio... | [
"Make",
"a",
"HTTP",
"request",
"against",
"the",
"remote",
"server",
"and",
"validate",
"the",
"response",
"."
] | 2211c50c6019dc45acb192e07f765ab0daabe3cd | https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L263-L302 |
47,577 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/domiterator/plugin.js | getNextSourceNode | function getNextSourceNode( node, startFromSibling, lastNode )
{
var next = node.getNextSourceNode( startFromSibling, null, lastNode );
while ( !bookmarkGuard( next ) )
next = next.getNextSourceNode( startFromSibling, null, lastNode );
return next;
} | javascript | function getNextSourceNode( node, startFromSibling, lastNode )
{
var next = node.getNextSourceNode( startFromSibling, null, lastNode );
while ( !bookmarkGuard( next ) )
next = next.getNextSourceNode( startFromSibling, null, lastNode );
return next;
} | [
"function",
"getNextSourceNode",
"(",
"node",
",",
"startFromSibling",
",",
"lastNode",
")",
"{",
"var",
"next",
"=",
"node",
".",
"getNextSourceNode",
"(",
"startFromSibling",
",",
"null",
",",
"lastNode",
")",
";",
"while",
"(",
"!",
"bookmarkGuard",
"(",
... | Get a reference for the next element, bookmark nodes are skipped. | [
"Get",
"a",
"reference",
"for",
"the",
"next",
"element",
"bookmark",
"nodes",
"are",
"skipped",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/domiterator/plugin.js#L39-L45 |
47,578 | saggiyogesh/nodeportal | public/ckeditor/_source/core/dom/domobject.js | function( domObject, eventName )
{
return function( domEvent )
{
// In FF, when reloading the page with the editor focused, it may
// throw an error because the CKEDITOR global is not anymore
// available. So, we check it here first. (#2923)
if ( typeof CKEDITOR != 'undefined' )
domObject.f... | javascript | function( domObject, eventName )
{
return function( domEvent )
{
// In FF, when reloading the page with the editor focused, it may
// throw an error because the CKEDITOR global is not anymore
// available. So, we check it here first. (#2923)
if ( typeof CKEDITOR != 'undefined' )
domObject.f... | [
"function",
"(",
"domObject",
",",
"eventName",
")",
"{",
"return",
"function",
"(",
"domEvent",
")",
"{",
"// In FF, when reloading the page with the editor focused, it may\r",
"// throw an error because the CKEDITOR global is not anymore\r",
"// available. So, we check it here first.... | Do not define other local variables here. We want to keep the native listener closures as clean as possible. | [
"Do",
"not",
"define",
"other",
"local",
"variables",
"here",
".",
"We",
"want",
"to",
"keep",
"the",
"native",
"listener",
"closures",
"as",
"clean",
"as",
"possible",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/domobject.js#L40-L50 | |
47,579 | saggiyogesh/nodeportal | public/ckeditor/_source/core/dom/domobject.js | function()
{
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
for ( var eventName in nativeListeners )
{
var listener = nativeListeners[ eventName ];
if ( this.$.detachEvent )
this.$.detachEvent( 'on' + eventName, listener );
else if ( this.$.removeEventListener )
... | javascript | function()
{
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
for ( var eventName in nativeListeners )
{
var listener = nativeListeners[ eventName ];
if ( this.$.detachEvent )
this.$.detachEvent( 'on' + eventName, listener );
else if ( this.$.removeEventListener )
... | [
"function",
"(",
")",
"{",
"var",
"nativeListeners",
"=",
"this",
".",
"getCustomData",
"(",
"'_cke_nativeListeners'",
")",
";",
"for",
"(",
"var",
"eventName",
"in",
"nativeListeners",
")",
"{",
"var",
"listener",
"=",
"nativeListeners",
"[",
"eventName",
"]"... | Removes any listener set on this object.
To avoid memory leaks we must assure that there are no
references left after the object is no longer needed. | [
"Removes",
"any",
"listener",
"set",
"on",
"this",
"object",
".",
"To",
"avoid",
"memory",
"leaks",
"we",
"must",
"assure",
"that",
"there",
"are",
"no",
"references",
"left",
"after",
"the",
"object",
"is",
"no",
"longer",
"needed",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/domobject.js#L125-L138 | |
47,580 | saggiyogesh/nodeportal | public/ckeditor/_source/core/lang.js | function( languageCode, defaultLanguage, callback )
{
// If no languageCode - fallback to browser or default.
// If languageCode - fallback to no-localized version or default.
if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )
languageCode = this.detect( defaultLanguage, languageCode )... | javascript | function( languageCode, defaultLanguage, callback )
{
// If no languageCode - fallback to browser or default.
// If languageCode - fallback to no-localized version or default.
if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )
languageCode = this.detect( defaultLanguage, languageCode )... | [
"function",
"(",
"languageCode",
",",
"defaultLanguage",
",",
"callback",
")",
"{",
"// If no languageCode - fallback to browser or default.\r",
"// If languageCode - fallback to no-localized version or default.\r",
"if",
"(",
"!",
"languageCode",
"||",
"!",
"CKEDITOR",
".",
"l... | Loads a specific language file, or auto detect it. A callback is
then called when the file gets loaded.
@param {String} languageCode The code of the language file to be
loaded. If null or empty, autodetection will be performed. The
same happens if the language is not supported.
@param {String} defaultLanguage The langu... | [
"Loads",
"a",
"specific",
"language",
"file",
"or",
"auto",
"detect",
"it",
".",
"A",
"callback",
"is",
"then",
"called",
"when",
"the",
"file",
"gets",
"loaded",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/lang.js#L97-L117 | |
47,581 | saggiyogesh/nodeportal | public/ckeditor/_source/core/lang.js | function( defaultLanguage, probeLanguage )
{
var languages = this.languages;
probeLanguage = probeLanguage || navigator.userLanguage || navigator.language || defaultLanguage;
var parts = probeLanguage
.toLowerCase()
.match( /([a-z]+)(?:-([a-z]+))?/ ),
lang = parts[1],
locale = par... | javascript | function( defaultLanguage, probeLanguage )
{
var languages = this.languages;
probeLanguage = probeLanguage || navigator.userLanguage || navigator.language || defaultLanguage;
var parts = probeLanguage
.toLowerCase()
.match( /([a-z]+)(?:-([a-z]+))?/ ),
lang = parts[1],
locale = par... | [
"function",
"(",
"defaultLanguage",
",",
"probeLanguage",
")",
"{",
"var",
"languages",
"=",
"this",
".",
"languages",
";",
"probeLanguage",
"=",
"probeLanguage",
"||",
"navigator",
".",
"userLanguage",
"||",
"navigator",
".",
"language",
"||",
"defaultLanguage",
... | Returns the language that best fit the user language. For example,
suppose that the user language is "pt-br". If this language is
supported by the editor, it is returned. Otherwise, if only "pt" is
supported, it is returned instead. If none of the previous are
supported, a default language is then returned.
@param {Str... | [
"Returns",
"the",
"language",
"that",
"best",
"fit",
"the",
"user",
"language",
".",
"For",
"example",
"suppose",
"that",
"the",
"user",
"language",
"is",
"pt",
"-",
"br",
".",
"If",
"this",
"language",
"is",
"supported",
"by",
"the",
"editor",
"it",
"is... | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/lang.js#L133-L154 | |
47,582 | ForbesLindesay/stop | lib/favicon.js | addFavicons | function addFavicons() {
var stream = new Transform({objectMode: true, highWaterMark: 2});
var hosts = {};
var downloads = [];
stream._transform = function (page, _, callback) {
stream.push(page);
var host = url.parse(page.url).host;
if (!hosts[host]) {
downloads.push(hosts[host] = download(u... | javascript | function addFavicons() {
var stream = new Transform({objectMode: true, highWaterMark: 2});
var hosts = {};
var downloads = [];
stream._transform = function (page, _, callback) {
stream.push(page);
var host = url.parse(page.url).host;
if (!hosts[host]) {
downloads.push(hosts[host] = download(u... | [
"function",
"addFavicons",
"(",
")",
"{",
"var",
"stream",
"=",
"new",
"Transform",
"(",
"{",
"objectMode",
":",
"true",
",",
"highWaterMark",
":",
"2",
"}",
")",
";",
"var",
"hosts",
"=",
"{",
"}",
";",
"var",
"downloads",
"=",
"[",
"]",
";",
"str... | Look for favicons and add them to the stream if they exist
@returns {TransformStream} | [
"Look",
"for",
"favicons",
"and",
"add",
"them",
"to",
"the",
"stream",
"if",
"they",
"exist"
] | 61db8899bdde604dc45cfc8f11fffa1beaa27abb | https://github.com/ForbesLindesay/stop/blob/61db8899bdde604dc45cfc8f11fffa1beaa27abb/lib/favicon.js#L15-L46 |
47,583 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/styles/plugin.js | function( elementPath )
{
switch ( this.type )
{
case CKEDITOR.STYLE_BLOCK :
return this.checkElementRemovable( elementPath.block || elementPath.blockLimit, true );
case CKEDITOR.STYLE_OBJECT :
case CKEDITOR.STYLE_INLINE :
var elements = elementPath.elements;
for ( var ... | javascript | function( elementPath )
{
switch ( this.type )
{
case CKEDITOR.STYLE_BLOCK :
return this.checkElementRemovable( elementPath.block || elementPath.blockLimit, true );
case CKEDITOR.STYLE_OBJECT :
case CKEDITOR.STYLE_INLINE :
var elements = elementPath.elements;
for ( var ... | [
"function",
"(",
"elementPath",
")",
"{",
"switch",
"(",
"this",
".",
"type",
")",
"{",
"case",
"CKEDITOR",
".",
"STYLE_BLOCK",
":",
"return",
"this",
".",
"checkElementRemovable",
"(",
"elementPath",
".",
"block",
"||",
"elementPath",
".",
"blockLimit",
","... | Get the style state inside an element path. Returns "true" if the
element is active in the path. | [
"Get",
"the",
"style",
"state",
"inside",
"an",
"element",
"path",
".",
"Returns",
"true",
"if",
"the",
"element",
"is",
"active",
"in",
"the",
"path",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L168-L200 | |
47,584 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/styles/plugin.js | function( elementPath )
{
switch ( this.type )
{
case CKEDITOR.STYLE_INLINE :
case CKEDITOR.STYLE_BLOCK :
break;
case CKEDITOR.STYLE_OBJECT :
return elementPath.lastElement.getAscendant( this.element, true );
}
return true;
} | javascript | function( elementPath )
{
switch ( this.type )
{
case CKEDITOR.STYLE_INLINE :
case CKEDITOR.STYLE_BLOCK :
break;
case CKEDITOR.STYLE_OBJECT :
return elementPath.lastElement.getAscendant( this.element, true );
}
return true;
} | [
"function",
"(",
"elementPath",
")",
"{",
"switch",
"(",
"this",
".",
"type",
")",
"{",
"case",
"CKEDITOR",
".",
"STYLE_INLINE",
":",
"case",
"CKEDITOR",
".",
"STYLE_BLOCK",
":",
"break",
";",
"case",
"CKEDITOR",
".",
"STYLE_OBJECT",
":",
"return",
"elemen... | Whether this style can be applied at the element path.
@param elementPath | [
"Whether",
"this",
"style",
"can",
"be",
"applied",
"at",
"the",
"element",
"path",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L206-L219 | |
47,585 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/styles/plugin.js | function( label )
{
var styleDefinition = this._.definition,
html = [],
elementName = styleDefinition.element;
// Avoid <bdo> in the preview.
if ( elementName == 'bdo' )
elementName = 'span';
html = [ '<', elementName ];
// Assign all defined attributes.
var attribs = sty... | javascript | function( label )
{
var styleDefinition = this._.definition,
html = [],
elementName = styleDefinition.element;
// Avoid <bdo> in the preview.
if ( elementName == 'bdo' )
elementName = 'span';
html = [ '<', elementName ];
// Assign all defined attributes.
var attribs = sty... | [
"function",
"(",
"label",
")",
"{",
"var",
"styleDefinition",
"=",
"this",
".",
"_",
".",
"definition",
",",
"html",
"=",
"[",
"]",
",",
"elementName",
"=",
"styleDefinition",
".",
"element",
";",
"// Avoid <bdo> in the preview.\r",
"if",
"(",
"elementName",
... | Builds the preview HTML based on the styles definition. | [
"Builds",
"the",
"preview",
"HTML",
"based",
"on",
"the",
"styles",
"definition",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L302-L332 | |
47,586 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/styles/plugin.js | removeFromInsideElement | function removeFromInsideElement( style, element )
{
var def = style._.definition,
attribs = def.attributes,
styles = def.styles,
overrides = getOverrides( style ),
innerElements = element.getElementsByTag( style.element );
for ( var i = innerElements.count(); --i >= 0 ; )
removeFromElemen... | javascript | function removeFromInsideElement( style, element )
{
var def = style._.definition,
attribs = def.attributes,
styles = def.styles,
overrides = getOverrides( style ),
innerElements = element.getElementsByTag( style.element );
for ( var i = innerElements.count(); --i >= 0 ; )
removeFromElemen... | [
"function",
"removeFromInsideElement",
"(",
"style",
",",
"element",
")",
"{",
"var",
"def",
"=",
"style",
".",
"_",
".",
"definition",
",",
"attribs",
"=",
"def",
".",
"attributes",
",",
"styles",
"=",
"def",
".",
"styles",
",",
"overrides",
"=",
"getOv... | Removes a style from inside an element. | [
"Removes",
"a",
"style",
"from",
"inside",
"an",
"element",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1171-L1196 |
47,587 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/styles/plugin.js | removeNoAttribsElement | function removeNoAttribsElement( element )
{
// If no more attributes remained in the element, remove it,
// leaving its children.
if ( !element.hasAttributes() )
{
if ( CKEDITOR.dtd.$block[ element.getName() ] )
{
var previous = element.getPrevious( nonWhitespaces ),
next = element.ge... | javascript | function removeNoAttribsElement( element )
{
// If no more attributes remained in the element, remove it,
// leaving its children.
if ( !element.hasAttributes() )
{
if ( CKEDITOR.dtd.$block[ element.getName() ] )
{
var previous = element.getPrevious( nonWhitespaces ),
next = element.ge... | [
"function",
"removeNoAttribsElement",
"(",
"element",
")",
"{",
"// If no more attributes remained in the element, remove it,\r",
"// leaving its children.\r",
"if",
"(",
"!",
"element",
".",
"hasAttributes",
"(",
")",
")",
"{",
"if",
"(",
"CKEDITOR",
".",
"dtd",
".",
... | If the element has no more attributes, remove it. | [
"If",
"the",
"element",
"has",
"no",
"more",
"attributes",
"remove",
"it",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1236-L1275 |
47,588 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/styles/plugin.js | getOverrides | function getOverrides( style )
{
if ( style._.overrides )
return style._.overrides;
var overrides = ( style._.overrides = {} ),
definition = style._.definition.overrides;
if ( definition )
{
// The override description can be a string, object or array.
// Internally, well handle arrays... | javascript | function getOverrides( style )
{
if ( style._.overrides )
return style._.overrides;
var overrides = ( style._.overrides = {} ),
definition = style._.definition.overrides;
if ( definition )
{
// The override description can be a string, object or array.
// Internally, well handle arrays... | [
"function",
"getOverrides",
"(",
"style",
")",
"{",
"if",
"(",
"style",
".",
"_",
".",
"overrides",
")",
"return",
"style",
".",
"_",
".",
"overrides",
";",
"var",
"overrides",
"=",
"(",
"style",
".",
"_",
".",
"overrides",
"=",
"{",
"}",
")",
",",... | Get the the collection used to compare the elements and attributes,
defined in this style overrides, with other element. All information in
it is lowercased.
@param {CKEDITOR.style} style | [
"Get",
"the",
"the",
"collection",
"used",
"to",
"compare",
"the",
"elements",
"and",
"attributes",
"defined",
"in",
"this",
"style",
"overrides",
"with",
"other",
"element",
".",
"All",
"information",
"in",
"it",
"is",
"lowercased",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1385-L1441 |
47,589 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/styles/plugin.js | normalizeProperty | function normalizeProperty( name, value, isStyle )
{
var temp = new CKEDITOR.dom.element( 'span' );
temp [ isStyle ? 'setStyle' : 'setAttribute' ]( name, value );
return temp[ isStyle ? 'getStyle' : 'getAttribute' ]( name );
} | javascript | function normalizeProperty( name, value, isStyle )
{
var temp = new CKEDITOR.dom.element( 'span' );
temp [ isStyle ? 'setStyle' : 'setAttribute' ]( name, value );
return temp[ isStyle ? 'getStyle' : 'getAttribute' ]( name );
} | [
"function",
"normalizeProperty",
"(",
"name",
",",
"value",
",",
"isStyle",
")",
"{",
"var",
"temp",
"=",
"new",
"CKEDITOR",
".",
"dom",
".",
"element",
"(",
"'span'",
")",
";",
"temp",
"[",
"isStyle",
"?",
"'setStyle'",
":",
"'setAttribute'",
"]",
"(",
... | Make the comparison of attribute value easier by standardizing it. | [
"Make",
"the",
"comparison",
"of",
"attribute",
"value",
"easier",
"by",
"standardizing",
"it",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1444-L1449 |
47,590 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/styles/plugin.js | normalizeCssText | function normalizeCssText( unparsedCssText, nativeNormalize )
{
var styleText;
if ( nativeNormalize !== false )
{
// Injects the style in a temporary span object, so the browser parses it,
// retrieving its final format.
var temp = new CKEDITOR.dom.element( 'span' );
temp.setAttribute( 'style... | javascript | function normalizeCssText( unparsedCssText, nativeNormalize )
{
var styleText;
if ( nativeNormalize !== false )
{
// Injects the style in a temporary span object, so the browser parses it,
// retrieving its final format.
var temp = new CKEDITOR.dom.element( 'span' );
temp.setAttribute( 'style... | [
"function",
"normalizeCssText",
"(",
"unparsedCssText",
",",
"nativeNormalize",
")",
"{",
"var",
"styleText",
";",
"if",
"(",
"nativeNormalize",
"!==",
"false",
")",
"{",
"// Injects the style in a temporary span object, so the browser parses it,\r",
"// retrieving its final fo... | Make the comparison of style text easier by standardizing it. | [
"Make",
"the",
"comparison",
"of",
"style",
"text",
"easier",
"by",
"standardizing",
"it",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1452-L1486 |
47,591 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/styles/plugin.js | parseStyleText | function parseStyleText( styleText )
{
var retval = {};
styleText
.replace( /"/g, '"' )
.replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value )
{
retval[ name ] = value;
} );
return retval;
} | javascript | function parseStyleText( styleText )
{
var retval = {};
styleText
.replace( /"/g, '"' )
.replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value )
{
retval[ name ] = value;
} );
return retval;
} | [
"function",
"parseStyleText",
"(",
"styleText",
")",
"{",
"var",
"retval",
"=",
"{",
"}",
";",
"styleText",
".",
"replace",
"(",
"/",
""",
"/",
"g",
",",
"'\"'",
")",
".",
"replace",
"(",
"/",
"\\s*([^ :;]+)\\s*:\\s*([^;]+)\\s*(?=;|$)",
"/",
"g",
",",... | Turn inline style text properties into one hash. | [
"Turn",
"inline",
"style",
"text",
"properties",
"into",
"one",
"hash",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1489-L1499 |
47,592 | Pegase745/node-gandi | src/gandi.js | defaultApikey | function defaultApikey(apikey) {
if (typeof apikey !== 'undefined') {
if (typeof apikey !== 'string') {
throw new TypeError('`apikey` argument must be a string');
}
if (apikey.length !== 24) {
throw new TypeError('`apikey` argument must be 24 characters long');
... | javascript | function defaultApikey(apikey) {
if (typeof apikey !== 'undefined') {
if (typeof apikey !== 'string') {
throw new TypeError('`apikey` argument must be a string');
}
if (apikey.length !== 24) {
throw new TypeError('`apikey` argument must be 24 characters long');
... | [
"function",
"defaultApikey",
"(",
"apikey",
")",
"{",
"if",
"(",
"typeof",
"apikey",
"!==",
"'undefined'",
")",
"{",
"if",
"(",
"typeof",
"apikey",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'`apikey` argument must be a string'",
")",
";",... | Returns apikey to constructor after some validation.
@param {string} apikey - Apikey passed onto the constructor.
@private | [
"Returns",
"apikey",
"to",
"constructor",
"after",
"some",
"validation",
"."
] | 86566ffa092bb2e16d3d819c244b2be97d62582e | https://github.com/Pegase745/node-gandi/blob/86566ffa092bb2e16d3d819c244b2be97d62582e/src/gandi.js#L23-L36 |
47,593 | Sobesednik/exiftool-context | src/ExiftoolContext.js | makeTempFile | function makeTempFile() {
const n = Math.floor(Math.random() * 100000)
const tempFile = path.join(os.tmpdir(), `node-exiftool_test_${n}.jpg`)
return new Promise((resolve, reject) => {
const rs = fs.createReadStream(jpegFile)
const ws = fs.createWriteStream(tempFile)
rs.on('error', re... | javascript | function makeTempFile() {
const n = Math.floor(Math.random() * 100000)
const tempFile = path.join(os.tmpdir(), `node-exiftool_test_${n}.jpg`)
return new Promise((resolve, reject) => {
const rs = fs.createReadStream(jpegFile)
const ws = fs.createWriteStream(tempFile)
rs.on('error', re... | [
"function",
"makeTempFile",
"(",
")",
"{",
"const",
"n",
"=",
"Math",
".",
"floor",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"100000",
")",
"const",
"tempFile",
"=",
"path",
".",
"join",
"(",
"os",
".",
"tmpdir",
"(",
")",
",",
"`",
"${",
"n",
... | create temp file for writing metadata | [
"create",
"temp",
"file",
"for",
"writing",
"metadata"
] | a6c44d2fd146898fae894ac08c1d381b4a969e2e | https://github.com/Sobesednik/exiftool-context/blob/a6c44d2fd146898fae894ac08c1d381b4a969e2e/src/ExiftoolContext.js#L42-L55 |
47,594 | ghornich/sort-paths | sort-paths.js | sortPaths | function sortPaths(items/* , [iteratee, ] dirSeparator */) {
assert(arguments.length >= 2, 'too few arguments');
assert(arguments.length <= 3, 'too many arguments');
var iteratee, dirSeparator;
if (arguments.length === 2) {
iteratee = identity;
dirSeparator = arguments[1];
}
el... | javascript | function sortPaths(items/* , [iteratee, ] dirSeparator */) {
assert(arguments.length >= 2, 'too few arguments');
assert(arguments.length <= 3, 'too many arguments');
var iteratee, dirSeparator;
if (arguments.length === 2) {
iteratee = identity;
dirSeparator = arguments[1];
}
el... | [
"function",
"sortPaths",
"(",
"items",
"/* , [iteratee, ] dirSeparator */",
")",
"{",
"assert",
"(",
"arguments",
".",
"length",
">=",
"2",
",",
"'too few arguments'",
")",
";",
"assert",
"(",
"arguments",
".",
"length",
"<=",
"3",
",",
"'too many arguments'",
"... | Allows sorting arbitrary items without modifying or copying them
@typedef {Object} itemDTO
@param {String|Object} item - original item
@param {Array} pathTokens - split path tokens. Extracted from `item` using `iteratee` and split using `splitRetain` | [
"Allows",
"sorting",
"arbitrary",
"items",
"without",
"modifying",
"or",
"copying",
"them"
] | 3b8b86f26319748c8d429980145099ad8bb71b8e | https://github.com/ghornich/sort-paths/blob/3b8b86f26319748c8d429980145099ad8bb71b8e/sort-paths.js#L17-L56 |
47,595 | fvsch/gulp-task-maker | state.js | setOptions | function setOptions(input) {
if (!isObject(input)) {
throw new Error('gtm.conf method expects a config object')
}
for (const key of ['debug', 'notify', 'parallel', 'strict']) {
const value = input[key]
if (typeof value === 'boolean') options[key] = value
else if (value != null) options[key] = strT... | javascript | function setOptions(input) {
if (!isObject(input)) {
throw new Error('gtm.conf method expects a config object')
}
for (const key of ['debug', 'notify', 'parallel', 'strict']) {
const value = input[key]
if (typeof value === 'boolean') options[key] = value
else if (value != null) options[key] = strT... | [
"function",
"setOptions",
"(",
"input",
")",
"{",
"if",
"(",
"!",
"isObject",
"(",
"input",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'gtm.conf method expects a config object'",
")",
"}",
"for",
"(",
"const",
"key",
"of",
"[",
"'debug'",
",",
"'notify'... | Override default gulp-task-maker options
@param {object} [input] - options, or undefined to return the current config
@property {string|boolean|number} [input.notify]
@property {string|boolean|number} [input.strict]
@property {object} [input.prefix]
@property {object} [input.groups]
@return {object} | [
"Override",
"default",
"gulp",
"-",
"task",
"-",
"maker",
"options"
] | 20ab4245f2d75174786ad140793e9438c025d546 | https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/state.js#L38-L64 |
47,596 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/bidi/plugin.js | getElementForDirection | function getElementForDirection( node )
{
while ( node && !( node.getName() in allGuardElements || node.is( 'body' ) ) )
{
var parent = node.getParent();
if ( !parent )
break;
node = parent;
}
return node;
} | javascript | function getElementForDirection( node )
{
while ( node && !( node.getName() in allGuardElements || node.is( 'body' ) ) )
{
var parent = node.getParent();
if ( !parent )
break;
node = parent;
}
return node;
} | [
"function",
"getElementForDirection",
"(",
"node",
")",
"{",
"while",
"(",
"node",
"&&",
"!",
"(",
"node",
".",
"getName",
"(",
")",
"in",
"allGuardElements",
"||",
"node",
".",
"is",
"(",
"'body'",
")",
")",
")",
"{",
"var",
"parent",
"=",
"node",
"... | Returns element with possibility of applying the direction.
@param node | [
"Returns",
"element",
"with",
"possibility",
"of",
"applying",
"the",
"direction",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/bidi/plugin.js#L70-L82 |
47,597 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/autogrow/plugin.js | contentHeight | function contentHeight( scrollable )
{
var overflowY = scrollable.getStyle( 'overflow-y' );
var doc = scrollable.getDocument();
// Create a temporary marker element.
var marker = CKEDITOR.dom.element.createFromHtml( '<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;... | javascript | function contentHeight( scrollable )
{
var overflowY = scrollable.getStyle( 'overflow-y' );
var doc = scrollable.getDocument();
// Create a temporary marker element.
var marker = CKEDITOR.dom.element.createFromHtml( '<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;... | [
"function",
"contentHeight",
"(",
"scrollable",
")",
"{",
"var",
"overflowY",
"=",
"scrollable",
".",
"getStyle",
"(",
"'overflow-y'",
")",
";",
"var",
"doc",
"=",
"scrollable",
".",
"getDocument",
"(",
")",
";",
"// Create a temporary marker element.\r",
"var",
... | Actual content height, figured out by appending check the last element's document position. | [
"Actual",
"content",
"height",
"figured",
"out",
"by",
"appending",
"check",
"the",
"last",
"element",
"s",
"document",
"position",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/autogrow/plugin.js#L12-L25 |
47,598 | twolfson/value-mapper | lib/value-mapper.js | ValueMapper | function ValueMapper(input, options) {
// Save input for later
this.input = input;
// Save placeholder middlewares
this.middlewares = [];
// Fallback options
options = options || {};
// Add each of the middlewares
var middlewares = options.middlewares || [];
middlewares.forEach(this.addMiddleware, ... | javascript | function ValueMapper(input, options) {
// Save input for later
this.input = input;
// Save placeholder middlewares
this.middlewares = [];
// Fallback options
options = options || {};
// Add each of the middlewares
var middlewares = options.middlewares || [];
middlewares.forEach(this.addMiddleware, ... | [
"function",
"ValueMapper",
"(",
"input",
",",
"options",
")",
"{",
"// Save input for later",
"this",
".",
"input",
"=",
"input",
";",
"// Save placeholder middlewares",
"this",
".",
"middlewares",
"=",
"[",
"]",
";",
"// Fallback options",
"options",
"=",
"option... | Constructor for mapping values
@param {Object} input Key-value pairs to map values across
@param {Object} [options] Flags to adjust how the mapping is performed
@param {Function[]} [options.middlewares] Middlewares to process resolved value through | [
"Constructor",
"for",
"mapping",
"values"
] | 956cfa193e02b6c4ae0e607b14eea41a15b7331d | https://github.com/twolfson/value-mapper/blob/956cfa193e02b6c4ae0e607b14eea41a15b7331d/lib/value-mapper.js#L13-L26 |
47,599 | twolfson/value-mapper | lib/value-mapper.js | function (key) {
// Assume the middleware is a function
var middleware = key;
// If the middleware is a string
if (typeof middleware === 'string') {
// Look it up and assert it was found
middleware = MIDDLEWARES[key];
assert(middleware, 'value-mapper middleware "' + key + '" could not... | javascript | function (key) {
// Assume the middleware is a function
var middleware = key;
// If the middleware is a string
if (typeof middleware === 'string') {
// Look it up and assert it was found
middleware = MIDDLEWARES[key];
assert(middleware, 'value-mapper middleware "' + key + '" could not... | [
"function",
"(",
"key",
")",
"{",
"// Assume the middleware is a function",
"var",
"middleware",
"=",
"key",
";",
"// If the middleware is a string",
"if",
"(",
"typeof",
"middleware",
"===",
"'string'",
")",
"{",
"// Look it up and assert it was found",
"middleware",
"="... | Add middleware to instance | [
"Add",
"middleware",
"to",
"instance"
] | 956cfa193e02b6c4ae0e607b14eea41a15b7331d | https://github.com/twolfson/value-mapper/blob/956cfa193e02b6c4ae0e607b14eea41a15b7331d/lib/value-mapper.js#L29-L42 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.