_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q24000
OperationInfo
train
function OperationInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
javascript
{ "resource": "" }
q24001
train
function (fn, time, context) { var lock, args, wrapperFn, later; later = function () { // reset lock and call if queued lock = false; if (args) { wrapperFn.apply(context, args); a...
javascript
{ "resource": "" }
q24002
processResult
train
function processResult(context, lang, langJson, stringXmlJson) { var path = require('path'); var q = require('q'); var deferred = q.defer(); var mapObj = {}; // create a map to the actual string _.forEach(stringXmlJson.resources.string, function (val) { if (_.has(val, "$") && _.has(val[...
javascript
{ "resource": "" }
q24003
writeSeedBatch
train
function writeSeedBatch(dynamodbWriteFunction, tableName, seeds) { const params = { RequestItems: { [tableName]: seeds.map((seed) => ({ PutRequest: { Item: seed, }, })), }, }; return new BbPromise((resolve, reject) => { // interval lets us know how much time we ha...
javascript
{ "resource": "" }
q24004
writeSeeds
train
function writeSeeds(dynamodbWriteFunction, tableName, seeds) { if (!dynamodbWriteFunction) { throw new Error("dynamodbWriteFunction argument must be provided"); } if (!tableName) { throw new Error("table name argument must be provided"); } if (!seeds) { throw new Error("seeds argument must be prov...
javascript
{ "resource": "" }
q24005
fileExists
train
function fileExists(fileName) { return new BbPromise((resolve) => { fs.exists(fileName, (exists) => resolve(exists)); }); }
javascript
{ "resource": "" }
q24006
unmarshalBuffer
train
function unmarshalBuffer(json) { _.forEach(json, function(value, key) { // Null check to prevent creation of Buffer when value is null if (value !== null && value.type==="Buffer") { json[key]= new Buffer(value.data); } }); return json; }
javascript
{ "resource": "" }
q24007
getSeedsAtLocation
train
function getSeedsAtLocation(location) { // load the file as JSON const result = require(location); // Ensure the output is an array if (Array.isArray(result)) { return _.forEach(result, unmarshalBuffer); } else { return [ unmarshalBuffer(result) ]; } }
javascript
{ "resource": "" }
q24008
locateSeeds
train
function locateSeeds(sources, cwd) { sources = sources || []; cwd = cwd || process.cwd(); const locations = sources.map((source) => path.join(cwd, source)); return BbPromise.map(locations, (location) => { return fileExists(location).then((exists) => { if(!exists) { throw new Error("source fil...
javascript
{ "resource": "" }
q24009
spawnNodeWithId
train
function spawnNodeWithId (factory, callback) { waterfall([(cb) => factory.spawnNode(cb), identify], callback) }
javascript
{ "resource": "" }
q24010
spawnNodes
train
function spawnNodes (n, factory, callback) { timesSeries(n, (_, cb) => factory.spawnNode(cb), callback) }
javascript
{ "resource": "" }
q24011
spawnNodesWithId
train
function spawnNodesWithId (n, factory, callback) { spawnNodes(n, factory, (err, nodes) => { if (err) return callback(err) map(nodes, identify, callback) }) }
javascript
{ "resource": "" }
q24012
train
function (insertPath, level) { var node = insertPath[level], M = node.children.length, m = this._minEntries; this._chooseSplitAxis(node, m, M); var splitIndex = this._chooseSplitIndex(node, m, M); var newNode = createNode(node.children.splice(splitIndex, node....
javascript
{ "resource": "" }
q24013
train
function (node, m, M) { var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m, M, compareMinX), yMargin = this._allDistMargin(node, m, M, compareMinY); //...
javascript
{ "resource": "" }
q24014
train
function (node, m, M, compare) { node.children.sort(compare); var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i, child; for (...
javascript
{ "resource": "" }
q24015
calcBBox
train
function calcBBox(node, toBBox) { distBBox(node, 0, node.children.length, toBBox, node); }
javascript
{ "resource": "" }
q24016
distBBox
train
function distBBox(node, k, p, toBBox, destNode) { if (!destNode) destNode = createNode(null); destNode.minX = Infinity; destNode.minY = Infinity; destNode.maxX = -Infinity; destNode.maxY = -Infinity; for (var i = k, child; i < p; i++) { child = node.children[i]; extend(destNode,...
javascript
{ "resource": "" }
q24017
multiSelect
train
function multiSelect(arr, left, right, n, compare) { var stack = [left, right], mid; while (stack.length) { right = stack.pop(); left = stack.pop(); if (right - left <= n) continue; mid = left + Math.ceil((right - left) / n / 2) * n; quickselect(arr, mid, left,...
javascript
{ "resource": "" }
q24018
jumpToState
train
function jumpToState () { return ({ merged, nodeId, excludeTypes }) => { state.focusedNodeId = nodeId state.control.merged = merged state.typeFilters.enableInlinable = !merged state.key.enableOptUnopt = !merged // Diff type exclude state to reach the one described by the entry c...
javascript
{ "resource": "" }
q24019
tagNodesWithIds
train
function tagNodesWithIds (data) { let id = 0 const idsToNodes = new Map() const nodesToIds = new Map() tagNodes(data) return { idsToNodes, nodesToIds } function tag (node) { idsToNodes.set(id, node) nodesToIds.set(node, id) id++ } function tagNodes (node) { tag(node) if (...
javascript
{ "resource": "" }
q24020
fixLines
train
function fixLines (line) { // Node 11+ are fine if (nodeMajorV > 10) return line // Work around a bug in Node 10's V8 --preprocess -j that breaks strings containing \\ if (nodeMajorV === 10) { // Look for backslashes that aren't escaping a unicode character code, like \\u01a2 // Small risk of false pos...
javascript
{ "resource": "" }
q24021
padNumbersToEqualLength
train
function padNumbersToEqualLength(arr) { var maxLen = 0; var strings = arr.map(function(n) { var str = n.toString(); maxLen = Math.max(maxLen, str.length); return str; }); return strings.map(function(s) { return common.padLeft(s, maxLen); }); }
javascript
{ "resource": "" }
q24022
strcpy
train
function strcpy(dest, src, offset) { var origDestLen = dest.length; var start = dest.slice(0, offset); var end = dest.slice(offset + src.length); return (start + src + end).substr(0, origDestLen); }
javascript
{ "resource": "" }
q24023
appendLine
train
function appendLine(num, content, prefix) { sb.append(prefix + lineNumbers[num] + ' | ' + content + '\n'); }
javascript
{ "resource": "" }
q24024
Extend
train
function Extend(superGrammar, name, body) { this.superGrammar = superGrammar; this.name = name; this.body = body; var origBody = superGrammar.rules[name].body; this.terms = [body, origBody]; }
javascript
{ "resource": "" }
q24025
ASemantics
train
function ASemantics(matchResult) { if (!(matchResult instanceof MatchResult)) { throw new TypeError( 'Semantics expected a MatchResult, but got ' + common.unexpectedObjToString(matchResult)); } if (matchResult.failed()) { throw new TypeError('cannot apply Semantics to ' + matchResult.t...
javascript
{ "resource": "" }
q24026
Attribute
train
function Attribute(name, actionDict, builtInDefault) { this.name = name; this.formals = []; this.actionDict = actionDict; this.builtInDefault = builtInDefault; }
javascript
{ "resource": "" }
q24027
train
function(what, name, actionDict) { function isSpecialAction(a) { return a === '_iter' || a === '_terminal' || a === '_nonterminal' || a === '_default'; } var problems = []; for (var k in actionDict) { var v = actionDict[k]; if (!isSpecialAction(k) && !(k in this.rules)) { prob...
javascript
{ "resource": "" }
q24028
train
function(str) { var app; if (str.indexOf('<') === -1) { // simple application app = new pexprs.Apply(str); } else { // parameterized application var cst = ohmGrammar.match(str, 'Base_application'); app = buildGrammar(cst, {}); } // Ensure that the application is valid....
javascript
{ "resource": "" }
q24029
train
function(pos, expr) { var posInfo = this.memoTable[pos]; if (posInfo && expr.ruleName) { var memoRec = posInfo.memo[expr.toMemoKey()]; if (memoRec && memoRec.traceEntry) { var entry = memoRec.traceEntry.cloneWithExpr(expr); entry.isMemoized = true; return entry; } }...
javascript
{ "resource": "" }
q24030
train
function(pos, expr, succeeded, bindings) { if (expr instanceof pexprs.Apply) { var app = this.currentApplication(); var actuals = app ? app.args : []; expr = expr.substituteParams(actuals); } return this.getMemoizedTraceEntry(pos, expr) || new Trace(this.input, pos, this.inputSt...
javascript
{ "resource": "" }
q24031
binaryExpression
train
function binaryExpression(first, ops, rest) { if (associativity[ops[0]] === 'L') { const applyLeft = (x, y) => new BinaryExpression(x, ops.shift(), y); return [first].concat(rest).reduce(applyLeft); } else { const applyRight = (x, y) => new BinaryExpression(y, ops.pop(), x); return [first].concat(re...
javascript
{ "resource": "" }
q24032
makeTree
train
function makeTree(left, ops, rights, minPrecedence = 0) { while (ops.length > 0 && precedence[ops[0]] >= minPrecedence) { let op = ops.shift(); let right = rights.shift(); while (ops.length > 0 && (precedence[ops[0]] > precedence[op] || associativity[ops[0]] === 'R' && precedence[ops[0]] === prece...
javascript
{ "resource": "" }
q24033
getInputExcerpt
train
function getInputExcerpt(input, pos, len) { var excerpt = asEscapedString(input.slice(pos, pos + len)); // Pad the output if necessary. if (excerpt.length < len) { return excerpt + common.repeat(' ', len - excerpt.length).join(''); } return excerpt; }
javascript
{ "resource": "" }
q24034
getScriptElementContents
train
function getScriptElementContents(el) { if (!isElement(el)) { throw new TypeError('Expected a DOM Node, got ' + common.unexpectedObjToString(el)); } if (el.type !== 'text/ohm-js') { throw new Error('Expected a script tag with type="text/ohm-js", got ' + el); } return el.getAttribute('src') ? load(el.g...
javascript
{ "resource": "" }
q24035
train
function(that) { if (this.sourceString !== that.sourceString) { throw errors.intervalSourcesDontMatch(); } else if (this.startIdx === that.startIdx && this.endIdx === that.endIdx) { // `this` and `that` are the same interval! return [ ]; } else if (this.startIdx < that.startIdx && th...
javascript
{ "resource": "" }
q24036
train
function(that) { if (this.sourceString !== that.sourceString) { throw errors.intervalSourcesDontMatch(); } assert(this.startIdx >= that.startIdx && this.endIdx <= that.endIdx, 'other interval does not cover this one'); return new Interval(this.sourceString, this....
javascript
{ "resource": "" }
q24037
flattenIterNodes
train
function flattenIterNodes(nodes) { var result = []; for (var i = 0; i < nodes.length; ++i) { if (nodes[i]._node.ctorName === '_iter') { result.push.apply(result, flattenIterNodes(nodes[i].children)); } else { result.push(nodes[i]); } } return result; }
javascript
{ "resource": "" }
q24038
duplicateRuleDeclaration
train
function duplicateRuleDeclaration(ruleName, grammarName, declGrammarName, optSource) { var message = "Duplicate declaration for rule '" + ruleName + "' in grammar '" + grammarName + "'"; if (grammarName !== declGrammarName) { message += " (originally declared in '" + declGrammarName + "')"; } return c...
javascript
{ "resource": "" }
q24039
wrongNumberOfParameters
train
function wrongNumberOfParameters(ruleName, expected, actual, source) { return createError( 'Wrong number of parameters for rule ' + ruleName + ' (expected ' + expected + ', got ' + actual + ')', source); }
javascript
{ "resource": "" }
q24040
wrongNumberOfArguments
train
function wrongNumberOfArguments(ruleName, expected, actual, expr) { return createError( 'Wrong number of arguments for rule ' + ruleName + ' (expected ' + expected + ', got ' + actual + ')', expr.source); }
javascript
{ "resource": "" }
q24041
invalidParameter
train
function invalidParameter(ruleName, expr) { return createError( 'Invalid parameter to rule ' + ruleName + ': ' + expr + ' has arity ' + expr.getArity() + ', but parameter expressions must have arity 1', expr.source); }
javascript
{ "resource": "" }
q24042
log_level_plus
train
function log_level_plus(logLevel) { let index = log_levels.indexOf(logLevel) if (index < 0) { return [] } else { return log_levels.slice(index, log_levels.length) } }
javascript
{ "resource": "" }
q24043
api_act
train
function api_act() { var argsarr = new Array(arguments.length) for (var l = 0; l < argsarr.length; ++l) { argsarr[l] = arguments[l] } var self = this var spec = Common.build_message(self, argsarr, 'reply:f?', self.fixedargs) var msg = spec.msg var reply = spec.reply if (opts.$.de...
javascript
{ "resource": "" }
q24044
api_close
train
function api_close(done) { var seneca = this var safe_done = _.once(function(err) { if (_.isFunction(done)) { return done.call(seneca, err) } }) // don't try to close twice if (seneca.flags.closed) { return safe_done() } seneca.ready(do_close) var close_timeo...
javascript
{ "resource": "" }
q24045
make_private
train
function make_private() { return { stats: { start: Date.now(), act: { calls: 0, done: 0, fails: 0, cache: 0 }, actmap: {} }, actdef: {}, transport: { register: [] }, plugins: {}, ignore_plugins: {} } }
javascript
{ "resource": "" }
q24046
adapter
train
function adapter (context, payload) { var when = payload.when.toString() var kind = pad(payload.kind || '-', 8).toUpperCase() var type = pad(payload.case || '-', 8).toUpperCase() var text = payload.pattern || payload.notice || '-' console.log(when, kind, type, text) }
javascript
{ "resource": "" }
q24047
inward_act_cache
train
function inward_act_cache(ctxt, data) { var so = ctxt.options var meta = data.meta var actid = meta.id var private$ = ctxt.seneca.private$ if (actid != null && so.history.active) { var actdetails = private$.history.get(actid) if (actdetails) { private$.stats.act.cache++ var latest = ac...
javascript
{ "resource": "" }
q24048
getSqSegDist
train
function getSqSegDist(p, p1, p2) { var x = p1.x, y = p1.y, dx = p2.x - x, dy = p2.y - y; if (dx !== 0 || dy !== 0) { var t = ((p.x - x) * dx + (p.y - y) * dy) / (dx * dx + dy * dy); if (t > 1) { x = p2.x; y = p2.y; } else if (t > 0) { ...
javascript
{ "resource": "" }
q24049
simplifyRadialDist
train
function simplifyRadialDist(points, sqTolerance) { var prevPoint = points[0], newPoints = [prevPoint], point; for (var i = 1, len = points.length; i < len; i++) { point = points[i]; if (getSqDist(point, prevPoint) > sqTolerance) { newPoints.push(point); ...
javascript
{ "resource": "" }
q24050
simplifyDouglasPeucker
train
function simplifyDouglasPeucker(points, sqTolerance) { var last = points.length - 1; var simplified = [points[0]]; simplifyDPStep(points, 0, last, sqTolerance, simplified); simplified.push(points[last]); return simplified; }
javascript
{ "resource": "" }
q24051
isExpression
train
function isExpression(node) { switch (node.type) { case Syntax.AssignmentExpression: case Syntax.ArrayExpression: case Syntax.ArrayPattern: case Syntax.BinaryExpression: case Syntax.CallExpression: case Syntax.ConditionalExpression: case Syntax.ClassExpres...
javascript
{ "resource": "" }
q24052
isStatement
train
function isStatement(node) { switch (node.type) { case Syntax.BlockStatement: case Syntax.BreakStatement: case Syntax.CatchClause: case Syntax.ContinueStatement: case Syntax.ClassDeclaration: case Syntax.ClassBody: case Syntax.DirectiveStatement: c...
javascript
{ "resource": "" }
q24053
flattenToString
train
function flattenToString(arr) { var i, iz, elem, result = ''; for (i = 0, iz = arr.length; i < iz; ++i) { elem = arr[i]; result += isArray(elem) ? flattenToString(elem) : elem; } return result; }
javascript
{ "resource": "" }
q24054
toSourceNodeWhenNeeded
train
function toSourceNodeWhenNeeded(generated, node) { if (!sourceMap) { // with no source maps, generated is either an // array or a string. if an array, flatten it. // if a string, just return it if (isArray(generated)) { return flattenToString(gene...
javascript
{ "resource": "" }
q24055
fillArray
train
function fillArray(low, high, step, def) { step = step || 1; var i = [], x; for (x = low; x <= high; x += step) { i[x] = def === undefined ? x : (typeof def === 'function' ? def(x) : def); } return i; }
javascript
{ "resource": "" }
q24056
createData
train
function createData() { var x, y, d = []; for (x = 0; x < 100; x += 1) { d[x] = {}; for (y = 0; y < 20; y += 1) { d[x][y] = y * x; } } return d; }
javascript
{ "resource": "" }
q24057
checkScrollBoxVisibility
train
function checkScrollBoxVisibility() { self.scrollBox.horizontalBarVisible = (self.style.width !== 'auto' && dataWidth > self.scrollBox.width && self.style.overflowX !== 'hidden') || self.style.overflowX === 'scroll'; self.scrollBox.horizontalBoxVisible = dataWidth > s...
javascript
{ "resource": "" }
q24058
createTopic
train
function createTopic(env, callback) { sns.createTopic({ Name: `${params.app}-${env}-${params.event}`, }, function _createTopic(err) { if (err) { console.log(err) } setTimeout(callback, 0) }) }
javascript
{ "resource": "" }
q24059
filter
train
function filter(p) { if (filters.length === 0) return true let predicate = false filters.forEach(section=> { let current = path.join('src', section) if (p.startsWith(current)) { predicate = true } }) return p...
javascript
{ "resource": "" }
q24060
start
train
function start(callback) { let handle = {close(){server.close()}} check(function _check(err, inUse) { if (err) throw err if (inUse) { server = {close(){}} init(callback) } else { server = dynalite({ createTableMs: 0 }).listen(5000, function _server(err) { if (...
javascript
{ "resource": "" }
q24061
start
train
function start(callback) { let {arc} = readArc() let close = x=> !x // if .arc has events and we're not clobbering with ARC_LOCAL flag if (arc.events || arc.queues) { // start a little web server let server = http.createServer(function listener(req, res) { let body = '' req.on('data', chun...
javascript
{ "resource": "" }
q24062
_readArc
train
function _readArc(callback) { let parsed = readArc() arc = parsed.arc inventory(arc, null, function _arc(err, result) { if (err) callback(err) else { pathToCode = result.localPaths callback() } }) }
javascript
{ "resource": "" }
q24063
copy
train
function copy(source, destination, callback) { cp(source, destination, {overwrite: true}, function done(err) { if (err) callback(err) else callback() }) }
javascript
{ "resource": "" }
q24064
listTopics
train
function listTopics(next, done) { let params = next? {NextToken:next} : {} sns.listTopics(params, function _listTopics(err, result) { if (err) { done(err) } else { // keep track of our current iteration let index = 0 let tidy = t=> t.TopicArn.split(':').reverse(...
javascript
{ "resource": "" }
q24065
read
train
function read(callback) { let raw = fs.readFileSync(thing.path).toString() //let json = thing.path.split('.').reverse()[0] === 'json' // TODO add support for role.yaml let policies = JSON.parse(raw).policies callback(null, policies || []) }
javascript
{ "resource": "" }
q24066
removes
train
function removes(result, callback) { let fns = result.AttachedPolicies.map(p=> { return function maybeRemove(callback) { let PolicyArn = p.PolicyArn if (policies.includes(PolicyArn)) { callback() } ...
javascript
{ "resource": "" }
q24067
adds
train
function adds(result, callback) { let fns = policies.map(PolicyArn=> { return function maybeAdd(callback) { iam.attachRolePolicy({ RoleName, PolicyArn }, callback) } })...
javascript
{ "resource": "" }
q24068
_read
train
function _read(callback) { glob(path.join(process.cwd(), pathToCode, '/*'), {dot:true}, callback) }
javascript
{ "resource": "" }
q24069
createIntegration
train
function createIntegration(callback) { setTimeout(function throttle() { let uri = `arn:aws:apigateway:${region}:lambda:path/2015-03-31/functions/${arn}/invocations` // console.log(api) gateway.createIntegration({ ApiId: api.ApiId, IntegrationMethod: 'POST', In...
javascript
{ "resource": "" }
q24070
createRoute
train
function createRoute(result, callback) { setTimeout(function throttle() { gateway.createRoute({ ApiId: api.ApiId, RouteKey, Target: `integrations/${integrationId}` }, callback) }, 1000) }
javascript
{ "resource": "" }
q24071
getBucket
train
function getBucket(env, static) { let staging let production static.forEach(thing=> { if (thing[0] === 'staging') { staging = thing[1] } if (thing[0] === 'production') { production = thing[1] } }) if (env === 'staging') return staging if (env === 'production') return prod...
javascript
{ "resource": "" }
q24072
reads
train
function reads(callback) { parallel({ cert(callback) { acm.listCertificates({}, callback) }, apis(callback) { gw.getRestApis({ limit: 500, }, callback) } }, callback) }
javascript
{ "resource": "" }
q24073
getRecordSetsAndDomains
train
function getRecordSetsAndDomains(result, callback) { HostedZoneId = result.HostedZones.find(i=>i.Name === `${domain}.`).Id parallel({ apis(callback) { gateway.getDomainNames({ limit: 500, }, callback) }, records(callback) { route53.listResour...
javascript
{ "resource": "" }
q24074
stringify
train
function stringify(arc) { let fmtTbl = obj=> { let name = Object.keys(obj)[0] let keys = Object.keys(obj[name]) let result = `${name}\n` keys.forEach(key=> { let val = obj[name][key] result += ` ${key} ${val}\n` }) return result } let str = `@app\n${arc.app[0]}\n` //////////...
javascript
{ "resource": "" }
q24075
_createRole
train
function _createRole(callback) { var iam = new aws.IAM iam.createRole({ AssumeRolePolicyDocument: JSON.stringify({ Version: '2012-10-17', Statement: [{ Sid: '', Effect: 'Allow', Principal: { Service: 'lambda.amazonaws.com' }, Action: 'sts:AssumeRole'...
javascript
{ "resource": "" }
q24076
getName
train
function getName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLambdaName(tuple[1]) return [`${app}-production-${verb}${path}`, `${app}-staging-${verb}${path}`] } else { var path = getLambdaName(tuple) return [`${app}-production-get${path}`, `${app}-sta...
javascript
{ "resource": "" }
q24077
getSystemName
train
function getSystemName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLambdaName(tuple[1]) return `${verb}${path}` } else { var path = getLambdaName(tuple) return `get${path}` } }
javascript
{ "resource": "" }
q24078
getLegacyName
train
function getLegacyName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLegacyLambdaName(tuple[1]) return [`${app}-production-${verb}${path}`, `${app}-staging-${verb}${path}`] } else { var path = getLegacyLambdaName(tuple) return [`${app}-production-get${p...
javascript
{ "resource": "" }
q24079
getLegacySystemName
train
function getLegacySystemName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLegacyLambdaName(tuple[1]) return `${verb}${path}` } else { var path = getLegacyLambdaName(tuple) return `get${path}` } }
javascript
{ "resource": "" }
q24080
getScheduledName
train
function getScheduledName(arr) { var name = arr.slice(0).shift() return [`${app}-production-${name}`, `${app}-staging-${name}`] }
javascript
{ "resource": "" }
q24081
train
function(type, base_class) { if (!base_class.prototype) { throw "Cannot register a simple object, it must be a class with a prototype"; } base_class.type = type; if (LiteGraph.debug) { console.log("Node registered: " + type); }...
javascript
{ "resource": "" }
q24082
train
function( name, func, param_types, return_type, properties ) { var params = Array(func.length); var code = ""; var names = LiteGraph.getParameterNames(func); for (var i = 0; i < names.length; ++i) { ...
javascript
{ "resource": "" }
q24083
train
function(type, title, options) { var base_class = this.registered_node_types[type]; if (!base_class) { if (LiteGraph.debug) { console.log( 'GraphNode type "' + type + '" not registered.' ); } ...
javascript
{ "resource": "" }
q24084
train
function(category, filter) { var r = []; for (var i in this.registered_node_types) { var type = this.registered_node_types[i]; if (filter && type.filter && type.filter != filter) { continue; } if (category == ""...
javascript
{ "resource": "" }
q24085
train
function() { var categories = { "": 1 }; for (var i in this.registered_node_types) { if ( this.registered_node_types[i].category && !this.registered_node_types[i].skip_list ) { categories[this.registered_...
javascript
{ "resource": "" }
q24086
train
function(obj, target) { if (obj == null) { return null; } var r = JSON.parse(JSON.stringify(obj)); if (!target) { return r; } for (var i in r) { target[i] = r[i]; } return tar...
javascript
{ "resource": "" }
q24087
LLink
train
function LLink(id, type, origin_id, origin_slot, target_id, target_slot) { this.id = id; this.type = type; this.origin_id = origin_id; this.origin_slot = origin_slot; this.target_id = target_id; this.target_slot = target_slot; this._data = null; this._pos...
javascript
{ "resource": "" }
q24088
isInsideBounding
train
function isInsideBounding(p, bb) { if ( p[0] < bb[0][0] || p[1] < bb[0][1] || p[0] > bb[1][0] || p[1] > bb[1][1] ) { return false; } return true; }
javascript
{ "resource": "" }
q24089
hex2num
train
function hex2num(hex) { if (hex.charAt(0) == "#") { hex = hex.slice(1); } //Remove the '#' char - if there is one. hex = hex.toUpperCase(); var hex_alphabets = "0123456789ABCDEF"; var value = new Array(3); var k = 0; var int1, int2; for (var i ...
javascript
{ "resource": "" }
q24090
num2hex
train
function num2hex(triplet) { var hex_alphabets = "0123456789ABCDEF"; var hex = "#"; var int1, int2; for (var i = 0; i < 3; i++) { int1 = triplet[i] / 16; int2 = triplet[i] % 16; hex += hex_alphabets.charAt(int1) + hex_alphabets.charAt(int2); } ...
javascript
{ "resource": "" }
q24091
inner_onclick
train
function inner_onclick(e) { var value = this.value; var close_parent = true; if (that.current_submenu) { that.current_submenu.close(e); } //global callback if (options.callback) { var r = options.callback.call( ...
javascript
{ "resource": "" }
q24092
GraphInput
train
function GraphInput() { this.addOutput("", ""); this.name_in_graph = ""; this.properties = {}; var that = this; Object.defineProperty(this.properties, "name", { get: function() { return that.name_in_graph; }, set: function(v) ...
javascript
{ "resource": "" }
q24093
GraphOutput
train
function GraphOutput() { this.addInput("", ""); this.name_in_graph = ""; this.properties = {}; var that = this; Object.defineProperty(this.properties, "name", { get: function() { return that.name_in_graph; }, set: function(v) ...
javascript
{ "resource": "" }
q24094
Sequencer
train
function Sequencer() { this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addOutp...
javascript
{ "resource": "" }
q24095
MathFormula
train
function MathFormula() { this.addInput("x", "number"); this.addInput("y", "number"); this.addOutput("", "number"); this.properties = { x: 1.0, y: 1.0, formula: "x+y" }; this.code_widget = this.addWidget( "text", "F(x,y)", this.propertie...
javascript
{ "resource": "" }
q24096
LGraphTextureScaleOffset
train
function LGraphTextureScaleOffset() { this.addInput("in", "Texture"); this.addInput("scale", "vec2"); this.addInput("offset", "vec2"); this.addOutput("out", "Texture"); this.properties = { offset: vec2.fromValues(0, 0), scale: v...
javascript
{ "resource": "" }
q24097
LGraphExposition
train
function LGraphExposition() { this.addInput("in", "Texture"); this.addInput("exp", "number"); this.addOutput("out", "Texture"); this.properties = { exposition: 1, precision: LGraphTexture.LOW }; this._uniforms = { u_texture: 0, u_exposition: 1 }; }
javascript
{ "resource": "" }
q24098
onDirectory
train
function onDirectory() { var this_SendStream = this; if (!/\/$/.test(reqUrl.pathname)) { // No trailing slash? Redirect to add one res.writeHead(301, { 'Location': reqUrl.pathname + '/' + (reqUrl.search || '') }); res.end(); deferred.resolve(true); r...
javascript
{ "resource": "" }
q24099
error500
train
function error500(req, res, errorText, detail, templateDir, consoleLogFile, appSpec) { fsutil.safeTail_p(consoleLogFile, 8192) .fail(function(consoleLog) { return; }) .then(function(consoleLog) { render.sendPage(res, 500, 'An error has occurred', { template: 'error-500', templateDir: templat...
javascript
{ "resource": "" }