repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
levilindsey/physx
src/collisions/collision-detection/src/sphere-collision-detection.js
sphereVsPoint
function sphereVsPoint(sphere, point) { return vec3.squaredDistance(point, sphere.centerOfVolume) <= sphere.radius * sphere.radius; }
javascript
function sphereVsPoint(sphere, point) { return vec3.squaredDistance(point, sphere.centerOfVolume) <= sphere.radius * sphere.radius; }
[ "function", "sphereVsPoint", "(", "sphere", ",", "point", ")", "{", "return", "vec3", ".", "squaredDistance", "(", "point", ",", "sphere", ".", "centerOfVolume", ")", "<=", "sphere", ".", "radius", "*", "sphere", ".", "radius", ";", "}" ]
This module defines utility methods for detecting whether intersection has occurred between spheres and other shapes. @param {Sphere} sphere @param {vec3} point @returns {boolean}
[ "This", "module", "defines", "utility", "methods", "for", "detecting", "whether", "intersection", "has", "occurred", "between", "spheres", "and", "other", "shapes", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/collision-detection/src/sphere-collision-detection.js#L15-L17
train
joelcolucci/geolocation-distance-between
lib/index.js
_haversineCalculation
function _haversineCalculation(coordinateOne, coordinateTwo) { // Credits // https://www.movable-type.co.uk/scripts/latlong.html // https://en.wikipedia.org/wiki/Haversine_formula let latitudeOneRadians = _convertDegreesToRadians(coordinateOne.latitude); let latitudeTwoRadians = _convertDegreesToRadians(coordinateT...
javascript
function _haversineCalculation(coordinateOne, coordinateTwo) { // Credits // https://www.movable-type.co.uk/scripts/latlong.html // https://en.wikipedia.org/wiki/Haversine_formula let latitudeOneRadians = _convertDegreesToRadians(coordinateOne.latitude); let latitudeTwoRadians = _convertDegreesToRadians(coordinateT...
[ "function", "_haversineCalculation", "(", "coordinateOne", ",", "coordinateTwo", ")", "{", "// Credits", "// https://www.movable-type.co.uk/scripts/latlong.html", "// https://en.wikipedia.org/wiki/Haversine_formula", "let", "latitudeOneRadians", "=", "_convertDegreesToRadians", "(", ...
Return distance between two coordinates using Haversine formula @param {Object} coordinateOne Object containing latitude, and longitude keys @param {Object} coordinateTwo Object containing latitude, and longitude keys @return {Float}
[ "Return", "distance", "between", "two", "coordinates", "using", "Haversine", "formula" ]
8f5437c1a87176891febbee4dc06e51af73c7f8d
https://github.com/joelcolucci/geolocation-distance-between/blob/8f5437c1a87176891febbee4dc06e51af73c7f8d/lib/index.js#L19-L42
train
slideme/rorschach
lib/utils.js
join
function join(args) { var arg; var i = 0; var path = ''; if (arguments.length === 0) { return utils.sep; } while ((arg = arguments[i++])) { if (typeof arg !== 'string') { throw new TypeError('utils.join() expects string arguments'); } path += utils.sep + arg; } path = path.repl...
javascript
function join(args) { var arg; var i = 0; var path = ''; if (arguments.length === 0) { return utils.sep; } while ((arg = arguments[i++])) { if (typeof arg !== 'string') { throw new TypeError('utils.join() expects string arguments'); } path += utils.sep + arg; } path = path.repl...
[ "function", "join", "(", "args", ")", "{", "var", "arg", ";", "var", "i", "=", "0", ";", "var", "path", "=", "''", ";", "if", "(", "arguments", ".", "length", "===", "0", ")", "{", "return", "utils", ".", "sep", ";", "}", "while", "(", "(", "...
Join paths. @param {...String} args Paths @returns {String}
[ "Join", "paths", "." ]
899339baf31682f8a62b2960cdd26fbb58a9e3a1
https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/utils.js#L113-L135
train
wprl/wainwright
index.js
extractMetadata
function extractMetadata (content, callback) { var end; var result; var metadata = ''; var body = content; // Metadata is defined by either starting and ending line, if (content.slice(0, 3) === '---') { result = content.match(/^-{3,}\s([\s\S]*?)-{3,}(\s[\s\S]*|\s?)$/); if (result && result.length =...
javascript
function extractMetadata (content, callback) { var end; var result; var metadata = ''; var body = content; // Metadata is defined by either starting and ending line, if (content.slice(0, 3) === '---') { result = content.match(/^-{3,}\s([\s\S]*?)-{3,}(\s[\s\S]*|\s?)$/); if (result && result.length =...
[ "function", "extractMetadata", "(", "content", ",", "callback", ")", "{", "var", "end", ";", "var", "result", ";", "var", "metadata", "=", "''", ";", "var", "body", "=", "content", ";", "// Metadata is defined by either starting and ending line,", "if", "(", "co...
Also from the wintersmith markdown plugin.
[ "Also", "from", "the", "wintersmith", "markdown", "plugin", "." ]
4a87298d3f097e27acf741157fe0e0b495ff4df9
https://github.com/wprl/wainwright/blob/4a87298d3f097e27acf741157fe0e0b495ff4df9/index.js#L52-L82
train
romainhild/node-xmlrpc-socket
lib/client.js
Client
function Client(host, port) { // Invokes with new if called without if (false === (this instanceof Client)) { return new Client(host, port) } this.host = host; this.port = port; }
javascript
function Client(host, port) { // Invokes with new if called without if (false === (this instanceof Client)) { return new Client(host, port) } this.host = host; this.port = port; }
[ "function", "Client", "(", "host", ",", "port", ")", "{", "// Invokes with new if called without", "if", "(", "false", "===", "(", "this", "instanceof", "Client", ")", ")", "{", "return", "new", "Client", "(", "host", ",", "port", ")", "}", "this", ".", ...
Creates a Client object for making XML-RPC method calls via socket @constructor @param {String} host host to connect @param {Number} port port to connect @return {Client}
[ "Creates", "a", "Client", "object", "for", "making", "XML", "-", "RPC", "method", "calls", "via", "socket" ]
44a1112632a1db332bea3754c913609f05570d0a
https://github.com/romainhild/node-xmlrpc-socket/blob/44a1112632a1db332bea3754c913609f05570d0a/lib/client.js#L14-L22
train
UsabilityDynamics/node-wordpress-client
lib/wordpress-client.js
Client
function Client(settings, callback) { this.debug('new Client', settings.url); var self = this; // Mixing settings and emitter into instance. require('object-emitter').mixin(this); require('object-settings').mixin(this); // Set defaults and instance settings. this.set(Client.defaults).set(settings); /...
javascript
function Client(settings, callback) { this.debug('new Client', settings.url); var self = this; // Mixing settings and emitter into instance. require('object-emitter').mixin(this); require('object-settings').mixin(this); // Set defaults and instance settings. this.set(Client.defaults).set(settings); /...
[ "function", "Client", "(", "settings", ",", "callback", ")", "{", "this", ".", "debug", "(", "'new Client'", ",", "settings", ".", "url", ")", ";", "var", "self", "=", "this", ";", "// Mixing settings and emitter into instance.", "require", "(", "'object-emitter...
WordPress Client. @todo Add support for 30X redirect. ### Events * ready - Once client instance created. * connected - Once client instance created and list of supported methods is returned. * authenticated - Once client instance created and list of supported methods is returned. * error - Emi...
[ "WordPress", "Client", "." ]
2b47a7c5cadd3d8f2cfd255f997f36af14a5d843
https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/lib/wordpress-client.js#L30-L88
train
UsabilityDynamics/node-wordpress-client
lib/wordpress-client.js
onceReady
function onceReady(error, methods) { this.debug(error ? 'No methods (%d) found, unable to connect to %s.' : 'onceReady: Found %d methods on %s.', ( methods ? methods.length : 0 ), this.get('url')); // Set Methods. this.set('methods', this.common.trim(methods)); if (error) { this.emit('...
javascript
function onceReady(error, methods) { this.debug(error ? 'No methods (%d) found, unable to connect to %s.' : 'onceReady: Found %d methods on %s.', ( methods ? methods.length : 0 ), this.get('url')); // Set Methods. this.set('methods', this.common.trim(methods)); if (error) { this.emit('...
[ "function", "onceReady", "(", "error", ",", "methods", ")", "{", "this", ".", "debug", "(", "error", "?", "'No methods (%d) found, unable to connect to %s.'", ":", "'onceReady: Found %d methods on %s.'", ",", "(", "methods", "?", "methods", ".", "length", ":", "0", ...
Callback for Connection Verification. @param error @param methods @returns {*}
[ "Callback", "for", "Connection", "Verification", "." ]
2b47a7c5cadd3d8f2cfd255f997f36af14a5d843
https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/lib/wordpress-client.js#L103-L118
train
UsabilityDynamics/node-wordpress-client
lib/wordpress-client.js
callbackWrapper
function callbackWrapper(error, response) { self.debug('methodCall->callbackWrapper', error, response); // TODO: error should be customized to handle more error types if (error /*&& error.code === "ENOTFOUND" && error.syscall === "getaddrinfo"*/) { error.message = "Unable to connect to...
javascript
function callbackWrapper(error, response) { self.debug('methodCall->callbackWrapper', error, response); // TODO: error should be customized to handle more error types if (error /*&& error.code === "ENOTFOUND" && error.syscall === "getaddrinfo"*/) { error.message = "Unable to connect to...
[ "function", "callbackWrapper", "(", "error", ",", "response", ")", "{", "self", ".", "debug", "(", "'methodCall->callbackWrapper'", ",", "error", ",", "response", ")", ";", "// TODO: error should be customized to handle more error types", "if", "(", "error", "/*&& error...
Handle RPC Method Callback. @param {Error} error @param {string} response @returns {*}
[ "Handle", "RPC", "Method", "Callback", "." ]
2b47a7c5cadd3d8f2cfd255f997f36af14a5d843
https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/lib/wordpress-client.js#L193-L206
train
UsabilityDynamics/node-wordpress-client
lib/wordpress-client.js
nextTick
function nextTick(callback) { var context = this; var args = Array.prototype.slice.call(arguments, 1); // Do not schedule callback if not a valid function. if ('function' !== typeof callback) { return this; } // Execute callback on next tick. process.nextTick(functio...
javascript
function nextTick(callback) { var context = this; var args = Array.prototype.slice.call(arguments, 1); // Do not schedule callback if not a valid function. if ('function' !== typeof callback) { return this; } // Execute callback on next tick. process.nextTick(functio...
[ "function", "nextTick", "(", "callback", ")", "{", "var", "context", "=", "this", ";", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ";", "// Do not schedule callback if not a valid function.", "if",...
Call Method on Next Tick. @param callback @returns {*}
[ "Call", "Method", "on", "Next", "Tick", "." ]
2b47a7c5cadd3d8f2cfd255f997f36af14a5d843
https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/lib/wordpress-client.js#L435-L454
train
levilindsey/physx
src/collisions/contact-calculation/src/capsule-contact-calculation.js
capsuleVsSphere
function capsuleVsSphere(contactPoint, contactNormal, capsule, sphere) { const sphereCenter = sphere.centerOfVolume; findClosestPointOnSegmentToPoint(contactPoint, capsule.segment, sphereCenter); vec3.subtract(contactNormal, sphereCenter, contactPoint); vec3.normalize(contactNormal, contactNormal); vec3.scale...
javascript
function capsuleVsSphere(contactPoint, contactNormal, capsule, sphere) { const sphereCenter = sphere.centerOfVolume; findClosestPointOnSegmentToPoint(contactPoint, capsule.segment, sphereCenter); vec3.subtract(contactNormal, sphereCenter, contactPoint); vec3.normalize(contactNormal, contactNormal); vec3.scale...
[ "function", "capsuleVsSphere", "(", "contactPoint", ",", "contactNormal", ",", "capsule", ",", "sphere", ")", "{", "const", "sphereCenter", "=", "sphere", ".", "centerOfVolume", ";", "findClosestPointOnSegmentToPoint", "(", "contactPoint", ",", "capsule", ".", "segm...
Finds the closest point on the surface of the capsule to the sphere center. @param {vec3} contactPoint Output param. @param {vec3} contactNormal Output param. @param {Capsule} capsule @param {Sphere} sphere
[ "Finds", "the", "closest", "point", "on", "the", "surface", "of", "the", "capsule", "to", "the", "sphere", "center", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/contact-calculation/src/capsule-contact-calculation.js#L39-L45
train
levilindsey/physx
src/collisions/contact-calculation/src/capsule-contact-calculation.js
capsuleVsAabb
function capsuleVsAabb(contactPoint, contactNormal, capsule, aabb) { // tmpVec1 represents the closest point on the capsule to the AABB. tmpVec2 // represents the closest point on the AABB to the capsule. // // Check whether the two capsule ends intersect the AABB (sphere vs AABB) (addresses the // capsule-v...
javascript
function capsuleVsAabb(contactPoint, contactNormal, capsule, aabb) { // tmpVec1 represents the closest point on the capsule to the AABB. tmpVec2 // represents the closest point on the AABB to the capsule. // // Check whether the two capsule ends intersect the AABB (sphere vs AABB) (addresses the // capsule-v...
[ "function", "capsuleVsAabb", "(", "contactPoint", ",", "contactNormal", ",", "capsule", ",", "aabb", ")", "{", "// tmpVec1 represents the closest point on the capsule to the AABB. tmpVec2", "// represents the closest point on the AABB to the capsule.", "//", "// Check whether the two c...
Finds the closest point on the surface of the capsule to the AABB. NOTE: This implementation cheats by checking whether vertices from one shape lie within the other. Due to the tunnelling problem, it is possible that intersection occurs without any vertices lying within the other shape. However, (A) this is unlikely, ...
[ "Finds", "the", "closest", "point", "on", "the", "surface", "of", "the", "capsule", "to", "the", "AABB", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/contact-calculation/src/capsule-contact-calculation.js#L60-L103
train
levilindsey/physx
src/collisions/contact-calculation/src/capsule-contact-calculation.js
capsuleVsCapsule
function capsuleVsCapsule(contactPoint, contactNormal, capsuleA, capsuleB) { findClosestPointsFromSegmentToSegment(tmpVec1, tmpVec2, capsuleA.segment, capsuleB.segment); vec3.subtract(contactNormal, tmpVec2, tmpVec1); vec3.normalize(contactNormal, contactNormal); vec3.scaleAndAdd(contactPoint, tmpVec1, co...
javascript
function capsuleVsCapsule(contactPoint, contactNormal, capsuleA, capsuleB) { findClosestPointsFromSegmentToSegment(tmpVec1, tmpVec2, capsuleA.segment, capsuleB.segment); vec3.subtract(contactNormal, tmpVec2, tmpVec1); vec3.normalize(contactNormal, contactNormal); vec3.scaleAndAdd(contactPoint, tmpVec1, co...
[ "function", "capsuleVsCapsule", "(", "contactPoint", ",", "contactNormal", ",", "capsuleA", ",", "capsuleB", ")", "{", "findClosestPointsFromSegmentToSegment", "(", "tmpVec1", ",", "tmpVec2", ",", "capsuleA", ".", "segment", ",", "capsuleB", ".", "segment", ")", "...
Finds the closest point on the surface of capsule A to capsule B. @param {vec3} contactPoint Output param. @param {vec3} contactNormal Output param. @param {Capsule} capsuleA @param {Capsule} capsuleB
[ "Finds", "the", "closest", "point", "on", "the", "surface", "of", "capsule", "A", "to", "capsule", "B", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/contact-calculation/src/capsule-contact-calculation.js#L124-L130
train
GochoMugo/elbow
src/lib/index.js
loadSchema
function loadSchema(uri) { return new Promise(function(resolve, reject) { request.get(uri).end(function(error, response) { if (error || !response.ok) { error = error || new Error(response.body); debug("error fetching remote schema:", error); return reject(error); } return...
javascript
function loadSchema(uri) { return new Promise(function(resolve, reject) { request.get(uri).end(function(error, response) { if (error || !response.ok) { error = error || new Error(response.body); debug("error fetching remote schema:", error); return reject(error); } return...
[ "function", "loadSchema", "(", "uri", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "request", ".", "get", "(", "uri", ")", ".", "end", "(", "function", "(", "error", ",", "response", ")", "{", "if", ...
Loads schema from remote server using a HTTP URI. @private @param {String} uri - HTTP URI to schema @return {Promise} @see https://github.com/epoberezkin/ajv#asynchronous-schema-compilation
[ "Loads", "schema", "from", "remote", "server", "using", "a", "HTTP", "URI", "." ]
2211c50c6019dc45acb192e07f765ab0daabe3cd
https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L44-L55
train
GochoMugo/elbow
src/lib/index.js
requireAll
function requireAll(schemaDir, options, callback) { debug("loading schemas"); if (!callback) { callback = options; options = {}; } const opts = _.assign({ extensions: ["json"], }, options); let files; try { files = fs.readdirSync(schemaDir); } catch(errReaddir) { return callback(err...
javascript
function requireAll(schemaDir, options, callback) { debug("loading schemas"); if (!callback) { callback = options; options = {}; } const opts = _.assign({ extensions: ["json"], }, options); let files; try { files = fs.readdirSync(schemaDir); } catch(errReaddir) { return callback(err...
[ "function", "requireAll", "(", "schemaDir", ",", "options", ",", "callback", ")", "{", "debug", "(", "\"loading schemas\"", ")", ";", "if", "(", "!", "callback", ")", "{", "callback", "=", "options", ";", "options", "=", "{", "}", ";", "}", "const", "o...
Loads all the Schemas into memory. @param {String} schemaDir - path to directory holding schemas @param {Object} [options] @param {String[]} [options.extensions=["json"]] Extension of schema files @param {Function} callback - callback(err, schemas)
[ "Loads", "all", "the", "Schemas", "into", "memory", "." ]
2211c50c6019dc45acb192e07f765ab0daabe3cd
https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L66-L108
train
GochoMugo/elbow
src/lib/index.js
expandVars
function expandVars(target, options) { const vars = options.vars || {}; const regexp = /\$\{(\w+)\}/g; if (typeof target === "string") { return _expand(target); } for (let key in target) { target[key] = _expand(target[key]); } return target; function _expand(val) { let expanded = val; ...
javascript
function expandVars(target, options) { const vars = options.vars || {}; const regexp = /\$\{(\w+)\}/g; if (typeof target === "string") { return _expand(target); } for (let key in target) { target[key] = _expand(target[key]); } return target; function _expand(val) { let expanded = val; ...
[ "function", "expandVars", "(", "target", ",", "options", ")", "{", "const", "vars", "=", "options", ".", "vars", "||", "{", "}", ";", "const", "regexp", "=", "/", "\\$\\{(\\w+)\\}", "/", "g", ";", "if", "(", "typeof", "target", "===", "\"string\"", ")"...
Expand variables, using variables from the `options` object, or process environment. Modifies the passed object in place. @private @param {String|Object} target - object with parameters @param {Object} options - test configurations @return {String|Object}
[ "Expand", "variables", "using", "variables", "from", "the", "options", "object", "or", "process", "environment", ".", "Modifies", "the", "passed", "object", "in", "place", "." ]
2211c50c6019dc45acb192e07f765ab0daabe3cd
https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L183-L210
train
GochoMugo/elbow
src/lib/index.js
validateResponse
function validateResponse(schema, response, options, done) { debug(`validating response for ${schema.endpoint}`); // testing status code if (schema.status) { should(response.status).eql(schema.status); } return validator.compileAsync(schema).then((validate) => { const valid = validate(response.body); ...
javascript
function validateResponse(schema, response, options, done) { debug(`validating response for ${schema.endpoint}`); // testing status code if (schema.status) { should(response.status).eql(schema.status); } return validator.compileAsync(schema).then((validate) => { const valid = validate(response.body); ...
[ "function", "validateResponse", "(", "schema", ",", "response", ",", "options", ",", "done", ")", "{", "debug", "(", "`", "${", "schema", ".", "endpoint", "}", "`", ")", ";", "// testing status code", "if", "(", "schema", ".", "status", ")", "{", "should...
Validate a Http response using schema. This handles the actual JSON schema validation. @private @param {Object} schema - schema used to validate against @param {*} response - http response @param {Object} options - test configurations @param {Function} done - called once validation is completed @TODO Remove our "...
[ "Validate", "a", "Http", "response", "using", "schema", ".", "This", "handles", "the", "actual", "JSON", "schema", "validation", "." ]
2211c50c6019dc45acb192e07f765ab0daabe3cd
https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L226-L249
train
GochoMugo/elbow
src/lib/index.js
makeRequest
function makeRequest(baseUrl, method, schema, options, done) { debug(`making ${method.toUpperCase()} request to ${schema.endpoint}`); const endpoint = expandVars(schema.endpoint, options); const apiPath = url.resolve(baseUrl + "/", _.trimStart(endpoint, "/")); const headers = Object.assign({}, options.headers, ...
javascript
function makeRequest(baseUrl, method, schema, options, done) { debug(`making ${method.toUpperCase()} request to ${schema.endpoint}`); const endpoint = expandVars(schema.endpoint, options); const apiPath = url.resolve(baseUrl + "/", _.trimStart(endpoint, "/")); const headers = Object.assign({}, options.headers, ...
[ "function", "makeRequest", "(", "baseUrl", ",", "method", ",", "schema", ",", "options", ",", "done", ")", "{", "debug", "(", "`", "${", "method", ".", "toUpperCase", "(", ")", "}", "${", "schema", ".", "endpoint", "}", "`", ")", ";", "const", "endpo...
Make a HTTP request against the remote server and validate the response. @private @param {String} baseUrl - base url e.g. "http://localhost:9090/" @param {String} method - http method to use for request e.g. "get" @param {Object} schema - schema used to validate response @param {Object} options - test configuratio...
[ "Make", "a", "HTTP", "request", "against", "the", "remote", "server", "and", "validate", "the", "response", "." ]
2211c50c6019dc45acb192e07f765ab0daabe3cd
https://github.com/GochoMugo/elbow/blob/2211c50c6019dc45acb192e07f765ab0daabe3cd/src/lib/index.js#L263-L302
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/domiterator/plugin.js
getNextSourceNode
function getNextSourceNode( node, startFromSibling, lastNode ) { var next = node.getNextSourceNode( startFromSibling, null, lastNode ); while ( !bookmarkGuard( next ) ) next = next.getNextSourceNode( startFromSibling, null, lastNode ); return next; }
javascript
function getNextSourceNode( node, startFromSibling, lastNode ) { var next = node.getNextSourceNode( startFromSibling, null, lastNode ); while ( !bookmarkGuard( next ) ) next = next.getNextSourceNode( startFromSibling, null, lastNode ); return next; }
[ "function", "getNextSourceNode", "(", "node", ",", "startFromSibling", ",", "lastNode", ")", "{", "var", "next", "=", "node", ".", "getNextSourceNode", "(", "startFromSibling", ",", "null", ",", "lastNode", ")", ";", "while", "(", "!", "bookmarkGuard", "(", ...
Get a reference for the next element, bookmark nodes are skipped.
[ "Get", "a", "reference", "for", "the", "next", "element", "bookmark", "nodes", "are", "skipped", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/domiterator/plugin.js#L39-L45
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/dom/domobject.js
function( domObject, eventName ) { return function( domEvent ) { // In FF, when reloading the page with the editor focused, it may // throw an error because the CKEDITOR global is not anymore // available. So, we check it here first. (#2923) if ( typeof CKEDITOR != 'undefined' ) domObject.f...
javascript
function( domObject, eventName ) { return function( domEvent ) { // In FF, when reloading the page with the editor focused, it may // throw an error because the CKEDITOR global is not anymore // available. So, we check it here first. (#2923) if ( typeof CKEDITOR != 'undefined' ) domObject.f...
[ "function", "(", "domObject", ",", "eventName", ")", "{", "return", "function", "(", "domEvent", ")", "{", "// In FF, when reloading the page with the editor focused, it may\r", "// throw an error because the CKEDITOR global is not anymore\r", "// available. So, we check it here first....
Do not define other local variables here. We want to keep the native listener closures as clean as possible.
[ "Do", "not", "define", "other", "local", "variables", "here", ".", "We", "want", "to", "keep", "the", "native", "listener", "closures", "as", "clean", "as", "possible", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/domobject.js#L40-L50
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/dom/domobject.js
function() { var nativeListeners = this.getCustomData( '_cke_nativeListeners' ); for ( var eventName in nativeListeners ) { var listener = nativeListeners[ eventName ]; if ( this.$.detachEvent ) this.$.detachEvent( 'on' + eventName, listener ); else if ( this.$.removeEventListener ) ...
javascript
function() { var nativeListeners = this.getCustomData( '_cke_nativeListeners' ); for ( var eventName in nativeListeners ) { var listener = nativeListeners[ eventName ]; if ( this.$.detachEvent ) this.$.detachEvent( 'on' + eventName, listener ); else if ( this.$.removeEventListener ) ...
[ "function", "(", ")", "{", "var", "nativeListeners", "=", "this", ".", "getCustomData", "(", "'_cke_nativeListeners'", ")", ";", "for", "(", "var", "eventName", "in", "nativeListeners", ")", "{", "var", "listener", "=", "nativeListeners", "[", "eventName", "]"...
Removes any listener set on this object. To avoid memory leaks we must assure that there are no references left after the object is no longer needed.
[ "Removes", "any", "listener", "set", "on", "this", "object", ".", "To", "avoid", "memory", "leaks", "we", "must", "assure", "that", "there", "are", "no", "references", "left", "after", "the", "object", "is", "no", "longer", "needed", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/domobject.js#L125-L138
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/lang.js
function( languageCode, defaultLanguage, callback ) { // If no languageCode - fallback to browser or default. // If languageCode - fallback to no-localized version or default. if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] ) languageCode = this.detect( defaultLanguage, languageCode )...
javascript
function( languageCode, defaultLanguage, callback ) { // If no languageCode - fallback to browser or default. // If languageCode - fallback to no-localized version or default. if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] ) languageCode = this.detect( defaultLanguage, languageCode )...
[ "function", "(", "languageCode", ",", "defaultLanguage", ",", "callback", ")", "{", "// If no languageCode - fallback to browser or default.\r", "// If languageCode - fallback to no-localized version or default.\r", "if", "(", "!", "languageCode", "||", "!", "CKEDITOR", ".", "l...
Loads a specific language file, or auto detect it. A callback is then called when the file gets loaded. @param {String} languageCode The code of the language file to be loaded. If null or empty, autodetection will be performed. The same happens if the language is not supported. @param {String} defaultLanguage The langu...
[ "Loads", "a", "specific", "language", "file", "or", "auto", "detect", "it", ".", "A", "callback", "is", "then", "called", "when", "the", "file", "gets", "loaded", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/lang.js#L97-L117
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/lang.js
function( defaultLanguage, probeLanguage ) { var languages = this.languages; probeLanguage = probeLanguage || navigator.userLanguage || navigator.language || defaultLanguage; var parts = probeLanguage .toLowerCase() .match( /([a-z]+)(?:-([a-z]+))?/ ), lang = parts[1], locale = par...
javascript
function( defaultLanguage, probeLanguage ) { var languages = this.languages; probeLanguage = probeLanguage || navigator.userLanguage || navigator.language || defaultLanguage; var parts = probeLanguage .toLowerCase() .match( /([a-z]+)(?:-([a-z]+))?/ ), lang = parts[1], locale = par...
[ "function", "(", "defaultLanguage", ",", "probeLanguage", ")", "{", "var", "languages", "=", "this", ".", "languages", ";", "probeLanguage", "=", "probeLanguage", "||", "navigator", ".", "userLanguage", "||", "navigator", ".", "language", "||", "defaultLanguage", ...
Returns the language that best fit the user language. For example, suppose that the user language is "pt-br". If this language is supported by the editor, it is returned. Otherwise, if only "pt" is supported, it is returned instead. If none of the previous are supported, a default language is then returned. @param {Str...
[ "Returns", "the", "language", "that", "best", "fit", "the", "user", "language", ".", "For", "example", "suppose", "that", "the", "user", "language", "is", "pt", "-", "br", ".", "If", "this", "language", "is", "supported", "by", "the", "editor", "it", "is...
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/lang.js#L133-L154
train
ForbesLindesay/stop
lib/favicon.js
addFavicons
function addFavicons() { var stream = new Transform({objectMode: true, highWaterMark: 2}); var hosts = {}; var downloads = []; stream._transform = function (page, _, callback) { stream.push(page); var host = url.parse(page.url).host; if (!hosts[host]) { downloads.push(hosts[host] = download(u...
javascript
function addFavicons() { var stream = new Transform({objectMode: true, highWaterMark: 2}); var hosts = {}; var downloads = []; stream._transform = function (page, _, callback) { stream.push(page); var host = url.parse(page.url).host; if (!hosts[host]) { downloads.push(hosts[host] = download(u...
[ "function", "addFavicons", "(", ")", "{", "var", "stream", "=", "new", "Transform", "(", "{", "objectMode", ":", "true", ",", "highWaterMark", ":", "2", "}", ")", ";", "var", "hosts", "=", "{", "}", ";", "var", "downloads", "=", "[", "]", ";", "str...
Look for favicons and add them to the stream if they exist @returns {TransformStream}
[ "Look", "for", "favicons", "and", "add", "them", "to", "the", "stream", "if", "they", "exist" ]
61db8899bdde604dc45cfc8f11fffa1beaa27abb
https://github.com/ForbesLindesay/stop/blob/61db8899bdde604dc45cfc8f11fffa1beaa27abb/lib/favicon.js#L15-L46
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/styles/plugin.js
function( elementPath ) { switch ( this.type ) { case CKEDITOR.STYLE_BLOCK : return this.checkElementRemovable( elementPath.block || elementPath.blockLimit, true ); case CKEDITOR.STYLE_OBJECT : case CKEDITOR.STYLE_INLINE : var elements = elementPath.elements; for ( var ...
javascript
function( elementPath ) { switch ( this.type ) { case CKEDITOR.STYLE_BLOCK : return this.checkElementRemovable( elementPath.block || elementPath.blockLimit, true ); case CKEDITOR.STYLE_OBJECT : case CKEDITOR.STYLE_INLINE : var elements = elementPath.elements; for ( var ...
[ "function", "(", "elementPath", ")", "{", "switch", "(", "this", ".", "type", ")", "{", "case", "CKEDITOR", ".", "STYLE_BLOCK", ":", "return", "this", ".", "checkElementRemovable", "(", "elementPath", ".", "block", "||", "elementPath", ".", "blockLimit", ","...
Get the style state inside an element path. Returns "true" if the element is active in the path.
[ "Get", "the", "style", "state", "inside", "an", "element", "path", ".", "Returns", "true", "if", "the", "element", "is", "active", "in", "the", "path", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L168-L200
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/styles/plugin.js
function( elementPath ) { switch ( this.type ) { case CKEDITOR.STYLE_INLINE : case CKEDITOR.STYLE_BLOCK : break; case CKEDITOR.STYLE_OBJECT : return elementPath.lastElement.getAscendant( this.element, true ); } return true; }
javascript
function( elementPath ) { switch ( this.type ) { case CKEDITOR.STYLE_INLINE : case CKEDITOR.STYLE_BLOCK : break; case CKEDITOR.STYLE_OBJECT : return elementPath.lastElement.getAscendant( this.element, true ); } return true; }
[ "function", "(", "elementPath", ")", "{", "switch", "(", "this", ".", "type", ")", "{", "case", "CKEDITOR", ".", "STYLE_INLINE", ":", "case", "CKEDITOR", ".", "STYLE_BLOCK", ":", "break", ";", "case", "CKEDITOR", ".", "STYLE_OBJECT", ":", "return", "elemen...
Whether this style can be applied at the element path. @param elementPath
[ "Whether", "this", "style", "can", "be", "applied", "at", "the", "element", "path", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L206-L219
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/styles/plugin.js
function( label ) { var styleDefinition = this._.definition, html = [], elementName = styleDefinition.element; // Avoid <bdo> in the preview. if ( elementName == 'bdo' ) elementName = 'span'; html = [ '<', elementName ]; // Assign all defined attributes. var attribs = sty...
javascript
function( label ) { var styleDefinition = this._.definition, html = [], elementName = styleDefinition.element; // Avoid <bdo> in the preview. if ( elementName == 'bdo' ) elementName = 'span'; html = [ '<', elementName ]; // Assign all defined attributes. var attribs = sty...
[ "function", "(", "label", ")", "{", "var", "styleDefinition", "=", "this", ".", "_", ".", "definition", ",", "html", "=", "[", "]", ",", "elementName", "=", "styleDefinition", ".", "element", ";", "// Avoid <bdo> in the preview.\r", "if", "(", "elementName", ...
Builds the preview HTML based on the styles definition.
[ "Builds", "the", "preview", "HTML", "based", "on", "the", "styles", "definition", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L302-L332
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/styles/plugin.js
removeFromInsideElement
function removeFromInsideElement( style, element ) { var def = style._.definition, attribs = def.attributes, styles = def.styles, overrides = getOverrides( style ), innerElements = element.getElementsByTag( style.element ); for ( var i = innerElements.count(); --i >= 0 ; ) removeFromElemen...
javascript
function removeFromInsideElement( style, element ) { var def = style._.definition, attribs = def.attributes, styles = def.styles, overrides = getOverrides( style ), innerElements = element.getElementsByTag( style.element ); for ( var i = innerElements.count(); --i >= 0 ; ) removeFromElemen...
[ "function", "removeFromInsideElement", "(", "style", ",", "element", ")", "{", "var", "def", "=", "style", ".", "_", ".", "definition", ",", "attribs", "=", "def", ".", "attributes", ",", "styles", "=", "def", ".", "styles", ",", "overrides", "=", "getOv...
Removes a style from inside an element.
[ "Removes", "a", "style", "from", "inside", "an", "element", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1171-L1196
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/styles/plugin.js
removeNoAttribsElement
function removeNoAttribsElement( element ) { // If no more attributes remained in the element, remove it, // leaving its children. if ( !element.hasAttributes() ) { if ( CKEDITOR.dtd.$block[ element.getName() ] ) { var previous = element.getPrevious( nonWhitespaces ), next = element.ge...
javascript
function removeNoAttribsElement( element ) { // If no more attributes remained in the element, remove it, // leaving its children. if ( !element.hasAttributes() ) { if ( CKEDITOR.dtd.$block[ element.getName() ] ) { var previous = element.getPrevious( nonWhitespaces ), next = element.ge...
[ "function", "removeNoAttribsElement", "(", "element", ")", "{", "// If no more attributes remained in the element, remove it,\r", "// leaving its children.\r", "if", "(", "!", "element", ".", "hasAttributes", "(", ")", ")", "{", "if", "(", "CKEDITOR", ".", "dtd", ".", ...
If the element has no more attributes, remove it.
[ "If", "the", "element", "has", "no", "more", "attributes", "remove", "it", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1236-L1275
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/styles/plugin.js
getOverrides
function getOverrides( style ) { if ( style._.overrides ) return style._.overrides; var overrides = ( style._.overrides = {} ), definition = style._.definition.overrides; if ( definition ) { // The override description can be a string, object or array. // Internally, well handle arrays...
javascript
function getOverrides( style ) { if ( style._.overrides ) return style._.overrides; var overrides = ( style._.overrides = {} ), definition = style._.definition.overrides; if ( definition ) { // The override description can be a string, object or array. // Internally, well handle arrays...
[ "function", "getOverrides", "(", "style", ")", "{", "if", "(", "style", ".", "_", ".", "overrides", ")", "return", "style", ".", "_", ".", "overrides", ";", "var", "overrides", "=", "(", "style", ".", "_", ".", "overrides", "=", "{", "}", ")", ",",...
Get the the collection used to compare the elements and attributes, defined in this style overrides, with other element. All information in it is lowercased. @param {CKEDITOR.style} style
[ "Get", "the", "the", "collection", "used", "to", "compare", "the", "elements", "and", "attributes", "defined", "in", "this", "style", "overrides", "with", "other", "element", ".", "All", "information", "in", "it", "is", "lowercased", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1385-L1441
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/styles/plugin.js
normalizeProperty
function normalizeProperty( name, value, isStyle ) { var temp = new CKEDITOR.dom.element( 'span' ); temp [ isStyle ? 'setStyle' : 'setAttribute' ]( name, value ); return temp[ isStyle ? 'getStyle' : 'getAttribute' ]( name ); }
javascript
function normalizeProperty( name, value, isStyle ) { var temp = new CKEDITOR.dom.element( 'span' ); temp [ isStyle ? 'setStyle' : 'setAttribute' ]( name, value ); return temp[ isStyle ? 'getStyle' : 'getAttribute' ]( name ); }
[ "function", "normalizeProperty", "(", "name", ",", "value", ",", "isStyle", ")", "{", "var", "temp", "=", "new", "CKEDITOR", ".", "dom", ".", "element", "(", "'span'", ")", ";", "temp", "[", "isStyle", "?", "'setStyle'", ":", "'setAttribute'", "]", "(", ...
Make the comparison of attribute value easier by standardizing it.
[ "Make", "the", "comparison", "of", "attribute", "value", "easier", "by", "standardizing", "it", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1444-L1449
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/styles/plugin.js
normalizeCssText
function normalizeCssText( unparsedCssText, nativeNormalize ) { var styleText; if ( nativeNormalize !== false ) { // Injects the style in a temporary span object, so the browser parses it, // retrieving its final format. var temp = new CKEDITOR.dom.element( 'span' ); temp.setAttribute( 'style...
javascript
function normalizeCssText( unparsedCssText, nativeNormalize ) { var styleText; if ( nativeNormalize !== false ) { // Injects the style in a temporary span object, so the browser parses it, // retrieving its final format. var temp = new CKEDITOR.dom.element( 'span' ); temp.setAttribute( 'style...
[ "function", "normalizeCssText", "(", "unparsedCssText", ",", "nativeNormalize", ")", "{", "var", "styleText", ";", "if", "(", "nativeNormalize", "!==", "false", ")", "{", "// Injects the style in a temporary span object, so the browser parses it,\r", "// retrieving its final fo...
Make the comparison of style text easier by standardizing it.
[ "Make", "the", "comparison", "of", "style", "text", "easier", "by", "standardizing", "it", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1452-L1486
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/styles/plugin.js
parseStyleText
function parseStyleText( styleText ) { var retval = {}; styleText .replace( /&quot;/g, '"' ) .replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value ) { retval[ name ] = value; } ); return retval; }
javascript
function parseStyleText( styleText ) { var retval = {}; styleText .replace( /&quot;/g, '"' ) .replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value ) { retval[ name ] = value; } ); return retval; }
[ "function", "parseStyleText", "(", "styleText", ")", "{", "var", "retval", "=", "{", "}", ";", "styleText", ".", "replace", "(", "/", "&quot;", "/", "g", ",", "'\"'", ")", ".", "replace", "(", "/", "\\s*([^ :;]+)\\s*:\\s*([^;]+)\\s*(?=;|$)", "/", "g", ",",...
Turn inline style text properties into one hash.
[ "Turn", "inline", "style", "text", "properties", "into", "one", "hash", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/styles/plugin.js#L1489-L1499
train
Pegase745/node-gandi
src/gandi.js
defaultApikey
function defaultApikey(apikey) { if (typeof apikey !== 'undefined') { if (typeof apikey !== 'string') { throw new TypeError('`apikey` argument must be a string'); } if (apikey.length !== 24) { throw new TypeError('`apikey` argument must be 24 characters long'); ...
javascript
function defaultApikey(apikey) { if (typeof apikey !== 'undefined') { if (typeof apikey !== 'string') { throw new TypeError('`apikey` argument must be a string'); } if (apikey.length !== 24) { throw new TypeError('`apikey` argument must be 24 characters long'); ...
[ "function", "defaultApikey", "(", "apikey", ")", "{", "if", "(", "typeof", "apikey", "!==", "'undefined'", ")", "{", "if", "(", "typeof", "apikey", "!==", "'string'", ")", "{", "throw", "new", "TypeError", "(", "'`apikey` argument must be a string'", ")", ";",...
Returns apikey to constructor after some validation. @param {string} apikey - Apikey passed onto the constructor. @private
[ "Returns", "apikey", "to", "constructor", "after", "some", "validation", "." ]
86566ffa092bb2e16d3d819c244b2be97d62582e
https://github.com/Pegase745/node-gandi/blob/86566ffa092bb2e16d3d819c244b2be97d62582e/src/gandi.js#L23-L36
train
Sobesednik/exiftool-context
src/ExiftoolContext.js
makeTempFile
function makeTempFile() { const n = Math.floor(Math.random() * 100000) const tempFile = path.join(os.tmpdir(), `node-exiftool_test_${n}.jpg`) return new Promise((resolve, reject) => { const rs = fs.createReadStream(jpegFile) const ws = fs.createWriteStream(tempFile) rs.on('error', re...
javascript
function makeTempFile() { const n = Math.floor(Math.random() * 100000) const tempFile = path.join(os.tmpdir(), `node-exiftool_test_${n}.jpg`) return new Promise((resolve, reject) => { const rs = fs.createReadStream(jpegFile) const ws = fs.createWriteStream(tempFile) rs.on('error', re...
[ "function", "makeTempFile", "(", ")", "{", "const", "n", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "100000", ")", "const", "tempFile", "=", "path", ".", "join", "(", "os", ".", "tmpdir", "(", ")", ",", "`", "${", "n", ...
create temp file for writing metadata
[ "create", "temp", "file", "for", "writing", "metadata" ]
a6c44d2fd146898fae894ac08c1d381b4a969e2e
https://github.com/Sobesednik/exiftool-context/blob/a6c44d2fd146898fae894ac08c1d381b4a969e2e/src/ExiftoolContext.js#L42-L55
train
ghornich/sort-paths
sort-paths.js
sortPaths
function sortPaths(items/* , [iteratee, ] dirSeparator */) { assert(arguments.length >= 2, 'too few arguments'); assert(arguments.length <= 3, 'too many arguments'); var iteratee, dirSeparator; if (arguments.length === 2) { iteratee = identity; dirSeparator = arguments[1]; } el...
javascript
function sortPaths(items/* , [iteratee, ] dirSeparator */) { assert(arguments.length >= 2, 'too few arguments'); assert(arguments.length <= 3, 'too many arguments'); var iteratee, dirSeparator; if (arguments.length === 2) { iteratee = identity; dirSeparator = arguments[1]; } el...
[ "function", "sortPaths", "(", "items", "/* , [iteratee, ] dirSeparator */", ")", "{", "assert", "(", "arguments", ".", "length", ">=", "2", ",", "'too few arguments'", ")", ";", "assert", "(", "arguments", ".", "length", "<=", "3", ",", "'too many arguments'", "...
Allows sorting arbitrary items without modifying or copying them @typedef {Object} itemDTO @param {String|Object} item - original item @param {Array} pathTokens - split path tokens. Extracted from `item` using `iteratee` and split using `splitRetain`
[ "Allows", "sorting", "arbitrary", "items", "without", "modifying", "or", "copying", "them" ]
3b8b86f26319748c8d429980145099ad8bb71b8e
https://github.com/ghornich/sort-paths/blob/3b8b86f26319748c8d429980145099ad8bb71b8e/sort-paths.js#L17-L56
train
fvsch/gulp-task-maker
state.js
setOptions
function setOptions(input) { if (!isObject(input)) { throw new Error('gtm.conf method expects a config object') } for (const key of ['debug', 'notify', 'parallel', 'strict']) { const value = input[key] if (typeof value === 'boolean') options[key] = value else if (value != null) options[key] = strT...
javascript
function setOptions(input) { if (!isObject(input)) { throw new Error('gtm.conf method expects a config object') } for (const key of ['debug', 'notify', 'parallel', 'strict']) { const value = input[key] if (typeof value === 'boolean') options[key] = value else if (value != null) options[key] = strT...
[ "function", "setOptions", "(", "input", ")", "{", "if", "(", "!", "isObject", "(", "input", ")", ")", "{", "throw", "new", "Error", "(", "'gtm.conf method expects a config object'", ")", "}", "for", "(", "const", "key", "of", "[", "'debug'", ",", "'notify'...
Override default gulp-task-maker options @param {object} [input] - options, or undefined to return the current config @property {string|boolean|number} [input.notify] @property {string|boolean|number} [input.strict] @property {object} [input.prefix] @property {object} [input.groups] @return {object}
[ "Override", "default", "gulp", "-", "task", "-", "maker", "options" ]
20ab4245f2d75174786ad140793e9438c025d546
https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/state.js#L38-L64
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/bidi/plugin.js
getElementForDirection
function getElementForDirection( node ) { while ( node && !( node.getName() in allGuardElements || node.is( 'body' ) ) ) { var parent = node.getParent(); if ( !parent ) break; node = parent; } return node; }
javascript
function getElementForDirection( node ) { while ( node && !( node.getName() in allGuardElements || node.is( 'body' ) ) ) { var parent = node.getParent(); if ( !parent ) break; node = parent; } return node; }
[ "function", "getElementForDirection", "(", "node", ")", "{", "while", "(", "node", "&&", "!", "(", "node", ".", "getName", "(", ")", "in", "allGuardElements", "||", "node", ".", "is", "(", "'body'", ")", ")", ")", "{", "var", "parent", "=", "node", "...
Returns element with possibility of applying the direction. @param node
[ "Returns", "element", "with", "possibility", "of", "applying", "the", "direction", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/bidi/plugin.js#L70-L82
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/autogrow/plugin.js
contentHeight
function contentHeight( scrollable ) { var overflowY = scrollable.getStyle( 'overflow-y' ); var doc = scrollable.getDocument(); // Create a temporary marker element. var marker = CKEDITOR.dom.element.createFromHtml( '<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;...
javascript
function contentHeight( scrollable ) { var overflowY = scrollable.getStyle( 'overflow-y' ); var doc = scrollable.getDocument(); // Create a temporary marker element. var marker = CKEDITOR.dom.element.createFromHtml( '<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;...
[ "function", "contentHeight", "(", "scrollable", ")", "{", "var", "overflowY", "=", "scrollable", ".", "getStyle", "(", "'overflow-y'", ")", ";", "var", "doc", "=", "scrollable", ".", "getDocument", "(", ")", ";", "// Create a temporary marker element.\r", "var", ...
Actual content height, figured out by appending check the last element's document position.
[ "Actual", "content", "height", "figured", "out", "by", "appending", "check", "the", "last", "element", "s", "document", "position", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/autogrow/plugin.js#L12-L25
train
twolfson/value-mapper
lib/value-mapper.js
ValueMapper
function ValueMapper(input, options) { // Save input for later this.input = input; // Save placeholder middlewares this.middlewares = []; // Fallback options options = options || {}; // Add each of the middlewares var middlewares = options.middlewares || []; middlewares.forEach(this.addMiddleware, ...
javascript
function ValueMapper(input, options) { // Save input for later this.input = input; // Save placeholder middlewares this.middlewares = []; // Fallback options options = options || {}; // Add each of the middlewares var middlewares = options.middlewares || []; middlewares.forEach(this.addMiddleware, ...
[ "function", "ValueMapper", "(", "input", ",", "options", ")", "{", "// Save input for later", "this", ".", "input", "=", "input", ";", "// Save placeholder middlewares", "this", ".", "middlewares", "=", "[", "]", ";", "// Fallback options", "options", "=", "option...
Constructor for mapping values @param {Object} input Key-value pairs to map values across @param {Object} [options] Flags to adjust how the mapping is performed @param {Function[]} [options.middlewares] Middlewares to process resolved value through
[ "Constructor", "for", "mapping", "values" ]
956cfa193e02b6c4ae0e607b14eea41a15b7331d
https://github.com/twolfson/value-mapper/blob/956cfa193e02b6c4ae0e607b14eea41a15b7331d/lib/value-mapper.js#L13-L26
train
twolfson/value-mapper
lib/value-mapper.js
function (key) { // Assume the middleware is a function var middleware = key; // If the middleware is a string if (typeof middleware === 'string') { // Look it up and assert it was found middleware = MIDDLEWARES[key]; assert(middleware, 'value-mapper middleware "' + key + '" could not...
javascript
function (key) { // Assume the middleware is a function var middleware = key; // If the middleware is a string if (typeof middleware === 'string') { // Look it up and assert it was found middleware = MIDDLEWARES[key]; assert(middleware, 'value-mapper middleware "' + key + '" could not...
[ "function", "(", "key", ")", "{", "// Assume the middleware is a function", "var", "middleware", "=", "key", ";", "// If the middleware is a string", "if", "(", "typeof", "middleware", "===", "'string'", ")", "{", "// Look it up and assert it was found", "middleware", "="...
Add middleware to instance
[ "Add", "middleware", "to", "instance" ]
956cfa193e02b6c4ae0e607b14eea41a15b7331d
https://github.com/twolfson/value-mapper/blob/956cfa193e02b6c4ae0e607b14eea41a15b7331d/lib/value-mapper.js#L29-L42
train
twolfson/value-mapper
lib/value-mapper.js
function (val) { // Keep track of aliases used var aliasesUsed = [], aliasesNotFound = [], that = this; // Map the value through the middlewares var middlewares = this.middlewares; middlewares.forEach(function mapMiddlewareValue (fn) { // Process the value through middleware ...
javascript
function (val) { // Keep track of aliases used var aliasesUsed = [], aliasesNotFound = [], that = this; // Map the value through the middlewares var middlewares = this.middlewares; middlewares.forEach(function mapMiddlewareValue (fn) { // Process the value through middleware ...
[ "function", "(", "val", ")", "{", "// Keep track of aliases used", "var", "aliasesUsed", "=", "[", "]", ",", "aliasesNotFound", "=", "[", "]", ",", "that", "=", "this", ";", "// Map the value through the middlewares", "var", "middlewares", "=", "this", ".", "mid...
Resolve values of values via middleware
[ "Resolve", "values", "of", "values", "via", "middleware" ]
956cfa193e02b6c4ae0e607b14eea41a15b7331d
https://github.com/twolfson/value-mapper/blob/956cfa193e02b6c4ae0e607b14eea41a15b7331d/lib/value-mapper.js#L45-L69
train
twolfson/value-mapper
lib/value-mapper.js
function (key) { // Look up the normal value var val = this.input[key]; // Save the key for reference var _key = this.key; this.key = key; // Map our value through the middlewares val = this.process(val); // Restore the original key this.key = _key; // Return the value re...
javascript
function (key) { // Look up the normal value var val = this.input[key]; // Save the key for reference var _key = this.key; this.key = key; // Map our value through the middlewares val = this.process(val); // Restore the original key this.key = _key; // Return the value re...
[ "function", "(", "key", ")", "{", "// Look up the normal value", "var", "val", "=", "this", ".", "input", "[", "key", "]", ";", "// Save the key for reference", "var", "_key", "=", "this", ".", "key", ";", "this", ".", "key", "=", "key", ";", "// Map our v...
Resolve the value of a key @param {String} key Name to lookup value by @returns {Object} retObj Container for value and meta information @returns {Mixed} retObj.value Aliased, mapped, and flattened copy of `key` @returns {String[]} retObj.aliasesUsed Array of aliased keys used while looking up @returns {String[]} retOb...
[ "Resolve", "the", "value", "of", "a", "key" ]
956cfa193e02b6c4ae0e607b14eea41a15b7331d
https://github.com/twolfson/value-mapper/blob/956cfa193e02b6c4ae0e607b14eea41a15b7331d/lib/value-mapper.js#L79-L95
train
Illyism/markade
lib/render.js
render
function render(content) { var deferred = q.defer(); var blockType = "normal"; var lines = content.split("\n"); var blocks = {}; for (var i=0; i<lines.length; i++) { var line = lines[i]; if (line.substr(0,1) == "@") { blockType = line.substr(1).trim(); if (blockType === "end") blockType ...
javascript
function render(content) { var deferred = q.defer(); var blockType = "normal"; var lines = content.split("\n"); var blocks = {}; for (var i=0; i<lines.length; i++) { var line = lines[i]; if (line.substr(0,1) == "@") { blockType = line.substr(1).trim(); if (blockType === "end") blockType ...
[ "function", "render", "(", "content", ")", "{", "var", "deferred", "=", "q", ".", "defer", "(", ")", ";", "var", "blockType", "=", "\"normal\"", ";", "var", "lines", "=", "content", ".", "split", "(", "\"\\n\"", ")", ";", "var", "blocks", "=", "{", ...
Catch all the blocks encapsulated in blocks with `key` as key. and make an object based on this to be used in the templates. ``` @ key # Normal Markdown content @ end ```
[ "Catch", "all", "the", "blocks", "encapsulated", "in", "blocks", "with", "key", "as", "key", ".", "and", "make", "an", "object", "based", "on", "this", "to", "be", "used", "in", "the", "templates", "." ]
fa2a4b45084b468a8ed0eca9499ade65e2568052
https://github.com/Illyism/markade/blob/fa2a4b45084b468a8ed0eca9499ade65e2568052/lib/render.js#L41-L73
train
Illyism/markade
lib/render.js
splitInput
function splitInput(str) { if (str.slice(0, 3) !== '---') return; var matcher = /\n(\.{3}|-{3})/g; var metaEnd = matcher.exec(str); return metaEnd && [str.slice(0, metaEnd.index), str.slice(matcher.lastIndex)]; }
javascript
function splitInput(str) { if (str.slice(0, 3) !== '---') return; var matcher = /\n(\.{3}|-{3})/g; var metaEnd = matcher.exec(str); return metaEnd && [str.slice(0, metaEnd.index), str.slice(matcher.lastIndex)]; }
[ "function", "splitInput", "(", "str", ")", "{", "if", "(", "str", ".", "slice", "(", "0", ",", "3", ")", "!==", "'---'", ")", "return", ";", "var", "matcher", "=", "/", "\\n(\\.{3}|-{3})", "/", "g", ";", "var", "metaEnd", "=", "matcher", ".", "exec...
Splits the given string into a meta section and a markdown section if a meta section is present, else returns null
[ "Splits", "the", "given", "string", "into", "a", "meta", "section", "and", "a", "markdown", "section", "if", "a", "meta", "section", "is", "present", "else", "returns", "null" ]
fa2a4b45084b468a8ed0eca9499ade65e2568052
https://github.com/Illyism/markade/blob/fa2a4b45084b468a8ed0eca9499ade65e2568052/lib/render.js#L101-L108
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/dom/range.js
function( range ) { range.collapsed = ( range.startContainer && range.endContainer && range.startContainer.equals( range.endContainer ) && range.startOffset == range.endOffset ); }
javascript
function( range ) { range.collapsed = ( range.startContainer && range.endContainer && range.startContainer.equals( range.endContainer ) && range.startOffset == range.endOffset ); }
[ "function", "(", "range", ")", "{", "range", ".", "collapsed", "=", "(", "range", ".", "startContainer", "&&", "range", ".", "endContainer", "&&", "range", ".", "startContainer", ".", "equals", "(", "range", ".", "endContainer", ")", "&&", "range", ".", ...
Updates the "collapsed" property for the given range object.
[ "Updates", "the", "collapsed", "property", "for", "the", "given", "range", "object", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/range.js#L94-L101
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/dom/range.js
function( mergeThen ) { var docFrag = new CKEDITOR.dom.documentFragment( this.document ); if ( !this.collapsed ) execContentsAction( this, 1, docFrag, mergeThen ); return docFrag; }
javascript
function( mergeThen ) { var docFrag = new CKEDITOR.dom.documentFragment( this.document ); if ( !this.collapsed ) execContentsAction( this, 1, docFrag, mergeThen ); return docFrag; }
[ "function", "(", "mergeThen", ")", "{", "var", "docFrag", "=", "new", "CKEDITOR", ".", "dom", ".", "documentFragment", "(", "this", ".", "document", ")", ";", "if", "(", "!", "this", ".", "collapsed", ")", "execContentsAction", "(", "this", ",", "1", "...
The content nodes of the range are cloned and added to a document fragment, meanwhile they're removed permanently from the DOM tree. @param {Boolean} [mergeThen] Merge any splitted elements result in DOM true due to partial selection.
[ "The", "content", "nodes", "of", "the", "range", "are", "cloned", "and", "added", "to", "a", "document", "fragment", "meanwhile", "they", "re", "removed", "permanently", "from", "the", "DOM", "tree", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/range.js#L466-L474
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/dom/range.js
function( normalized ) { var startContainer = this.startContainer, endContainer = this.endContainer; var startOffset = this.startOffset, endOffset = this.endOffset; var collapsed = this.collapsed; var child, previous; // If there is no range then get out of here. // It happe...
javascript
function( normalized ) { var startContainer = this.startContainer, endContainer = this.endContainer; var startOffset = this.startOffset, endOffset = this.endOffset; var collapsed = this.collapsed; var child, previous; // If there is no range then get out of here. // It happe...
[ "function", "(", "normalized", ")", "{", "var", "startContainer", "=", "this", ".", "startContainer", ",", "endContainer", "=", "this", ".", "endContainer", ";", "var", "startOffset", "=", "this", ".", "startOffset", ",", "endOffset", "=", "this", ".", "endO...
Creates a "non intrusive" and "mutation sensible" bookmark. This kind of bookmark should be used only when the DOM is supposed to remain stable after its creation. @param {Boolean} [normalized] Indicates that the bookmark must normalized. When normalized, the successive text nodes are considered a single node. To suces...
[ "Creates", "a", "non", "intrusive", "and", "mutation", "sensible", "bookmark", ".", "This", "kind", "of", "bookmark", "should", "be", "used", "only", "when", "the", "DOM", "is", "supposed", "to", "remain", "stable", "after", "its", "creation", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/range.js#L558-L650
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/dom/range.js
function() { var container = this.startContainer; var offset = this.startOffset; if ( container.type != CKEDITOR.NODE_ELEMENT ) { if ( !offset ) this.setStartBefore( container ); else if ( offset >= container.getLength() ) this.setStartAfter( container ); } container...
javascript
function() { var container = this.startContainer; var offset = this.startOffset; if ( container.type != CKEDITOR.NODE_ELEMENT ) { if ( !offset ) this.setStartBefore( container ); else if ( offset >= container.getLength() ) this.setStartAfter( container ); } container...
[ "function", "(", ")", "{", "var", "container", "=", "this", ".", "startContainer", ";", "var", "offset", "=", "this", ".", "startOffset", ";", "if", "(", "container", ".", "type", "!=", "CKEDITOR", ".", "NODE_ELEMENT", ")", "{", "if", "(", "!", "offset...
Transforms the startContainer and endContainer properties from text nodes to element nodes, whenever possible. This is actually possible if either of the boundary containers point to a text node, and its offset is set to zero, or after the last char in the node.
[ "Transforms", "the", "startContainer", "and", "endContainer", "properties", "from", "text", "nodes", "to", "element", "nodes", "whenever", "possible", ".", "This", "is", "actually", "possible", "if", "either", "of", "the", "boundary", "containers", "point", "to", ...
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/range.js#L783-L806
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/dom/range.js
function() { var startNode = this.startContainer, endNode = this.endContainer; if ( startNode.is && startNode.is( 'span' ) && startNode.data( 'cke-bookmark' ) ) this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START ); if ( endNode && endNode.is && endNode.is( 'span' ) && endNod...
javascript
function() { var startNode = this.startContainer, endNode = this.endContainer; if ( startNode.is && startNode.is( 'span' ) && startNode.data( 'cke-bookmark' ) ) this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START ); if ( endNode && endNode.is && endNode.is( 'span' ) && endNod...
[ "function", "(", ")", "{", "var", "startNode", "=", "this", ".", "startContainer", ",", "endNode", "=", "this", ".", "endContainer", ";", "if", "(", "startNode", ".", "is", "&&", "startNode", ".", "is", "(", "'span'", ")", "&&", "startNode", ".", "data...
Move the range out of bookmark nodes if they'd been the container.
[ "Move", "the", "range", "out", "of", "bookmark", "nodes", "if", "they", "d", "been", "the", "container", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/range.js#L811-L822
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/dom/range.js
function( element, checkType ) { var checkStart = ( checkType == CKEDITOR.START ); // Create a copy of this range, so we can manipulate it for our checks. var walkerRange = this.clone(); // Collapse the range at the proper size. walkerRange.collapse( checkStart ); // Expand the range to...
javascript
function( element, checkType ) { var checkStart = ( checkType == CKEDITOR.START ); // Create a copy of this range, so we can manipulate it for our checks. var walkerRange = this.clone(); // Collapse the range at the proper size. walkerRange.collapse( checkStart ); // Expand the range to...
[ "function", "(", "element", ",", "checkType", ")", "{", "var", "checkStart", "=", "(", "checkType", "==", "CKEDITOR", ".", "START", ")", ";", "// Create a copy of this range, so we can manipulate it for our checks.\r", "var", "walkerRange", "=", "this", ".", "clone", ...
Check whether a range boundary is at the inner boundary of a given element. @param {CKEDITOR.dom.element} element The target element to check. @param {Number} checkType The boundary to check for both the range and the element. It can be CKEDITOR.START or CKEDITOR.END. @returns {Boolean} "true" if the range boundary is ...
[ "Check", "whether", "a", "range", "boundary", "is", "at", "the", "inner", "boundary", "of", "a", "given", "element", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/range.js#L1779-L1799
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/dom/range.js
function() { var startContainer = this.startContainer, startOffset = this.startOffset; // If the starting node is a text node, and non-empty before the offset, // then we're surely not at the start of block. if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT ) { var textBef...
javascript
function() { var startContainer = this.startContainer, startOffset = this.startOffset; // If the starting node is a text node, and non-empty before the offset, // then we're surely not at the start of block. if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT ) { var textBef...
[ "function", "(", ")", "{", "var", "startContainer", "=", "this", ".", "startContainer", ",", "startOffset", "=", "this", ".", "startOffset", ";", "// If the starting node is a text node, and non-empty before the offset,\r", "// then we're surely not at the start of block.\r", "...
Calls to this function may produce changes to the DOM. The range may be updated to reflect such changes.
[ "Calls", "to", "this", "function", "may", "produce", "changes", "to", "the", "DOM", ".", "The", "range", "may", "be", "updated", "to", "reflect", "such", "changes", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/range.js#L1803-L1835
train
shlomiassaf/resty-stone
example/customTypeHandlers/cloudinaryimage.js
authorizedHandler
function authorizedHandler(value) { if (! value) return value; delete value.public_id; delete value.version; delete value.signature; delete value.resource_type; return value; }
javascript
function authorizedHandler(value) { if (! value) return value; delete value.public_id; delete value.version; delete value.signature; delete value.resource_type; return value; }
[ "function", "authorizedHandler", "(", "value", ")", "{", "if", "(", "!", "value", ")", "return", "value", ";", "delete", "value", ".", "public_id", ";", "delete", "value", ".", "version", ";", "delete", "value", ".", "signature", ";", "delete", "value", ...
Handles CloudinaryImage instances for authorized requests.
[ "Handles", "CloudinaryImage", "instances", "for", "authorized", "requests", "." ]
9ab093272ea7b68c6fe0aba45384206571896295
https://github.com/shlomiassaf/resty-stone/blob/9ab093272ea7b68c6fe0aba45384206571896295/example/customTypeHandlers/cloudinaryimage.js#L20-L29
train
coderaiser/ponse
lib/ponse.js
sendFile
function sendFile(params) { const p = params; checkParams(params); fs.lstat(p.name, (error, stat) => { if (error) return sendError(error, params); const isGzip = isGZIP(p.request) && p.gzip; const time = stat.mtime.toUTCString(); const length = ...
javascript
function sendFile(params) { const p = params; checkParams(params); fs.lstat(p.name, (error, stat) => { if (error) return sendError(error, params); const isGzip = isGZIP(p.request) && p.gzip; const time = stat.mtime.toUTCString(); const length = ...
[ "function", "sendFile", "(", "params", ")", "{", "const", "p", "=", "params", ";", "checkParams", "(", "params", ")", ";", "fs", ".", "lstat", "(", "p", ".", "name", ",", "(", "error", ",", "stat", ")", "=>", "{", "if", "(", "error", ")", "return...
send file to client thru pipe and gzip it if client support
[ "send", "file", "to", "client", "thru", "pipe", "and", "gzip", "it", "if", "client", "support" ]
0bea0b55304553a6b44254daffe178bb90fbe60b
https://github.com/coderaiser/ponse/blob/0bea0b55304553a6b44254daffe178bb90fbe60b/lib/ponse.js#L200-L238
train
coderaiser/ponse
lib/ponse.js
sendError
function sendError(error, params) { checkParams(params); params.status = FILE_NOT_FOUND; const data = error.message || String(error); logError(error.stack); send(data, params); }
javascript
function sendError(error, params) { checkParams(params); params.status = FILE_NOT_FOUND; const data = error.message || String(error); logError(error.stack); send(data, params); }
[ "function", "sendError", "(", "error", ",", "params", ")", "{", "checkParams", "(", "params", ")", ";", "params", ".", "status", "=", "FILE_NOT_FOUND", ";", "const", "data", "=", "error", ".", "message", "||", "String", "(", "error", ")", ";", "logError"...
send error response
[ "send", "error", "response" ]
0bea0b55304553a6b44254daffe178bb90fbe60b
https://github.com/coderaiser/ponse/blob/0bea0b55304553a6b44254daffe178bb90fbe60b/lib/ponse.js#L243-L253
train
coderaiser/ponse
lib/ponse.js
redirect
function redirect(url, response) { const header = { 'Location': url }; assert(url, 'url could not be empty!'); assert(response, 'response could not be empty!'); fillHeader(header, response); response.statusCode = MOVED_PERMANENTLY; response.end(); }
javascript
function redirect(url, response) { const header = { 'Location': url }; assert(url, 'url could not be empty!'); assert(response, 'response could not be empty!'); fillHeader(header, response); response.statusCode = MOVED_PERMANENTLY; response.end(); }
[ "function", "redirect", "(", "url", ",", "response", ")", "{", "const", "header", "=", "{", "'Location'", ":", "url", "}", ";", "assert", "(", "url", ",", "'url could not be empty!'", ")", ";", "assert", "(", "response", ",", "'response could not be empty!'", ...
redirect to another URL
[ "redirect", "to", "another", "URL" ]
0bea0b55304553a6b44254daffe178bb90fbe60b
https://github.com/coderaiser/ponse/blob/0bea0b55304553a6b44254daffe178bb90fbe60b/lib/ponse.js#L318-L329
train
jhermsmeier/node-speech
lib/distance/levenshtein.js
levenshtein
function levenshtein( source, target ) { var s = source.length var t = target.length if( s === 0 ) return t if( t === 0 ) return s var i, k, matrix = [] for( i = 0; i <= t; i++ ) { matrix[i] = [ i ] } for( k = 0; k <= s; k++ ) matrix[0][k] = k for( i = 1; i <= t; i++ ) { ...
javascript
function levenshtein( source, target ) { var s = source.length var t = target.length if( s === 0 ) return t if( t === 0 ) return s var i, k, matrix = [] for( i = 0; i <= t; i++ ) { matrix[i] = [ i ] } for( k = 0; k <= s; k++ ) matrix[0][k] = k for( i = 1; i <= t; i++ ) { ...
[ "function", "levenshtein", "(", "source", ",", "target", ")", "{", "var", "s", "=", "source", ".", "length", "var", "t", "=", "target", ".", "length", "if", "(", "s", "===", "0", ")", "return", "t", "if", "(", "t", "===", "0", ")", "return", "s",...
Computes the Levenshtein distance between two sequences. @param {String} source @param {String} target @return {Number} distance
[ "Computes", "the", "Levenshtein", "distance", "between", "two", "sequences", "." ]
984c4dd6e2fe640c01267f10e3804ef81391e73a
https://github.com/jhermsmeier/node-speech/blob/984c4dd6e2fe640c01267f10e3804ef81391e73a/lib/distance/levenshtein.js#L10-L43
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/resourcemanager.js
function( name ) { var external = this.externals[ name ]; return CKEDITOR.getUrl( ( external && external.dir ) || this.basePath + name + '/' ); }
javascript
function( name ) { var external = this.externals[ name ]; return CKEDITOR.getUrl( ( external && external.dir ) || this.basePath + name + '/' ); }
[ "function", "(", "name", ")", "{", "var", "external", "=", "this", ".", "externals", "[", "name", "]", ";", "return", "CKEDITOR", ".", "getUrl", "(", "(", "external", "&&", "external", ".", "dir", ")", "||", "this", ".", "basePath", "+", "name", "+",...
Get the folder path for a specific loaded resource. @param {String} name The resource name. @type String @example alert( <b>CKEDITOR.plugins.getPath( 'sample' )</b> ); // "&lt;editor path&gt;/plugins/sample/"
[ "Get", "the", "folder", "path", "for", "a", "specific", "loaded", "resource", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/resourcemanager.js#L112-L116
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/resourcemanager.js
function( name ) { var external = this.externals[ name ]; return CKEDITOR.getUrl( this.getPath( name ) + ( ( external && ( typeof external.file == 'string' ) ) ? external.file : this.fileName + '.js' ) ); }
javascript
function( name ) { var external = this.externals[ name ]; return CKEDITOR.getUrl( this.getPath( name ) + ( ( external && ( typeof external.file == 'string' ) ) ? external.file : this.fileName + '.js' ) ); }
[ "function", "(", "name", ")", "{", "var", "external", "=", "this", ".", "externals", "[", "name", "]", ";", "return", "CKEDITOR", ".", "getUrl", "(", "this", ".", "getPath", "(", "name", ")", "+", "(", "(", "external", "&&", "(", "typeof", "external"...
Get the file path for a specific loaded resource. @param {String} name The resource name. @type String @example alert( <b>CKEDITOR.plugins.getFilePath( 'sample' )</b> ); // "&lt;editor path&gt;/plugins/sample/plugin.js"
[ "Get", "the", "file", "path", "for", "a", "specific", "loaded", "resource", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/resourcemanager.js#L125-L131
train
saggiyogesh/nodeportal
public/ckeditor/_source/core/resourcemanager.js
function( names, path, fileName ) { names = names.split( ',' ); for ( var i = 0 ; i < names.length ; i++ ) { var name = names[ i ]; this.externals[ name ] = { dir : path, file : fileName }; } }
javascript
function( names, path, fileName ) { names = names.split( ',' ); for ( var i = 0 ; i < names.length ; i++ ) { var name = names[ i ]; this.externals[ name ] = { dir : path, file : fileName }; } }
[ "function", "(", "names", ",", "path", ",", "fileName", ")", "{", "names", "=", "names", ".", "split", "(", "','", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "names", ".", "length", ";", "i", "++", ")", "{", "var", "name", "="...
Registers one or more resources to be loaded from an external path instead of the core base path. @param {String} names The resource names, separated by commas. @param {String} path The path of the folder containing the resource. @param {String} [fileName] The resource file name. If not provided, the default name is us...
[ "Registers", "one", "or", "more", "resources", "to", "be", "loaded", "from", "an", "external", "path", "instead", "of", "the", "core", "base", "path", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/resourcemanager.js#L151-L164
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/pastefromword/filter/default.js
postProcessList
function postProcessList( list ) { var children = list.children, child, attrs, count = list.children.length, match, mergeStyle, styleTypeRegexp = /list-style-type:(.*?)(?:;|$)/, stylesFilter = CKEDITOR.plugins.pastefromword.filters.stylesFilter; attrs = list.attributes; if ( sty...
javascript
function postProcessList( list ) { var children = list.children, child, attrs, count = list.children.length, match, mergeStyle, styleTypeRegexp = /list-style-type:(.*?)(?:;|$)/, stylesFilter = CKEDITOR.plugins.pastefromword.filters.stylesFilter; attrs = list.attributes; if ( sty...
[ "function", "postProcessList", "(", "list", ")", "{", "var", "children", "=", "list", ".", "children", ",", "child", ",", "attrs", ",", "count", "=", "list", ".", "children", ".", "length", ",", "match", ",", "mergeStyle", ",", "styleTypeRegexp", "=", "/...
1. move consistent list item styles up to list root. 2. clear out unnecessary list item numbering.
[ "1", ".", "move", "consistent", "list", "item", "styles", "up", "to", "list", "root", ".", "2", ".", "clear", "out", "unnecessary", "list", "item", "numbering", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/pastefromword/filter/default.js#L123-L169
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/pastefromword/filter/default.js
fromRoman
function fromRoman( str ) { str = str.toUpperCase(); var l = romans.length, retVal = 0; for ( var i = 0; i < l; ++i ) { for ( var j = romans[i], k = j[1].length; str.substr( 0, k ) == j[1]; str = str.substr( k ) ) retVal += j[ 0 ]; } return retVal; }
javascript
function fromRoman( str ) { str = str.toUpperCase(); var l = romans.length, retVal = 0; for ( var i = 0; i < l; ++i ) { for ( var j = romans[i], k = j[1].length; str.substr( 0, k ) == j[1]; str = str.substr( k ) ) retVal += j[ 0 ]; } return retVal; }
[ "function", "fromRoman", "(", "str", ")", "{", "str", "=", "str", ".", "toUpperCase", "(", ")", ";", "var", "l", "=", "romans", ".", "length", ",", "retVal", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "l", ";", "++", "i",...
Convert roman numbering back to decimal.
[ "Convert", "roman", "numbering", "back", "to", "decimal", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/pastefromword/filter/default.js#L184-L194
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/pastefromword/filter/default.js
fromAlphabet
function fromAlphabet( str ) { str = str.toUpperCase(); var l = alpahbets.length, retVal = 1; for ( var x = 1; str.length > 0; x *= l ) { retVal += alpahbets.indexOf( str.charAt( str.length - 1 ) ) * x; str = str.substr( 0, str.length - 1 ); } return retVal; }
javascript
function fromAlphabet( str ) { str = str.toUpperCase(); var l = alpahbets.length, retVal = 1; for ( var x = 1; str.length > 0; x *= l ) { retVal += alpahbets.indexOf( str.charAt( str.length - 1 ) ) * x; str = str.substr( 0, str.length - 1 ); } return retVal; }
[ "function", "fromAlphabet", "(", "str", ")", "{", "str", "=", "str", ".", "toUpperCase", "(", ")", ";", "var", "l", "=", "alpahbets", ".", "length", ",", "retVal", "=", "1", ";", "for", "(", "var", "x", "=", "1", ";", "str", ".", "length", ">", ...
Convert alphabet numbering back to decimal.
[ "Convert", "alphabet", "numbering", "back", "to", "decimal", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/pastefromword/filter/default.js#L197-L207
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/pastefromword/filter/default.js
function ( styleDefiniton, variables ) { return function( element ) { var styleDef = variables ? new CKEDITOR.style( styleDefiniton, variables )._.definition : styleDefiniton; element.name = styleDef.element; CKEDITOR.tools.extend( element.attrib...
javascript
function ( styleDefiniton, variables ) { return function( element ) { var styleDef = variables ? new CKEDITOR.style( styleDefiniton, variables )._.definition : styleDefiniton; element.name = styleDef.element; CKEDITOR.tools.extend( element.attrib...
[ "function", "(", "styleDefiniton", ",", "variables", ")", "{", "return", "function", "(", "element", ")", "{", "var", "styleDef", "=", "variables", "?", "new", "CKEDITOR", ".", "style", "(", "styleDefiniton", ",", "variables", ")", ".", "_", ".", "definiti...
Migrate the element by decorate styles on it. @param styleDefiniton @param variables
[ "Migrate", "the", "element", "by", "decorate", "styles", "on", "it", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/pastefromword/filter/default.js#L687-L699
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/pastefromword/filter/default.js
function( styleDefinition, variableName ) { var elementMigrateFilter = this.elementMigrateFilter; return function( value, element ) { // Build an stylish element first. var styleElement = new CKEDITOR.htmlParser.element( null ), variables = {}; variables[ variable...
javascript
function( styleDefinition, variableName ) { var elementMigrateFilter = this.elementMigrateFilter; return function( value, element ) { // Build an stylish element first. var styleElement = new CKEDITOR.htmlParser.element( null ), variables = {}; variables[ variable...
[ "function", "(", "styleDefinition", ",", "variableName", ")", "{", "var", "elementMigrateFilter", "=", "this", ".", "elementMigrateFilter", ";", "return", "function", "(", "value", ",", "element", ")", "{", "// Build an stylish element first.\r", "var", "styleElement"...
Migrate styles by creating a new nested stylish element. @param styleDefinition
[ "Migrate", "styles", "by", "creating", "a", "new", "nested", "stylish", "element", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/pastefromword/filter/default.js#L705-L721
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/pastefromword/filter/default.js
function( element ) { if ( CKEDITOR.env.gecko ) { // Grab only the style definition section. var styleDefSection = element.onlyChild().value.match( /\/\* Style Definitions \*\/([\s\S]*?)\/\*/ ), styleDefText = styleDefSection && styleDefSection[ 1 ], rules = {}; // ...
javascript
function( element ) { if ( CKEDITOR.env.gecko ) { // Grab only the style definition section. var styleDefSection = element.onlyChild().value.match( /\/\* Style Definitions \*\/([\s\S]*?)\/\*/ ), styleDefText = styleDefSection && styleDefSection[ 1 ], rules = {}; // ...
[ "function", "(", "element", ")", "{", "if", "(", "CKEDITOR", ".", "env", ".", "gecko", ")", "{", "// Grab only the style definition section.\r", "var", "styleDefSection", "=", "element", ".", "onlyChild", "(", ")", ".", "value", ".", "match", "(", "/", "\\/\...
We'll drop any style sheet, but Firefox conclude certain styles in a single style element, which are required to be changed into inline ones.
[ "We", "ll", "drop", "any", "style", "sheet", "but", "Firefox", "conclude", "certain", "styles", "in", "a", "single", "style", "element", "which", "are", "required", "to", "be", "changed", "into", "inline", "ones", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/pastefromword/filter/default.js#L855-L917
train
mdreizin/webpack-config-stream
lib/initStream.js
initStream
function initStream(options) { if (!_.isObject(options)) { options = {}; } return through.obj(function(chunk, enc, cb) { var compilerOptions = chunk[FIELD_NAME] || {}; compilerOptions = _.merge(compilerOptions, options); if (options.progress === true) { compile...
javascript
function initStream(options) { if (!_.isObject(options)) { options = {}; } return through.obj(function(chunk, enc, cb) { var compilerOptions = chunk[FIELD_NAME] || {}; compilerOptions = _.merge(compilerOptions, options); if (options.progress === true) { compile...
[ "function", "initStream", "(", "options", ")", "{", "if", "(", "!", "_", ".", "isObject", "(", "options", ")", ")", "{", "options", "=", "{", "}", ";", "}", "return", "through", ".", "obj", "(", "function", "(", "chunk", ",", "enc", ",", "cb", ")...
Helps to init `webpack` compiler. Can be piped. @function @alias initStream @param {Object=} options @param {Boolean} [options.useMemoryFs=false] - Uses {@link https://github.com/webpack/memory-fs memory-fs} for `compiler.outputFileSystem`. Prevents writing of emitted files to file system. `gulp.dest()` can be used. `g...
[ "Helps", "to", "init", "webpack", "compiler", ".", "Can", "be", "piped", "." ]
f8424f97837a224bc07cc18a03ecf649d708e924
https://github.com/mdreizin/webpack-config-stream/blob/f8424f97837a224bc07cc18a03ecf649d708e924/lib/initStream.js#L23-L41
train
shlomiassaf/resty-stone
lib/models/BaseTypeHandler.js
BaseTypeHandler
function BaseTypeHandler(ksTypeName, handlers) { this.ksTypeName = ksTypeName; if ("function" === typeof handlers) { this.handlers = {default: handlers}; } else { this.handlers = _.extend({}, handlers); } }
javascript
function BaseTypeHandler(ksTypeName, handlers) { this.ksTypeName = ksTypeName; if ("function" === typeof handlers) { this.handlers = {default: handlers}; } else { this.handlers = _.extend({}, handlers); } }
[ "function", "BaseTypeHandler", "(", "ksTypeName", ",", "handlers", ")", "{", "this", ".", "ksTypeName", "=", "ksTypeName", ";", "if", "(", "\"function\"", "===", "typeof", "handlers", ")", "{", "this", ".", "handlers", "=", "{", "default", ":", "handlers", ...
Handles transformation of keystone field types. @param ksTypeName The name of the field @param handlers an object with profile/handler pairs or a single function that will be the default profile handler. @constructor
[ "Handles", "transformation", "of", "keystone", "field", "types", "." ]
9ab093272ea7b68c6fe0aba45384206571896295
https://github.com/shlomiassaf/resty-stone/blob/9ab093272ea7b68c6fe0aba45384206571896295/lib/models/BaseTypeHandler.js#L10-L20
train
fvsch/gulp-task-maker
feedback.js
onExit
function onExit() { if (!onExit.done) { if (options.strict !== true) showLoadingErrors() if (options.debug === true) showDebugInfo() } onExit.done = true }
javascript
function onExit() { if (!onExit.done) { if (options.strict !== true) showLoadingErrors() if (options.debug === true) showDebugInfo() } onExit.done = true }
[ "function", "onExit", "(", ")", "{", "if", "(", "!", "onExit", ".", "done", ")", "{", "if", "(", "options", ".", "strict", "!==", "true", ")", "showLoadingErrors", "(", ")", "if", "(", "options", ".", "debug", "===", "true", ")", "showDebugInfo", "("...
Show saved errors if things went wrong
[ "Show", "saved", "errors", "if", "things", "went", "wrong" ]
20ab4245f2d75174786ad140793e9438c025d546
https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/feedback.js#L25-L31
train
fvsch/gulp-task-maker
feedback.js
showDebugInfo
function showDebugInfo() { customLog(`gulp-task-maker options:\n${util.inspect(options)}`) for (const data of scripts) { const info = { callback: data.callback, configs: data.normalizedConfigs, errors: data.errors } customLog( `gulp-task-maker script '${data.name}':\n${util.inspe...
javascript
function showDebugInfo() { customLog(`gulp-task-maker options:\n${util.inspect(options)}`) for (const data of scripts) { const info = { callback: data.callback, configs: data.normalizedConfigs, errors: data.errors } customLog( `gulp-task-maker script '${data.name}':\n${util.inspe...
[ "function", "showDebugInfo", "(", ")", "{", "customLog", "(", "`", "\\n", "${", "util", ".", "inspect", "(", "options", ")", "}", "`", ")", "for", "(", "const", "data", "of", "scripts", ")", "{", "const", "info", "=", "{", "callback", ":", "data", ...
Get debug info such as the current options and GTM state @return {object}
[ "Get", "debug", "info", "such", "as", "the", "current", "options", "and", "GTM", "state" ]
20ab4245f2d75174786ad140793e9438c025d546
https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/feedback.js#L37-L51
train
fvsch/gulp-task-maker
feedback.js
handleError
function handleError(err, store) { if (err && !err.plugin) { err.plugin = 'gulp-task-maker' } if (Array.isArray(store)) { store.push(err) } else { showError(err) } }
javascript
function handleError(err, store) { if (err && !err.plugin) { err.plugin = 'gulp-task-maker' } if (Array.isArray(store)) { store.push(err) } else { showError(err) } }
[ "function", "handleError", "(", "err", ",", "store", ")", "{", "if", "(", "err", "&&", "!", "err", ".", "plugin", ")", "{", "err", ".", "plugin", "=", "'gulp-task-maker'", "}", "if", "(", "Array", ".", "isArray", "(", "store", ")", ")", "{", "store...
Store an error for later, log it instantly or throw if in strict mode @param {object} err - error object @param {Array} [store] - where to store the error for later
[ "Store", "an", "error", "for", "later", "log", "it", "instantly", "or", "throw", "if", "in", "strict", "mode" ]
20ab4245f2d75174786ad140793e9438c025d546
https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/feedback.js#L58-L67
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/horizontalrule/plugin.js
function( editor ) { var hr = editor.document.createElement( 'hr' ), range = new CKEDITOR.dom.range( editor.document ); editor.insertElement( hr ); // If there's nothing or a non-editable block followed by, establish a new paragraph // to make sure cursor is not trapped. range.moveToPosi...
javascript
function( editor ) { var hr = editor.document.createElement( 'hr' ), range = new CKEDITOR.dom.range( editor.document ); editor.insertElement( hr ); // If there's nothing or a non-editable block followed by, establish a new paragraph // to make sure cursor is not trapped. range.moveToPosi...
[ "function", "(", "editor", ")", "{", "var", "hr", "=", "editor", ".", "document", ".", "createElement", "(", "'hr'", ")", ",", "range", "=", "new", "CKEDITOR", ".", "dom", ".", "range", "(", "editor", ".", "document", ")", ";", "editor", ".", "insert...
The undo snapshot will be handled by 'insertElement'.
[ "The", "undo", "snapshot", "will", "be", "handled", "by", "insertElement", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/horizontalrule/plugin.js#L15-L30
train
levilindsey/physx
src/util/src/geometry.js
findSquaredDistanceBetweenSegments
function findSquaredDistanceBetweenSegments(segmentA, segmentB) { findClosestPointsFromSegmentToSegment(_segmentDistance_tmpVecA, _segmentDistance_tmpVecB, segmentA, segmentB); return vec3.squaredDistance(_segmentDistance_tmpVecA, _segmentDistance_tmpVecB); }
javascript
function findSquaredDistanceBetweenSegments(segmentA, segmentB) { findClosestPointsFromSegmentToSegment(_segmentDistance_tmpVecA, _segmentDistance_tmpVecB, segmentA, segmentB); return vec3.squaredDistance(_segmentDistance_tmpVecA, _segmentDistance_tmpVecB); }
[ "function", "findSquaredDistanceBetweenSegments", "(", "segmentA", ",", "segmentB", ")", "{", "findClosestPointsFromSegmentToSegment", "(", "_segmentDistance_tmpVecA", ",", "_segmentDistance_tmpVecB", ",", "segmentA", ",", "segmentB", ")", ";", "return", "vec3", ".", "squ...
Finds the minimum squared distance between two line segments. @param {LineSegment} segmentA @param {LineSegment} segmentB @returns {number}
[ "Finds", "the", "minimum", "squared", "distance", "between", "two", "line", "segments", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/util/src/geometry.js#L16-L20
train
levilindsey/physx
src/util/src/geometry.js
findSquaredDistanceFromSegmentToPoint
function findSquaredDistanceFromSegmentToPoint(segment, point) { findClosestPointOnSegmentToPoint(_segmentDistance_tmpVecA, segment, point); return vec3.squaredDistance(_segmentDistance_tmpVecA, point); }
javascript
function findSquaredDistanceFromSegmentToPoint(segment, point) { findClosestPointOnSegmentToPoint(_segmentDistance_tmpVecA, segment, point); return vec3.squaredDistance(_segmentDistance_tmpVecA, point); }
[ "function", "findSquaredDistanceFromSegmentToPoint", "(", "segment", ",", "point", ")", "{", "findClosestPointOnSegmentToPoint", "(", "_segmentDistance_tmpVecA", ",", "segment", ",", "point", ")", ";", "return", "vec3", ".", "squaredDistance", "(", "_segmentDistance_tmpVe...
Finds the minimum squared distance between a line segment and a point. @param {LineSegment} segment @param {vec3} point @returns {number}
[ "Finds", "the", "minimum", "squared", "distance", "between", "a", "line", "segment", "and", "a", "point", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/util/src/geometry.js#L29-L32
train
levilindsey/physx
src/util/src/geometry.js
findPoiBetweenSegmentAndPlaneRegion
function findPoiBetweenSegmentAndPlaneRegion(poi, segment, planeVertex1, planeVertex2, planeVertex3, planeVertex4) { return findPoiBetweenSegmentAndTriangle(poi, segment, planeVertex1, planeVertex2, planeVertex3) || findPoiBetweenSegmentAndTriangle(poi, segment, plan...
javascript
function findPoiBetweenSegmentAndPlaneRegion(poi, segment, planeVertex1, planeVertex2, planeVertex3, planeVertex4) { return findPoiBetweenSegmentAndTriangle(poi, segment, planeVertex1, planeVertex2, planeVertex3) || findPoiBetweenSegmentAndTriangle(poi, segment, plan...
[ "function", "findPoiBetweenSegmentAndPlaneRegion", "(", "poi", ",", "segment", ",", "planeVertex1", ",", "planeVertex2", ",", "planeVertex3", ",", "planeVertex4", ")", "{", "return", "findPoiBetweenSegmentAndTriangle", "(", "poi", ",", "segment", ",", "planeVertex1", ...
Finds the point of intersection between a line segment and a coplanar quadrilateral. This assumes the region is not degenerate (has non-zero side lengths). @param {vec3} poi Output param. Null if there is no intersection. @param {LineSegment} segment @param {vec3} planeVertex1 @param {vec3} planeVertex2 @param {vec3}...
[ "Finds", "the", "point", "of", "intersection", "between", "a", "line", "segment", "and", "a", "coplanar", "quadrilateral", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/util/src/geometry.js#L116-L120
train
levilindsey/physx
src/util/src/geometry.js
findPoiBetweenSegmentAndTriangle
function findPoiBetweenSegmentAndTriangle(poi, segment, triangleVertex1, triangleVertex2, triangleVertex3) { // // Find the point of intersection between the segment and the triangle's plane. // // First triangle edge. vec3.subtract(_tmpVec1, triangleVertex2, triangl...
javascript
function findPoiBetweenSegmentAndTriangle(poi, segment, triangleVertex1, triangleVertex2, triangleVertex3) { // // Find the point of intersection between the segment and the triangle's plane. // // First triangle edge. vec3.subtract(_tmpVec1, triangleVertex2, triangl...
[ "function", "findPoiBetweenSegmentAndTriangle", "(", "poi", ",", "segment", ",", "triangleVertex1", ",", "triangleVertex2", ",", "triangleVertex3", ")", "{", "//", "// Find the point of intersection between the segment and the triangle's plane.", "//", "// First triangle edge.", ...
Finds the point of intersection between a line segment and a triangle. This assumes the triangle is not degenerate (has non-zero side lengths). ---------------------------------------------------------------------------- Originally based on Dan Sunday's algorithms at http://geomalgorithms.com/a06-_intersect-2.html. ...
[ "Finds", "the", "point", "of", "intersection", "between", "a", "line", "segment", "and", "a", "triangle", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/util/src/geometry.js#L145-L201
train
levilindsey/physx
src/util/src/geometry.js
findClosestPointsFromSegmentToSegment
function findClosestPointsFromSegmentToSegment(closestA, closestB, segmentA, segmentB) { const {distA, distB} = findClosestPointsFromLineToLine( segmentA.start, segmentA.dir, segmentB.start, segmentB.dir); const isDistAInBounds = distA >= 0 && distA <= 1; const isDistBInBounds = distB >= 0 && distB <= 1; ...
javascript
function findClosestPointsFromSegmentToSegment(closestA, closestB, segmentA, segmentB) { const {distA, distB} = findClosestPointsFromLineToLine( segmentA.start, segmentA.dir, segmentB.start, segmentB.dir); const isDistAInBounds = distA >= 0 && distA <= 1; const isDistBInBounds = distB >= 0 && distB <= 1; ...
[ "function", "findClosestPointsFromSegmentToSegment", "(", "closestA", ",", "closestB", ",", "segmentA", ",", "segmentB", ")", "{", "const", "{", "distA", ",", "distB", "}", "=", "findClosestPointsFromLineToLine", "(", "segmentA", ".", "start", ",", "segmentA", "."...
Finds the closest position on one line segment to the other line segment, and vice versa. ---------------------------------------------------------------------------- Originally based on Jukka Jylänki's algorithm at https://github.com/juj/MathGeoLib/blob/ff2d348a167008c831ae304483b824647f71fbf6/src/Geometry/LineSegmen...
[ "Finds", "the", "closest", "position", "on", "one", "line", "segment", "to", "the", "other", "line", "segment", "and", "vice", "versa", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/util/src/geometry.js#L266-L324
train
levilindsey/physx
src/util/src/geometry.js
findClosestPointOnSegmentToPoint
function findClosestPointOnSegmentToPoint(closestPoint, segment, point) { const dirSquaredLength = vec3.squaredLength(segment.dir); if (!dirSquaredLength) { // The point is at the segment start. vec3.copy(closestPoint, segment.start); } else { // Calculate the projection of the point onto the line ex...
javascript
function findClosestPointOnSegmentToPoint(closestPoint, segment, point) { const dirSquaredLength = vec3.squaredLength(segment.dir); if (!dirSquaredLength) { // The point is at the segment start. vec3.copy(closestPoint, segment.start); } else { // Calculate the projection of the point onto the line ex...
[ "function", "findClosestPointOnSegmentToPoint", "(", "closestPoint", ",", "segment", ",", "point", ")", "{", "const", "dirSquaredLength", "=", "vec3", ".", "squaredLength", "(", "segment", ".", "dir", ")", ";", "if", "(", "!", "dirSquaredLength", ")", "{", "//...
Finds the closest position on a line segment to a point. ---------------------------------------------------------------------------- Originally based on Jukka Jylänki's algorithm at https://github.com/juj/MathGeoLib/blob/ff2d348a167008c831ae304483b824647f71fbf6/src/Geometry/LineSegment.cpp. Copyright 2011 Jukka Jylä...
[ "Finds", "the", "closest", "position", "on", "a", "line", "segment", "to", "a", "point", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/util/src/geometry.js#L353-L375
train
levilindsey/physx
src/util/src/geometry.js
findClosestPointsFromLineToLine
function findClosestPointsFromLineToLine(startA, dirA, startB, dirB) { vec3.subtract(_tmpVec1, startA, startB); const dirBDotDirAToB = vec3.dot(dirB, _tmpVec1); const dirADotDirAToB = vec3.dot(dirA, _tmpVec1); const sqrLenDirB = vec3.squaredLength(dirB); const sqrLenDirA = vec3.squaredLength(dirA); const ...
javascript
function findClosestPointsFromLineToLine(startA, dirA, startB, dirB) { vec3.subtract(_tmpVec1, startA, startB); const dirBDotDirAToB = vec3.dot(dirB, _tmpVec1); const dirADotDirAToB = vec3.dot(dirA, _tmpVec1); const sqrLenDirB = vec3.squaredLength(dirB); const sqrLenDirA = vec3.squaredLength(dirA); const ...
[ "function", "findClosestPointsFromLineToLine", "(", "startA", ",", "dirA", ",", "startB", ",", "dirB", ")", "{", "vec3", ".", "subtract", "(", "_tmpVec1", ",", "startA", ",", "startB", ")", ";", "const", "dirBDotDirAToB", "=", "vec3", ".", "dot", "(", "dir...
Finds the closest position on one line to the other line, and vice versa. The positions are represented as scalar-value distances from the "start" positions of each line. These are scaled according to the given direction vectors. ---------------------------------------------------------------------------- Originally ...
[ "Finds", "the", "closest", "position", "on", "one", "line", "to", "the", "other", "line", "and", "vice", "versa", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/util/src/geometry.js#L408-L429
train
levilindsey/physx
src/collisions/src/collision-handler.js
handleCollisionsForJob
function handleCollisionsForJob(job, elapsedTime, physicsParams) { const collidable = job.collidable; // Clear any previous collision info. collidable.previousCollisions = collidable.collisions; collidable.collisions = []; // Find all colliding collidables. const collidingCollidables = findIntersectingCol...
javascript
function handleCollisionsForJob(job, elapsedTime, physicsParams) { const collidable = job.collidable; // Clear any previous collision info. collidable.previousCollisions = collidable.collisions; collidable.collisions = []; // Find all colliding collidables. const collidingCollidables = findIntersectingCol...
[ "function", "handleCollisionsForJob", "(", "job", ",", "elapsedTime", ",", "physicsParams", ")", "{", "const", "collidable", "=", "job", ".", "collidable", ";", "// Clear any previous collision info.", "collidable", ".", "previousCollisions", "=", "collidable", ".", "...
This module defines a collision pipeline. These functions will detect collisions between collidable bodies and update their momenta in response to the collisions. - Consists of an efficient broad-phase collision detection step followed by a precise narrow-phase step. - Calculates the position, surface normal, and tim...
[ "This", "module", "defines", "a", "collision", "pipeline", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/src/collision-handler.js#L99-L117
train
levilindsey/physx
src/collisions/src/collision-handler.js
checkThatNoObjectsCollide
function checkThatNoObjectsCollide() { // Broad-phase collision detection (pairs whose bounding volumes intersect). let collisions = collidableStore.getPossibleCollisionsForAllCollidables(); // Narrow-phase collision detection (pairs that actually intersect). collisions = _detectPreciseCollisionsFromCollisions...
javascript
function checkThatNoObjectsCollide() { // Broad-phase collision detection (pairs whose bounding volumes intersect). let collisions = collidableStore.getPossibleCollisionsForAllCollidables(); // Narrow-phase collision detection (pairs that actually intersect). collisions = _detectPreciseCollisionsFromCollisions...
[ "function", "checkThatNoObjectsCollide", "(", ")", "{", "// Broad-phase collision detection (pairs whose bounding volumes intersect).", "let", "collisions", "=", "collidableStore", ".", "getPossibleCollisionsForAllCollidables", "(", ")", ";", "// Narrow-phase collision detection (pairs...
Logs a warning message for any pair of objects that intersect.
[ "Logs", "a", "warning", "message", "for", "any", "pair", "of", "objects", "that", "intersect", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/src/collision-handler.js#L147-L157
train
levilindsey/physx
src/collisions/src/collision-handler.js
_recordCollisions
function _recordCollisions(collidable, collidingCollidables, elapsedTime) { return collidingCollidables.map(other => { const collision = { collidableA: collidable, collidableB: other, time: elapsedTime }; // Record the fact that these objects collided (the ModelController may want to ha...
javascript
function _recordCollisions(collidable, collidingCollidables, elapsedTime) { return collidingCollidables.map(other => { const collision = { collidableA: collidable, collidableB: other, time: elapsedTime }; // Record the fact that these objects collided (the ModelController may want to ha...
[ "function", "_recordCollisions", "(", "collidable", ",", "collidingCollidables", ",", "elapsedTime", ")", "{", "return", "collidingCollidables", ".", "map", "(", "other", "=>", "{", "const", "collision", "=", "{", "collidableA", ":", "collidable", ",", "collidable...
Create collision objects that record the time of collision and the collidables in the collision. Also record references to these collisions on the collidables. @param {Collidable} collidable @param {Array.<Collidable>} collidingCollidables @param {DOMHighResTimeStamp} elapsedTime @returns {Array.<Collision>} @private
[ "Create", "collision", "objects", "that", "record", "the", "time", "of", "collision", "and", "the", "collidables", "in", "the", "collision", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/src/collision-handler.js#L170-L184
train
levilindsey/physx
src/collisions/src/collision-handler.js
_detectPreciseCollisionsFromCollisions
function _detectPreciseCollisionsFromCollisions(collisions) { return collisions.filter(collision => { // TODO: // - Use temporal bisection with discrete sub-time steps to find time of collision (use // x-vs-y-specific intersection detection methods). // - Make sure the collision object is set up...
javascript
function _detectPreciseCollisionsFromCollisions(collisions) { return collisions.filter(collision => { // TODO: // - Use temporal bisection with discrete sub-time steps to find time of collision (use // x-vs-y-specific intersection detection methods). // - Make sure the collision object is set up...
[ "function", "_detectPreciseCollisionsFromCollisions", "(", "collisions", ")", "{", "return", "collisions", ".", "filter", "(", "collision", "=>", "{", "// TODO:", "// - Use temporal bisection with discrete sub-time steps to find time of collision (use", "// x-vs-y-specific inte...
Narrow-phase collision detection. Given a list of possible collision pairs, filter out which pairs are actually colliding. @param {Array.<Collision>} collisions @returns {Array.<Collision>} @private
[ "Narrow", "-", "phase", "collision", "detection", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/src/collision-handler.js#L195-L206
train
levilindsey/physx
src/collisions/src/collision-handler.js
_resolveCollisions
function _resolveCollisions(collisions, physicsParams) { collisions.forEach(collision => { // If neither physics job needs the standard collision restitution, then don't do it. if (_notifyPhysicsJobsOfCollision(collision)) { if (collision.collidableA.physicsJob && collision.collidableB.physicsJob) { ...
javascript
function _resolveCollisions(collisions, physicsParams) { collisions.forEach(collision => { // If neither physics job needs the standard collision restitution, then don't do it. if (_notifyPhysicsJobsOfCollision(collision)) { if (collision.collidableA.physicsJob && collision.collidableB.physicsJob) { ...
[ "function", "_resolveCollisions", "(", "collisions", ",", "physicsParams", ")", "{", "collisions", ".", "forEach", "(", "collision", "=>", "{", "// If neither physics job needs the standard collision restitution, then don't do it.", "if", "(", "_notifyPhysicsJobsOfCollision", "...
Updates the linear and angular momenta of each body in response to its collision. @param {Array.<Collision>} collisions @param {PhysicsConfig} physicsParams @private
[ "Updates", "the", "linear", "and", "angular", "momenta", "of", "each", "body", "in", "response", "to", "its", "collision", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/src/collision-handler.js#L248-L261
train
levilindsey/physx
src/collisions/src/collision-handler.js
_resolveCollision
function _resolveCollision(collision, physicsParams) { const collidableA = collision.collidableA; const collidableB = collision.collidableB; const previousStateA = collidableA.physicsJob.previousState; const previousStateB = collidableB.physicsJob.previousState; const nextStateA = collidableA.physicsJob.curre...
javascript
function _resolveCollision(collision, physicsParams) { const collidableA = collision.collidableA; const collidableB = collision.collidableB; const previousStateA = collidableA.physicsJob.previousState; const previousStateB = collidableB.physicsJob.previousState; const nextStateA = collidableA.physicsJob.curre...
[ "function", "_resolveCollision", "(", "collision", ",", "physicsParams", ")", "{", "const", "collidableA", "=", "collision", ".", "collidableA", ";", "const", "collidableB", "=", "collision", ".", "collidableB", ";", "const", "previousStateA", "=", "collidableA", ...
Resolve a collision between two moving, physics-based objects. This is based on collision-response algorithms from Wikipedia (https://en.wikipedia.org/wiki/Collision_response#Impulse-based_reaction_model). @param {Collision} collision @param {PhysicsConfig} physicsParams @private
[ "Resolve", "a", "collision", "between", "two", "moving", "physics", "-", "based", "objects", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/src/collision-handler.js#L284-L349
train
levilindsey/physx
src/collisions/src/collision-handler.js
_resolveCollisionWithStationaryObject
function _resolveCollisionWithStationaryObject(collision, physicsParams) { const contactNormal = collision.contactNormal; let physicsCollidable; if (collision.collidableA.physicsJob) { physicsCollidable = collision.collidableA; } else { physicsCollidable = collision.collidableB; vec3.negate(contact...
javascript
function _resolveCollisionWithStationaryObject(collision, physicsParams) { const contactNormal = collision.contactNormal; let physicsCollidable; if (collision.collidableA.physicsJob) { physicsCollidable = collision.collidableA; } else { physicsCollidable = collision.collidableB; vec3.negate(contact...
[ "function", "_resolveCollisionWithStationaryObject", "(", "collision", ",", "physicsParams", ")", "{", "const", "contactNormal", "=", "collision", ".", "contactNormal", ";", "let", "physicsCollidable", ";", "if", "(", "collision", ".", "collidableA", ".", "physicsJob"...
Resolve a collision between one moving, physics-based object and one stationary object. @param {Collision} collision @param {PhysicsConfig} physicsParams @private
[ "Resolve", "a", "collision", "between", "one", "moving", "physics", "-", "based", "object", "and", "one", "stationary", "object", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/src/collision-handler.js#L358-L410
train
mdreizin/webpack-config-stream
lib/proxyStream.js
proxyStream
function proxyStream(err, stats) { return through.obj(function(chunk, enc, cb) { processStats.call(this, chunk, stats); if (_.isError(err)) { this.emit('error', wrapError(err)); } cb(null, chunk); }); }
javascript
function proxyStream(err, stats) { return through.obj(function(chunk, enc, cb) { processStats.call(this, chunk, stats); if (_.isError(err)) { this.emit('error', wrapError(err)); } cb(null, chunk); }); }
[ "function", "proxyStream", "(", "err", ",", "stats", ")", "{", "return", "through", ".", "obj", "(", "function", "(", "chunk", ",", "enc", ",", "cb", ")", "{", "processStats", ".", "call", "(", "this", ",", "chunk", ",", "stats", ")", ";", "if", "(...
Re-uses existing `err` and `stats` objects. Can be piped. @function @alias proxyStream @param {Error=} err @param {Stats=} stats @returns {Stream}
[ "Re", "-", "uses", "existing", "err", "and", "stats", "objects", ".", "Can", "be", "piped", "." ]
f8424f97837a224bc07cc18a03ecf649d708e924
https://github.com/mdreizin/webpack-config-stream/blob/f8424f97837a224bc07cc18a03ecf649d708e924/lib/proxyStream.js#L16-L26
train
verbose/verb-cli
bin/verb.js
run
function run(env) { console.log(); // empty line var verbfile = env.configPath; if (versionFlag && tasks.length === 0) { verbLog('CLI version', pkg.version); if (env.modulePackage && typeof env.modulePackage.version !== 'undefined') { verbLog('Local version', env.modulePackage.version); } } ...
javascript
function run(env) { console.log(); // empty line var verbfile = env.configPath; if (versionFlag && tasks.length === 0) { verbLog('CLI version', pkg.version); if (env.modulePackage && typeof env.modulePackage.version !== 'undefined') { verbLog('Local version', env.modulePackage.version); } } ...
[ "function", "run", "(", "env", ")", "{", "console", ".", "log", "(", ")", ";", "// empty line", "var", "verbfile", "=", "env", ".", "configPath", ";", "if", "(", "versionFlag", "&&", "tasks", ".", "length", "===", "0", ")", "{", "verbLog", "(", "'CLI...
the actual logic
[ "the", "actual", "logic" ]
f42621b3e43a631b1df40917ab5ecb9c0ff437b9
https://github.com/verbose/verb-cli/blob/f42621b3e43a631b1df40917ab5ecb9c0ff437b9/bin/verb.js#L98-L155
train
hash-bang/conkie-stats
modules/feedRSSAtom.js
callbackParser
function callbackParser(err, out) { if (err) { error += err + '\n\n'; } else { results[counter] = out; } counter++; if (counter === urlLength) { let result = {sources: [], feeds: []}; let i = 0; _.each(results, feed => { feed.metadata.lastBuildDate = moment(feed.metadata.lastBuildDate).format('x'); ...
javascript
function callbackParser(err, out) { if (err) { error += err + '\n\n'; } else { results[counter] = out; } counter++; if (counter === urlLength) { let result = {sources: [], feeds: []}; let i = 0; _.each(results, feed => { feed.metadata.lastBuildDate = moment(feed.metadata.lastBuildDate).format('x'); ...
[ "function", "callbackParser", "(", "err", ",", "out", ")", "{", "if", "(", "err", ")", "{", "error", "+=", "err", "+", "'\\n\\n'", ";", "}", "else", "{", "results", "[", "counter", "]", "=", "out", ";", "}", "counter", "++", ";", "if", "(", "coun...
Callback call when parser is finished @param err {string} Error reported @param out {json} Data returned
[ "Callback", "call", "when", "parser", "is", "finished" ]
c81775b305efb33a5788325ab851d4f356b240f5
https://github.com/hash-bang/conkie-stats/blob/c81775b305efb33a5788325ab851d4f356b240f5/modules/feedRSSAtom.js#L66-L106
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/maximize/plugin.js
resizeHandler
function resizeHandler() { var viewPaneSize = mainWindow.getViewPaneSize(); shim && shim.setStyles( { width : viewPaneSize.width + 'px', height : viewPaneSize.height + 'px' } ); editor.resize( viewPaneSize.width, viewPaneSize.height, null, true ); }
javascript
function resizeHandler() { var viewPaneSize = mainWindow.getViewPaneSize(); shim && shim.setStyles( { width : viewPaneSize.width + 'px', height : viewPaneSize.height + 'px' } ); editor.resize( viewPaneSize.width, viewPaneSize.height, null, true ); }
[ "function", "resizeHandler", "(", ")", "{", "var", "viewPaneSize", "=", "mainWindow", ".", "getViewPaneSize", "(", ")", ";", "shim", "&&", "shim", ".", "setStyles", "(", "{", "width", ":", "viewPaneSize", ".", "width", "+", "'px'", ",", "height", ":", "v...
Saved resize handler function.
[ "Saved", "resize", "handler", "function", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/maximize/plugin.js#L145-L150
train
taylor1791/promissory-arbiter
src/spec/promissory-arbiter.spec.js
p1so
function p1so (topic1, topic2) { pub(topic1, null, {persist: true}); var spy = sub(topic2); return spy; }
javascript
function p1so (topic1, topic2) { pub(topic1, null, {persist: true}); var spy = sub(topic2); return spy; }
[ "function", "p1so", "(", "topic1", ",", "topic2", ")", "{", "pub", "(", "topic1", ",", "null", ",", "{", "persist", ":", "true", "}", ")", ";", "var", "spy", "=", "sub", "(", "topic2", ")", ";", "return", "spy", ";", "}" ]
Publish 1 Subscribe Other
[ "Publish", "1", "Subscribe", "Other" ]
6327b87efd9ee997cbfaa009164dac266d9e16c2
https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/spec/promissory-arbiter.spec.js#L754-L758
train
taylor1791/promissory-arbiter
src/spec/promissory-arbiter.spec.js
subPubArg
function subPubArg (topic, data, i) { var spy = sub(topic); pub(topic, data); var args = spy.calls.first().args; return typeof i === 'undefined' ? args : args[i]; }
javascript
function subPubArg (topic, data, i) { var spy = sub(topic); pub(topic, data); var args = spy.calls.first().args; return typeof i === 'undefined' ? args : args[i]; }
[ "function", "subPubArg", "(", "topic", ",", "data", ",", "i", ")", "{", "var", "spy", "=", "sub", "(", "topic", ")", ";", "pub", "(", "topic", ",", "data", ")", ";", "var", "args", "=", "spy", ".", "calls", ".", "first", "(", ")", ".", "args", ...
Subscribes to a topic, publishes data and returns the specified arguemnts
[ "Subscribes", "to", "a", "topic", "publishes", "data", "and", "returns", "the", "specified", "arguemnts" ]
6327b87efd9ee997cbfaa009164dac266d9e16c2
https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/spec/promissory-arbiter.spec.js#L768-L774
train
saggiyogesh/nodeportal
public/js/jquery.fileupload-ui.js
function (options) { var processQueue = []; $.each(options.processQueue, function () { var settings = {}, action = this.action, prefix = this.prefix === true ? action : this.prefix; $.each(this, function (key, value) { ...
javascript
function (options) { var processQueue = []; $.each(options.processQueue, function () { var settings = {}, action = this.action, prefix = this.prefix === true ? action : this.prefix; $.each(this, function (key, value) { ...
[ "function", "(", "options", ")", "{", "var", "processQueue", "=", "[", "]", ";", "$", ".", "each", "(", "options", ".", "processQueue", ",", "function", "(", ")", "{", "var", "settings", "=", "{", "}", ",", "action", "=", "this", ".", "action", ","...
Replaces the settings of each processQueue item that are strings starting with an "@", using the remaining substring as key for the option map, e.g. "@autoUpload" is replaced with options.autoUpload:
[ "Replaces", "the", "settings", "of", "each", "processQueue", "item", "that", "are", "strings", "starting", "with", "an" ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/js/jquery.fileupload-ui.js#L738-L759
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/link/plugin.js
function( editor ) { try { var selection = editor.getSelection(); if ( selection.getType() == CKEDITOR.SELECTION_ELEMENT ) { var selectedElement = selection.getSelectedElement(); if ( selectedElement.is( 'a' ) ) return selectedElement; } var range = selection.getRanges( tru...
javascript
function( editor ) { try { var selection = editor.getSelection(); if ( selection.getType() == CKEDITOR.SELECTION_ELEMENT ) { var selectedElement = selection.getSelectedElement(); if ( selectedElement.is( 'a' ) ) return selectedElement; } var range = selection.getRanges( tru...
[ "function", "(", "editor", ")", "{", "try", "{", "var", "selection", "=", "editor", ".", "getSelection", "(", ")", ";", "if", "(", "selection", ".", "getType", "(", ")", "==", "CKEDITOR", ".", "SELECTION_ELEMENT", ")", "{", "var", "selectedElement", "=",...
Get the surrounding link element of current selection. @param editor @example CKEDITOR.plugins.link.getSelectedLink( editor ); @since 3.2.1 The following selection will all return the link element. <pre> <a href="#">li^nk</a> <a href="#">[link]</a> text[<a href="#">link]</a> <a href="#">li[nk</a>] [<b><a href="#">li]nk...
[ "Get", "the", "surrounding", "link", "element", "of", "current", "selection", "." ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/link/plugin.js#L265-L283
train
levilindsey/physx
src/collisions/contact-calculation/src/obb-contact-calculation.js
obbVsSphere
function obbVsSphere(contactPoint, contactNormal, obb, sphere) { findClosestPointFromObbToPoint(contactPoint, obb, sphere.centerOfVolume); vec3.subtract(contactNormal, sphere.centerOfVolume, contactPoint); vec3.normalize(contactNormal, contactNormal); }
javascript
function obbVsSphere(contactPoint, contactNormal, obb, sphere) { findClosestPointFromObbToPoint(contactPoint, obb, sphere.centerOfVolume); vec3.subtract(contactNormal, sphere.centerOfVolume, contactPoint); vec3.normalize(contactNormal, contactNormal); }
[ "function", "obbVsSphere", "(", "contactPoint", ",", "contactNormal", ",", "obb", ",", "sphere", ")", "{", "findClosestPointFromObbToPoint", "(", "contactPoint", ",", "obb", ",", "sphere", ".", "centerOfVolume", ")", ";", "vec3", ".", "subtract", "(", "contactNo...
Finds the closest point anywhere inside the OBB to the center of the sphere. @param {vec3} contactPoint Output param. @param {vec3} contactNormal Output param. @param {Obb} obb @param {Sphere} sphere
[ "Finds", "the", "closest", "point", "anywhere", "inside", "the", "OBB", "to", "the", "center", "of", "the", "sphere", "." ]
62df9f6968082ed34aa784a23f3db6c8feca6f3a
https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/collisions/contact-calculation/src/obb-contact-calculation.js#L42-L46
train
gpolitis/node-tarantula
lib/ResourcePool.js
ResourcePool
function ResourcePool (options) { this.max = options.max || 1; this.maxUses = options.maxUses || 1; this.create = options.create || function () {}; this.destroy = options.destroy || function () {}; this.active = 0; this.resources = new Array(this.max); this.resourceActive = new Array(this.max); this.resourceUse...
javascript
function ResourcePool (options) { this.max = options.max || 1; this.maxUses = options.maxUses || 1; this.create = options.create || function () {}; this.destroy = options.destroy || function () {}; this.active = 0; this.resources = new Array(this.max); this.resourceActive = new Array(this.max); this.resourceUse...
[ "function", "ResourcePool", "(", "options", ")", "{", "this", ".", "max", "=", "options", ".", "max", "||", "1", ";", "this", ".", "maxUses", "=", "options", ".", "maxUses", "||", "1", ";", "this", ".", "create", "=", "options", ".", "create", "||", ...
Class for managing a pool of resources @param {object} options @param {int} options.max Maximum number of resources to keep @param {int} options.maxUses Maximum number of times a resource may be used @param {function} options.create Called to create a new Resource @param {function} options.destroy Called to destroy an...
[ "Class", "for", "managing", "a", "pool", "of", "resources" ]
fd5bfdff5c287244bd5b4a871074a7a67c37387d
https://github.com/gpolitis/node-tarantula/blob/fd5bfdff5c287244bd5b4a871074a7a67c37387d/lib/ResourcePool.js#L15-L24
train
bigpipe/fittings
index.js
Fittings
function Fittings(bigpipe) { if (!this.name) throw new Error('The fittings.name property is required.'); this.ultron = new Ultron(bigpipe); this.bigpipe = bigpipe; this.setup(); }
javascript
function Fittings(bigpipe) { if (!this.name) throw new Error('The fittings.name property is required.'); this.ultron = new Ultron(bigpipe); this.bigpipe = bigpipe; this.setup(); }
[ "function", "Fittings", "(", "bigpipe", ")", "{", "if", "(", "!", "this", ".", "name", ")", "throw", "new", "Error", "(", "'The fittings.name property is required.'", ")", ";", "this", ".", "ultron", "=", "new", "Ultron", "(", "bigpipe", ")", ";", "this", ...
Fittings is the default framework provider for BigPipe. @constructor @param {BigPipe} bigpipe @api public
[ "Fittings", "is", "the", "default", "framework", "provider", "for", "BigPipe", "." ]
3fc601c7835eec9c4c222fe78003af02a13671b0
https://github.com/bigpipe/fittings/blob/3fc601c7835eec9c4c222fe78003af02a13671b0/index.js#L31-L38
train
bigpipe/fittings
index.js
makeitso
function makeitso(where) { if ('string' === typeof where) { where = { expose: path.basename(where).replace(new RegExp(path.extname(where).replace('.', '\\.') +'$'), ''), path: where }; } return where; }
javascript
function makeitso(where) { if ('string' === typeof where) { where = { expose: path.basename(where).replace(new RegExp(path.extname(where).replace('.', '\\.') +'$'), ''), path: where }; } return where; }
[ "function", "makeitso", "(", "where", ")", "{", "if", "(", "'string'", "===", "typeof", "where", ")", "{", "where", "=", "{", "expose", ":", "path", ".", "basename", "(", "where", ")", ".", "replace", "(", "new", "RegExp", "(", "path", ".", "extname"...
As the libraries as run through browserify it makes sense to give them a custom export name. When it's an object we assume that they already follow our required structure. If this is not the case we use the filename as the name it should be exposed under. @param {String|Object} where Either the location of a file or o...
[ "As", "the", "libraries", "as", "run", "through", "browserify", "it", "makes", "sense", "to", "give", "them", "a", "custom", "export", "name", ".", "When", "it", "s", "an", "object", "we", "assume", "that", "they", "already", "follow", "our", "required", ...
3fc601c7835eec9c4c222fe78003af02a13671b0
https://github.com/bigpipe/fittings/blob/3fc601c7835eec9c4c222fe78003af02a13671b0/index.js#L117-L126
train
saggiyogesh/nodeportal
lib/Mailer/MailMessage.js
Attachment
function Attachment(options) { this.fileName = options.fileName; this.contents = options.contents; this.filePath = options.filePath; this.streamSource = options.streamSource; this.contentType = options.contentType; this.cid = options.cid; }
javascript
function Attachment(options) { this.fileName = options.fileName; this.contents = options.contents; this.filePath = options.filePath; this.streamSource = options.streamSource; this.contentType = options.contentType; this.cid = options.cid; }
[ "function", "Attachment", "(", "options", ")", "{", "this", ".", "fileName", "=", "options", ".", "fileName", ";", "this", ".", "contents", "=", "options", ".", "contents", ";", "this", ".", "filePath", "=", "options", ".", "filePath", ";", "this", ".", ...
Attachment constructor. Options of nodemailer attachment are available @constructor
[ "Attachment", "constructor", ".", "Options", "of", "nodemailer", "attachment", "are", "available" ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/Mailer/MailMessage.js#L14-L21
train
gpolitis/node-tarantula
lib/tarantula.js
trimHash
function trimHash (uri) { var indexOfHash = uri.indexOf('#'); return (indexOfHash != -1) ? uri.substring(0, indexOfHash) : uri; }
javascript
function trimHash (uri) { var indexOfHash = uri.indexOf('#'); return (indexOfHash != -1) ? uri.substring(0, indexOfHash) : uri; }
[ "function", "trimHash", "(", "uri", ")", "{", "var", "indexOfHash", "=", "uri", ".", "indexOf", "(", "'#'", ")", ";", "return", "(", "indexOfHash", "!=", "-", "1", ")", "?", "uri", ".", "substring", "(", "0", ",", "indexOfHash", ")", ":", "uri", ";...
Remove Hash part of a URL @param {string} uri The URL to remove hash from @return {string} The URL without hash
[ "Remove", "Hash", "part", "of", "a", "URL" ]
fd5bfdff5c287244bd5b4a871074a7a67c37387d
https://github.com/gpolitis/node-tarantula/blob/fd5bfdff5c287244bd5b4a871074a7a67c37387d/lib/tarantula.js#L346-L349
train
saggiyogesh/nodeportal
public/ckeditor/_source/plugins/scayt/plugin.js
in_array
function in_array( needle, haystack ) { var found = 0, key; for ( key in haystack ) { if ( haystack[ key ] == needle ) { found = 1; break; } } return found; }
javascript
function in_array( needle, haystack ) { var found = 0, key; for ( key in haystack ) { if ( haystack[ key ] == needle ) { found = 1; break; } } return found; }
[ "function", "in_array", "(", "needle", ",", "haystack", ")", "{", "var", "found", "=", "0", ",", "key", ";", "for", "(", "key", "in", "haystack", ")", "{", "if", "(", "haystack", "[", "key", "]", "==", "needle", ")", "{", "found", "=", "1", ";", ...
Checks if a value exists in an array
[ "Checks", "if", "a", "value", "exists", "in", "an", "array" ]
cfd5b340f259d3a57c20892a1e2c95b133fe99ee
https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/scayt/plugin.js#L17-L30
train