Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
static function to update the 'carsAtEnd' entry in the database > updateCarsAtEnd(rank)
static updateCarsAtEnd(rank){ database.ref('/').update({ carsAtEnd:rank }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static updateCarsAtEnd(rank){\n database.ref('/').update({\n carsAtEnd: rank\n });\n }", "static updateCarsAtEnd(rank){\n database.ref('/').update({\n carsAtEnd:rank\n })\n }", "static updateCarsAtEnd(rank){\r\n\r\n db.ref(\"/\").update({\r\n CarsAtEnd:rank\r\n ...
[ "0.9074518", "0.8931814", "0.88833463", "0.60322756", "0.5811188", "0.56187314", "0.5578218", "0.5319371", "0.52613145", "0.51471174", "0.5140243", "0.49739963", "0.4956345", "0.49151027", "0.4862653", "0.48618132", "0.48310503", "0.47985476", "0.47904608", "0.47698796", "0.4...
0.8921482
2
initialize jquery ui widgets
init() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initWidgetUI() {\n $(\".widget-wrapper\").each(function () {\n var widgetId = extractObjectIdFromElementId($(this).attr(\"id\"));\n styleWidgetButtons(widgetId);\n });\n }", "function jUIInit() {\r\n if (!Lazy.load(_fdk.load.ui, jUIInit)) ret...
[ "0.75740737", "0.73285437", "0.71469045", "0.6872859", "0.66495115", "0.66145164", "0.644699", "0.6390463", "0.63804185", "0.6351126", "0.63376284", "0.6332129", "0.6320515", "0.6313113", "0.6268168", "0.62571985", "0.6216167", "0.62030464", "0.6174131", "0.61708343", "0.6157...
0.0
-1
perform export of password registrations
exportPasswordRegistrations() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "importPasswordRegistrations() {}", "async export (filter) {\n try {\n let passwords = await this.get(filter);\n for (let i = 0; i < passwords.length; i++) {\n delete passwords[i].id;\n delete passwords[i].searchField;\n delete passwords[i]...
[ "0.72531384", "0.6734159", "0.59479034", "0.59293306", "0.5842392", "0.5765355", "0.5763758", "0.55392766", "0.5483543", "0.54703844", "0.5468411", "0.5384414", "0.5354951", "0.5322535", "0.532172", "0.5321072", "0.53195775", "0.53141606", "0.53022575", "0.5297273", "0.529333...
0.85519964
0
perform import of password registrations
importPasswordRegistrations() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "exportPasswordRegistrations() {}", "loadAccounts() {\n let accounts = store.getData( this._accountsKey );\n if ( !Array.isArray( accounts ) || !accounts.length ) return;\n this.importAccounts( accounts, true );\n }", "function ImportData() {\n //in this method we can connect to database or read ou...
[ "0.71750134", "0.5684588", "0.5608808", "0.53307146", "0.53267664", "0.52772063", "0.5261102", "0.524553", "0.5176268", "0.5156221", "0.5144649", "0.5104331", "0.50915545", "0.50792104", "0.5075228", "0.5061108", "0.5060919", "0.5042965", "0.5021013", "0.5003008", "0.498903",...
0.839793
0
Flatten a children object (typically specified as `props.children`) and return an array with appropriately rekeyed children. See
function toArray(children) { var result = []; mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toArrayChildren(children) {\n var ret = [];\n React__default.Children.forEach(children, function (child) {\n ret.push(child);\n });\n return ret;\n }", "function toArray(children){var result=[];mapIntoWithKeyPrefixInternal(children,result,null,function(child){return child;}...
[ "0.775594", "0.7520282", "0.74348474", "0.7408082", "0.7408082", "0.7408082", "0.7408082", "0.7408082", "0.7408082", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74...
0.0
-1
WARNING: DO NOT manually require this module. This is a replacement for `invariant(...)` used by the error code system and will _only_ be required by the corresponding babel pass. It always throws.
function reactProdInvariant(code) { var argCount = arguments.length - 1; var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; for (var argIdx = 0; argIdx < argCount; argIdx++) { message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); } message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; var error = new Error(message); error.name = 'Invariant Violation'; error.framesToPop = 1; // we don't care about reactProdInvariant's own frame throw error; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function invariant(condition,format,a,b,c,d,e,f){if(process.env.NODE_ENV!=='production'){if(format===undefined){throw new Error('invariant requires an error message argument');}}if(!condition){var error;if(format===undefined){error=new Error('Minified exception occurred; use the non-minified dev environment '+'for...
[ "0.7492959", "0.7492959", "0.7264662", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.7220383", "0.72170794", "0.7143818", "0.7143818", "0.7143818", "0.7143818", ...
0.0
-1
Copyright (c) 2013present, Facebook, Inc. All rights reserved. This source code is licensed under the BSDstyle license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory.
function makeEmptyFunction(arg) { return function () { return arg; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() {\n // if this is the first time the home screen is loading\n // we must initialize Facebook\n if (!window.FB) {\n window.fbAsyncInit = function() {\n window.FB.init({\n appId : '280945375708713',\n cookie : true, // enable cookies to allow the s...
[ "0.5606324", "0.54053015", "0.5362759", "0.53557986", "0.5333446", "0.52908176", "0.52908176", "0.5233073", "0.51926816", "0.5186246", "0.5185339", "0.5152006", "0.51346844", "0.5113237", "0.50953215", "0.5080205", "0.50634295", "0.5059636", "0.5039364", "0.5006647", "0.49587...
0.0
-1
Base class helpers for the updating state of a component.
function ReactComponent(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n BaseState.update.call(this);\n }", "_update() {\n // Call subclass lifecycle method\n const stateNeedsUpdate = this.needsUpdate();\n // End lifecycle method\n debug(TRACE_UPDATE, this, stateNeedsUpdate);\n\n if (stateNeedsUpdate) {\n this._updateState();\n }\n }", "func...
[ "0.7217204", "0.67610246", "0.66769236", "0.66106635", "0.6540022", "0.65259355", "0.6489663", "0.64705694", "0.645821", "0.63847154", "0.6354757", "0.63347685", "0.63053316", "0.6304944", "0.62717897", "0.6266675", "0.621649", "0.6214279", "0.6194085", "0.6189877", "0.615812...
0.0
-1
Base class helpers for the updating state of a component.
function ReactPureComponent(props, context, updater) { // Duplicated from ReactComponent. this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n BaseState.update.call(this);\n }", "_update() {\n // Call subclass lifecycle method\n const stateNeedsUpdate = this.needsUpdate();\n // End lifecycle method\n debug(TRACE_UPDATE, this, stateNeedsUpdate);\n\n if (stateNeedsUpdate) {\n this._updateState();\n }\n }", "func...
[ "0.7217204", "0.67610246", "0.66769236", "0.66106635", "0.6540022", "0.65259355", "0.6489663", "0.64705694", "0.645821", "0.63847154", "0.6354757", "0.63347685", "0.63053316", "0.6304944", "0.62717897", "0.6266675", "0.621649", "0.6214279", "0.6194085", "0.6189877", "0.615812...
0.0
-1
Helper function to allow the creation of anonymous functions which do not have .name set to the name of the variable being assigned to.
function identity(fn) { return fn; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function funcName(func) {\n return func.name || \"{anonymous}\"\n }", "function creaClosure(name) {\n return function () {\n console.log(name);\n }\n}", "function nom(fun) {\n var src = fun.toString();\n src = src.substr('function '.length);\n var n = src.substr(0, src.indexOf('...
[ "0.623104", "0.61261266", "0.6084542", "0.6071095", "0.59881675", "0.58369964", "0.57317287", "0.5707706", "0.5692399", "0.5692399", "0.5692399", "0.5692399", "0.5692399", "0.5692399", "0.56864655", "0.5668907", "0.5660514", "0.5651214", "0.56139386", "0.55957097", "0.5586700...
0.0
-1
Mixin helper which handles policy validation and reserved specification keys when building React classes.
function mixSpecIntoComponent(Constructor, spec) { if (!spec) { if ((null) !== 'production') { var typeofSpec = typeof spec; var isMixinValid = typeofSpec === 'object' && spec !== null; (null) !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0; } return; } !(typeof spec !== 'function') ? (null) !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0; !!ReactElement.isValidElement(spec) ? (null) !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0; var proto = Constructor.prototype; var autoBindPairs = proto.__reactAutoBindPairs; // By handling mixins before any other properties, we ensure the same // chaining order is applied to methods with DEFINE_MANY policy, whether // mixins are listed before or after these methods in the spec. if (spec.hasOwnProperty(MIXINS_KEY)) { RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); } for (var name in spec) { if (!spec.hasOwnProperty(name)) { continue; } if (name === MIXINS_KEY) { // We have already handled mixins in a special case above. continue; } var property = spec[name]; var isAlreadyDefined = proto.hasOwnProperty(name); validateMethodOverride(isAlreadyDefined, name); if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { RESERVED_SPEC_KEYS[name](Constructor, property); } else { // Setup methods on prototype: // The following member methods should not be automatically bound: // 1. Expected ReactClass methods (in the "interface"). // 2. Overridden methods (that were mixed in). var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); var isFunction = typeof property === 'function'; var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; if (shouldAutoBind) { autoBindPairs.push(name, property); proto[name] = property; } else { if (isAlreadyDefined) { var specPolicy = ReactClassInterface[name]; // These cases should already be caught by validateMethodOverride. !(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? (null) !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0; // For methods which are defined more than once, call the existing // methods before calling the new property, merging if appropriate. if (specPolicy === 'DEFINE_MANY_MERGED') { proto[name] = createMergedResultFunction(proto[name], property); } else if (specPolicy === 'DEFINE_MANY') { proto[name] = createChainedFunction(proto[name], property); } } else { proto[name] = property; if ((null) !== 'production') { // Add verbose displayName to the function, which helps when looking // at profiling tools. if (typeof property === 'function' && spec.displayName) { proto[name].displayName = spec.displayName + '_' + name; } } } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_validate() {\n throw new Error('_validate not implemented in child class');\n }", "function jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, true);\n }\n}", "function jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props...
[ "0.5326749", "0.5076963", "0.5076963", "0.5059135", "0.50286794", "0.50286794", "0.50002414", "0.50002414", "0.50002414", "0.50002414", "0.50002414", "0.50002414", "0.50002414", "0.50002414", "0.50002414", "0.50002414", "0.50002414", "0.49992508", "0.4959277", "0.4959277", "0...
0.0
-1
v8 likes predictible objects
function Item(fun, array) { this.fun = fun; this.array = array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareLike(a,b){\n var al = a.idLikesProp.length;\n var bl = b.idLikesProp.length;\n if(al > bl) return -1;\n if(bl > al) return 1;\n return 0;\n}", "function lookAround() {\n var objectDescription = \"\"\n tj.see().then(function(objects) {\n objects.forEach(function(each) {\n ...
[ "0.527866", "0.52612406", "0.51951283", "0.518796", "0.51302594", "0.5044646", "0.48934332", "0.4857401", "0.484017", "0.48302925", "0.482028", "0.4812441", "0.4808473", "0.47852293", "0.47828078", "0.47574478", "0.47493434", "0.4739314", "0.47239366", "0.4703992", "0.4703992...
0.0
-1
inlined Object.is polyfill to avoid requiring consumers ship their own /eslintdisable noselfcompare
function is(x, y) { // SameValue algorithm if (x === y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y; } else { // Step 6.a: NaN == NaN return x !== x && y !== y; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isObject$1(obj) {\n // incase of arrow function and array\n return Object(obj) === obj && String(obj) === '[object Object]' && !isFunction(obj) && !isArray(obj);\n }", "function isObject$1(obj) {\n ...
[ "0.6731362", "0.6633782", "0.6609513", "0.6599949", "0.6599775", "0.6565226", "0.6506394", "0.64681304", "0.6463561", "0.641157", "0.6370518", "0.63660806", "0.63660806", "0.63660806", "0.63660806", "0.6357975", "0.6327474", "0.6323051", "0.63226765", "0.6296809", "0.6296809"...
0.0
-1
Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return 'array'; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return 'object'; } if (isSymbol(propType, propValue)) { return 'symbol'; } return propType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sc_typeof( x ) {\n return typeof x;\n}", "static type(arg)\n {\n const types = [\n 'array', 'boolean', 'function', 'number',\n 'null', 'object', 'regexp', 'symbol', 'string',\n 'undefined'\n ]\n\n var type = Object.prototype.toString.call(arg),\...
[ "0.6910223", "0.6775289", "0.6609952", "0.65395606", "0.64953166", "0.6490504", "0.6490504", "0.64504206", "0.64504206", "0.6430276", "0.6429547", "0.64052975", "0.64052975", "0.6397319", "0.6397319", "0.6397319", "0.6397319", "0.6397319", "0.6397319", "0.6397319", "0.6397319...
0.0
-1
This handles more types than `getPropType`. Only used for error messages. See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) { if (typeof propValue === 'undefined' || propValue === null) { return '' + propValue; } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPropType(propValue) {\n\t\t var propType = typeof propValue;\n\t\t if (Array.isArray(propValue)) {\n\t\t return 'array';\n\t\t }\n\t\t if (propValue instanceof RegExp) {\n\t\t // Old webkits (at least until Android 4.0) return 'function' rather than\n\t\t // 'object' for type...
[ "0.6876632", "0.68532825", "0.68532825", "0.68532825", "0.68532825", "0.68521523", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517"...
0.0
-1
Returns a string that is postfixed to a warning about an invalid type. For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) { var type = getPreciseType(value); switch (type) { case 'array': case 'object': return 'an ' + type; case 'boolean': case 'date': case 'regexp': return 'a ' + type; default: return type; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _undefinedCoerce() {\n return '';\n}", "function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case \"array\":\n case \"object\":\n return \"an \" + type;\n case \"boolean\":\n ...
[ "0.65988296", "0.6565237", "0.6559532", "0.6559532", "0.6559532", "0.6559532", "0.6522337", "0.65215486", "0.65060395", "0.65060395", "0.65060395", "0.65060395", "0.65060395", "0.65013695", "0.6489755", "0.6453345", "0.6453345", "0.6453345", "0.6453345", "0.6453345", "0.64533...
0.6477735
44
Returns class name of the object, if any.
function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { return ANONYMOUS; } return propValue.constructor.name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getClassName(obj) {\n var funcNameRegex = /function\\s+(.+?)\\s*\\(/;\n var results = funcNameRegex.exec(obj['constructor'].toString());\n return (results && results.length > 1) ? results[1] : '';\n }", "getClassName() {\n return this.constructor\n .className;\n...
[ "0.7730571", "0.74697196", "0.74697196", "0.74258965", "0.7164231", "0.71448183", "0.7083163", "0.7080694", "0.6995368", "0.6971116", "0.6901662", "0.6883398", "0.67147285", "0.66557264", "0.6639163", "0.6611592", "0.6611592", "0.6611592", "0.6611592", "0.6600893", "0.6599787...
0.0
-1
The Buffer constructor returns instances of `Uint8Array` that have their prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of `Uint8Array`, so the returned instances will have all the node `Buffer` methods and the `Uint8Array` methods. Square bracket notation works as expected it returns a single octet. The `Uint8Array` prototype remains unmodified.
function Buffer (arg, encodingOrOffset, length) { if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { return new Buffer(arg, encodingOrOffset, length) } // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new Error( 'If encoding is specified then the first argument must be a string' ) } return allocUnsafe(this, arg) } return from(this, arg, encodingOrOffset, length) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "toB...
[ "0.7354607", "0.7354607", "0.7354607", "0.7354607", "0.6974044", "0.68936193", "0.68936193", "0.68496907", "0.68496907", "0.68496907", "0.68496907", "0.68496907", "0.68496907", "0.68496907", "0.6839512", "0.6839512", "0.6839512", "0.6839512", "0.6839512", "0.6839512", "0.6839...
0.0
-1
Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, OR the last index of `val` in `buffer` at offset <= `byteOffset`. Arguments: buffer a Buffer to search val a string, Buffer, or number byteOffset an index into `buffer`; will be clamped to an int32 encoding an optional encoding, relevant is val is a string dir true for indexOf, false for lastIndexOf
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (isNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){// Empty buffer means no match\n if(buffer.length===0)return -1;// Normalize byteOffset\n if(typeof byteOffset==='string'){encoding=byteOffset;byteOffset=0;}else if(byteOffset>0x7fffffff){byteOffset=0x7fffffff;}else if(byteOffset<-0x80000000){byte...
[ "0.82823086", "0.8254614", "0.8254614", "0.82530254", "0.82530254", "0.82530254", "0.82530254", "0.82530254", "0.82530254", "0.82530254", "0.82530254", "0.824807", "0.8245907", "0.8244159", "0.8244159", "0.82278013", "0.82197213", "0.8218354", "0.8218354", "0.8218354", "0.821...
0.0
-1
Need to make sure that buffer isn't trying to write out of bounds.
function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "ensure(n) {\n let minsize = this.pos + n;\n if (minsize > this.capacity) {\n let cap = this.capacity * 2;\n w...
[ "0.66712785", "0.66712785", "0.6632945", "0.65210676", "0.63827264", "0.62754023", "0.62562263", "0.62335545", "0.62335545", "0.61056054", "0.6035937", "0.6017502", "0.59810936", "0.5959609", "0.5948556", "0.59404105", "0.59404105", "0.59404105", "0.5934013", "0.5929776", "0....
0.5951102
72
Fully qualified element name, e.g. returns "svg:path"
function getQualifiedElementName(elementName) { var qualifiedName; switch (elementName.type) { case jsx_syntax_1.JSXSyntax.JSXIdentifier: var id = (elementName); qualifiedName = id.name; break; case jsx_syntax_1.JSXSyntax.JSXNamespacedName: var ns = (elementName); qualifiedName = getQualifiedElementName(ns.namespace) + ':' + getQualifiedElementName(ns.name); break; case jsx_syntax_1.JSXSyntax.JSXMemberExpression: var expr = (elementName); qualifiedName = getQualifiedElementName(expr.object) + '.' + getQualifiedElementName(expr.property); break; } return qualifiedName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getQualifiedElementName(elementName) {\n\t var qualifiedName;\n\t switch (elementName.type) {\n\t case jsx_syntax_1.JSXSyntax.JSXIdentifier:\n\t var id = (elementName);\n\t qualifiedName = id.name;\n\t break;\n\t case jsx_syntax_1.JSXSyntax.JSXNamespace...
[ "0.72543544", "0.72495854", "0.7230725", "0.7225359", "0.7225359", "0.7225359", "0.7225359", "0.72132176", "0.72113883", "0.6702878", "0.61897784", "0.61897784", "0.61262274", "0.6123173", "0.575144", "0.5736171", "0.5686173", "0.5678697", "0.5673583", "0.5633859", "0.5633859...
0.72124815
10
Indents every line in a string. Empty lines (\n only) are not indented.
function indentString(string, spaces) { var ind = common.repeat(' ', spaces), position = 0, next = -1, result = '', line, length = string.length; while (position < length) { next = string.indexOf('\n', position); if (next === -1) { line = string.slice(position); position = length; } else { line = string.slice(position, next + 1); position = next + 1; } if (line.length && line !== '\n') result += ind; result += line; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function indentString$1(string, spaces) {\n var ind = common$5.repeat(' ', spaces),\n position = 0,\n next = -1,\n result = '',\n line,\n length = string.length;\n\n while (position < length) {\n next = string.indexOf('\\n', position);\n if (next === -1) {\n line = string.slic...
[ "0.6785153", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "0.6737852", "...
0.6650095
27
[33] swhite ::= sspace | stab
function isWhitespace(c) { return c === CHAR_SPACE || c === CHAR_TAB; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function white() {\r\n var c = walker.ch,\r\n token = '';\r\n \r\n while (c === \" \" || c === \"\\t\") {\r\n token += c;\r\n c = walker.nextChar();\r\n }\r\n \r\n tokener(token, 'white');\r\n \r\n }", "function matchWhite() {\n\t\tvar pattern = /^(\\s|\\n|\\t)/;\n\t\tvar x = lexSt...
[ "0.72004145", "0.63212115", "0.6066105", "0.60660726", "0.60660726", "0.6038587", "0.597847", "0.59019464", "0.59019464", "0.5816713", "0.5816713", "0.5816713", "0.5816182", "0.57565314", "0.57493216", "0.5690716", "0.5690716", "0.56494665", "0.55240345", "0.54573727", "0.545...
0.52789366
37
Simplified test for values allowed after the first character in plain style.
function isPlainSafe(c) { // Uses a subset of nb-char - c-flow-indicator - ":" - "#" // where nb-char ::= c-printable - b-char - c-byte-order-mark. return isPrintable(c) && c !== 0xFEFF // - c-flow-indicator && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET // - ":" - "#" && c !== CHAR_COLON && c !== CHAR_SHARP; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isPlainSafeFirst(c) {\n // Uses a subset of ns-char - c-indicator\n // where ns-char = nb-char - s-white.\n return isPrintable(c) && c !== 0xFEFF\n && !isWhitespace(c) // - s-white\n // - (c-indicator ::=\n // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”\n && c !== CHAR_MINUS\n && c !==...
[ "0.6714688", "0.6714688", "0.6714688", "0.6714688", "0.6714688", "0.6714688", "0.6714688", "0.6714688", "0.6714688", "0.6708685", "0.6708685", "0.6708685", "0.6672289", "0.6672289", "0.6672289", "0.6672289", "0.6672289", "0.6672289", "0.6672289", "0.6672289", "0.6672289", "...
0.0
-1
Simplified test for values allowed as the first character in plain style.
function isPlainSafeFirst(c) { // Uses a subset of ns-char - c-indicator // where ns-char = nb-char - s-white. return isPrintable(c) && c !== 0xFEFF && !isWhitespace(c) // - s-white // - (c-indicator ::= // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET // | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"” && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE // | “%” | “@” | “`”) && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isPlainSafeFirst(c) {\n // Uses a subset of ns-char - c-indicator\n // where ns-char = nb-char - s-white.\n return isPrintable(c) && c !== 0xFEFF\n && !isWhitespace(c) // - s-white\n // - (c-indicator ::=\n // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”\n && c !== CHAR_MINUS\n && c !==...
[ "0.69060594", "0.69060594", "0.69060594", "0.69060594", "0.69060594", "0.69060594", "0.69060594", "0.69060594", "0.69060594", "0.68719757", "0.68719757", "0.68719757", "0.68719757", "0.68719757", "0.68719757", "0.68719757", "0.68719757", "0.68719757", "0.68719757", "0.68719757"...
0.6874973
11
Determines which scalar styles are possible and returns the preferred style. lineWidth = 1 => no limit. Preconditions: str.length > 0. Postconditions: STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. STYLE_LITERAL => no lines are suitable for folding (or lineWidth is 1). STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != 1).
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { var i; var char; var hasLineBreak = false; var hasFoldableLine = false; // only checked if shouldTrackWidth var shouldTrackWidth = lineWidth !== -1; var previousLineBreak = -1; // count the first line correctly var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1)); if (singleLineOnly) { // Case: no block styles. // Check for disallowed characters to rule out plain and single. for (i = 0; i < string.length; i++) { char = string.charCodeAt(i); if (!isPrintable(char)) { return STYLE_DOUBLE; } plain = plain && isPlainSafe(char); } } else { // Case: block styles permitted. for (i = 0; i < string.length; i++) { char = string.charCodeAt(i); if (char === CHAR_LINE_FEED) { hasLineBreak = true; // Check if any line can be folded. if (shouldTrackWidth) { hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented. (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' '); previousLineBreak = i; } } else if (!isPrintable(char)) { return STYLE_DOUBLE; } plain = plain && isPlainSafe(char); } // in case the end is missing a \n hasFoldableLine = hasFoldableLine || (shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' ')); } // Although every style can represent \n without escaping, prefer block styles // for multiline, since they're more readable and they don't add empty lines. // Also prefer folding a super-long line. if (!hasLineBreak && !hasFoldableLine) { // Strings interpretable as another type have to be quoted; // e.g. the string 'true' vs. the boolean true. return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE; } // Edge case: block indentation indicator can only have one digit. if (string[0] === ' ' && indentPerLevel > 9) { return STYLE_DOUBLE; } // At this point we know block styles are valid. // Prefer literal style unless we want to fold. return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {\n var i;\n var char, prev_char;\n var hasLineBreak = false;\n var hasFoldableLine = false; // only checked if shouldTrackWidth\n var shouldTrackWidth = lineWidth !== -1;\n var previousLineBreak = -1; // count t...
[ "0.76289934", "0.76289934", "0.76289934", "0.76289934", "0.76289934", "0.76289934", "0.76289934", "0.76289934", "0.76289934", "0.7589788", "0.7589788", "0.7589788", "0.7589788", "0.7589788", "0.7589788", "0.7589788", "0.7589788", "0.7589788", "0.7589788", "0.7589788", "0.7555...
0.7569587
22
Preconditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
function blockHeader(string, indentPerLevel) { var indentIndicator = (string[0] === ' ') ? String(indentPerLevel) : ''; // note the special case: the string '\n' counts as a "trailing" empty line. var clip = string[string.length - 1] === '\n'; var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); var chomp = keep ? '+' : (clip ? '' : '-'); return indentIndicator + chomp + '\n'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function blockStringValue(rawString) {\n // Expand a block string's raw value into independent lines.\n var lines = rawString.split(/\\r\\n|[\\n\\r]/g); // Remove common indentation from all lines but first.\n\n var commonIndent = null;\n\n for (var i = 1; i < lines.length; i++) {\n var line = lines[i];\n ...
[ "0.61728823", "0.61728823", "0.6095264", "0.60879904", "0.60751706", "0.607021", "0.6069991", "0.6067153", "0.6067153", "0.6067153", "0.6067153", "0.6067153", "0.6058868", "0.6058868", "0.602628", "0.60203415", "0.60155505", "0.5995585", "0.5971955", "0.59654516", "0.59636676...
0.6040288
16
(See the note for writeScalar.)
function dropEndingNewline(string) { return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scalarScalar(a, b) {\n\t var x = a + b\n\t var bv = x - a\n\t var av = x - bv\n\t var br = b - bv\n\t var ar = a - av\n\t var y = ar + br\n\t if(y) {\n\t return [y, x]\n\t }\n\t return [x]\n\t}", "function scalarScalar(a, b) {\n\t var x = a + b\n\t var bv = x - a\n\t var av = x - bv\n\t ...
[ "0.57324404", "0.57324404", "0.57324404", "0.57324404", "0.57324404", "0.57324404", "0.57324404", "0.57324404", "0.57324404", "0.57324404", "0.5670208", "0.5642623", "0.56310874", "0.5620793", "0.5614877", "0.5605067", "0.5533351", "0.55127835", "0.5507258", "0.5507258", "0.5...
0.0
-1
Note: a long line without a suitable break point will exceed the width limit. Preconditions: every char in str isPrintable, str.length > 0, width > 0.
function foldString(string, width) { // In folded style, $k$ consecutive newlines output as $k+1$ newlines— // unless they're before or after a more-indented line, or at the very // beginning or end, in which case $k$ maps to $k$. // Therefore, parse each chunk as newline(s) followed by a content line. var lineRe = /(\n+)([^\n]*)/g; // first line (possibly an empty line) var result = (function () { var nextLF = string.indexOf('\n'); nextLF = nextLF !== -1 ? nextLF : string.length; lineRe.lastIndex = nextLF; return foldLine(string.slice(0, nextLF), width); }()); // If we haven't reached the first content line yet, don't add an extra \n. var prevMoreIndented = string[0] === '\n' || string[0] === ' '; var moreIndented; // rest of the lines var match; while ((match = lineRe.exec(string))) { var prefix = match[1], line = match[2]; moreIndented = (line[0] === ' '); result += prefix + (!prevMoreIndented && !moreIndented && line !== '' ? '\n' : '') + foldLine(line, width); prevMoreIndented = moreIndented; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wordWrap(str, width) {\n\t\tif (str.length <= width) return str;\n\t\tvar count = 0;\n\t\tvar newStr = [];\n\t\tfor (const char of str) {\n\t\t\tcount++;\n\t\t\tif (char === \"\\n\") {\n\t\t\t\tnewStr.push(char);\n\t\t\t\tcount = 0;\n\t\t\t} else if (count >= width) {\n\t\t\t\tnewStr.push(char + \"\\n\");...
[ "0.6729785", "0.6500183", "0.640271", "0.63876516", "0.62888646", "0.6250549", "0.62336147", "0.62336147", "0.62336147", "0.61823726", "0.61823726", "0.61823726", "0.61823726", "0.61823726", "0.61823726", "0.61823726", "0.61823726", "0.61823726", "0.61823726", "0.61823726", "...
0.546944
64
Greedy line breaking. Picks the longest line under the limit each time, otherwise settles for the shortest line over the limit. NB. Moreindented lines cannot be folded, as that would add an extra \n.
function foldLine(line, width) { if (line === '' || line[0] === ' ') return line; // Since a more-indented line adds a \n, breaks can't be followed by a space. var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. var match; // start is an inclusive index. end, curr, and next are exclusive. var start = 0, end, curr = 0, next = 0; var result = ''; // Invariants: 0 <= start <= length-1. // 0 <= curr <= next <= max(0, length-2). curr - start <= width. // Inside the loop: // A match implies length >= 2, so curr and next are <= length-2. while ((match = breakRe.exec(line))) { next = match.index; // maintain invariant: curr - start <= width if (next - start > width) { end = (curr > start) ? curr : next; // derive end <= length-2 result += '\n' + line.slice(start, end); // skip the space that was output as \n start = end + 1; // derive start <= length-1 } curr = next; } // By the invariants, start <= length-1, so there is something left over. // It is either the whole string or a part starting from non-whitespace. result += '\n'; // Insert a break if the remainder is too long and there is a break available. if (line.length - start > width && curr > start) { result += line.slice(start, curr) + '\n' + line.slice(curr + 1); } else { result += line.slice(start); } return result.slice(1); // drop extra \n joiner }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_maxLineHack() {\n var display = this.cm.display, curOp = this.cm.curOp;\n const CLEARANCE = 3; /* space added to the right, in characters */\n display.maxLineChanged = false;\n if (curOp) {\n curOp.updateMaxLine = false;\n curOp.adjustWidthTo = (display.maxLine.t...
[ "0.6190599", "0.61574274", "0.61344916", "0.60757965", "0.59439456", "0.59056413", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275", "0.59042275",...
0.59049755
8
Escapes a doublequoted string.
function escapeString(string) { var result = ''; var char; var escapeSeq; for (var i = 0; i < string.length; i++) { char = string.charCodeAt(i); escapeSeq = ESCAPE_SEQUENCES[char]; result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function escapeDoubleQuotes(text) {\n\treturn text.replace(/\"/g, '\\\\\"');\n}", "function esc(v) { return \"\\\"\" + v.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\") + \"\\\"\"; }", "function esc(v) { return \"\\\"\" + v.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\") + \"\\\"\"; }",...
[ "0.7508567", "0.73971397", "0.73971397", "0.73971397", "0.73971397", "0.7339319", "0.73259073", "0.7322143", "0.7150075", "0.7150075", "0.7150075", "0.7150075", "0.7150075", "0.7150075", "0.7150075", "0.7150075", "0.7150075", "0.7150075", "0.7150075", "0.7150075", "0.7150075"...
0.0
-1
Serializes `object` and writes it to global `result`. Returns true on success, or false on invalid object.
function writeNode(state, level, object, block, compact, iskey) { state.tag = null; state.dump = object; if (!detectType(state, object, false)) { detectType(state, object, true); } var type = _toString.call(state.dump); if (block) { block = (state.flowLevel < 0 || state.flowLevel > level); } var objectOrArray = type === '[object Object]' || type === '[object Array]', duplicateIndex, duplicate; if (objectOrArray) { duplicateIndex = state.duplicates.indexOf(object); duplicate = duplicateIndex !== -1; } if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { compact = false; } if (duplicate && state.usedDuplicates[duplicateIndex]) { state.dump = '*ref_' + duplicateIndex; } else { if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { state.usedDuplicates[duplicateIndex] = true; } if (type === '[object Object]') { if (block && (Object.keys(state.dump).length !== 0)) { writeBlockMapping(state, level, state.dump, compact); if (duplicate) { state.dump = '&ref_' + duplicateIndex + state.dump; } } else { writeFlowMapping(state, level, state.dump); if (duplicate) { state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; } } } else if (type === '[object Array]') { if (block && (state.dump.length !== 0)) { writeBlockSequence(state, level, state.dump, compact); if (duplicate) { state.dump = '&ref_' + duplicateIndex + state.dump; } } else { writeFlowSequence(state, level, state.dump); if (duplicate) { state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; } } } else if (type === '[object String]') { if (state.tag !== '?') { writeScalar(state, state.dump, level, iskey); } } else { if (state.skipInvalid) return false; throw new YAMLException('unacceptable kind of an object to dump ' + type); } if (state.tag !== null && state.tag !== '?') { state.dump = '!<' + state.tag + '> ' + state.dump; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "stringify(object) {\n return JSON.stringify(object)\n }", "function serialize(object, options = {}) {\n // Unpack the options\n const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;\n const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? o...
[ "0.55372435", "0.550772", "0.5396421", "0.5378927", "0.53609836", "0.5304392", "0.5290606", "0.5290606", "0.5266007", "0.52468634", "0.5243715", "0.5241914", "0.523814", "0.5174504", "0.5168797", "0.5143203", "0.51339746", "0.51178324", "0.51143724", "0.51099664", "0.5109823"...
0.0
-1
called when the client connects
function onConnect() { // Once a connection has been made, make a subscription and send a message. console.log("Conectado..."); client.subscribe("licha_05reyes@outlook.com/IoT"); enviarInfo("00:00/00:00/0/0/0/0") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onConnect() {\n // Once a connection has been made, make a subscription and send a message.\n console.log(\"onConnect\");\n client.subscribe(SUBSCRIBER);\n }", "clientConnected() {\n super.clientConnected('connected', this.wasConnected);\n\n this.state = 'connected';\n t...
[ "0.7953843", "0.7779623", "0.7695985", "0.76530504", "0.76097023", "0.76057947", "0.7550192", "0.7486288", "0.74651325", "0.7456237", "0.743651", "0.74294996", "0.7360504", "0.7349641", "0.733722", "0.7330392", "0.73156106", "0.73113114", "0.72769135", "0.7256924", "0.7246945...
0.71716374
25
called when the client loses its connection
function onConnectionLost(responseObject) { if (responseObject.errorCode !== 0) { console.log("onConnectionLost:"+responseObject.errorMessage); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clientDisconnect() {\r\n delete clients[connection.remoteAddress];\r\n console.log('connection closed: ' + remoteAddress + \" \" + now.getHours() + \":\" + now.getMinutes() + \":\" + now.getSeconds());\r\n\r\n\r\n }", "handleDisconnect() {\n\t\tdebug(\n\t\t\t'warn: ' + ((this.fromServer)?'server'...
[ "0.74930704", "0.74448484", "0.7402352", "0.73521984", "0.73293084", "0.7301868", "0.7283165", "0.71935105", "0.71685475", "0.7131784", "0.7131624", "0.71083176", "0.70932055", "0.7084353", "0.706098", "0.706098", "0.706098", "0.706098", "0.706098", "0.706098", "0.7057529", ...
0.6897006
40
called when a message arrives
function onMessageArrived(message) { Mensaje=message.payloadString; console.log(Mensaje); Datos=Mensaje.split("/"); if(CntAc==0 || Datos[0]=="0"){ ActuHoras(); } if(Datos[3]=="1"){ location.reload(); } if(Datos[0]=="2"){ AcAlarm(); } if(Datos[0]=="3"){ DsAlarm(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onMessageReceive() {}", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "onMessage() {}", "onMessage() {}", "function onMessageArrived(message) {\n console.log(\"onMessageArrived:\" + message.payloadString);\n write(message.payloadString);\n}"...
[ "0.7934939", "0.7763872", "0.7763872", "0.7763872", "0.7689599", "0.7689599", "0.7681036", "0.76184124", "0.75249606", "0.745653", "0.7440115", "0.74297774", "0.74297774", "0.7408812", "0.7395323", "0.7392582", "0.73652905", "0.7332422", "0.7319002", "0.73102856", "0.72710824...
0.0
-1
Erase ao Trades in this Trade collection.
erase () { this._trades = [] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vaciarTabla() {\n pedidos = [];\n console.table(pedidos);\n let filasTabla = document.querySelectorAll(\"tr\");\n for (const fila of filasTabla) {\n if (fila.parentElement.tagName != \"THEAD\") {\n fila.remove();\n }\n };\n}", "function ClearPets(tx)\n {\n tx....
[ "0.49750566", "0.4939237", "0.49219763", "0.48971927", "0.482155", "0.47894225", "0.47814706", "0.47780558", "0.47780558", "0.47748727", "0.47621617", "0.4754298", "0.4731334", "0.47270605", "0.47022036", "0.46886954", "0.4684073", "0.4658007", "0.46427694", "0.4639909", "0.4...
0.6342356
0
Entry point of the application. Initializes application and root controller.
function main($locale, $rootScope, $state, gettextCatalog, _, config, restService) { /* * Root view model */ var vm = $rootScope; vm.pageTitle = ''; /** * Utility method to set the language in the tools requiring it. * @param {string=} language The IETF language tag. */ vm.setLanguage = function(language) { var isSupportedLanguage = _.includes(config.supportedLanguages, language); // Fallback if language is not supported if (!isSupportedLanguage) { language = 'en-US'; } // Configure translation with gettext gettextCatalog.setCurrentLanguage(language); $locale.id = language; }; /** * Updates page title on view change. */ vm.$on('$stateChangeSuccess', function(event, toState) { updatePageTitle(toState.data ? toState.data.title : null); }); /** * Updates page title on language change. */ vm.$on('gettextLanguageChanged', function() { updatePageTitle($state.current.data ? $state.current.data.title : null); }); init(); /* * Internal */ /** * Initializes the root controller. */ function init() { // Enable debug mode for translations gettextCatalog.debug = config.debug; vm.setLanguage(); // Set REST server configuration restService.setServer(config.server); } /** * Updates the page title. * @param {?string=} stateTitle Title of current state, to be translated. */ function updatePageTitle(stateTitle) { vm.pageTitle = gettextCatalog.getString('APP_NAME'); if (stateTitle) { vm.pageTitle += ' | ' + gettextCatalog.getString(stateTitle); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initApp() {\n var router = new App.Router();\n var dispatcher = new App.Dispatcher();\n\n router.once('route', function() {\n dispatcher.runAction(router.getCurrent(), router.getParams());\n });\n\n // Start!\n router.startHistory();\n}", "function App() {\n this.modules = [];\n this.regi...
[ "0.72947985", "0.69416183", "0.67816734", "0.67768127", "0.6771486", "0.6764282", "0.6646097", "0.6622697", "0.66225916", "0.6608968", "0.6599007", "0.6572146", "0.6571959", "0.65490323", "0.65428644", "0.65390587", "0.6525109", "0.6523272", "0.64985085", "0.6498294", "0.6493...
0.0
-1
Internal Initializes the root controller.
function init() { // Enable debug mode for translations gettextCatalog.debug = config.debug; vm.setLanguage(); // Set REST server configuration restService.setServer(config.server); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initController() {\n }", "function init() {\r\n // Set up the items that are needed for the controller to run\r\n }", "function _init() {\r\n // set page <title>\r\n Metadata.set(home.title);\r\n\r\n // activate controller\r\n _activate();\r\n }", "fun...
[ "0.7166787", "0.6978194", "0.68359095", "0.6821147", "0.6821147", "0.6752873", "0.6736488", "0.6677995", "0.6654134", "0.6626815", "0.66144764", "0.66068155", "0.6536285", "0.6509831", "0.6477127", "0.63682604", "0.6340987", "0.63065064", "0.61915165", "0.6143441", "0.6113776...
0.6088078
24
constructor(n, m) creat matrix structure
constructor(n, m) { this.n = n; this.m = m; this.numerator = new Array(this.n); this.denominator = new Array(this.n); this.b_numerator = new Array(this.n); this.b_denominator = new Array(this.n); this.f_numerator = new Array(this.m); this.f_denominator = new Array(this.m); this.free = new Array(this.m); this.basis = new Array(this.n); // blanc matrix for (let i=0; i<this.n; i++) { this.numerator[i] = new Array(this.m); this.denominator[i] = new Array(this.m); for (let j=0; j<this.m; j++) { this.numerator[i][j] = 0; this.denominator[i][j] = 1; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Matrix(m, n, d){\r\n\t\tvar matrix = [];\r\n\t\tfor(var i=0; i<m; i++) {\r\n\t\t\tmatrix[i] = [];\r\n\t\t\tfor(var j=0; j<n; j++) {\r\n\t\t\t\tmatrix[i][j] = d;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn matrix;\r\n\t}", "function matrix(N){}", "function matrix(n,m) { \n var mat = [];\n for (i=0; i<n;...
[ "0.74334323", "0.7279109", "0.71957594", "0.6983252", "0.69770235", "0.6799219", "0.67969155", "0.6784135", "0.67557174", "0.6726362", "0.6604406", "0.65827024", "0.6580861", "0.6571703", "0.65412676", "0.65048116", "0.6502806", "0.6488561", "0.6444766", "0.6420442", "0.64094...
0.69148535
5
method load_1(prices, counts, values) load constraints to matrix task: minimal items quantity
load_1(prices, counts, values) { // maximum numbers of items constraints for (let i=0; i<this.m; i++) { this.numerator[i][i] = 1; this.b_numerator[i] = counts[i]; this.b_denominator[i] = 1; this.f_numerator[i] = -1; this.f_denominator[i] = 1; this.free[i] = i; } let sum = profit(counts, values); // price constraints for (let i=0; i<prices.length; i++) { for (let j=0; j<values.length; j++) { this.numerator[this.m+i][j] = -prices[i][j] -values[j]; } this.b_numerator[this.m+i] = -sum; this.b_denominator[this.m+i] = 1; } for (let i=0; i<this.n; i++) this.basis[i] = this.m + i; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "load_2(prices, counts, values) {\n\t\t\n\t\t// maximum numbers of items constraints\n\t\tfor (let i=0; i<this.m; i++) {\n\t\t\tthis.numerator[i][i] = 1;\n\t\t\tthis.b_numerator[i] = counts[i];\n\t\t\tthis.b_denominator[i] = 1;\n\t\t\tthis.f_numerator[i] = -values[i];\n\t\t\tthis.f_denominator[i] = 1;\n\t\t\tthis.f...
[ "0.7436233", "0.5007667", "0.48850378", "0.48850378", "0.48151737", "0.48151737", "0.46928835", "0.46863848", "0.46811303", "0.46191847", "0.46044996", "0.46040934", "0.45997486", "0.45981693", "0.4568527", "0.4564258", "0.4528504", "0.45222667", "0.45198417", "0.45140848", "...
0.78625685
0
method load_2(prices, counts, values) load constraints to matrix task: miximal profit
load_2(prices, counts, values) { // maximum numbers of items constraints for (let i=0; i<this.m; i++) { this.numerator[i][i] = 1; this.b_numerator[i] = counts[i]; this.b_denominator[i] = 1; this.f_numerator[i] = -values[i]; this.f_denominator[i] = 1; this.free[i] = i; } let sum = profit(counts, values); sum = Math.floor(sum/2); // price constraints for (let i=0; i<prices.length; i++) { for (let j=0; j<values.length; j++) { this.numerator[this.m+i][j] = prices[i][j]; } this.b_numerator[this.m+i] = sum; this.b_denominator[this.m+i] = 1; } for (let i=0; i<this.n; i++) this.basis[i] = this.m + i; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "load_1(prices, counts, values) {\n\t\t\n\t\t// maximum numbers of items constraints\n\t\tfor (let i=0; i<this.m; i++) {\n\t\t\tthis.numerator[i][i] = 1;\n\t\t\tthis.b_numerator[i] = counts[i];\n\t\t\tthis.b_denominator[i] = 1;\n\t\t\tthis.f_numerator[i] = -1;\n\t\t\tthis.f_denominator[i] = 1;\n\t\t\tthis.free[i] =...
[ "0.79875535", "0.49255934", "0.47670075", "0.47663677", "0.4737774", "0.47316885", "0.4717825", "0.4710044", "0.4700515", "0.46984234", "0.46697223", "0.46697223", "0.46559665", "0.45981428", "0.45583332", "0.45535064", "0.4538569", "0.45311534", "0.45223594", "0.45136786", "...
0.8336306
0
method gauss(index_in, index_out) Gausss matrix transformation
gauss(index_in, index_out) { var chisl = this.numerator[index_out][index_in]; var znamen = this.denominator[index_out][index_in]; var tmp_n = new Array(this.n); var tmp_d = new Array(this.n); if (chisl < 0) { tmp_n[index_out] = -znamen; tmp_d[index_out] = -chisl; } else { tmp_n[index_out] = znamen; tmp_d[index_out] = chisl; } var x, y, z; for (let i=0; i<this.m; i++) { if (this.numerator[index_out][i] === 0) continue; x = this.numerator[index_out][i] * znamen; y = this.denominator[index_out][i] * chisl; if (y < 0) { y = -y; x = -x; } z = nod(x, y); this.numerator[index_out][i] = x / z; this.denominator[index_out][i] = y / z; } x = this.b_numerator[index_out] * znamen; y = this.b_denominator[index_out] * chisl; if (y < 0) { y = -y; x = -x; } if(x===0) { this.b_numerator[index_out] = 0; this.b_denominator[index_out] = 1; } else { z = nod(x, y); this.b_numerator[index_out] = x / z; this.b_denominator[index_out] = y / z; } var a, b, c; for (let i=0; i<this.n; i++) { if (i == index_out) continue; a = this.numerator[i][index_in]; b = this.denominator[i][index_in]; if (a === 0) { tmp_n[i] = 0; tmp_d[i] = 1; } else { c = nod(a*znamen, b*chisl); if (b*chisl > 0) { tmp_n[i] = -a*znamen / c; tmp_d[i] = b*chisl / c; } else { tmp_n[i] = a*znamen / c; tmp_d[i] = -b*chisl / c; } } for (let j=0; j<this.m; j++) { x = this.numerator[i][j] * this.denominator[index_out][j]*b - this.denominator[i][j] * this.numerator[index_out][j]*a; y = this.denominator[i][j] * this.denominator[index_out][j]*b; if (x===0) { this.numerator[i][j] = 0; this.denominator[i][j] = 1; } else { z = nod(x,y); this.numerator[i][j] = x / z; this.denominator[i][j] = y / z; } } x = this.b_numerator[i] * this.b_denominator[index_out]*b - this.b_denominator[i] * this.b_numerator[index_out]*a; y = this.b_denominator[i] * this.b_denominator[index_out]*b; if (x===0) { this.b_numerator[i] = 0; this.b_denominator[i] = 1; } else { var z = nod(x,y); this.b_numerator[i] = x / z; this.b_denominator[i] = y / z; } } a = this.f_numerator[index_in]; b = this.f_denominator[index_in]; for (let j=0; j<this.m; j++) { x = this.f_numerator[j] * this.denominator[index_out][j]*b - this.f_denominator[j] * this.numerator[index_out][j]*a; y = this.f_denominator[j] * this.denominator[index_out][j]*b; if (x===0) { this.f_numerator[j] = 0; this.f_denominator[j] = 1; } else { z = nod(x,y); this.f_numerator[j] = x / z; this.f_denominator[j] = y / z; } } c = nod(a*znamen, b*chisl); if (b*chisl > 0) { this.f_numerator[index_in] = -a*znamen / c; this.f_denominator[index_in] = b*chisl / c; } else { this.f_numerator[index_in] = a*znamen / c; this.f_denominator[index_in] = -b*chisl / c; } let tmp_index = this.basis[index_out]; this.basis[index_out] = this.free[index_in]; this.free[index_in] = tmp_index; for (let i=0; i<this.n; i++) { this.numerator[i][index_in] = tmp_n[i]; this.denominator[i][index_in] = tmp_d[i]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GaussEli(A, b) {\n let x = new Array(A.row);\n let M = new Matrix(A.row, A.col);\n for (let j = 0; j < A.col; j++) {\n for (let i = j + 1; i < A.col + 1; i++) {\n M.data[i][j] = A.data[i][j] / A.data[j][j];\n for (let k = j + 1; k < A.col + 1; k++) {\n ...
[ "0.659039", "0.57784575", "0.5778068", "0.57418454", "0.57418454", "0.57418454", "0.57418454", "0.57418454", "0.5732751", "0.57305", "0.56017023", "0.5572432", "0.5433277", "0.53012973", "0.52975184", "0.5278036", "0.52489614", "0.51948303", "0.4871608", "0.47957125", "0.4779...
0.772235
0
end of gauss method method dopusk_out() search illegal constraint index for out from basis
dopusk_out() { var ind = -1; var a = 0; for (let i=0; i<this.n; i++) { if (this.b_numerator[i] >= 0) continue; if (this.b_numerator[i]/this.b_denominator[i] <= a) { ind = i; a = this.b_numerator[i]/this.b_denominator[i]; } } return ind; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "dopusk() {\n\t\tvar ind_out = this.dopusk_out();\n\t\twhile (ind_out >= 0) {\n\t\t\tvar ind_in = this.dopusk_in(ind_out);\n\t\t\tif (ind_in == -1) return false;\n\t\t\tthis.gauss(ind_in, ind_out);\n\t\t\tind_out = this.dopusk_out();\n\t\t}\n\t\treturn true;\n\t}", "dopusk_in(index_out) {\n\t\tvar ind = -1;\n\t\t...
[ "0.6435484", "0.6390105", "0.5966422", "0.58272296", "0.56237525", "0.5380196", "0.5361011", "0.5352768", "0.532159", "0.52877635", "0.5238938", "0.5139644", "0.509962", "0.49901956", "0.49747458", "0.49563354", "0.490491", "0.4896201", "0.48615164", "0.48490763", "0.48487133...
0.6197418
2
method dopusk_in(index_out) search index for in to basis
dopusk_in(index_out) { var ind = -1; var a = 0; for (let i=0; i<this.m; i++) { if (this.numerator[index_out][i] >= 0) continue; if (this.numerator[index_out][i]/this.denominator[index_out][i] < a) { ind = i; a = this.numerator[index_out][i]/this.denominator[index_out][i]; } } return ind; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_findInIndex (index0, key0, key1, key2, name0, name1, name2, graph, callback, array) {\n let tmp, index1, index2\n\n // If a key is specified, use only that part of index 0.\n if (key0) {\n (tmp = index0, index0 = {})[key0] = tmp[key0]\n }\n\n for (const value0 in index0) {\n index1 = inde...
[ "0.5975847", "0.57930875", "0.56894046", "0.5686321", "0.5592967", "0.55777985", "0.55633736", "0.55400187", "0.55217665", "0.53575623", "0.53357285", "0.53275627", "0.52014124", "0.5162887", "0.5133592", "0.5133592", "0.5133592", "0.5133592", "0.5133592", "0.5133592", "0.513...
0.6887598
0
method dopusk() search for legal solution
dopusk() { var ind_out = this.dopusk_out(); while (ind_out >= 0) { var ind_in = this.dopusk_in(ind_out); if (ind_in == -1) return false; this.gauss(ind_in, ind_out); ind_out = this.dopusk_out(); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doubleSearch () {}", "function FindWords(letters, finalsolutions){\n\tvar letters_or = getOrdered(letters); \n\tif (letters_or in wordhash){\t// check if ordered version has words\n\t\tfor (var i=0; i<wordhash[letters_or].length; i++){\n\t\t\tfinalsolutions.push(wordhash[letters_or][i]);\t// grab each m...
[ "0.63910097", "0.5924538", "0.5806761", "0.57739395", "0.5629815", "0.56052625", "0.5588416", "0.5578466", "0.5568545", "0.5507283", "0.5490397", "0.5482387", "0.5459629", "0.5428079", "0.54122096", "0.5410444", "0.5398513", "0.5362553", "0.5344044", "0.5314323", "0.5305801",...
0.0
-1
method simplex_in() search index for in to basis
simplex_min_in() { var ind = -1; var min_a = 0; for (var i=0; i<this.m; i++) { if (this.f_numerator[i] <= 0) continue; if (this.f_numerator[i]/this.f_denominator[i] > min_a) { ind = i; min_a = this.f_numerator[i]/this.f_denominator[i]; } } return ind; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function elemIndices(x, xs){\r\n return findIndices(function(e){ return Eq.eq(x) }, xs);\r\n}", "function elemIndex(x, xs){\r\n return findIndex(function(e){ return Eq.eq(x) }, xs);\r\n}", "in(key, values) {\n // Push query part for `in` and return self\n this.pts.push({ type : 'in', vals : values,...
[ "0.6556702", "0.6362038", "0.5945763", "0.5929666", "0.5923565", "0.5835603", "0.58017004", "0.58003694", "0.5795078", "0.57751226", "0.56328565", "0.56067556", "0.55951005", "0.5571252", "0.5481542", "0.5470606", "0.5470086", "0.5439408", "0.53984934", "0.5391532", "0.535364...
0.4955547
78
method simplex_in() search index for in to basis
simplex_max_in() { var ind = -1; var min_a = 0; for (var i=0; i<this.m; i++) { if (this.f_numerator[i] >= 0) continue; if (this.f_numerator[i]/this.f_denominator[i] < min_a) { ind = i; min_a = this.f_numerator[i]/this.f_denominator[i]; } } return ind; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function elemIndices(x, xs){\r\n return findIndices(function(e){ return Eq.eq(x) }, xs);\r\n}", "function elemIndex(x, xs){\r\n return findIndex(function(e){ return Eq.eq(x) }, xs);\r\n}", "in(key, values) {\n // Push query part for `in` and return self\n this.pts.push({ type : 'in', vals : values,...
[ "0.65566385", "0.6360657", "0.5946533", "0.59287685", "0.5922868", "0.58368886", "0.5800393", "0.5798314", "0.57950306", "0.5773147", "0.563142", "0.560421", "0.5593856", "0.5571915", "0.5480875", "0.54703766", "0.5468474", "0.5437488", "0.53979874", "0.5390372", "0.53533256"...
0.0
-1
method simplex_out(index_in) search index for out from basis
simplex_out(index_in) { var ind = -1; var min_a = 0; for (let i=0; i<this.n; i++) { if (this.numerator[i][index_in] <= 0) continue; var a = (this.b_numerator[i] / this.b_denominator[i]) * (this.denominator[i][index_in] / this.numerator[i][index_in]); if (a < 0) continue; if (ind == -1 || a < min_a) { ind = i; min_a = a; } } return ind; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "simplex2_in(ind_out) {\n\t\tvar ind = -1;\n\t\tvar min_a = 0;\n\t\tfor (let i=0; i<this.m; i++) {\n\t\t\tif (this.f_numerator[i] > 0) continue;\n\t\t\tif (this.numerator[ind_out][i] >= 0) continue;\nvar a = (this.f_numerator[i] * this.denominator[ind_out][i]) / (this.numerator[ind_out][i] * this.f_denominator[i])...
[ "0.60989445", "0.5925809", "0.5757789", "0.57070774", "0.55560607", "0.54455805", "0.5377327", "0.5211818", "0.51058555", "0.51019216", "0.5088686", "0.50362694", "0.50227773", "0.50184196", "0.49769902", "0.49763545", "0.49604225", "0.49372664", "0.4928754", "0.48963496", "0...
0.7006323
0
method simplex() simlex method
simplex2min() { var ind_in = this.simplex_min_in(); while (ind_in >= 0) { var ind_out = this.simplex_out(ind_in); if (ind_out == -1) return false; this.gauss(ind_in, ind_out); ind_in = this.simplex_min_in(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Simplex(code){\n\tthis.code = code;\n\tthis.Macros = [];\t// to hold the macros\n\tthis.StripField = [new Strip()];\t// to hold the strips\n\tthis.inputStack = [];\n\tthis.lambdaStack = [];\n\tthis.StripPointer = 0;\n\tthis.index = 0;\n\tthis.stepNum = 0;\n\tthis.safetyMode = true...
[ "0.6288166", "0.605458", "0.59269965", "0.5909434", "0.57923746", "0.56413203", "0.56413203", "0.56413203", "0.56413203", "0.56413203", "0.56413203", "0.5639026", "0.55048317", "0.5438154", "0.54263186", "0.5365692", "0.5223719", "0.51448226", "0.5101813", "0.50583524", "0.50...
0.6320213
0
method simplex() simlex method
simplex2max() { var ind_in = this.simplex_max_in(); while (ind_in >= 0) { var ind_out = this.simplex_out(ind_in); if (ind_out == -1) return false; this.gauss(ind_in, ind_out); ind_in = this.simplex_max_in(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "simplex2min() {\n\t\tvar ind_in = this.simplex_min_in();\n\t\twhile (ind_in >= 0) {\n\t\t\tvar ind_out = this.simplex_out(ind_in);\n\t\t\tif (ind_out == -1) return false;\n\t\t\tthis.gauss(ind_in, ind_out);\n\t\t\tind_in = this.simplex_min_in();\n\t\t}\n\t}", "function Simplex(code){\n\tthis.code = code;\n\tthis...
[ "0.6321524", "0.6288764", "0.60556555", "0.5927725", "0.5910496", "0.5793054", "0.5641931", "0.5641931", "0.5641931", "0.5641931", "0.5641931", "0.5641931", "0.5639646", "0.55058", "0.5437009", "0.5366241", "0.52242905", "0.51428205", "0.51004237", "0.50581306", "0.50365424",...
0.54276943
15
method gomoryCut() Gomory cut method
gomoryCut() { var bbb = 0; var ind, rest; for (let i=0; i<this.n; i++) { rest = this.b_numerator[i] % this.b_denominator[i]; if (rest < 0) rest += this.b_denominator[i]; rest = rest / this.b_denominator[i]; if (rest > bbb) { ind = i; bbb = rest; } } rest = this.b_numerator[ind] % this.b_denominator[ind]; if (rest < 0) rest += this.b_denominator[ind]; this.b_numerator[this.n] = -rest; this.b_denominator[this.n] = this.b_denominator[ind]; var arr_n = new Array(this.m); var arr_d = new Array(this.m); for (let i=0; i<this.m; i++) { rest = this.numerator[ind][i] % this.denominator[ind][i]; if (rest < 0) rest += this.denominator[ind][i]; if (rest === 0) { arr_n[i] = 0; arr_d[i] = 1; } else { arr_n[i] = -rest; arr_d[i] = this.denominator[ind][i]; } } this.numerator[this.n] = arr_n; this.denominator[this.n] = arr_d; this.basis[this.n] = this.n + this.m + 1; this.n += 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cut() {}", "function cut(c, i) {\n\t var a = adj[i][c[i]]\n\t a.splice(a.indexOf(c), 1)\n\t }", "function cut(c, i) {\n\t var a = adj[i][c[i]]\n\t a.splice(a.indexOf(c), 1)\n\t }", "cutEntity() {\n\n if (this.entitySelection !== null) {\n this.commander.push(\"cut\", this, [thi...
[ "0.7492843", "0.5877411", "0.5877411", "0.58230996", "0.5768336", "0.5768336", "0.5648657", "0.5529407", "0.5490319", "0.544564", "0.5395222", "0.5392793", "0.5365964", "0.53475755", "0.5333695", "0.52391857", "0.52109474", "0.5183086", "0.51814175", "0.5158197", "0.51456404"...
0.7259044
1
method simplex2_out() search index for out from basis
simplex2_out() { var ind = -1; var a = 0; for (let i=0; i<this.n; i++) { if (this.b_numerator[i] >= 0) continue; if (this.b_numerator[i] / this.b_denominator[i] < a) { ind = i; a = this.b_numerator[i] / this.b_denominator[i]; } } return ind; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "simplex_out(index_in) {\n\t\tvar ind = -1;\n\t\tvar min_a = 0;\n\t\tfor (let i=0; i<this.n; i++) {\n\t\t\tif (this.numerator[i][index_in] <= 0) continue;\nvar a = (this.b_numerator[i] / this.b_denominator[i]) * (this.denominator[i][index_in] / this.numerator[i][index_in]);\n\t\t\tif (a < 0) continue;\n\t\t\tif (in...
[ "0.6502125", "0.59476274", "0.55531424", "0.55306345", "0.53232306", "0.5227959", "0.5182319", "0.5059645", "0.5039684", "0.49484178", "0.48986557", "0.4885675", "0.48743832", "0.48490205", "0.48381573", "0.48199785", "0.4780526", "0.47774243", "0.47631714", "0.4756", "0.4749...
0.6118458
1
method simplex2_in(index_out) search index for in to basis
simplex2_in(ind_out) { var ind = -1; var min_a = 0; for (let i=0; i<this.m; i++) { if (this.f_numerator[i] > 0) continue; if (this.numerator[ind_out][i] >= 0) continue; var a = (this.f_numerator[i] * this.denominator[ind_out][i]) / (this.numerator[ind_out][i] * this.f_denominator[i]); if (a < 0) continue; if (ind == -1 || a < min_a) { ind = i; min_a = a; } } return ind; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "simplex_out(index_in) {\n\t\tvar ind = -1;\n\t\tvar min_a = 0;\n\t\tfor (let i=0; i<this.n; i++) {\n\t\t\tif (this.numerator[i][index_in] <= 0) continue;\nvar a = (this.b_numerator[i] / this.b_denominator[i]) * (this.denominator[i][index_in] / this.numerator[i][index_in]);\n\t\t\tif (a < 0) continue;\n\t\t\tif (in...
[ "0.6331437", "0.5989683", "0.5786872", "0.55922264", "0.556005", "0.55396765", "0.55298746", "0.54732454", "0.54141957", "0.53915894", "0.5333916", "0.53223157", "0.5308186", "0.5308186", "0.5308186", "0.5308186", "0.5308186", "0.5308186", "0.5308186", "0.5308186", "0.5276203...
0.70041585
0
method simplex2() simplex method dual
simplex2() { var ind_out = this.simplex2_out(); while (ind_out >= 0) { var ind_in = this.simplex2_in(ind_out); if (ind_in == -1) return false; this.gauss(ind_in, ind_out); ind_out = this.simplex2_out(); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "simplex2min() {\n\t\tvar ind_in = this.simplex_min_in();\n\t\twhile (ind_in >= 0) {\n\t\t\tvar ind_out = this.simplex_out(ind_in);\n\t\t\tif (ind_out == -1) return false;\n\t\t\tthis.gauss(ind_in, ind_out);\n\t\t\tind_in = this.simplex_min_in();\n\t\t}\n\t}", "simplex2max() {\n\t\tvar ind_in = this.simplex_max_i...
[ "0.6791447", "0.58788496", "0.53623396", "0.5130472", "0.5124311", "0.5122071", "0.48948804", "0.48797625", "0.48316854", "0.48157334", "0.47876033", "0.4757231", "0.4713894", "0.47038764", "0.47026792", "0.47026792", "0.47026792", "0.47026792", "0.47026792", "0.47026792", "0...
0.6794266
0
method check_b() check B vector for integers
check_b() { for (let i=0; i<this.n; i++) { if (this.basis[i] >= this.m) continue; if ((this.b_numerator[i] % this.b_denominator[i]) != 0) return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function h$ghcjsbn_assertValid_i(b, msg) {\n var sd, d, neg, i, n;\n // check global constants for unwanted mutations\n if(h$ghcjsbn_zero_b.length !== 1 || h$ghcjsbn_zero_b[0] !== 0) {\n throw new Error(\"zero_b mutated\");\n }\n if(h$ghcjsbn_one_b.length !== 2 || h$ghcjsbn_one_b[0] !== 1 || h$ghcjsbn_one_...
[ "0.6940319", "0.67904043", "0.67904043", "0.67904043", "0.67904043", "0.6775925", "0.6775925", "0.67548764", "0.67548764", "0.6544542", "0.62807035", "0.57389736", "0.55939376", "0.55939376", "0.55939376", "0.55939376", "0.5474874", "0.54252577", "0.54252577", "0.54252577", "...
0.683381
1
method solution() solution array
solution() { var res = new Array(this.m); for (let i=0; i<this.m; i++) res[i] = 0; for (let i=0; i<this.n; i++) { if (this.basis[i] < this.m) { var b_index = this.basis[i]; res[b_index] = this.b_numerator[i]/this.b_denominator[i]; } } return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function solution(arr){\n\n}", "function solution(arr) {\n var answer = [];\n return answer;\n}", "function findSolutions(challenge) {\n return [];\n}", "function solution(A) {\n\n}", "solve()\n {\n let solved = false;\n this.updatePossibilities();\n\n while (! solved)\n {\n solved =...
[ "0.7936761", "0.7631375", "0.68115836", "0.662201", "0.64620924", "0.64509714", "0.63180685", "0.6308067", "0.62587434", "0.6242688", "0.62292874", "0.6228013", "0.621134", "0.6014609", "0.59861267", "0.5980781", "0.5979423", "0.5943092", "0.5904564", "0.5884515", "0.5882358"...
0.66041166
4
method dump() dump matrix to log
dump(log) { for (let i=0; i<this.n; i++) { log(this.basis[i]+": ["+ this.numerator[i].join(",")+"]/["+ this.denominator[i].join(",")+"] = "+this.b_numerator[i]+"/"+this.b_denominator[i]); } log(' F: '+this.f_numerator.join(" ; ")); log(' f: '+this.free.join(" ; ")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dumpMatrix4( m )\n{\n\tvar r1 = '['+m.n11+']['+m.n12+']['+m.n13+']['+m.n14+']';\n\tvar r2 = '['+m.n21+']['+m.n22+']['+m.n23+']['+m.n24+']';\n\tvar r3 = '['+m.n31+']['+m.n32+']['+m.n33+']['+m.n34+']';\n\tvar r4 = '['+m.n41+']['+m.n42+']['+m.n43+']['+m.n44+']';\n\tlog('d matrix4:\\n'+r1+'\\n'+r2+'\\n'+r3+'\...
[ "0.71613544", "0.6677948", "0.6488224", "0.6488224", "0.6422381", "0.632687", "0.6228062", "0.6202261", "0.6096542", "0.60158974", "0.59510374", "0.581185", "0.577037", "0.57455957", "0.5733899", "0.5662617", "0.5549426", "0.5513152", "0.55117387", "0.5490771", "0.5490771", ...
0.63860357
5
Age calculation: Tree inspiration:
function calculateAge(birthday) { // birthday is a date const ageDifMs = Date.now() - birthday.getTime(); const ageDate = new Date(ageDifMs); // miliseconds from epoch return Math.abs(ageDate.getUTCFullYear() - 1970); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getAge() {\n\n let months = 0;\n\n if (this.date) {\n\n months = (new Date().getFullYear() - this.date.getFullYear()) * 12;\n months -= this.date.getMonth() + 1;\n months += new Date().getMonth() + 1;\n\n const childChange = this.matchGrowthRange(months);\n...
[ "0.70542777", "0.6937707", "0.6870946", "0.68601346", "0.68601346", "0.6859149", "0.675975", "0.675975", "0.675975", "0.675975", "0.6671208", "0.66405594", "0.6612526", "0.6604262", "0.65803444", "0.655576", "0.6520474", "0.6506076", "0.6506076", "0.65060616", "0.6494835", ...
0.0
-1
Creates a curved (diagonal) path from parent to the child nodes
function diagonal(s, d) { path = `M ${s.y} ${s.x} C ${(s.y + d.y) / 2} ${s.x}, ${(s.y + d.y) / 2} ${d.x}, ${d.y} ${d.x}`; return path }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function diagonal(d) {\n return \"M\" + d.y + \",\" + d.x\n + \"V\" + d.parent.x\n + \"H\" + d.parent.y;\n}", "function diagonal(d) {\n return \"M\" + project(d.x, d.y)\n + \"C\" + project(d.x, (d.y + d.parent.y) / 2)\n + \" \" + project(d.parent.x, (d.y + d.parent.y) / ...
[ "0.65406346", "0.6209308", "0.59951013", "0.58574104", "0.5815413", "0.58101994", "0.57812744", "0.5753873", "0.5753873", "0.57159704", "0.57058805", "0.5702334", "0.5696452", "0.5664441", "0.5650818", "0.5642091", "0.56320316", "0.56320316", "0.5623965", "0.56190246", "0.561...
0.56474024
15
Toggle children on click.
function click(d) { if (d.children) { d._children = d.children; d.children = null; } else { d.children = d._children; d._children = null; } update(d); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleChildren() {\n\t\tthis.setState({\n\t\t\tlinksVisible: !this.state.linksVisible\n\t\t});\n\t}", "function toggle_sidebar_sublist()\n{\n $(\".navbar_right_sidebar .sidebar_main_item.expandable\").click(function(){\n var child_container=$(this).find(\".subele_container\");\n if (child_contai...
[ "0.7110301", "0.6869267", "0.6655963", "0.6654497", "0.665069", "0.66472757", "0.66196424", "0.6617967", "0.6611529", "0.6591686", "0.654975", "0.6496521", "0.6458841", "0.64187694", "0.6404308", "0.63751197", "0.6367944", "0.6303494", "0.6300836", "0.6289716", "0.6254156", ...
0.0
-1
The cornerstone, an `each` implementation, aka `forEach`. Handles objects with the builtin `forEach`, arrays, and raw objects. Delegates to ECMAScript 5's native `forEach` if available.
function each(obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return; } } else { for (var key in obj) { if (has(obj, key)) { if (iterator.call(context, obj[key], key, obj) === breaker) return; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function forEach(obj, iterator, context) {\n if (obj === null) {\n return;\n }\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n } else if (obj.length === +obj.length) {\n for (var i = 0, l = obj.length; i < l; i += 1) {\n iterator.call(context, obj[i], i...
[ "0.78414583", "0.745536", "0.7396002", "0.7377368", "0.7377368", "0.733551", "0.7299104", "0.7276125", "0.7202616", "0.7202616", "0.712669", "0.712669", "0.70859635", "0.7083171", "0.70718294", "0.7064128", "0.70296216", "0.6986594", "0.6979177", "0.68009514", "0.6776445", ...
0.73323923
6
Determine whether all of the elements match a truth test. Delegates to ECMAScript 5's native `every` if available. Aliased as `all`.
function every(obj, iterator, context) { var result = true; if (obj == null) return result; if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); each(obj, function (value, index, list) { if (!(result = result && iterator.call(context, value, index, list))) return breaker; }); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "every(predicate) {\n for (const element of this)\n if (!predicate(element))\n return false;\n return true;\n }", "function every(predicate) {\n var arr = this.value();\n for (var i = 0; i < arr.length; i++) {\n if (!predicate(arr[i], i))\n return...
[ "0.74810314", "0.72609794", "0.7254824", "0.7234641", "0.7113811", "0.7113811", "0.7113811", "0.7113811", "0.7101232", "0.70653874", "0.70653874", "0.70328856", "0.7025807", "0.70092165", "0.6998867", "0.6992675", "0.6991896", "0.6945959", "0.6941451", "0.687601", "0.68728", ...
0.6269697
61
Determine if at least one element in the object matches a truth test. Delegates to ECMAScript 5's native `some` if available. Aliased as `any`.
function any(obj, iterator, context) { iterator || (iterator = _.identity); var result = false; if (obj == null) return result; if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); each(obj, function (value, index, list) { if (result || (result = iterator.call(context, value, index, list))) return breaker; }); return !!result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function any(predicate, iterable) {\n for (const element of iterable) {\n if (predicate(element)) return true;\n }\n return false;\n}", "function some(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = !isArrayLike(obj) && keys(obj),\n length = (_keys || obj).length...
[ "0.70127594", "0.66792274", "0.66792274", "0.66792274", "0.66792274", "0.66792274", "0.66792274", "0.66792274", "0.66792274", "0.66792274", "0.6644302", "0.64668036", "0.6414661", "0.6405987", "0.63890195", "0.6324726", "0.632258", "0.6214626", "0.61825657", "0.61022395", "0....
0.68956983
1
Determine if a given value is included in the array or object using `===`. Aliased as `contains`.
function contains(obj, target) { var found = false; if (obj == null) return found; if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; found = any(obj, function (value) { return value === target; }); return found; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "includes(value) {\n for (const ele of this.arr) {\n if (ele === value) {\n return true;\n }\n }\n\n return false;\n }", "function arrayIncludes(array, value) {\n return array.indexOf(value) !== -1;\n}", "function includes(array, value) {\n for (var i = 0; i < array.length; i++) {...
[ "0.762607", "0.7362511", "0.73604894", "0.71346617", "0.7114225", "0.7114225", "0.7114225", "0.70926", "0.709084", "0.7042601", "0.70090127", "0.6986189", "0.69459516", "0.6923626", "0.6903975", "0.6842923", "0.68176234", "0.677967", "0.6765055", "0.6761621", "0.6756492", "...
0.62839043
81
type(object) > the object's type type(name, bases, dict) > a new type
function type(name, bases, dict) { return type.__call__(name, bases, dict); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function type(obj){\n\treturn Object.prototype.toString.call(obj).match(/^\\[object (.*)\\]$/)[1]\n }", "function type(obj){\n if ( obj == null ) {\n return obj + \"\";\n }\n\n var class2type = {};\n // 生成class2type映射\n \"Boolean Number String Function Array Date RegExp Object Error Null...
[ "0.72445375", "0.7171189", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7135728", "0.7042966", "0.6911148", "0.6907304", ...
0.64813113
33
wraps the given code (function) and process calls like the python interpreter code: function with the code name: function name (will be stored in the __name__ attribute) flags: indicates whether the function has (args, kwargs) in all variants (0, 1, 2, 3) arg_names: array with the argument names as strings defaults: array with the defaults for the len(defaults) last attributes (without args and kwargs)
function $function(code, name, flags, arg_names, defaults) { // __new__ function $function_instance() { // todo process arguments and include starargs and kwargs // var result = process_arguments(data, arguments); var result = arguments; return code.apply($function_instance, result); } // __init__ mimic_instance($function_instance, name, $function); $function_instance.__code__ = code; return $function_instance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function functionName(arguments) {\n //code here\n}", "function helloFunctionInvoker(hello){\n hello('function args');\n}", "function wrapFunction(fn, setargc) {\n var wrap = (...args) => {\n setargc(args.length);\n return fn(...args);\n }\n // adding a function to the table with `newFunction` is ...
[ "0.5481934", "0.5352064", "0.53151536", "0.5298862", "0.52242523", "0.51830137", "0.51567435", "0.5131026", "0.51074064", "0.50848514", "0.5069993", "0.49806187", "0.49806187", "0.49806187", "0.49791282", "0.4970103", "0.49539718", "0.49515715", "0.49449128", "0.49341887", "0...
0.7045777
0
function __get__ needs to behave like an instance of $function
function $function_instance(self, instance, C) { // bounded functions are implemented using descriptors // return a bound method passing the instance as the first argument implicitly if (instance) { return $method(self, instance); } return self; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function __func(){}", "get() {}", "_get () {\n throw new Error('_get not implemented')\n }", "function $o(){}", "get Custom() {}", "get x() {}", "function get(){return proxy;}", "function get(){return proxy;}", "function __getter(value) {\n // console.log('GET', arguments)\n\n ...
[ "0.69561505", "0.64943075", "0.64003253", "0.6352435", "0.63370204", "0.6334622", "0.6319652", "0.6319652", "0.6296417", "0.6270662", "0.62309414", "0.61640227", "0.61317724", "0.61274624", "0.6091396", "0.60738623", "0.6036835", "0.59780735", "0.5962923", "0.5954262", "0.595...
0.0
-1
flag used to signal no attribute
function is_descriptor(attribute) { // base class when searching a function instance if (attribute.__class__ === $function) return true; try { var _get=$getattribute(attribute, '__get__'); return true; } catch (e) { // catch only attribute errors return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attrNull() {\n this.removeAttribute(name);\n }", "function attrNull() {\n this.removeAttribute(name);\n }", "function attrNull() {\n this.removeAttribute(name);\n }", "function NoBonus()\n{\n\tgiveBonus = false;\n}", "function no_set_attr(klass, attr){\n if(klass[attr] !== u...
[ "0.6302921", "0.6281559", "0.6281559", "0.6227794", "0.6116832", "0.60311484", "0.59768337", "0.59494984", "0.59465164", "0.586497", "0.58524764", "0.5747859", "0.5724551", "0.5689944", "0.5673051", "0.5670115", "0.5669759", "0.5607277", "0.55508137", "0.55411637", "0.5513696...
0.0
-1
T.__new__(S, ...) > a new object with type S, a subtype of T Called to create a new instance of class cls. __new__() is a static method don't need to declare it as such this will be the object instance note that when called calls the __call__ method
function instance() { if (!hasattr(instance, '__call__')) throw 'object is not callable'; // call method should be bound to the instance return getattr(instance, '__call__').apply(instance, arguments); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _new(Cls) {\n return new(Cls.bind.apply(Cls, arguments))();\n }", "new() {\n let newInstance = Object.create(this);\n\n newInstance.init(...arguments);\n\n return newInstance;\n }", "construct (target, args) {\n return new target(...args)\n }", "function cheapNew(cls) {\n disabl...
[ "0.753499", "0.7093847", "0.68944097", "0.68178177", "0.68178177", "0.6816042", "0.67723864", "0.671773", "0.6646129", "0.6592829", "0.6592829", "0.6592829", "0.65866953", "0.65591305", "0.6514612", "0.6483328", "0.64736164", "0.64613587", "0.64048284", "0.64048284", "0.64048...
0.0
-1
mro() > list return a type's method resolution order
function $merge(seqs) { var result = []; while (1) { seqs = filter(seqs, function(seq){return seq.length>0}); if (seqs.length === 0) return result; var head = null; for (var i=0; i<seqs.length; i++) { var head = seqs[i][0]; check_tail: for (var j=0; j<seqs.length; j++) { var tail = seqs[j].slice(1); for (var k=0; k<tail.length; k++) { if (tail[k] === head) { head = null; break check_tail; } } } if (head !== null) break; } if (head === null) throw "Inconsistent hierarchy"; result.push(head); for (var i=0; i<seqs.length; i++) { if (seqs[i][0] === head) { seqs[i].shift(); } } } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lmfc(klass){\n list_Methods(klass,1)\n}", "function sortMethodList(type) {\n var methods = vm.allClasses[vm.selectedClass.key].methods;\n switch (type) {\n case constants.sortMessage.default:\n vm.sortMessage = constants.sortMessage.default;\n ...
[ "0.58216196", "0.57021976", "0.5395257", "0.5273567", "0.52682453", "0.5192188", "0.5158983", "0.5077372", "0.5072812", "0.5019832", "0.49911737", "0.49895695", "0.4935629", "0.48876736", "0.4880883", "0.4848058", "0.48317146", "0.48158053", "0.48123732", "0.4807231", "0.4785...
0.0
-1
renderTable renders the filteredData to the tbody
function renderTable(filteredData) { $tbody.innerHTML = ""; // Create variable for page number for (var i = 0; i < filteredData.length; i++) { // Get get the current address object and its fields var address = filteredData[i]; var fields = Object.keys(address); // Create a new row in the tbody, set the index to be i + startingIndex var $row = $tbody.insertRow(i); // Increment page no if i is multiple of 50 // add data attribute to row for (var j = 0; j < fields.length; j++) { // For every field in the address object, create a new cell at set its inner text to be the current value at the current address's field var field = fields[j]; var $cell = $row.insertCell(j); $cell.innerText = address[field]; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredData.length; i++) {\n // Get the current object and its fields\n var data = filteredData[i];\n var fields = Object.keys(data);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $t...
[ "0.8318006", "0.8080722", "0.7958396", "0.7645312", "0.7549476", "0.74590045", "0.74425024", "0.7371615", "0.7356715", "0.7329696", "0.7289877", "0.7210483", "0.7168306", "0.7135515", "0.70008934", "0.6976496", "0.6920009", "0.6893965", "0.68546057", "0.68541473", "0.6841171"...
0.73122877
10
Do the search queries on Datetime, City, State, Country and Shape
function handleSearchButtonClick() { filteredData = dataSet; // Format the user's search by removing leading and trailing whitespace, lowercase the string var filterDatetime = $dateInput.value.trim().toLowerCase(); var filterCity = $cityInput.value.trim().toLowerCase(); var filterState = $stateInput.value.trim().toLowerCase(); var filterCountry = $countryInput.value.trim().toLowerCase(); var filterShape = $shapeInput.value.trim().toLowerCase(); // Set filteredAddresses to an array of all addresses whose "state" matches the filter filteredData = dataSet.filter(function(address) { var addressDatetime = address.datetime.toLowerCase(); var addressCity = address.city.toLowerCase(); var addressState = address.state.toLowerCase(); var addressCountry = address.country.toLowerCase(); var addressShape = address.shape.toLowerCase(); if ((addressDatetime===filterDatetime || filterDatetime == "") && (addressCity === filterCity || filterCity == "") && (addressState === filterState || filterState == "") && (addressCountry === filterCountry || filterCountry == "") && (addressShape === filterShape || filterShape =="")){ return true; } return false; console.log(filteredData); }); loadList(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchButtonClick() {\r\n var filterDate = $dateTimeInput.value.trim();\r\n var filterCity = $cityInput.value.trim().toLowerCase();\r\n var filterState = $stateInput.value.trim().toLowerCase();\r\n var filterCountry = $countryInput.value.trim().toLowerCase();\r\n var filterShape = $shapeInp...
[ "0.7001556", "0.6976177", "0.6858922", "0.6841097", "0.6656866", "0.654867", "0.62935156", "0.62833494", "0.6215945", "0.6171852", "0.61194146", "0.6110327", "0.61035395", "0.6052423", "0.60274667", "0.6024338", "0.60223424", "0.60104877", "0.60102665", "0.5998142", "0.599047...
0.63452363
6
Calculate number of pages
function getNumberOfPages(list) { return Math.ceil(list.length / numberPerPage); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function numPages(){\n let no_pages = Math.ceil(all_participants.length/per_page);\n return parseInt(no_pages);\n }", "function numPages(){\n let no_pages = Math.ceil(all_projects.length/per_page);\n return parseInt(no_pages);\n }", "function numPages()...
[ "0.80004454", "0.80004245", "0.7939875", "0.78530556", "0.78530556", "0.78530556", "0.78530556", "0.78530556", "0.778079", "0.7768121", "0.7756139", "0.77490485", "0.7707214", "0.7686812", "0.7684083", "0.7667969", "0.7610635", "0.7542113", "0.75156474", "0.74968964", "0.7493...
0.7321208
25
Set up pagination buttons
function nextPage() { currentPage += 1; loadList(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addPagination(list) {\n const numOfButtons = Math.ceil(list.length / 9);\n linkList.innerHTML = '';\n\n // The loop creates the buttons necessary for the pages and adds them to the button list\n for (let i = 0; i < numOfButtons; i++) {\n const button = `\n <li>\n <button ty...
[ "0.7528145", "0.75218445", "0.74129295", "0.7408235", "0.7407975", "0.74029684", "0.7349358", "0.7337236", "0.7331808", "0.7323913", "0.732266", "0.72896194", "0.72784716", "0.7272854", "0.7270257", "0.7254046", "0.72470045", "0.7227205", "0.71673644", "0.7164198", "0.7157709...
0.0
-1
Slice the data to be displayed as page and render table for display of page
function loadList() { var begin = ((currentPage - 1) * numberPerPage); var end = begin + numberPerPage; pageList = filteredData.slice(begin, end); console.log(pageList); renderTable(pageList); numberOfPages = getNumberOfPages(filteredData) check(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render_table_chunk() {\n\n $tablehead.text('');\n $tablebody.text('');\n \n chunkdata = alien_data.slice((currentPage-1) * perPage, currentPage * perPage);\n\n try {\n \n //setting up a header\n var $headrow = $tablehead.append(\"tr\");\n Object.keys(alien_data[0...
[ "0.7458912", "0.69491106", "0.68118155", "0.67495614", "0.66886896", "0.66795564", "0.66753453", "0.66305566", "0.6576733", "0.65105134", "0.649029", "0.64041877", "0.6388884", "0.62662506", "0.62214434", "0.6218858", "0.62167764", "0.6212504", "0.62123793", "0.62121844", "0....
0.6868376
2
Disable first and previous buttons when on first page and disable last and next buttons when on last page.
function check() { document.getElementById("next").disabled = currentPage == numberOfPages ? true : false; document.getElementById("previous").disabled = currentPage == 1 ? true : false; document.getElementById("first").disabled = currentPage == 1 ? true : false; document.getElementById("last").disabled = currentPage == numberOfPages ? true : false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "disableEnableActions(){\n let buttons = this.template.querySelectorAll('lightning-button');\n buttons.forEach(bun =>{\n if(bun.label === 'Previous'){\n bun.disabled = this.pageNo === 1 ? true : false;\n }else if(bun.label === 'Next'){\n bun.disabled = this.pageNo === this.totalPage ? ...
[ "0.7559757", "0.7502497", "0.74798244", "0.7255528", "0.71945035", "0.7137151", "0.71285194", "0.7123075", "0.7046538", "0.6997346", "0.6951793", "0.6949375", "0.6947892", "0.69348735", "0.69251645", "0.68309283", "0.68309283", "0.6817642", "0.6816025", "0.6816025", "0.681602...
0.7493053
3
Display a given topic (e.g. Hot, New)
function show_topic(topic_name){ hide_headlines(); $.get('/api/topic/' + topic_name, function(data){redraw_page(data)}); $('#nav_button').click(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectTopic(topic){\n currentSubject = topic;\n var topicObj = getItemTopicsData(currentSubject);\n \n if(topicObj.data.length > 0){\n //show the stickers from the data stored\n showStickers(topicObj.data);\n }\n else\n {\n //search for the topic in the API and lo...
[ "0.70857126", "0.70290804", "0.6955832", "0.686087", "0.67486393", "0.66498375", "0.6563776", "0.6468289", "0.6466965", "0.64339495", "0.64339495", "0.64339495", "0.64339495", "0.64339495", "0.64339495", "0.64339495", "0.64339495", "0.64339495", "0.64339495", "0.64339495", "0...
0.6938747
3
Supports an advanced search for limit by subreddit
function search_subreddit(){ $.get('/api/subreddit/' + $('#search_input').val(), function(data){redraw_page(data)}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async frontPageContent(accessToken, subreddit) {\n const urlBase = 'https://oauth.reddit.com'\n const urlPost = '/hot'\n let searchParams = new URLSearchParams();\n searchParams.set('limit', 27)\n let urlSubreddit = ''\n if (subreddit) {\n urlSubreddit = '/r/' + subreddit\n }\n const u...
[ "0.6442464", "0.6355836", "0.6011011", "0.58974946", "0.58533835", "0.5845338", "0.5831914", "0.57106817", "0.56753373", "0.56685257", "0.5626505", "0.5618567", "0.5577272", "0.5533086", "0.5529827", "0.55191374", "0.550607", "0.5498385", "0.54601866", "0.5443105", "0.5433526...
0.64678085
0
Hide the News headlines
function hide_headlines() { $('#headlines').hide(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideWikiContent() {\n\t// Hide everything but title\n\t$(\"#content.mw-body, #content.mw-body a, .mw-body div, .mw-code, .de1, .de1 span, .mw-body table, .mw-body tr, .mw-body td, .mw-body th, h2, h3, h4, .mw-editsection-bracket, .mw-editsection-divider, #content.mw-body ul, .thumbcaption, .thumb, .noprin...
[ "0.65763676", "0.64081615", "0.6314913", "0.62975305", "0.621657", "0.6214654", "0.6206398", "0.6111016", "0.6094817", "0.6092271", "0.6042901", "0.603462", "0.6021633", "0.60151225", "0.6010028", "0.5998379", "0.59619343", "0.5930881", "0.59282386", "0.5925841", "0.59002125"...
0.7196289
0
Show the News headlines currently linking to Home however
function show_headlines() { $('#headlines').show(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayDataOnHead(topNews){\n // console.log(topNews);\n\n topNews.articles.forEach(content => {\n const spanNode2 = document.createElement(\"li\"); // make fresh <li>\n spanNode2.innerHTML = // news contents\n `<a href=\"${content.url}\">\n <img...
[ "0.6456009", "0.6426665", "0.6276016", "0.6188486", "0.61288965", "0.60354096", "0.6000836", "0.593653", "0.5927917", "0.5926204", "0.5899199", "0.5892921", "0.5865004", "0.5806735", "0.58013487", "0.57914484", "0.5766085", "0.57598376", "0.5685369", "0.56680524", "0.5657018"...
0.5240166
82
Render the page in JavaScript using a JSON string
function redraw_page(data) { $('#thread').hide(); $('#page_pagination').hide(); parsed_json = create_posts(data); number_posts = populate_posts(parsed_json); paginate_posts(); create_pagination_bar(number_posts); $(document).foundation(); $('#thread').show(); $('#page_pagination').show(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addJSONToPage(jsonData){\n\t//Console log my data\n\tconsole.log(jsonData);\n\t//Create a div with jquery\n\tvar myDataDiv = $(\"<div>\");\n\t//Add data to div\n\tmyDataDiv.html(jsonData);\n\t//Put myDataDiv div inside DivID\n\t$(\"#DivID\").append(myDataDiv);\n}", "function Render (opts) {\n this.js...
[ "0.6193688", "0.61897063", "0.60394216", "0.59197706", "0.5896203", "0.58823097", "0.58214223", "0.5793542", "0.5791192", "0.5770616", "0.5721661", "0.5690377", "0.56336373", "0.557018", "0.5568791", "0.5560296", "0.55469537", "0.552781", "0.5509726", "0.54839885", "0.5456435...
0.0
-1
Create the HTML for each Post in a Thread
function create_posts(post_json) { var parsed_json = JSON.parse(post_json); var html_string = ''; $.each(parsed_json, function (jsonkey, jsonval) { html_string += '<ul class="thread accordion" data-accordion data-allow-all-closed="true">'; html_string += '<li class="accordion-item" data-accordion-item>'; html_string += '<a href="#" class="accordion-title"><span class="stat post_score">-</span> points <div class="post_title"></div></a>'; html_string += '<div class="accordion-content post_details" data-tab-content></div>'; html_string += '</li></ul>'; }); $('#thread').html(html_string); return parsed_json; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getThreads() {\n $.ajax({\n url: \"/threads\"\n }).done(function (data) {\n\n $('#showThreads').html('');\n\n\n console.log('Fetched / threads: ', data);\n for (var i = 0; i < data.length; i++) {\n\n var textContent = data[i].text;\n if (data[i].text...
[ "0.70848453", "0.6893722", "0.6673581", "0.6621284", "0.65684307", "0.6479202", "0.63952625", "0.6391868", "0.6377335", "0.6341166", "0.63128823", "0.6296942", "0.6244111", "0.6243373", "0.6235244", "0.6235244", "0.6226057", "0.62163657", "0.620201", "0.618893", "0.61732453",...
0.63590777
9
Populate the HTML with the content from Reddit's API
function populate_posts(parsed_json) { let post_counter = 0; const REDDIT_HOST = 'https://www.reddit.com'; $.each(parsed_json, function (jsonkey, jsonval) { let media_html = ''; let epoch_date = parsed_json[jsonkey]['date_created']; let date_object = new Date(epoch_date*1000); let string_date = date_object.getMonth() + '/' + date_object.getDate() + '/' + date_object.getFullYear() + ' ' + date_object.getHours() + ':' + date_object.getMinutes(); post_counter++; if (typeof parsed_json[jsonkey]['author']['media'] !== 'undefined' && typeof parsed_json[jsonkey]['author']['media']['url'] !== 'undefined') { media_html = '<img src="' + parsed_json[jsonkey]['author']['media']['url'] + '">'; } $('.post_score', $('#thread>ul:nth-child(' + post_counter + ')')).text( parsed_json[jsonkey]['score'] ); $('.post_title', $('#thread>ul:nth-child(' + post_counter + ')')).html( '<div><a href="#" onclick="call_external_url(\'' + REDDIT_HOST + parsed_json[jsonkey]['permalink'] + '\')" class="button large" target="_blank">' + parsed_json[jsonkey]['title'] + '</a></div>' ); $('.post_details', $('#thread>ul:nth-child(' + post_counter + ')')).html( 'Posted on ' + string_date + ' by ' + parsed_json[jsonkey]['author'] + '<br>' + media_html ); }); return post_counter; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reddit() {\n // Reddit API with Proxy\n let apiCall = fetch('https://cors.bridged.cc/https://www.reddit.com/top.json');\n apiCall\n .then(res => res.json())\n .then(results => {\n results.data.children.forEach(function(result){\n console.log(result.data)\n \n let article = document.c...
[ "0.68995035", "0.6569811", "0.64364856", "0.6370415", "0.6361075", "0.63212126", "0.6302901", "0.6293861", "0.628242", "0.62605184", "0.62585354", "0.62449455", "0.6243968", "0.62207043", "0.62064564", "0.61715287", "0.61712945", "0.6145633", "0.61420506", "0.6139941", "0.613...
0.6555047
2
Hide any of the posts we don't want to display for userfriendly pagination
function paginate_posts() { $('#thread>ul').each(function(index){ if (index >= 5) { $(this).css('display', 'none') } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideAllPosts() {\n\tfor(var i = 0; i < allPosts.length; i++) {\n\t\tallPosts[i].style.display = \"none\";\n\t}\n}", "function hideAllPosts() {\n const posts=document.getElementsByClassName('single_post_container');\n for (let i = 0; i < posts.length; i++) {\n posts[i].style.display = 'none';\n }\n...
[ "0.7571042", "0.7116022", "0.69771", "0.6717077", "0.66200143", "0.65152794", "0.64305097", "0.6372681", "0.6277065", "0.62524885", "0.6242123", "0.6232819", "0.6170743", "0.61633486", "0.61564714", "0.61354315", "0.613245", "0.6128478", "0.6128478", "0.60141826", "0.5965069"...
0.7307523
1
Create a navigation bar to allow user to navigate through posts
function create_pagination_bar(number_posts) { let html_string = ''; html_string = '<li class="pagination-previous" id="pagination_previous"><a href="#" class="disabled" aria-label="Previous page">Previous</a></li>'; html_string += '<li class="current"><span class="show-for-sr">You\'re on page</span> <span id="current_page_number">1</span></li>'; html_string += '<li class="pagination-next" id="pagination_next"><a href="#" aria-label="Next page">Next</a></li>'; $('#page_pagination').html(html_string); if (number_posts > 5) { $('#pagination_next a').click(function () { next_page(); }); }else{ $('#pagination_next a').addClass('disabled').off("click"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createNavigation() {\n var nav = {\n left: [],\n right: []\n };\n nav.right.push(new NavButton('Review Results', scope.review, true, false, 0));\n\n this.navigation = nav;\n }", ...
[ "0.6519173", "0.6514143", "0.6419517", "0.6382091", "0.6370068", "0.6345955", "0.6316852", "0.62824035", "0.6245296", "0.62235713", "0.619238", "0.61442465", "0.61287934", "0.6116736", "0.61076325", "0.607012", "0.60639024", "0.6011832", "0.6006766", "0.60027707", "0.5989016"...
0.5564801
84
dropdown group can change props of individual dropdowns bypassing the onChange event eslintdisablenextline react/nodeprecated
componentWillReceiveProps(nextProps) { const { disabled, options } = this.props; if (nextProps.disabled !== disabled || nextProps.options[0] !== options[0]) { this.triggerUpdate(null); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleDropDown(e)\n\t{\n\t\tlet role = e.target.value;\n\t\tthis.setState({role: role});\n }", "onChange(event) {\n this.props.onChange(event.target.selectedIndex);\n }", "change() {\n\n const divs = this.parent.querySelectorAll('[class^=\"toggle-select-\"],[class*=\" toggle-select-\"]');\n const ...
[ "0.6801464", "0.67467767", "0.6704142", "0.66918314", "0.6648288", "0.6629461", "0.66256034", "0.65746105", "0.6568861", "0.6549338", "0.65097475", "0.65085185", "0.64852405", "0.647541", "0.6462758", "0.6462251", "0.6435733", "0.6434126", "0.64236695", "0.64224505", "0.64001...
0.0
-1
Read T1 by kan 04/18
static fetchT1() { return db.execute('SELECT player.name as ID,player.real_name,player.position,`character`.name as "main",clan.name as "戰隊",player.photo FROM player,clan,`character` where player.belong_clan=clan.cid AND clan.cid=1 AND player.main = `character`.chid;'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTemp() {\n b.readTextFile(w1, printStatus);\n}", "function nth1() {\n if (response.list[0].dt_txt.slice([8], [10]) > 3 && response.list[0].dt_txt.slice([8], [10]) < 21) return 'th'; // \n switch (response.list[0].dt_txt.slice([8], [10]) % 10) {\n ...
[ "0.58315575", "0.5727436", "0.5548716", "0.5451111", "0.52184236", "0.521355", "0.5159424", "0.51486474", "0.5137295", "0.51366013", "0.5133497", "0.5100788", "0.5014688", "0.4989898", "0.4966448", "0.49443138", "0.4917501", "0.49107376", "0.48932648", "0.4879739", "0.4874558...
0.0
-1
Best First pathfinder used by p5js draw() method Uses A.
function BestFirstFinder(grid, start, end, heuristics) { AStarFinder(grid, start, end, function (x, y) { return heuristics(x, y) * 1000000; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\r\n\r\n if (openSet.length > 0) {\r\n\r\n var winner = 0;\r\n for (var i = 0; i < openSet.length; i++) {\r\n if (openSet[i].f < openSet[winner].f) {\r\n winner = i;\r\n }\r\n }\r\n var current = openSet[winner];\r\n\r\n if...
[ "0.5922081", "0.5920368", "0.5870053", "0.5769986", "0.57572454", "0.57114106", "0.5656594", "0.56528234", "0.5606088", "0.5560557", "0.55371034", "0.55215544", "0.5507736", "0.54781115", "0.5465885", "0.5461292", "0.5459462", "0.5453845", "0.5450491", "0.5402848", "0.5388366...
0.5264561
28
Best First pathfinder Uses A.
function BestFirstFinderFast(grid, start, end, heuristics) { AStarFinderFast(grid, start, end, function (x, y) { return heuristics(x, y) * 1000000; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BestFirstFinder(grid, start, end, heuristics) {\n AStarFinder(grid, start, end, function (x, y) {\n return heuristics(x, y) * 1000000;\n });\n}", "function bestPathFinder(bPath , path){\n if (path < bPath){\n return path;\n }\n return bPath\n}", "function executeAlgo() {\n\tif(alg...
[ "0.64661515", "0.61172557", "0.60119075", "0.59893996", "0.59232974", "0.5794908", "0.5701615", "0.5594534", "0.5579405", "0.5535318", "0.55197054", "0.55136806", "0.5470742", "0.5467158", "0.5461829", "0.54403603", "0.5408983", "0.5398611", "0.53921735", "0.5388783", "0.5370...
0.61762005
1
add to entry table
function getVolumeIDfromDB() { var volume_id; connection.query('SELECT volume_id FROM Volume WHERE volume_comicVineId = ?', volume_comicVineId, function (err, response) { if (err) throw err; value = JSON.stringify(response); var newStr = value.substring(1, value.length-1); var strippedStr = JSON.parse(newStr); volume_id = strippedStr.volume_id; addComicToLib(volume_id); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addEntry(tableName, entry) {\n $(tableName).append(\"<tr><td>\" + entry + \"</td></tr>\");\n}", "function addEntries() {\n\n}", "add(entry) {\n this.amount.add(entry.amount);\n this.count += 1;\n this.dbUpdater.update();\n }", "_add (table, type) {\n table = this._sanitizeTable(table...
[ "0.7766646", "0.6773895", "0.67055917", "0.6688207", "0.668369", "0.6660192", "0.6518577", "0.65067726", "0.6477604", "0.64427876", "0.64352846", "0.64102465", "0.64017", "0.6379507", "0.63751316", "0.63363165", "0.632313", "0.6294325", "0.62839466", "0.62786967", "0.6271687"...
0.0
-1
the last step to adding to the join table
function addComicToLib(volume_id){ var params = [user_id, volume_id, 0] connection.query('INSERT into entry (entry_user_id, entry_volume_id, entry_status) VALUES (?, ?, ?)', params, function (err, res) { if(err) throw err; console.log("Insert into entry complete"); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addRelation(key: string, fromClassName: string, fromId: string, toId: string) {\n const doc = {\n relatedId: toId,\n owningId: fromId,\n };\n return this.adapter.upsertOneObject(\n `_Join:${key}:${fromClassName}`,\n relationSchema,\n doc,\n doc,\n this._transactionalSess...
[ "0.6197643", "0.5650161", "0.55592877", "0.54956216", "0.5455508", "0.5355109", "0.5345657", "0.5232178", "0.52301806", "0.5209116", "0.5193537", "0.51583433", "0.5156018", "0.50933623", "0.50839704", "0.50556815", "0.5025483", "0.49960914", "0.49843237", "0.49763164", "0.496...
0.0
-1
construct "horse" replacement for "force" components
function replacement_horse(match,f,or,c,e) { return horse_subs[f] + or + horse_subs[c] + e; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Base(hob_h)\n{\n this.base_h = 4.2; // Base plate thickness.\n this.support_wall = 2.0;\n \n this.round_d = nema.side_size - nema.mount_dist * 2;\n this.shaft_base_h = hob_h - lever.h / 2.0;\n this.spring_z = hob_h;\n this.spring_x = lever.spring_offset_x;\n this.spring_y...
[ "0.56883687", "0.56167364", "0.5571768", "0.55637914", "0.5451678", "0.5376955", "0.5376955", "0.5376955", "0.5376955", "0.5368486", "0.53668207", "0.53312576", "0.5310129", "0.52896947", "0.5280816", "0.52649194", "0.52566403", "0.5250467", "0.5145149", "0.51359594", "0.5131...
0.4984562
39
Transform all instances of "force" in a string into "horse"
function horsify(str) { return str.replace(force_pattern, replacement_horse); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function replaceBadWords(string){\n let stringLower = string.toLowerCase();\n let arr = stringLower.split(' ');\n\n let arrRes = arr.map((item)=>{\n if(item.includes(`fuck`)){\n return item.replace(`fuck`, `****`);\n };\n\n if(item.includes(`shit`)){\n return i...
[ "0.63662547", "0.6360232", "0.60796654", "0.5938724", "0.5800178", "0.5786906", "0.57405627", "0.57165", "0.56855404", "0.56524885", "0.5617037", "0.5590352", "0.5588605", "0.5544027", "0.5535514", "0.55035925", "0.5491884", "0.548454", "0.5451415", "0.54398286", "0.541589", ...
0.74673176
0
to get the numbers of days in a year between two dates parameter: startDate start of Date parameter: endDate end of Date parameter: compSwAddtl condition ,if condition is blank ("") = 0 , for PRORATE
function computeNoOfDays(startDate,endDate,compSwAddtl) { var noOfDays = ""; if (startDate == "" || endDate == "") { return noOfDays; } else { var addtl = 0; if ("Y" == compSwAddtl) { addtl = 1; } else if ("M" == compSwAddtl) { addtl = -1; } var iDateArray = startDate.split("-"); var iDate = new Date(); var date = parseInt(iDateArray[1], 10); var month = parseInt(iDateArray[0], 10); var year = parseInt(iDateArray[2], 10); iDate.setFullYear(year, month-1, date); var eDateArray = endDate.split("-"); var eDate = new Date(); var edate = parseInt(eDateArray[1], 10); var emonth = parseInt(eDateArray[0], 10); var eyear = parseInt(eDateArray[2], 10); eDate.setFullYear(eyear, emonth-1, edate); var oneDay = 1000*60*60*24; noOfDays = Math.floor((parseInt(Math.floor(eDate.getTime() - iDate.getTime()))/oneDay)) + addtl; } return (isNaN(noOfDays) ? "" : noOfDays); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CalculateYearToDays (year1, year2){\n var localOutput = 0;\n \n for (i = year1; i < year2; i++){\n if (IsItLeapYear(i)){\n localOutput += 366;\n }else if (inputYear = checkLeap){\n localOutput += 365;\n }\n else{\n localOutput += 365;\n ...
[ "0.7191322", "0.70364183", "0.70163727", "0.6994773", "0.68467623", "0.66216874", "0.6611537", "0.65826917", "0.6575831", "0.6433533", "0.64298487", "0.6292513", "0.6219477", "0.62100714", "0.61972636", "0.6161396", "0.61277324", "0.61249846", "0.6120045", "0.61182165", "0.60...
0.7600015
0
Returns a new array created by patching the diff into the old array. The diff formatted with alternating matching and mismatching segments: ... repeated until the end of diff. Example 1: patching a diff of [1, 1, 3] onto [0, 0] yields [0, 3]. Example 2: patching a diff of [0, 1, 2, 1] onto [0, 0] yields [2, 0].
function patch(old, diff) { var out = []; var i = 0; while (i < diff.length) { if (diff[i]) { // matching Array.prototype.push.apply( out, old.slice(out.length, out.length + diff[i]) ); } i++; if (i < diff.length && diff[i]) { // mismatching Array.prototype.push.apply(out, diff.slice(i + 1, i + 1 + diff[i])); i += diff[i]; } i++; } return out; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function patch(old, diff) {\n\tvar out = [];\n\tvar i = 0;\n\twhile (i < diff.length) {\n\t\tif (diff[i]) { // matching\n\t\t\tArray.prototype.push.apply(out, old.slice(out.length, out.length + diff[i]));\n\t\t}\n\t\ti++;\n\t\tif (i < diff.length && diff[i]) { // mismatching\n\t\t\tArray.prototype.push.apply(out...
[ "0.7940562", "0.7940562", "0.67407745", "0.62020046", "0.6099448", "0.60585386", "0.58769816", "0.569291", "0.56784374", "0.563608", "0.5630012", "0.5630012", "0.5630012", "0.5630012", "0.56138676", "0.5608321", "0.55820805", "0.55820805", "0.55820805", "0.55820805", "0.55820...
0.79000616
2
STATE var channel; INITIALIZATION/FINALIZATION
function init() { wndConversations = Cc['@mozilla.org/appshell/window-mediator;1'] .getService(Ci.nsIWindowMediator) .getMostRecentWindow('SamePlace:Conversations'); if(!wndConversations) { wndConversations = window.open( 'chrome://sameplace/content/conversations/conversations.xul', 'SamePlace:Conversations', 'chrome'); wndConversations.addEventListener('load', function(event) { setTimeout(function() { wndConversations.hide(); }); }, false); } window.addEventListener('contact/select', selectedContact, false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Channel() {\n\t\tthis._listeners = {};\n\t}", "createChannel() {\n\t\t// Set the depends - add self aggs query as well with depends\n\t\tlet depends = this.props.depends ? this.props.depends : {};\n\t\tdepends['aggs'] = {\n\t\t\tkey: this.props.inputData,\n\t\t\tsort: this.props.sort,\n\t\t\tsize: this....
[ "0.68814677", "0.6808491", "0.6774522", "0.6730335", "0.6626495", "0.6570436", "0.6468089", "0.64424396", "0.6387115", "0.6319921", "0.6231061", "0.62302846", "0.6198635", "0.6165498", "0.6157131", "0.61427003", "0.61173564", "0.601892", "0.601117", "0.6000523", "0.59982073",...
0.0
-1
Build flat array from all nodes
function buildFlatArray(root){ for(var i = 0; i < root.length; i++){ // If this node doesn't exist push it to flat array function checkDups(oneN){ return oneN.id == root[i].id; } var exists = $rootScope.nodesFlat.find(checkDups); console.log(exists); if(!exists){ $rootScope.nodesFlat.push({ id: root[i].id, name: root[i].name }); } if(root[i].children.length != null){ buildFlatArray(root[i].children); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function populateNodes(tree) {\n var out = [];\n visitInternal(tree, out);\n return out;\n }", "toArray() {\n let arr = [];\n this.traverse((currentNode) => {\n arr.push(currentNode.value);\n });\n return arr;\n }", "toArray() {\n let...
[ "0.66906863", "0.6665045", "0.66382796", "0.6527132", "0.64570826", "0.63821554", "0.62669384", "0.623203", "0.6231619", "0.6229337", "0.6170605", "0.61699957", "0.6162592", "0.6156094", "0.612812", "0.6118432", "0.609894", "0.60864276", "0.6082877", "0.6082877", "0.6082877",...
0.6478558
4
If this node doesn't exist push it to flat array
function checkDups(oneN){ return oneN.id == root[i].id; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildFlatArray(root){\n\n\n for(var i = 0; i < root.length; i++){\n\n // If this node doesn't exist push it to flat array\n function checkDups(oneN){\n return oneN.id == root[i].id;\n }\n var exists = $rootScope.node...
[ "0.6237649", "0.5620177", "0.5598183", "0.5442303", "0.5436147", "0.5269325", "0.5243295", "0.52255124", "0.51986927", "0.51855856", "0.5129509", "0.510671", "0.5095381", "0.50572443", "0.5043629", "0.5043629", "0.5039396", "0.5031622", "0.5030098", "0.50255793", "0.502036", ...
0.0
-1
Return object with new file name and type
function filePrepare(name, type, extension){ var newProps = {}; newProps.name = name + "." + extension; newProps.type = type + "." + extension; return newProps; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handle(type) {\n // Handling newfile, newfolder.\n var newFile = document.getElementById('new' + type);\n newFile.addEventListener('click', function() {\n var name = search.value;\n if (name === '') {\n search.value = type; search.focus(); search.select(); return false;\n }\...
[ "0.623313", "0.61705613", "0.60797817", "0.60794526", "0.6019139", "0.6003935", "0.59760463", "0.5960772", "0.5858101", "0.5831427", "0.5762635", "0.57478255", "0.5713783", "0.56555", "0.5638147", "0.56356955", "0.5632847", "0.5632736", "0.55874157", "0.55819833", "0.55638874...
0.636848
0
Function to compare objects by property studentID
function compare(result1, result2) { if (result1.StudentID < result2.StudentID) { return -1; } if (result1.StudentID > result2.StudentID) { return 1; } return 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStudentById (id){\n function getStudent (student){\n return student.id == id;\n }\n\n return students.find(getStudent);\n\n}", "function compareById( left, right) {\n \"use strict\";\n/*\n -- Step 2: Evaluate if the value of the property id of the object1 is greater than\n the val...
[ "0.6257275", "0.6227299", "0.617287", "0.6021051", "0.6012352", "0.59897053", "0.5934495", "0.5891602", "0.58730507", "0.5857515", "0.58344537", "0.57599646", "0.5701624", "0.56824213", "0.5656419", "0.5635933", "0.562397", "0.5599152", "0.55798835", "0.5566014", "0.55541474"...
0.6130726
3