repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
jlewczyk/git-hooks-js-win | lib/git-hooks-debug.js | function (filename, arg, callback) {
console.log('*** git-hooks.js run', filename, arg);
var hookName = path.basename(filename);
var hooksDirname = path.resolve(path.dirname(filename), '../../.githooks', hookName);
if (fsHelpers.exists(hooksDirname)) {
var list = fs.readdirSyn... | javascript | function (filename, arg, callback) {
console.log('*** git-hooks.js run', filename, arg);
var hookName = path.basename(filename);
var hooksDirname = path.resolve(path.dirname(filename), '../../.githooks', hookName);
if (fsHelpers.exists(hooksDirname)) {
var list = fs.readdirSyn... | [
"function",
"(",
"filename",
",",
"arg",
",",
"callback",
")",
"{",
"console",
".",
"log",
"(",
"'*** git-hooks.js run'",
",",
"filename",
",",
"arg",
")",
";",
"var",
"hookName",
"=",
"path",
".",
"basename",
"(",
"filename",
")",
";",
"var",
"hooksDirn... | Runs a git hook.
@param {String} filename Path to git hook.
@param {String} [arg] Git hook argument.
@param {Function} callback | [
"Runs",
"a",
"git",
"hook",
"."
] | e156f88ad7aec76c9180c70656c5568ad89f9de7 | https://github.com/jlewczyk/git-hooks-js-win/blob/e156f88ad7aec76c9180c70656c5568ad89f9de7/lib/git-hooks-debug.js#L126-L142 | train | |
jlewczyk/git-hooks-js-win | lib/git-hooks-debug.js | runHooks | function runHooks(hooks, args, callback) {
console.log('*** git-hooks.js runHooks', hooks, args);
if (!hooks.length) {
callback(0);
return;
}
try {
var hook = spawnHook(hooks.shift(), args);
hook.on('close', function (code) {
if (code === 0) {
... | javascript | function runHooks(hooks, args, callback) {
console.log('*** git-hooks.js runHooks', hooks, args);
if (!hooks.length) {
callback(0);
return;
}
try {
var hook = spawnHook(hooks.shift(), args);
hook.on('close', function (code) {
if (code === 0) {
... | [
"function",
"runHooks",
"(",
"hooks",
",",
"args",
",",
"callback",
")",
"{",
"console",
".",
"log",
"(",
"'*** git-hooks.js runHooks'",
",",
"hooks",
",",
"args",
")",
";",
"if",
"(",
"!",
"hooks",
".",
"length",
")",
"{",
"callback",
"(",
"0",
")",
... | Runs hooks.
@param {String[]} hooks List of hook names to execute.
@param {String[]} args
@param {Function} callback | [
"Runs",
"hooks",
"."
] | e156f88ad7aec76c9180c70656c5568ad89f9de7 | https://github.com/jlewczyk/git-hooks-js-win/blob/e156f88ad7aec76c9180c70656c5568ad89f9de7/lib/git-hooks-debug.js#L152-L170 | train |
enriched/repeating-interval | interval.js | function () {
if (this._duration) {
return this._duration;
}
if (this._start && this._end) {
return moment.duration(this._end - this._start);
}
else {
return moment.duration(0);
}
} | javascript | function () {
if (this._duration) {
return this._duration;
}
if (this._start && this._end) {
return moment.duration(this._end - this._start);
}
else {
return moment.duration(0);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_duration",
")",
"{",
"return",
"this",
".",
"_duration",
";",
"}",
"if",
"(",
"this",
".",
"_start",
"&&",
"this",
".",
"_end",
")",
"{",
"return",
"moment",
".",
"duration",
"(",
"this",
".",
... | The duration of a single repition of the interval | [
"The",
"duration",
"of",
"a",
"single",
"repition",
"of",
"the",
"interval"
] | 059173390aabbd84615fe7bc98ecca695d5d2c47 | https://github.com/enriched/repeating-interval/blob/059173390aabbd84615fe7bc98ecca695d5d2c47/interval.js#L225-L235 | train | |
anvaka/ngraph.shremlin | lib/utils/filterExpression.js | createFilter | function createFilter(filterExpression) {
if (typeof filterExpression === 'undefined') {
throw new Error('Filter expression should be defined');
}
if (isSimpleType(filterExpression)) {
return simpleTypeFilter(filterExpression);
} else if (isCustomPredicate(filterExpression)) {
return customPredicat... | javascript | function createFilter(filterExpression) {
if (typeof filterExpression === 'undefined') {
throw new Error('Filter expression should be defined');
}
if (isSimpleType(filterExpression)) {
return simpleTypeFilter(filterExpression);
} else if (isCustomPredicate(filterExpression)) {
return customPredicat... | [
"function",
"createFilter",
"(",
"filterExpression",
")",
"{",
"if",
"(",
"typeof",
"filterExpression",
"===",
"'undefined'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Filter expression should be defined'",
")",
";",
"}",
"if",
"(",
"isSimpleType",
"(",
"filterExp... | This method creates custom filter predicate based on `filterExpression`
value.
When `filterExpression` is a simple type (Number, String or Boolean), then
returned predicate compares `data` property directly with that value:
```
var match42 = createFilter(42);
// this will print true:
console.log(match42({data: 42}));... | [
"This",
"method",
"creates",
"custom",
"filter",
"predicate",
"based",
"on",
"filterExpression",
"value",
"."
] | 98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7 | https://github.com/anvaka/ngraph.shremlin/blob/98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7/lib/utils/filterExpression.js#L81-L95 | train |
rksm/ace.improved | lib/ace.ext.keys.js | toUnicode | function toUnicode(charCode) {
var result = charCode.toString(16).toUpperCase();
while (result.length < 4) result = '0' + result;
return '\\u' + result;
} | javascript | function toUnicode(charCode) {
var result = charCode.toString(16).toUpperCase();
while (result.length < 4) result = '0' + result;
return '\\u' + result;
} | [
"function",
"toUnicode",
"(",
"charCode",
")",
"{",
"var",
"result",
"=",
"charCode",
".",
"toString",
"(",
"16",
")",
".",
"toUpperCase",
"(",
")",
";",
"while",
"(",
"result",
".",
"length",
"<",
"4",
")",
"result",
"=",
"'0'",
"+",
"result",
";",
... | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- eventing stuff -=-=-=-=-=-=-=- | [
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"... | b0b5014d9e31046608a10714c850a2441223a8f3 | https://github.com/rksm/ace.improved/blob/b0b5014d9e31046608a10714c850a2441223a8f3/lib/ace.ext.keys.js#L514-L518 | train |
saggiyogesh/nodeportal | lib/permissions/PermissionError.js | PermissionError | function PermissionError(message, userName, actionKey) {
this.name = "PermissionError";
this.message = message || (userName && actionKey) ? "Permission Error. User " + userName + " is not authorized to " + actionKey : "Permission Error";
this.localizedMessageKey = "permission-error";
} | javascript | function PermissionError(message, userName, actionKey) {
this.name = "PermissionError";
this.message = message || (userName && actionKey) ? "Permission Error. User " + userName + " is not authorized to " + actionKey : "Permission Error";
this.localizedMessageKey = "permission-error";
} | [
"function",
"PermissionError",
"(",
"message",
",",
"userName",
",",
"actionKey",
")",
"{",
"this",
".",
"name",
"=",
"\"PermissionError\"",
";",
"this",
".",
"message",
"=",
"message",
"||",
"(",
"userName",
"&&",
"actionKey",
")",
"?",
"\"Permission Error. U... | This error is thrown when user role is not having permission to perform any action | [
"This",
"error",
"is",
"thrown",
"when",
"user",
"role",
"is",
"not",
"having",
"permission",
"to",
"perform",
"any",
"action"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/permissions/PermissionError.js#L5-L9 | train |
garanj/amphtml-autoscript | index.js | create | function create(opt_options) {
function runInclude(file, encoding, callback) {
if (file.isNull()) {
return callback(null, file);
}
if (file.isStream()) {
this.emit('error', new PluginError(PLUGIN_NAME,
'Streams not supported!'));
}
if (file.isBuffer()) {
addIncludesToFi... | javascript | function create(opt_options) {
function runInclude(file, encoding, callback) {
if (file.isNull()) {
return callback(null, file);
}
if (file.isStream()) {
this.emit('error', new PluginError(PLUGIN_NAME,
'Streams not supported!'));
}
if (file.isBuffer()) {
addIncludesToFi... | [
"function",
"create",
"(",
"opt_options",
")",
"{",
"function",
"runInclude",
"(",
"file",
",",
"encoding",
",",
"callback",
")",
"{",
"if",
"(",
"file",
".",
"isNull",
"(",
")",
")",
"{",
"return",
"callback",
"(",
"null",
",",
"file",
")",
";",
"}"... | Imports the required AMP custom-element script tags into an AMP document.
@param {Object} opt_options Configurations options, currently:
placeholder: Overrides the default placeholder.
mode: Overrides the default mode (MODES.PLACEHOLDER);
@return {!Transform} The created stream.Transform object. | [
"Imports",
"the",
"required",
"AMP",
"custom",
"-",
"element",
"script",
"tags",
"into",
"an",
"AMP",
"document",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L50-L72 | train |
garanj/amphtml-autoscript | index.js | addIncludesToFile | async function addIncludesToFile(file,
opt_options) {
const overrideMap = await readComponentsMap('./amp-versions.json');
const html = file.contents.toString();
const newHtml = await addIncludesToHtml(html, overrideMap, opt_options);
file.contents = new Buffer(newHtml);
return file;
} | javascript | async function addIncludesToFile(file,
opt_options) {
const overrideMap = await readComponentsMap('./amp-versions.json');
const html = file.contents.toString();
const newHtml = await addIncludesToHtml(html, overrideMap, opt_options);
file.contents = new Buffer(newHtml);
return file;
} | [
"async",
"function",
"addIncludesToFile",
"(",
"file",
",",
"opt_options",
")",
"{",
"const",
"overrideMap",
"=",
"await",
"readComponentsMap",
"(",
"'./amp-versions.json'",
")",
";",
"const",
"html",
"=",
"file",
".",
"contents",
".",
"toString",
"(",
")",
";... | Identifies missing AMP custom-elementscript tags in an AMP HTML file and
adds them.
@param {!Vinyl} file The file to add script tags to.
@param {Object} opt_options See {@code create}.
@return {!Vinyl} The modified file. | [
"Identifies",
"missing",
"AMP",
"custom",
"-",
"elementscript",
"tags",
"in",
"an",
"AMP",
"HTML",
"file",
"and",
"adds",
"them",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L82-L89 | train |
garanj/amphtml-autoscript | index.js | addIncludesToHtml | async function addIncludesToHtml(html, overrideMap,
opt_options) {
let instance = await amphtmlValidator.getInstance();
const options = opt_options || {};
if (options.updateComponentsMap) {
await updateComponentMap();
}
const versionMap = await readComponentsMap(COMPONENTS_MAP_PATH);
const result =... | javascript | async function addIncludesToHtml(html, overrideMap,
opt_options) {
let instance = await amphtmlValidator.getInstance();
const options = opt_options || {};
if (options.updateComponentsMap) {
await updateComponentMap();
}
const versionMap = await readComponentsMap(COMPONENTS_MAP_PATH);
const result =... | [
"async",
"function",
"addIncludesToHtml",
"(",
"html",
",",
"overrideMap",
",",
"opt_options",
")",
"{",
"let",
"instance",
"=",
"await",
"amphtmlValidator",
".",
"getInstance",
"(",
")",
";",
"const",
"options",
"=",
"opt_options",
"||",
"{",
"}",
";",
"if"... | Identifies missing AMP custom-element script tags in an AMP HTML test and
adds them.
This is achieved by:
1. Running the AMP validator and filtering for errors for missing extensions.
2. Creating <script> elements using versions taken from GitHub directory
listings.
@param {!Vinyl} file The file to add script tags to... | [
"Identifies",
"missing",
"AMP",
"custom",
"-",
"element",
"script",
"tags",
"in",
"an",
"AMP",
"HTML",
"test",
"and",
"adds",
"them",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L105-L168 | train |
garanj/amphtml-autoscript | index.js | updateComponentMap | async function updateComponentMap() {
const response = await fetch(GITHUB_AMPHTML_TREE_URL);
const data = await response.json();
const pairs = data.tree.map((item) => item.path.match(REGEX_EXTENSION_DIR))
.filter((match) => match && !match[1].endsWith('impl'))
.map((match) => [... | javascript | async function updateComponentMap() {
const response = await fetch(GITHUB_AMPHTML_TREE_URL);
const data = await response.json();
const pairs = data.tree.map((item) => item.path.match(REGEX_EXTENSION_DIR))
.filter((match) => match && !match[1].endsWith('impl'))
.map((match) => [... | [
"async",
"function",
"updateComponentMap",
"(",
")",
"{",
"const",
"response",
"=",
"await",
"fetch",
"(",
"GITHUB_AMPHTML_TREE_URL",
")",
";",
"const",
"data",
"=",
"await",
"response",
".",
"json",
"(",
")",
";",
"const",
"pairs",
"=",
"data",
".",
"tree... | Create a map from component to version number, based on GitHub directory
structure. | [
"Create",
"a",
"map",
"from",
"component",
"to",
"version",
"number",
"based",
"on",
"GitHub",
"directory",
"structure",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L206-L219 | train |
garanj/amphtml-autoscript | index.js | writeComponentsMap | function writeComponentsMap(path, componentsMap) {
return new Promise((resolve, reject) => {
const data = JSON.stringify(componentsMap);
fs.writeFile(path, data, (err) => {
if (err) {
return reject(err);
}
resolve(data.length);
});
});
} | javascript | function writeComponentsMap(path, componentsMap) {
return new Promise((resolve, reject) => {
const data = JSON.stringify(componentsMap);
fs.writeFile(path, data, (err) => {
if (err) {
return reject(err);
}
resolve(data.length);
});
});
} | [
"function",
"writeComponentsMap",
"(",
"path",
",",
"componentsMap",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"data",
"=",
"JSON",
".",
"stringify",
"(",
"componentsMap",
")",
";",
"fs",
".",
"wri... | Writes a component map to the file system.
@param {string} path The path to the file to write to.
@param {Object} componentsMap The map of components to versions.
@return {number} The length of data written. | [
"Writes",
"a",
"component",
"map",
"to",
"the",
"file",
"system",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L228-L238 | train |
garanj/amphtml-autoscript | index.js | readComponentsMap | async function readComponentsMap(path) {
return new Promise((resolve, reject) => {
fs.readFile(path, (err, data) => {
if (err) {
return resolve({});
}
resolve(JSON.parse(data));
});
});
} | javascript | async function readComponentsMap(path) {
return new Promise((resolve, reject) => {
fs.readFile(path, (err, data) => {
if (err) {
return resolve({});
}
resolve(JSON.parse(data));
});
});
} | [
"async",
"function",
"readComponentsMap",
"(",
"path",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"readFile",
"(",
"path",
",",
"(",
"err",
",",
"data",
")",
"=>",
"{",
"if",
"(",
"err",
")"... | Reads a component map from the file system.
@param {string} path The path to the file to write to.
@return {Object} The map of components to versions. | [
"Reads",
"a",
"component",
"map",
"from",
"the",
"file",
"system",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L246-L255 | train |
garanj/amphtml-autoscript | index.js | createAmpCustomElementTag | function createAmpCustomElementTag(tagName, version) {
const scriptType = AMP_SCRIPT_TYPE_MAP[tagName] || 'custom-element';
return `<script async ${scriptType}="${tagName}" ` +
`src="https://cdn.ampproject.org/v0/${tagName}-${version}.js"></script>`;
} | javascript | function createAmpCustomElementTag(tagName, version) {
const scriptType = AMP_SCRIPT_TYPE_MAP[tagName] || 'custom-element';
return `<script async ${scriptType}="${tagName}" ` +
`src="https://cdn.ampproject.org/v0/${tagName}-${version}.js"></script>`;
} | [
"function",
"createAmpCustomElementTag",
"(",
"tagName",
",",
"version",
")",
"{",
"const",
"scriptType",
"=",
"AMP_SCRIPT_TYPE_MAP",
"[",
"tagName",
"]",
"||",
"'custom-element'",
";",
"return",
"`",
"${",
"scriptType",
"}",
"${",
"tagName",
"}",
"`",
"+",
"`... | Builds a script tag for a custom element.
@param {string} tagName The custom element to include.
@param {number} version The version number to include.
@return {string} The <script> tag. | [
"Builds",
"a",
"script",
"tag",
"for",
"a",
"custom",
"element",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L274-L278 | train |
saggiyogesh/nodeportal | public/ckeditor/_source/core/dom/document.js | function( cssFileUrl )
{
if ( this.$.createStyleSheet )
this.$.createStyleSheet( cssFileUrl );
else
{
var link = new CKEDITOR.dom.element( 'link' );
link.setAttributes(
{
rel :'stylesheet',
type : 'text/css',
href : cssFileUrl
});
this.getHead().app... | javascript | function( cssFileUrl )
{
if ( this.$.createStyleSheet )
this.$.createStyleSheet( cssFileUrl );
else
{
var link = new CKEDITOR.dom.element( 'link' );
link.setAttributes(
{
rel :'stylesheet',
type : 'text/css',
href : cssFileUrl
});
this.getHead().app... | [
"function",
"(",
"cssFileUrl",
")",
"{",
"if",
"(",
"this",
".",
"$",
".",
"createStyleSheet",
")",
"this",
".",
"$",
".",
"createStyleSheet",
"(",
"cssFileUrl",
")",
";",
"else",
"{",
"var",
"link",
"=",
"new",
"CKEDITOR",
".",
"dom",
".",
"element",
... | Appends a CSS file to the document.
@param {String} cssFileUrl The CSS file URL.
@example
<b>CKEDITOR.document.appendStyleSheet( '/mystyles.css' )</b>; | [
"Appends",
"a",
"CSS",
"file",
"to",
"the",
"document",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/document.js#L37-L53 | train | |
saggiyogesh/nodeportal | public/ckeditor/_source/core/dom/document.js | function()
{
var head = this.$.getElementsByTagName( 'head' )[0];
if ( !head )
head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true );
else
head = new CKEDITOR.dom.element( head );
return (
this.getHead = function()
{
return head;
})();
} | javascript | function()
{
var head = this.$.getElementsByTagName( 'head' )[0];
if ( !head )
head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true );
else
head = new CKEDITOR.dom.element( head );
return (
this.getHead = function()
{
return head;
})();
} | [
"function",
"(",
")",
"{",
"var",
"head",
"=",
"this",
".",
"$",
".",
"getElementsByTagName",
"(",
"'head'",
")",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"head",
")",
"head",
"=",
"this",
".",
"getDocumentElement",
"(",
")",
".",
"append",
"(",
"new",
... | Gets the <head> element for this document.
@returns {CKEDITOR.dom.element} The <head> element.
@example
var element = <b>CKEDITOR.document.getHead()</b>;
alert( element.getName() ); // "head" | [
"Gets",
"the",
"<",
";",
"head>",
";",
"element",
"for",
"this",
"document",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/document.js#L165-L178 | train | |
saggiyogesh/nodeportal | lib/permissions/PermissionDefinitionProcessor.js | isActionsExistsInPermissionActions | function isActionsExistsInPermissionActions(allActions, schemaActions) {
return utils.contains(allActions.sort().join(), schemaActions.sort().join());
} | javascript | function isActionsExistsInPermissionActions(allActions, schemaActions) {
return utils.contains(allActions.sort().join(), schemaActions.sort().join());
} | [
"function",
"isActionsExistsInPermissionActions",
"(",
"allActions",
",",
"schemaActions",
")",
"{",
"return",
"utils",
".",
"contains",
"(",
"allActions",
".",
"sort",
"(",
")",
".",
"join",
"(",
")",
",",
"schemaActions",
".",
"sort",
"(",
")",
".",
"join"... | Returns true if schemaActions exists in allActions
@param allActions {Array} all actions in defined in permission definition file
@param schemaActions {Array} actions allowed in particular schema entry in definition file | [
"Returns",
"true",
"if",
"schemaActions",
"exists",
"in",
"allActions"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/permissions/PermissionDefinitionProcessor.js#L35-L37 | train |
saggiyogesh/nodeportal | lib/permissions/PermissionDefinitionProcessor.js | insertSettingsPluginsPermission | function insertSettingsPluginsPermission(app, next) {
var pluginsHome = utils.getRootPath() + "/plugins",
settingsPlugins = Object.keys(plugins.getSettingsPlugins());
var dbActionInstance = DBActions.getSimpleInstance(app, "SchemaPermissions");
var pluginInstanceHandler = require(utils.getLibPath() ... | javascript | function insertSettingsPluginsPermission(app, next) {
var pluginsHome = utils.getRootPath() + "/plugins",
settingsPlugins = Object.keys(plugins.getSettingsPlugins());
var dbActionInstance = DBActions.getSimpleInstance(app, "SchemaPermissions");
var pluginInstanceHandler = require(utils.getLibPath() ... | [
"function",
"insertSettingsPluginsPermission",
"(",
"app",
",",
"next",
")",
"{",
"var",
"pluginsHome",
"=",
"utils",
".",
"getRootPath",
"(",
")",
"+",
"\"/plugins\"",
",",
"settingsPlugins",
"=",
"Object",
".",
"keys",
"(",
"plugins",
".",
"getSettingsPlugins"... | Function used to insert settings plugin schema permissions
@param app
@param next | [
"Function",
"used",
"to",
"insert",
"settings",
"plugin",
"schema",
"permissions"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/permissions/PermissionDefinitionProcessor.js#L110-L144 | train |
saggiyogesh/nodeportal | public/ckeditor/_source/core/editor.js | function()
{
this.fire( 'beforeGetData' );
var eventData = this._.data;
if ( typeof eventData != 'string' )
{
var element = this.element;
if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml... | javascript | function()
{
this.fire( 'beforeGetData' );
var eventData = this._.data;
if ( typeof eventData != 'string' )
{
var element = this.element;
if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml... | [
"function",
"(",
")",
"{",
"this",
".",
"fire",
"(",
"'beforeGetData'",
")",
";",
"var",
"eventData",
"=",
"this",
".",
"_",
".",
"data",
";",
"if",
"(",
"typeof",
"eventData",
"!=",
"'string'",
")",
"{",
"var",
"element",
"=",
"this",
".",
"element"... | Gets the editor data. The data will be in raw format. It is the same
data that is posted by the editor.
@type String
@returns (String) The editor data.
@example
if ( CKEDITOR.instances.editor1.<strong>getData()</strong> == '' )
alert( 'There is no data available' ); | [
"Gets",
"the",
"editor",
"data",
".",
"The",
"data",
"will",
"be",
"in",
"raw",
"format",
".",
"It",
"is",
"the",
"same",
"data",
"that",
"is",
"posted",
"by",
"the",
"editor",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/editor.js#L638-L659 | train | |
saggiyogesh/nodeportal | public/ckeditor/_source/core/htmlparser/comment.js | function( writer, filter )
{
var comment = this.value;
if ( filter )
{
if ( !( comment = filter.onComment( comment, this ) ) )
return;
if ( typeof comment != 'string' )
{
comment.parent = this.parent;
comment.writeHtml( writer, filter );
return;
}
}
writer.comm... | javascript | function( writer, filter )
{
var comment = this.value;
if ( filter )
{
if ( !( comment = filter.onComment( comment, this ) ) )
return;
if ( typeof comment != 'string' )
{
comment.parent = this.parent;
comment.writeHtml( writer, filter );
return;
}
}
writer.comm... | [
"function",
"(",
"writer",
",",
"filter",
")",
"{",
"var",
"comment",
"=",
"this",
".",
"value",
";",
"if",
"(",
"filter",
")",
"{",
"if",
"(",
"!",
"(",
"comment",
"=",
"filter",
".",
"onComment",
"(",
"comment",
",",
"this",
")",
")",
")",
"ret... | Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.
@param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
@example | [
"Writes",
"the",
"HTML",
"representation",
"of",
"this",
"comment",
"to",
"a",
"CKEDITOR",
".",
"htmlWriter",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/htmlparser/comment.js#L41-L59 | train | |
slideme/rorschach | lib/RetryPolicy.js | RetryPolicy | function RetryPolicy(options) {
options = options || {};
if (typeof options.maxAttempts === 'number') {
this.maxAttempts = options.maxAttempts;
}
else {
this.maxAttempts = RetryPolicy.DEFAULT_MAX_ATTEMPTS;
}
if (typeof options.codes === 'function') {
this.isRetryable = options.codes;
}
els... | javascript | function RetryPolicy(options) {
options = options || {};
if (typeof options.maxAttempts === 'number') {
this.maxAttempts = options.maxAttempts;
}
else {
this.maxAttempts = RetryPolicy.DEFAULT_MAX_ATTEMPTS;
}
if (typeof options.codes === 'function') {
this.isRetryable = options.codes;
}
els... | [
"function",
"RetryPolicy",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"typeof",
"options",
".",
"maxAttempts",
"===",
"'number'",
")",
"{",
"this",
".",
"maxAttempts",
"=",
"options",
".",
"maxAttempts",
";",
"}"... | Retry policy controls behavior of Rorschach in case of errors.
@constructor
@param {Object} [options] Options:
@param {Number} options.maxAttempts Max number of attempts
@param {Array.<String>|Function} options.codes Error codes or error validation function | [
"Retry",
"policy",
"controls",
"behavior",
"of",
"Rorschach",
"in",
"case",
"of",
"errors",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/RetryPolicy.js#L22-L38 | train |
JoTrdl/grunt-dock | tasks/dock.js | function(command, arg) {
if (!arg) {
arg = 'default';
}
if (!commands[command]) {
grunt.fail.fatal('Command [' + command + '] not found.');
}
// Check arg
if (typeof (commands[command]) !== 'function') {
if (!commands[command][arg]) {
grunt.fail.fatal('Argument [' + a... | javascript | function(command, arg) {
if (!arg) {
arg = 'default';
}
if (!commands[command]) {
grunt.fail.fatal('Command [' + command + '] not found.');
}
// Check arg
if (typeof (commands[command]) !== 'function') {
if (!commands[command][arg]) {
grunt.fail.fatal('Argument [' + a... | [
"function",
"(",
"command",
",",
"arg",
")",
"{",
"if",
"(",
"!",
"arg",
")",
"{",
"arg",
"=",
"'default'",
";",
"}",
"if",
"(",
"!",
"commands",
"[",
"command",
"]",
")",
"{",
"grunt",
".",
"fail",
".",
"fatal",
"(",
"'Command ['",
"+",
"command... | Process the given command with arg. | [
"Process",
"the",
"given",
"command",
"with",
"arg",
"."
] | ea731dd4679c88cb7c6ae812affd1214c7eb43a9 | https://github.com/JoTrdl/grunt-dock/blob/ea731dd4679c88cb7c6ae812affd1214c7eb43a9/tasks/dock.js#L23-L57 | train | |
levilindsey/physx | src/integrator/src/rk4-integrator.js | _calculateDerivative | function _calculateDerivative(out, state, job, t, dt, d) {
vec3.scaleAndAdd(state.position, state.position, d.velocity, dt);
vec3.scaleAndAdd(state.momentum, state.momentum, d.force, dt);
_geometry.scaleAndAddQuat(state.orientation, state.orientation, d.spin, dt);
vec3.scaleAndAdd(state.angularMomentum, state.a... | javascript | function _calculateDerivative(out, state, job, t, dt, d) {
vec3.scaleAndAdd(state.position, state.position, d.velocity, dt);
vec3.scaleAndAdd(state.momentum, state.momentum, d.force, dt);
_geometry.scaleAndAddQuat(state.orientation, state.orientation, d.spin, dt);
vec3.scaleAndAdd(state.angularMomentum, state.a... | [
"function",
"_calculateDerivative",
"(",
"out",
",",
"state",
",",
"job",
",",
"t",
",",
"dt",
",",
"d",
")",
"{",
"vec3",
".",
"scaleAndAdd",
"(",
"state",
".",
"position",
",",
"state",
".",
"position",
",",
"d",
".",
"velocity",
",",
"dt",
")",
... | Calculate the derivative from the given state with the given time step.
@param {PhysicsDerivative} out
@param {PhysicsState} state
@param {PhysicsJob} job
@param {number} t
@param {number} dt
@param {PhysicsDerivative} d
@private | [
"Calculate",
"the",
"derivative",
"from",
"the",
"given",
"state",
"with",
"the",
"given",
"time",
"step",
"."
] | 62df9f6968082ed34aa784a23f3db6c8feca6f3a | https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/integrator/src/rk4-integrator.js#L83-L103 | train |
backbeam/backbeamjs | cache.js | Cache | function Cache(maxSize, debug, storage) {
this.maxSize_ = maxSize || -1;
this.debug_ = debug || false;
this.storage_ = storage || new Cache.BasicCacheStorage();
this.fillFactor_ = .75;
this.stats_ = {};
this.stats_['hits'] = 0;
this.stats_['misses'] = 0;
this.log_('Initialized cache wi... | javascript | function Cache(maxSize, debug, storage) {
this.maxSize_ = maxSize || -1;
this.debug_ = debug || false;
this.storage_ = storage || new Cache.BasicCacheStorage();
this.fillFactor_ = .75;
this.stats_ = {};
this.stats_['hits'] = 0;
this.stats_['misses'] = 0;
this.log_('Initialized cache wi... | [
"function",
"Cache",
"(",
"maxSize",
",",
"debug",
",",
"storage",
")",
"{",
"this",
".",
"maxSize_",
"=",
"maxSize",
"||",
"-",
"1",
";",
"this",
".",
"debug_",
"=",
"debug",
"||",
"false",
";",
"this",
".",
"storage_",
"=",
"storage",
"||",
"new",
... | Creates a new Cache object.
@param {number} maxSize The maximum size of the cache (or -1 for no max).
@param {boolean} debug Whether to log events to the console.log.
@constructor | [
"Creates",
"a",
"new",
"Cache",
"object",
"."
] | 3d664a2edcb680da076a0f3b3afa717290f6c215 | https://github.com/backbeam/backbeamjs/blob/3d664a2edcb680da076a0f3b3afa717290f6c215/cache.js#L36-L47 | train |
enquirer/prompt-autocompletion | index.js | Prompt | function Prompt() {
BasePrompt.apply(this, arguments);
if (typeof this.question.source !== 'function') {
throw new TypeError('expected source to be defined');
}
this.currentChoices = [];
this.firstRender = true;
this.selected = 0;
// Make sure no default is set (so it won't be printed)
this.questi... | javascript | function Prompt() {
BasePrompt.apply(this, arguments);
if (typeof this.question.source !== 'function') {
throw new TypeError('expected source to be defined');
}
this.currentChoices = [];
this.firstRender = true;
this.selected = 0;
// Make sure no default is set (so it won't be printed)
this.questi... | [
"function",
"Prompt",
"(",
")",
"{",
"BasePrompt",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"typeof",
"this",
".",
"question",
".",
"source",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'expected source to be ... | Create a new autocomplete `Prompt` | [
"Create",
"a",
"new",
"autocomplete",
"Prompt"
] | ea9daf347b0129e22a235de82bdc71038d34b341 | https://github.com/enquirer/prompt-autocompletion/blob/ea9daf347b0129e22a235de82bdc71038d34b341/index.js#L21-L34 | train |
UsabilityDynamics/node-wordpress-client | examples/create.js | insertCallback | function insertCallback(error, data) {
console.log(require('util').inspect(error ? error.message : data, { showHidden: true, colors: true, depth: 2 }));
} | javascript | function insertCallback(error, data) {
console.log(require('util').inspect(error ? error.message : data, { showHidden: true, colors: true, depth: 2 }));
} | [
"function",
"insertCallback",
"(",
"error",
",",
"data",
")",
"{",
"console",
".",
"log",
"(",
"require",
"(",
"'util'",
")",
".",
"inspect",
"(",
"error",
"?",
"error",
".",
"message",
":",
"data",
",",
"{",
"showHidden",
":",
"true",
",",
"colors",
... | Insertion Callback.
@param error
@param data | [
"Insertion",
"Callback",
"."
] | 2b47a7c5cadd3d8f2cfd255f997f36af14a5d843 | https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/examples/create.js#L13-L15 | train |
JoTrdl/grunt-dock | lib/container.js | function(tag, confImage, callback) {
grunt.log.subhead(actioning[action] + ' image [' + tag + ']');
async.waterfall([
// Step 1: search for a running container with the same image
function(cb) {
docker.listContainers({
all : 1,
// filters: (action !== 'unpause') ? '{... | javascript | function(tag, confImage, callback) {
grunt.log.subhead(actioning[action] + ' image [' + tag + ']');
async.waterfall([
// Step 1: search for a running container with the same image
function(cb) {
docker.listContainers({
all : 1,
// filters: (action !== 'unpause') ? '{... | [
"function",
"(",
"tag",
",",
"confImage",
",",
"callback",
")",
"{",
"grunt",
".",
"log",
".",
"subhead",
"(",
"actioning",
"[",
"action",
"]",
"+",
"' image ['",
"+",
"tag",
"+",
"']'",
")",
";",
"async",
".",
"waterfall",
"(",
"[",
"// Step 1: search... | process 1 container with image tag | [
"process",
"1",
"container",
"with",
"image",
"tag"
] | ea731dd4679c88cb7c6ae812affd1214c7eb43a9 | https://github.com/JoTrdl/grunt-dock/blob/ea731dd4679c88cb7c6ae812affd1214c7eb43a9/lib/container.js#L159-L215 | train | |
saggiyogesh/nodeportal | lib/Renderer/PluginRender.js | PluginRender | function PluginRender(pluginInstance, rendererInstance) {
this._view = "index.jade";
this._locals = {};
var ns = pluginInstance.pluginNamespace, obj = PluginHelper.getPluginIdAndIId(ns), pluginId = obj.pluginId,
req = PluginHelper.cloneRequest(rendererInstance.req, pluginId), res = rendererInstance... | javascript | function PluginRender(pluginInstance, rendererInstance) {
this._view = "index.jade";
this._locals = {};
var ns = pluginInstance.pluginNamespace, obj = PluginHelper.getPluginIdAndIId(ns), pluginId = obj.pluginId,
req = PluginHelper.cloneRequest(rendererInstance.req, pluginId), res = rendererInstance... | [
"function",
"PluginRender",
"(",
"pluginInstance",
",",
"rendererInstance",
")",
"{",
"this",
".",
"_view",
"=",
"\"index.jade\"",
";",
"this",
".",
"_locals",
"=",
"{",
"}",
";",
"var",
"ns",
"=",
"pluginInstance",
".",
"pluginNamespace",
",",
"obj",
"=",
... | Constructor to create Plugin render, which will render the plugin's html
@param pluginInstance {Object} Plugin Instance model
@param rendererInstance {PageRenderer} instance of PageRenderer
@constructor | [
"Constructor",
"to",
"create",
"Plugin",
"render",
"which",
"will",
"render",
"the",
"plugin",
"s",
"html"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/Renderer/PluginRender.js#L21-L88 | train |
reklatsmasters/unicast | lib/socket.js | filter | function filter(socket, message, rinfo) {
const isAllowedAddress = socket.remoteAddress === rinfo.address;
const isAllowedPort = socket.remotePort === rinfo.port;
return isAllowedAddress && isAllowedPort;
} | javascript | function filter(socket, message, rinfo) {
const isAllowedAddress = socket.remoteAddress === rinfo.address;
const isAllowedPort = socket.remotePort === rinfo.port;
return isAllowedAddress && isAllowedPort;
} | [
"function",
"filter",
"(",
"socket",
",",
"message",
",",
"rinfo",
")",
"{",
"const",
"isAllowedAddress",
"=",
"socket",
".",
"remoteAddress",
"===",
"rinfo",
".",
"address",
";",
"const",
"isAllowedPort",
"=",
"socket",
".",
"remotePort",
"===",
"rinfo",
".... | Default filter for incoming messages.
@param {Socket} socket
@param {Buffer} message
@param {{address: string, port: number}} rinfo
@returns {bool} | [
"Default",
"filter",
"for",
"incoming",
"messages",
"."
] | fe83eb884bcd8687e50a4b5163a5af584d32444b | https://github.com/reklatsmasters/unicast/blob/fe83eb884bcd8687e50a4b5163a5af584d32444b/lib/socket.js#L231-L236 | train |
mdreizin/webpack-config-stream | lib/propsStream.js | propsStream | function propsStream(options) {
if (!_.isObject(options)) {
options = {};
}
return through.obj(function(chunk, enc, cb) {
var webpackOptions = chunk[FIELD_NAME] || {};
webpackOptions = _.merge(webpackOptions, options);
chunk[FIELD_NAME] = webpackOptions;
cb(null, ... | javascript | function propsStream(options) {
if (!_.isObject(options)) {
options = {};
}
return through.obj(function(chunk, enc, cb) {
var webpackOptions = chunk[FIELD_NAME] || {};
webpackOptions = _.merge(webpackOptions, options);
chunk[FIELD_NAME] = webpackOptions;
cb(null, ... | [
"function",
"propsStream",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isObject",
"(",
"options",
")",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"return",
"through",
".",
"obj",
"(",
"function",
"(",
"chunk",
",",
"enc",
",",
"cb",
"... | Overrides existing properties of each `webpack.config.js` file. Can be piped.
@function
@alias propsStream
@param {Configuration=} options
@returns {Stream} | [
"Overrides",
"existing",
"properties",
"of",
"each",
"webpack",
".",
"config",
".",
"js",
"file",
".",
"Can",
"be",
"piped",
"."
] | f8424f97837a224bc07cc18a03ecf649d708e924 | https://github.com/mdreizin/webpack-config-stream/blob/f8424f97837a224bc07cc18a03ecf649d708e924/lib/propsStream.js#L20-L34 | train |
alekzonder/maf | src/Service/Config/getConfigFromConsul.js | function (logger, key, options) {
return new Promise((resolve, reject) => {
var url = `http://${options.host}:${options.port}/v1/kv/${key}`;
logger.trace(`GET ${url}`);
request.get(url)
.timeout(options.timeout)
.then((res) => {
logger.trace(`GET ${... | javascript | function (logger, key, options) {
return new Promise((resolve, reject) => {
var url = `http://${options.host}:${options.port}/v1/kv/${key}`;
logger.trace(`GET ${url}`);
request.get(url)
.timeout(options.timeout)
.then((res) => {
logger.trace(`GET ${... | [
"function",
"(",
"logger",
",",
"key",
",",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"var",
"url",
"=",
"`",
"${",
"options",
".",
"host",
"}",
"${",
"options",
".",
"port",
"}",
"${",
"... | get key form consul kv api
@param {logger} logger
@param {String} key
@param {Object} options
@private
@return {Promise} | [
"get",
"key",
"form",
"consul",
"kv",
"api"
] | 1c88ef1f8618080fa4bfd467220c938ac74c4164 | https://github.com/alekzonder/maf/blob/1c88ef1f8618080fa4bfd467220c938ac74c4164/src/Service/Config/getConfigFromConsul.js#L18-L58 | train | |
saggiyogesh/nodeportal | public/ckeditor/_source/plugins/tabletools/dialogs/tableCell.js | function()
{
var heightType = this.getDialog().getContentElement( 'info', 'htmlHeightType' ),
labelElement = heightType.getElement(),
inputElement = this.getInputElement(),
ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' );
... | javascript | function()
{
var heightType = this.getDialog().getContentElement( 'info', 'htmlHeightType' ),
labelElement = heightType.getElement(),
inputElement = this.getInputElement(),
ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' );
... | [
"function",
"(",
")",
"{",
"var",
"heightType",
"=",
"this",
".",
"getDialog",
"(",
")",
".",
"getContentElement",
"(",
"'info'",
",",
"'htmlHeightType'",
")",
",",
"labelElement",
"=",
"heightType",
".",
"getElement",
"(",
")",
",",
"inputElement",
"=",
"... | Extra labelling of height unit type. | [
"Extra",
"labelling",
"of",
"height",
"unit",
"type",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/tabletools/dialogs/tableCell.js#L173-L181 | train | |
anvaka/ngraph.shremlin | index.js | createGraphIterators | function createGraphIterators(graph) {
return {
/**
* Creates a vertex iterator stream. This is an entry point for all traversal
* starting with a node.
*
* @param {string|number} [startFrom] vertex id to start iteration from.
* If this argument is omitted, then all graph nodes are iter... | javascript | function createGraphIterators(graph) {
return {
/**
* Creates a vertex iterator stream. This is an entry point for all traversal
* starting with a node.
*
* @param {string|number} [startFrom] vertex id to start iteration from.
* If this argument is omitted, then all graph nodes are iter... | [
"function",
"createGraphIterators",
"(",
"graph",
")",
"{",
"return",
"{",
"/**\n * Creates a vertex iterator stream. This is an entry point for all traversal\n * starting with a node.\n *\n * @param {string|number} [startFrom] vertex id to start iteration from.\n * If this arg... | Creates a wrapper to iterate over graph. A wrapper contains methods which
allows you to begin iteration. Currently we support only vertices as iterator
starters, but in future we can easily extend this and add edges
@param {ngraph.graph|Viva.Graph.graph} graph source graph we want to iterate over | [
"Creates",
"a",
"wrapper",
"to",
"iterate",
"over",
"graph",
".",
"A",
"wrapper",
"contains",
"methods",
"which",
"allows",
"you",
"to",
"begin",
"iteration",
".",
"Currently",
"we",
"support",
"only",
"vertices",
"as",
"iterator",
"starters",
"but",
"in",
"... | 98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7 | https://github.com/anvaka/ngraph.shremlin/blob/98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7/index.js#L61-L81 | train |
adriantoine/preact-enroute | index.js | normalizeRoute | function normalizeRoute(path, parent) {
if (path[0] === '/' || path[0] === '') {
return path; // absolute route
}
if (!parent) {
return path; // no need for a join
}
return `${parent.route}/${path}`; // join
} | javascript | function normalizeRoute(path, parent) {
if (path[0] === '/' || path[0] === '') {
return path; // absolute route
}
if (!parent) {
return path; // no need for a join
}
return `${parent.route}/${path}`; // join
} | [
"function",
"normalizeRoute",
"(",
"path",
",",
"parent",
")",
"{",
"if",
"(",
"path",
"[",
"0",
"]",
"===",
"'/'",
"||",
"path",
"[",
"0",
"]",
"===",
"''",
")",
"{",
"return",
"path",
";",
"// absolute route",
"}",
"if",
"(",
"!",
"parent",
")",
... | Normalize route based on the parent. | [
"Normalize",
"route",
"based",
"on",
"the",
"parent",
"."
] | c7923d05df4b4b6b36a7ea2014d2dfa9ad963383 | https://github.com/adriantoine/preact-enroute/blob/c7923d05df4b4b6b36a7ea2014d2dfa9ad963383/index.js#L97-L105 | train |
lambtron/metalsmith-hover | lib/index.js | plugin | function plugin() {
return function(files, metalsmith, done) {
Object.keys(files).forEach(function(file) {
if (!~file.indexOf('.html')) return;
var $ = cheerio.load(files[file].contents);
var links = $('a');
for (var i = links.length - 1; i >= 0; i--) {
var url = links[i].attribs.h... | javascript | function plugin() {
return function(files, metalsmith, done) {
Object.keys(files).forEach(function(file) {
if (!~file.indexOf('.html')) return;
var $ = cheerio.load(files[file].contents);
var links = $('a');
for (var i = links.length - 1; i >= 0; i--) {
var url = links[i].attribs.h... | [
"function",
"plugin",
"(",
")",
"{",
"return",
"function",
"(",
"files",
",",
"metalsmith",
",",
"done",
")",
"{",
"Object",
".",
"keys",
"(",
"files",
")",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"if",
"(",
"!",
"~",
"file",
".",
... | Plugin to show images or gifs from anchor elements on hover.
@return {Function} | [
"Plugin",
"to",
"show",
"images",
"or",
"gifs",
"from",
"anchor",
"elements",
"on",
"hover",
"."
] | a147b8d109d88eaab8e93d20cfaac764de260b59 | https://github.com/lambtron/metalsmith-hover/blob/a147b8d109d88eaab8e93d20cfaac764de260b59/lib/index.js#L32-L47 | train |
lambtron/metalsmith-hover | lib/index.js | image | function image(filename) {
if (!filename) return;
var ext = filename.split('.')[filename.split('.').length - 1];
return ~extensions.join().indexOf(ext);
} | javascript | function image(filename) {
if (!filename) return;
var ext = filename.split('.')[filename.split('.').length - 1];
return ~extensions.join().indexOf(ext);
} | [
"function",
"image",
"(",
"filename",
")",
"{",
"if",
"(",
"!",
"filename",
")",
"return",
";",
"var",
"ext",
"=",
"filename",
".",
"split",
"(",
"'.'",
")",
"[",
"filename",
".",
"split",
"(",
"'.'",
")",
".",
"length",
"-",
"1",
"]",
";",
"retu... | See if filename is image. | [
"See",
"if",
"filename",
"is",
"image",
"."
] | a147b8d109d88eaab8e93d20cfaac764de260b59 | https://github.com/lambtron/metalsmith-hover/blob/a147b8d109d88eaab8e93d20cfaac764de260b59/lib/index.js#L53-L57 | train |
saggiyogesh/nodeportal | public/ckeditor/_source/core/htmlparser/filter.js | callItems | function callItems( currentEntry )
{
var isNode = currentEntry.type
|| currentEntry instanceof CKEDITOR.htmlParser.fragment;
for ( var i = 0 ; i < this.length ; i++ )
{
// Backup the node info before filtering.
if ( isNode )
{
var orgType = currentEntry.type,
orgName = currentEn... | javascript | function callItems( currentEntry )
{
var isNode = currentEntry.type
|| currentEntry instanceof CKEDITOR.htmlParser.fragment;
for ( var i = 0 ; i < this.length ; i++ )
{
// Backup the node info before filtering.
if ( isNode )
{
var orgType = currentEntry.type,
orgName = currentEn... | [
"function",
"callItems",
"(",
"currentEntry",
")",
"{",
"var",
"isNode",
"=",
"currentEntry",
".",
"type",
"||",
"currentEntry",
"instanceof",
"CKEDITOR",
".",
"htmlParser",
".",
"fragment",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
"... | Invoke filters sequentially on the array, break the iteration when it doesn't make sense to continue anymore. | [
"Invoke",
"filters",
"sequentially",
"on",
"the",
"array",
"break",
"the",
"iteration",
"when",
"it",
"doesn",
"t",
"make",
"sense",
"to",
"continue",
"anymore",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/htmlparser/filter.js#L232-L276 | train |
building5/appdirsjs | index.js | function (dir, appname, version) {
if (appname) {
dir = path.join(dir, appname);
if (version) {
dir = path.join(dir, version);
}
}
return dir;
} | javascript | function (dir, appname, version) {
if (appname) {
dir = path.join(dir, appname);
if (version) {
dir = path.join(dir, version);
}
}
return dir;
} | [
"function",
"(",
"dir",
",",
"appname",
",",
"version",
")",
"{",
"if",
"(",
"appname",
")",
"{",
"dir",
"=",
"path",
".",
"join",
"(",
"dir",
",",
"appname",
")",
";",
"if",
"(",
"version",
")",
"{",
"dir",
"=",
"path",
".",
"join",
"(",
"dir"... | Append the name and and version to a path.
Both the appname and version are optional. The version is only appended if
the appname.
@param {string} dir Base directory.
@param {string} [appname] Optional name to append.
@param {string} [version] Optional version to append.
@returns {string} Resulting path
@private | [
"Append",
"the",
"name",
"and",
"and",
"version",
"to",
"a",
"path",
"."
] | 0c1a98efea2db40923b92e45725adb44c36f5a18 | https://github.com/building5/appdirsjs/blob/0c1a98efea2db40923b92e45725adb44c36f5a18/index.js#L40-L48 | train | |
saggiyogesh/nodeportal | plugins/managePage/PageManageController.js | deletePage | function deletePage(req, res, next) {
var that = this, db = that.getDB(), DBActions = that.getDBActionsLib(),
dbAction = DBActions.getAuthInstance(req, PAGE_SCHEMA, PAGE_PERMISSION_SCHEMA_ENTRY);
var params = req.params;
var pageId = params.id;
if (!pageId) {
that.setErrorMessage(req, "N... | javascript | function deletePage(req, res, next) {
var that = this, db = that.getDB(), DBActions = that.getDBActionsLib(),
dbAction = DBActions.getAuthInstance(req, PAGE_SCHEMA, PAGE_PERMISSION_SCHEMA_ENTRY);
var params = req.params;
var pageId = params.id;
if (!pageId) {
that.setErrorMessage(req, "N... | [
"function",
"deletePage",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"that",
"=",
"this",
",",
"db",
"=",
"that",
".",
"getDB",
"(",
")",
",",
"DBActions",
"=",
"that",
".",
"getDBActionsLib",
"(",
")",
",",
"dbAction",
"=",
"DBActions",
... | only single page is deleted at a time, ie if a page doesn't have any children
@param req
@param res
@param next | [
"only",
"single",
"page",
"is",
"deleted",
"at",
"a",
"time",
"ie",
"if",
"a",
"page",
"doesn",
"t",
"have",
"any",
"children"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/plugins/managePage/PageManageController.js#L177-L243 | train |
saggiyogesh/nodeportal | plugins/themeBuilder/ThemeBuilderPluginController.js | setupWatcher | function setupWatcher(app, dbAction, name) {
dbAction.get("findByName", name, function (err, theme) {
if (!err && theme) {
require(utils.getLibPath() + "/static/ThemesWatcher").cacheAndWatchTheme(app, theme);
}
});
} | javascript | function setupWatcher(app, dbAction, name) {
dbAction.get("findByName", name, function (err, theme) {
if (!err && theme) {
require(utils.getLibPath() + "/static/ThemesWatcher").cacheAndWatchTheme(app, theme);
}
});
} | [
"function",
"setupWatcher",
"(",
"app",
",",
"dbAction",
",",
"name",
")",
"{",
"dbAction",
".",
"get",
"(",
"\"findByName\"",
",",
"name",
",",
"function",
"(",
"err",
",",
"theme",
")",
"{",
"if",
"(",
"!",
"err",
"&&",
"theme",
")",
"{",
"require"... | Setup watcher for newly created theme for changes
@param app
@param dbAction
@param name | [
"Setup",
"watcher",
"for",
"newly",
"created",
"theme",
"for",
"changes"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/plugins/themeBuilder/ThemeBuilderPluginController.js#L250-L256 | train |
nicktindall/cyclon.p2p-rtc-client | lib/SignallingServerSelector.js | filterAndSortAvailableServers | function filterAndSortAvailableServers (serverArray) {
var copyOfServerArray = JSON.parse(JSON.stringify(serverArray));
copyOfServerArray.sort(function (itemOne, itemTwo) {
return sortValue(itemOne) - sortValue(itemTwo);
});
// Filter servers we've too-recently disconnected ... | javascript | function filterAndSortAvailableServers (serverArray) {
var copyOfServerArray = JSON.parse(JSON.stringify(serverArray));
copyOfServerArray.sort(function (itemOne, itemTwo) {
return sortValue(itemOne) - sortValue(itemTwo);
});
// Filter servers we've too-recently disconnected ... | [
"function",
"filterAndSortAvailableServers",
"(",
"serverArray",
")",
"{",
"var",
"copyOfServerArray",
"=",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"serverArray",
")",
")",
";",
"copyOfServerArray",
".",
"sort",
"(",
"function",
"(",
"itemOne",... | Return a copy of the known server array sorted in the order of
their last-disconnect-time. Due to the fact a failed connect is
considered a disconnect, this will cause servers to be tried in
a round robin pattern. | [
"Return",
"a",
"copy",
"of",
"the",
"known",
"server",
"array",
"sorted",
"in",
"the",
"order",
"of",
"their",
"last",
"-",
"disconnect",
"-",
"time",
".",
"Due",
"to",
"the",
"fact",
"a",
"failed",
"connect",
"is",
"considered",
"a",
"disconnect",
"this... | eb586ce288a6ad7e1b221280825037e855b03904 | https://github.com/nicktindall/cyclon.p2p-rtc-client/blob/eb586ce288a6ad7e1b221280825037e855b03904/lib/SignallingServerSelector.js#L24-L32 | train |
vertical-knowledge/jsocrud | helpers.js | ValidatedPath | function ValidatedPath(path, firstPathPart, pathRemainder) {
this.path = path;
this.firstPathPart = firstPathPart;
this.pathRemainder = pathRemainder;
} | javascript | function ValidatedPath(path, firstPathPart, pathRemainder) {
this.path = path;
this.firstPathPart = firstPathPart;
this.pathRemainder = pathRemainder;
} | [
"function",
"ValidatedPath",
"(",
"path",
",",
"firstPathPart",
",",
"pathRemainder",
")",
"{",
"this",
".",
"path",
"=",
"path",
";",
"this",
".",
"firstPathPart",
"=",
"firstPathPart",
";",
"this",
".",
"pathRemainder",
"=",
"pathRemainder",
";",
"}"
] | Storage for a validated path
@param {String} path - Full validated path
@param {String|Null} firstPathPart - "Converted" first path if necessary (see helpers::convertFirstPathPart)
@param {String|Null} pathRemainder - "Converted" remainder of the path if necessary (see helpers::convertFirstPathPart)
@constructor | [
"Storage",
"for",
"a",
"validated",
"path"
] | d8142df1e2c9404fe34162b35543622822938b33 | https://github.com/vertical-knowledge/jsocrud/blob/d8142df1e2c9404fe34162b35543622822938b33/helpers.js#L10-L14 | train |
simbo/gulp-watchify-browserify | demo/gulpfile.js | streamHandler | function streamHandler(stream) {
return stream
.pipe(plumber())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.write('.', {includeContent: true, sourceRoot: '.'}))
.pipe(gulp.dest(dest));
} | javascript | function streamHandler(stream) {
return stream
.pipe(plumber())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.write('.', {includeContent: true, sourceRoot: '.'}))
.pipe(gulp.dest(dest));
} | [
"function",
"streamHandler",
"(",
"stream",
")",
"{",
"return",
"stream",
".",
"pipe",
"(",
"plumber",
"(",
")",
")",
".",
"pipe",
"(",
"sourcemaps",
".",
"init",
"(",
"{",
"loadMaps",
":",
"true",
"}",
")",
")",
".",
"pipe",
"(",
"sourcemaps",
".",
... | stream handler to apply further gulp plugins
@param {Object} stream gulp file stream
@return {Object} processed stream | [
"stream",
"handler",
"to",
"apply",
"further",
"gulp",
"plugins"
] | 149bee169c9a104cc641bc0e0eaf5a6aa52f9936 | https://github.com/simbo/gulp-watchify-browserify/blob/149bee169c9a104cc641bc0e0eaf5a6aa52f9936/demo/gulpfile.js#L50-L56 | train |
smartface/sf-component-calendar | scripts/components/calendarContext.js | reducer | function reducer(context, action, target, state) {
const newState = Object.assign({}, state);
let actor;
switch(action.type) {
case INIT_CONTEXT_ACTION_TYPE:
newState.days = context.reduce((acc, actor, name) => {
if(name.indexOf("_weekDay") > 0)
acc.push(name);
return acc;
}, []);
return n... | javascript | function reducer(context, action, target, state) {
const newState = Object.assign({}, state);
let actor;
switch(action.type) {
case INIT_CONTEXT_ACTION_TYPE:
newState.days = context.reduce((acc, actor, name) => {
if(name.indexOf("_weekDay") > 0)
acc.push(name);
return acc;
}, []);
return n... | [
"function",
"reducer",
"(",
"context",
",",
"action",
",",
"target",
",",
"state",
")",
"{",
"const",
"newState",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"state",
")",
";",
"let",
"actor",
";",
"switch",
"(",
"action",
".",
"type",
")",
"... | reducer for context's components | [
"reducer",
"for",
"context",
"s",
"components"
] | d6c8310564ff551b9424ac6955efa5e8cf5f8dff | https://github.com/smartface/sf-component-calendar/blob/d6c8310564ff551b9424ac6955efa5e8cf5f8dff/scripts/components/calendarContext.js#L46-L122 | train |
tenorviol/xjs | lib/XjsStream.js | emitBuffer | function emitBuffer() {
if (!this._buffer) {
return;
}
for (var i = this._marker; i < this._buffer.length; i++) {
var data = this._buffer[i];
if (data.writable === true) {
break;
} else if (data.writable === false) {
emitBuffer.call(data);
} else {
this.emit('data', data, 'ut... | javascript | function emitBuffer() {
if (!this._buffer) {
return;
}
for (var i = this._marker; i < this._buffer.length; i++) {
var data = this._buffer[i];
if (data.writable === true) {
break;
} else if (data.writable === false) {
emitBuffer.call(data);
} else {
this.emit('data', data, 'ut... | [
"function",
"emitBuffer",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_buffer",
")",
"{",
"return",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"_marker",
";",
"i",
"<",
"this",
".",
"_buffer",
".",
"length",
";",
"i",
"++",
")",
"{",
... | When not waiting on an async substream, emit right away. Otherwise start._buffering. | [
"When",
"not",
"waiting",
"on",
"an",
"async",
"substream",
"emit",
"right",
"away",
".",
"Otherwise",
"start",
".",
"_buffering",
"."
] | 1f0744354b311066d6e58d11f9f5c602dae926af | https://github.com/tenorviol/xjs/blob/1f0744354b311066d6e58d11f9f5c602dae926af/lib/XjsStream.js#L163-L186 | train |
node-tastypie/tastypie | lib/class/options.js | setOptions | function setOptions( options ){
if( this.addListener ){
for( var opt in options ){
if( typeof( options[ opt ] ) !== 'function' || !(/^on[A-z]/).test(opt)){
continue;
}
this.addListener( removeOn( opt ), options[ opt ]);
... | javascript | function setOptions( options ){
if( this.addListener ){
for( var opt in options ){
if( typeof( options[ opt ] ) !== 'function' || !(/^on[A-z]/).test(opt)){
continue;
}
this.addListener( removeOn( opt ), options[ opt ]);
... | [
"function",
"setOptions",
"(",
"options",
")",
"{",
"if",
"(",
"this",
".",
"addListener",
")",
"{",
"for",
"(",
"var",
"opt",
"in",
"options",
")",
"{",
"if",
"(",
"typeof",
"(",
"options",
"[",
"opt",
"]",
")",
"!==",
"'function'",
"||",
"!",
"("... | Over rides internal values with supplied object
@method module:tastypie/lib/class/options#setOptions
@param {Object} options The options object to use as configuration overrides | [
"Over",
"rides",
"internal",
"values",
"with",
"supplied",
"object"
] | bf42227975704ac19cce2c5f62427a205cadafdb | https://github.com/node-tastypie/tastypie/blob/bf42227975704ac19cce2c5f62427a205cadafdb/lib/class/options.js#L43-L55 | train |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | sanitize | function sanitize(htmlText, opt_uriPolicy, opt_nmTokenPolicy) {
var out = [];
makeHtmlSanitizer(
function sanitizeAttribs(tagName, attribs) {
for (var i = 0; i < attribs.length; i += 2) {
var attribName = attribs[i];
var value = attribs[i + 1];
var atype = null, attri... | javascript | function sanitize(htmlText, opt_uriPolicy, opt_nmTokenPolicy) {
var out = [];
makeHtmlSanitizer(
function sanitizeAttribs(tagName, attribs) {
for (var i = 0; i < attribs.length; i += 2) {
var attribName = attribs[i];
var value = attribs[i + 1];
var atype = null, attri... | [
"function",
"sanitize",
"(",
"htmlText",
",",
"opt_uriPolicy",
",",
"opt_nmTokenPolicy",
")",
"{",
"var",
"out",
"=",
"[",
"]",
";",
"makeHtmlSanitizer",
"(",
"function",
"sanitizeAttribs",
"(",
"tagName",
",",
"attribs",
")",
"{",
"for",
"(",
"var",
"i",
... | Strips unsafe tags and attributes from html.
@param {string} htmlText to sanitize
@param {Function} opt_uriPolicy -- a transform to apply to uri/url
attribute values. If no opt_uriPolicy is provided, no uris
are allowed ie. the default uriPolicy rewrites all uris to null
@param {Function} opt_nmTokenPolicy : string ->... | [
"Strips",
"unsafe",
"tags",
"and",
"attributes",
"from",
"html",
"."
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L3926-L3986 | train |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | onDown | function onDown(e) {
// Prevent interaction offset calculations happening while
// the user is dragging the map.
//
// Store this event so that we can compare it to the
// up event
_downLock = true;
var _e = (e.type !== "MSPointerDown" && e.type !== "pointerdown"... | javascript | function onDown(e) {
// Prevent interaction offset calculations happening while
// the user is dragging the map.
//
// Store this event so that we can compare it to the
// up event
_downLock = true;
var _e = (e.type !== "MSPointerDown" && e.type !== "pointerdown"... | [
"function",
"onDown",
"(",
"e",
")",
"{",
"// Prevent interaction offset calculations happening while",
"// the user is dragging the map.",
"//",
"// Store this event so that we can compare it to the",
"// up event",
"_downLock",
"=",
"true",
";",
"var",
"_e",
"=",
"(",
"e",
... | A handler for 'down' events - which means `mousedown` and `touchstart` | [
"A",
"handler",
"for",
"down",
"events",
"-",
"which",
"means",
"mousedown",
"and",
"touchstart"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L5041-L5082 | train |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | initTouch | function initTouch()
{
var startX,
startY,
touchStartX,
touchStartY,
moved,
moving = false;
container.unbind('touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick').bind(
'touchstart.jsp',
function(e)
{
... | javascript | function initTouch()
{
var startX,
startY,
touchStartX,
touchStartY,
moved,
moving = false;
container.unbind('touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick').bind(
'touchstart.jsp',
function(e)
{
... | [
"function",
"initTouch",
"(",
")",
"{",
"var",
"startX",
",",
"startY",
",",
"touchStartX",
",",
"touchStartY",
",",
"moved",
",",
"moving",
"=",
"false",
";",
"container",
".",
"unbind",
"(",
"'touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick'",
")",
... | Init touch on iPad, iPhone, iPod, Android | [
"Init",
"touch",
"on",
"iPad",
"iPhone",
"iPod",
"Android"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L7251-L7309 | train |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(vars) {
var c = this.compiled = this.compiled || this.get('compiled') || this.compile();
var rendered = c(vars);
return rendered;
} | javascript | function(vars) {
var c = this.compiled = this.compiled || this.get('compiled') || this.compile();
var rendered = c(vars);
return rendered;
} | [
"function",
"(",
"vars",
")",
"{",
"var",
"c",
"=",
"this",
".",
"compiled",
"=",
"this",
".",
"compiled",
"||",
"this",
".",
"get",
"(",
"'compiled'",
")",
"||",
"this",
".",
"compile",
"(",
")",
";",
"var",
"rendered",
"=",
"c",
"(",
"vars",
")... | renders the template with specified vars | [
"renders",
"the",
"template",
"with",
"specified",
"vars"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L17141-L17145 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(args) {
var self = this;
// var date = new Date();
this.trigger('loadModelStarted');
$.when(this.elder('fetch', args)).done(function(ev){
self.trigger('loadModelCompleted', ev);
// var dateComplete = new Date()
// console.log('completed in '+(dateComplete - date)... | javascript | function(args) {
var self = this;
// var date = new Date();
this.trigger('loadModelStarted');
$.when(this.elder('fetch', args)).done(function(ev){
self.trigger('loadModelCompleted', ev);
// var dateComplete = new Date()
// console.log('completed in '+(dateComplete - date)... | [
"function",
"(",
"args",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// var date = new Date();",
"this",
".",
"trigger",
"(",
"'loadModelStarted'",
")",
";",
"$",
".",
"when",
"(",
"this",
".",
"elder",
"(",
"'fetch'",
",",
"args",
")",
")",
".",
"done... | We are redefining fetch to be able to trigger an event when the ajax call ends, no matter if there's
a change in the data or not. Why don't backbone does this by default? ahh, my friend, who knows.
@method fetch
@param args {Object} | [
"We",
"are",
"redefining",
"fetch",
"to",
"be",
"able",
"to",
"trigger",
"an",
"event",
"when",
"the",
"ajax",
"call",
"ends",
"no",
"matter",
"if",
"there",
"s",
"a",
"change",
"in",
"the",
"data",
"or",
"not",
".",
"Why",
"don",
"t",
"backbone",
"d... | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L17250-L17261 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(ev, obj, retrigEvent) {
if(!retrigEvent) {
retrigEvent = ev;
}
var self = this;
obj.bind && obj.bind(ev, function() {
self.trigger(retrigEvent);
}, self)
} | javascript | function(ev, obj, retrigEvent) {
if(!retrigEvent) {
retrigEvent = ev;
}
var self = this;
obj.bind && obj.bind(ev, function() {
self.trigger(retrigEvent);
}, self)
} | [
"function",
"(",
"ev",
",",
"obj",
",",
"retrigEvent",
")",
"{",
"if",
"(",
"!",
"retrigEvent",
")",
"{",
"retrigEvent",
"=",
"ev",
";",
"}",
"var",
"self",
"=",
"this",
";",
"obj",
".",
"bind",
"&&",
"obj",
".",
"bind",
"(",
"ev",
",",
"function... | Listen for an event on another object and triggers on itself, with the same name or a new one
@method retrigger
@param ev {String} event who triggers the action
@param obj {Object} object where the event happens
@param obj {Object} [optional] name of the retriggered event;
@todo [xabel]: This method is repeated here an... | [
"Listen",
"for",
"an",
"event",
"on",
"another",
"object",
"and",
"triggers",
"on",
"itself",
"with",
"the",
"same",
"name",
"or",
"a",
"new",
"one"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L17278-L17286 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
var self = this;
this.trigger('clean');
this.clearSubViews();
// remove from parent
if(this._parent) {
this._parent.removeView(this);
this._parent = null;
}
this.remove();
this.unbind();
// remove this model binding
if (this.model ... | javascript | function() {
var self = this;
this.trigger('clean');
this.clearSubViews();
// remove from parent
if(this._parent) {
this._parent.removeView(this);
this._parent = null;
}
this.remove();
this.unbind();
// remove this model binding
if (this.model ... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"trigger",
"(",
"'clean'",
")",
";",
"this",
".",
"clearSubViews",
"(",
")",
";",
"// remove from parent",
"if",
"(",
"this",
".",
"_parent",
")",
"{",
"this",
".",
"_parent",
"... | this methid clean removes the view
and clean and events associated. call it when
the view is not going to be used anymore | [
"this",
"methid",
"clean",
"removes",
"the",
"view",
"and",
"clean",
"and",
"events",
"associated",
".",
"call",
"it",
"when",
"the",
"view",
"is",
"not",
"going",
"to",
"be",
"used",
"anymore"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L17355-L17376 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(ev) {
if(ev && ev.preventDefault) {
ev.preventDefault();
};
if(ev && ev.stopPropagation) {
ev.stopPropagation();
};
} | javascript | function(ev) {
if(ev && ev.preventDefault) {
ev.preventDefault();
};
if(ev && ev.stopPropagation) {
ev.stopPropagation();
};
} | [
"function",
"(",
"ev",
")",
"{",
"if",
"(",
"ev",
"&&",
"ev",
".",
"preventDefault",
")",
"{",
"ev",
".",
"preventDefault",
"(",
")",
";",
"}",
";",
"if",
"(",
"ev",
"&&",
"ev",
".",
"stopPropagation",
")",
"{",
"ev",
".",
"stopPropagation",
"(",
... | Captures an event and prevents the default behaviour and stops it from bubbling
@method killEvent
@param event {Event} | [
"Captures",
"an",
"event",
"and",
"prevents",
"the",
"default",
"behaviour",
"and",
"stops",
"it",
"from",
"bubbling"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L17420-L17427 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
_.each(cdb.core.View.views, function(view) {
_.each(view, function(prop, k) {
if( k !== '_parent' &&
view.hasOwnProperty(k) &&
prop instanceof cdb.core.View &&
view._subviews[prop.cid] === undefined) {
console.log("=========");
... | javascript | function() {
_.each(cdb.core.View.views, function(view) {
_.each(view, function(prop, k) {
if( k !== '_parent' &&
view.hasOwnProperty(k) &&
prop instanceof cdb.core.View &&
view._subviews[prop.cid] === undefined) {
console.log("=========");
... | [
"function",
"(",
")",
"{",
"_",
".",
"each",
"(",
"cdb",
".",
"core",
".",
"View",
".",
"views",
",",
"function",
"(",
"view",
")",
"{",
"_",
".",
"each",
"(",
"view",
",",
"function",
"(",
"prop",
",",
"k",
")",
"{",
"if",
"(",
"k",
"!==",
... | search for views in a view and check if they are added as subviews | [
"search",
"for",
"views",
"in",
"a",
"view",
"and",
"check",
"if",
"they",
"are",
"added",
"as",
"subviews"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L17462-L17478 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
var e = this.get('extra_params') || e;
e.cache_buster = new Date().getTime();
this.set('extra_params', e);
this.trigger('change', this);
} | javascript | function() {
var e = this.get('extra_params') || e;
e.cache_buster = new Date().getTime();
this.set('extra_params', e);
this.trigger('change', this);
} | [
"function",
"(",
")",
"{",
"var",
"e",
"=",
"this",
".",
"get",
"(",
"'extra_params'",
")",
"||",
"e",
";",
"e",
".",
"cache_buster",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
"this",
".",
"set",
"(",
"'extra_params'",
",",
"e"... | refresh the layer | [
"refresh",
"the",
"layer"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L18052-L18057 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(model, col, options) {
if (this.size() > 0) {
// Assign an order of 0 to the first layer
this.at(0).set({ order: 0 });
if (this.size() > 1) {
var layersByType = {};
for (var i = 1; i < this.size(); ++i) {
var layer = this.at(i);
var layerType = layer.... | javascript | function(model, col, options) {
if (this.size() > 0) {
// Assign an order of 0 to the first layer
this.at(0).set({ order: 0 });
if (this.size() > 1) {
var layersByType = {};
for (var i = 1; i < this.size(); ++i) {
var layer = this.at(i);
var layerType = layer.... | [
"function",
"(",
"model",
",",
"col",
",",
"options",
")",
"{",
"if",
"(",
"this",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"// Assign an order of 0 to the first layer",
"this",
".",
"at",
"(",
"0",
")",
".",
"set",
"(",
"{",
"order",
":",
"0",
"... | each time a layer is added or removed
the index should be recalculated | [
"each",
"time",
"a",
"layer",
"is",
"added",
"or",
"removed",
"the",
"index",
"should",
"be",
"recalculated"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L18124-L18153 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(options) {
if (typeof options != "object" || options.length) {
if (this.options.debug) {
throw (options + ' options has to be an object');
} else {
return;
}
}
// Set options
_.defaults(this.options, options);
} | javascript | function(options) {
if (typeof options != "object" || options.length) {
if (this.options.debug) {
throw (options + ' options has to be an object');
} else {
return;
}
}
// Set options
_.defaults(this.options, options);
} | [
"function",
"(",
"options",
")",
"{",
"if",
"(",
"typeof",
"options",
"!=",
"\"object\"",
"||",
"options",
".",
"length",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"debug",
")",
"{",
"throw",
"(",
"options",
"+",
"' options has to be an object'",
... | Change multiple options at the same time
@params {Object} New options object | [
"Change",
"multiple",
"options",
"at",
"the",
"same",
"time"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L18258-L18269 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(bounds, mapSize) {
var z = this.getBoundsZoom(bounds, mapSize);
if(z === null) {
return;
}
// project -> calculate center -> unproject
var swPoint = cdb.geo.Map.latlngToMercator(bounds[0], z);
var nePoint = cdb.geo.Map.latlngToMercator(bounds[1], z);
var center = cdb.geo.Map... | javascript | function(bounds, mapSize) {
var z = this.getBoundsZoom(bounds, mapSize);
if(z === null) {
return;
}
// project -> calculate center -> unproject
var swPoint = cdb.geo.Map.latlngToMercator(bounds[0], z);
var nePoint = cdb.geo.Map.latlngToMercator(bounds[1], z);
var center = cdb.geo.Map... | [
"function",
"(",
"bounds",
",",
"mapSize",
")",
"{",
"var",
"z",
"=",
"this",
".",
"getBoundsZoom",
"(",
"bounds",
",",
"mapSize",
")",
";",
"if",
"(",
"z",
"===",
"null",
")",
"{",
"return",
";",
"}",
"// project -> calculate center -> unproject",
"var",
... | set center and zoom according to fit bounds | [
"set",
"center",
"and",
"zoom",
"according",
"to",
"fit",
"bounds"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L18392-L18410 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(boundsSWNE, mapSize) {
// sometimes the map reports size = 0 so return null
if(mapSize.x === 0 || mapSize.y === 0) return null;
var size = [mapSize.x, mapSize.y],
zoom = this.get('minZoom') || 0,
maxZoom = this.get('maxZoom') || 24,
ne = boundsSWNE[1],
sw = boundsSWNE[0],
bounds... | javascript | function(boundsSWNE, mapSize) {
// sometimes the map reports size = 0 so return null
if(mapSize.x === 0 || mapSize.y === 0) return null;
var size = [mapSize.x, mapSize.y],
zoom = this.get('minZoom') || 0,
maxZoom = this.get('maxZoom') || 24,
ne = boundsSWNE[1],
sw = boundsSWNE[0],
bounds... | [
"function",
"(",
"boundsSWNE",
",",
"mapSize",
")",
"{",
"// sometimes the map reports size = 0 so return null",
"if",
"(",
"mapSize",
".",
"x",
"===",
"0",
"||",
"mapSize",
".",
"y",
"===",
"0",
")",
"return",
"null",
";",
"var",
"size",
"=",
"[",
"mapSize"... | adapted from leaflat src @return {Number, null} Calculated zoom from given bounds or the maxZoom if no appropriate zoom level could be found or null if given mapSize has no size. | [
"adapted",
"from",
"leaflat",
"src"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L18415-L18442 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
var result = [];
for (var s in this._subviews) {
if(this._subviews[s] instanceof cdb.geo.ui.Infowindow) {
result.push(this._subviews[s]);
}
}
return result;
} | javascript | function() {
var result = [];
for (var s in this._subviews) {
if(this._subviews[s] instanceof cdb.geo.ui.Infowindow) {
result.push(this._subviews[s]);
}
}
return result;
} | [
"function",
"(",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"s",
"in",
"this",
".",
"_subviews",
")",
"{",
"if",
"(",
"this",
".",
"_subviews",
"[",
"s",
"]",
"instanceof",
"cdb",
".",
"geo",
".",
"ui",
".",
"Infowindow",
... | search in the subviews and return the infowindows | [
"search",
"in",
"the",
"subviews",
"and",
"return",
"the",
"infowindows"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L18503-L18511 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
this._unbindModel();
this.map.bind('change:view_bounds_sw', this._changeBounds, this);
this.map.bind('change:view_bounds_ne', this._changeBounds, this);
this.map.bind('change:zoom', this._setZoom, this);
this.map.bind('change:scrollwheel', this._setScrollWheel, this);
... | javascript | function() {
this._unbindModel();
this.map.bind('change:view_bounds_sw', this._changeBounds, this);
this.map.bind('change:view_bounds_ne', this._changeBounds, this);
this.map.bind('change:zoom', this._setZoom, this);
this.map.bind('change:scrollwheel', this._setScrollWheel, this);
... | [
"function",
"(",
")",
"{",
"this",
".",
"_unbindModel",
"(",
")",
";",
"this",
".",
"map",
".",
"bind",
"(",
"'change:view_bounds_sw'",
",",
"this",
".",
"_changeBounds",
",",
"this",
")",
";",
"this",
".",
"map",
".",
"bind",
"(",
"'change:view_bounds_n... | bind model properties | [
"bind",
"model",
"properties"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L18544-L18553 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
this.map.unbind('change:view_bounds_sw', null, this);
this.map.unbind('change:view_bounds_ne', null, this);
this.map.unbind('change:zoom', null, this);
this.map.unbind('change:scrollwheel', null, this);
this.map.unbind('change:keyboard', null, this);
this.map... | javascript | function() {
this.map.unbind('change:view_bounds_sw', null, this);
this.map.unbind('change:view_bounds_ne', null, this);
this.map.unbind('change:zoom', null, this);
this.map.unbind('change:scrollwheel', null, this);
this.map.unbind('change:keyboard', null, this);
this.map... | [
"function",
"(",
")",
"{",
"this",
".",
"map",
".",
"unbind",
"(",
"'change:view_bounds_sw'",
",",
"null",
",",
"this",
")",
";",
"this",
".",
"map",
".",
"unbind",
"(",
"'change:view_bounds_ne'",
",",
"null",
",",
"this",
")",
";",
"this",
".",
"map",... | unbind model properties | [
"unbind",
"model",
"properties"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L18556-L18564 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(attributes) {
var fields = this.get('fields');
this.set('content', cdb.geo.ui.InfowindowModel.contentForFields(attributes, fields));
} | javascript | function(attributes) {
var fields = this.get('fields');
this.set('content', cdb.geo.ui.InfowindowModel.contentForFields(attributes, fields));
} | [
"function",
"(",
"attributes",
")",
"{",
"var",
"fields",
"=",
"this",
".",
"get",
"(",
"'fields'",
")",
";",
"this",
".",
"set",
"(",
"'content'",
",",
"cdb",
".",
"geo",
".",
"ui",
".",
"InfowindowModel",
".",
"contentForFields",
"(",
"attributes",
"... | updates content with attributes | [
"updates",
"content",
"with",
"attributes"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21115-L21118 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
if(this.template) {
// If there is content, destroy the jscrollpane first, then remove the content.
var $jscrollpane = this.$(".cartodb-popup-content");
if ($jscrollpane.length > 0 && $jscrollpane.data() != null) {
$jscrollpane.data().jsp && $jscrollpane.data().jsp.destroy()... | javascript | function() {
if(this.template) {
// If there is content, destroy the jscrollpane first, then remove the content.
var $jscrollpane = this.$(".cartodb-popup-content");
if ($jscrollpane.length > 0 && $jscrollpane.data() != null) {
$jscrollpane.data().jsp && $jscrollpane.data().jsp.destroy()... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"template",
")",
"{",
"// If there is content, destroy the jscrollpane first, then remove the content.",
"var",
"$jscrollpane",
"=",
"this",
".",
"$",
"(",
"\".cartodb-popup-content\"",
")",
";",
"if",
"(",
"$jscrollp... | Render infowindow content | [
"Render",
"infowindow",
"content"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21236-L21312 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
var template = this.model.get('template') ?
this.model.get('template') :
cdb.templates.getTemplate(this._getModelTemplate());
if(typeof(template) !== 'function') {
this.template = new cdb.core.Template({
template: template,
type: this.model.get('template_type') ||... | javascript | function() {
var template = this.model.get('template') ?
this.model.get('template') :
cdb.templates.getTemplate(this._getModelTemplate());
if(typeof(template) !== 'function') {
this.template = new cdb.core.Template({
template: template,
type: this.model.get('template_type') ||... | [
"function",
"(",
")",
"{",
"var",
"template",
"=",
"this",
".",
"model",
".",
"get",
"(",
"'template'",
")",
"?",
"this",
".",
"model",
".",
"get",
"(",
"'template'",
")",
":",
"cdb",
".",
"templates",
".",
"getTemplate",
"(",
"this",
".",
"_getModel... | Compile template of the infowindow | [
"Compile",
"template",
"of",
"the",
"infowindow"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21331-L21346 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(ev) {
// If the mouse down come from jspVerticalBar
// dont stop the propagation, but if the event
// is a touchstart, stop the propagation
var come_from_scroll = (($(ev.target).closest(".jspVerticalBar").length > 0) && (ev.type != "touchstart"));
if (!come_from_scroll) {
ev.stopProp... | javascript | function(ev) {
// If the mouse down come from jspVerticalBar
// dont stop the propagation, but if the event
// is a touchstart, stop the propagation
var come_from_scroll = (($(ev.target).closest(".jspVerticalBar").length > 0) && (ev.type != "touchstart"));
if (!come_from_scroll) {
ev.stopProp... | [
"function",
"(",
"ev",
")",
"{",
"// If the mouse down come from jspVerticalBar",
"// dont stop the propagation, but if the event",
"// is a touchstart, stop the propagation",
"var",
"come_from_scroll",
"=",
"(",
"(",
"$",
"(",
"ev",
".",
"target",
")",
".",
"closest",
"(",... | Check event origin | [
"Check",
"event",
"origin"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21351-L21360 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(fields, template_name) {
var fields_sanitized = [];
if (fields && fields.length > 0) {
var self = this;
fields_sanitized = _.map(fields, function(field,i) {
// Return whole attribute sanitized
return self._sanitizeField(field, template_name, field.index || i);
});
... | javascript | function(fields, template_name) {
var fields_sanitized = [];
if (fields && fields.length > 0) {
var self = this;
fields_sanitized = _.map(fields, function(field,i) {
// Return whole attribute sanitized
return self._sanitizeField(field, template_name, field.index || i);
});
... | [
"function",
"(",
"fields",
",",
"template_name",
")",
"{",
"var",
"fields_sanitized",
"=",
"[",
"]",
";",
"if",
"(",
"fields",
"&&",
"fields",
".",
"length",
">",
"0",
")",
"{",
"var",
"self",
"=",
"this",
";",
"fields_sanitized",
"=",
"_",
".",
"map... | Convert values to string unless value is NULL | [
"Convert",
"values",
"to",
"string",
"unless",
"value",
"is",
"NULL"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21365-L21375 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function($el) {
this._stopSpinner();
var $el = this.$el.find('.loading');
if ($el) {
// Check if it is dark or other to change color
var template_dark = this.model.get('template_name').search('dark') != -1;
if (template_dark) {
this.spin_options.color = '#FFF';
} else {
... | javascript | function($el) {
this._stopSpinner();
var $el = this.$el.find('.loading');
if ($el) {
// Check if it is dark or other to change color
var template_dark = this.model.get('template_name').search('dark') != -1;
if (template_dark) {
this.spin_options.color = '#FFF';
} else {
... | [
"function",
"(",
"$el",
")",
"{",
"this",
".",
"_stopSpinner",
"(",
")",
";",
"var",
"$el",
"=",
"this",
".",
"$el",
".",
"find",
"(",
"'.loading'",
")",
";",
"if",
"(",
"$el",
")",
"{",
"// Check if it is dark or other to change color",
"var",
"template_d... | Start loading spinner | [
"Start",
"loading",
"spinner"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21458-L21476 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
var content = this.model.get("content");
if (content && content.fields && content.fields.length > 0) {
return (content.fields[0].value || '').toString();
}
return false;
} | javascript | function() {
var content = this.model.get("content");
if (content && content.fields && content.fields.length > 0) {
return (content.fields[0].value || '').toString();
}
return false;
} | [
"function",
"(",
")",
"{",
"var",
"content",
"=",
"this",
".",
"model",
".",
"get",
"(",
"\"content\"",
")",
";",
"if",
"(",
"content",
"&&",
"content",
".",
"fields",
"&&",
"content",
".",
"fields",
".",
"length",
">",
"0",
")",
"{",
"return",
"("... | Get cover URL | [
"Get",
"cover",
"URL"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21489-L21497 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
if (!this._containsCover()) return;
var self = this;
var $cover = this.$(".cover");
var $img = $cover.find("img");
var $shadow = this.$(".shadow");
var url = this._getCoverURL();
if (!this._isValidURL(url)) {
$img.hide();
$shadow.hide();
cdb.log.info("Header... | javascript | function() {
if (!this._containsCover()) return;
var self = this;
var $cover = this.$(".cover");
var $img = $cover.find("img");
var $shadow = this.$(".shadow");
var url = this._getCoverURL();
if (!this._isValidURL(url)) {
$img.hide();
$shadow.hide();
cdb.log.info("Header... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_containsCover",
"(",
")",
")",
"return",
";",
"var",
"self",
"=",
"this",
";",
"var",
"$cover",
"=",
"this",
".",
"$",
"(",
"\".cover\"",
")",
";",
"var",
"$img",
"=",
"$cover",
".",
"find... | Attempts to load the cover URL and show it | [
"Attempts",
"to",
"load",
"the",
"cover",
"URL",
"and",
"show",
"it"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21502-L21561 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(url) {
if (url) {
var urlPattern = /^(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-|]*[\w@?^=%&\/~+#-])?$/
return String(url).match(urlPattern) != null ? true : false;
}
return false;
} | javascript | function(url) {
if (url) {
var urlPattern = /^(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-|]*[\w@?^=%&\/~+#-])?$/
return String(url).match(urlPattern) != null ? true : false;
}
return false;
} | [
"function",
"(",
"url",
")",
"{",
"if",
"(",
"url",
")",
"{",
"var",
"urlPattern",
"=",
"/",
"^(http|ftp|https):\\/\\/[\\w-]+(\\.[\\w-]+)+([\\w.,@?^=%&:\\/~+#-|]*[\\w@?^=%&\\/~+#-])?$",
"/",
"return",
"String",
"(",
"url",
")",
".",
"match",
"(",
"urlPattern",... | Return true if the provided URL is valid | [
"Return",
"true",
"if",
"the",
"provided",
"URL",
"is",
"valid"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21566-L21573 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
this.model.set({
content: {
fields: [{
title: null,
alternative_name: null,
value: 'Loading content...',
index: null,
type: "loading"
}],
data: {}
}
})
return this;
} | javascript | function() {
this.model.set({
content: {
fields: [{
title: null,
alternative_name: null,
value: 'Loading content...',
index: null,
type: "loading"
}],
data: {}
}
})
return this;
} | [
"function",
"(",
")",
"{",
"this",
".",
"model",
".",
"set",
"(",
"{",
"content",
":",
"{",
"fields",
":",
"[",
"{",
"title",
":",
"null",
",",
"alternative_name",
":",
"null",
",",
"value",
":",
"'Loading content...'",
",",
"index",
":",
"null",
","... | Set loading state adding its content | [
"Set",
"loading",
"state",
"adding",
"its",
"content"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21600-L21614 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(delay) {
if (!cdb.core.util.ie || (cdb.core.util.browser.ie && cdb.core.util.browser.ie.version > 8)) {
this.$el.css({
'marginBottom':'-10px',
'display': 'block',
'visibility':'visible',
opacity:0
});
this.$el
.delay(delay)
.animate({
o... | javascript | function(delay) {
if (!cdb.core.util.ie || (cdb.core.util.browser.ie && cdb.core.util.browser.ie.version > 8)) {
this.$el.css({
'marginBottom':'-10px',
'display': 'block',
'visibility':'visible',
opacity:0
});
this.$el
.delay(delay)
.animate({
o... | [
"function",
"(",
"delay",
")",
"{",
"if",
"(",
"!",
"cdb",
".",
"core",
".",
"util",
".",
"ie",
"||",
"(",
"cdb",
".",
"core",
".",
"util",
".",
"browser",
".",
"ie",
"&&",
"cdb",
".",
"core",
".",
"util",
".",
"browser",
".",
"ie",
".",
"ver... | Animate infowindow to show up | [
"Animate",
"infowindow",
"to",
"show",
"up"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21710-L21728 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
if (!$.browser.msie || ($.browser.msie && parseInt($.browser.version) > 8 )) {
var self = this;
this.$el.animate({
marginBottom: "-10px",
opacity: "0",
display: "block"
}, 180, function() {
self.$el.css({visibility: "hidden"});
});
}... | javascript | function() {
if (!$.browser.msie || ($.browser.msie && parseInt($.browser.version) > 8 )) {
var self = this;
this.$el.animate({
marginBottom: "-10px",
opacity: "0",
display: "block"
}, 180, function() {
self.$el.css({visibility: "hidden"});
});
}... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"$",
".",
"browser",
".",
"msie",
"||",
"(",
"$",
".",
"browser",
".",
"msie",
"&&",
"parseInt",
"(",
"$",
".",
"browser",
".",
"version",
")",
">",
"8",
")",
")",
"{",
"var",
"self",
"=",
"this",
";... | Animate infowindow to disappear | [
"Animate",
"infowindow",
"to",
"disappear"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21733-L21746 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function () {
var offset = this.model.get("offset");
if (!this.model.get("autoPan") || this.isHidden()) { return; }
var
x = this.$el.position().left,
y = this.$el.position().top,
containerHeight = this.$el.outerHeight(true) + 15, // Adding some more space
contai... | javascript | function () {
var offset = this.model.get("offset");
if (!this.model.get("autoPan") || this.isHidden()) { return; }
var
x = this.$el.position().left,
y = this.$el.position().top,
containerHeight = this.$el.outerHeight(true) + 15, // Adding some more space
contai... | [
"function",
"(",
")",
"{",
"var",
"offset",
"=",
"this",
".",
"model",
".",
"get",
"(",
"\"offset\"",
")",
";",
"if",
"(",
"!",
"this",
".",
"model",
".",
"get",
"(",
"\"autoPan\"",
")",
"||",
"this",
".",
"isHidden",
"(",
")",
")",
"{",
"return"... | Adjust pan to show correctly the infowindow | [
"Adjust",
"pan",
"to",
"show",
"correctly",
"the",
"infowindow"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L21771-L21808 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(pos) {
var props = {};
if(pos.indexOf('top') !== -1) {
props.top = this.options.pos_margin;
} else if(pos.indexOf('bottom') !== -1) {
props.bottom = this.options.pos_margin;
}
if(pos.indexOf('left') !== -1) {
props.left = this.options.pos_margin;
} else if(pos.indexOf... | javascript | function(pos) {
var props = {};
if(pos.indexOf('top') !== -1) {
props.top = this.options.pos_margin;
} else if(pos.indexOf('bottom') !== -1) {
props.bottom = this.options.pos_margin;
}
if(pos.indexOf('left') !== -1) {
props.left = this.options.pos_margin;
} else if(pos.indexOf... | [
"function",
"(",
"pos",
")",
"{",
"var",
"props",
"=",
"{",
"}",
";",
"if",
"(",
"pos",
".",
"indexOf",
"(",
"'top'",
")",
"!==",
"-",
"1",
")",
"{",
"props",
".",
"top",
"=",
"this",
".",
"options",
".",
"pos_margin",
";",
"}",
"else",
"if",
... | set position based on a string like "top|right", "top|left", "bottom|righ"... | [
"set",
"position",
"based",
"on",
"a",
"string",
"like",
"top|right",
"top|left",
"bottom|righ",
"..."
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L23404-L23419 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(payload) {
var self = this;
if (this.options.compressor) {
return this.options.compressor;
}
payload = payload || JSON.stringify(this.toJSON());
if (!this.options.force_compress && payload.length < this.options.MAX_GET_SIZE) {
return function(data, level, callback) {
ca... | javascript | function(payload) {
var self = this;
if (this.options.compressor) {
return this.options.compressor;
}
payload = payload || JSON.stringify(this.toJSON());
if (!this.options.force_compress && payload.length < this.options.MAX_GET_SIZE) {
return function(data, level, callback) {
ca... | [
"function",
"(",
"payload",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"this",
".",
"options",
".",
"compressor",
")",
"{",
"return",
"this",
".",
"options",
".",
"compressor",
";",
"}",
"payload",
"=",
"payload",
"||",
"JSON",
".",
"strin... | returns the compressor depending on the size of the layer | [
"returns",
"the",
"compressor",
"depending",
"on",
"the",
"size",
"of",
"the",
"layer"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L24341-L24361 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(params, included) {
if(!params) return '';
var url_params = [];
included = included || _.keys(params);
for(var i in included) {
var k = included[i]
var p = params[k];
if(p) {
if (_.isArray(p)) {
for (var j = 0, len = p.length; j < len; j++) {
url_... | javascript | function(params, included) {
if(!params) return '';
var url_params = [];
included = included || _.keys(params);
for(var i in included) {
var k = included[i]
var p = params[k];
if(p) {
if (_.isArray(p)) {
for (var j = 0, len = p.length; j < len; j++) {
url_... | [
"function",
"(",
"params",
",",
"included",
")",
"{",
"if",
"(",
"!",
"params",
")",
"return",
"''",
";",
"var",
"url_params",
"=",
"[",
"]",
";",
"included",
"=",
"included",
"||",
"_",
".",
"keys",
"(",
"params",
")",
";",
"for",
"(",
"var",
"i... | Change query of the tiles
@params {str} New sql for the tiles | [
"Change",
"query",
"of",
"the",
"tiles"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L24516-L24536 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(layer, callback) {
layer = layer == undefined ? 0: layer;
var self = this;
this.getTiles(function(urls) {
if(!urls) {
callback(null);
return;
}
if(callback) {
callback(self._tileJSONfromTiles(layer, urls));
}
});
} | javascript | function(layer, callback) {
layer = layer == undefined ? 0: layer;
var self = this;
this.getTiles(function(urls) {
if(!urls) {
callback(null);
return;
}
if(callback) {
callback(self._tileJSONfromTiles(layer, urls));
}
});
} | [
"function",
"(",
"layer",
",",
"callback",
")",
"{",
"layer",
"=",
"layer",
"==",
"undefined",
"?",
"0",
":",
"layer",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"getTiles",
"(",
"function",
"(",
"urls",
")",
"{",
"if",
"(",
"!",
"urls",
... | get tile json for layer | [
"get",
"tile",
"json",
"for",
"layer"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L24552-L24564 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(number) {
var layers = {}
var c = 0;
for(var i = 0; i < this.layers.length; ++i) {
var layer = this.layers[i];
layers[i] = c;
if(layer.options && !layer.options.hidden) {
++c;
}
}
return layers[number];
} | javascript | function(number) {
var layers = {}
var c = 0;
for(var i = 0; i < this.layers.length; ++i) {
var layer = this.layers[i];
layers[i] = c;
if(layer.options && !layer.options.hidden) {
++c;
}
}
return layers[number];
} | [
"function",
"(",
"number",
")",
"{",
"var",
"layers",
"=",
"{",
"}",
"var",
"c",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"layers",
".",
"length",
";",
"++",
"i",
")",
"{",
"var",
"layer",
"=",
"this",
".... | given number inside layergroup returns the real index in tiler layergroup` | [
"given",
"number",
"inside",
"layergroup",
"returns",
"the",
"real",
"index",
"in",
"tiler",
"layergroup"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L24634-L24645 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(index) {
var layers = [];
for(var i = 0; i < this.layers.length; ++i) {
var layer = this.layers[i];
if(this._isLayerVisible(layer)) {
layers.push(i);
}
}
if (index >= layers.length) {
return -1;
}
return +layers[index];
} | javascript | function(index) {
var layers = [];
for(var i = 0; i < this.layers.length; ++i) {
var layer = this.layers[i];
if(this._isLayerVisible(layer)) {
layers.push(i);
}
}
if (index >= layers.length) {
return -1;
}
return +layers[index];
} | [
"function",
"(",
"index",
")",
"{",
"var",
"layers",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"layers",
".",
"length",
";",
"++",
"i",
")",
"{",
"var",
"layer",
"=",
"this",
".",
"layers",
"[",
"i",
... | return the layer number by index taking into
account the hidden layers. | [
"return",
"the",
"layer",
"number",
"by",
"index",
"taking",
"into",
"account",
"the",
"hidden",
"layers",
"."
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L24651-L24663 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(layer, attributes) {
if(attributes === undefined) {
attributes = layer;
layer = 0;
}
if(layer >= this.getLayerCount() && layer < 0) {
throw new Error("layer does not exist");
}
if(typeof(attributes) == 'string') {
attributes = attributes.split(',');
}
for(... | javascript | function(layer, attributes) {
if(attributes === undefined) {
attributes = layer;
layer = 0;
}
if(layer >= this.getLayerCount() && layer < 0) {
throw new Error("layer does not exist");
}
if(typeof(attributes) == 'string') {
attributes = attributes.split(',');
}
for(... | [
"function",
"(",
"layer",
",",
"attributes",
")",
"{",
"if",
"(",
"attributes",
"===",
"undefined",
")",
"{",
"attributes",
"=",
"layer",
";",
"layer",
"=",
"0",
";",
"}",
"if",
"(",
"layer",
">=",
"this",
".",
"getLayerCount",
"(",
")",
"&&",
"layer... | set interactivity attributes for a layer.
if attributes are passed as first param layer 0 is
set | [
"set",
"interactivity",
"attributes",
"for",
"a",
"layer",
".",
"if",
"attributes",
"are",
"passed",
"as",
"first",
"param",
"layer",
"0",
"is",
"set"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L24874-L24895 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(layer, style, version) {
if(version === undefined) {
version = style;
style = layer;
layer = 0;
}
version = version || cartodb.CARTOCSS_DEFAULT_VERSION;
this.layers[layer].options.cartocss = style;
this.layers[layer].options.cartocss_version = version;
this._definiti... | javascript | function(layer, style, version) {
if(version === undefined) {
version = style;
style = layer;
layer = 0;
}
version = version || cartodb.CARTOCSS_DEFAULT_VERSION;
this.layers[layer].options.cartocss = style;
this.layers[layer].options.cartocss_version = version;
this._definiti... | [
"function",
"(",
"layer",
",",
"style",
",",
"version",
")",
"{",
"if",
"(",
"version",
"===",
"undefined",
")",
"{",
"version",
"=",
"style",
";",
"style",
"=",
"layer",
";",
"layer",
"=",
"0",
";",
"}",
"version",
"=",
"version",
"||",
"cartodb",
... | Change style of the tiles
@params {style} New carto for the tiles | [
"Change",
"style",
"of",
"the",
"tiles"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L24915-L24927 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(layer, b) {
// shift arguments to maintain caompatibility
if(b == undefined) {
b = layer;
layer = 0;
}
var layerInteraction;
this.interactionEnabled[layer] = b;
if(!b) {
layerInteraction = this.interaction[layer];
if(layerInteraction) {
layerInteraction.r... | javascript | function(layer, b) {
// shift arguments to maintain caompatibility
if(b == undefined) {
b = layer;
layer = 0;
}
var layerInteraction;
this.interactionEnabled[layer] = b;
if(!b) {
layerInteraction = this.interaction[layer];
if(layerInteraction) {
layerInteraction.r... | [
"function",
"(",
"layer",
",",
"b",
")",
"{",
"// shift arguments to maintain caompatibility",
"if",
"(",
"b",
"==",
"undefined",
")",
"{",
"b",
"=",
"layer",
";",
"layer",
"=",
"0",
";",
"}",
"var",
"layerInteraction",
";",
"this",
".",
"interactionEnabled"... | Active or desactive interaction
@params enable {Number} layer number
@params layer {Boolean} Choose if wants interaction or not | [
"Active",
"or",
"desactive",
"interaction"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25140-L25188 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
var xyz = {z: 4, x: 6, y: 6}
, self = this
, img = new Image()
, urls = this._tileJSON()
getTiles(function(urls) {
var grid_url = urls.tiles[0]
.replace(/\{z\}/g,xyz.z)
.replace(/\{x\}/g,xyz.x)
.replace(/\{y\}/g,xyz.y);
this.options.aja... | javascript | function() {
var xyz = {z: 4, x: 6, y: 6}
, self = this
, img = new Image()
, urls = this._tileJSON()
getTiles(function(urls) {
var grid_url = urls.tiles[0]
.replace(/\{z\}/g,xyz.z)
.replace(/\{x\}/g,xyz.x)
.replace(/\{y\}/g,xyz.y);
this.options.aja... | [
"function",
"(",
")",
"{",
"var",
"xyz",
"=",
"{",
"z",
":",
"4",
",",
"x",
":",
"6",
",",
"y",
":",
"6",
"}",
",",
"self",
"=",
"this",
",",
"img",
"=",
"new",
"Image",
"(",
")",
",",
"urls",
"=",
"this",
".",
"_tileJSON",
"(",
")",
"get... | Check the tiles | [
"Check",
"the",
"tiles"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25278-L25311 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(container, className) {
// Check if any cartodb-logo exists within container
var a = [];
var re = new RegExp('\\b' + className + '\\b');
var els = container.getElementsByTagName("*");
for(var i=0,j=els.length; i<j; i++)
if(re.test(els[i].className))a.push(els[i]);
return a.length... | javascript | function(container, className) {
// Check if any cartodb-logo exists within container
var a = [];
var re = new RegExp('\\b' + className + '\\b');
var els = container.getElementsByTagName("*");
for(var i=0,j=els.length; i<j; i++)
if(re.test(els[i].className))a.push(els[i]);
return a.length... | [
"function",
"(",
"container",
",",
"className",
")",
"{",
"// Check if any cartodb-logo exists within container",
"var",
"a",
"=",
"[",
"]",
";",
"var",
"re",
"=",
"new",
"RegExp",
"(",
"'\\\\b'",
"+",
"className",
"+",
"'\\\\b'",
")",
";",
"var",
"els",
"="... | Check if any class already exists
in the provided container | [
"Check",
"if",
"any",
"class",
"already",
"exists",
"in",
"the",
"provided",
"container"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25322-L25331 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(position, timeout, container) {
var self = this;
setTimeout(function() {
if (!self.isWadusAdded(container, 'cartodb-logo')) {
var cartodb_link = document.createElement("div");
var is_retina = self.isRetinaBrowser();
cartodb_link.setAttribute('class','cartodb-logo');
... | javascript | function(position, timeout, container) {
var self = this;
setTimeout(function() {
if (!self.isWadusAdded(container, 'cartodb-logo')) {
var cartodb_link = document.createElement("div");
var is_retina = self.isRetinaBrowser();
cartodb_link.setAttribute('class','cartodb-logo');
... | [
"function",
"(",
"position",
",",
"timeout",
",",
"container",
")",
"{",
"var",
"self",
"=",
"this",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"!",
"self",
".",
"isWadusAdded",
"(",
"container",
",",
"'cartodb-logo'",
")",
")",
"{",... | Add Cartodb logo
It needs a position, timeout if it is needed and the container where to add it | [
"Add",
"Cartodb",
"logo",
"It",
"needs",
"a",
"position",
"timeout",
"if",
"it",
"is",
"needed",
"and",
"the",
"container",
"where",
"to",
"add",
"it"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25346-L25361 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(layerModel, leafletLayer, leafletMap) {
this.leafletLayer = leafletLayer;
this.leafletMap = leafletMap;
this.model = layerModel;
this.setModel(layerModel);
this.type = layerModel.get('type') || layerModel.get('kind');
this.type = this.type.toLowerCase();
} | javascript | function(layerModel, leafletLayer, leafletMap) {
this.leafletLayer = leafletLayer;
this.leafletMap = leafletMap;
this.model = layerModel;
this.setModel(layerModel);
this.type = layerModel.get('type') || layerModel.get('kind');
this.type = this.type.toLowerCase();
} | [
"function",
"(",
"layerModel",
",",
"leafletLayer",
",",
"leafletMap",
")",
"{",
"this",
".",
"leafletLayer",
"=",
"leafletLayer",
";",
"this",
".",
"leafletMap",
"=",
"leafletMap",
";",
"this",
".",
"model",
"=",
"layerModel",
";",
"this",
".",
"setModel",
... | base layer for all leaflet layers | [
"base",
"layer",
"for",
"all",
"leaflet",
"layers"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25370-L25379 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function (tilePoint) {
var EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
this._adjustTilePoint(tilePoint);
var tiles = [EMPTY_GIF];
if(this.tilejson) {
tiles = this.tilejson.tiles;
}
var index = (tilePoint.x + tilePoint.y) % tiles.length;
... | javascript | function (tilePoint) {
var EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
this._adjustTilePoint(tilePoint);
var tiles = [EMPTY_GIF];
if(this.tilejson) {
tiles = this.tilejson.tiles;
}
var index = (tilePoint.x + tilePoint.y) % tiles.length;
... | [
"function",
"(",
"tilePoint",
")",
"{",
"var",
"EMPTY_GIF",
"=",
"\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"",
";",
"this",
".",
"_adjustTilePoint",
"(",
"tilePoint",
")",
";",
"var",
"tiles",
"=",
"[",
"EMPTY_GIF",
"]",
";",
"i... | overwrite getTileUrl in order to support different tiles subdomains in tilejson way | [
"overwrite",
"getTileUrl",
"in",
"order",
"to",
"support",
"different",
"tiles",
"subdomains",
"in",
"tilejson",
"way"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25723-L25739 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(opacity) {
if (isNaN(opacity) || opacity>1 || opacity<0) {
throw new Error(opacity + ' is not a valid value');
}
// Leaflet only accepts 0-0.99... Weird!
this.options.opacity = Math.min(opacity, 0.99);
if (this.options.visible) {
L.TileLayer.prototype.setOpacity.call(this, th... | javascript | function(opacity) {
if (isNaN(opacity) || opacity>1 || opacity<0) {
throw new Error(opacity + ' is not a valid value');
}
// Leaflet only accepts 0-0.99... Weird!
this.options.opacity = Math.min(opacity, 0.99);
if (this.options.visible) {
L.TileLayer.prototype.setOpacity.call(this, th... | [
"function",
"(",
"opacity",
")",
"{",
"if",
"(",
"isNaN",
"(",
"opacity",
")",
"||",
"opacity",
">",
"1",
"||",
"opacity",
"<",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"opacity",
"+",
"' is not a valid value'",
")",
";",
"}",
"// Leaflet only accept... | Change opacity of the layer
@params {Integer} New opacity | [
"Change",
"opacity",
"of",
"the",
"layer"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25745-L25758 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(map) {
var self = this;
this.options.map = map;
// Add cartodb logo
if (this.options.cartodb_logo != false)
cdb.geo.common.CartoDBLogo.addWadus({ left:8, bottom:8 }, 0, map._container);
this.__update(function() {
// if while the layer was processed in the server is removed
... | javascript | function(map) {
var self = this;
this.options.map = map;
// Add cartodb logo
if (this.options.cartodb_logo != false)
cdb.geo.common.CartoDBLogo.addWadus({ left:8, bottom:8 }, 0, map._container);
this.__update(function() {
// if while the layer was processed in the server is removed
... | [
"function",
"(",
"map",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"options",
".",
"map",
"=",
"map",
";",
"// Add cartodb logo",
"if",
"(",
"this",
".",
"options",
".",
"cartodb_logo",
"!=",
"false",
")",
"cdb",
".",
"geo",
".",
"common... | When Leaflet adds the layer... go!
@params {map} | [
"When",
"Leaflet",
"adds",
"the",
"layer",
"...",
"go!"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25765-L25785 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(map) {
if(this.options.added) {
this.options.added = false;
L.TileLayer.prototype.onRemove.call(this, map);
}
} | javascript | function(map) {
if(this.options.added) {
this.options.added = false;
L.TileLayer.prototype.onRemove.call(this, map);
}
} | [
"function",
"(",
"map",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"added",
")",
"{",
"this",
".",
"options",
".",
"added",
"=",
"false",
";",
"L",
".",
"TileLayer",
".",
"prototype",
".",
"onRemove",
".",
"call",
"(",
"this",
",",
"map",
... | When removes the layer, destroy interactivity if exist | [
"When",
"removes",
"the",
"layer",
"destroy",
"interactivity",
"if",
"exist"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25794-L25799 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(done) {
var self = this;
this.fire('updated');
this.fire('loading');
var map = this.options.map;
this.getTiles(function(urls, err) {
if(urls) {
self.tilejson = urls;
self.setUrl(self.tilejson.tiles[0]);
// manage interaction
self._reloadInteraction();
... | javascript | function(done) {
var self = this;
this.fire('updated');
this.fire('loading');
var map = this.options.map;
this.getTiles(function(urls, err) {
if(urls) {
self.tilejson = urls;
self.setUrl(self.tilejson.tiles[0]);
// manage interaction
self._reloadInteraction();
... | [
"function",
"(",
"done",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"fire",
"(",
"'updated'",
")",
";",
"this",
".",
"fire",
"(",
"'loading'",
")",
";",
"var",
"map",
"=",
"this",
".",
"options",
".",
"map",
";",
"this",
".",
"getTil... | Update CartoDB layer
generates a new url for tiles and refresh leaflet layer
do not collide with leaflet _update | [
"Update",
"CartoDB",
"layer",
"generates",
"a",
"new",
"url",
"for",
"tiles",
"and",
"refresh",
"leaflet",
"layer",
"do",
"not",
"collide",
"with",
"leaflet",
"_update"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25806-L25825 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(attribution) {
this._checkLayer();
// Remove old one
this.map.attributionControl.removeAttribution(
cdb.core.sanitize.html(this.options.attribution)
);
// Change text
this.map.attributionControl.addAttribution(
cdb.core.sanitize.html(attribution)
);
// Set new attrib... | javascript | function(attribution) {
this._checkLayer();
// Remove old one
this.map.attributionControl.removeAttribution(
cdb.core.sanitize.html(this.options.attribution)
);
// Change text
this.map.attributionControl.addAttribution(
cdb.core.sanitize.html(attribution)
);
// Set new attrib... | [
"function",
"(",
"attribution",
")",
"{",
"this",
".",
"_checkLayer",
"(",
")",
";",
"// Remove old one",
"this",
".",
"map",
".",
"attributionControl",
".",
"removeAttribution",
"(",
"cdb",
".",
"core",
".",
"sanitize",
".",
"html",
"(",
"this",
".",
"opt... | Set a new layer attribution
@params {String} New attribution string | [
"Set",
"a",
"new",
"layer",
"attribution"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25838-L25854 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(map, o) {
var layer_point = this._findPos(map,o);
if (!layer_point || isNaN(layer_point.x) || isNaN(layer_point.y)) {
// If layer_point doesn't contain x and y,
// we can't calculate event map position
return false;
}
var latlng = map.layerPointToLatLng(layer_point);
var... | javascript | function(map, o) {
var layer_point = this._findPos(map,o);
if (!layer_point || isNaN(layer_point.x) || isNaN(layer_point.y)) {
// If layer_point doesn't contain x and y,
// we can't calculate event map position
return false;
}
var latlng = map.layerPointToLatLng(layer_point);
var... | [
"function",
"(",
"map",
",",
"o",
")",
"{",
"var",
"layer_point",
"=",
"this",
".",
"_findPos",
"(",
"map",
",",
"o",
")",
";",
"if",
"(",
"!",
"layer_point",
"||",
"isNaN",
"(",
"layer_point",
".",
"x",
")",
"||",
"isNaN",
"(",
"layer_point",
".",... | Bind events for wax interaction
@param {Object} Layer map object
@param {Event} Wax event | [
"Bind",
"events",
"for",
"wax",
"interaction"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L25861-L25894 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
var b = this.map_leaflet.getBounds();
var sw = b.getSouthWest();
var ne = b.getNorthEast();
return [
[sw.lat, sw.lng],
[ne.lat, ne.lng]
];
} | javascript | function() {
var b = this.map_leaflet.getBounds();
var sw = b.getSouthWest();
var ne = b.getNorthEast();
return [
[sw.lat, sw.lng],
[ne.lat, ne.lng]
];
} | [
"function",
"(",
")",
"{",
"var",
"b",
"=",
"this",
".",
"map_leaflet",
".",
"getBounds",
"(",
")",
";",
"var",
"sw",
"=",
"b",
".",
"getSouthWest",
"(",
")",
";",
"var",
"ne",
"=",
"b",
".",
"getNorthEast",
"(",
")",
";",
"return",
"[",
"[",
"... | return the current bounds of the map view | [
"return",
"the",
"current",
"bounds",
"of",
"the",
"map",
"view"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L26703-L26711 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(layerModel, gmapsLayer, gmapsMap) {
this.gmapsLayer = gmapsLayer;
this.map = this.gmapsMap = gmapsMap;
this.model = layerModel;
this.model.bind('change', this._update, this);
this.type = layerModel.get('type') || layerModel.get('kind');
this.type = this.type.toLowerCase();
} | javascript | function(layerModel, gmapsLayer, gmapsMap) {
this.gmapsLayer = gmapsLayer;
this.map = this.gmapsMap = gmapsMap;
this.model = layerModel;
this.model.bind('change', this._update, this);
this.type = layerModel.get('type') || layerModel.get('kind');
this.type = this.type.toLowerCase();
} | [
"function",
"(",
"layerModel",
",",
"gmapsLayer",
",",
"gmapsMap",
")",
"{",
"this",
".",
"gmapsLayer",
"=",
"gmapsLayer",
";",
"this",
".",
"map",
"=",
"this",
".",
"gmapsMap",
"=",
"gmapsMap",
";",
"this",
".",
"model",
"=",
"layerModel",
";",
"this",
... | base layer for all google maps | [
"base",
"layer",
"for",
"all",
"google",
"maps"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L26860-L26868 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
var self = this;
var index = -1;
this.gmapsMap.overlayMapTypes.forEach(
function(layer, i) {
if (layer == self) {
index = i;
}
}
);
return index;
} | javascript | function() {
var self = this;
var index = -1;
this.gmapsMap.overlayMapTypes.forEach(
function(layer, i) {
if (layer == self) {
index = i;
}
}
);
return index;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"index",
"=",
"-",
"1",
";",
"this",
".",
"gmapsMap",
".",
"overlayMapTypes",
".",
"forEach",
"(",
"function",
"(",
"layer",
",",
"i",
")",
"{",
"if",
"(",
"layer",
"==",
"self",
... | hack function to search layer inside google maps layers | [
"hack",
"function",
"to",
"search",
"layer",
"inside",
"google",
"maps",
"layers"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L26874-L26885 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function() {
if(!this.isBase) {
var self = this;
var idx = this._searchLayerIndex();
if(idx >= 0) {
this.gmapsMap.overlayMapTypes.removeAt(idx);
} else if (this.gmapsLayer.setMap){
this.gmapsLayer.setMap(null);
}
this.model.unbind(null, null, this);
this.unb... | javascript | function() {
if(!this.isBase) {
var self = this;
var idx = this._searchLayerIndex();
if(idx >= 0) {
this.gmapsMap.overlayMapTypes.removeAt(idx);
} else if (this.gmapsLayer.setMap){
this.gmapsLayer.setMap(null);
}
this.model.unbind(null, null, this);
this.unb... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isBase",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"idx",
"=",
"this",
".",
"_searchLayerIndex",
"(",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"{",
"this",
".",
"gmapsMap",
"."... | remove layer from the map and unbind events | [
"remove",
"layer",
"from",
"the",
"map",
"and",
"unbind",
"events"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L26890-L26902 | train | |
knownasilya/ember-leaflet-cartodb | vendor/ember-leaflet-cartodb/cartodb_noleaflet.js | function(layerModel, gmapsMap) {
var self = this;
_.bindAll(this, 'featureOut', 'featureOver', 'featureClick');
var opts = _.clone(layerModel.attributes);
opts.map = gmapsMap;
var // preserve the user's callbacks
_featureOver = opts.featureOver,
_featureOut = opts.featureOut,
_featureClick = opt... | javascript | function(layerModel, gmapsMap) {
var self = this;
_.bindAll(this, 'featureOut', 'featureOver', 'featureClick');
var opts = _.clone(layerModel.attributes);
opts.map = gmapsMap;
var // preserve the user's callbacks
_featureOver = opts.featureOver,
_featureOut = opts.featureOut,
_featureClick = opt... | [
"function",
"(",
"layerModel",
",",
"gmapsMap",
")",
"{",
"var",
"self",
"=",
"this",
";",
"_",
".",
"bindAll",
"(",
"this",
",",
"'featureOut'",
",",
"'featureOver'",
",",
"'featureClick'",
")",
";",
"var",
"opts",
"=",
"_",
".",
"clone",
"(",
"layerM... | gmaps cartodb layer | [
"gmaps",
"cartodb",
"layer"
] | 61d11c6268d59343746809639e0d23419674ae87 | https://github.com/knownasilya/ember-leaflet-cartodb/blob/61d11c6268d59343746809639e0d23419674ae87/vendor/ember-leaflet-cartodb/cartodb_noleaflet.js#L27601-L27632 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.