id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,100 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function($root, $el, rentManager, manager) {
var $filtered;
// If selector is specified, attempt to find it.
if (manager.selector) {
if (rentManager.noel) {
$filtered = $root.filter(manager.selector);
$root = $filtered.length ? $filtered : $root.find(manager.selector);
} else {
... | javascript | function($root, $el, rentManager, manager) {
var $filtered;
// If selector is specified, attempt to find it.
if (manager.selector) {
if (rentManager.noel) {
$filtered = $root.filter(manager.selector);
$root = $filtered.length ? $filtered : $root.find(manager.selector);
} else {
... | [
"function",
"(",
"$root",
",",
"$el",
",",
"rentManager",
",",
"manager",
")",
"{",
"var",
"$filtered",
";",
"// If selector is specified, attempt to find it.",
"if",
"(",
"manager",
".",
"selector",
")",
"{",
"if",
"(",
"rentManager",
".",
"noel",
")",
"{",
... | This is the most common way you will want to partially apply a view into a layout. | [
"This",
"is",
"the",
"most",
"common",
"way",
"you",
"will",
"want",
"to",
"partially",
"apply",
"a",
"view",
"into",
"a",
"layout",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L1027-L1046 | |
17,101 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(rootView, subViews, selector) {
// Shorthand the parent manager object.
var rentManager = rootView.__manager__;
// Create a simplified manager object that tells partial() where
// place the elements.
var manager = { selector: selector };
// Get the elements to be inserted into the root... | javascript | function(rootView, subViews, selector) {
// Shorthand the parent manager object.
var rentManager = rootView.__manager__;
// Create a simplified manager object that tells partial() where
// place the elements.
var manager = { selector: selector };
// Get the elements to be inserted into the root... | [
"function",
"(",
"rootView",
",",
"subViews",
",",
"selector",
")",
"{",
"// Shorthand the parent manager object.",
"var",
"rentManager",
"=",
"rootView",
".",
"__manager__",
";",
"// Create a simplified manager object that tells partial() where",
"// place the elements.",
"var... | Used for inserting subViews in a single batch. This gives a small performance boost as we write to a disconnected fragment instead of to the DOM directly. Smarter browsers like Chrome will batch writes internally and layout as seldom as possible, but even in that case this provides a decent boost. jQuery will use a D... | [
"Used",
"for",
"inserting",
"subViews",
"in",
"a",
"single",
"batch",
".",
"This",
"gives",
"a",
"small",
"performance",
"boost",
"as",
"we",
"write",
"to",
"a",
"disconnected",
"fragment",
"instead",
"of",
"to",
"the",
"DOM",
"directly",
".",
"Smarter",
"... | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L1060-L1088 | |
17,102 | simontabor/jquery-toggles | toggles.js | function(e) {
el.off('mousemove');
elSlide.off('mouseleave');
elBlob.off('mouseup');
if (!diff && opts['click'] && e.type !== 'mouseleave') {
doToggle();
return;
}
var overBound = active ? diff < -slideLimit : diff > slideLimit;
... | javascript | function(e) {
el.off('mousemove');
elSlide.off('mouseleave');
elBlob.off('mouseup');
if (!diff && opts['click'] && e.type !== 'mouseleave') {
doToggle();
return;
}
var overBound = active ? diff < -slideLimit : diff > slideLimit;
... | [
"function",
"(",
"e",
")",
"{",
"el",
".",
"off",
"(",
"'mousemove'",
")",
";",
"elSlide",
".",
"off",
"(",
"'mouseleave'",
")",
";",
"elBlob",
".",
"off",
"(",
"'mouseup'",
")",
";",
"if",
"(",
"!",
"diff",
"&&",
"opts",
"[",
"'click'",
"]",
"&&... | fired on mouseup and mouseleave events | [
"fired",
"on",
"mouseup",
"and",
"mouseleave",
"events"
] | 1fc33ce039dd07cbf6bcfbe35f891d1e99723347 | https://github.com/simontabor/jquery-toggles/blob/1fc33ce039dd07cbf6bcfbe35f891d1e99723347/toggles.js#L195-L215 | |
17,103 | xzyfer/sass-graph | sass-graph.js | resolveSassPath | function resolveSassPath(sassPath, loadPaths, extensions) {
// trim sass file extensions
var re = new RegExp('(\.('+extensions.join('|')+'))$', 'i');
var sassPathName = sassPath.replace(re, '');
// check all load paths
var i, j, length = loadPaths.length, scssPath, partialPath;
for (i = 0; i < length; i++) ... | javascript | function resolveSassPath(sassPath, loadPaths, extensions) {
// trim sass file extensions
var re = new RegExp('(\.('+extensions.join('|')+'))$', 'i');
var sassPathName = sassPath.replace(re, '');
// check all load paths
var i, j, length = loadPaths.length, scssPath, partialPath;
for (i = 0; i < length; i++) ... | [
"function",
"resolveSassPath",
"(",
"sassPath",
",",
"loadPaths",
",",
"extensions",
")",
"{",
"// trim sass file extensions",
"var",
"re",
"=",
"new",
"RegExp",
"(",
"'(\\.('",
"+",
"extensions",
".",
"join",
"(",
"'|'",
")",
"+",
"'))$'",
",",
"'i'",
")",
... | resolve a sass module to a path | [
"resolve",
"a",
"sass",
"module",
"to",
"a",
"path"
] | fa9fb9098b018f7c90f9f2464203ed3e1ef9da90 | https://github.com/xzyfer/sass-graph/blob/fa9fb9098b018f7c90f9f2464203ed3e1ef9da90/sass-graph.js#L10-L40 |
17,104 | CenterForOpenScience/ember-osf | addon/utils/auth.js | getCookieAuthUrl | function getCookieAuthUrl(nextUri) {
nextUri = nextUri || config.OSF.redirectUri;
const loginUri = `${config.OSF.url}login/?next=${encodeURIComponent(nextUri)}`;
return `${config.OSF.cookieLoginUrl}?service=${encodeURIComponent(loginUri)}`;
} | javascript | function getCookieAuthUrl(nextUri) {
nextUri = nextUri || config.OSF.redirectUri;
const loginUri = `${config.OSF.url}login/?next=${encodeURIComponent(nextUri)}`;
return `${config.OSF.cookieLoginUrl}?service=${encodeURIComponent(loginUri)}`;
} | [
"function",
"getCookieAuthUrl",
"(",
"nextUri",
")",
"{",
"nextUri",
"=",
"nextUri",
"||",
"config",
".",
"OSF",
".",
"redirectUri",
";",
"const",
"loginUri",
"=",
"`",
"${",
"config",
".",
"OSF",
".",
"url",
"}",
"${",
"encodeURIComponent",
"(",
"nextUri"... | Retrieve the correct URL for cookie-based in the OSF, including any additional configurable parameters
@private
@method getCookieAuthUrl
@param {string} nextUri Where to send the browser after a successful login request
@return {string} | [
"Retrieve",
"the",
"correct",
"URL",
"for",
"cookie",
"-",
"based",
"in",
"the",
"OSF",
"including",
"any",
"additional",
"configurable",
"parameters"
] | 833db862ece4f164a7932c43a90861429cb8bb98 | https://github.com/CenterForOpenScience/ember-osf/blob/833db862ece4f164a7932c43a90861429cb8bb98/addon/utils/auth.js#L41-L45 |
17,105 | CenterForOpenScience/ember-osf | addon/utils/discover-page.js | buildQueryBody | function buildQueryBody(queryParams, filters, queryParamsChanged) {
let query = {
query_string: {
query: queryParams.q || '*',
},
};
if (filters.length) {
query = {
bool: {
must: query,
filter: filters,
},
}... | javascript | function buildQueryBody(queryParams, filters, queryParamsChanged) {
let query = {
query_string: {
query: queryParams.q || '*',
},
};
if (filters.length) {
query = {
bool: {
must: query,
filter: filters,
},
}... | [
"function",
"buildQueryBody",
"(",
"queryParams",
",",
"filters",
",",
"queryParamsChanged",
")",
"{",
"let",
"query",
"=",
"{",
"query_string",
":",
"{",
"query",
":",
"queryParams",
".",
"q",
"||",
"'*'",
",",
"}",
",",
"}",
";",
"if",
"(",
"filters",
... | Construct queryBody for OSF facets
@method buildQueryBody
@param {Object} queryParams - Ember Parachute queryParams
@param {List} filters - Filters for query body
@param {Boolean} queryParamsChanged - Whether or not any queryParams differ from their defaults
@return {String} queryBody - Stringified queryBody | [
"Construct",
"queryBody",
"for",
"OSF",
"facets"
] | 833db862ece4f164a7932c43a90861429cb8bb98 | https://github.com/CenterForOpenScience/ember-osf/blob/833db862ece4f164a7932c43a90861429cb8bb98/addon/utils/discover-page.js#L64-L98 |
17,106 | CenterForOpenScience/ember-osf | addon/utils/discover-page.js | sortContributors | function sortContributors(contributors) {
return contributors
.sort((b, a) => (b.order_cited || -1) - (a.order_cited || -1))
.map(contributor => ({
users: Object.keys(contributor).reduce(
(acc, key) => Ember.assign(acc, { [Ember.String.camelize(key)]: contributor[key] }),... | javascript | function sortContributors(contributors) {
return contributors
.sort((b, a) => (b.order_cited || -1) - (a.order_cited || -1))
.map(contributor => ({
users: Object.keys(contributor).reduce(
(acc, key) => Ember.assign(acc, { [Ember.String.camelize(key)]: contributor[key] }),... | [
"function",
"sortContributors",
"(",
"contributors",
")",
"{",
"return",
"contributors",
".",
"sort",
"(",
"(",
"b",
",",
"a",
")",
"=>",
"(",
"b",
".",
"order_cited",
"||",
"-",
"1",
")",
"-",
"(",
"a",
".",
"order_cited",
"||",
"-",
"1",
")",
")"... | Sort contributors by order cited and set bibliographic property
@private
@method sortContributors
@param {List} contributors - list.contributors from a SHARE ES result
@return {List} | [
"Sort",
"contributors",
"by",
"order",
"cited",
"and",
"set",
"bibliographic",
"property"
] | 833db862ece4f164a7932c43a90861429cb8bb98 | https://github.com/CenterForOpenScience/ember-osf/blob/833db862ece4f164a7932c43a90861429cb8bb98/addon/utils/discover-page.js#L154-L163 |
17,107 | CenterForOpenScience/ember-osf | addon/utils/discover-page.js | transformShareData | function transformShareData(result) {
const transformedResult = Ember.assign(result._source, {
id: result._id,
type: 'elastic-search-result',
workType: result._source['@type'],
abstract: result._source.description,
subjects: result._source.subjects.map(each => ({ text: each }... | javascript | function transformShareData(result) {
const transformedResult = Ember.assign(result._source, {
id: result._id,
type: 'elastic-search-result',
workType: result._source['@type'],
abstract: result._source.description,
subjects: result._source.subjects.map(each => ({ text: each }... | [
"function",
"transformShareData",
"(",
"result",
")",
"{",
"const",
"transformedResult",
"=",
"Ember",
".",
"assign",
"(",
"result",
".",
"_source",
",",
"{",
"id",
":",
"result",
".",
"_id",
",",
"type",
":",
"'elastic-search-result'",
",",
"workType",
":",... | Make share data look like apiv2 preprints data and pull out identifiers
@private
@method transformShareData
@param {Object} result - hit from a SHARE ES
@return {Object} | [
"Make",
"share",
"data",
"look",
"like",
"apiv2",
"preprints",
"data",
"and",
"pull",
"out",
"identifiers"
] | 833db862ece4f164a7932c43a90861429cb8bb98 | https://github.com/CenterForOpenScience/ember-osf/blob/833db862ece4f164a7932c43a90861429cb8bb98/addon/utils/discover-page.js#L173-L217 |
17,108 | apvarun/toastify-js | src/toastify.js | function(options) {
// Verifying and validating the input object
if (!options) {
options = {};
}
// Creating the options object
this.options = {};
// Validating the options
this.options.text = options.text || "Hi there!"; // Display message
this.options.duration... | javascript | function(options) {
// Verifying and validating the input object
if (!options) {
options = {};
}
// Creating the options object
this.options = {};
// Validating the options
this.options.text = options.text || "Hi there!"; // Display message
this.options.duration... | [
"function",
"(",
"options",
")",
"{",
"// Verifying and validating the input object",
"if",
"(",
"!",
"options",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"// Creating the options object",
"this",
".",
"options",
"=",
"{",
"}",
";",
"// Validating the options"... | Initializing the object with required parameters | [
"Initializing",
"the",
"object",
"with",
"required",
"parameters"
] | ee56ec7a185e731cae0868e50b0711786c851384 | https://github.com/apvarun/toastify-js/blob/ee56ec7a185e731cae0868e50b0711786c851384/src/toastify.js#L31-L56 | |
17,109 | apvarun/toastify-js | src/toastify.js | function() {
// Validating if the options are defined
if (!this.options) {
throw "Toastify is not initialized";
}
// Creating the DOM object
var divElement = document.createElement("div");
divElement.className = "toastify on " + this.options.className;
// Positioning ... | javascript | function() {
// Validating if the options are defined
if (!this.options) {
throw "Toastify is not initialized";
}
// Creating the DOM object
var divElement = document.createElement("div");
divElement.className = "toastify on " + this.options.className;
// Positioning ... | [
"function",
"(",
")",
"{",
"// Validating if the options are defined",
"if",
"(",
"!",
"this",
".",
"options",
")",
"{",
"throw",
"\"Toastify is not initialized\"",
";",
"}",
"// Creating the DOM object",
"var",
"divElement",
"=",
"document",
".",
"createElement",
"("... | Building the DOM element | [
"Building",
"the",
"DOM",
"element"
] | ee56ec7a185e731cae0868e50b0711786c851384 | https://github.com/apvarun/toastify-js/blob/ee56ec7a185e731cae0868e50b0711786c851384/src/toastify.js#L59-L150 | |
17,110 | apvarun/toastify-js | src/toastify.js | function() {
// Creating the DOM object for the toast
var toastElement = this.buildToast();
// Getting the root element to with the toast needs to be added
var rootElement;
if (typeof this.options.selector === "undefined") {
rootElement = document.body;
} else {
root... | javascript | function() {
// Creating the DOM object for the toast
var toastElement = this.buildToast();
// Getting the root element to with the toast needs to be added
var rootElement;
if (typeof this.options.selector === "undefined") {
rootElement = document.body;
} else {
root... | [
"function",
"(",
")",
"{",
"// Creating the DOM object for the toast",
"var",
"toastElement",
"=",
"this",
".",
"buildToast",
"(",
")",
";",
"// Getting the root element to with the toast needs to be added",
"var",
"rootElement",
";",
"if",
"(",
"typeof",
"this",
".",
"... | Displaying the toast | [
"Displaying",
"the",
"toast"
] | ee56ec7a185e731cae0868e50b0711786c851384 | https://github.com/apvarun/toastify-js/blob/ee56ec7a185e731cae0868e50b0711786c851384/src/toastify.js#L153-L186 | |
17,111 | apvarun/toastify-js | src/toastify.js | function(toastElement) {
// Hiding the element
// toastElement.classList.remove("on");
toastElement.className = toastElement.className.replace(" on", "");
// Removing the element from DOM after transition end
window.setTimeout(
function() {
// Remove the elemenf from the... | javascript | function(toastElement) {
// Hiding the element
// toastElement.classList.remove("on");
toastElement.className = toastElement.className.replace(" on", "");
// Removing the element from DOM after transition end
window.setTimeout(
function() {
// Remove the elemenf from the... | [
"function",
"(",
"toastElement",
")",
"{",
"// Hiding the element",
"// toastElement.classList.remove(\"on\");",
"toastElement",
".",
"className",
"=",
"toastElement",
".",
"className",
".",
"replace",
"(",
"\" on\"",
",",
"\"\"",
")",
";",
"// Removing the element from D... | Removing the element from the DOM | [
"Removing",
"the",
"element",
"from",
"the",
"DOM"
] | ee56ec7a185e731cae0868e50b0711786c851384 | https://github.com/apvarun/toastify-js/blob/ee56ec7a185e731cae0868e50b0711786c851384/src/toastify.js#L189-L208 | |
17,112 | michaelleeallen/mocha-junit-reporter | index.js | getSetting | function getSetting(value, key, defaultVal, transform) {
if (process.env[key] !== undefined) {
var envVal = process.env[key];
return (typeof transform === 'function') ? transform(envVal) : envVal;
}
if (value !== undefined) {
return value;
}
return defaultVal;
} | javascript | function getSetting(value, key, defaultVal, transform) {
if (process.env[key] !== undefined) {
var envVal = process.env[key];
return (typeof transform === 'function') ? transform(envVal) : envVal;
}
if (value !== undefined) {
return value;
}
return defaultVal;
} | [
"function",
"getSetting",
"(",
"value",
",",
"key",
",",
"defaultVal",
",",
"transform",
")",
"{",
"if",
"(",
"process",
".",
"env",
"[",
"key",
"]",
"!==",
"undefined",
")",
"{",
"var",
"envVal",
"=",
"process",
".",
"env",
"[",
"key",
"]",
";",
"... | Determine an option value.
1. If `key` is present in the environment, then use the environment value
2. If `value` is specified, then use that value
3. Fall back to `defaultVal`
@module mocha-junit-reporter
@param {Object} value - the value from the reporter options
@param {String} key - the environment variable to che... | [
"Determine",
"an",
"option",
"value",
".",
"1",
".",
"If",
"key",
"is",
"present",
"in",
"the",
"environment",
"then",
"use",
"the",
"environment",
"value",
"2",
".",
"If",
"value",
"is",
"specified",
"then",
"use",
"that",
"value",
"3",
".",
"Fall",
"... | 74ca40423385113214144477233ad441744452b1 | https://github.com/michaelleeallen/mocha-junit-reporter/blob/74ca40423385113214144477233ad441744452b1/index.js#L77-L86 |
17,113 | michaelleeallen/mocha-junit-reporter | index.js | MochaJUnitReporter | function MochaJUnitReporter(runner, options) {
this._options = configureDefaults(options);
this._runner = runner;
this._generateSuiteTitle = this._options.useFullSuiteTitle ? fullSuiteTitle : defaultSuiteTitle;
this._antId = 0;
var testsuites = [];
function lastSuite() {
return testsuites[testsuites.l... | javascript | function MochaJUnitReporter(runner, options) {
this._options = configureDefaults(options);
this._runner = runner;
this._generateSuiteTitle = this._options.useFullSuiteTitle ? fullSuiteTitle : defaultSuiteTitle;
this._antId = 0;
var testsuites = [];
function lastSuite() {
return testsuites[testsuites.l... | [
"function",
"MochaJUnitReporter",
"(",
"runner",
",",
"options",
")",
"{",
"this",
".",
"_options",
"=",
"configureDefaults",
"(",
"options",
")",
";",
"this",
".",
"_runner",
"=",
"runner",
";",
"this",
".",
"_generateSuiteTitle",
"=",
"this",
".",
"_option... | JUnit reporter for mocha.js.
@module mocha-junit-reporter
@param {EventEmitter} runner - the test runner
@param {Object} options - mocha options | [
"JUnit",
"reporter",
"for",
"mocha",
".",
"js",
"."
] | 74ca40423385113214144477233ad441744452b1 | https://github.com/michaelleeallen/mocha-junit-reporter/blob/74ca40423385113214144477233ad441744452b1/index.js#L157-L206 |
17,114 | moszeed/easysoap | src/index.js | mandatoryCheck | function mandatoryCheck (params = {}) {
assert.ok(params.host !== void 0, 'no host given');
assert.ok(params.path !== void 0, 'no path given');
assert.ok(params.wsdl !== void 0, 'no wsdl given');
} | javascript | function mandatoryCheck (params = {}) {
assert.ok(params.host !== void 0, 'no host given');
assert.ok(params.path !== void 0, 'no path given');
assert.ok(params.wsdl !== void 0, 'no wsdl given');
} | [
"function",
"mandatoryCheck",
"(",
"params",
"=",
"{",
"}",
")",
"{",
"assert",
".",
"ok",
"(",
"params",
".",
"host",
"!==",
"void",
"0",
",",
"'no host given'",
")",
";",
"assert",
".",
"ok",
"(",
"params",
".",
"path",
"!==",
"void",
"0",
",",
"... | check given params object
@param {[type]} params [description]
@return {[type]} [description] | [
"check",
"given",
"params",
"object"
] | 349e3e709fa59c4678ae526e94b22c349feabc6f | https://github.com/moszeed/easysoap/blob/349e3e709fa59c4678ae526e94b22c349feabc6f/src/index.js#L16-L20 |
17,115 | steelbreeze/state.js | lib/node/state.js | invoke | function invoke(actions, message, instance, deepHistory) {
if (deepHistory === void 0) { deepHistory = false; }
for (var _i = 0, actions_2 = actions; _i < actions_2.length; _i++) {
var action = actions_2[_i];
action(message, instance, deepHistory);
}
} | javascript | function invoke(actions, message, instance, deepHistory) {
if (deepHistory === void 0) { deepHistory = false; }
for (var _i = 0, actions_2 = actions; _i < actions_2.length; _i++) {
var action = actions_2[_i];
action(message, instance, deepHistory);
}
} | [
"function",
"invoke",
"(",
"actions",
",",
"message",
",",
"instance",
",",
"deepHistory",
")",
"{",
"if",
"(",
"deepHistory",
"===",
"void",
"0",
")",
"{",
"deepHistory",
"=",
"false",
";",
"}",
"for",
"(",
"var",
"_i",
"=",
"0",
",",
"actions_2",
"... | Invokes behavior.
@param actions The set of [[Action]]s to invoke.
@param message The message that caused the [[Transition]] to be traversed that is triggering this behavior.
@param instance The state machine instance.
@param deepHistory True if [[DeepHistory]] semantics are in force at the time the behavior is invoked... | [
"Invokes",
"behavior",
"."
] | 2e563d7e916de67c7fb8b1e78b09e40420750a38 | https://github.com/steelbreeze/state.js/blob/2e563d7e916de67c7fb8b1e78b09e40420750a38/lib/node/state.js#L750-L756 |
17,116 | ciena-blueplanet/pr-bumper | lib/utils.js | getEnv | function getEnv (key, defaultValue) {
let value = process.env[key]
if (value === 'undefined') {
value = undefined
}
return (value === undefined) ? defaultValue : value
} | javascript | function getEnv (key, defaultValue) {
let value = process.env[key]
if (value === 'undefined') {
value = undefined
}
return (value === undefined) ? defaultValue : value
} | [
"function",
"getEnv",
"(",
"key",
",",
"defaultValue",
")",
"{",
"let",
"value",
"=",
"process",
".",
"env",
"[",
"key",
"]",
"if",
"(",
"value",
"===",
"'undefined'",
")",
"{",
"value",
"=",
"undefined",
"}",
"return",
"(",
"value",
"===",
"undefined"... | Get the given key from process.env, substituting "undefined" for the real undefined
@param {String} key - the environment variable we want to get
@param {*} defaultValue - value to return if key not in env, or if it is 'undefined'
@returns {*} whatever is at process.env[key] with the one exception of "undefined" being ... | [
"Get",
"the",
"given",
"key",
"from",
"process",
".",
"env",
"substituting",
"undefined",
"for",
"the",
"real",
"undefined"
] | bb98aa046556f5b925576528d3fc15c268249d01 | https://github.com/ciena-blueplanet/pr-bumper/blob/bb98aa046556f5b925576528d3fc15c268249d01/lib/utils.js#L68-L75 |
17,117 | ciena-blueplanet/pr-bumper | lib/utils.js | processEnv | function processEnv (config) {
// Grab the CI stuff from env
config.computed.ci.buildNumber = getEnv(config.ci.env.buildNumber)
config.computed.ci.prNumber = getEnv(config.ci.env.pr, 'false')
config.computed.ci.isPr = config.computed.ci.prNumber !== 'false'
config.computed.ci.branch = getEnv(config.ci.env.bra... | javascript | function processEnv (config) {
// Grab the CI stuff from env
config.computed.ci.buildNumber = getEnv(config.ci.env.buildNumber)
config.computed.ci.prNumber = getEnv(config.ci.env.pr, 'false')
config.computed.ci.isPr = config.computed.ci.prNumber !== 'false'
config.computed.ci.branch = getEnv(config.ci.env.bra... | [
"function",
"processEnv",
"(",
"config",
")",
"{",
"// Grab the CI stuff from env",
"config",
".",
"computed",
".",
"ci",
".",
"buildNumber",
"=",
"getEnv",
"(",
"config",
".",
"ci",
".",
"env",
".",
"buildNumber",
")",
"config",
".",
"computed",
".",
"ci",
... | Process the environment variable sections in the config and fill in the computed properties within it
@param {Config} config - the config object to process (will be mutated in-place) | [
"Process",
"the",
"environment",
"variable",
"sections",
"in",
"the",
"config",
"and",
"fill",
"in",
"the",
"computed",
"properties",
"within",
"it"
] | bb98aa046556f5b925576528d3fc15c268249d01 | https://github.com/ciena-blueplanet/pr-bumper/blob/bb98aa046556f5b925576528d3fc15c268249d01/lib/utils.js#L95-L125 |
17,118 | ciena-blueplanet/pr-bumper | lib/vcs/github-enterprise.js | getFetchOpts | function getFetchOpts (config) {
const readToken = config.computed.vcs.auth.readToken
const headers = {}
logger.log(`RO_GH_TOKEN = [${readToken}]`)
if (readToken) {
headers['Authorization'] = `token ${readToken}`
}
return {headers}
} | javascript | function getFetchOpts (config) {
const readToken = config.computed.vcs.auth.readToken
const headers = {}
logger.log(`RO_GH_TOKEN = [${readToken}]`)
if (readToken) {
headers['Authorization'] = `token ${readToken}`
}
return {headers}
} | [
"function",
"getFetchOpts",
"(",
"config",
")",
"{",
"const",
"readToken",
"=",
"config",
".",
"computed",
".",
"vcs",
".",
"auth",
".",
"readToken",
"const",
"headers",
"=",
"{",
"}",
"logger",
".",
"log",
"(",
"`",
"${",
"readToken",
"}",
"`",
")",
... | Get fetch options
@param {Config} config - the pr-bumper config object
@returns {Object} the options | [
"Get",
"fetch",
"options"
] | bb98aa046556f5b925576528d3fc15c268249d01 | https://github.com/ciena-blueplanet/pr-bumper/blob/bb98aa046556f5b925576528d3fc15c268249d01/lib/vcs/github-enterprise.js#L19-L27 |
17,119 | ciena-blueplanet/pr-bumper | lib/vcs/github-enterprise.js | convertPr | function convertPr (ghPr) {
return {
number: ghPr.number,
description: ghPr.body,
url: ghPr.html_url,
headSha: ghPr.head.sha
}
} | javascript | function convertPr (ghPr) {
return {
number: ghPr.number,
description: ghPr.body,
url: ghPr.html_url,
headSha: ghPr.head.sha
}
} | [
"function",
"convertPr",
"(",
"ghPr",
")",
"{",
"return",
"{",
"number",
":",
"ghPr",
".",
"number",
",",
"description",
":",
"ghPr",
".",
"body",
",",
"url",
":",
"ghPr",
".",
"html_url",
",",
"headSha",
":",
"ghPr",
".",
"head",
".",
"sha",
"}",
... | Convert a GitHub PR to a PR representation
@param {GitHubPullRequest} ghPr - the API response from a GitHub API looking for a PR
@returns {PullRequest} a pull request in standard format | [
"Convert",
"a",
"GitHub",
"PR",
"to",
"a",
"PR",
"representation"
] | bb98aa046556f5b925576528d3fc15c268249d01 | https://github.com/ciena-blueplanet/pr-bumper/blob/bb98aa046556f5b925576528d3fc15c268249d01/lib/vcs/github-enterprise.js#L34-L41 |
17,120 | ciena-blueplanet/pr-bumper | lib/bumper.js | addModifiedFile | function addModifiedFile (info, filename) {
if (info.modifiedFiles.indexOf(filename) === -1) {
info.modifiedFiles.push(filename)
}
} | javascript | function addModifiedFile (info, filename) {
if (info.modifiedFiles.indexOf(filename) === -1) {
info.modifiedFiles.push(filename)
}
} | [
"function",
"addModifiedFile",
"(",
"info",
",",
"filename",
")",
"{",
"if",
"(",
"info",
".",
"modifiedFiles",
".",
"indexOf",
"(",
"filename",
")",
"===",
"-",
"1",
")",
"{",
"info",
".",
"modifiedFiles",
".",
"push",
"(",
"filename",
")",
"}",
"}"
] | Adds the given filename to info.modifiedFiles if it doesn't already exist
@param {PrInfo} info - the info for the PR
@param {String[]} info.modifiedFiles - the list of modified files so far
@param {String} filename - the filename to add to info.modifiedFiles if it's not already there | [
"Adds",
"the",
"given",
"filename",
"to",
"info",
".",
"modifiedFiles",
"if",
"it",
"doesn",
"t",
"already",
"exist"
] | bb98aa046556f5b925576528d3fc15c268249d01 | https://github.com/ciena-blueplanet/pr-bumper/blob/bb98aa046556f5b925576528d3fc15c268249d01/lib/bumper.js#L33-L37 |
17,121 | NathanaelA/nativescript-permissions | src/permissions.android.js | handlePermissionResults | function handlePermissionResults(args) {
// get current promise set
//noinspection JSUnresolvedVariable
const promises = pendingPromises[args.requestCode];
// We have either gotten a promise from somewhere else or a bug has occurred and android has called us twice
// In either case we will ignore it...
if (!pro... | javascript | function handlePermissionResults(args) {
// get current promise set
//noinspection JSUnresolvedVariable
const promises = pendingPromises[args.requestCode];
// We have either gotten a promise from somewhere else or a bug has occurred and android has called us twice
// In either case we will ignore it...
if (!pro... | [
"function",
"handlePermissionResults",
"(",
"args",
")",
"{",
"// get current promise set",
"//noinspection JSUnresolvedVariable",
"const",
"promises",
"=",
"pendingPromises",
"[",
"args",
".",
"requestCode",
"]",
";",
"// We have either gotten a promise from somewhere else or a ... | noinspection JSUnresolvedVariable,JSUnresolvedFunction
This handles the results of getting the permissions! | [
"noinspection",
"JSUnresolvedVariable",
"JSUnresolvedFunction",
"This",
"handles",
"the",
"results",
"of",
"getting",
"the",
"permissions!"
] | 5abbb3c8150e5d446aecda1932045068c472d6e2 | https://github.com/NathanaelA/nativescript-permissions/blob/5abbb3c8150e5d446aecda1932045068c472d6e2/src/permissions.android.js#L31-L81 |
17,122 | NathanaelA/nativescript-permissions | src/permissions.android.js | hasSupportVersion4 | function hasSupportVersion4() {
//noinspection JSUnresolvedVariable
if (!android.support || !android.support.v4 || !android.support.v4.content || !android.support.v4.content.ContextCompat || !android.support.v4.content.ContextCompat.checkSelfPermission) {
return false;
}
return true;
} | javascript | function hasSupportVersion4() {
//noinspection JSUnresolvedVariable
if (!android.support || !android.support.v4 || !android.support.v4.content || !android.support.v4.content.ContextCompat || !android.support.v4.content.ContextCompat.checkSelfPermission) {
return false;
}
return true;
} | [
"function",
"hasSupportVersion4",
"(",
")",
"{",
"//noinspection JSUnresolvedVariable",
"if",
"(",
"!",
"android",
".",
"support",
"||",
"!",
"android",
".",
"support",
".",
"v4",
"||",
"!",
"android",
".",
"support",
".",
"v4",
".",
"content",
"||",
"!",
... | Checks to see if v4 is installed and has the proper calls with it
@returns {boolean} | [
"Checks",
"to",
"see",
"if",
"v4",
"is",
"installed",
"and",
"has",
"the",
"proper",
"calls",
"with",
"it"
] | 5abbb3c8150e5d446aecda1932045068c472d6e2 | https://github.com/NathanaelA/nativescript-permissions/blob/5abbb3c8150e5d446aecda1932045068c472d6e2/src/permissions.android.js#L163-L169 |
17,123 | NathanaelA/nativescript-permissions | src/permissions.android.js | hasAndroidX | function hasAndroidX() {
//noinspection JSUnresolvedVariable
if (!global.androidx || !global.androidx.core || !global.androidx.core.content || !global.androidx.core.content.ContextCompat || !global.androidx.core.content.ContextCompat.checkSelfPermission) {
return false;
}
return true;
} | javascript | function hasAndroidX() {
//noinspection JSUnresolvedVariable
if (!global.androidx || !global.androidx.core || !global.androidx.core.content || !global.androidx.core.content.ContextCompat || !global.androidx.core.content.ContextCompat.checkSelfPermission) {
return false;
}
return true;
} | [
"function",
"hasAndroidX",
"(",
")",
"{",
"//noinspection JSUnresolvedVariable",
"if",
"(",
"!",
"global",
".",
"androidx",
"||",
"!",
"global",
".",
"androidx",
".",
"core",
"||",
"!",
"global",
".",
"androidx",
".",
"core",
".",
"content",
"||",
"!",
"gl... | Checks to see if androidx is installed and has the proper calls for it.
@returns {boolean} | [
"Checks",
"to",
"see",
"if",
"androidx",
"is",
"installed",
"and",
"has",
"the",
"proper",
"calls",
"for",
"it",
"."
] | 5abbb3c8150e5d446aecda1932045068c472d6e2 | https://github.com/NathanaelA/nativescript-permissions/blob/5abbb3c8150e5d446aecda1932045068c472d6e2/src/permissions.android.js#L176-L182 |
17,124 | NathanaelA/nativescript-permissions | src/permissions.android.js | getContext | function getContext() {
if (application.android.context) {
return (application.android.context);
}
if (typeof application.getNativeApplication === 'function') {
let ctx = application.getNativeApplication();
if (ctx) {
return ctx;
}
}
//noinspection JSUnresolvedFunction,JSUnresolvedVariable
let ctx = ... | javascript | function getContext() {
if (application.android.context) {
return (application.android.context);
}
if (typeof application.getNativeApplication === 'function') {
let ctx = application.getNativeApplication();
if (ctx) {
return ctx;
}
}
//noinspection JSUnresolvedFunction,JSUnresolvedVariable
let ctx = ... | [
"function",
"getContext",
"(",
")",
"{",
"if",
"(",
"application",
".",
"android",
".",
"context",
")",
"{",
"return",
"(",
"application",
".",
"android",
".",
"context",
")",
";",
"}",
"if",
"(",
"typeof",
"application",
".",
"getNativeApplication",
"==="... | gets the current application context
@returns {*}
@private | [
"gets",
"the",
"current",
"application",
"context"
] | 5abbb3c8150e5d446aecda1932045068c472d6e2 | https://github.com/NathanaelA/nativescript-permissions/blob/5abbb3c8150e5d446aecda1932045068c472d6e2/src/permissions.android.js#L212-L233 |
17,125 | Availity/availity-workflow | packages/workflow/scripts/proxy.js | proxyLogRewrite | function proxyLogRewrite(daArgs) {
const args = Array.prototype.slice.call(daArgs);
return args.map(arg => {
if (typeof arg === 'string') {
return arg.replace(/\[HPM\] /g, '').replace(/ {2}/g, ' ');
}
return arg;
});
} | javascript | function proxyLogRewrite(daArgs) {
const args = Array.prototype.slice.call(daArgs);
return args.map(arg => {
if (typeof arg === 'string') {
return arg.replace(/\[HPM\] /g, '').replace(/ {2}/g, ' ');
}
return arg;
});
} | [
"function",
"proxyLogRewrite",
"(",
"daArgs",
")",
"{",
"const",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"daArgs",
")",
";",
"return",
"args",
".",
"map",
"(",
"arg",
"=>",
"{",
"if",
"(",
"typeof",
"arg",
"===",
"'str... | Clean up HPM messages so they appear more @availity/workflow like ;) | [
"Clean",
"up",
"HPM",
"messages",
"so",
"they",
"appear",
"more"
] | 5a92d4fbebea3e56bd7e8ff4b1ac0e8d7d268b70 | https://github.com/Availity/availity-workflow/blob/5a92d4fbebea3e56bd7e8ff4b1ac0e8d7d268b70/packages/workflow/scripts/proxy.js#L12-L22 |
17,126 | Availity/availity-workflow | packages/workflow/scripts/format.js | formatMessage | function formatMessage(message) {
let lines = message.split('\n');
// Remove webpack-specific loader notation from filename.
// Before:
// ./~/css-loader!./~/postcss-loader!./src/App.css
// After:
// ./src/App.css
if (lines[0].lastIndexOf('!') !== -1) {
lines[0] = lines[0].substr(lines[0].lastIndexOf... | javascript | function formatMessage(message) {
let lines = message.split('\n');
// Remove webpack-specific loader notation from filename.
// Before:
// ./~/css-loader!./~/postcss-loader!./src/App.css
// After:
// ./src/App.css
if (lines[0].lastIndexOf('!') !== -1) {
lines[0] = lines[0].substr(lines[0].lastIndexOf... | [
"function",
"formatMessage",
"(",
"message",
")",
"{",
"let",
"lines",
"=",
"message",
".",
"split",
"(",
"'\\n'",
")",
";",
"// Remove webpack-specific loader notation from filename.",
"// Before:",
"// ./~/css-loader!./~/postcss-loader!./src/App.css",
"// After:",
"// ./src... | Cleans up webpack error messages. | [
"Cleans",
"up",
"webpack",
"error",
"messages",
"."
] | 5a92d4fbebea3e56bd7e8ff4b1ac0e8d7d268b70 | https://github.com/Availity/availity-workflow/blob/5a92d4fbebea3e56bd7e8ff4b1ac0e8d7d268b70/packages/workflow/scripts/format.js#L8-L65 |
17,127 | leepowellcouk/mongoose-validator | lib/mongoose-validator.js | validate | function validate(options) {
if (is.undef(options.validator)) {
throw new Error('validator option undefined')
}
if (!is.function(options.validator) && !is.string(options.validator)) {
throw new Error(
`validator must be of type function or string, received ${typeof options.validator}`
)
}
... | javascript | function validate(options) {
if (is.undef(options.validator)) {
throw new Error('validator option undefined')
}
if (!is.function(options.validator) && !is.string(options.validator)) {
throw new Error(
`validator must be of type function or string, received ${typeof options.validator}`
)
}
... | [
"function",
"validate",
"(",
"options",
")",
"{",
"if",
"(",
"is",
".",
"undef",
"(",
"options",
".",
"validator",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'validator option undefined'",
")",
"}",
"if",
"(",
"!",
"is",
".",
"function",
"(",
"optio... | Create a validator object
@alias module:mongoose-validator
@param {object} options Options object
@param {string} options.validator Validator name to use
@param {*} [options.arguments=[]] Arguments to pass to validator. If more than one argument is required an array must be used. Single arguments will internally be c... | [
"Create",
"a",
"validator",
"object"
] | 9a702aed336516f12905ab72494e9b21768e193a | https://github.com/leepowellcouk/mongoose-validator/blob/9a702aed336516f12905ab72494e9b21768e193a/lib/mongoose-validator.js#L71-L116 |
17,128 | bunkat/schedule | src/core/resource-manager.js | addResourceToMap | function addResourceToMap(map, def, start) {
var sched = JSON.parse(JSON.stringify(def.available || defaultSched)),
nextFn = schedule.memoizedRangeFn(later.schedule(sched).nextRange);
map[def.id] = { schedule: sched, next: nextFn, nextAvail: nextFn(start) };
} | javascript | function addResourceToMap(map, def, start) {
var sched = JSON.parse(JSON.stringify(def.available || defaultSched)),
nextFn = schedule.memoizedRangeFn(later.schedule(sched).nextRange);
map[def.id] = { schedule: sched, next: nextFn, nextAvail: nextFn(start) };
} | [
"function",
"addResourceToMap",
"(",
"map",
",",
"def",
",",
"start",
")",
"{",
"var",
"sched",
"=",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"def",
".",
"available",
"||",
"defaultSched",
")",
")",
",",
"nextFn",
"=",
"schedule",
".",... | Adds a resource to the resource map. | [
"Adds",
"a",
"resource",
"to",
"the",
"resource",
"map",
"."
] | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L38-L43 |
17,129 | bunkat/schedule | src/core/resource-manager.js | getReservation | function getReservation(resources, start, min, max) {
var reservation, schedules = [], delays = {},
maxTries = 50;
initRanges(resources, start, schedules, delays);
while(!(reservation = tryReservation(schedules, min, max)).success && --maxTries) {
updateRanges(schedules, nextValidStart(schedu... | javascript | function getReservation(resources, start, min, max) {
var reservation, schedules = [], delays = {},
maxTries = 50;
initRanges(resources, start, schedules, delays);
while(!(reservation = tryReservation(schedules, min, max)).success && --maxTries) {
updateRanges(schedules, nextValidStart(schedu... | [
"function",
"getReservation",
"(",
"resources",
",",
"start",
",",
"min",
",",
"max",
")",
"{",
"var",
"reservation",
",",
"schedules",
"=",
"[",
"]",
",",
"delays",
"=",
"{",
"}",
",",
"maxTries",
"=",
"50",
";",
"initRanges",
"(",
"resources",
",",
... | Attempts to find the next time that all resources are available, starting
from the start time, with a duration of at least min minutes but no more
than max minutes. | [
"Attempts",
"to",
"find",
"the",
"next",
"time",
"that",
"all",
"resources",
"are",
"available",
"starting",
"from",
"the",
"start",
"time",
"with",
"a",
"duration",
"of",
"at",
"least",
"min",
"minutes",
"but",
"no",
"more",
"than",
"max",
"minutes",
"."
... | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L50-L61 |
17,130 | bunkat/schedule | src/core/resource-manager.js | initRanges | function initRanges(resources, start, ranges, delays) {
for(var i = 0, len = resources.length; i < len; i++) {
var resId = resources[i];
// handles nested resources (OR)
if(Array.isArray(resId)) {
var subRanges = [], subDelays = {};
initRanges(resId, start, subRanges, subDelays);
... | javascript | function initRanges(resources, start, ranges, delays) {
for(var i = 0, len = resources.length; i < len; i++) {
var resId = resources[i];
// handles nested resources (OR)
if(Array.isArray(resId)) {
var subRanges = [], subDelays = {};
initRanges(resId, start, subRanges, subDelays);
... | [
"function",
"initRanges",
"(",
"resources",
",",
"start",
",",
"ranges",
",",
"delays",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"var",
"resId",
"=",
... | Initializes the resource schedule availablity based on the start date
provided. Resources that were not immediately available are captured in
the delays array to be reported with the reservation. | [
"Initializes",
"the",
"resource",
"schedule",
"availablity",
"based",
"on",
"the",
"start",
"date",
"provided",
".",
"Resources",
"that",
"were",
"not",
"immediately",
"available",
"are",
"captured",
"in",
"the",
"delays",
"array",
"to",
"be",
"reported",
"with"... | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L68-L98 |
17,131 | bunkat/schedule | src/core/resource-manager.js | tryReservation | function tryReservation(schedules, min,max) {
var reservation = {success: false},
resources = [], start, end;
for(var i = 0, len = schedules.length; i < len; i++) {
var schedule = schedules[i],
range = schedule.range;
if(!isInternal(schedule)) {
resources.push(schedule.id... | javascript | function tryReservation(schedules, min,max) {
var reservation = {success: false},
resources = [], start, end;
for(var i = 0, len = schedules.length; i < len; i++) {
var schedule = schedules[i],
range = schedule.range;
if(!isInternal(schedule)) {
resources.push(schedule.id... | [
"function",
"tryReservation",
"(",
"schedules",
",",
"min",
",",
"max",
")",
"{",
"var",
"reservation",
"=",
"{",
"success",
":",
"false",
"}",
",",
"resources",
"=",
"[",
"]",
",",
"start",
",",
"end",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
... | Determines if the current schedules overlap for at least min minutes. If
they do, a reservation is created, otherwise a failure is reported. | [
"Determines",
"if",
"the",
"current",
"schedules",
"overlap",
"for",
"at",
"least",
"min",
"minutes",
".",
"If",
"they",
"do",
"a",
"reservation",
"is",
"created",
"otherwise",
"a",
"failure",
"is",
"reported",
"."
] | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L104-L127 |
17,132 | bunkat/schedule | src/core/resource-manager.js | createReservation | function createReservation(resources, start, duration) {
var end = start + (duration * later.MIN),
reservation = {
resources: resources,
start: start,
end: end,
duration: duration,
success: true
};
applyReservation(resources, start, end);
re... | javascript | function createReservation(resources, start, duration) {
var end = start + (duration * later.MIN),
reservation = {
resources: resources,
start: start,
end: end,
duration: duration,
success: true
};
applyReservation(resources, start, end);
re... | [
"function",
"createReservation",
"(",
"resources",
",",
"start",
",",
"duration",
")",
"{",
"var",
"end",
"=",
"start",
"+",
"(",
"duration",
"*",
"later",
".",
"MIN",
")",
",",
"reservation",
"=",
"{",
"resources",
":",
"resources",
",",
"start",
":",
... | Generates a new reservation object and reserves the associated resources. | [
"Generates",
"a",
"new",
"reservation",
"object",
"and",
"reserves",
"the",
"associated",
"resources",
"."
] | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L132-L144 |
17,133 | bunkat/schedule | src/core/resource-manager.js | updateRanges | function updateRanges(resources, start, delays) {
for(var i = 0, len = resources.length; i < len; i++) {
var res = resources[i];
if(res.range[1] > start) continue;
if(res.subRanges) {
updateRanges(res.subRanges, start, {});
setEarliestSubRange(res);
}
else {
re... | javascript | function updateRanges(resources, start, delays) {
for(var i = 0, len = resources.length; i < len; i++) {
var res = resources[i];
if(res.range[1] > start) continue;
if(res.subRanges) {
updateRanges(res.subRanges, start, {});
setEarliestSubRange(res);
}
else {
re... | [
"function",
"updateRanges",
"(",
"resources",
",",
"start",
",",
"delays",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"var",
"res",
"=",
"resources",
"[... | Updates ranges after a failed reservation attempt. Resources that were not
immediately available are captured in the delays array to be reported with
the reservation. | [
"Updates",
"ranges",
"after",
"a",
"failed",
"reservation",
"attempt",
".",
"Resources",
"that",
"were",
"not",
"immediately",
"available",
"are",
"captured",
"in",
"the",
"delays",
"array",
"to",
"be",
"reported",
"with",
"the",
"reservation",
"."
] | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L151-L168 |
17,134 | bunkat/schedule | src/core/resource-manager.js | nextValidStart | function nextValidStart(schedules) {
var latest;
for(var i = 0, len = schedules.length; i < len; i++) {
var end = schedules[i].range[1];
latest = !latest || end < latest ? end : latest;
}
return latest;
} | javascript | function nextValidStart(schedules) {
var latest;
for(var i = 0, len = schedules.length; i < len; i++) {
var end = schedules[i].range[1];
latest = !latest || end < latest ? end : latest;
}
return latest;
} | [
"function",
"nextValidStart",
"(",
"schedules",
")",
"{",
"var",
"latest",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"schedules",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"var",
"end",
"=",
"schedules",
"[",
"i... | Determines the earliest time that a schedule goes invalid which is the
time that should be used to update resource ranges from. | [
"Determines",
"the",
"earliest",
"time",
"that",
"a",
"schedule",
"goes",
"invalid",
"which",
"is",
"the",
"time",
"that",
"should",
"be",
"used",
"to",
"update",
"resource",
"ranges",
"from",
"."
] | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L196-L204 |
17,135 | bunkat/schedule | src/core/resource-manager.js | getLongestDelay | function getLongestDelay(delays) {
var latest, lid;
for(var id in delays) {
var available = delays[id].available;
if(!latest || available < latest) {
latest = available;
lid = id;
}
}
return lid;
} | javascript | function getLongestDelay(delays) {
var latest, lid;
for(var id in delays) {
var available = delays[id].available;
if(!latest || available < latest) {
latest = available;
lid = id;
}
}
return lid;
} | [
"function",
"getLongestDelay",
"(",
"delays",
")",
"{",
"var",
"latest",
",",
"lid",
";",
"for",
"(",
"var",
"id",
"in",
"delays",
")",
"{",
"var",
"available",
"=",
"delays",
"[",
"id",
"]",
".",
"available",
";",
"if",
"(",
"!",
"latest",
"||",
"... | Determines the longest delay amongst a set of delays. Used to determine
which resource to report for resources that are OR'd together. | [
"Determines",
"the",
"longest",
"delay",
"amongst",
"a",
"set",
"of",
"delays",
".",
"Used",
"to",
"determine",
"which",
"resource",
"to",
"report",
"for",
"resources",
"that",
"are",
"OR",
"d",
"together",
"."
] | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L230-L241 |
17,136 | bunkat/schedule | src/core/resource-manager.js | function(arr, prefix, start) {
for(var i = 0, len = arr.length; i < len; i++) {
var def = typeof arr[i] !== 'object' ?
{ id: prefix + arr[i] } :
{ id: prefix + arr[i].id, available: arr[i].available, isNotReservable: arr[i].isNotReservable };
if(!rMap[def.id]) {
addR... | javascript | function(arr, prefix, start) {
for(var i = 0, len = arr.length; i < len; i++) {
var def = typeof arr[i] !== 'object' ?
{ id: prefix + arr[i] } :
{ id: prefix + arr[i].id, available: arr[i].available, isNotReservable: arr[i].isNotReservable };
if(!rMap[def.id]) {
addR... | [
"function",
"(",
"arr",
",",
"prefix",
",",
"start",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"arr",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"var",
"def",
"=",
"typeof",
"arr",
"[",
"i",
"]",
"!=="... | Adds a new resource to the resource map if a resource doesn't already exist
with that id. Expects resources to be passed in as an array and will
prefix each resource with the prefix specified. | [
"Adds",
"a",
"new",
"resource",
"to",
"the",
"resource",
"map",
"if",
"a",
"resource",
"doesn",
"t",
"already",
"exist",
"with",
"that",
"id",
".",
"Expects",
"resources",
"to",
"be",
"passed",
"in",
"as",
"an",
"array",
"and",
"will",
"prefix",
"each",
... | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L265-L275 | |
17,137 | bunkat/schedule | src/core/resource-manager.js | function(resources, start, min, max) {
start = start ? new Date(start) : new Date();
return getReservation(resources, start.getTime(), min || 1, max);
} | javascript | function(resources, start, min, max) {
start = start ? new Date(start) : new Date();
return getReservation(resources, start.getTime(), min || 1, max);
} | [
"function",
"(",
"resources",
",",
"start",
",",
"min",
",",
"max",
")",
"{",
"start",
"=",
"start",
"?",
"new",
"Date",
"(",
"start",
")",
":",
"new",
"Date",
"(",
")",
";",
"return",
"getReservation",
"(",
"resources",
",",
"start",
".",
"getTime",... | Attempts to reserve the set of resources at the earliest possible time from
start time provide with a duration of at least min and no more than max
minutes. | [
"Attempts",
"to",
"reserve",
"the",
"set",
"of",
"resources",
"at",
"the",
"earliest",
"possible",
"time",
"from",
"start",
"time",
"provide",
"with",
"a",
"duration",
"of",
"at",
"least",
"min",
"and",
"no",
"more",
"than",
"max",
"minutes",
"."
] | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resource-manager.js#L282-L285 | |
17,138 | bunkat/schedule | src/core/resources.js | resources | function resources(data) {
var items = [],
fid = schedule.functor(id),
favailable = schedule.functor(available),
freserve = schedule.functor(isNotReservable);
for(var i = 0, len = data.length; i < len; i++) {
var resource = data[i],
rId = fid.call(this, resource, i),
... | javascript | function resources(data) {
var items = [],
fid = schedule.functor(id),
favailable = schedule.functor(available),
freserve = schedule.functor(isNotReservable);
for(var i = 0, len = data.length; i < len; i++) {
var resource = data[i],
rId = fid.call(this, resource, i),
... | [
"function",
"resources",
"(",
"data",
")",
"{",
"var",
"items",
"=",
"[",
"]",
",",
"fid",
"=",
"schedule",
".",
"functor",
"(",
"id",
")",
",",
"favailable",
"=",
"schedule",
".",
"functor",
"(",
"available",
")",
",",
"freserve",
"=",
"schedule",
"... | Takes an array of objects and returns an array of schedule resource objects. | [
"Takes",
"an",
"array",
"of",
"objects",
"and",
"returns",
"an",
"array",
"of",
"schedule",
"resource",
"objects",
"."
] | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/resources.js#L21-L37 |
17,139 | bunkat/schedule | src/core/create.js | forwardPassTask | function forwardPassTask(task, start) {
var resAll = ['_proj', '_task' + task.id],
resources = task.resources ? resAll.concat(task.resources) : resAll,
duration = task.duration,
next = start,
scheduledTask = {schedule: [], duration: task.duration};
while(duration) {
var r ... | javascript | function forwardPassTask(task, start) {
var resAll = ['_proj', '_task' + task.id],
resources = task.resources ? resAll.concat(task.resources) : resAll,
duration = task.duration,
next = start,
scheduledTask = {schedule: [], duration: task.duration};
while(duration) {
var r ... | [
"function",
"forwardPassTask",
"(",
"task",
",",
"start",
")",
"{",
"var",
"resAll",
"=",
"[",
"'_proj'",
",",
"'_task'",
"+",
"task",
".",
"id",
"]",
",",
"resources",
"=",
"task",
".",
"resources",
"?",
"resAll",
".",
"concat",
"(",
"task",
".",
"r... | Finds the next available time that all of a tasks constraints are met and
makes the appropriate resource reservations. A task may be scheduled in a
single contiguous block or multiple blocks of time. | [
"Finds",
"the",
"next",
"available",
"time",
"that",
"all",
"of",
"a",
"tasks",
"constraints",
"are",
"met",
"and",
"makes",
"the",
"appropriate",
"resource",
"reservations",
".",
"A",
"task",
"may",
"be",
"scheduled",
"in",
"a",
"single",
"contiguous",
"blo... | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/create.js#L88-L109 |
17,140 | bunkat/schedule | src/core/dependency-graph.js | createDependencyGraph | function createDependencyGraph(tasks) {
var graph = {
tasks: {},
roots: [],
leaves: [],
resources: [],
depth: 0,
end : 0
};
for(var i = 0, len = tasks.length; i < len; i++) {
var t = tasks[i];
graph.tasks[t.id] = {
id: t.id,
duration: t.durati... | javascript | function createDependencyGraph(tasks) {
var graph = {
tasks: {},
roots: [],
leaves: [],
resources: [],
depth: 0,
end : 0
};
for(var i = 0, len = tasks.length; i < len; i++) {
var t = tasks[i];
graph.tasks[t.id] = {
id: t.id,
duration: t.durati... | [
"function",
"createDependencyGraph",
"(",
"tasks",
")",
"{",
"var",
"graph",
"=",
"{",
"tasks",
":",
"{",
"}",
",",
"roots",
":",
"[",
"]",
",",
"leaves",
":",
"[",
"]",
",",
"resources",
":",
"[",
"]",
",",
"depth",
":",
"0",
",",
"end",
":",
... | Starting point for creating the dependency graph, clones the tasks and
then fills out the graph properties. | [
"Starting",
"point",
"for",
"creating",
"the",
"dependency",
"graph",
"clones",
"the",
"tasks",
"and",
"then",
"fills",
"out",
"the",
"graph",
"properties",
"."
] | 7698978c94e3c54a3e26c1ee701fef8349102ff5 | https://github.com/bunkat/schedule/blob/7698978c94e3c54a3e26c1ee701fef8349102ff5/src/core/dependency-graph.js#L21-L56 |
17,141 | milankinen/livereactload | examples/02-redux/src/reducers/counter.js | counter | function counter(state = 0, action = {}) {
switch (action.type) {
case INCREMENT_COUNTER:
return state + 1;
case DECREMENT_COUNTER:
return state - 1;
default:
return state;
}
} | javascript | function counter(state = 0, action = {}) {
switch (action.type) {
case INCREMENT_COUNTER:
return state + 1;
case DECREMENT_COUNTER:
return state - 1;
default:
return state;
}
} | [
"function",
"counter",
"(",
"state",
"=",
"0",
",",
"action",
"=",
"{",
"}",
")",
"{",
"switch",
"(",
"action",
".",
"type",
")",
"{",
"case",
"INCREMENT_COUNTER",
":",
"return",
"state",
"+",
"1",
";",
"case",
"DECREMENT_COUNTER",
":",
"return",
"stat... | reducer for the counter
@param {number} state input state
@param {object} action object containing the action type
@param {string} action.type action type
@return {number} | [
"reducer",
"for",
"the",
"counter"
] | 4ec023240308e0603f6e40c16f2ab1757eab467d | https://github.com/milankinen/livereactload/blob/4ec023240308e0603f6e40c16f2ab1757eab467d/examples/02-redux/src/reducers/counter.js#L14-L23 |
17,142 | lega911/angular-light | src/ext/router.es.js | routeMatcher | function routeMatcher(route) {
var segments = route.replace(/^\/+|\/+$/, '').split(/\/+/);
var names = [];
var rules = [];
segments.forEach(function(segment){
var rule;
if (segment.charAt(0) === ':') {
names.push(segment.slice(1));
rules.push('([^\/]+)');
} else if... | javascript | function routeMatcher(route) {
var segments = route.replace(/^\/+|\/+$/, '').split(/\/+/);
var names = [];
var rules = [];
segments.forEach(function(segment){
var rule;
if (segment.charAt(0) === ':') {
names.push(segment.slice(1));
rules.push('([^\/]+)');
} else if... | [
"function",
"routeMatcher",
"(",
"route",
")",
"{",
"var",
"segments",
"=",
"route",
".",
"replace",
"(",
"/",
"^\\/+|\\/+$",
"/",
",",
"''",
")",
".",
"split",
"(",
"/",
"\\/+",
"/",
")",
";",
"var",
"names",
"=",
"[",
"]",
";",
"var",
"rules",
... | coded by rumkin | [
"coded",
"by",
"rumkin"
] | 9450ce65e79b7068ac3ef35a9572a866d104edf8 | https://github.com/lega911/angular-light/blob/9450ce65e79b7068ac3ef35a9572a866d104edf8/src/ext/router.es.js#L274-L309 |
17,143 | publiclab/inline-markdown-editor | spec/javascripts/customizations_spec.js | exampleBookFunction | function exampleBookFunction(element, uniqueId) {
expect(element).not.toBeUndefined();
expect(element.length).toBe(1);
expect($('.inline-edit-btn-' + uniqueId).length).toBe(2); // two because there are two buttons per section
expect($('.inline-edit-btn-' + uniqueId + '-fa-book').... | javascript | function exampleBookFunction(element, uniqueId) {
expect(element).not.toBeUndefined();
expect(element.length).toBe(1);
expect($('.inline-edit-btn-' + uniqueId).length).toBe(2); // two because there are two buttons per section
expect($('.inline-edit-btn-' + uniqueId + '-fa-book').... | [
"function",
"exampleBookFunction",
"(",
"element",
",",
"uniqueId",
")",
"{",
"expect",
"(",
"element",
")",
".",
"not",
".",
"toBeUndefined",
"(",
")",
";",
"expect",
"(",
"element",
".",
"length",
")",
".",
"toBe",
"(",
"1",
")",
";",
"expect",
"(",
... | here we specify a button icon and a function to be run on it | [
"here",
"we",
"specify",
"a",
"button",
"icon",
"and",
"a",
"function",
"to",
"be",
"run",
"on",
"it"
] | c6342531174ee9dd92538ae63efc1e303cc7e842 | https://github.com/publiclab/inline-markdown-editor/blob/c6342531174ee9dd92538ae63efc1e303cc7e842/spec/javascripts/customizations_spec.js#L13-L19 |
17,144 | publiclab/inline-markdown-editor | src/processSection.js | onEdit | function onEdit() {
var editor;
if (o.wysiwyg && $('#' + uniqueId).find('.wk-container').length === 0) {
// insert rich editor
var editorOptions = o.editorOptions || {};
editorOptions.textarea = $('#' + uniqueId + ' textarea')[0];
editorOptions.tagsModule = (edito... | javascript | function onEdit() {
var editor;
if (o.wysiwyg && $('#' + uniqueId).find('.wk-container').length === 0) {
// insert rich editor
var editorOptions = o.editorOptions || {};
editorOptions.textarea = $('#' + uniqueId + ' textarea')[0];
editorOptions.tagsModule = (edito... | [
"function",
"onEdit",
"(",
")",
"{",
"var",
"editor",
";",
"if",
"(",
"o",
".",
"wysiwyg",
"&&",
"$",
"(",
"'#'",
"+",
"uniqueId",
")",
".",
"find",
"(",
"'.wk-container'",
")",
".",
"length",
"===",
"0",
")",
"{",
"// insert rich editor",
"var",
"ed... | plan for swappable editors; will need to specify both constructor and onEditorSubmit | [
"plan",
"for",
"swappable",
"editors",
";",
"will",
"need",
"to",
"specify",
"both",
"constructor",
"and",
"onEditorSubmit"
] | c6342531174ee9dd92538ae63efc1e303cc7e842 | https://github.com/publiclab/inline-markdown-editor/blob/c6342531174ee9dd92538ae63efc1e303cc7e842/src/processSection.js#L27-L43 |
17,145 | fex-team/kity | demo/public/draggable.js | function () {
var target = this.dragTarget;
target.off( DRAG_START_EVENT, target._dragStartHandler );
target.getPaper().off( DRAG_END_EVENT, target._dragEndHandler );
delete target._dragStartHandler;
delete target._dragEndHandler;
this.dragEnabled ... | javascript | function () {
var target = this.dragTarget;
target.off( DRAG_START_EVENT, target._dragStartHandler );
target.getPaper().off( DRAG_END_EVENT, target._dragEndHandler );
delete target._dragStartHandler;
delete target._dragEndHandler;
this.dragEnabled ... | [
"function",
"(",
")",
"{",
"var",
"target",
"=",
"this",
".",
"dragTarget",
";",
"target",
".",
"off",
"(",
"DRAG_START_EVENT",
",",
"target",
".",
"_dragStartHandler",
")",
";",
"target",
".",
"getPaper",
"(",
")",
".",
"off",
"(",
"DRAG_END_EVENT",
","... | end of drag | [
"end",
"of",
"drag"
] | 592279cf2b095e940d6a457a1c6d2591eb9a9302 | https://github.com/fex-team/kity/blob/592279cf2b095e940d6a457a1c6d2591eb9a9302/demo/public/draggable.js#L129-L137 | |
17,146 | pbatey/query-to-mongo | index.js | typedValue | function typedValue(value) {
if (value[0] == '!') value = value.substr(1)
var regex = value.match(/^\/(.*)\/(i?)$/);
var quotedString = value.match(/(["'])(?:\\\1|.)*?\1/);
if (regex) {
return new RegExp(regex[1], regex[2]);
} else if (quotedString) {
return quotedString[0].substr(1, quotedString[0].... | javascript | function typedValue(value) {
if (value[0] == '!') value = value.substr(1)
var regex = value.match(/^\/(.*)\/(i?)$/);
var quotedString = value.match(/(["'])(?:\\\1|.)*?\1/);
if (regex) {
return new RegExp(regex[1], regex[2]);
} else if (quotedString) {
return quotedString[0].substr(1, quotedString[0].... | [
"function",
"typedValue",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"[",
"0",
"]",
"==",
"'!'",
")",
"value",
"=",
"value",
".",
"substr",
"(",
"1",
")",
"var",
"regex",
"=",
"value",
".",
"match",
"(",
"/",
"^\\/(.*)\\/(i?)$",
"/",
")",
";",
"... | Convert String to Number, Date, or Boolean if possible. Also strips ! prefix | [
"Convert",
"String",
"to",
"Number",
"Date",
"or",
"Boolean",
"if",
"possible",
".",
"Also",
"strips",
"!",
"prefix"
] | 062dc0fbacb368d1c0ba43585998203417edaab8 | https://github.com/pbatey/query-to-mongo/blob/062dc0fbacb368d1c0ba43585998203417edaab8/index.js#L40-L60 |
17,147 | pbatey/query-to-mongo | index.js | typedValues | function typedValues(svalue) {
var commaSplit = /("[^"]*")|('[^']*')|([^,]+)/g
var values = []
svalue
.match(commaSplit)
.forEach(function(value) {
values.push(typedValue(value))
})
return values;
} | javascript | function typedValues(svalue) {
var commaSplit = /("[^"]*")|('[^']*')|([^,]+)/g
var values = []
svalue
.match(commaSplit)
.forEach(function(value) {
values.push(typedValue(value))
})
return values;
} | [
"function",
"typedValues",
"(",
"svalue",
")",
"{",
"var",
"commaSplit",
"=",
"/",
"(\"[^\"]*\")|('[^']*')|([^,]+)",
"/",
"g",
"var",
"values",
"=",
"[",
"]",
"svalue",
".",
"match",
"(",
"commaSplit",
")",
".",
"forEach",
"(",
"function",
"(",
"value",
")... | Convert a comma separated string value to an array of values. Commas in a quoted string are ignored. Also strips ! prefix from values. | [
"Convert",
"a",
"comma",
"separated",
"string",
"value",
"to",
"an",
"array",
"of",
"values",
".",
"Commas",
"in",
"a",
"quoted",
"string",
"are",
"ignored",
".",
"Also",
"strips",
"!",
"prefix",
"from",
"values",
"."
] | 062dc0fbacb368d1c0ba43585998203417edaab8 | https://github.com/pbatey/query-to-mongo/blob/062dc0fbacb368d1c0ba43585998203417edaab8/index.js#L64-L73 |
17,148 | Mindmapp/mmp | example/app.js | downloadMap | function downloadMap(map) {
let data = map.exportAsJSON(),
json = JSON.stringify(data),
blob = new Blob([json], {type: "application/json"}),
a = document.createElement("a");
a.download = "example.json";
a.href = URL.createObjectURL(blob);
a.click();
} | javascript | function downloadMap(map) {
let data = map.exportAsJSON(),
json = JSON.stringify(data),
blob = new Blob([json], {type: "application/json"}),
a = document.createElement("a");
a.download = "example.json";
a.href = URL.createObjectURL(blob);
a.click();
} | [
"function",
"downloadMap",
"(",
"map",
")",
"{",
"let",
"data",
"=",
"map",
".",
"exportAsJSON",
"(",
")",
",",
"json",
"=",
"JSON",
".",
"stringify",
"(",
"data",
")",
",",
"blob",
"=",
"new",
"Blob",
"(",
"[",
"json",
"]",
",",
"{",
"type",
":"... | Download the json of the map | [
"Download",
"the",
"json",
"of",
"the",
"map"
] | ddb60450af6f7967e2c3eb6fc0326a2e989d9829 | https://github.com/Mindmapp/mmp/blob/ddb60450af6f7967e2c3eb6fc0326a2e989d9829/example/app.js#L23-L32 |
17,149 | Mindmapp/mmp | example/app.js | uploadMap | function uploadMap(map, e) {
let reader = new window.FileReader();
reader.readAsText(e.target.files[0]);
reader.onload = function () {
let data = JSON.parse(event.target.result);
map.new(data);
};
} | javascript | function uploadMap(map, e) {
let reader = new window.FileReader();
reader.readAsText(e.target.files[0]);
reader.onload = function () {
let data = JSON.parse(event.target.result);
map.new(data);
};
} | [
"function",
"uploadMap",
"(",
"map",
",",
"e",
")",
"{",
"let",
"reader",
"=",
"new",
"window",
".",
"FileReader",
"(",
")",
";",
"reader",
".",
"readAsText",
"(",
"e",
".",
"target",
".",
"files",
"[",
"0",
"]",
")",
";",
"reader",
".",
"onload",
... | Upload a mmp json to map | [
"Upload",
"a",
"mmp",
"json",
"to",
"map"
] | ddb60450af6f7967e2c3eb6fc0326a2e989d9829 | https://github.com/Mindmapp/mmp/blob/ddb60450af6f7967e2c3eb6fc0326a2e989d9829/example/app.js#L35-L44 |
17,150 | Mindmapp/mmp | example/app.js | downloadImage | function downloadImage(map) {
map.exportAsImage(function (url) {
let a = document.createElement("a");
a.download = "example";
a.href = url;
a.click();
}, "jpeg");
} | javascript | function downloadImage(map) {
map.exportAsImage(function (url) {
let a = document.createElement("a");
a.download = "example";
a.href = url;
a.click();
}, "jpeg");
} | [
"function",
"downloadImage",
"(",
"map",
")",
"{",
"map",
".",
"exportAsImage",
"(",
"function",
"(",
"url",
")",
"{",
"let",
"a",
"=",
"document",
".",
"createElement",
"(",
"\"a\"",
")",
";",
"a",
".",
"download",
"=",
"\"example\"",
";",
"a",
".",
... | Save the image of the map | [
"Save",
"the",
"image",
"of",
"the",
"map"
] | ddb60450af6f7967e2c3eb6fc0326a2e989d9829 | https://github.com/Mindmapp/mmp/blob/ddb60450af6f7967e2c3eb6fc0326a2e989d9829/example/app.js#L47-L54 |
17,151 | Mindmapp/mmp | example/app.js | insertImage | function insertImage(map) {
let src = map.selectNode().image.src;
if (src === "") {
let value = prompt("Please enter your name", "example/img/material-icons/add.svg");
if (value) {
map.updateNode("imageSrc", value);
}
} else {
map.updateNode("imageSrc", "");
... | javascript | function insertImage(map) {
let src = map.selectNode().image.src;
if (src === "") {
let value = prompt("Please enter your name", "example/img/material-icons/add.svg");
if (value) {
map.updateNode("imageSrc", value);
}
} else {
map.updateNode("imageSrc", "");
... | [
"function",
"insertImage",
"(",
"map",
")",
"{",
"let",
"src",
"=",
"map",
".",
"selectNode",
"(",
")",
".",
"image",
".",
"src",
";",
"if",
"(",
"src",
"===",
"\"\"",
")",
"{",
"let",
"value",
"=",
"prompt",
"(",
"\"Please enter your name\"",
",",
"... | Insert an image in the selected node | [
"Insert",
"an",
"image",
"in",
"the",
"selected",
"node"
] | ddb60450af6f7967e2c3eb6fc0326a2e989d9829 | https://github.com/Mindmapp/mmp/blob/ddb60450af6f7967e2c3eb6fc0326a2e989d9829/example/app.js#L57-L69 |
17,152 | Mindmapp/mmp | example/app.js | bold | function bold(map) {
let value = map.selectNode().font.weight !== "bold" ? "bold" : "normal";
map.updateNode("fontWeight", value);
} | javascript | function bold(map) {
let value = map.selectNode().font.weight !== "bold" ? "bold" : "normal";
map.updateNode("fontWeight", value);
} | [
"function",
"bold",
"(",
"map",
")",
"{",
"let",
"value",
"=",
"map",
".",
"selectNode",
"(",
")",
".",
"font",
".",
"weight",
"!==",
"\"bold\"",
"?",
"\"bold\"",
":",
"\"normal\"",
";",
"map",
".",
"updateNode",
"(",
"\"fontWeight\"",
",",
"value",
")... | Update bold status | [
"Update",
"bold",
"status"
] | ddb60450af6f7967e2c3eb6fc0326a2e989d9829 | https://github.com/Mindmapp/mmp/blob/ddb60450af6f7967e2c3eb6fc0326a2e989d9829/example/app.js#L72-L75 |
17,153 | Mindmapp/mmp | example/app.js | italic | function italic(map) {
let value = map.selectNode().font.style !== "italic" ? "italic" : "normal";
map.updateNode("fontStyle", value);
} | javascript | function italic(map) {
let value = map.selectNode().font.style !== "italic" ? "italic" : "normal";
map.updateNode("fontStyle", value);
} | [
"function",
"italic",
"(",
"map",
")",
"{",
"let",
"value",
"=",
"map",
".",
"selectNode",
"(",
")",
".",
"font",
".",
"style",
"!==",
"\"italic\"",
"?",
"\"italic\"",
":",
"\"normal\"",
";",
"map",
".",
"updateNode",
"(",
"\"fontStyle\"",
",",
"value",
... | Update italic status | [
"Update",
"italic",
"status"
] | ddb60450af6f7967e2c3eb6fc0326a2e989d9829 | https://github.com/Mindmapp/mmp/blob/ddb60450af6f7967e2c3eb6fc0326a2e989d9829/example/app.js#L78-L81 |
17,154 | Mindmapp/mmp | example/app.js | updateValues | function updateValues(node, map) {
dom.fontSize[map].value = node.fontSize;
dom.imageSize[map].value = node.image.size;
dom.backgroundColor[map].value = node.colors.background;
dom.branchColor[map].value = node.colors.branch || "#ffffff";
dom.nameColor[map].value = node.colors.name;
} | javascript | function updateValues(node, map) {
dom.fontSize[map].value = node.fontSize;
dom.imageSize[map].value = node.image.size;
dom.backgroundColor[map].value = node.colors.background;
dom.branchColor[map].value = node.colors.branch || "#ffffff";
dom.nameColor[map].value = node.colors.name;
} | [
"function",
"updateValues",
"(",
"node",
",",
"map",
")",
"{",
"dom",
".",
"fontSize",
"[",
"map",
"]",
".",
"value",
"=",
"node",
".",
"fontSize",
";",
"dom",
".",
"imageSize",
"[",
"map",
"]",
".",
"value",
"=",
"node",
".",
"image",
".",
"size",... | Update the values of map controls | [
"Update",
"the",
"values",
"of",
"map",
"controls"
] | ddb60450af6f7967e2c3eb6fc0326a2e989d9829 | https://github.com/Mindmapp/mmp/blob/ddb60450af6f7967e2c3eb6fc0326a2e989d9829/example/app.js#L84-L90 |
17,155 | wmurphyrd/aframe-super-hands-component | index.js | sorter | function sorter (a, b) {
const aDist = a.distance == null ? -1 : a.distance
const bDist = b.distance == null ? -1 : b.distance
if (aDist < bDist) {
return 1
}
if (bDist < aDist) {
return -1
}
return 0
} | javascript | function sorter (a, b) {
const aDist = a.distance == null ? -1 : a.distance
const bDist = b.distance == null ? -1 : b.distance
if (aDist < bDist) {
return 1
}
if (bDist < aDist) {
return -1
}
return 0
} | [
"function",
"sorter",
"(",
"a",
",",
"b",
")",
"{",
"const",
"aDist",
"=",
"a",
".",
"distance",
"==",
"null",
"?",
"-",
"1",
":",
"a",
".",
"distance",
"const",
"bDist",
"=",
"b",
".",
"distance",
"==",
"null",
"?",
"-",
"1",
":",
"b",
".",
... | closer objects and objects with no distance come later in list | [
"closer",
"objects",
"and",
"objects",
"with",
"no",
"distance",
"come",
"later",
"in",
"list"
] | c24b4d7172856147d4370090b48ce6c401a71df0 | https://github.com/wmurphyrd/aframe-super-hands-component/blob/c24b4d7172856147d4370090b48ce6c401a71df0/index.js#L138-L148 |
17,156 | yvele/azure-function-express | src/IncomingMessage.js | createConnectionObject | function createConnectionObject(context) {
const { req } = context.bindings;
const xForwardedFor = req.headers ? req.headers["x-forwarded-for"] : undefined;
return {
encrypted : req.originalUrl && req.originalUrl.toLowerCase().startsWith("https"),
remoteAddress : removePortFromAddress(xForwardedFor)
... | javascript | function createConnectionObject(context) {
const { req } = context.bindings;
const xForwardedFor = req.headers ? req.headers["x-forwarded-for"] : undefined;
return {
encrypted : req.originalUrl && req.originalUrl.toLowerCase().startsWith("https"),
remoteAddress : removePortFromAddress(xForwardedFor)
... | [
"function",
"createConnectionObject",
"(",
"context",
")",
"{",
"const",
"{",
"req",
"}",
"=",
"context",
".",
"bindings",
";",
"const",
"xForwardedFor",
"=",
"req",
".",
"headers",
"?",
"req",
".",
"headers",
"[",
"\"x-forwarded-for\"",
"]",
":",
"undefined... | Create a fake connection object
@param {Object} context Raw Azure context object for a single HTTP request
@returns {object} Connection object | [
"Create",
"a",
"fake",
"connection",
"object"
] | 2bd90411b20480f2e430d730b638974d3391e671 | https://github.com/yvele/azure-function-express/blob/2bd90411b20480f2e430d730b638974d3391e671/src/IncomingMessage.js#L18-L26 |
17,157 | yvele/azure-function-express | src/IncomingMessage.js | sanitizeContext | function sanitizeContext(context) {
const sanitizedContext = {
...context,
log : context.log.bind(context)
};
// We don't want the developper to mess up express flow
// See https://github.com/yvele/azure-function-express/pull/12#issuecomment-336733540
delete sanitizedContext.done;
return sanitized... | javascript | function sanitizeContext(context) {
const sanitizedContext = {
...context,
log : context.log.bind(context)
};
// We don't want the developper to mess up express flow
// See https://github.com/yvele/azure-function-express/pull/12#issuecomment-336733540
delete sanitizedContext.done;
return sanitized... | [
"function",
"sanitizeContext",
"(",
"context",
")",
"{",
"const",
"sanitizedContext",
"=",
"{",
"...",
"context",
",",
"log",
":",
"context",
".",
"log",
".",
"bind",
"(",
"context",
")",
"}",
";",
"// We don't want the developper to mess up express flow",
"// See... | Copy usefull context properties from the native context provided by the Azure Function engine
See:
- https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#context-object
- https://github.com/christopheranderson/azure-functions-typescript/blob/master/src/context.d.ts
@param {Object} context R... | [
"Copy",
"usefull",
"context",
"properties",
"from",
"the",
"native",
"context",
"provided",
"by",
"the",
"Azure",
"Function",
"engine"
] | 2bd90411b20480f2e430d730b638974d3391e671 | https://github.com/yvele/azure-function-express/blob/2bd90411b20480f2e430d730b638974d3391e671/src/IncomingMessage.js#L38-L49 |
17,158 | s-yadav/patternLock | lib/util.js | getLengthAngle | function getLengthAngle(x1, x2, y1, y2) {
var xDiff = x2 - x1;
var yDiff = y2 - y1;
return {
length: Math.ceil(Math.sqrt(xDiff * xDiff + yDiff * yDiff)),
angle: Math.round(Math.atan2(yDiff, xDiff) * 180 / Math.PI)
};
} | javascript | function getLengthAngle(x1, x2, y1, y2) {
var xDiff = x2 - x1;
var yDiff = y2 - y1;
return {
length: Math.ceil(Math.sqrt(xDiff * xDiff + yDiff * yDiff)),
angle: Math.round(Math.atan2(yDiff, xDiff) * 180 / Math.PI)
};
} | [
"function",
"getLengthAngle",
"(",
"x1",
",",
"x2",
",",
"y1",
",",
"y2",
")",
"{",
"var",
"xDiff",
"=",
"x2",
"-",
"x1",
";",
"var",
"yDiff",
"=",
"y2",
"-",
"y1",
";",
"return",
"{",
"length",
":",
"Math",
".",
"ceil",
"(",
"Math",
".",
"sqrt... | return height and angle for lines | [
"return",
"height",
"and",
"angle",
"for",
"lines"
] | 6d33baeb85818852b5cf06e05c96fdd81dd85fb0 | https://github.com/s-yadav/patternLock/blob/6d33baeb85818852b5cf06e05c96fdd81dd85fb0/lib/util.js#L88-L97 |
17,159 | leeoniya/RgbQuant.js | src/rgbquant.js | distEuclidean | function distEuclidean(rgb0, rgb1) {
var rd = rgb1[0]-rgb0[0],
gd = rgb1[1]-rgb0[1],
bd = rgb1[2]-rgb0[2];
return Math.sqrt(Pr*rd*rd + Pg*gd*gd + Pb*bd*bd) / euclMax;
} | javascript | function distEuclidean(rgb0, rgb1) {
var rd = rgb1[0]-rgb0[0],
gd = rgb1[1]-rgb0[1],
bd = rgb1[2]-rgb0[2];
return Math.sqrt(Pr*rd*rd + Pg*gd*gd + Pb*bd*bd) / euclMax;
} | [
"function",
"distEuclidean",
"(",
"rgb0",
",",
"rgb1",
")",
"{",
"var",
"rd",
"=",
"rgb1",
"[",
"0",
"]",
"-",
"rgb0",
"[",
"0",
"]",
",",
"gd",
"=",
"rgb1",
"[",
"1",
"]",
"-",
"rgb0",
"[",
"1",
"]",
",",
"bd",
"=",
"rgb1",
"[",
"2",
"]",
... | perceptual Euclidean color distance | [
"perceptual",
"Euclidean",
"color",
"distance"
] | dd80ef94c2256eb0af4b8451b3f5c4e1b5a70988 | https://github.com/leeoniya/RgbQuant.js/blob/dd80ef94c2256eb0af4b8451b3f5c4e1b5a70988/src/rgbquant.js#L723-L729 |
17,160 | leeoniya/RgbQuant.js | src/rgbquant.js | distManhattan | function distManhattan(rgb0, rgb1) {
var rd = Math.abs(rgb1[0]-rgb0[0]),
gd = Math.abs(rgb1[1]-rgb0[1]),
bd = Math.abs(rgb1[2]-rgb0[2]);
return (Pr*rd + Pg*gd + Pb*bd) / manhMax;
} | javascript | function distManhattan(rgb0, rgb1) {
var rd = Math.abs(rgb1[0]-rgb0[0]),
gd = Math.abs(rgb1[1]-rgb0[1]),
bd = Math.abs(rgb1[2]-rgb0[2]);
return (Pr*rd + Pg*gd + Pb*bd) / manhMax;
} | [
"function",
"distManhattan",
"(",
"rgb0",
",",
"rgb1",
")",
"{",
"var",
"rd",
"=",
"Math",
".",
"abs",
"(",
"rgb1",
"[",
"0",
"]",
"-",
"rgb0",
"[",
"0",
"]",
")",
",",
"gd",
"=",
"Math",
".",
"abs",
"(",
"rgb1",
"[",
"1",
"]",
"-",
"rgb0",
... | perceptual Manhattan color distance | [
"perceptual",
"Manhattan",
"color",
"distance"
] | dd80ef94c2256eb0af4b8451b3f5c4e1b5a70988 | https://github.com/leeoniya/RgbQuant.js/blob/dd80ef94c2256eb0af4b8451b3f5c4e1b5a70988/src/rgbquant.js#L733-L739 |
17,161 | leeoniya/RgbQuant.js | src/rgbquant.js | sortedHashKeys | function sortedHashKeys(obj, desc) {
var keys = [];
for (var key in obj)
keys.push(key);
return sort.call(keys, function(a,b) {
return desc ? obj[b] - obj[a] : obj[a] - obj[b];
});
} | javascript | function sortedHashKeys(obj, desc) {
var keys = [];
for (var key in obj)
keys.push(key);
return sort.call(keys, function(a,b) {
return desc ? obj[b] - obj[a] : obj[a] - obj[b];
});
} | [
"function",
"sortedHashKeys",
"(",
"obj",
",",
"desc",
")",
"{",
"var",
"keys",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"keys",
".",
"push",
"(",
"key",
")",
";",
"return",
"sort",
".",
"call",
"(",
"keys",
",",
"function"... | returns array of hash keys sorted by their values | [
"returns",
"array",
"of",
"hash",
"keys",
"sorted",
"by",
"their",
"values"
] | dd80ef94c2256eb0af4b8451b3f5c4e1b5a70988 | https://github.com/leeoniya/RgbQuant.js/blob/dd80ef94c2256eb0af4b8451b3f5c4e1b5a70988/src/rgbquant.js#L916-L925 |
17,162 | serverless-heaven/serverless-aws-alias | lib/stackops/functions.js | mergeAliases | function mergeAliases(stackName, newTemplate, currentTemplate, aliasStackTemplates, currentAliasStackTemplate, removedResources) {
const allAliasTemplates = _.concat(aliasStackTemplates, currentAliasStackTemplate);
// Get all referenced function logical resource ids
const aliasedFunctions =
_.flatMap(
allAlia... | javascript | function mergeAliases(stackName, newTemplate, currentTemplate, aliasStackTemplates, currentAliasStackTemplate, removedResources) {
const allAliasTemplates = _.concat(aliasStackTemplates, currentAliasStackTemplate);
// Get all referenced function logical resource ids
const aliasedFunctions =
_.flatMap(
allAlia... | [
"function",
"mergeAliases",
"(",
"stackName",
",",
"newTemplate",
",",
"currentTemplate",
",",
"aliasStackTemplates",
",",
"currentAliasStackTemplate",
",",
"removedResources",
")",
"{",
"const",
"allAliasTemplates",
"=",
"_",
".",
"concat",
"(",
"aliasStackTemplates",
... | Merge template definitions that are still in use into the new template
@param stackName {String} Main stack name
@param newTemplate {Object} New main stack template
@param currentTemplate {Object} Currently deployed main stack template
@param aliasStackTemplates {Array<Object>} Currently deployed and references aliases | [
"Merge",
"template",
"definitions",
"that",
"are",
"still",
"in",
"use",
"into",
"the",
"new",
"template"
] | 6b9d0ac66a71dd686627eefccf071e0ea7e266ee | https://github.com/serverless-heaven/serverless-aws-alias/blob/6b9d0ac66a71dd686627eefccf071e0ea7e266ee/lib/stackops/functions.js#L17-L63 |
17,163 | cabal-club/cabal-core | index.js | Cabal | function Cabal (storage, key, opts) {
if (!(this instanceof Cabal)) return new Cabal(storage, key, opts)
if (!opts) opts = {}
events.EventEmitter.call(this)
var json = {
encode: function (obj) {
return Buffer.from(JSON.stringify(obj))
},
decode: function (buf) {
var str = buf.toString('... | javascript | function Cabal (storage, key, opts) {
if (!(this instanceof Cabal)) return new Cabal(storage, key, opts)
if (!opts) opts = {}
events.EventEmitter.call(this)
var json = {
encode: function (obj) {
return Buffer.from(JSON.stringify(obj))
},
decode: function (buf) {
var str = buf.toString('... | [
"function",
"Cabal",
"(",
"storage",
",",
"key",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Cabal",
")",
")",
"return",
"new",
"Cabal",
"(",
"storage",
",",
"key",
",",
"opts",
")",
"if",
"(",
"!",
"opts",
")",
"opts",
"="... | Create a new cabal. This is the object handling all
local nickname -> mesh interactions for a single user.
@constructor
@param {string|function} storage - A hyperdb compatible storage function, or a string representing the local data path.
@param {string} key - The dat link
@param {Object} opts - | [
"Create",
"a",
"new",
"cabal",
".",
"This",
"is",
"the",
"object",
"handling",
"all",
"local",
"nickname",
"-",
">",
"mesh",
"interactions",
"for",
"a",
"single",
"user",
"."
] | 5c2a69a398a6e66221fc3ef2cebfd43df2def320 | https://github.com/cabal-club/cabal-core/blob/5c2a69a398a6e66221fc3ef2cebfd43df2def320/index.js#L25-L69 |
17,164 | cabal-club/cabal-core | views/topics.js | sanitize | function sanitize (msg) {
if (typeof msg !== 'object') return null
if (typeof msg.value !== 'object') return null
if (typeof msg.value.content !== 'object') return null
if (typeof msg.value.timestamp !== 'number') return null
if (typeof msg.value.type !== 'string') return null
if (typeof msg.value.content.c... | javascript | function sanitize (msg) {
if (typeof msg !== 'object') return null
if (typeof msg.value !== 'object') return null
if (typeof msg.value.content !== 'object') return null
if (typeof msg.value.timestamp !== 'number') return null
if (typeof msg.value.type !== 'string') return null
if (typeof msg.value.content.c... | [
"function",
"sanitize",
"(",
"msg",
")",
"{",
"if",
"(",
"typeof",
"msg",
"!==",
"'object'",
")",
"return",
"null",
"if",
"(",
"typeof",
"msg",
".",
"value",
"!==",
"'object'",
")",
"return",
"null",
"if",
"(",
"typeof",
"msg",
".",
"value",
".",
"co... | Either returns a well-formed channel message, or null. | [
"Either",
"returns",
"a",
"well",
"-",
"formed",
"channel",
"message",
"or",
"null",
"."
] | 5c2a69a398a6e66221fc3ef2cebfd43df2def320 | https://github.com/cabal-club/cabal-core/blob/5c2a69a398a6e66221fc3ef2cebfd43df2def320/views/topics.js#L50-L59 |
17,165 | cabal-club/cabal-core | views/users.js | sanitize | function sanitize (msg) {
if (typeof msg !== 'object') return null
if (typeof msg.value !== 'object') return null
if (typeof msg.value.content !== 'object') return null
if (typeof msg.value.timestamp !== 'number') return null
if (typeof msg.value.type !== 'string') return null
return msg
} | javascript | function sanitize (msg) {
if (typeof msg !== 'object') return null
if (typeof msg.value !== 'object') return null
if (typeof msg.value.content !== 'object') return null
if (typeof msg.value.timestamp !== 'number') return null
if (typeof msg.value.type !== 'string') return null
return msg
} | [
"function",
"sanitize",
"(",
"msg",
")",
"{",
"if",
"(",
"typeof",
"msg",
"!==",
"'object'",
")",
"return",
"null",
"if",
"(",
"typeof",
"msg",
".",
"value",
"!==",
"'object'",
")",
"return",
"null",
"if",
"(",
"typeof",
"msg",
".",
"value",
".",
"co... | Either returns a well-formed user message, or null. | [
"Either",
"returns",
"a",
"well",
"-",
"formed",
"user",
"message",
"or",
"null",
"."
] | 5c2a69a398a6e66221fc3ef2cebfd43df2def320 | https://github.com/cabal-club/cabal-core/blob/5c2a69a398a6e66221fc3ef2cebfd43df2def320/views/users.js#L80-L87 |
17,166 | cabal-club/cabal-core | views/messages.js | function (core, channel, opts) {
opts = opts || {}
var t = through.obj()
if (opts.gt) opts.gt = 'msg!' + channel + '!' + charwise.encode(opts.gt) + '!'
else opts.gt = 'msg!' + channel + '!'
if (opts.lt) opts.lt = 'msg!' + channel + '!' + charwise.encode(opts.lt) + '~'
... | javascript | function (core, channel, opts) {
opts = opts || {}
var t = through.obj()
if (opts.gt) opts.gt = 'msg!' + channel + '!' + charwise.encode(opts.gt) + '!'
else opts.gt = 'msg!' + channel + '!'
if (opts.lt) opts.lt = 'msg!' + channel + '!' + charwise.encode(opts.lt) + '~'
... | [
"function",
"(",
"core",
",",
"channel",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
"var",
"t",
"=",
"through",
".",
"obj",
"(",
")",
"if",
"(",
"opts",
".",
"gt",
")",
"opts",
".",
"gt",
"=",
"'msg!'",
"+",
"channel",
"+",
"... | Creates a read stream of messages
@param {Object} core - HyperCore to stream messages from.
@param {String} channel - Name of channel
@param {Object} opts :
`gt` {Number} - Filter by timestamp where message.timestamp is greater than `gt`
`lt` {Number} - Filter by timestamp where message.timestamp is lesser than `lt`
Su... | [
"Creates",
"a",
"read",
"stream",
"of",
"messages"
] | 5c2a69a398a6e66221fc3ef2cebfd43df2def320 | https://github.com/cabal-club/cabal-core/blob/5c2a69a398a6e66221fc3ef2cebfd43df2def320/views/messages.js#L54-L70 | |
17,167 | johnpduane/confluence-api | lib/confluence.js | Confluence | function Confluence(config) {
if (!(this instanceof Confluence)) return new Confluence(config);
if (!config) {
throw new Error("Confluence module expects a config object.");
}
else if (!config.username || ! config.password) {
throw new Error("Confluence module expects a config object wi... | javascript | function Confluence(config) {
if (!(this instanceof Confluence)) return new Confluence(config);
if (!config) {
throw new Error("Confluence module expects a config object.");
}
else if (!config.username || ! config.password) {
throw new Error("Confluence module expects a config object wi... | [
"function",
"Confluence",
"(",
"config",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Confluence",
")",
")",
"return",
"new",
"Confluence",
"(",
"config",
")",
";",
"if",
"(",
"!",
"config",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Confluenc... | Construct Confluence.
@constructor
@this {Confluence}
@param {Object} config
@param {string} config.username
@param {string} config.password
@param {string} config.baseUrl
@param {number} config.version - Optional | [
"Construct",
"Confluence",
"."
] | 27f300d6d50e37991ed950f7ed395f4ccca49e3f | https://github.com/johnpduane/confluence-api/blob/27f300d6d50e37991ed950f7ed395f4ccca49e3f/lib/confluence.js#L23-L45 |
17,168 | fiduswriter/xslt-processor | src/xslt.js | xsltPassThrough | function xsltPassThrough(input, template, output, outputDocument) {
if (template.nodeType == DOM_TEXT_NODE) {
if (xsltPassText(template)) {
let node = domCreateTextNode(outputDocument, template.nodeValue);
domAppendChild(output, node);
}
} else if (template.nodeType == D... | javascript | function xsltPassThrough(input, template, output, outputDocument) {
if (template.nodeType == DOM_TEXT_NODE) {
if (xsltPassText(template)) {
let node = domCreateTextNode(outputDocument, template.nodeValue);
domAppendChild(output, node);
}
} else if (template.nodeType == D... | [
"function",
"xsltPassThrough",
"(",
"input",
",",
"template",
",",
"output",
",",
"outputDocument",
")",
"{",
"if",
"(",
"template",
".",
"nodeType",
"==",
"DOM_TEXT_NODE",
")",
"{",
"if",
"(",
"xsltPassText",
"(",
"template",
")",
")",
"{",
"let",
"node",... | Passes template text to the output. The current template node does not specify an XSL-T operation and therefore is appended to the output with all its attributes. Then continues traversing the template node tree. | [
"Passes",
"template",
"text",
"to",
"the",
"output",
".",
"The",
"current",
"template",
"node",
"does",
"not",
"specify",
"an",
"XSL",
"-",
"T",
"operation",
"and",
"therefore",
"is",
"appended",
"to",
"the",
"output",
"with",
"all",
"its",
"attributes",
"... | fc5f2d6fa1d63da2ba96e4bce692d2e5ab52bf53 | https://github.com/fiduswriter/xslt-processor/blob/fc5f2d6fa1d63da2ba96e4bce692d2e5ab52bf53/src/xslt.js#L404-L429 |
17,169 | yibn2008/find-process | lib/find.js | find | function find (by, value, strict) {
return new Promise((resolve, reject) => {
if (!(by in findBy)) {
reject(new Error(`do not support find by "${by}"`))
} else {
findBy[by](value, strict).then(resolve, reject)
}
})
} | javascript | function find (by, value, strict) {
return new Promise((resolve, reject) => {
if (!(by in findBy)) {
reject(new Error(`do not support find by "${by}"`))
} else {
findBy[by](value, strict).then(resolve, reject)
}
})
} | [
"function",
"find",
"(",
"by",
",",
"value",
",",
"strict",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"!",
"(",
"by",
"in",
"findBy",
")",
")",
"{",
"reject",
"(",
"new",
"Error",
"(",
... | find process by condition
return Promise: [{
pid: <process id>,
ppid: <process parent id>,
uid: <user id (*nix)>,
gid: <user group id (*nix)>,
name: <command name>,
cmd: <process run args>
}, ...]
If no process found, resolve process with empty array (only reject when error occured)
@param {String} by condition: po... | [
"find",
"process",
"by",
"condition"
] | a0a154cc6b0676312233ded67fd042d6c5095913 | https://github.com/yibn2008/find-process/blob/a0a154cc6b0676312233ded67fd042d6c5095913/lib/find.js#L55-L63 |
17,170 | firesharkstudios/butterfly-server-dotnet | docs/docfx/styles/docfx.js | renderNavbar | function renderNavbar() {
var navbar = $('#navbar ul')[0];
if (typeof (navbar) === 'undefined') {
loadNavbar();
} else {
$('#navbar ul a.active').parents('li').addClass(active);
renderBreadcrumb();
}
function loadNavbar() {
var navbarPath = $("meta[property='docfx\\:navrel']... | javascript | function renderNavbar() {
var navbar = $('#navbar ul')[0];
if (typeof (navbar) === 'undefined') {
loadNavbar();
} else {
$('#navbar ul a.active').parents('li').addClass(active);
renderBreadcrumb();
}
function loadNavbar() {
var navbarPath = $("meta[property='docfx\\:navrel']... | [
"function",
"renderNavbar",
"(",
")",
"{",
"var",
"navbar",
"=",
"$",
"(",
"'#navbar ul'",
")",
"[",
"0",
"]",
";",
"if",
"(",
"typeof",
"(",
"navbar",
")",
"===",
"'undefined'",
")",
"{",
"loadNavbar",
"(",
")",
";",
"}",
"else",
"{",
"$",
"(",
... | Update href in navbar | [
"Update",
"href",
"in",
"navbar"
] | 9859557197966d970e8030e91f908c73c5082e0f | https://github.com/firesharkstudios/butterfly-server-dotnet/blob/9859557197966d970e8030e91f908c73c5082e0f/docs/docfx/styles/docfx.js#L343-L404 |
17,171 | BinaryMuse/planetary.js | site/public/examples/quake/quake.js | autocenter | function autocenter(options) {
options = options || {};
var needsCentering = false;
var globe = null;
var resize = function() {
var width = window.innerWidth + (options.extraWidth || 0);
var height = window.innerHeight + (options.extraHeight || 0);
globe.canvas.width = width;
g... | javascript | function autocenter(options) {
options = options || {};
var needsCentering = false;
var globe = null;
var resize = function() {
var width = window.innerWidth + (options.extraWidth || 0);
var height = window.innerHeight + (options.extraHeight || 0);
globe.canvas.width = width;
g... | [
"function",
"autocenter",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"needsCentering",
"=",
"false",
";",
"var",
"globe",
"=",
"null",
";",
"var",
"resize",
"=",
"function",
"(",
")",
"{",
"var",
"width",
"=",
"w... | Plugin to resize the canvas to fill the window and to automatically center the planet when the window size changes | [
"Plugin",
"to",
"resize",
"the",
"canvas",
"to",
"fill",
"the",
"window",
"and",
"to",
"automatically",
"center",
"the",
"planet",
"when",
"the",
"window",
"size",
"changes"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/examples/quake/quake.js#L163-L189 |
17,172 | BinaryMuse/planetary.js | site/public/examples/quake/quake.js | autoscale | function autoscale(options) {
options = options || {};
return function(planet) {
planet.onInit(function() {
var width = window.innerWidth + (options.extraWidth || 0);
var height = window.innerHeight + (options.extraHeight || 0);
planet.projection.scale(Math.min(width, height) / 2)... | javascript | function autoscale(options) {
options = options || {};
return function(planet) {
planet.onInit(function() {
var width = window.innerWidth + (options.extraWidth || 0);
var height = window.innerHeight + (options.extraHeight || 0);
planet.projection.scale(Math.min(width, height) / 2)... | [
"function",
"autoscale",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"return",
"function",
"(",
"planet",
")",
"{",
"planet",
".",
"onInit",
"(",
"function",
"(",
")",
"{",
"var",
"width",
"=",
"window",
".",
"innerWidth",... | Plugin to automatically scale the planet's projection based on the window size when the planet is initialized | [
"Plugin",
"to",
"automatically",
"scale",
"the",
"planet",
"s",
"projection",
"based",
"on",
"the",
"window",
"size",
"when",
"the",
"planet",
"is",
"initialized"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/examples/quake/quake.js#L193-L202 |
17,173 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function() {
$module
.data(metadata.promise, false)
.data(metadata.xhr, false)
;
$context
.removeClass(className.error)
.removeClass(className.loading)
;
} | javascript | function() {
$module
.data(metadata.promise, false)
.data(metadata.xhr, false)
;
$context
.removeClass(className.error)
.removeClass(className.loading)
;
} | [
"function",
"(",
")",
"{",
"$module",
".",
"data",
"(",
"metadata",
".",
"promise",
",",
"false",
")",
".",
"data",
"(",
"metadata",
".",
"xhr",
",",
"false",
")",
";",
"$context",
".",
"removeClass",
"(",
"className",
".",
"error",
")",
".",
"remove... | reset api request | [
"reset",
"api",
"request"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L765-L774 | |
17,174 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function(member) {
users = $module.data('users');
if(member.id != 'anonymous' && users[ member.id ] === undefined ) {
users[ member.id ] = member.info;
if(settings.randomColor && member.info.color === undefined) {
member.info.color = settings.templates... | javascript | function(member) {
users = $module.data('users');
if(member.id != 'anonymous' && users[ member.id ] === undefined ) {
users[ member.id ] = member.info;
if(settings.randomColor && member.info.color === undefined) {
member.info.color = settings.templates... | [
"function",
"(",
"member",
")",
"{",
"users",
"=",
"$module",
".",
"data",
"(",
"'users'",
")",
";",
"if",
"(",
"member",
".",
"id",
"!=",
"'anonymous'",
"&&",
"users",
"[",
"member",
".",
"id",
"]",
"===",
"undefined",
")",
"{",
"users",
"[",
"mem... | add user to user list | [
"add",
"user",
"to",
"user",
"list"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L2924-L2950 | |
17,175 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function(member) {
users = $module.data('users');
if(member !== undefined && member.id !== 'anonymous') {
delete users[ member.id ];
$module
.data('users', users)
;
$userList
.find('[data-id='+ member.id + ']... | javascript | function(member) {
users = $module.data('users');
if(member !== undefined && member.id !== 'anonymous') {
delete users[ member.id ];
$module
.data('users', users)
;
$userList
.find('[data-id='+ member.id + ']... | [
"function",
"(",
"member",
")",
"{",
"users",
"=",
"$module",
".",
"data",
"(",
"'users'",
")",
";",
"if",
"(",
"member",
"!==",
"undefined",
"&&",
"member",
".",
"id",
"!==",
"'anonymous'",
")",
"{",
"delete",
"users",
"[",
"member",
".",
"id",
"]",... | remove user from user list | [
"remove",
"user",
"from",
"user",
"list"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L2953-L2972 | |
17,176 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function(members) {
users = {};
members.each(function(member) {
if(member.id !== 'anonymous' && member.id !== 'undefined') {
if(settings.randomColor && member.info.color === undefined) {
member.info.color = settings.templates.color(member... | javascript | function(members) {
users = {};
members.each(function(member) {
if(member.id !== 'anonymous' && member.id !== 'undefined') {
if(settings.randomColor && member.info.color === undefined) {
member.info.color = settings.templates.color(member... | [
"function",
"(",
"members",
")",
"{",
"users",
"=",
"{",
"}",
";",
"members",
".",
"each",
"(",
"function",
"(",
"member",
")",
"{",
"if",
"(",
"member",
".",
"id",
"!==",
"'anonymous'",
"&&",
"member",
".",
"id",
"!==",
"'undefined'",
")",
"{",
"i... | receives list of members and generates user list | [
"receives",
"list",
"of",
"members",
"and",
"generates",
"user",
"list"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L2977-L3002 | |
17,177 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function() {
$log
.animate({
width: (module.width.log - module.width.userList)
}, {
duration : settings.speed,
easing : settings.easing,
complete : module.message.scroll.move
})
... | javascript | function() {
$log
.animate({
width: (module.width.log - module.width.userList)
}, {
duration : settings.speed,
easing : settings.easing,
complete : module.message.scroll.move
})
... | [
"function",
"(",
")",
"{",
"$log",
".",
"animate",
"(",
"{",
"width",
":",
"(",
"module",
".",
"width",
".",
"log",
"-",
"module",
".",
"width",
".",
"userList",
")",
"}",
",",
"{",
"duration",
":",
"settings",
".",
"speed",
",",
"easing",
":",
"... | shows user list | [
"shows",
"user",
"list"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L3005-L3015 | |
17,178 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function(message) {
if( !module.utils.emptyString(message) ) {
$.api({
url : settings.endpoint.message,
method : 'POST',
data : {
'message': {
content : message,
timestamp : new Dat... | javascript | function(message) {
if( !module.utils.emptyString(message) ) {
$.api({
url : settings.endpoint.message,
method : 'POST',
data : {
'message': {
content : message,
timestamp : new Dat... | [
"function",
"(",
"message",
")",
"{",
"if",
"(",
"!",
"module",
".",
"utils",
".",
"emptyString",
"(",
"message",
")",
")",
"{",
"$",
".",
"api",
"(",
"{",
"url",
":",
"settings",
".",
"endpoint",
".",
"message",
",",
"method",
":",
"'POST'",
",",
... | sends chat message | [
"sends",
"chat",
"message"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L3055-L3068 | |
17,179 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function(response) {
message = response.data;
users = $module.data('users');
loggedInUser = $module.data('user');
if(users[ message.userID] !== undefined) {
// logged in user's messages already pushed instantly
if(loggedInUser === u... | javascript | function(response) {
message = response.data;
users = $module.data('users');
loggedInUser = $module.data('user');
if(users[ message.userID] !== undefined) {
// logged in user's messages already pushed instantly
if(loggedInUser === u... | [
"function",
"(",
"response",
")",
"{",
"message",
"=",
"response",
".",
"data",
";",
"users",
"=",
"$module",
".",
"data",
"(",
"'users'",
")",
";",
"loggedInUser",
"=",
"$module",
".",
"data",
"(",
"'user'",
")",
";",
"if",
"(",
"users",
"[",
"messa... | receives chat response and processes | [
"receives",
"chat",
"response",
"and",
"processes"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L3071-L3082 | |
17,180 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function(message) {
$log
.append( settings.templates.message(message) )
;
module.message.scroll.test();
$.proxy(settings.onMessage, $log.children().last() )();
} | javascript | function(message) {
$log
.append( settings.templates.message(message) )
;
module.message.scroll.test();
$.proxy(settings.onMessage, $log.children().last() )();
} | [
"function",
"(",
"message",
")",
"{",
"$log",
".",
"append",
"(",
"settings",
".",
"templates",
".",
"message",
"(",
"message",
")",
")",
";",
"module",
".",
"message",
".",
"scroll",
".",
"test",
"(",
")",
";",
"$",
".",
"proxy",
"(",
"settings",
... | displays message in chat log | [
"displays",
"message",
"in",
"chat",
"log"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L3085-L3091 | |
17,181 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function() {
var
message = $messageInput.val(),
loggedInUser = $module.data('user')
;
if(loggedInUser !== undefined && !module.utils.emptyString(message)) {
module.message.send(message);
// display immediately
... | javascript | function() {
var
message = $messageInput.val(),
loggedInUser = $module.data('user')
;
if(loggedInUser !== undefined && !module.utils.emptyString(message)) {
module.message.send(message);
// display immediately
... | [
"function",
"(",
")",
"{",
"var",
"message",
"=",
"$messageInput",
".",
"val",
"(",
")",
",",
"loggedInUser",
"=",
"$module",
".",
"data",
"(",
"'user'",
")",
";",
"if",
"(",
"loggedInUser",
"!==",
"undefined",
"&&",
"!",
"module",
".",
"utils",
".",
... | handles message form submit | [
"handles",
"message",
"form",
"submit"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L3135-L3153 | |
17,182 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function() {
if( !$module.hasClass(className.expand) ) {
$expandButton
.addClass(className.active)
;
module.expand();
}
else {
$expandButton
.removeClass(className.active)
;
... | javascript | function() {
if( !$module.hasClass(className.expand) ) {
$expandButton
.addClass(className.active)
;
module.expand();
}
else {
$expandButton
.removeClass(className.active)
;
... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"$module",
".",
"hasClass",
"(",
"className",
".",
"expand",
")",
")",
"{",
"$expandButton",
".",
"addClass",
"(",
"className",
".",
"active",
")",
";",
"module",
".",
"expand",
"(",
")",
";",
"}",
"else",
... | handles button click on expand button | [
"handles",
"button",
"click",
"on",
"expand",
"button"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L3156-L3169 | |
17,183 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function() {
if( !$log.is(':animated') ) {
if( !$userListButton.hasClass(className.active) ) {
$userListButton
.addClass(className.active)
;
module.user.list.show();
}
else {
$userList... | javascript | function() {
if( !$log.is(':animated') ) {
if( !$userListButton.hasClass(className.active) ) {
$userListButton
.addClass(className.active)
;
module.user.list.show();
}
else {
$userList... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"$log",
".",
"is",
"(",
"':animated'",
")",
")",
"{",
"if",
"(",
"!",
"$userListButton",
".",
"hasClass",
"(",
"className",
".",
"active",
")",
")",
"{",
"$userListButton",
".",
"addClass",
"(",
"className",
... | handles button click on user list button | [
"handles",
"button",
"click",
"on",
"user",
"list",
"button"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L3172-L3188 | |
17,184 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function(source, id, url) {
module.debug('Changing video to ', source, id, url);
$module
.data(metadata.source, source)
.data(metadata.id, id)
.data(metadata.url, url)
;
settings.onChange();
} | javascript | function(source, id, url) {
module.debug('Changing video to ', source, id, url);
$module
.data(metadata.source, source)
.data(metadata.id, id)
.data(metadata.url, url)
;
settings.onChange();
} | [
"function",
"(",
"source",
",",
"id",
",",
"url",
")",
"{",
"module",
".",
"debug",
"(",
"'Changing video to '",
",",
"source",
",",
"id",
",",
"url",
")",
";",
"$module",
".",
"data",
"(",
"metadata",
".",
"source",
",",
"source",
")",
".",
"data",
... | sets new video | [
"sets",
"new",
"video"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L11301-L11309 | |
17,185 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function() {
module.debug('Playing video');
var
source = $module.data(metadata.source) || false,
url = $module.data(metadata.url) || false,
id = $module.data(metadata.id) || false
;
$embed
.html( module.generate.html(s... | javascript | function() {
module.debug('Playing video');
var
source = $module.data(metadata.source) || false,
url = $module.data(metadata.url) || false,
id = $module.data(metadata.id) || false
;
$embed
.html( module.generate.html(s... | [
"function",
"(",
")",
"{",
"module",
".",
"debug",
"(",
"'Playing video'",
")",
";",
"var",
"source",
"=",
"$module",
".",
"data",
"(",
"metadata",
".",
"source",
")",
"||",
"false",
",",
"url",
"=",
"$module",
".",
"data",
"(",
"metadata",
".",
"url... | plays current video | [
"plays",
"current",
"video"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L11327-L11341 | |
17,186 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function(source, id, url) {
module.debug('Generating embed html');
var
width = (settings.width == 'auto')
? $module.width()
: settings.width,
height = (settings.height == 'auto')
? $module.height()
: sett... | javascript | function(source, id, url) {
module.debug('Generating embed html');
var
width = (settings.width == 'auto')
? $module.width()
: settings.width,
height = (settings.height == 'auto')
? $module.height()
: sett... | [
"function",
"(",
"source",
",",
"id",
",",
"url",
")",
"{",
"module",
".",
"debug",
"(",
"'Generating embed html'",
")",
";",
"var",
"width",
"=",
"(",
"settings",
".",
"width",
"==",
"'auto'",
")",
"?",
"$module",
".",
"width",
"(",
")",
":",
"setti... | generates iframe html | [
"generates",
"iframe",
"html"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L11345-L11383 | |
17,187 | BinaryMuse/planetary.js | site/public/semantic/javascript/semantic.js | function(source) {
var
api = (settings.api)
? 1
: 0,
autoplay = (settings.autoplay)
? 1
: 0,
hd = (settings.hd)
? 1
: 0,
showUI = (settings.sho... | javascript | function(source) {
var
api = (settings.api)
? 1
: 0,
autoplay = (settings.autoplay)
? 1
: 0,
hd = (settings.hd)
? 1
: 0,
showUI = (settings.sho... | [
"function",
"(",
"source",
")",
"{",
"var",
"api",
"=",
"(",
"settings",
".",
"api",
")",
"?",
"1",
":",
"0",
",",
"autoplay",
"=",
"(",
"settings",
".",
"autoplay",
")",
"?",
"1",
":",
"0",
",",
"hd",
"=",
"(",
"settings",
".",
"hd",
")",
"?... | generate url parameters | [
"generate",
"url",
"parameters"
] | 838bf922655bdc7e501b3eb59c8e162a20d43f41 | https://github.com/BinaryMuse/planetary.js/blob/838bf922655bdc7e501b3eb59c8e162a20d43f41/site/public/semantic/javascript/semantic.js#L11386-L11439 | |
17,188 | brozeph/node-craigslist | src/index.js | _getPostings | function _getPostings (options, markup) {
let
$ = cheerio.load(markup),
// hostname = options.hostname,
posting = {},
postings = [],
secure = options.secure;
$('div.content')
.find('.result-row')
.each((i, element) => {
let
// introducing fix for #11 - Craigslist markup changed
details = $(e... | javascript | function _getPostings (options, markup) {
let
$ = cheerio.load(markup),
// hostname = options.hostname,
posting = {},
postings = [],
secure = options.secure;
$('div.content')
.find('.result-row')
.each((i, element) => {
let
// introducing fix for #11 - Craigslist markup changed
details = $(e... | [
"function",
"_getPostings",
"(",
"options",
",",
"markup",
")",
"{",
"let",
"$",
"=",
"cheerio",
".",
"load",
"(",
"markup",
")",
",",
"// hostname = options.hostname,",
"posting",
"=",
"{",
"}",
",",
"postings",
"=",
"[",
"]",
",",
"secure",
"=",
"optio... | Accepts string of HTML and parses that string to find all pertinent postings.
@param {object} options - Request options used for the request to craigslist
@param {string} markup - Markup from the request to Craigslist
@returns {Array} postings - The processed and normalized array of postings | [
"Accepts",
"string",
"of",
"HTML",
"and",
"parses",
"that",
"string",
"to",
"find",
"all",
"pertinent",
"postings",
"."
] | 73730d95c94f06feaefcc6a8b33443bf1ff46795 | https://github.com/brozeph/node-craigslist/blob/73730d95c94f06feaefcc6a8b33443bf1ff46795/src/index.js#L134-L205 |
17,189 | MikeMcl/decimal.js-light | decimal.js | multiplyInteger | function multiplyInteger(x, k) {
var temp,
carry = 0,
i = x.length;
for (x = x.slice(); i--;) {
temp = x[i] * k + carry;
x[i] = temp % BASE | 0;
carry = temp / BASE | 0;
}
if (carry) x.unshift(carry);
return x;
} | javascript | function multiplyInteger(x, k) {
var temp,
carry = 0,
i = x.length;
for (x = x.slice(); i--;) {
temp = x[i] * k + carry;
x[i] = temp % BASE | 0;
carry = temp / BASE | 0;
}
if (carry) x.unshift(carry);
return x;
} | [
"function",
"multiplyInteger",
"(",
"x",
",",
"k",
")",
"{",
"var",
"temp",
",",
"carry",
"=",
"0",
",",
"i",
"=",
"x",
".",
"length",
";",
"for",
"(",
"x",
"=",
"x",
".",
"slice",
"(",
")",
";",
"i",
"--",
";",
")",
"{",
"temp",
"=",
"x",
... | Assumes non-zero x and k, and hence non-zero result. | [
"Assumes",
"non",
"-",
"zero",
"x",
"and",
"k",
"and",
"hence",
"non",
"-",
"zero",
"result",
"."
] | ff1e0f93ef0967e18c198f09aa2b329791e7dc0e | https://github.com/MikeMcl/decimal.js-light/blob/ff1e0f93ef0967e18c198f09aa2b329791e7dc0e/decimal.js#L1042-L1056 |
17,190 | MikeMcl/decimal.js-light | decimal.js | getBase10Exponent | function getBase10Exponent(x) {
var e = x.e * LOG_BASE,
w = x.d[0];
// Add the number of digits of the first word of the digits array.
for (; w >= 10; w /= 10) e++;
return e;
} | javascript | function getBase10Exponent(x) {
var e = x.e * LOG_BASE,
w = x.d[0];
// Add the number of digits of the first word of the digits array.
for (; w >= 10; w /= 10) e++;
return e;
} | [
"function",
"getBase10Exponent",
"(",
"x",
")",
"{",
"var",
"e",
"=",
"x",
".",
"e",
"*",
"LOG_BASE",
",",
"w",
"=",
"x",
".",
"d",
"[",
"0",
"]",
";",
"// Add the number of digits of the first word of the digits array.",
"for",
"(",
";",
"w",
">=",
"10",
... | Calculate the base 10 exponent from the base 1e7 exponent. | [
"Calculate",
"the",
"base",
"10",
"exponent",
"from",
"the",
"base",
"1e7",
"exponent",
"."
] | ff1e0f93ef0967e18c198f09aa2b329791e7dc0e | https://github.com/MikeMcl/decimal.js-light/blob/ff1e0f93ef0967e18c198f09aa2b329791e7dc0e/decimal.js#L1337-L1344 |
17,191 | MikeMcl/decimal.js-light | decimal.js | truncate | function truncate(arr, len) {
if (arr.length > len) {
arr.length = len;
return true;
}
} | javascript | function truncate(arr, len) {
if (arr.length > len) {
arr.length = len;
return true;
}
} | [
"function",
"truncate",
"(",
"arr",
",",
"len",
")",
"{",
"if",
"(",
"arr",
".",
"length",
">",
"len",
")",
"{",
"arr",
".",
"length",
"=",
"len",
";",
"return",
"true",
";",
"}",
"}"
] | Does not strip trailing zeros. | [
"Does",
"not",
"strip",
"trailing",
"zeros",
"."
] | ff1e0f93ef0967e18c198f09aa2b329791e7dc0e | https://github.com/MikeMcl/decimal.js-light/blob/ff1e0f93ef0967e18c198f09aa2b329791e7dc0e/decimal.js#L1822-L1827 |
17,192 | vzhou842/faster.js | src/optimizations/array-reduce.js | writeReduceForLoop | function writeReduceForLoop(t, path, reducePath, reduceRight) {
const reduceCall = reducePath.node;
const array = defineIdIfNeeded(t, reducePath.get('callee.object'), path);
const func = extractDynamicFuncIfNeeded(t, reducePath, path);
const acc = path.scope.generateUidIdentifier('acc');
const i = path.scope.gener... | javascript | function writeReduceForLoop(t, path, reducePath, reduceRight) {
const reduceCall = reducePath.node;
const array = defineIdIfNeeded(t, reducePath.get('callee.object'), path);
const func = extractDynamicFuncIfNeeded(t, reducePath, path);
const acc = path.scope.generateUidIdentifier('acc');
const i = path.scope.gener... | [
"function",
"writeReduceForLoop",
"(",
"t",
",",
"path",
",",
"reducePath",
",",
"reduceRight",
")",
"{",
"const",
"reduceCall",
"=",
"reducePath",
".",
"node",
";",
"const",
"array",
"=",
"defineIdIfNeeded",
"(",
"t",
",",
"reducePath",
".",
"get",
"(",
"... | Returns the identifier the result is stored in. | [
"Returns",
"the",
"identifier",
"the",
"result",
"is",
"stored",
"in",
"."
] | 0031e22a65f9069c44476ffd19e7f7553ea54f41 | https://github.com/vzhou842/faster.js/blob/0031e22a65f9069c44476ffd19e7f7553ea54f41/src/optimizations/array-reduce.js#L52-L85 |
17,193 | vzhou842/faster.js | bench/utils.js | randomArray | function randomArray(size) {
const cache = arrayCaches[size];
return cache[Math.floor(Math.random() * cache.length)];
} | javascript | function randomArray(size) {
const cache = arrayCaches[size];
return cache[Math.floor(Math.random() * cache.length)];
} | [
"function",
"randomArray",
"(",
"size",
")",
"{",
"const",
"cache",
"=",
"arrayCaches",
"[",
"size",
"]",
";",
"return",
"cache",
"[",
"Math",
".",
"floor",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"cache",
".",
"length",
")",
"]",
";",
"}"
] | Returns an array of random length with random contents.
@param {string} size - Either 'small', 'medium', or 'large'. | [
"Returns",
"an",
"array",
"of",
"random",
"length",
"with",
"random",
"contents",
"."
] | 0031e22a65f9069c44476ffd19e7f7553ea54f41 | https://github.com/vzhou842/faster.js/blob/0031e22a65f9069c44476ffd19e7f7553ea54f41/bench/utils.js#L15-L18 |
17,194 | IonicaBizau/json2md | lib/index.js | json2md | function json2md(data, prefix, _type) {
prefix = prefix || ""
if (typeof data === "string" || typeof data === "number") {
return indento(data, 1, prefix)
}
let content = []
// Handle arrays
if (Array.isArray(data)) {
for (let i = 0; i < data.length; ++i) {
content.p... | javascript | function json2md(data, prefix, _type) {
prefix = prefix || ""
if (typeof data === "string" || typeof data === "number") {
return indento(data, 1, prefix)
}
let content = []
// Handle arrays
if (Array.isArray(data)) {
for (let i = 0; i < data.length; ++i) {
content.p... | [
"function",
"json2md",
"(",
"data",
",",
"prefix",
",",
"_type",
")",
"{",
"prefix",
"=",
"prefix",
"||",
"\"\"",
"if",
"(",
"typeof",
"data",
"===",
"\"string\"",
"||",
"typeof",
"data",
"===",
"\"number\"",
")",
"{",
"return",
"indento",
"(",
"data",
... | json2md
Converts a JSON input to markdown.
**Supported elements**
| Type | Element | Data | Example ... | [
"json2md",
"Converts",
"a",
"JSON",
"input",
"to",
"markdown",
"."
] | 25076ad5ed0af419c0e0fe806e005842275605fc | https://github.com/IonicaBizau/json2md/blob/25076ad5ed0af419c0e0fe806e005842275605fc/lib/index.js#L51-L74 |
17,195 | flimshaw/Valiant360 | src/valiant.jquery.js | function() {
var muteControl = this.options.muted ? 'fa-volume-off' : 'fa-volume-up';
var playPauseControl = this.options.autoplay ? 'fa-pause' : 'fa-play';
var controlsHTML = ' \
<div class="controlsWrapper">\
<div class="valiant-progress-bar">\
... | javascript | function() {
var muteControl = this.options.muted ? 'fa-volume-off' : 'fa-volume-up';
var playPauseControl = this.options.autoplay ? 'fa-pause' : 'fa-play';
var controlsHTML = ' \
<div class="controlsWrapper">\
<div class="valiant-progress-bar">\
... | [
"function",
"(",
")",
"{",
"var",
"muteControl",
"=",
"this",
".",
"options",
".",
"muted",
"?",
"'fa-volume-off'",
":",
"'fa-volume-up'",
";",
"var",
"playPauseControl",
"=",
"this",
".",
"options",
".",
"autoplay",
"?",
"'fa-pause'",
":",
"'fa-play'",
";",... | creates div and buttons for onscreen video controls | [
"creates",
"div",
"and",
"buttons",
"for",
"onscreen",
"video",
"controls"
] | 79f1b528886ab580e1624ef3b5857dbd541d62c4 | https://github.com/flimshaw/Valiant360/blob/79f1b528886ab580e1624ef3b5857dbd541d62c4/src/valiant.jquery.js#L298-L335 | |
17,196 | flimshaw/Valiant360 | src/lib/Three.js | cacheUniformLocations | function cacheUniformLocations ( program, identifiers ) {
var i, l, id;
for( i = 0, l = identifiers.length; i < l; i ++ ) {
id = identifiers[ i ];
program.uniforms[ id ] = _gl.getUniformLocation( program, id );
}
} | javascript | function cacheUniformLocations ( program, identifiers ) {
var i, l, id;
for( i = 0, l = identifiers.length; i < l; i ++ ) {
id = identifiers[ i ];
program.uniforms[ id ] = _gl.getUniformLocation( program, id );
}
} | [
"function",
"cacheUniformLocations",
"(",
"program",
",",
"identifiers",
")",
"{",
"var",
"i",
",",
"l",
",",
"id",
";",
"for",
"(",
"i",
"=",
"0",
",",
"l",
"=",
"identifiers",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"id",
... | Shader parameters cache | [
"Shader",
"parameters",
"cache"
] | 79f1b528886ab580e1624ef3b5857dbd541d62c4 | https://github.com/flimshaw/Valiant360/blob/79f1b528886ab580e1624ef3b5857dbd541d62c4/src/lib/Three.js#L25483-L25494 |
17,197 | ucbl/HyLAR-Reasoner | hylar/core/Logics/Rule.js | function() {
var factConj = '';
for(var key in this.causes) {
factConj += ' ^ ' + this.causes[key].toString().substring(1).replace(/,/g, '');
}
for(var key in this.operatorCauses) {
factConj += ' ^ ' + this.operatorCauses[key].toString().substring(1).replace(/,/g,... | javascript | function() {
var factConj = '';
for(var key in this.causes) {
factConj += ' ^ ' + this.causes[key].toString().substring(1).replace(/,/g, '');
}
for(var key in this.operatorCauses) {
factConj += ' ^ ' + this.operatorCauses[key].toString().substring(1).replace(/,/g,... | [
"function",
"(",
")",
"{",
"var",
"factConj",
"=",
"''",
";",
"for",
"(",
"var",
"key",
"in",
"this",
".",
"causes",
")",
"{",
"factConj",
"+=",
"' ^ '",
"+",
"this",
".",
"causes",
"[",
"key",
"]",
".",
"toString",
"(",
")",
".",
"substring",
"(... | Convenient method to stringify a rule.
@returns {string} | [
"Convenient",
"method",
"to",
"stringify",
"a",
"rule",
"."
] | a66cd396de89cc2e1921b18f23ec9a8906313df2 | https://github.com/ucbl/HyLAR-Reasoner/blob/a66cd396de89cc2e1921b18f23ec9a8906313df2/hylar/core/Logics/Rule.js#L45-L54 | |
17,198 | ucbl/HyLAR-Reasoner | hylar/core/ReasoningEngine.js | function(FeAdd, FeDel, F, R) {
var FiAdd = [], FiAddNew = [], additions, deletions,
Fe = Logics.getOnlyExplicitFacts(F), FiAddNew = [];
// Deletion
if(FeDel && FeDel.length) {
Fe = Logics.minus(Fe, FeDel);
}
// Insertion
if(FeAdd && FeAdd.length)... | javascript | function(FeAdd, FeDel, F, R) {
var FiAdd = [], FiAddNew = [], additions, deletions,
Fe = Logics.getOnlyExplicitFacts(F), FiAddNew = [];
// Deletion
if(FeDel && FeDel.length) {
Fe = Logics.minus(Fe, FeDel);
}
// Insertion
if(FeAdd && FeAdd.length)... | [
"function",
"(",
"FeAdd",
",",
"FeDel",
",",
"F",
",",
"R",
")",
"{",
"var",
"FiAdd",
"=",
"[",
"]",
",",
"FiAddNew",
"=",
"[",
"]",
",",
"additions",
",",
"deletions",
",",
"Fe",
"=",
"Logics",
".",
"getOnlyExplicitFacts",
"(",
"F",
")",
",",
"F... | A naive reasoner that recalculates the entire knowledge base.
@deprecated
@param triplesIns
@param triplesDel
@param rules
@returns {{fi: *, fe: *}} | [
"A",
"naive",
"reasoner",
"that",
"recalculates",
"the",
"entire",
"knowledge",
"base",
"."
] | a66cd396de89cc2e1921b18f23ec9a8906313df2 | https://github.com/ucbl/HyLAR-Reasoner/blob/a66cd396de89cc2e1921b18f23ec9a8906313df2/hylar/core/ReasoningEngine.js#L25-L55 | |
17,199 | ucbl/HyLAR-Reasoner | hylar/core/ReasoningEngine.js | function (FeAdd, FeDel, F, R) {
var Rdel = [], Rred = [], Rins = [],
FiDel = [], FiAdd = [],
FiDelNew = [], FiAddNew = [],
superSet = [],
additions, deletions,
Fe = Logics.getOnlyExplicitFacts(F),
Fi = Logics.getOnlyImplicitFacts(... | javascript | function (FeAdd, FeDel, F, R) {
var Rdel = [], Rred = [], Rins = [],
FiDel = [], FiAdd = [],
FiDelNew = [], FiAddNew = [],
superSet = [],
additions, deletions,
Fe = Logics.getOnlyExplicitFacts(F),
Fi = Logics.getOnlyImplicitFacts(... | [
"function",
"(",
"FeAdd",
",",
"FeDel",
",",
"F",
",",
"R",
")",
"{",
"var",
"Rdel",
"=",
"[",
"]",
",",
"Rred",
"=",
"[",
"]",
",",
"Rins",
"=",
"[",
"]",
",",
"FiDel",
"=",
"[",
"]",
",",
"FiAdd",
"=",
"[",
"]",
",",
"FiDelNew",
"=",
"[... | Incremental reasoning which avoids complete recalculation of facts.
Concat is preferred over merge for evaluation purposes.
@param R set of rules
@param F set of assertions
@param FeAdd set of assertions to be added
@param FeDel set of assertions to be deleted | [
"Incremental",
"reasoning",
"which",
"avoids",
"complete",
"recalculation",
"of",
"facts",
".",
"Concat",
"is",
"preferred",
"over",
"merge",
"for",
"evaluation",
"purposes",
"."
] | a66cd396de89cc2e1921b18f23ec9a8906313df2 | https://github.com/ucbl/HyLAR-Reasoner/blob/a66cd396de89cc2e1921b18f23ec9a8906313df2/hylar/core/ReasoningEngine.js#L65-L136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.