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
Load (or reload) controller from js code (another controller) call it's init function
function load(controllerName, query) { var url = controllerName + ".html"; require(['js/' + controllerName + '/'+ controllerName + 'Controller'], function(controller) { basicInfo = new BasicInfo() controller.init(basicInfo, query); $('.tab-link').each(function(index) { if ($(this).attr('href') == url) $(this).addClass('active'); else $(this).removeClass('active'); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initilizeController(){\n }", "function initController() {\n }", "function initiateController() {\n window.extensions.KJSLINT.Panels.Command.Controller.init();\n }", "function initController() {\r\n loadProjects();\r\n }", "function initController(){\n loadC...
[ "0.73674774", "0.7237928", "0.71068484", "0.70868456", "0.6924114", "0.68932307", "0.6882001", "0.6882001", "0.6791715", "0.6791715", "0.66455775", "0.66058433", "0.6590782", "0.65319896", "0.6509792", "0.6448334", "0.6419772", "0.63552946", "0.6332596", "0.6319235", "0.63129...
0.59068936
41
Register button clicked run this function, ajax post to controllers.LaunchController.loginUser via routes
function btnRegisterSubmit_click(){ var id = $('#signin-id-input').val(); var email =$('#signin-email-input').val(); var pwd = $('#signin-pwd-input').val(); var repwd = $('#signin-repwd-input').val(); if(id.length!=0 && email.length!=0 && pwd.length!=0 && repwd.length!=0){ ///Email format validation check by regular expression var regex = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/; if (regex.test($('#signin-email-input').val()) === false) { alert("유효하지 않은 E-mail입니다. 다시 입력하세요."); $('#signin-email-input').val(""); } else { if(pwd != repwd){ alert("정확히 다시 입력하세요."); $('#signin-repwd-input').val(""); } else{ var obj = new Object(); obj.type = "signin"; obj.id = id; obj.email=email; obj.pwd = pwd; var jsonString = JSON.stringify(obj); $.ajax({ type : 'POST', crossOrigin: true, url : "/login", data : obj, success : function(e) { $('#signin-id-input').val(""); $('#signin-email-input').val(""); $('#signin-pwd-input').val(""); $('#signin-repwd-input').val(""); window.location.replace("/main"); // if register success, load main.scala.html (dashboard) check controller.PageController.main } }); } } } else{ alert("모든 값을 입력하세요.") $('#registerfrm').submit(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function register() {\n $.post(\"AJAX/register-user.cshtml\",\n {\n username: username,\n email: email,\n password: password\n },\n (data, status) => {\n console.log(\"\\nData:\\n\" + data + \"\\nStatus:\\n\" + status);\n \n });\...
[ "0.69043005", "0.68930745", "0.68645704", "0.68081367", "0.67222464", "0.6681365", "0.6676987", "0.66297686", "0.6612458", "0.6563979", "0.65474725", "0.652968", "0.6506978", "0.65067965", "0.64755446", "0.6472516", "0.64688444", "0.64673007", "0.6453768", "0.64505726", "0.64...
0.66911334
5
]]> loc du lieu
function myFunction() { var input, filter, table, tr, td, i, txtValue; input = document.getElementById("myInput"); filter = input.value.toUpperCase(); table = document.getElementById("myTable"); tr = table.getElementsByTagName("tr"); for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName("td")[1]; if (td) { txtValue = td.textContent || td.innerText; if (txtValue.toUpperCase().indexOf(filter) > -1) { tr[i].style.display = ""; } else { tr[i].style.display = "none"; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ea(){}", "private public function m246() {}", "replacerChangNiveau(){\n this.viderLaFile();\n this.cellule = this.jeu.labyrinthe.cellule(0,0);\n this.direction = 1;\n\t\t\t\tthis.vitesse = 0;\n }", "function simple(){\n aff('Exercice n°01 : Bienvenue');\n var name = 'lo...
[ "0.5652979", "0.5627189", "0.5595085", "0.5555951", "0.54523736", "0.5430987", "0.54224193", "0.53871244", "0.537434", "0.53690946", "0.53671944", "0.5349555", "0.5339269", "0.53140086", "0.5290455", "0.52744496", "0.52698827", "0.52632225", "0.52583313", "0.52569306", "0.524...
0.0
-1
GET request to the spacexdata api, grab out all the required data and store it in an array.
componentWillMount() { var launches = []; axios.get('https://api.spacexdata.com/v3/launches/past') .then((req) => { this.setState({"items": req.data}); req.data.forEach(obj => { var singleLaunch = {}; singleLaunch['launch_year'] = obj.launch_year; singleLaunch['mission_name'] = obj.mission_name; singleLaunch['launch_site_name'] = obj.launch_site.site_name_long; singleLaunch['payload_mass_kg'] = obj.rocket.second_stage.payloads[0].payload_mass_kg; singleLaunch['land_success'] = String(obj.rocket.first_stage.cores[0].land_success); launches = [...launches, singleLaunch]; }) this.setState({"items": launches}); }) .catch(err => { console.log(err) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getData(){\r\n\r\n \r\n //url of the site where the info comes from\r\n const Launches_URL = \"https://api.spacexdata.com/v2/launches/all\";\r\n \r\n let url = Launches_URL;\r\n\r\n \r\n \r\n \r\n //calling the method that will look through th...
[ "0.664377", "0.6622786", "0.6604872", "0.6239379", "0.62161946", "0.6199637", "0.6176015", "0.6162047", "0.5946423", "0.59363014", "0.59297293", "0.5926661", "0.5916459", "0.59053874", "0.58781564", "0.58560747", "0.5813922", "0.580794", "0.58037984", "0.5790968", "0.5737599"...
0.0
-1
Return a unique ID that can be assigned to an observable for dependency tracking. Theoretically, you could eventually overflow the number storage size, resulting in duplicate IDs. But in JavaScript, the largest exact integral value is 2^53 or 9,007,199,254,740,992. If you created 1,000,000 IDs per second, it would take over 285 years to reach that number. Reference
function getId() { return ++lastId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function uniqueID() {\n return Math.round(new Date().getTime() * (Math.random() * 100));\n }", "function createId() {\n\tvar id = Math.floor( Math.random() * 100000 ) + 1;\n\treturn id;\n}", "function createID() {\n return Math.floor(Math.random() * 100000000000);\n}", "function generateId() {\n ...
[ "0.76844907", "0.7581741", "0.75364333", "0.7536082", "0.752612", "0.7521134", "0.75026023", "0.7491074", "0.7479059", "0.7447655", "0.7445163", "0.7413323", "0.74085927", "0.73978394", "0.73782", "0.73623604", "0.736198", "0.7361333", "0.7357073", "0.7357073", "0.7357073", ...
0.0
-1
The binding context object includes static properties for the current, parent, and root view models. If a view model is actually stored in an observable, the corresponding binding context object, and any child contexts, must be updated when the view model is changed.
function updateContext() { // Most of the time, the context will directly get a view model object, but if a function is given, // we call the function to retrieve the view model. If the function accesses any obsevables or returns // an observable, the dependency is tracked, and those observables can later cause the binding // context to be updated. var dataItemOrObservable = isFunc ? dataItemOrAccessor() : dataItemOrAccessor, dataItem = ko.utils.unwrapObservable(dataItemOrObservable); if (parentContext) { // When a "parent" context is given, register a dependency on the parent context. Thus whenever the // parent context is updated, this context will also be updated. if (parentContext._subscribable) parentContext._subscribable(); // Copy $root and any custom properties from the parent context ko.utils.extend(self, parentContext); // Because the above copy overwrites our own properties, we need to reset them. // During the first execution, "subscribable" isn't set, so don't bother doing the update then. if (subscribable) { self._subscribable = subscribable; } } else { self['$parents'] = []; self['$root'] = dataItem; // Export 'ko' in the binding context so it will be available in bindings and templates // even if 'ko' isn't exported as a global, such as when using an AMD loader. // See https://github.com/SteveSanderson/knockout/issues/490 self['ko'] = ko; } self['$rawData'] = dataItemOrObservable; self['$data'] = dataItem; if (dataItemAlias) self[dataItemAlias] = dataItem; // The extendCallback function is provided when creating a child context or extending a context. // It handles the specific actions needed to finish setting up the binding context. Actions in this // function could also add dependencies to this binding context. if (extendCallback) extendCallback(self, parentContext, dataItem); return self['$data']; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateContext() {\n // Most of the time, the context will directly get a view model object, but if a function is given,\n // we call the function to retrieve the view model. If the function accesses any observables or returns\n // an observable, the dependency is tracked, and th...
[ "0.7729418", "0.7680203", "0.7680203", "0.7640491", "0.76353496", "0.76353496", "0.76353496", "0.76353496", "0.76145273", "0.75955725", "0.7506894", "0.7365157", "0.66395456", "0.642034", "0.6334558", "0.61824316", "0.6145124", "0.60111", "0.5719577", "0.5696956", "0.55442894...
0.74857
12
Returns the valueAccesor function for a binding value
function makeValueAccessor(value) { return function() { return value; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeValueAccessor(value) {\n return function () {\n return value;\n };\n }", "function makeValueAccessor(value) {\n return function() {\n return value;\n };\n }", "function makeValueAccessor(value) ...
[ "0.644786", "0.6169277", "0.6169277", "0.6169277", "0.6169277", "0.6169277", "0.6169277", "0.6169277", "0.6169277", "0.5979802", "0.59227747", "0.59073776", "0.58821946", "0.57806706", "0.5733423", "0.56551385", "0.5635954", "0.56089807", "0.56039524", "0.5599379", "0.5474708...
0.6320255
3
Returns the value of a valueAccessor function
function evaluateValueAccessor(valueAccessor) { return valueAccessor(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function evaluateValueAccessor (valueAccessor) {\n return valueAccessor()\n }", "function evaluateValueAccessor(valueAccessor) {\n return valueAccessor();\n }", "function evaluateValueAccessor(valueAccessor) {\n return valueAccessor();\n }", "function evaluateValue...
[ "0.82307124", "0.8219515", "0.8170258", "0.8148536", "0.8148536", "0.8148536", "0.8148536", "0.8148536", "0.8148536", "0.8148536", "0.8148536", "0.7644628", "0.76069796", "0.7545255", "0.7545255", "0.7545255", "0.74490565", "0.74490565", "0.74490565", "0.74490565", "0.7449056...
0.82074046
4
Given a function that returns bindings, create and return a new object that contains binding valueaccessors functions. Each accessor function calls the original function so that it always gets the latest value and all dependencies are captured. This is used by ko.applyBindingsToNode and getBindingsAndMakeAccessors.
function makeAccessorsFromFunction(callback) { return ko.utils.objectMap(ko.dependencyDetection.ignore(callback), function(value, key) { return function() { return callback()[key]; }; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "makeBindingAccessors (bindings, context, node) {\n if (typeof bindings === 'function') {\n return this.makeAccessorsFromFunction(bindings.bind(null, context, node))\n } else {\n return objectMap(bindings, this.makeValueAccessor)\n }\n }", "function makeBindingAccessors(bindings, c...
[ "0.7839172", "0.7835442", "0.7835442", "0.7835442", "0.7835442", "0.7835442", "0.7835442", "0.7835442", "0.7835442", "0.7832581", "0.7832581", "0.7832581", "0.7808206", "0.7019667", "0.69962955", "0.69962955", "0.69962955", "0.6892035", "0.6892035", "0.6892035", "0.6892035", ...
0.6012142
39
Given a bindings function or object, create and return a new object that contains binding valueaccessors functions. This is used by ko.applyBindingsToNode.
function makeBindingAccessors(bindings, context, node) { if (typeof bindings === 'function') { return makeAccessorsFromFunction(bindings.bind(null, context, node)); } else { return ko.utils.objectMap(bindings, makeValueAccessor); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeBindingAccessors(bindings, context, node) {\n if (typeof bindings === 'function') {\n return makeAccessorsFromFunction(bindings.bind(null, context, node));\n } else {\n return ko.utils.objectMap(bindings, makeValueAcce...
[ "0.78046787", "0.7790671", "0.7790671", "0.7790671", "0.7790671", "0.7790671", "0.7790671", "0.7790671", "0.7790671", "0.7686497", "0.660013", "0.65840673", "0.65840673", "0.65840673", "0.6436627", "0.6436627", "0.6436627", "0.6436627", "0.6436627", "0.6436627", "0.6436627", ...
0.7832013
2
This function is used if the binding provider doesn't include a getBindingAccessors function. It must be called with 'this' set to the provider instance.
function getBindingsAndMakeAccessors(node, context) { return makeAccessorsFromFunction(this['getBindings'].bind(this, node, context)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBindingsAndMakeAccessors (node, context) {\n const bindingsFn = this.providerObject.getBindings.bind(this.providerObject, node, context);\n return this.makeAccessorsFromFunction(bindingsFn)\n }", "function getBindingsAndMakeAccessors(node, context) {\n return makeAccessorsFromF...
[ "0.68577576", "0.6389461", "0.63457733", "0.6320145", "0.62521076", "0.61818063", "0.61818063", "0.61818063", "0.61818063", "0.61818063", "0.61818063", "0.61818063", "0.61818063", "0.6171506", "0.6171506", "0.6171506", "0.6163265", "0.6122634", "0.6079923", "0.60291374", "0.6...
0.63668627
4
Use of allBindings as a function is maintained for backwards compatibility, but its use is deprecated
function allBindings() { return ko.utils.objectMap(bindingsUpdater ? bindingsUpdater() : bindings, evaluateValueAccessor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function allBindings() {\n return objectMap(bindingsUpdater ? bindingsUpdater() : bindings, evaluateValueAccessor);\n }", "function allBindings () {\n return objectMap(bindingsUpdater ? bindingsUpdater() : bindings, evaluateValueAccessor)\n }", "function allBindings() {\n ...
[ "0.8146741", "0.8140547", "0.79797053", "0.79378724", "0.79378724", "0.79378724", "0.79378724", "0.79378724", "0.79378724", "0.79378724", "0.79378724", "0.68821084", "0.6657657", "0.66334903", "0.65729946", "0.6489872", "0.6489872", "0.6489872", "0.6468127", "0.6436297", "0.6...
0.79595983
5
Makes a binding like with or if
function makeWithIfBinding(bindingKey, isWith, isNot, makeContextCallback) { ko.bindingHandlers[bindingKey] = { 'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) { var didDisplayOnLastUpdate, savedNodes; ko.computed(function() { var dataValue = ko.utils.unwrapObservable(valueAccessor()), shouldDisplay = !isNot !== !dataValue, // equivalent to isNot ? !dataValue : !!dataValue isFirstRender = !savedNodes, needsRefresh = isFirstRender || isWith || (shouldDisplay !== didDisplayOnLastUpdate); if (needsRefresh) { // Save a copy of the inner nodes on the initial update, but only if we have dependencies. if (isFirstRender && ko.computedContext.getDependenciesCount()) { savedNodes = ko.utils.cloneNodes(ko.virtualElements.childNodes(element), true /* shouldCleanNodes */); } if (shouldDisplay) { if (!isFirstRender) { ko.virtualElements.setDomNodeChildren(element, ko.utils.cloneNodes(savedNodes)); } ko.applyBindingsToDescendants(makeContextCallback ? makeContextCallback(bindingContext, dataValue) : bindingContext, element); } else { ko.virtualElements.emptyNode(element); } didDisplayOnLastUpdate = shouldDisplay; } }, null, { disposeWhenNodeIsRemoved: element }); return { 'controlsDescendantBindings': true }; } }; ko.expressionRewriting.bindingRewriteValidators[bindingKey] = false; // Can't rewrite control flow bindings ko.virtualElements.allowedBindings[bindingKey] = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function simpleBind(context,fn){return function(value){fn.call(context,value);};}", "function bind(value){var lView=getLView();return bindingUpdated(lView,lView[BINDING_INDEX]++,value)?value:NO_CHANGE;}", "function bindable(){\n\t\t\n\t}", "function simpleBind(context, fn) { ...
[ "0.6507822", "0.6353678", "0.6320383", "0.62198526", "0.61838305", "0.6112397", "0.6111167", "0.6034252", "0.6034252", "0.60112244", "0.5999314", "0.5999314", "0.5999314", "0.5999314", "0.5999314", "0.5995306", "0.5975392", "0.59434617", "0.59120345", "0.59057206", "0.5905720...
0.6098783
8
Simple calculation based on Levenshtein distance.
function compareArrays(oldArray, newArray, options) { // For backward compatibility, if the third arg is actually a bool, interpret // it as the old parameter 'dontLimitMoves'. Newer code should use { dontLimitMoves: true }. options = (typeof options === 'boolean') ? { 'dontLimitMoves': options } : (options || {}); oldArray = oldArray || []; newArray = newArray || []; if (oldArray.length <= newArray.length) return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options); else return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringCompByLevenshteinDistance(s1,s2){\n\tlet longer = s1;\n\tlet shorter = s2;\n\tif (s1.length < s2.length) {\n\t\tlonger = s2;\n\t\tshorter = s1;\n\t}\n\tvar longerLength = longer.length;\n\tif (longerLength == 0) {\n\t\treturn 1.0;\n\t}\n\treturn (longerLength - editDistance(longer, shorter)) / parse...
[ "0.8275167", "0.7799088", "0.7767071", "0.75914854", "0.7547063", "0.74966866", "0.7487881", "0.74867857", "0.73635983", "0.73543656", "0.72983307", "0.72502756", "0.7233416", "0.7195262", "0.71762425", "0.71755457", "0.7136185", "0.7135121", "0.71308506", "0.7128799", "0.707...
0.0
-1
Objective: Given an input array, a container DOM node, and a function from array elements to arrays of DOM nodes, map the array elements to arrays of DOM nodes, concatenate together all these arrays, and use them to populate the container DOM node Next time we're given the same combination of things (with the array possibly having mutated), update the container DOM node so that its children is again the concatenation of the mappings of the array elements, but don't remap any array elements that we previously mapped retain those nodes, and just insert/delete other ones "callbackAfterAddingNodes" will be invoked after any "mapping"generated nodes are inserted into the container node You can use this, for example, to activate bindings on those nodes.
function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) { // Map this array value inside a dependentObservable so we re-map when any dependency changes var mappedNodes = []; var dependentObservable = ko.dependentObservable(function() { var newMappedNodes = mapping(valueToMap, index, ko.utils.fixUpContinuousNodeArray(mappedNodes, containerNode)) || []; // On subsequent evaluations, just replace the previously-inserted DOM nodes if (mappedNodes.length > 0) { ko.utils.replaceDomNodes(mappedNodes, newMappedNodes); if (callbackAfterAddingNodes) ko.dependencyDetection.ignore(callbackAfterAddingNodes, null, [valueToMap, newMappedNodes, index]); } // Replace the contents of the mappedNodes array, thereby updating the record // of which nodes would be deleted if valueToMap was itself later removed mappedNodes.length = 0; ko.utils.arrayPushAll(mappedNodes, newMappedNodes); }, null, { disposeWhenNodeIsRemoved: containerNode, disposeWhen: function() { return !ko.utils.anyDomNodeIsAttachedToDocument(mappedNodes); } }); return { mappedNodes : mappedNodes, dependentObservable : (dependentObservable.isActive() ? dependentObservable : undefined) }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {\n // Map this array value inside a dependentObservable so we re-map when any dependency changes\n var mappedNodes = [];\n var dependentObservable = k...
[ "0.6603838", "0.65494925", "0.65494925", "0.65494925", "0.65494925", "0.65494925", "0.65494925", "0.65494925", "0.6540742", "0.64597815", "0.64268744", "0.6322469", "0.6247582", "0.5875311", "0.5607404", "0.5551369", "0.55266005", "0.5524079", "0.5513698", "0.5513698", "0.548...
0.652609
11
Convert Stringformatted options into Objectformatted ones and store in cache
function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.split( core_rspace ), function( _, flag ) { object[ flag ] = true; }); return object; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createOptions( options ) {\n var object = optionsCache[ options ] = {};\n jQuery.each( options.split( core_rspace ), function( _, flag ) {\n object[ flag ] = true;\n });\n return object;\n }", "function createOptions( options ) {\n var object = optionsCache[ ...
[ "0.65983355", "0.65088433", "0.64988786", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.647308", "0.6450778", "0.64444906", "0.6403399", "0.6280776", "0.6278151", ...
0.6588602
1
checks a cache object for emptiness
function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "emptyCache() {\n this.cache = {};\n }", "emptyCache() {\n this.cache = {};\n }", "function clearcache() {\n dbgmsg( 'retrieveData: Internal cache contain attribute values for: ' + Object.keys( cache ).sort().join( '; ' ) );\n cache = {};\n logmsg( 'retrieveData: cache cleared.' );\n }", "fu...
[ "0.7050553", "0.7050553", "0.66289544", "0.6554919", "0.65317714", "0.64950603", "0.64907366", "0.64907366", "0.64907366", "0.6364922", "0.63472253", "0.6262434", "0.6233119", "0.6168802", "0.6158475", "0.6138711", "0.61330646", "0.61330646", "0.6131914", "0.6131914", "0.6101...
0.0
-1
Returns a function to use in pseudos for input types
function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createInputPseudo(type) {\n return function(elem) {\n var name = elem.nodeName.toLowerCase();\n return name === \"input\" && elem.type === type;\n };\n }", "function createInputPseudo( type ) {\r\r\n\treturn function( elem ) {\r\r\n\t\tvar name ...
[ "0.64144033", "0.63896376", "0.63754016", "0.63754016", "0.63754016", "0.63754016", "0.63666767", "0.6362271", "0.63515526", "0.63515526", "0.63515526", "0.63515526", "0.63515526", "0.63515526", "0.63515526", "0.63515526", "0.63515526", "0.63515526", "0.63515526", "0.63515526",...
0.6371507
6
Returns a function to use in pseudos for buttons
function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createButtonPseudo(type) {\n return function(elem) {\n var name = elem.nodeName.toLowerCase();\n return (name === \"input\" || name === \"button\") && elem.type === type;\n };\n }", "static get BUTTON_X() {\n return \"x\";\n }", "fun...
[ "0.64884734", "0.64819735", "0.6478148", "0.64756554", "0.6465699", "0.64540684", "0.64501953", "0.64501953", "0.64501953", "0.64501953", "0.6437996", "0.64033014", "0.64033014", "0.64033014", "0.64033014", "0.64033014", "0.64033014", "0.64033014", "0.64033014", "0.64033014", ...
0.6529537
0
Returns a function to use in pseudos for positionals
function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createPositionalPseudo(fn) {\n return markFunction(function(argument) {\n argument = +argument;\n return markFunction(function(seed, matches) {\n var j,\n matchIndexes = fn([], seed.length, argument),\n ...
[ "0.62299865", "0.6221124", "0.60966897", "0.6070631", "0.6070631", "0.6070631", "0.6070631", "0.60172766", "0.59685814", "0.59685814", "0.59685814", "0.59685814", "0.59685814", "0.59685814", "0.59685814", "0.59685814", "0.59685814", "0.59685814", "0.59685814", "0.59685814", "...
0.61324084
2
A painfully simple check to see if an element is disconnected from a document (should be improved, where feasible).
function isDisconnected( node ) { return !node || !node.parentNode || node.parentNode.nodeType === 11; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isDisconnected(node){return !node||!node.parentNode||node.parentNode.nodeType===11;}", "function isDisconnected( node ) {\n return !node || !node.parentNode || node.parentNode.nodeType === 11;\n}", "function isDisconnected( node ) {\n return !node || !node.parentNode || node.parentNode.nodeType ==...
[ "0.7232", "0.682839", "0.6804032", "0.6804032", "0.6804032", "0.6804032", "0.67547387", "0.6728325", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6642035", "0.6...
0.6581669
29
Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem, i ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "filter() {\n\t}", "filter() {\n\t}", "function filter() {\n \n}", "function filterFunction() {\n \n}", "function Nothing$prototype$filter(pred) {\n return this;\n }", "removeAllFilters() {}", "function noFilter(filterObj) {\n return Object.\n keys(filterObj).\n ...
[ "0.7415891", "0.7415891", "0.71924883", "0.68619496", "0.67648804", "0.6652573", "0.64584637", "0.64584637", "0.64584637", "0.64584637", "0.6294628", "0.62928224", "0.6256001", "0.62469697", "0.6207571", "0.61991894", "0.61926854", "0.6190803", "0.6184332", "0.61646616", "0.6...
0.0
-1
Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fixDefaultChecked( elem ) {\n if ( manipulation_rcheckableType.test( elem.type ) ) {\n elem.defaultChecked = elem.checked;\n }\n }", "function fixDefaultChecked( elem ) {\n if ( rcheckableType.test( elem.type ) ) {\n elem.defaultChecked = elem.checked;\n }\n }", ...
[ "0.85473293", "0.84593266", "0.84593266", "0.8428615", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", "0.8427636", ...
0.8450395
3
return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vendorPropName(name){// Shortcut for names that are not vendor prefixed\nif(name in emptyStyle){return name;}// Check for vendor prefixed names\nvar capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name;}}}// Return a pro...
[ "0.81199294", "0.81199294", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.7741535", "0.77281314", "0.76649904", "0.76344436", "0.76290935", "0.7543812", "0.7490448", "0.74820906", "0.7476511", "0.74624354", ...
0.0
-1
Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) { if ( elemdisplay[ nodeName ] ) { return elemdisplay[ nodeName ]; } var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), display = elem.css("display"); elem.remove(); // If the simple way fails, // get element's real default display by attaching it to a temp iframe if ( display === "none" || display === "" ) { // Use the already-created iframe if possible iframe = document.body.appendChild( iframe || jQuery.extend( document.createElement("iframe"), { frameBorder: 0, width: 0, height: 0 }) ); // Create a cacheable copy of the iframe document on first call. // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML // document to it; WebKit & Firefox won't allow reusing the iframe document. if ( !iframeDoc || !iframe.createElement ) { iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; iframeDoc.write("<!doctype html><html><body>"); iframeDoc.close(); } elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); display = curCSS( elem, "display" ); document.body.removeChild( iframe ); } // Store the correct default display elemdisplay[ nodeName ] = display; return display; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getElementDefaultDisplay(elem) {\n\t\t// Get the 'visible' display style for the element\n\t\tvar testElem, nodeName,\n\t\t\tgetComputedStyle = global.getComputedStyle,\n\t\t\tcStyle = (elem.currentStyle || getComputedStyle.call(global, elem, \"\")).display;\n\n\t\tif (cStyle === \"none\" && !(cStyle = di...
[ "0.7472962", "0.72553515", "0.72553515", "0.7111155", "0.7098295", "0.7093641", "0.70717317", "0.70717317", "0.70607156", "0.70513785", "0.70513785", "0.70513785", "0.70513785", "0.70513785", "0.70513785", "0.70513785", "0.70513785", "0.70513785", "0.70513785", "0.7050581", "...
0.72743565
1
Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, list, placeBefore, dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), i = 0, length = dataTypes.length; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression for ( ; i < length; i++ ) { dataType = dataTypes[ i ]; // We control if we're asked to add before // any existing element placeBefore = /^\+/.test( dataType ); if ( placeBefore ) { dataType = dataType.substr( 1 ) || "*"; } list = structure[ dataType ] = structure[ dataType ] || []; // then we add to the structure accordingly list[ placeBefore ? "unshift" : "push" ]( func ); } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n this.config = Config.ajax;\n this.xhr;\n this.Serialize;\n }", "function AjaxPipelineConstructor() {\r\n BaseObject.call(this,arguments);\r\n }", "function Ajax(__constructor) {\r\n if (Params.env.isFirefox) return GM_xmlhttpRequest(__constructor);\r\n ...
[ "0.6993283", "0.6822893", "0.6371214", "0.6163058", "0.59267855", "0.58393145", "0.5837328", "0.5837328", "0.5829274", "0.5829274", "0.5829274", "0.5829274", "0.5829274", "0.5829274", "0.5797885", "0.5787472", "0.5787472", "0.5744089", "0.573186", "0.5730097", "0.5662906", ...
0.0
-1
Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, dataType /* internal */, inspected /* internal */ ) { dataType = dataType || options.dataTypes[ 0 ]; inspected = inspected || {}; inspected[ dataType ] = true; var selection, list = structure[ dataType ], i = 0, length = list ? list.length : 0, executeOnly = ( structure === prefilters ); for ( ; i < length && ( executeOnly || !selection ); i++ ) { selection = list[ i ]( options, originalOptions, jqXHR ); // If we got redirected to another dataType // we try there if executing only and not done already if ( typeof selection === "string" ) { if ( !executeOnly || inspected[ selection ] ) { selection = undefined; } else { options.dataTypes.unshift( selection ); selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, selection, inspected ); } } } // If we're only executing or nothing was selected // we try the catchall dataType if not done already if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, "*", inspected ); } // unnecessary when only executing (prefilters) // but it'll be ignored by the caller in that case return selection; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {\n\n var inspected = {},\n seekin...
[ "0.6271232", "0.62278324", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.607385", "0.60586876", "0.60586876", "0.6036968", "0.601241", "0.601241", "0.601241", "0.601241", "0.601241", "0.6...
0.0
-1
A special extend for ajax options that takes "flat" options (not to be deep extended) Fixes 9887
function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettin...
[ "0.76664", "0.76095086", "0.7565319", "0.7565319", "0.7565319", "0.7565319", "0.7565319", "0.7565319", "0.7546114", "0.7546114", "0.7526265", "0.74551934", "0.7317776", "0.7311058", "0.72911924", "0.7255344", "0.72409916", "0.723997", "0.723997", "0.72252256", "0.7218871", ...
0.7290337
15
Callback for when everything is done It is defined here because jslint complains if it is declared at the end of the function (which would be more logical and readable)
function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // If successful, handle type chaining if ( status >= 200 && status < 300 || status === 304 ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader("Last-Modified"); if ( modified ) { jQuery.lastModified[ ifModifiedKey ] = modified; } modified = jqXHR.getResponseHeader("Etag"); if ( modified ) { jQuery.etag[ ifModifiedKey ] = modified; } } // If not modified if ( status === 304 ) { statusText = "notmodified"; isSuccess = true; // If we have data } else { isSuccess = ajaxConvert( s, response ); statusText = isSuccess.state; success = isSuccess.data; error = isSuccess.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if ( !statusText || status ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AllDone(){\n \n}", "function done() {}", "complete() {}", "_onEnd() {}", "function doDone() {\r\n // in FF this is empty.\r\n\r\n }", "function doDone() {\r\n // in FF this is empty.\r\n\r\n }", "function finished(err){\n }", "done() {}", "onFinish...
[ "0.74679637", "0.72341937", "0.7091543", "0.6931611", "0.6861432", "0.6861432", "0.68613994", "0.6860473", "0.68484855", "0.6700876", "0.66732866", "0.66682667", "0.66682667", "0.66682667", "0.66682667", "0.66297436", "0.66241944", "0.65894485", "0.65657556", "0.6506549", "0....
0.0
-1
Handles responses to an ajax request: sets all responseXXX fields accordingly finds the right dataType (mediates between contenttype and expected dataType) returns the corresponding response
function ajaxHandleResponses( s, jqXHR, responses ) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes, responseFields = s.responseFields; // Fill responseXXX fields for ( type in responseFields ) { if ( type in responses ) { jqXHR[ responseFields[type] ] = responses[ type ]; } } // Remove auto dataType and get content-type in the process while( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxHandleResponses(s,jqXHR,responses){var ct,type,finalDataType,firstDataType,contents=s.contents,dataTypes=s.dataTypes;// Remove auto dataType and get content-type in the process\nwhile(dataTypes[0]===\"*\"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader(\"Content-Type\");}}...
[ "0.8111879", "0.8111879", "0.8100981", "0.8067477", "0.8064683", "0.7991785", "0.79761744", "0.7961755", "0.7951462", "0.79122376", "0.7894264", "0.789335", "0.78847694", "0.78478056", "0.7846795", "0.7814707", "0.7780932", "0.7780549", "0.7780549", "0.7780549", "0.77747554",...
0.77580947
23
Chain conversions given the request and the original response
function ajaxConvert( s, response ) { var conv, conv2, current, tmp, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(), prev = dataTypes[ 0 ], converters = {}, i = 0; // Apply the dataFilter if provided if ( s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } // Convert to each sequential dataType, tolerating list modification for ( ; (current = dataTypes[++i]); ) { // There's only work to do if current dataType is non-auto if ( current !== "*" ) { // Convert response if prev dataType is non-auto and differs from current if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split(" "); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.splice( i--, 0, current ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s["throws"] ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } // Update prev for next iteration prev = current; } } return { state: "success", data: response }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={},// Work with a copy of dataTypes in case we need to modify it for conversion\ndataTypes=s.dataTypes.slice();// Create converters map with lowercased keys\nif(dataTypes[1]){for(conv in s.converters){converters[conv.toLowe...
[ "0.6620599", "0.6620599", "0.660552", "0.6539198", "0.6532621", "0.64428306", "0.6426713", "0.64198816", "0.6414336", "0.62829214", "0.62829214", "0.62829214", "0.62757075", "0.6273467", "0.6246295", "0.6246295", "0.6244782", "0.6244782", "0.6244782", "0.6244782", "0.6244782"...
0.615026
30
Functions to create xhrs
function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeTime(h, i, s, ms) {\n\treturn parseInt(h, 10) * 60 * 60 \n\t\t+ parseInt(i, 10) * 60\n\t\t+ parseInt(s, 10) \n\t\t+ parseInt(ms, 10) / 1000 ;\n}", "function xToHour(x) {\n var hour = (Math.floor(times[0] + parseInt(x) / hourSpace)) % 24;\n return (hour >= 10) ? hour : \"0\" + hour;\n}", "fun...
[ "0.6773095", "0.67282486", "0.65836316", "0.6557948", "0.6520314", "0.65039384", "0.65039384", "0.65039384", "0.65039384", "0.65039384", "0.65039384", "0.65039384", "0.64763576", "0.64381844", "0.64357316", "0.64100814", "0.6404843", "0.6399019", "0.63961005", "0.6384597", "0...
0.0
-1
Animations created synchronously will run synchronously
function createFxNow() { setTimeout(function() { fxNow = undefined; }, 0 ); return ( fxNow = jQuery.now() ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_playAnimation() {\n if (this._animationLast === undefined && this._animationQueue.length > 0) {\n this._animationLast = this._animationCurrent;\n this._animationCurrent = this._animationQueue.shift();\n console.log(\"New: \" + this._animationCurrent.name);\n this...
[ "0.72304296", "0.71728456", "0.67521536", "0.6703089", "0.66503274", "0.6645787", "0.66425407", "0.65776545", "0.6516832", "0.64954275", "0.64914846", "0.64082175", "0.6393736", "0.6383406", "0.6378035", "0.6375194", "0.6370166", "0.6353008", "0.6350212", "0.63320714", "0.632...
0.0
-1
Generate parameters to create a standard animation
function genFx( type, includeWidth ) { var which, attrs = { height: type }, i = 0; // if we include width, step value is 1 to do all cssExpand values, // if we don't include width, step value is 2 to skip over Left and Right includeWidth = includeWidth? 1 : 0; for( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setParameters() {\n params.viscosity = 0.02;\n params.u0 = -amplitude;\n params.one36th = 1 / 36;\n params.one9th = 1 / 9;\n params.four9ths = 4 / 9;\n params.gridSize = 5;\n params.m = int(height / params.gridSize);\n params.n = int(width / params.gridSize);\n}", "function generateAnimationPara...
[ "0.6477499", "0.6449747", "0.6239411", "0.62102515", "0.62051743", "0.6019592", "0.599829", "0.594838", "0.5940393", "0.5940393", "0.5912163", "0.5873654", "0.5832134", "0.5828958", "0.58236474", "0.5820797", "0.5813001", "0.579854", "0.57910967", "0.57835335", "0.5780475", ...
0.0
-1
utillang.js The minimal language enhancement
function isType(type) { return function(obj) { return Object.prototype.toString.call(obj) === "[object " + type + "]" } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function TI18n() {}", "function TI18n() {}", "function TI18n() {}", "function TI18n() { }", "function TI18n() { }", "function LangMap() {}", "function LangMap() {}", "function addLanguages() {}", "function TI18n(){}", "function Lang() { \n}", "function BrowserLanguage() {\n}", "function GenLa...
[ "0.7186397", "0.7186397", "0.7186397", "0.71283567", "0.71283567", "0.7121588", "0.7121588", "0.7110207", "0.6952862", "0.6790221", "0.6766629", "0.6725471", "0.6504188", "0.6451519", "0.63734365", "0.63401806", "0.63004434", "0.6299742", "0.6285467", "0.62538856", "0.6246662...
0.0
-1
Extract the directory portion of a path dirname("a/b/c.js?t=123xx/zz") ==> "a/b/" ref:
function dirname(path) { return path.match(DIRNAME_RE)[0] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dirname(url) {\n const slashIndex = url && url.lastIndexOf('/');\n return slashIndex >= 0 ? url.substr(0, slashIndex) : '';\n}", "function dirname(url) {\n const slashIndex = url && url.lastIndexOf('/');\n return slashIndex >= 0 ? url.substr(0, slashIndex) : '';\n}", "function sc_dirname(p) {\n ...
[ "0.7684736", "0.7684736", "0.7474577", "0.7028416", "0.6948202", "0.6948202", "0.6931474", "0.67882746", "0.67527723", "0.6701431", "0.6695406", "0.6694862", "0.6692878", "0.6647446", "0.6643584", "0.6643584", "0.6643584", "0.6643584", "0.6643584", "0.6643584", "0.6616779", ...
0.66551626
13
Canonicalize a path realpath(" ==> "
function realpath(path) { // /a/b/./c/./d ==> /a/b/c/d path = path.replace(DOT_RE, "/") // "file:///a//b/c" ==> "file:///a/b/c" // "http://a//b/c" ==> "http://a/b/c" // "https://a//b/c" ==> "https://a/b/c" // "/a/b//" ==> "/a/b/" path = path.replace(MULTIPLE_SLASH_RE, "$1\/") // a/b/c/../../d ==> a/b/../d ==> a/d while (path.match(DOUBLE_DOT_RE)) { path = path.replace(DOUBLE_DOT_RE, "/") } return path }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GetNormalizedPath() {\n}", "function canonical_uri(src,base_path) {\n\t\tvar absolute_regex = /^\\w+\\:\\/\\//;\n\t\t\n\t\t// is `src` is protocol-relative (begins with // or ///), prepend protocol\n\t\tif (/^\\/\\/\\/?/.test(src)) {\n\t\t\tsrc = location.protocol + src;\n\t\t}\n\t\t// is `src` page-rel...
[ "0.6709759", "0.6702698", "0.6609128", "0.6456524", "0.64326733", "0.64309305", "0.63968444", "0.63194084", "0.62933767", "0.6244801", "0.6244801", "0.6244801", "0.6244801", "0.6218411", "0.6218411", "0.6218411", "0.6217389", "0.62084955", "0.6163006", "0.6118867", "0.6113805...
0.65180767
3
Normalize an uri normalize("path/to/a") ==> "path/to/a.js"
function normalize(uri) { // Call realpath() before adding extension, so that most of uris will // contains no `.` and will just return in realpath() call uri = realpath(uri) // Add the default `.js` extension except that the uri ends with `#` if (HASH_END_RE.test(uri)) { uri = uri.slice(0, -1) } else if (!URI_END_RE.test(uri)) { uri += ".js" } // issue #256: fix `:80` bug in IE return uri.replace(":80/", "/") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalize(path) {\n var last = path.length - 1\n var lastC = path.charAt(last)\n\n // If the uri ends with `#`, just return it without '#'\n if (lastC === \"#\") {\n return path.substring(0, last)\n }\n\n return (path.substring(last - 2) === \".js\" ||\n path.indexOf(\"?\") > 0 ||\n las...
[ "0.7741806", "0.7677585", "0.7638272", "0.74466026", "0.7421231", "0.72541517", "0.7086319", "0.7053448", "0.7053448", "0.7053448", "0.7049185", "0.7025306", "0.7021984", "0.7021984", "0.7021984", "0.7021984", "0.7021984", "0.7021984", "0.7021984", "0.7021984", "0.7021984", ...
0.7648592
2
Run a queue of functions as quickly as possible, passing value to each.
function runHandlers(queue, value) { for (var i = 0; i < queue.length; i++) { queue[i](value); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runHandlers(queue, value) {\n for (var i = 0; i < queue.length; i++) {\n queue[i](value);\n }\n}", "function runHandlers(queue, value) {\n\t\tfor (var i = 0; i < queue.length; i++) {\n\t\t\tqueue[i](value);\n\t\t}\n\t}", "function runQueue() {\n if(queue.length) {\n...
[ "0.7692049", "0.76008296", "0.71150464", "0.69867754", "0.6865169", "0.68179584", "0.66173464", "0.66173464", "0.66173464", "0.66173464", "0.6465038", "0.6377458", "0.62527335", "0.6059452", "0.60239965", "0.59751266", "0.5897051", "0.58910185", "0.58795387", "0.5873245", "0....
0.75986105
2
Drain the handler queue entirely, being careful to allow the queue to be extended while it is being processed, and to continue processing until it is truly empty.
function drainQueue() { runHandlers(handlerQueue); handlerQueue = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drainQueue() {\n\t\trunHandlers(handlerQueue);\n\t\thandlerQueue = [];\n\t}", "function drainQueue() {\n runHandlers(handlerQueue);\n handlerQueue = [];\n}", "function processQueue() {\n emptyQueue = true;\n drainQueue(true);\n }", "function handleQueue() {\n if (this...
[ "0.8368115", "0.8304939", "0.70665467", "0.701564", "0.68049484", "0.6587707", "0.6466933", "0.63364094", "0.62661076", "0.62456757", "0.62418073", "0.62328243", "0.6208933", "0.6208856", "0.6208856", "0.6208856", "0.6208856", "0.61453366", "0.6136541", "0.6108031", "0.609368...
0.84176576
0
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.52719957", "0.5258603", "0.5189542", "0.5181587", "0.51222587", "0.50485057", "0.4895682", "0.48634082", "0.48405623", "0.4833185", "0.48265588", "0.48152655", "0.48029664", "0.47881085", "0.47855937", "0.4759736", "0.47531617", "0.47402334", "0.4730283", "0.47066608", "0....
0.0
-1
c is a single hex digit (string)
function inc_digit(c) { if (c == "9") { return "a"; } else if (c == "f") { return "0"; } else { return String.fromCharCode(c.charCodeAt() + 1) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hexVal (c) {\n return (\n c < 58 ? c - 48 : // 0 - 9\n c < 71 ? c - 55 : // A - F\n c - 87 // a - f\n );\n}", "componentToHex(c) {\n let hex = c.toString(16);\n return hex.length === 1 ? \"0\" + hex : hex;\n }", "function isHexDigit(c){\r\n return /^[0-9A-Fa-f...
[ "0.7732673", "0.7485638", "0.7338237", "0.7304741", "0.7301328", "0.7301328", "0.7272534", "0.7268888", "0.7254141", "0.7247418", "0.7240753", "0.7240753", "0.72371835", "0.7225809", "0.7225809", "0.7225809", "0.7225809", "0.7225809", "0.7225809", "0.7224251", "0.7223993", ...
0.0
-1
x is a string of hex digits
function increment(x) { var i = x.length - 1; var carry; var new_x = x.split(""); do { old_digit = x.charAt(i); new_digit = inc_digit(old_digit); new_x[i] = new_digit; if (new_digit == "0") { carry = true; i -= 1; } else { carry = false; } if (i < 0) { carry = false; } } while (carry); return new_x.join(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hex(x) {\n var hexDigits = new Array(\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"a\",\"b\",\"c\",\"d\",\"e\",\"f\");\n return isNaN(x) ? \"00\" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];\n }", "function hexify(x) {\n return isNaN(x) ? \"00\" : hexDigits[...
[ "0.809851", "0.8075778", "0.79198825", "0.7572682", "0.7567683", "0.7494706", "0.7391833", "0.7391833", "0.7391833", "0.7381191", "0.7381191", "0.73471767", "0.7298553", "0.71644753", "0.7136094", "0.69190353", "0.6855642", "0.6842635", "0.67922825", "0.67829025", "0.67313915...
0.0
-1
request is a url
function redirect(request, key, expire, args) { if (args == "") { url = request + "?"; } else { url = request + "&"; } url += "key=" + key + "&expire=" + expire; window.location = url; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isResource(request) {\n return request.url.match(/\\/imgs\\/.*$/) && request.method === 'GET';\n}", "function _isSentryRequest(url) {\n const client = getCurrentHub().getClient();\n const dsn = client && client.getDsn();\n return dsn ? url.includes(dsn.host) : false;\n }", "function checkUR...
[ "0.6592209", "0.6475749", "0.64422524", "0.64353544", "0.63690853", "0.63560677", "0.6278105", "0.6273924", "0.6256092", "0.62533903", "0.6251151", "0.6156149", "0.615417", "0.61241287", "0.6095675", "0.6072017", "0.6064829", "0.6051718", "0.6051438", "0.6051072", "0.6049161"...
0.0
-1
solves the puzzle (in bursts, with sleep time inbetween bursts) then calls redirect with the solution.
function solve_puzzle(request, y, x, tries, bits, burst_len, sleep_time, expire, args) { var hash_x; for (i = 0; i < burst_len; i++) { hash_x = hex_md5(x); if (hash_x == y) { redirect(request, x, expire, args); return; } x = increment(x); } tries += burst_len; percent_done = Math.floor((tries / Math.pow(2, bits)) * 100.0); if (percent_done <= 100) { document.getElementById("redirect_status").innerHTML = "" + Math.floor((tries / Math.pow(2, bits)) * 100.0); var func = function() { solve_puzzle(request, y, x, tries, bits, burst_len, sleep_time, expire, args); } setTimeout(func, sleep_time); } else { document.getElementById("redirect_status").innerHTML = "ERROR"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function solvefast(original, limit) {\n var turtle = solveboard(original, 100);\n var steps = 100;\n var rabbitsteps = 60;\n while (steps < limit) {\n if (turtle.solution !== null || turtle.track.length == 0) return turtle;\n var rabbit = solveboard(original, rabbitsteps);\n if (rabbit.solution !== nu...
[ "0.5905619", "0.5905619", "0.5762027", "0.55624634", "0.5552511", "0.5515747", "0.5423148", "0.53984857", "0.53957987", "0.5395104", "0.5333132", "0.5246411", "0.5198886", "0.5194895", "0.51609963", "0.51185673", "0.51114535", "0.5090567", "0.5082154", "0.5080496", "0.5076672...
0.75672466
0
Gets array of objects and builds gets tree using mged's tree command and parses it into json
function getModelTree(objectsArray, filePath) { const tree = {}; const treeCommand = part => `mged -c ${filePath} tree -a -i 2 ${part} 2>&1`; for (const obj of objectsArray) { const currentObject = (tree[ obj[obj.length - 1] === "/" ? obj.substring(0, obj.length - 1) : obj ] = {}); if (obj[obj.length - 1] === "/") { let lines = execSync(treeCommand(obj.substring(0, obj.length - 1)), { encoding: "UTF-8" }); lines = lines.split("\n"); let prevIndent = 0; let road = [currentObject]; // eslint-disable-line for (const line of lines) { const args = line.split(/ +/); if (args[1] === "@") { road[road.length - 1][args[2]] = args[3]; } if (args[1] === "u" && trimR(args[2]) !== args[2]) { const indent = /^ +/.exec(line); let indentLength = 0; if (indent) { indentLength = indent[0].length; } const indentChange = indentLength - prevIndent; if (indentChange < 0) { road.pop(); if (road[road.length - 1] === {}) { delete road[road.length - 1]; } for (let i = indentChange; i < 0; i += 2) { road.pop(); } road.push((road[road.length - 1][trimR(args[2])] = {})); } else if (indentChange > 0) { road.push((road[road.length - 1][trimR(args[2])] = {})); } else if (indentChange === 0) { road.pop(); road.push((road[road.length - 1][trimR(args[2])] = {})); } prevIndent = indentLength; } } } } return tree; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildingObjectTree(array, obj = {}) {\r\n for (let i = 0; i < array.length; i++) {\r\n if (array[i].parent === null) {\r\n obj[array[i].id] = {};\r\n array.slice(i, 1);\r\n break;\r\n }\r\n }\r\n for (let i = 0; i < array.length; i++) {\r\n tr...
[ "0.66164774", "0.63485175", "0.6272255", "0.6148201", "0.6096477", "0.60741055", "0.60169566", "0.60018885", "0.5953875", "0.59260213", "0.59231323", "0.58904654", "0.5888925", "0.5878588", "0.58692616", "0.5834775", "0.5818594", "0.58049834", "0.5775699", "0.5741763", "0.573...
0.73752075
0
Trims R/ from the end of the string
function trimR(s) { if (s[s.length - 1] === "R" && s[s.length - 2] === "/") { s = s.substring(0, s.length - 2); } if (s[s.length - 1] === "/") { s = s.substring(0, s.length - 1); } return s; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rtrim(path) {\n\t\treturn _.str.rtrim(path, \"/\");\n\t}", "function stripTrailingSlash(str) {\n\t if(str.substr(-1) == '/') {\n\t return str.substr(0, str.length - 1);\n\t }\n\t return str;\n\t }", "function trimOut(inp)\r\n{\r\n\tlet temp=inp.substring(inp.lastIndexOf(\"/\")+1,inp.len...
[ "0.7328511", "0.7195182", "0.6699478", "0.6567531", "0.6526202", "0.6466382", "0.63819236", "0.63811404", "0.636192", "0.6310996", "0.625045", "0.6234766", "0.6231134", "0.62180465", "0.62180465", "0.62180465", "0.62180465", "0.62180465", "0.62180465", "0.62180465", "0.621804...
0.8536636
0
const app = require('../../app'); ADMIN
async function deckEdit(req, res) { const { userName } = req.app.locals.username; const userId = await User.findOne({ name: userName })._id; // const obj = { // id: 123, // title: 'Test', // dataArr: [{q:'test',a:'test'},{q:'test',a:'test'},{q:'test',a:'test'},{q:'test',a:'test'}], // }; const obj = req.body; let idD; let cardArr; let title = `${obj.title.trim()}`; let key = `${title.toLowerCase()}`; if (obj.id === '' || obj.id === undefined || obj.id === null) { const deck = await Deck.findOne({ title }).lean();// , userid: userId if (deck) { // eslint-disable-next-line no-sequences key = `${title.toLowerCase()}*`; title = `${title}*`; } idD = await Deck.create({ key, title, userid: userId, }); } else { idD = await Deck.findOneAndUpdate({ _id: obj.id }, { $set: { title } }, { useFindAndModify: false, new: true }).exec(); // await Card.deleteMany({ deckid: idD._id }); } if (idD) { cardArr = await obj.dataArr.map(async (el) => { const cardN = await Card.create({ level: el.level, question: el.q, answer: el.a, answerArr: el.AllAnswer, deckid: idD._id, }); return cardN; }); } if (idD && cardArr) res.json('Ok'); else res.json('Err'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "CrearApp() {\n this.app = express();\n }", "function router(app) {\n\n}", "function learnModules() {\n const sth=require('./app.js').something;\n \n console.log(sth);\n \n }", "constructor() {\n this.path = '/admin';\n this.router = express.Router();\n this.init();...
[ "0.67630106", "0.6653704", "0.65146166", "0.649688", "0.6478555", "0.6435572", "0.64141506", "0.64003795", "0.64003795", "0.6344262", "0.63233066", "0.6273064", "0.6266061", "0.62474144", "0.62373084", "0.6226276", "0.6198587", "0.6194034", "0.61845696", "0.61817116", "0.6174...
0.0
-1
returns all the accounts depending on the type the user selected
async function handleLoadAccounts(acctType) { try { const accounts = await accountRepo.getAccounts(acctType); document.querySelector('#accounts-table').innerHTML = `<table id="accounts"> <tr> <th>Account No</th> <th>Account Type</th> <th>Balance</th> <th>Action</th> </tr> ${accounts.map(account => accountToHTMLRow(account)).join('')} <table>`; } catch (e) { console.log(e); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getAccountTypes() {\n return await this.contract.methods\n .getAccountTypes()\n .call({ from: this.currentAddress });\n }", "getAccountsList() {\n const params = { type: 'list' };\n return this.apiService.get(`${this.url}/user/find`, { params }).pipe(\n map(res => res.map((account)...
[ "0.6889962", "0.6669898", "0.6375879", "0.6374473", "0.6287132", "0.627356", "0.6238821", "0.61558914", "0.6068359", "0.60603017", "0.59961224", "0.597382", "0.59635913", "0.5960709", "0.5956586", "0.5925498", "0.5857158", "0.58500063", "0.5846595", "0.58391464", "0.58181", ...
0.53037137
70
this is to make sure that if we internally set
makeIdentity() { this.$obj.idKey = new Ref(this.$obj.entity, this.$obj.name); this.$obj.indexed = this.$obj.identity = this.$obj.identity_ = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient final protected internal function m174() {}", "update() {\r\n throw new Error('must be set in subclass');\r\n }", "transient final p...
[ "0.6541378", "0.6194477", "0.6087722", "0.59868246", "0.59726936", "0.59651196", "0.5944969", "0.5820261", "0.5745353", "0.57140523", "0.5679596", "0.5676883", "0.563382", "0.56282616", "0.5628218", "0.5610903", "0.5583831", "0.55658954", "0.555063", "0.55303544", "0.5504424"...
0.0
-1
it get fixed object
toObject() { let props = this.$obj; let res = super.toObject(); return JSON.parse(JSON.stringify({ ...res, type: props.type || props.type_, identity: props.identity || props.identity_ , required: props.required || props.required_, indexed: props.indexed || props.indexed_, idKey: props.idKey ? props.idKey.toString() : undefined, relation: props.relation ? props.relation.toObject() : undefined, })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get object() {\n\n }", "function makeObject(obj){\n\t// console.log(\"ovj=\",obj);\n\t// console.log();\n\ttry{\n\t\tif(obj!=undefined && obj[10]!=undefined && obj[0]!=\"Delete\"){\n\t\t\tvar newObj={};\n\t\t\tnewObj._key=calculate_key(obj);\n\t\t\tnewObj.name=obj[1];\n\t\t\tnewObj.priority=obj[2];\n\t\t\tnewOb...
[ "0.6457381", "0.6347683", "0.6099506", "0.59793913", "0.59340143", "0.59234184", "0.5888046", "0.5862156", "0.57820636", "0.57661873", "0.5734656", "0.572827", "0.57175076", "0.5703546", "0.5618647", "0.5618647", "0.5618647", "0.5618647", "0.5614233", "0.56098473", "0.5598939...
0.0
-1
it get clean object with no default values
toJSON() { let props = this.$obj; let res = super.toJSON(); return JSON.parse(JSON.stringify({ ...res, type: props.type_, identity: props.identity_, required: props.required_, indexed: props.indexed_, relation: props.relation ? props.relation.toJSON() : undefined, })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clean() {\n let clone = {};\n Object.assign(clone, this);\n\n for (const i in clone) {\n if (typeof clone[i] === 'undefined') {\n delete clone[i];\n }\n }\n\n return clone;\n }", "function clean(obj) {\n var res = {};\n\n _underscoreWra...
[ "0.69558144", "0.6689635", "0.646938", "0.62628704", "0.6232172", "0.61731505", "0.61313593", "0.6113121", "0.6072644", "0.6006736", "0.59840065", "0.59840065", "0.59661084", "0.59422296", "0.59016067", "0.58741903", "0.58706516", "0.58706516", "0.5860293", "0.5838698", "0.58...
0.0
-1
extends alert functionality. Also sets global is_submit to false.
function inform( title, message, focusId ){ std_dlg .dialog( "option", "width", "400px" ) .dialog( "option", "title", title ) .dialog( "option", "buttons",[ { text: prompts.close, click: function(){ $(this).dialog("close"); is_submit = false; if(focusId) $("#"+focusId).focus(); } } ]) .html( message ) .dialog("open"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitAlert() {\n alert('Thank you. The form information has been received.')\n}", "function alert( title, message, type, tag, unescaped ) {\n var element = $( \"#alert\" ).clone();\n\n element.prop( \"id\", \"\" );\n if ( unescaped ) {\n element.find( \".error-title\" )...
[ "0.67509854", "0.65568304", "0.6374718", "0.6344766", "0.6321502", "0.6207952", "0.61506706", "0.6080448", "0.60609025", "0.60560423", "0.60534686", "0.60331005", "0.6012199", "0.5976175", "0.5972001", "0.59528106", "0.5952133", "0.5942666", "0.5941973", "0.5935046", "0.59103...
0.0
-1
Seite anzeigen. Wird von der AppKlasse aufgerufen.
async show(matches) { // URL-Parameter auswerten this._recordId = matches[1]; this._data = await this._app.database.selectById(this._recordId, "restaurants"); // Anzuzeigenden Seiteninhalt nachladen let html = await fetch("page-detail/page-detail.html"); let css = await fetch("page-detail/page-detail.css"); if (html.ok && css.ok) { html = await html.text(); css = await css.text(); } else { console.error("Fehler beim Laden des HTML/CSS-Inhalts"); return; } // Seite zur Anzeige bringen let bewertung = await this.bewertungBerechnen(); let pageDom = this._processTemplate(html, bewertung); this._app.setPageTitle(` ${this._data.name}`, {isSubPage: true}); this._app.setPageCss(css); this._app.setPageHeader(pageDom.querySelector("header")); this._app.setPageContent(pageDom.querySelector("main")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "start() {\n //DO BEFORE START APP CONFIGURATION/INITIALIZATION\n super.start();\n }", "get mainApp() {\r\n return this._mainApp;\r\n }", "function onPreappinit() {\n kony.print(\"LOG : onPreappinit - START\");\n gAppData = new initAppData();\n}", "get app() {\r\n retur...
[ "0.59443486", "0.5921244", "0.5871539", "0.5839616", "0.5835826", "0.5810795", "0.5810795", "0.57308877", "0.56739163", "0.5656072", "0.5653936", "0.5599793", "0.5574181", "0.5567349", "0.5559737", "0.5557001", "0.5538022", "0.5513588", "0.55119854", "0.54901546", "0.5486249"...
0.0
-1
DISPLAY'S THE GOOGLE MAP IN THE HTML CENTERED ON THE USER'S POSITION
function showMap(myLat, myLong) { // Create a LatLng object with the GPS coordinates. // var myLatLng = new google.maps.LatLng(lat, lon); // Create the Map Options var mapOptions = { zoom: 2, center: {lat: myLat, lng: myLong}, mapTypeId: google.maps.MapTypeId.ROADMAP // disableDefaultUI: true }; // Generate the map // var heatmap = new google.maps.visualization.HeatmapLayer({ // data: heatMapData // }; // Setting the map to the html div var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); // Setting the heatmap layer onto the map (must come after the above line of code) // heatmap.setMap(map); var marker = new google.maps.Marker({ position: {lat: myLat, lng: myLong}, map: map, title: 'Hello World!' }); return map; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSuccess(position) {\n \n document.getElementById('map').innerHTML = \"<iframe src = \\\"https:\\/\\/maps.google.com\\/maps?q=\"+position.coords.latitude+\",\"+position.coords.longitude+\"&hl=es;z=14&amp;output=embed\\\" frameborder=\\\"0\\\" style=\\\"height:100%; width:100%\\\"><\\/iframe>\";\n\n ...
[ "0.7700875", "0.743997", "0.7384327", "0.7360375", "0.72922325", "0.7190038", "0.7053787", "0.70445526", "0.6993402", "0.6944326", "0.6941431", "0.6874592", "0.6873061", "0.6871294", "0.6862834", "0.68468744", "0.6842874", "0.6790366", "0.67781776", "0.67701864", "0.6761343",...
0.6705653
28
We need this function to gather all the data coming from several indices. In this example we are using the `indexName` to namespace those data to avoid erasing them each time an instance is updated. You can choose to use any namespace of your choice, if the `indexName` is not a differentiator.
onProps(props) { this.setState({hits: {...this.state.hits, [props.indexName]: props.hits}, query: props.query}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getIndices() {\n return this._registry.get('properties', 'schemaData', { indices: [] })\n .indices.map(data => {\n if (!data.hasOwnProperty('name') || !data.name)\n data.indexName = this.getStorageIndexName();\n else\n data.indexName = this.getStorageIndexPrefix() + data.name;\n ...
[ "0.69299984", "0.6372046", "0.6188884", "0.6167241", "0.5976565", "0.5860668", "0.5855596", "0.5834705", "0.57975215", "0.57781416", "0.5749914", "0.56766707", "0.56383383", "0.56328434", "0.56149787", "0.55863184", "0.55457354", "0.55413467", "0.5479946", "0.5479946", "0.547...
0.0
-1
We trigger an update of the autocomplete if the props changed.
componentWillReceiveProps(nextProps) { this.props.onProps(nextProps); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_updateAutoCompleteHelper() {\n const that = this;\n\n that.$.autoCompleteString.style.width = that.$.input.offsetWidth + 'px';\n that.$.autoCompleteString.style.height = that.$.input.offsetHeight + 'px';\n that.$.autoCompleteString.style.left = that.$.input.offsetLeft + 'px';\n ...
[ "0.6664672", "0.65073925", "0.6455506", "0.633346", "0.6323923", "0.6273839", "0.6269641", "0.6237986", "0.6195088", "0.6169356", "0.6163454", "0.613245", "0.6101667", "0.6098556", "0.6075636", "0.6063945", "0.6055582", "0.6047421", "0.60135496", "0.5987259", "0.59837204", ...
0.0
-1
Consume the log message. When log capacity is satisfied, chunk will be send out.
function Consumer(options){ this.options = options; this.size = 0; this.chunks = new Array(); this.last = new Date().getTime(); this.chunk = helper.defaultChunk(options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "processQueue_() {\n if (!this.queue_.length) return;\n const [size, callback] = this.queue_[0];\n\n if (this.getBufferSize_() < size) return;\n\n const chunk = this.consumeBuffer_(size);\n this.queue_.shift();\n callback(chunk);\n this.processQueue_();\n }", "function consume(message) {\n ...
[ "0.5705241", "0.55820364", "0.5539325", "0.5539325", "0.5539325", "0.5539325", "0.5488231", "0.5447962", "0.54330546", "0.54330546", "0.54330546", "0.54330546", "0.54330546", "0.5399743", "0.5363185", "0.5350229", "0.53465194", "0.53340256", "0.52627414", "0.5249275", "0.5230...
0.0
-1
This function will list all the sub categories under selected category
createListItems() { //This is used to give active class to the selected category jQuery('.active_cat').removeClass('active_cat'); jQuery("#category_" + this.props.category.cat_id).addClass("active_cat"); //Store the selected meal under sub category(sub menu) to get access in order page if (this.props.meal) sessionStorage.setItem("selected_meal", JSON.stringify(this.props.meal)); //creates the sub category(sub menu) cards layout, selectMeal is the action triggered when meal card is clicked return this.props.category.sub_cat.map((meal, index) => { return ( <div key={index} className="col-md-4 col-lg-3 col-sm-6 col-xs-12 cards" onClick={() => this.props.selectMeal(meal)}> <img src={meal.subcat_thumbnail} alt="meal pic" /> <div style={{ padding: '5px' }}> <label>{meal.subcat_name}</label> <p>{meal.subcat_desc}</p> <label style={{ right: '0', position: 'absolute', bottom: '0', marginRight: '20px', color: 'red' }}>{meal.subcat_price}</label> </div> </div> ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSubCategoryList(category){\n\t\t\n\t\t$.ajax({\n\t\t\turl:\"http://localhost:8080/flipkart/webapi/category/getSubCategoryList/\"+category,\n\t\t\ttype:\"POST\",\n\t\t\tcache:false,\n\t\t\tcontentType:false,\n\t\t\tprocessData: false,\n\t success : function(data){\n\t \t\n\t \tif(da...
[ "0.7441592", "0.695153", "0.6942101", "0.69071865", "0.6838817", "0.6765603", "0.6754103", "0.6640523", "0.661851", "0.66110444", "0.6588842", "0.6537597", "0.6505056", "0.64698845", "0.6459706", "0.64331573", "0.64147663", "0.63845557", "0.6365538", "0.6345924", "0.63453215"...
0.0
-1
This function helps component to have access to the store (state) as props category : selected category meal : selected sub category
function mapStateToProps(state) { return { category: state.activeCategory, meal: state.activeMeal }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getcategory(state){\n return state.category\n }", "categ(state,data)\n {\n return state.category=data\n }", "setSub() {\n\t\tconsole.log('called constructor setSub');\n\t\tlet sub_category_selected_display = [],\n\t\t\tcategory_selected = this.state.category_selected;\...
[ "0.753704", "0.7270922", "0.6834107", "0.67346513", "0.66304016", "0.6567567", "0.6545415", "0.65225726", "0.6500009", "0.64858115", "0.6455819", "0.64463675", "0.6436887", "0.6428612", "0.6424423", "0.6397571", "0.63922065", "0.6371321", "0.6355915", "0.63017786", "0.6300156...
0.6299497
21
This function binds the action creators to the this component and have them access as props selectMeal is the action when sub category is clicked
function matchDispatchToProps(dispatch) { return bindActionCreators({ selectMeal: selectMeal }, dispatch); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createListItems() {\n //This is used to give active class to the selected category\n jQuery('.active_cat').removeClass('active_cat');\n jQuery(\"#category_\" + this.props.category.cat_id).addClass(\"active_cat\");\n\n //Store the selected meal under sub category(sub menu) to get access ...
[ "0.6636004", "0.59603053", "0.5856939", "0.5851976", "0.57318884", "0.5690823", "0.5663616", "0.56277084", "0.56063336", "0.55818176", "0.5558048", "0.55423146", "0.55381244", "0.5508489", "0.55062497", "0.5488537", "0.54855204", "0.5481426", "0.54811525", "0.5481072", "0.547...
0.63745886
1
start initialise the buffer and GL
function start() { glcanvas = document.getElementById("glcanvas"); gl=initWebGL(glcanvas); // Initialize the GL context if (!gl) return;//Web GL is not available so, quit! mvMatrix = mat4.create();//create the model matrix pMatrix = mat4.create();//create the projection matrx modelRotationMatrix=mat4.create(); mat4.identity(modelRotationMatrix,modelRotationMatrix); //------- mat4.rotate(modelRotationMatrix,modelRotationMatrix,degToRad(90),[0,1,0]);//side view //------- initShaders(); //initialise the shaders initBuffers(); init_Skeleton(gl,shoulder_width,upper_arm_length,arm_diameter,upper_arm_y_offset,upper_arm_z_offset, lower_arm_length,lower_arm_diameter,lower_arm_x_offset,lower_arm_y_offset,lower_arm_z_offset, hand_length,hand_diameter,hip_width,thigh_y_offset,thigh_length,thigh_diameter, shin_length,shin_diameter, foot_length,foot_diameter); gl.clearColor(0.0,0.0,0.0,1.0);//clear the canvas gl.enable(gl.DEPTH_TEST); //enable depth test -> d glcanvas.onmousedown=handleMouseDown; glcanvas.onmouseup=handleMouseUp; document.onmousemove=handleMouseMove; drawScene();//draw the scene again document.onkeydown=handleKeyDown;//handle key down events document.onkeyup=handleKeyUp;//handle key up events setAnimatinonTimer(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "start() {\n this.renderer.state.setState(this.state);\n this.renderer.shader.bind(this.shader);\n if (WebGLSettings_1.WebGLSettings.CAN_UPLOAD_SAME_BUFFER) {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this.vaos[this.vertexCount]);\n }\n...
[ "0.78950685", "0.78402084", "0.75048673", "0.7350822", "0.7333553", "0.7283233", "0.7274882", "0.7215834", "0.7184787", "0.7170557", "0.7167841", "0.71632725", "0.71518654", "0.7132437", "0.71322155", "0.70979", "0.7080388", "0.70771796", "0.70739985", "0.7060015", "0.7035884...
0.0
-1
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> initWebGL Initialize WebGL, returning the GL context or null if WebGL isn't available or could not be initialized.
function initWebGL() { var gl = null; try { gl = glcanvas.getContext("experimental-webgl");//load the web GL onto the canvas gl.viewportWidth=glcanvas.width;//find out the size of the canvas gl.viewportHeight=glcanvas.height; } catch(e) { console.log("exception caught when getting the webGL context"); } // If we don't have a GL context, give up now if (!gl) alert("Unable to initialize WebGL. Your browser may not support it."); return gl;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initWebGL() {\n gl = null;\n\n try {\n gl = canvas.getContext(Constants.WEBGL_CANVAS_CONTEXT);\n } catch (e) {\n log(Constants.WEBGL_CREATION_ERR);\n }\n\n if (!gl) {\n alert(Constants.WEBGL_UNSUPPORTED_ERR); // eslint-disable-line\n }\n}", "function initWebGL(canvas) {\n gl = null;\n\n ...
[ "0.8517223", "0.848254", "0.8469585", "0.84507793", "0.835966", "0.82854426", "0.81050926", "0.7903838", "0.78570324", "0.783045", "0.7805917", "0.77039444", "0.744647", "0.7345004", "0.73029953", "0.7292262", "0.72825015", "0.724285", "0.72253054", "0.7213555", "0.71579796",...
0.8609813
0
initShaders Initialize the shaders, so WebGL knows how to light our scene.
function initShaders() { no_light_shaderProgram=loadShaders("nolighting_shader-fs","nolighting_shader-vs",false); shaderProgram=loadShaders( "shader-fs","shader-vs",true);}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initShaders()\n{\n\tvar fragmentShader = getShader(gl, \"shader-fs\");\n\tvar vertexShader = getShader(gl, \"shader-vs\");\n\n\t//create and link shader program\n\tshaderProgram = gl.createProgram();\n\tgl.attachShader(shaderProgram, vertexShader);\n\tgl.attachShader(shaderProgram, fragmentShader);\n\tgl....
[ "0.87163424", "0.8596219", "0.85760325", "0.84909165", "0.83908445", "0.83655006", "0.8319474", "0.8305133", "0.82184213", "0.81231046", "0.8115499", "0.8115499", "0.8053723", "0.8030474", "0.7978208", "0.7969012", "0.7955394", "0.79364115", "0.79215693", "0.79097426", "0.782...
0.83300763
6
getShader Loads a shader program by scouring the current document, looking for a script with the specified ID.
function getShader(gl, id) { var shaderScript = document.getElementById(id);//get the shading script from the HTML file // Didn't find an element with the specified ID; abort. if (!shaderScript) { return null; } // Walk through the source element's children, building the // shader source string. var theSource = ""; var currentChild = shaderScript.firstChild; while(currentChild) { if (currentChild.nodeType == 3) { theSource += currentChild.textContent; } currentChild = currentChild.nextSibling; } // Now find out the type of the shader scripts based on its MIME type. var shader; if (shaderScript.type == "x-shader/x-fragment") { shader = gl.createShader(gl.FRAGMENT_SHADER);//create the fragment shader } else if (shaderScript.type == "x-shader/x-vertex") { shader = gl.createShader(gl.VERTEX_SHADER);//create the vertex shader } else { return null; // Unknown shader type } // Send the source to the shader object gl.shaderSource(shader, theSource); // Compile the shader program gl.compileShader(shader); // See if it compiled successfully if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { alert("An error occurred compiling the shaders: " + gl.getShaderInfoLog(shader)); return null; } return shader;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getShader(id) {\n\tvar shaderScript = document.getElementById(id);\n\tif (!shaderScript) {\n\t\treturn null;\n\t}\n\n\tvar str = \"\";\n\tvar k = shaderScript.firstChild;\n\twhile (k) {\n\t\tif (k.nodeType == 3) {\n\t\t\tstr += k.textContent;\n\t\t}\n\t\tk = k.nextSibling;\n\t}\n\n\tvar shader;\n\tif (sha...
[ "0.84481615", "0.8419941", "0.8396628", "0.8378928", "0.8378437", "0.83659244", "0.8363262", "0.83575743", "0.8341929", "0.8324276", "0.83045965", "0.83014584", "0.8236277", "0.8213277", "0.81736225", "0.8150158", "0.8119269", "0.80990374", "0.7999891", "0.7946503", "0.789729...
0.84897995
0
setMatrixUniforms specify the matrix values of uniform variables
function setMatrixUniforms() { //send the uniform matrices onto the shader (i.e. pMatrix->shaderProgram.pMatrixUniform etc.) gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix); gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix); var normalMatrix=mat3.create(); mat3.normalFromMat4(normalMatrix,mvMatrix); //calculate a 3x3 normal matrix (transpose inverse) from a 4x4 matrix gl.uniformMatrix3fv(shaderProgram.nMatrixUniform,false,normalMatrix); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setMatrixUniforms() {\n gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n}", "function setMatrixUniforms() {\n gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n gl.uniformMatrix4fv(shad...
[ "0.87151825", "0.87052226", "0.87052226", "0.87020713", "0.8659143", "0.863722", "0.8621031", "0.8498454", "0.83971506", "0.83971506", "0.83271617", "0.83271617", "0.83271617", "0.83271617", "0.825695", "0.825695", "0.825695", "0.8234012", "0.82011503", "0.8197572", "0.818277...
0.8300245
14
this is used to parse the profile
function url_base64_decode(str) { var output = str.replace('-', '+').replace('_', '/'); switch (output.length % 4) { case 0: break; case 2: output += '=='; break; case 3: output += '='; break; default: throw 'Illegal base64url string!'; } return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getProfile() {\n\t\treturn decode(this.getAccess());\n\t}", "async getInfoProfile() {\n\t\tthis.spinner.info('Get profile info!');\n\t\tthis.spinner.info('here');\n\t\tawait this.page.waitForSelector(element.numberPosts, {timeout: 5000});\n\t\tlet area_count_post = await this.page.$(element.numberPosts)\n\t\tlet...
[ "0.68599415", "0.6752998", "0.67452204", "0.67446274", "0.6519533", "0.647352", "0.64597815", "0.6437472", "0.63876945", "0.63852715", "0.638432", "0.6361713", "0.6300902", "0.62915367", "0.62609226", "0.62609226", "0.6252527", "0.6223336", "0.61956227", "0.6191141", "0.61719...
0.0
-1
Randomly generate a time interval to simulate "typing"
function randomInterval(min,max) { return Math.floor(Math.random()*(max-min+1)+min); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function random_interval(text){\r\n\tvar time = Math.floor(Math.random()*5+1)*1000;\r\n\tdocument.getElementById(text).innerHTML = time/1000 + \" seconds\";\r\n\treturn time;\r\n}", "function getRandomTimeout () {\n return self.intervalMs + Math.floor(Math.random() * self.intervalMs / 5)\n }", "function pi...
[ "0.7088958", "0.68200773", "0.67238766", "0.66800547", "0.6551102", "0.6510392", "0.6495139", "0.64236677", "0.6292952", "0.6277739", "0.6253145", "0.6240741", "0.62363106", "0.62363106", "0.6229949", "0.6220399", "0.6177548", "0.61275834", "0.6116657", "0.6116657", "0.610107...
0.0
-1
Types out text typewriterstyle
function type(id, text){ $('#'+id).addClass('notblinking'); var rand = 0 for (var i = 0; i < text.length; i++) { rand += parseInt(randomInterval(40,300)); var typing = setTimeout(function(y){ $('#'+id).append(text.charAt(y)); },rand, i); }; // SPECIAL CASES setTimeout(function(){ $('#'+id).removeClass('notblinking'); if(text === "do u no de wae") { $('#grtn').html('<a id="grtn" href=https://www.youtube.com/embed/eix7fLsS058 class="special-greeting blinking">do u no de wae</a>'); } else { $('#'+id).addClass('blinking'); } },rand+333); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function typeWriter() {\n if (i < txt.length) {\n document.getElementById(\"heading\").innerHTML += txt.charAt(i);\n i++;\n setTimeout(typeWriter, speed);\n }\n }", "function typeWriter() {\n if (i < txt.length) {\n document.getEle...
[ "0.72368354", "0.7207265", "0.7054152", "0.6945238", "0.68852663", "0.6869939", "0.6855101", "0.68446064", "0.68422323", "0.6808665", "0.67775327", "0.6752686", "0.67464894", "0.6743793", "0.6743793", "0.67348385", "0.67348385", "0.6732244", "0.6716871", "0.6642572", "0.66368...
0.0
-1
given a string, say A: if its valid B: if there's more in the radix valid not valid more 'more' 'more' no more object false
function radixHas (input) { if (input[0] === '"') { if (input.length > 1 && input[input.length - 1] === '"' && input[input.length - 2] !== '\\') { return { value: input .substr(1, input.length - 2) .replace(/\\"/g, '"'), valid: true, type: 'STRING', stop: true, length: input.length }; } return 'more'; } if (input[0] === '/' && input[1] === '/') { if (input[input.length - 1] === '\n' || input[input.length - 1] === '\0') { return { value: '', type: 'COMMENT', valid: true, stop: true, length: input.length } } return 'more'; } if (input.match(numberRegex)) return { valid: true, type: 'NUMBER', value: Number.parseFloat(input), length: input.length }; var focus = tokenRadix; for (var i = 0; i < input.length; i++) { if (focus[input[i]] !== undefined) { focus = focus[input[i]]; } else { if (input.match(identifierRegex)) return { valid: true, type: 'IDENTIFIER', value: input, length: input.length } return false; } } return focus.valid ? { type: focus.type, valid: true, value: input, length: input.length } : 'more'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function similar_to(num, str) {\n var one_digit = false;\n var digits = num.toString().split('');\n var chars = str.replace(/\\s+/g, '').split('');\n if (chars.length < digits.length) return false;\n for (var i = 0; i < digits.length; i++) {\n var c = chars[i];\n if (c==digits[i]) {\n one_digit = t...
[ "0.5971141", "0.59197456", "0.591616", "0.5898972", "0.5896091", "0.5873027", "0.585961", "0.584643", "0.58365446", "0.582743", "0.5815965", "0.5808959", "0.5787837", "0.57631177", "0.5763006", "0.5763006", "0.57606417", "0.57462835", "0.57239616", "0.5709279", "0.56955177", ...
0.650782
0
resolves . and .. elements in a path array with directory names there must be no slashes, empty elements, or device names (c:\) in the array (so also no leading and trailing slashes it does not distinguish relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) { // if the path tries to go above the root, `up` ends up > 0 var up = 0; for (var i = parts.length; i >= 0; i--) { var last = parts[i]; if (last == '.') { parts.splice(i, 1); } else if (last === '..') { parts.splice(i, 1); up++; } else if (up) { parts.splice(i, 1); up--; } } // if the path is allowed to go above the root, restore leading ..s if (allowAboveRoot) { for (; up--; up) { parts.unshift('..'); } } return parts; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resolvePathDots(input) {\r\n\t\tvar output = [];\r\n\t\tinput.replace(/^(\\.\\.?(\\/|$))+/, '')\r\n\t\t .replace(/\\/(\\.(\\/|$))+/g, '/')\r\n\t\t .replace(/\\/\\.\\.$/, '/../')\r\n\t\t .replace(/\\/?[^\\/]*/g, function (part) { part === '/..' ? output.pop() : output.push(part); });\r\n\t\tret...
[ "0.72002256", "0.7079204", "0.7060445", "0.7000722", "0.69598734", "0.68429655", "0.6764273", "0.6622679", "0.65752923", "0.6572563", "0.65173155", "0.64808446", "0.6434036", "0.64339215", "0.6359622", "0.63100463", "0.6276153", "0.6274993", "0.6246552", "0.62407887", "0.6222...
0.61782634
46
A bounding rectangle x,y the minimum coordinate contained in the rectangle sx,sy the size of the rectangle along the x,y axis
function Rect(x,y,sx,sy,centered){ this.sx = sx; // width of the rectangle on the x axis this.sy = sy; // width of the rectangle on the y axis this.hx = sx/2; // half of the rectangle width on the x axis this.hy = sy/2; // half of the rectangle width on the y axis this.x = x; // minimum x coordinate contained in the rectangle this.y = y; // minimum y coordinate contained in the rectangle this.cx = x + this.hx; // x coordinate of the rectangle center this.cy = y + this.hy; // y coordinate of the rectangle center this.mx = this.x + sx; // maximum x coordinate contained in the rectangle this.my = this.y + sy; // maximum x coordinate contained in the rectangle if(centered){ this.x -= this.hx; this.cx -= this.hx; this.mx -= this.hx; this.y -= this.hy; this.cy -= this.hy; this.my -= this.hy; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BoundingBoxRect() { }", "bbox() {\n var maxX = -Infinity;\n var maxY = -Infinity;\n var minX = Infinity;\n var minY = Infinity;\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX);\n maxY = Math.max(el[1], maxY);\n minX = Math.min(el[0], minX);\n minY = Math....
[ "0.7078578", "0.684791", "0.6818044", "0.66710156", "0.6666757", "0.6666757", "0.64929557", "0.6467882", "0.6403344", "0.63710004", "0.6345185", "0.63323104", "0.6330131", "0.6313377", "0.63131547", "0.629353", "0.6277352", "0.62769806", "0.6258857", "0.6240201", "0.62348264"...
0.70760936
1
intersect line a,b with line c,d, returns null if no intersection
function lineIntersect(a,b,c,d){ // http://paulbourke.net/geometry/lineline2d/ var f = ((d.y - c.y)*(b.x - a.x) - (d.x - c.x)*(b.y - a.y)); if(f == 0){ return null; } f = 1 / f; var fab = ((d.x - c.x)*(a.y - c.y) - (d.y - c.y)*(a.x - c.x)) * f ; if(fab < 0 || fab > 1){ return null; } var fcd = ((b.x - a.x)*(a.y - c.y) - (b.y - a.y)*(a.x - c.x)) * f ; if(fcd < 0 || fcd > 1){ return null; } return new V2(a.x + fab * (b.x-a.x), a.y + fab * (b.y - a.y) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineintersect(s1, e1, s2, e2) { \n // Solve the equation \n // [(e1-s1) -(e2-s2)]*[a1 a2]^T = s2-s1\n // for [a1 a2]. Both a1 and a2 should be in the range [0,1] for segments to\n // intersect. The matrix on the lhs will be singular if the lines are\n // collinear.\n const a = e1[0] - s1[0], c ...
[ "0.8023182", "0.8009668", "0.8009668", "0.78674155", "0.7796506", "0.76996833", "0.76971805", "0.768333", "0.76445526", "0.7621484", "0.7585495", "0.7568172", "0.7559469", "0.7548191", "0.7546497", "0.7528471", "0.75217235", "0.75217235", "0.7500918", "0.74072814", "0.7396146...
0.86406803
0
The dummy class constructor
function Class() { // All construction is actually done in the init method if ( !initializing && this.init ) this.init.apply(this, arguments); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructur() {}", "function DummyClass() {\r\n // All construction is actually done in the construct method\r\n if ( !init && this.construct )\r\n this.construct.apply(this, arguments);\r\n }", "constructor(){}", "constructor(){}", "constructor(){}", "construc...
[ "0.83117235", "0.8150335", "0.8125716", "0.8125716", "0.8125716", "0.8125716", "0.8125716", "0.8125716", "0.8125716", "0.81216276", "0.81216276", "0.81216276", "0.80153376", "0.80066764", "0.7822476", "0.7822476", "0.7822476", "0.7822476", "0.7822476", "0.7822476", "0.7822476...
0.0
-1
don't leave dangling pipes when there are errors.
function onerror(er) { cleanup(); if (this.listeners('error').length === 0) { throw er; // Unhandled stream error in pipe. } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function brokenPipe() {\n throw Error('artoo.asyncStore: broken pipe.');\n }", "function onerror(error) {\n cleanup();\n if (!hasListeners(this, 'error'))\n throw error; // Unhandled stream error in pipe.\n }", "function onerror(er){debug(\"onerror\",er);unpipe();dest.removeListener(\"e...
[ "0.69866925", "0.6516497", "0.6399389", "0.6383316", "0.63701004", "0.63701004", "0.63701004", "0.63701004", "0.63701004", "0.6333437", "0.6292604", "0.6285128", "0.6285128", "0.6274714", "0.6233449", "0.62333864", "0.6221305", "0.62146306", "0.62146306", "0.62146306", "0.621...
0.61765504
83
remove all the event listeners that were added.
function cleanup() { source.removeListener('data', ondata); dest.removeListener('drain', ondrain); source.removeListener('end', onend); source.removeListener('close', onclose); source.removeListener('error', onerror); dest.removeListener('error', onerror); source.removeListener('end', cleanup); source.removeListener('close', cleanup); dest.removeListener('end', cleanup); dest.removeListener('close', cleanup); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeListeners() {}", "removeListeners() {}", "removeListeners() {}", "function removeEventListeners(){\n _.forEach(unlistenCallbacks, function(unlisten){\n unlisten();\n });\n unlistenCallbacks = [];\n }", "_clearListeners() {\n for (let liste...
[ "0.8521039", "0.8521039", "0.8521039", "0.8423259", "0.8304111", "0.8296624", "0.8282094", "0.8274838", "0.82720345", "0.8261525", "0.81342524", "0.8060971", "0.8031993", "0.7983937", "0.7970812", "0.7962308", "0.7867754", "0.78554255", "0.7834158", "0.77878404", "0.77458024"...
0.0
-1
CSS TRANSITION SUPPORT (Shoutout: ============================================================
function transitionEnd() { var el = document.createElement('bootstrap') var transEndEventNames = { 'WebkitTransition' : 'webkitTransitionEnd', 'MozTransition' : 'transitionend', 'OTransition' : 'oTransitionEnd otransitionend', 'transition' : 'transitionend' } for (var name in transEndEventNames) { if (el.style[name] !== undefined) { return { end: transEndEventNames[name] } } } return false // explicit for ie8 ( ._.) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "turnOn() {\n this.wrapper.style[Modernizr.prefixed('transition')] = Modernizr.prefixed('transform') + ' .25s';\n return this;\n }", "function reverseTranslate(newFrom){return $animateCss(target,{to:newFrom||from,addClass:options.transitionOutClass,removeClass:options.transitionInClas...
[ "0.6393169", "0.63363785", "0.6116096", "0.60325706", "0.59854114", "0.59188414", "0.58959925", "0.58895886", "0.58418053", "0.5778939", "0.57483596", "0.57483596", "0.5739082", "0.57356673", "0.56955856", "0.56765735", "0.56765735", "0.56765735", "0.56696326", "0.56696326", ...
0.0
-1
SCROLLSPY CLASS DEFINITION ==========================
function ScrollSpy(element, options) { var href var process = $.proxy(this.process, this) this.$element = $(element).is('body') ? $(window) : $(element) this.$body = $('body') this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process) this.options = $.extend({}, ScrollSpy.DEFAULTS, options) this.selector = (this.options.target || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 || '') + ' .nav li > a' this.offsets = $([]) this.targets = $([]) this.activeTarget = null this.refresh() this.process() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set scrolling(scrolling) {\n this._scrolling = scrolling;\n }", "function ScrollPosition() {}", "constructor() {\n this.instance = createScrollBar();\n }", "get scrollTarget(){return this.$.scrollable}", "constructor(props){\n super(props);\n this.state = {\n ...
[ "0.6424849", "0.6409387", "0.63328534", "0.6303255", "0.62154484", "0.6214183", "0.6214183", "0.6214183", "0.6214183", "0.6203554", "0.6202512", "0.61928904", "0.61734974", "0.6135548", "0.6109564", "0.6094813", "0.6077772", "0.6066652", "0.6066099", "0.6064882", "0.6058574",...
0.0
-1
var that = this;
function urllib(d) { // nothing yet //console.log(this); //console.log(that); return {current: varval,}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function contextOfThis(){\n return this\n}", "function whatIsThis() {\n return this;\n}", "function whatIsThis() {\n return this;\n}", "function whatIsThis() {\n console.log(\"this = \", this);\n}", "function whatisthis() {\n return this;\n }", "function foo() {\n alert(this);\n}", "fu...
[ "0.7088679", "0.6996949", "0.6996949", "0.6807182", "0.67879534", "0.66984016", "0.66964555", "0.6665635", "0.66271317", "0.6569171", "0.651752", "0.6454584", "0.6454572", "0.6438382", "0.6424949", "0.6420771", "0.6401824", "0.6401824", "0.6370205", "0.63697195", "0.63694257"...
0.0
-1
begin with some helper functions
function capitaliseFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "static private internal function m121() {}", "protected internal function m252() {}", "function _____SHARED_functions_____(){}", "static private protected internal function m118() {}", "transient protected internal function m18...
[ "0.65662664", "0.6473638", "0.63775975", "0.632043", "0.6246416", "0.61226255", "0.61174905", "0.61029696", "0.59229034", "0.59147596", "0.5820397", "0.5820397", "0.5814083", "0.5804759", "0.5804489", "0.57668304", "0.573242", "0.5730247", "0.5707165", "0.56519043", "0.561823...
0.0
-1
begin with some helper functions
function capitaliseFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "static private internal function m121() {}", "protected internal function m252() {}", "function _____SHARED_functions_____(){}", "static private protected internal function m118() {}", "transient protected internal function m18...
[ "0.6565186", "0.64724314", "0.63765097", "0.63196456", "0.62453985", "0.61215764", "0.6115861", "0.6101588", "0.5922311", "0.59130716", "0.5819228", "0.5819228", "0.5812798", "0.5803729", "0.5802676", "0.5765833", "0.57315266", "0.5729387", "0.570645", "0.5650666", "0.5616967...
0.0
-1
Export selected area on the map as a json encoded geoJson standard file, no backend calls simple HTML5 trick ;)
function exportToGeoJSON(element, content) { // HTML5 features has been used here var geoJsonData = 'data:application/json;charset=utf-8,' + encodeURIComponent(content); // TODO: replace closest() by using persistence id for templates, template id prefixed by unique id(i.e leaflet_id) var fileName = $(element).closest('form').attr('area-name') || 'geoJson'; var link = document.createElement("a"); link.download = fileName + '.json'; // Use the fence name given by the user as the file name of the JSON file; link.href = geoJsonData; document.body.appendChild(link); link.click(); document.body.removeChild(link); delete link; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exportToGeoJSON(link, content) {\n // HTML5 features has been used here\n var geoJsonData = 'data:application/json;charset=utf-8,' + encodeURIComponent(content);\n // TODO: replace closest() by using persistence id for templates, template id prefixed by unique id(i.e leaflet_id)\n var fileNam...
[ "0.7177311", "0.7154892", "0.66580635", "0.6548282", "0.64752775", "0.6453165", "0.6437649", "0.64189875", "0.62069756", "0.6124514", "0.61042166", "0.6078614", "0.6049572", "0.60482675", "0.6022068", "0.600245", "0.5965552", "0.590308", "0.58901584", "0.5842907", "0.5841846"...
0.72194403
0
ensures a vertical line will not pass from the left to the right
lineTest (left, right) { let leftLine = true, rightLine = true left.forEach(index => { if (index % this.width !== 0) leftLine = false }) right.forEach(index => { if (index % this.width !== this.width - 1) rightLine = false }) return leftLine && rightLine }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vertical_line_line(line, x) {\n const px = line.p[0], py = line.p[1];\n const ux = line.u[0], uy = line.u[1];\n return vec2.fromValues(x, py + uy * (x - px) / ux);\n}", "function verticalline(prevcol) {\n var currchip = null;\n var prevchip = 0;\n var count = 0;\n\n for (var row = 0; row ...
[ "0.6729954", "0.6622322", "0.64239997", "0.6312249", "0.63114655", "0.6309668", "0.6269432", "0.6267897", "0.6216122", "0.62157315", "0.6188763", "0.6178433", "0.613286", "0.61135954", "0.61135954", "0.6106936", "0.6100049", "0.60898376", "0.6086674", "0.60331523", "0.6022578...
0.6440199
2
OICE Output: a string representing the longest common prefix Input: an array of strings Constraints: O(n) empty string, strs.length = 0 => null ["colorado", "color", "cold"] result = 'col' sorted: ["cold", "color", "colorado"] fVal: 'd' lVal: 'o' return 'col' Pseudo: 1. declare a results variable which would be an empty string 2. sort the array into alphabetical order 3. loop over the array comparing the first and last elements if the values of the first and last are the same, then concat that value to the string break if the two do not equal each other 4. return result
function longestCommonPrefix(strs) { if (strs.length === 0) { return null; } if (strs.length === 1) { return strs[0]; } let result = ''; strs = strs.sort(); // nlogn for (let i = 0; i < strs[0].length; i++) { //n if (strs[0][i] === strs[strs.length - 1][i]) { result += strs[0][i]; } else { break; } } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function longestCommonPrefix(arr) {\n let result = '';\n if (!arr || arr.length === 0) { return ''; }\n for (let i = 0; i < arr[0].length; i++){\n let newLetter = arr[0][i];\n\n for (let j = 0; j < arr.length; j++){\n let testLetter = arr[j][i];\n if (testLetter !== newLetter) {\n return ...
[ "0.81770235", "0.7536537", "0.7298831", "0.72766906", "0.7263027", "0.72377604", "0.7116802", "0.67260146", "0.6720174", "0.6601336", "0.65502846", "0.64597", "0.64029264", "0.6357975", "0.6325793", "0.62687784", "0.6240725", "0.6238666", "0.6204243", "0.61854887", "0.6171245...
0.7716853
1
Checks if a Discord member already has a Simbit shop account
function checkAcc(memberObj){ if(getShopUser(memberObj) != null){ return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkSubscription ( spaceId )\n{ // checks if spaceId is currently subscribed\n if ( subscriptions.includes( spaceId ) )\n { return true; }\n else\n { return false; }\n}", "userExists(user) {\n // Temp variable for storing the user if found\n let temp = '';\n for (let i of this.users) {\n ...
[ "0.55734277", "0.5473422", "0.5449131", "0.5419826", "0.54182255", "0.5417166", "0.5397074", "0.5372543", "0.53500605", "0.5339697", "0.5327737", "0.5310359", "0.53093594", "0.53005874", "0.5296564", "0.52776945", "0.5259131", "0.52456725", "0.5239986", "0.52367795", "0.52335...
0.65833217
0
Makes a Simbit shop account for a Discord member
function mkAcc(memberObj){ data["users"].push( { "id": memberObj.user.id.toString(), "name": memberObj.user.username, "balance": 0, "inventory" : [] } ) return fs.writeFileSync("./data/shop/data.json", JSON.stringify(data), (err) => console.log(err)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "becomeGameSponsor({ gameSponsorFee }) {\n this.CONTRACT\n .becomeGameSponsor\n .sendTransaction(\n {\n \"from\": MYWeb3.getAccount(),\n \"gas\": MYWeb3.toHex(400000),\n \"value\": MYWeb3.toWei(gameSponsorFee),\n },\n function (err, result) {}\n );\n...
[ "0.6132298", "0.5986284", "0.58800316", "0.5826678", "0.5746144", "0.5742082", "0.56690496", "0.56596005", "0.5641064", "0.56408376", "0.56162", "0.55959916", "0.55750436", "0.5573975", "0.55138916", "0.55117965", "0.55003226", "0.5472459", "0.54669696", "0.54669696", "0.5466...
0.0
-1
Gets the Simbit account
function getShopUser(memberObj){ return data.users.find(user => { return user.id === memberObj.user.id.toString(); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAccount() {\n const config = zxeth.getConf();\n\n return config.accounts[0];\n}", "async function getAccount() {\n return (await web3.eth.personal.getAccounts())[0];\n}", "get account () { return this.API.getAccount(this.address) }", "async function getAccount() {\n let account = \"No accou...
[ "0.78236365", "0.77858245", "0.76284635", "0.7244754", "0.7130035", "0.702045", "0.6929867", "0.690045", "0.6829834", "0.68227273", "0.6687283", "0.66637695", "0.6632414", "0.66189754", "0.65984136", "0.6561963", "0.6561452", "0.6543035", "0.64462125", "0.642186", "0.6402867"...
0.0
-1
Awards a Shop User an amount of Simbits. There's no limit to how many Simbits
function award(memberObj, amount){ let shopUser = getShopUser(memberObj); shopUser.balance += amount; data.budget -= amount; fs.writeFileSync("./data/shop/data.json", JSON.stringify(data), (err) => console.log(err)); return `:confetti_ball: ${memberObj} has earned ${amount} Simbits! :confetti_ball: ` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buy5() {\n const credit = 500;\n addCredit(credit);\n return credit;\n}", "function purchaseAutoUpgrades(autoUpgradeChoice) {\n let purchSing = automaticUpgrades[autoUpgradeChoice]\n let buySing = purchSing + automaticUpgrades[autoUpgradeChoice].quantity\n if (cheese >= automaticUpgrades[a...
[ "0.5645975", "0.5639223", "0.5607249", "0.5585898", "0.55709535", "0.55418587", "0.5501198", "0.54871213", "0.54459745", "0.54241574", "0.5391087", "0.536751", "0.53550285", "0.5311168", "0.5310351", "0.53002954", "0.5289543", "0.5285286", "0.5278841", "0.52735656", "0.526818...
0.5022208
60
Deducts a Shop User an amount of Simbits. Can't deduct if their balance isn't enough to deduct from
function deduct(memberObj, amount){ let shopUser = getShopUser(memberObj); shopUser.balance -= amount; data.budget += amount; fs.writeFileSync("./data/shop/data.json", JSON.stringify(data), (err) => console.log(err)); return `${memberObj} has had ${amount} Simbits deducted from them and added back to the budget.` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculDeductible () {\n for (var i = 0; i < deliveries.length; i++) {\n if (deliveries[i].options.deductibleReduction == true) {\n deliveries[i].price += deliveries[i].volume\n deliveries[i].commission.convargo += deliveries[i].volume\n }\n }\n}", "async deposit_ammo_usdc_clp(amount) {...
[ "0.6344042", "0.6142094", "0.59707654", "0.59464335", "0.58904266", "0.5883644", "0.58782816", "0.5858526", "0.5807908", "0.57528013", "0.5734093", "0.5729706", "0.5669909", "0.56642145", "0.5635661", "0.5620646", "0.5572337", "0.55587494", "0.5558613", "0.5549193", "0.554227...
0.69656706
0
Gets an Item object from the shop
function getItemFromShop(itemName){ return data.store.find(storeItem => { return storeItem.Item === itemName; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getItemById (itemId) {\n return Item.findOne({ \"_id\": itemId })\n}", "function getShopItemInfo(shopItem) {\n //Create an object with shop item data\n const shopItemInfo = {\n image: shopItem.querySelector('img').src,\n title: shopItem.querySelector('h5').textContent,\n price: shopItem....
[ "0.6840215", "0.67527175", "0.65636957", "0.65296793", "0.64509606", "0.643171", "0.64228094", "0.64165485", "0.6398271", "0.6361998", "0.63446003", "0.63249916", "0.6272496", "0.62217516", "0.6170912", "0.61449254", "0.6131862", "0.6063973", "0.60442835", "0.60430187", "0.60...
0.7789292
0
Removes an shop item object from the shop
function removeFromShop(itemObj) { let index = data.store.indexOf(itemObj); if(index > -1){ data.store.splice(index, 1); fs.writeFileSync("./data/shop/data.json", JSON.stringify(data), (err) => console.log(err)); return `${itemObj.Item} has been removed from the shop.` } else { return `${itemObj.Item} doesn't exist in the store. Please double check you've spelled it correctly.` } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeItem(item){\n\n\t\t\t// Make sure cart is not empty\n\t\t\tif((!isEmpty()) && itemInCart(item) ){\n\n\t\t\t\t// remove all the items of this kind from cart count\n\t\t\t\tadjustCount(item.qty * -1);\n\t\t\t\t\n\t\t\t\t// Adjust total based on item qty\n\t\t\t\tadjustTotal((item.price*item.qty)*-1);\...
[ "0.7396999", "0.7288893", "0.7258435", "0.69506174", "0.69497085", "0.6946783", "0.6944789", "0.6902107", "0.69014347", "0.68973345", "0.6896371", "0.68830764", "0.68610626", "0.68413305", "0.6831908", "0.68280256", "0.6794857", "0.679483", "0.6789529", "0.6748611", "0.674861...
0.7409766
0
Gets item object if it exists in a shop user's inventory
function getItemFromInventory(memberObj, itemName){ let shopUser = getShopUser(memberObj); return shopUser.inventory.find(invItem => { return invItem.Item === itemName; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkInventory(chosenItemId, inventory) {\n // loop through the inventory, and check if the user ID-input matches any IDs in the database\n for (let i = 0; i < product.length; i++) {\n // if it matches, then return the item\n if (inventory[i].id === chosenItemId) {\n return ...
[ "0.7176266", "0.71692055", "0.70616436", "0.7025029", "0.65179", "0.6476265", "0.645627", "0.6286752", "0.62667966", "0.62543756", "0.62536126", "0.6217274", "0.61803204", "0.6179814", "0.6120193", "0.6112549", "0.61096394", "0.6108419", "0.6080318", "0.60705066", "0.6056833"...
0.7557776
0
The redeeming process. Removes an inventory item from a shop user's inventory
function redeem(memberObj, itemObj){ let shopUser = getShopUser(memberObj); inventoryQuantityProcess(memberObj, itemObj); return `One ${itemObj.Item} has successfully redeemed and removed from ${memberObj}'s inventory.`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "remove(item) {\n item = this.normalize(item);\n\n if (this.items.filter(i => i[0] == item[0]).length) { // item with SKU exists already\n this.items = this.items.map(\n i => {\n // when the SKU of the newly added item matches the item in the inventory, jus...
[ "0.7013096", "0.68041146", "0.6792574", "0.6783351", "0.6760429", "0.67308116", "0.6706836", "0.6693642", "0.66435033", "0.66217846", "0.65953696", "0.65835863", "0.6571048", "0.6560019", "0.6497578", "0.6494628", "0.6487814", "0.6482277", "0.64687467", "0.6376041", "0.633172...
0.7110339
0
The process of removing ONE item from a shop user inventory. Will delete completely if quantity is at 0, reduce quantity by 1 else.
function inventoryQuantityProcess(memberObj, itemObj){ let shopUser = getShopUser(memberObj); if(itemObj.quantity == 1) { let index = shopUser.inventory.indexOf(itemObj); if(index > -1){ shopUser.inventory.splice(index, 1); return fs.writeFileSync("./data/shop/data.json", JSON.stringify(data), (err) => console.log(err)); } } else { itemObj.quantity -= 1; return fs.writeFileSync("./data/shop/data.json", JSON.stringify(data), (err) => console.log(err)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "remove(item) {\n item = this.normalize(item);\n\n if (this.items.filter(i => i[0] == item[0]).length) { // item with SKU exists already\n this.items = this.items.map(\n i => {\n // when the SKU of the newly added item matches the item in the inventory, jus...
[ "0.762449", "0.73512983", "0.71952987", "0.7138613", "0.71305656", "0.7071512", "0.7050945", "0.7002176", "0.69745976", "0.6967367", "0.69345516", "0.6904968", "0.67896813", "0.67762643", "0.6746823", "0.67459285", "0.66755944", "0.6673889", "0.6655034", "0.6631984", "0.66286...
0.7058083
6
The function is memoized so that no extra lifecycles are needed as per
prefetch() { if (!this.p || true) return; // Prefetch the JSON page if asked (only in the client) var { pathname } = window.location; var { href: parsedHref } = this.formatUrls(this.props.href, this.props.as); var href = (0, _url.resolve)(pathname, parsedHref); _router.default.prefetch(href); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function memoize(fn){\n const cache={}\n return function(...args){\n if(cache[args]) return cache[args]\n \n const result = fn.apply(this,args)\n cache[args]=result\n \n return result\n }\n }", "function memoizedAddTo80() {\n let cache = {};\n\n return function (n) {\n if (n...
[ "0.5979633", "0.5847816", "0.57982284", "0.57515824", "0.57465976", "0.57324284", "0.56982774", "0.5657083", "0.5651081", "0.5646444", "0.5635349", "0.56281275", "0.56016815", "0.558982", "0.5588909", "0.55641943", "0.5555498", "0.554418", "0.5487954", "0.5487954", "0.5487954...
0.0
-1
Go back in history
back() { window.history.back(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function goBack() {\n history.go(-1);\n }", "function back() {\n if (history.length > 1) {\n setHistory(prev => prev.slice(0, prev.length - 1));\n }\n }", "function voltarHistory()\n\t{\n\t\twindow.history.back();\n\t}", "function goback() \n{\nhistory.go(-1);\n}", "back()\n ...
[ "0.8658206", "0.8359694", "0.83595216", "0.83213216", "0.8285847", "0.82845247", "0.82467586", "0.8236736", "0.82216424", "0.82195777", "0.82184064", "0.81998354", "0.8196878", "0.8195958", "0.8180671", "0.81693447", "0.8166096", "0.8150814", "0.8150814", "0.8150814", "0.8132...
0.7714336
78
Performs a `pushState` with arguments
push(url, as = url, options = {}) { return this.change('pushState', url, as, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "pushState(state, title, url = this.url) {\n url = URL.resolve(this.current.window.document.URL, url);\n // TODO: check same origin\n this.addEntry(this.current.window, url, state || {});\n this.updateLocation(this.current.window, url);\n }", "function pushState(state, pathname, query) { ...
[ "0.7204924", "0.71836793", "0.69598854", "0.68663716", "0.6789066", "0.67421365", "0.67283183", "0.6669965", "0.6669965", "0.6669965", "0.6669965", "0.6669965", "0.6569138", "0.6569138", "0.6569138", "0.65368104", "0.6515619", "0.64871335", "0.6471626", "0.64703053", "0.64407...
0.65883434
20
Performs a `replaceState` with arguments
replace(url, as = url, options = {}) { return this.change('replaceState', url, as, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "replace(url, as, options = {}) {\n ;\n ({\n url,\n as\n } = prepareUrlAs(this, url, as));\n return this.change('replaceState', url, as, options);\n }", "replace(url, as, options = {}) {\n ;\n ({\n url,\n as\n } = prepareUrlAs(this, url, as));\n return this.change('rep...
[ "0.6915585", "0.6915585", "0.6915585", "0.6915585", "0.6915585", "0.6831305", "0.6831305", "0.6831305", "0.66702175", "0.66198623", "0.64779127", "0.6450049", "0.64047945", "0.63779116", "0.5861434", "0.5754697", "0.5746827", "0.5723408", "0.5712878", "0.57043463", "0.5645805...
0.69920236
8
Callback to execute before replacing router state
beforePopState(cb) { this._bps = cb; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dispatchRouteChange() {\n // remove hash\n var href = location.hash.substr(1, location.hash.length - 1);\n\n routerState$.patch({\n route: href === '' ? '/' : href.split('?')[0],\n params: getUrlParams(href)\n });\n }", "function _beforeRouting(newRou...
[ "0.6493267", "0.634981", "0.6302787", "0.62859064", "0.62746507", "0.61022764", "0.6086716", "0.604224", "0.604224", "0.604224", "0.6034733", "0.6025055", "0.6016213", "0.6009035", "0.59987426", "0.5981339", "0.5973961", "0.5965341", "0.5963855", "0.59628415", "0.5958349", ...
0.0
-1
Prefetch `page` code, you may wait for the data during `page` rendering. This feature only works in production!
prefetch(url) { return new _Promise((resolve, reject) => { const { pathname, protocol } = url_1.parse(url); if (!pathname || protocol) { if (true) { throw new Error(`Invalid href passed to router: ${url} https://err.sh/zeit/next.js/invalid-href-passed`); } return; } // Prefetch is not supported in development mode because it would trigger on-demand-entries if (true) return; // @ts-ignore pathname is always defined const route = toRoute(pathname); this.pageLoader.prefetch(route).then(resolve, reject); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadAndRenderItems() {\n pageData().then(render)\n }", "prefetch() {\n if (!this.p || true) return; // Prefetch the JSON page if asked (only in the client)\n\n var href = this.getHref();\n\n _router.default.prefetch(href);\n\n prefetched[href] = true;\n }", "prefetch() {\n if (!this....
[ "0.7043598", "0.69597477", "0.69597477", "0.6868784", "0.6868784", "0.67919433", "0.6769896", "0.6769896", "0.6579662", "0.6304017", "0.6304017", "0.6301481", "0.6300077", "0.62954915", "0.62954915", "0.6271136", "0.62579906", "0.6233454", "0.6233454", "0.6233454", "0.6212761...
0.60669357
44