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
currentDay function runs with the giving city from where the function is called, and with the createButton boolean true or false.
function currentDay(inputCity, createButton){ // Variable that holds the API url along with variables key, unit and inputed city from user. const queryURL = "https://api.openweathermap.org/data/2.5/weather?appid=" + APIKey + imperialUnit + "&q=" + inputCity; // AJAX call for the specific criteria (city name) entered by the user. $.ajax({ url: queryURL, method: "GET" }).then(response => { // console.log(response); // Created variable to hold the city name response from API. const cityName = response.name // console.log(cityName); // If createButton boolean is true than create button; however, another if statement is entered, so if user types a name of a city that he/she searched before, then this city will not be entered in the savedCity array. if (createButton) { if ((savedCity.indexOf(cityName)) <= -1){ // console.log(cityName); savedCity.push(cityName); } } // Created variable to grab current day. const d = new Date(); // Created variable to grab the icon image name. const dayIcon = response.weather[0].icon; // Create new elements to be append in the html file using the API response as part of the text. const newCurrentWeather = ` <h2>${cityName}<span>(${d.getMonth()+1}/${d.getDate()}/${d.getFullYear()})</span> <img src="https://openweathermap.org/img/wn/${dayIcon}.png"></img> </h2> <p>Temperature: <span class="bold">${response.main.temp}</span> ℉</p> <p>Humidity: <span class="bold">${response.main.humidity}</span>%</p> <p>Wind Speed: <span class="bold">${response.wind.speed}</span> mph; <p class="uv">UV Index: </p> <img class='imgUv' src="https://www.epa.gov/sites/production/files/sunwise/images/uviscaleh_lg.gif" alt="UV Color Scale"></img> <br> <br> ` // Created varibles to store the latitude and longitude responses that are going to be used in the URL to grab the UV. const latitude = response.coord.lat const long = response.coord.lon // Calls the function that runs the AJAX with the UV API. getUV(); // Clears the div with the today class, and add the response for the new city searched. today.empty().append(newCurrentWeather); function getUV(){ // Created variable to hold API url along with key, and the searched city latitute and longitude. const uvURL = "https://api.openweathermap.org/data/2.5/uvi?lat=" + latitude + "&lon=" + long + "&appid=" + APIKey // AJAX call function for to get the UV API response. $.ajax({ url: uvURL, method: "GET" }).then(resUV => { // console.log(resUV); // Created variable to hold UV response. const uv = resUV.value; $(".spUv").remove(); // Created a span tag with the UV response. const spanUV = $("<span class='spUv bold'>").text(uv); // Append the span tag to the p tag created previously. $(".uv").append(spanUV); // Gets the UV response and turns into a number. const parsenUV = parseInt(uv); // The following if statements are to color code the UV level according to https://www.epa.gov/sunsafety/uv-index-scale-0 if (parsenUV <= 2){ spanUV.attr("style", "background: green") } else if (parsenUV >= 3 && parsenUV <= 5){ spanUV.attr("style", "background: yellow") } else if (parsenUV === 6 || parsenUV === 7){ spanUV.attr("style", "background: orange") } else if (parsenUV >= 8 && parsenUV <= 10){ spanUV.attr("style", "color: white;background: red") } else if (parsenUV >= 11){ spanUV.attr("style", "color: white;background: purple") } }) } // Call function that displays 5 days forecast. futureDates() function futureDates(){ // Created variable to hold the forecast URL, adding the user search city name, API key, and unit change from standard to imperial. const forecastURL = "https://api.openweathermap.org/data/2.5/forecast?q=" + cityName + "&appid=" + APIKey + imperialUnit // AJAX call for the specific city search by the user. $.ajax({ url: forecastURL, method: "GET" }).then(forecastRes => { // console.log(forecastRes); // Created varibale that holds the API response with a list of the every three works forecast for a five days period. const forecastArray = forecastRes.list // Create a h3 tag to display the 5-Day Forecast title. const newForH3 = `<h3>5-Day Forecast</h3>`; // Create a new div with a bootstrap class card-deck. const newCardDeck = `<div class="card-deck"></div>`; // Empty the div with class forecast, then append the new h3 and the new div. forecast.empty().append(newForH3, newCardDeck); // Create a for loop to loop through the forecast array. Start to loop at index 7 to skip the current day. The response comes back in 3 hours range; therefore, each returns 8 result per day, that's why i is added by 8 each time, to take a new day. for (let i=7; i < forecastArray.length; i+=8){ // Created variable to store date from response and format it to JavaScript. const forDate = new Date(forecastArray[i].dt_txt); // console.log(forDate); // Created variable to hold each icon name. const forDayIcon = forecastArray[i].weather[0].icon; // Create a new div with bootstrap class card-body for each result. const newDivCardBody = `<div class="card-body"> <p><span class="bold">${forDate.getMonth()+1}/${forDate.getDate()}/${forDate.getFullYear()}</span> <img src="https://openweathermap.org/img/wn/${forDayIcon}.png"></img></p> <p>Temperature: <span class="bold">${forecastArray[i].main.temp}</span> ℉<p> <p>Humidity: <span class="bold">${forecastArray[1].main.humidity}</span>%</p> </div> ` // Append the div with class card-body to the div with class card-deck. $(".card-deck").append(newDivCardBody); } }) } // Call create button function. createBtn(); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function city() {\n let cityName = $(this).text();\n currentWeather(cityName);\n get5Day(cityName);\n}", "function dayButtonClicked() {\n if (night == false) {\n night = true;\n nightIn();\n return;\n }\n if (night == true) {\n night = false;\n dayIn();\n return;\n }\n}", "function onC...
[ "0.68691313", "0.67805153", "0.6557033", "0.6453229", "0.63967985", "0.6370309", "0.6354954", "0.6277295", "0.6245603", "0.61781263", "0.6158528", "0.61158", "0.6094348", "0.6089973", "0.6075558", "0.6040204", "0.60292065", "0.60158986", "0.59915924", "0.59398204", "0.5932253...
0.76257956
0
Function that creates a new button with the city name searched by the user.
function createBtn(){ // Remove existing buttons with the city name. $(".cityBtn").remove(); // Create new button for each element inside the savedCity array. savedCity.forEach(cn => { // console.log(cn); // Create a new button with the city names inside the savedCity array. const newCityBtn = `<button class="cityBtn btn-block" data-name="${cn}">${cn}</button>` // Append the new button tag to the div with class searchArea. searchArea.append(newCityBtn); }) // Call storeCities function. storeCities(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createcitybtn(city) {\n var citybutton = $(\"<button>\").addClass(\"citybutton button\");\n citybutton.text(city);\n $(\"#citylist\").append(citybutton);\n $(\"#citylist\").append(\"<br />\");\n}", "function recentSearch() {\n var cityName = $(\"#search\").val().trim();\n var button = $(\"<but...
[ "0.78553957", "0.7825736", "0.763286", "0.75950134", "0.75568724", "0.7497093", "0.7391449", "0.7385075", "0.73447865", "0.7334902", "0.7242455", "0.7230919", "0.72066313", "0.716309", "0.70412064", "0.7033622", "0.7025236", "0.699126", "0.6982093", "0.6968694", "0.69606197",...
0.7926703
0
Helper function to allow the creation of anonymous functions which do not have .name set to the name of the variable being assigned to.
function identity(fn) { return fn; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function funcName(func) {\n return func.name || \"{anonymous}\"\n }", "function creaClosure(name) {\n return function () {\n console.log(name);\n }\n}", "function nom(fun) {\n var src = fun.toString();\n src = src.substr('function '.length);\n var n = src.substr(0, src.indexOf('...
[ "0.6230304", "0.61239725", "0.6084594", "0.60710484", "0.5986077", "0.58369416", "0.57288766", "0.5704563", "0.56906456", "0.56906456", "0.56906456", "0.56906456", "0.56906456", "0.56906456", "0.56852525", "0.5667304", "0.56588256", "0.56499326", "0.5611372", "0.55936", "0.55...
0.0
-1
Mixin helper which handles policy validation and reserved specification keys when building React classes.
function mixSpecIntoComponent(Constructor, spec) { if (!spec) { if (process.env.NODE_ENV !== 'production') { var typeofSpec = typeof spec; var isMixinValid = typeofSpec === 'object' && spec !== null; if (process.env.NODE_ENV !== 'production') { warning( isMixinValid, "%s: You're attempting to include a mixin that is either null " + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec ); } } return; } _invariant( typeof spec !== 'function', "ReactClass: You're attempting to " + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.' ); _invariant( !isValidElement(spec), "ReactClass: You're attempting to " + 'use a component as a mixin. Instead, just use a regular object.' ); var proto = Constructor.prototype; var autoBindPairs = proto.__reactAutoBindPairs; // By handling mixins before any other properties, we ensure the same // chaining order is applied to methods with DEFINE_MANY policy, whether // mixins are listed before or after these methods in the spec. if (spec.hasOwnProperty(MIXINS_KEY)) { RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); } for (var name in spec) { if (!spec.hasOwnProperty(name)) { continue; } if (name === MIXINS_KEY) { // We have already handled mixins in a special case above. continue; } var property = spec[name]; var isAlreadyDefined = proto.hasOwnProperty(name); validateMethodOverride(isAlreadyDefined, name); if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { RESERVED_SPEC_KEYS[name](Constructor, property); } else { // Setup methods on prototype: // The following member methods should not be automatically bound: // 1. Expected ReactClass methods (in the "interface"). // 2. Overridden methods (that were mixed in). var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); var isFunction = typeof property === 'function'; var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; if (shouldAutoBind) { autoBindPairs.push(name, property); proto[name] = property; } else { if (isAlreadyDefined) { var specPolicy = ReactClassInterface[name]; // These cases should already be caught by validateMethodOverride. _invariant( isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name ); // For methods which are defined more than once, call the existing // methods before calling the new property, merging if appropriate. if (specPolicy === 'DEFINE_MANY_MERGED') { proto[name] = createMergedResultFunction(proto[name], property); } else if (specPolicy === 'DEFINE_MANY') { proto[name] = createChainedFunction(proto[name], property); } } else { proto[name] = property; if (process.env.NODE_ENV !== 'production') { // Add verbose displayName to the function, which helps when looking // at profiling tools. if (typeof property === 'function' && spec.displayName) { proto[name].displayName = spec.displayName + '_' + name; } } } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_validate() {\n throw new Error('_validate not implemented in child class');\n }", "function jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, true);\n }\n}", "function jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props...
[ "0.5324247", "0.5077051", "0.5077051", "0.5059369", "0.5028981", "0.5028981", "0.5000489", "0.5000489", "0.5000489", "0.5000489", "0.5000489", "0.5000489", "0.5000489", "0.5000489", "0.5000489", "0.5000489", "0.5000489", "0.49979922", "0.49586648", "0.49586648", "0.49571598",...
0.0
-1
Copyright (c) 2013present, Facebook, Inc. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
function makeEmptyFunction(arg) { return function () { return arg; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() {\n // if this is the first time the home screen is loading\n // we must initialize Facebook\n if (!window.FB) {\n window.fbAsyncInit = function() {\n window.FB.init({\n appId : '280945375708713',\n cookie : true, // enable cookies to allow the s...
[ "0.582302", "0.56352496", "0.55549705", "0.54886013", "0.5398446", "0.5384924", "0.53627056", "0.53269863", "0.5322178", "0.53158647", "0.53158647", "0.5293647", "0.5266638", "0.52168524", "0.5198115", "0.51917535", "0.5191675", "0.5155282", "0.5140739", "0.5130987", "0.51252...
0.0
-1
v8 likes predictible objects
function Item(fun, array) { this.fun = fun; this.array = array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareLike(a,b){\n var al = a.idLikesProp.length;\n var bl = b.idLikesProp.length;\n if(al > bl) return -1;\n if(bl > al) return 1;\n return 0;\n}", "function lookAround() {\n var objectDescription = \"\"\n tj.see().then(function(objects) {\n objects.forEach(function(each) {\n ...
[ "0.527866", "0.52612406", "0.51951283", "0.518796", "0.51302594", "0.5044646", "0.48934332", "0.4857401", "0.484017", "0.48302925", "0.482028", "0.4812441", "0.4808473", "0.47852293", "0.47828078", "0.47574478", "0.47493434", "0.4739314", "0.47239366", "0.4703992", "0.4703992...
0.0
-1
inlined Object.is polyfill to avoid requiring consumers ship their own /eslintdisable noselfcompare
function is(x, y) { // SameValue algorithm if (x === y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y; } else { // Step 6.a: NaN == NaN return x !== x && y !== y; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isObject$1(obj) {\n // incase of arrow function and array\n return Object(obj) === obj && String(obj) === '[object Object]' && !isFunction(obj) && !isArray(obj);\n }", "function isObject$1(obj) {\n ...
[ "0.67307776", "0.6633116", "0.6609801", "0.65994185", "0.65991455", "0.65645915", "0.65056276", "0.6466668", "0.64615506", "0.6410588", "0.63689065", "0.63643163", "0.63643163", "0.63643163", "0.63643163", "0.6356162", "0.63265204", "0.6321958", "0.632186", "0.6294811", "0.62...
0.0
-1
Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return 'array'; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return 'object'; } if (isSymbol(propType, propValue)) { return 'symbol'; } return propType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sc_typeof( x ) {\n return typeof x;\n}", "static type(arg)\n {\n const types = [\n 'array', 'boolean', 'function', 'number',\n 'null', 'object', 'regexp', 'symbol', 'string',\n 'undefined'\n ]\n\n var type = Object.prototype.toString.call(arg),\...
[ "0.6909167", "0.67750335", "0.66079795", "0.6537892", "0.64935464", "0.6488478", "0.6488478", "0.6450447", "0.6450447", "0.64288545", "0.6427948", "0.6404547", "0.6404547", "0.63955957", "0.63955957", "0.63955957", "0.63955957", "0.63955957", "0.63955957", "0.63955957", "0.63...
0.0
-1
This handles more types than `getPropType`. Only used for error messages. See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) { if (typeof propValue === 'undefined' || propValue === null) { return '' + propValue; } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPropType(propValue) {\n\t\t var propType = typeof propValue;\n\t\t if (Array.isArray(propValue)) {\n\t\t return 'array';\n\t\t }\n\t\t if (propValue instanceof RegExp) {\n\t\t // Old webkits (at least until Android 4.0) return 'function' rather than\n\t\t // 'object' for type...
[ "0.6876632", "0.68532825", "0.68532825", "0.68532825", "0.68532825", "0.68521523", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517", "0.6846517"...
0.0
-1
Returns a string that is postfixed to a warning about an invalid type. For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) { var type = getPreciseType(value); switch (type) { case 'array': case 'object': return 'an ' + type; case 'boolean': case 'date': case 'regexp': return 'a ' + type; default: return type; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _undefinedCoerce() {\n return '';\n}", "function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case \"array\":\n case \"object\":\n return \"an \" + type;\n case \"boolean\":\n ...
[ "0.65988296", "0.6565237", "0.6559532", "0.6559532", "0.6559532", "0.6559532", "0.6522337", "0.65215486", "0.65060395", "0.65060395", "0.65060395", "0.65060395", "0.65060395", "0.65013695", "0.6489755", "0.6477735", "0.6477735", "0.6477735", "0.6477735", "0.6477735", "0.64777...
0.0
-1
Returns class name of the object, if any.
function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { return ANONYMOUS; } return propValue.constructor.name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getClassName(obj) {\n var funcNameRegex = /function\\s+(.+?)\\s*\\(/;\n var results = funcNameRegex.exec(obj['constructor'].toString());\n return (results && results.length > 1) ? results[1] : '';\n }", "getClassName() {\n return this.constructor\n .className;\n...
[ "0.7729453", "0.7467235", "0.7467235", "0.74239284", "0.7165505", "0.71431816", "0.70840144", "0.7080456", "0.69956654", "0.6969364", "0.6898247", "0.6879638", "0.6712778", "0.66559386", "0.663537", "0.6608779", "0.6608779", "0.6608779", "0.6608779", "0.6598088", "0.65969384"...
0.0
-1
Base class helpers for the updating state of a component.
function Component(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n BaseState.update.call(this);\n }", "_update() {\n // Call subclass lifecycle method\n const stateNeedsUpdate = this.needsUpdate();\n // End lifecycle method\n debug(TRACE_UPDATE, this, stateNeedsUpdate);\n\n if (stateNeedsUpdate) {\n this._updateState();\n }\n }", "func...
[ "0.721754", "0.6761505", "0.6677766", "0.66110283", "0.65402955", "0.6526947", "0.6489771", "0.6469624", "0.6459612", "0.63837487", "0.635385", "0.6334491", "0.63050455", "0.6304887", "0.62716913", "0.6266266", "0.6215486", "0.62133574", "0.6194339", "0.6189688", "0.61572605"...
0.0
-1
Convenience component with default shallow equality check for sCU.
function PureComponent(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function useStrictEquality(b, a) {\n return a === b;\n }", "get shallowCopy() {\n return this.shallowCopy$();\n }", "function defaultEqualityCheck(a, b) {\n return !a && !b || a === b;\n }", "equals() {\n return false;\n }", "equals() {\n return false;\n }", ...
[ "0.6085072", "0.5797941", "0.56714934", "0.56600976", "0.56600976", "0.5634895", "0.5591487", "0.5591487", "0.5589446", "0.5548937", "0.54901", "0.5488135", "0.54843646", "0.54843646", "0.5476242", "0.5476242", "0.5476242", "0.54560626", "0.54560626", "0.5442269", "0.5401306"...
0.0
-1
an immutable object with a single mutable value
function createRef() { var refObject = { current: null }; { Object.seal(refObject); } return refObject; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function immutableObjectTest(){\n\nlet test= {'name': 'vishal', 'age':27};\n//Object.freeze(test);\nlet test2= test;\n\ntest.age = 26;\nconsole.log(test);\nconsole.log(test2);\nconsole.log(test === test2);\n\n\n\n\n}", "static set one(value) {}", "function makeImmutableObject(obj) {\n\t if (!globalConfig.us...
[ "0.6674448", "0.66609514", "0.6358345", "0.6347869", "0.6347869", "0.6263268", "0.6230736", "0.6136926", "0.61048114", "0.5915378", "0.5889688", "0.580687", "0.5776291", "0.5763881", "0.57248324", "0.56947106", "0.566211", "0.5636481", "0.56181127", "0.5606209", "0.5606209", ...
0.0
-1
Create and return a new ReactElement of the given type. See
function createElement(type, config, children) { var propName = void 0; // Reserved names are extracted var props = {}; var key = null; var ref = null; var self = null; var source = null; if (config != null) { if (hasValidRef(config)) { ref = config.ref; } if (hasValidKey(config)) { key = '' + config.key; } self = config.__self === undefined ? null : config.__self; source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config[propName]; } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } { if (Object.freeze) { Object.freeze(childArray); } } props.children = childArray; } // Resolve default props if (type && type.defaultProps) { var defaultProps = type.defaultProps; for (propName in defaultProps) { if (props[propName] === undefined) { props[propName] = defaultProps[propName]; } } } { if (key || ref) { if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; if (key) { defineKeyPropWarningGetter(props, displayName); } if (ref) { defineRefPropWarningGetter(props, displayName); } } } } return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createElement(type,config,children){var propName;// Reserved names are extracted\nvar props={};var key=null;var ref=null;var self=null;var source=null;if(config!=null){if(hasValidRef(config)){ref=config.ref;{warnIfStringRefCannotBeAutoConverted(config);}}if(hasValidKey(config)){key=''+config.key;}self=con...
[ "0.6893627", "0.68369675", "0.67687505", "0.67585975", "0.67468476", "0.67468476", "0.67468476", "0.67468476", "0.67468476", "0.67468476", "0.67468476", "0.67468476", "0.67468476", "0.6566136", "0.6558518", "0.64085925", "0.64085925", "0.64085925", "0.64085925", "0.64085925", ...
0.6346304
64
Return a function that produces ReactElements of a given type. See
function cloneAndReplaceKey(oldElement, newKey) { var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); return newElement; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getElementConstructor(type) {\n return JSXElement;\n }", "wrap(type = this.type, props) {\n if (props) {\n if (typeof props === \"string\") props = { className: props };\n else props = this.normalizeProps(props);\n }\n this.elements = [ React.createElement(type, props, ...this.elements) ];...
[ "0.688169", "0.6599771", "0.6501903", "0.6501903", "0.6501903", "0.6501903", "0.6501903", "0.6501903", "0.6501903", "0.6501903", "0.6501903", "0.62633073", "0.6178194", "0.5946246", "0.59189516", "0.58819187", "0.5864861", "0.5778515", "0.5640179", "0.563297", "0.5620519", ...
0.0
-1
Clone and return a new ReactElement using element as the starting point. See
function cloneElement(element, config, children) { !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0; var propName = void 0; // Original props are copied var props = _assign({}, element.props); // Reserved names are extracted var key = element.key; var ref = element.ref; // Self is preserved since the owner is preserved. var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a // transpiler, and the original source is probably a better indicator of the // true owner. var source = element._source; // Owner will be preserved, unless ref is overridden var owner = element._owner; if (config != null) { if (hasValidRef(config)) { // Silently steal the ref from the parent. ref = config.ref; owner = ReactCurrentOwner.current; } if (hasValidKey(config)) { key = '' + config.key; } // Remaining properties override existing props var defaultProps = void 0; if (element.type && element.type.defaultProps) { defaultProps = element.type.defaultProps; } for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { if (config[propName] === undefined && defaultProps !== undefined) { // Resolve default props props[propName] = defaultProps[propName]; } else { props[propName] = config[propName]; } } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } props.children = childArray; } return ReactElement(element.type, key, ref, self, source, owner, props); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cloneElement(element,config,children){if(!!(element===null||element===undefined)){{throw Error(\"React.cloneElement(...): The argument must be a React element, but you passed \"+element+\".\");}}var propName;// Original props are copied\nvar props=_assign({},element.props);// Reserved names are extracted\...
[ "0.6915557", "0.6893059", "0.66959214", "0.66959214", "0.66947424", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.6635265", "0.66155624", ...
0.0
-1
Flatten a children object (typically specified as `props.children`) and return an array with appropriately rekeyed children. See
function toArray(children) { var result = []; mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toArrayChildren(children) {\n var ret = [];\n React__default.Children.forEach(children, function (child) {\n ret.push(child);\n });\n return ret;\n }", "function toArray(children){var result=[];mapIntoWithKeyPrefixInternal(children,result,null,function(child){return child;}...
[ "0.775594", "0.7520282", "0.74348474", "0.7408082", "0.7408082", "0.7408082", "0.7408082", "0.7408082", "0.7408082", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74...
0.0
-1
Starts all requests that do not exceed request limits This method is invoked whenever a new request has been queued or a running request finished
function startAllAllowedRequests() { for (let i = 0; i < waiting_tasks.length; i++) { if (canStartRequest(waiting_tasks[i].hostname)) { onRequestStart(waiting_tasks[i].hostname); waiting_tasks[i].start(); // remove request from waiting requests list and update loop index waiting_tasks.splice(i, 1); i--; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_issueNewRequestsAsync() {\n this._deferredUpdate = null;\n\n const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);\n\n if (freeSlots === 0) {\n return;\n }\n\n this._updateAllRequests();\n\n // Resolve pending promises for the top-priority requests\n for (let i...
[ "0.6628981", "0.6625322", "0.658616", "0.6573614", "0.6563562", "0.65359145", "0.6399605", "0.63529646", "0.6351921", "0.6289156", "0.62717116", "0.62717116", "0.61580175", "0.6135651", "0.6084854", "0.60447055", "0.60442245", "0.6014789", "0.5995843", "0.59860396", "0.598074...
0.7608277
0
Keep track of all the current lines written in the destination file. These will need to be rewritten when JS variables are updated.
extractNonCharcoalData(resolve, reject, data){ const lines = data.split('\n'); let destinationFileLines = []; let foundCharcoalLine = false; for(let index = 0; index < lines.length; index++) { const line = lines[index]; if(foundCharcoalLine) continue; if(line === '' && (index === lines.length - 1 || index === 0)) continue; const charcoalLine = line.match(this.charcoalRegex); if(charcoalLine) { destinationFileLines.push(line); foundCharcoalLine = true; } else { destinationFileLines.push(line); } }; if(foundCharcoalLine){ this.destIsFragile = true; } this.destFileData = destinationFileLines; resolve(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_updateFile() {\n const fs = require('fs');\n\n let result = '';\n\n for (const entry of this.m_entries) {\n for (const property of Object.keys(entry).sort()) {\n if ((entry[property] + '').indexOf('\\n') !== -1) {\n misc.throwOnError(true);\n ...
[ "0.5770231", "0.56890064", "0.5356412", "0.53077924", "0.52938753", "0.51783085", "0.51662964", "0.51349777", "0.5077958", "0.5044464", "0.49814218", "0.49717966", "0.49433184", "0.49268025", "0.48703688", "0.48634258", "0.48464328", "0.48239532", "0.48045275", "0.47982603", ...
0.0
-1
Displays entered value on screen.
function screen(value) { let res = document.getElementById("result"); if (res.value == "undefined") { res.value = ""; } res.value += value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showInput() {\n document.getElementById('display').innerHTML = \n document.getElementById(\"user_data\").value;\n \n}", "function displayValue(value) {\n display.textContent = value;\n}", "function display(input){\r\n dispStr=dispStr+input;\r\n displayInScreen(dispSt...
[ "0.70568824", "0.70197594", "0.6877267", "0.6854964", "0.67869073", "0.67277056", "0.67181027", "0.6690169", "0.6666995", "0.66501933", "0.66437423", "0.6607174", "0.6589666", "0.6585043", "0.6564493", "0.65639955", "0.65558726", "0.6539327", "0.6500925", "0.649463", "0.64740...
0.6827806
4
Displays copyright in the footer.
function Copyright() { return ( <Typography variant="body2" color="textSecondary" align="center"> {'Copyright © '} <Link color="inherit" href="http://civitalaurea.com/"> Civita Laurea </Link>{' '} {new Date().getFullYear()} {'.'} </Typography> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Footer() {\n const currentYear = new Date().getFullYear();\n\n return (\n <footer>\n <p>Copyright © {currentYear}</p>\n </footer>\n );\n }", "function insertFooter () {\n \"use strict\";\n try {\n var footer;\n\t\t\t/* There are at least one, and maybe...
[ "0.74149865", "0.7355889", "0.7319642", "0.6959091", "0.68697226", "0.67985135", "0.6755619", "0.6692379", "0.6591227", "0.6574422", "0.652041", "0.65074044", "0.64674073", "0.6461332", "0.64499134", "0.64397264", "0.6436996", "0.64336884", "0.6412219", "0.63751465", "0.63751...
0.64787173
12
change the flashing page title
function flashCount(count) { if (count < 1) { clearFlash(); } var newTitle = "[ " + count + " ] " + original; timeout = setInterval(function() { document.title = (document.title == original) ? newTitle : original; }, 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeTitle() {\n document.title = 'Star Wars';\n }", "function setPageTitle (newTitle) {\n title = newTitle;\n }", "function shortenPageTitle() {\n document.getElementById('main-title').innerHTML = \"Fast & Furious\";\n }", "function updatePageTitle (string) {\n document.title = string...
[ "0.78957", "0.7689076", "0.7599403", "0.75987047", "0.75961", "0.7569214", "0.7541583", "0.75138783", "0.74872434", "0.74475104", "0.74239624", "0.7418987", "0.739139", "0.739139", "0.7379649", "0.7367359", "0.7354041", "0.7346799", "0.7338706", "0.7328233", "0.73277617", "...
0.68549216
62
clear the flashing page title
function clearFlash() { if (timeout) { clearTimeout(timeout); timeout = undefined; } document.title = original; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearTitle() {\n $('title').html(\"Blacksmith\");\n}", "function titleClear(){\n document.querySelector(\".title\").style.display = \"none\";\n document.querySelector(\".line\").style.display = \"none\";\n document.querySelector(\".intro\").style.display = \"none\";\n docume...
[ "0.79916203", "0.76807255", "0.7311639", "0.6959074", "0.6955087", "0.6925484", "0.68691003", "0.68407184", "0.68332314", "0.6786957", "0.6736297", "0.6689621", "0.6628867", "0.6573916", "0.65599525", "0.6555257", "0.65461123", "0.6541896", "0.65411365", "0.64804876", "0.6468...
0.8067197
0
change the badget ico in IVLE
function changeCount(count) { Tinycon.setBubble(count); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function il(a,b,c,d){this.Y=null;this.Ya=Number(c);this.xa=Number(b);this.Vd={height:this.Ya+10,width:this.xa};this.eb=d||\"\";this.Ob(a)}", "influence () {\n return parseInt(this.I, 16);\n }", "function prepOli(img) {\n var orig = img;\n img = renameOli(img);\n img = fmask(img);\n img = calcNbr(...
[ "0.5471111", "0.54525274", "0.53871924", "0.5323614", "0.5244285", "0.52346927", "0.52339107", "0.52299815", "0.5226354", "0.5210173", "0.51994616", "0.5172732", "0.5157133", "0.515656", "0.51405287", "0.5108636", "0.51050586", "0.5091474", "0.5067333", "0.50654525", "0.50606...
0.0
-1
let result = inArray; let final = arrForInArr.filter(result([3, 5, 8])) console.log(myFilterArra(arrForInArr,[3, 5, 8],inArray));
function byField(fieldName){ return (a, b) => a[fieldName] > b[fieldName] ? 1 : -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myFilter(arr, f){\n let ans = [] ;\n\n for(let i = 0; i < arr.length; i++){\n if(f(arr[i]) == true){\n ans.push(arr[i]) ;\n }\n }\n return ans ;\n}", "function filter (array,fn) {\n return array.filter(fn)\n}", "function filter(arr,fn) {\n const newArray = [];\n...
[ "0.7183751", "0.7170588", "0.7119997", "0.7082903", "0.6985113", "0.6933697", "0.69010913", "0.6897618", "0.68760496", "0.68737334", "0.6869783", "0.6863028", "0.6857912", "0.6829964", "0.6807575", "0.6746761", "0.67336583", "0.67217547", "0.6719153", "0.6706601", "0.66720474...
0.0
-1
this function is called final part of prepareToRender
set customFunctionWhenPrepareToRender(func) { this._customFunctionWhenPrepareToRender = func; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render() {\n\t\t\t}", "function render() {\n\n\t\t\t}", "afterRender() { }", "afterRender() { }", "postRender()\n {\n super.postRender();\n }", "_firstRendered() { }", "onBeforeRendering() {}", "static rendered () {}", "static rendered () {}", "_render() {}", "handleRender...
[ "0.7278723", "0.7275558", "0.7259879", "0.7259879", "0.7181207", "0.7065279", "0.6924316", "0.6882285", "0.6882285", "0.68550706", "0.6839958", "0.6831122", "0.68241054", "0.6789302", "0.6765992", "0.67061645", "0.6647756", "0.659764", "0.6563315", "0.6540208", "0.6515079", ...
0.0
-1
end of render() method Valida el password ingresado
validarPassword() { if (!this.validador.validarPassword(this.state.password)) { // TO DO: mecanismo para informar qué Alert.alert('Error', `La contraseña debe tener al menos ${this.validador.passwordMinLength} caracteres.`); return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate_password()\n {\n const icon = DOM.new_password_validation_icon;\n const password = DOM.new_password_input.value;\n\n icon.style.visibility = \"visible\";\n\n if (security.is_valid_password(password))\n {\n icon.src = \"/icons/main/correct_white...
[ "0.77586097", "0.7665253", "0.760622", "0.75909793", "0.7450125", "0.74456334", "0.743816", "0.7358825", "0.7334179", "0.7306905", "0.724486", "0.72398955", "0.7237887", "0.72303236", "0.7223803", "0.71935797", "0.71863574", "0.7179179", "0.7166479", "0.71643424", "0.7163287"...
0.74559754
4
This page contains the info about the web application functionality for potential users, and is just JSX.
function About() { return ( <div id="about-section"> <h1 id="page-title">About Us</h1> <h2>Welcome to New U!</h2> <p> New U is an all-in-one workout planner and knowledge hub. Here you will be able to create and store workout programs so you can better track your progress and actually see results! </p> <div className="image-text-container"> <img src="./build-workout.png" alt="" /> <div className="image-text"> <p> This site was created with our users in mind! Most companies will build their "backend" and everything the company needs first, and then think about the user. We are different. </p> <p> New U was first created to be user-friendly and intuitive, with no complicated features or gimmiks. And with full-control over your own program, how can you not see the best results money can buy! </p> <h3>Start Free, Pay Later!</h3> <p> With New U, we understand that gettign started is often the hardest part of you journey. This is why we give you 2 months to use our platform, absolutely free! We care about you, so you will get 100% unlimited access until you get into the habit of working on your goals. </p> </div> </div> <div className="image-text-container"> <img src="./articles.png" alt="" /> <div className="image-text"> <h3>Never be Lost Again</h3> <p> Part of the journey is knowing how to get there. And with so much information on the internet, just how can you sort through it all in your free time and find what truly works?? Well, fret no more. We have gathered the best articles across the globe and provided links to them in our articles section, which is curated by a panel of highly acknowledged fitness professionals. </p> <p> Find exactly what you need, when you need it. Don't worry about losing your articles, either. With our favorites feature, you can save an article for later, either because you just liked it so much, or because there is a lot of info in the article, and you want to reference it later when you have more time. </p> <p> So what are you waiting for? Sign up and start on your goals for free, today! </p> </div> </div> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderAbout() {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<p>This simple web-app developed for test purpose. It allows to fetch some user data from <b>GitHub</b> account: all profile info and repository list</p>\n\t\t\t\t<p>Used technologies: \n\t\t\t\t\t<b>React.js</b>, \n\t\t\t\t\t<b>Bable.js</b>, \n\t\t\t\t\t<b>Webp...
[ "0.6642912", "0.6210656", "0.6187553", "0.6055153", "0.597719", "0.5889682", "0.5876891", "0.5845281", "0.5842558", "0.5839484", "0.5830929", "0.58142823", "0.5812627", "0.5801304", "0.5799924", "0.5797609", "0.57963717", "0.57712054", "0.57552576", "0.5750901", "0.5750488", ...
0.0
-1
cette fonction appelle les fonctions d'affichage initiale.
function updateTeddyInfo(teddy) { //On injecte les données du teddy API dans le currentTeddy. currentTeddy.id = teddy._id currentTeddy.name = teddy.name currentTeddy.image = teddy.imageUrl currentTeddy.description = teddy.description currentTeddy.price = teddy.price/100 currentTeddy.quantity = 1 displayImageTeddy(currentTeddy) displayDescriptionTeddy(currentTeddy.description) displayPriceTeddy(currentTeddy) displayColorsTeddy(teddy) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function couleur()\n {\n\treturn 25000 * (0|pos_actuelle()/5 + 1);\n }", "function prepararejerciciorandom() {\n brillo = 0;\n contraste = 0;\n saturacion = 0;\n exposicion = 0;\n ruido = 0;\n difuminacion = 0; \n var elegido = [];\n var valores = [-40,-30,-20,-10,10,20,30,40];\n ...
[ "0.5973901", "0.57983285", "0.5752512", "0.5707807", "0.56457245", "0.5631513", "0.56013596", "0.55607766", "0.55607766", "0.5559428", "0.5530206", "0.55271214", "0.55217355", "0.54889685", "0.547876", "0.54715264", "0.5465591", "0.5457149", "0.5447218", "0.5408577", "0.53679...
0.0
-1
FUNCTIONS// /////////// Afficher l'image du teddy.
function displayImageTeddy(teddy) { let img = document.querySelector('#teddyImg') img.setAttribute("src", `${teddy.image}`) img.setAttribute("data-id", `${teddy._id}`) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function modifiedImgBack(image){\n image.src = image.id + '.jpg';\n }", "function changeImageLeavesBack() {\n document.images['white-duck-leaves'].src ='./assets/images/white-duck-leaves.png'\n }", "function changeImageMonocleBack() {\n document.images['white-duck-monocle'].src ='./assets/images/whit...
[ "0.71838117", "0.6633162", "0.660354", "0.6599721", "0.6592838", "0.6565422", "0.6547703", "0.65361184", "0.6443637", "0.6437124", "0.64339244", "0.641671", "0.64162356", "0.63826543", "0.6374062", "0.6373162", "0.63620394", "0.63503903", "0.6348611", "0.63473195", "0.6339134...
0.75115514
0
Afficher la description du teddy.
function displayDescriptionTeddy(teddyDescription) { let desc = document.querySelector('#description') desc.innerHTML = teddyDescription }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get descripion() {\n return this._descripion\n }", "afficherDescription() {\n return (\n this.nom\n + ' est '\n + this.couleur\n + ' pèse '\n + this.poids\n + ' grammes et mesure '\n + this.taille\n + ' centimètres.'\n );\n }", "get...
[ "0.75699145", "0.7545369", "0.71114933", "0.70800334", "0.70800334", "0.70800334", "0.7061728", "0.7061728", "0.7061728", "0.7061728", "0.7061728", "0.70443815", "0.70271736", "0.69997895", "0.69997895", "0.69997895", "0.69997895", "0.69997895", "0.69997895", "0.69997895", "0...
0.7081578
3
Afficher le prix du teddy
function displayPriceTeddy(teddy) { let priceTeddy = document.querySelector('#card-price') let teddyPriceCents = teddy.price priceTeddy.innerHTML = "Prix : " + teddyPriceCents + " €" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculerPrixTotal(nounours) {\n prixPanier = prixPanier += nounours.price;\n}", "function prixProduitTotal(prix, nombre) {\n let ppt = prix * nombre;\n return ppt;\n}", "function prix() {\n return 50 * (nbMultiplicateur * nbMultiplicateur * 0.2);\n}", "get saldo() {\n\t\treturn this.ingreso - ...
[ "0.6807657", "0.6679105", "0.65266716", "0.63043493", "0.62294185", "0.62265444", "0.6018096", "0.58842534", "0.5879686", "0.5874738", "0.5823457", "0.5816363", "0.58042836", "0.57912374", "0.5786268", "0.5753411", "0.57290435", "0.5721998", "0.571984", "0.5710777", "0.568132...
0.6158829
6
Ajouter le produit dans le localStorage, pour l'utiliser dans le panier.
function addToShoppingBasket() { //Si l'item "teddies_basket" n'existe pas et que l'user a sélectionné une couleur. On créé un nouveau tableau "teddies_basket", on y ajoute le currentTeddy modifié par l'user, on stringify le tableau pour l'envoyer au localStorage if (localStorage.getItem('teddies_basket') == null && selectOption.selected === false) { let teddies_basket = [] teddies_basket.push(currentTeddy) let teddies_basketString = JSON.stringify(teddies_basket) localStorage.setItem('teddies_basket', `${teddies_basketString}`) //Sinon si "teddies_basket" existe et que l'user a sélectionné une couleur. On attrape l'item du localStorage, on le parse pour obtenir le tableau "teddies_basket". } else if (localStorage.getItem('teddies_basket') != null && selectOption.selected === false) { let getTeddyArray = localStorage.getItem('teddies_basket') let parseArray = JSON.parse(getTeddyArray) let teddyIndex = null let teddyFound = null //On parcours le tableau pour chaque élément à l'intérieur de celui-ci. On attrape les données ID et Color. // eslint-disable-next-line no-unused-vars parseArray.forEach((elementTeddy, index, array) => { let teddyID = elementTeddy.id let teddyColor = elementTeddy.color //Si l'ID et la couleur du teddy user correspond au teddy dans le tableau alors on assigne les valeurs suivantes. if (teddyID === currentTeddy.id && teddyColor === currentTeddy.color) { teddyFound = elementTeddy teddyIndex = index } }) //Si un teddy dans le panier correspond avec un nouvel objet currentTeddy. On créé une variable pour la nouvelle quantité. On supprime du tableau l'ancien teddy qui sera remplacé par le nouveau avec la mise à jour de sa quantité avec la fonction splice(). //On converti le tableau en string puis on l'envoi dans le localStorage. if (teddyFound != null) { let newTeddyQuantity = currentTeddy.quantity + teddyFound.quantity teddyFound.quantity = newTeddyQuantity parseArray.splice(teddyIndex, 1, teddyFound) let teddyString = JSON.stringify(parseArray) localStorage.setItem('teddies_basket', `${teddyString}`) //Sinon on ajoute le currentTeddy au tableau, on converti le tableau puis on l'envoi dans le localStorage. } else { parseArray.push(currentTeddy) let teddyString = JSON.stringify(parseArray) localStorage.setItem('teddies_basket', `${teddyString}`) } } else { console.log("ERROR") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajoutPanier() {\n //verifie si le client à choisi une lentille\n if (!productLense) {\n alert(\"Vous devez choisir une lentille\");\n return;\n }\n\n //créer l'objet\n let panierObj = ({\n id: Request.response[\"_id\"],\n lense: productLense,\n quantity: p...
[ "0.7971278", "0.7626354", "0.7330149", "0.7255275", "0.71616066", "0.7054878", "0.6964389", "0.6949826", "0.6872633", "0.68674177", "0.6850646", "0.68341774", "0.6806295", "0.679144", "0.6769827", "0.67338735", "0.6719077", "0.6713203", "0.6705794", "0.66593254", "0.6624388",...
0.0
-1
alertMsg.setAttribute('class', 'dnone') Cette fonction permet d'afficher
function msgAddShopBasket() { //Si la balise option avec l'attribut "selected" est sélectionnée quand l'user commande son article. if (selectOption.selected === true) { //Changer la couleur de l'input si l'user ne choisit pas la couleur du produit + alerte indiquant à l'user qu'il doit choisir une couleur. alertMsg.classList.add('alert-danger') let removeColor = document.querySelector('#selectColor') removeColor.classList.remove('border-primary') removeColor.classList.add('border-danger') alertMsg.classList.remove('d-none') alertMsg.innerHTML = "Veuillez sélectionner une couleur" //Sinon l'input prend la couleur de validation et un message de confirmation est envoyé à l'user. } else { let removeColor = document.querySelector('#selectColor') removeColor.classList.add('border-success') removeColor.classList.remove('border-danger') alertMsg.classList.remove('d-none') alertMsg.classList.remove('alert-danger') alertMsg.classList.add('alert-success') alertMsg.innerHTML = "Un nouvel article a été rajouté à votre panier !" } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearAlert(){\n noChecksAlert.className = \"d-none\";\n}", "hide(){\n this.alert.classList.add('d-none');\n }", "show(message){\n this.alert.classList.remove('d-none');\n this.alert.innerText = message;\n }", "function Ocultar() {\n setTimeout(functio...
[ "0.70515716", "0.6893001", "0.66359484", "0.65187323", "0.64427465", "0.6426611", "0.6416795", "0.6353687", "0.62926406", "0.62647444", "0.6204296", "0.6187571", "0.6167117", "0.6142436", "0.6137017", "0.61297446", "0.6129349", "0.60927075", "0.60915196", "0.6077629", "0.6072...
0.0
-1
This is a function. Familiar. Will log out 'boo' nothing complicated.
function boo() { console.log('boo'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logFunnyJoke() {\r\n console.log(\"This is a good Joke\");\r\n}", "function foo() {\n console.log('aloha');\n }", "function logFunnyJoke() {\n console.log(\"Funny Joke :))\");\n}", "function log(foo){\n\tconsole.log(foo);\n}", "function logGreeting(fn) {\n fn();\n}", "function lo...
[ "0.69598633", "0.6782853", "0.6772384", "0.6768125", "0.6714548", "0.66742605", "0.6652557", "0.66385233", "0.66370684", "0.6565696", "0.6554457", "0.6547843", "0.6500409", "0.6496441", "0.6422036", "0.64151895", "0.64147294", "0.6395267", "0.63835806", "0.6383021", "0.636198...
0.6729955
4
displaysResults to the console
function displayResults(responseJson) { console.log(responseJson); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showResults() {\n\t\t\t\tconsole.clear();\n\t\t\t\tconsole.log(data);\n\t\t\t}", "function displayResults(results) {\n if (results) {\n if (prg.json && prg.inspect) {\n console.log(inspect(JSON.parse(results), false, 2, true));\n } else {\n console.log(results);\n ...
[ "0.7987944", "0.778714", "0.7753115", "0.7427977", "0.73537725", "0.7344451", "0.7282258", "0.72646147", "0.7194152", "0.71853757", "0.7163434", "0.7123612", "0.71155596", "0.70384777", "0.6912223", "0.6873063", "0.6861153", "0.683602", "0.67674494", "0.6766285", "0.67539173"...
0.68701303
16
route that grabs user's information from the server
getUserInfo() { axios({ method: 'get', url: 'tokbox/lobby', }).then(res => { this.setState({ firstName: res.data.firstName, lastName: res.data.lastName, teamName: `${res.data.firstName}'s Team`, gamesPlayed: res.data.gamesPlayed, totalWins: res.data.totalWins, lowestScore: res.data.lowestScore }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function user(){\r\n uProfile(req, res);\r\n }", "function user(request, response) {\n //if url == \"/....\"\n var username = request.url.replace(\"/\", \"\");\n if(username.length > 0) {\n response.writeHead(200, {'Content-Type': 'text/plain'}); // response.writeHead(statusCode[, statusMessage...
[ "0.7194777", "0.71463037", "0.71457", "0.70512134", "0.69527835", "0.694975", "0.6869201", "0.6798297", "0.6786865", "0.67837846", "0.67593217", "0.6742606", "0.6736843", "0.6705752", "0.6618769", "0.6592089", "0.65686715", "0.6544276", "0.6519293", "0.64784616", "0.6426449",...
0.0
-1
attached to the start button, sends info the server to create the lobby, then receives the key used for people to join with.
handleSubmit(event) { const { lobbies, gameType, maxPlayers, room } = this.state; document.getElementById('startButton').disabled = true; event.preventDefault(); this.setState({ lobbies: [...lobbies, { 'gameType': gameType, 'maxPlayers': maxPlayers, 'room': room }], }); axios({ method: 'post', url: `/tokbox/room`, data: { gameType, maxPlayers } }).then(res => { this.setState({ roomKeyFromServer: res.data.roomKey }); const dataFromServer = JSON.stringify(res.data); sessionStorage.setItem('gameSession', dataFromServer); sessionStorage.setItem('roomKey', res.data.roomKey); this.setDisplayModal(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function start_lobby_click_listener($event) {\n\n chrome.runtime.sendMessage({ type: 'start_lobby' }, function (response) {\n\n if (response && response.type) {\n if (response.type === 'start_lobby_ack' && response.success) {\n // Update the view\n update_state(PO...
[ "0.67093563", "0.6524995", "0.6462301", "0.6255683", "0.6227275", "0.6206439", "0.6134939", "0.60731995", "0.6071729", "0.59143573", "0.5867134", "0.5852219", "0.5847822", "0.58292377", "0.58090705", "0.57941204", "0.5782071", "0.57748497", "0.5774304", "0.5741155", "0.574053...
0.0
-1
checks the roomKey that was entered against any in the database, then joins if there is a match.
handleJoinSubmit(event) { document.getElementById('joinButton').disabled = true; const { roomKey } = this.state; event.preventDefault(); axios({ method: 'post', url: `/tokbox/join`, data: { roomKey } }).then(res => { const dataFromServer = JSON.stringify(res.data); sessionStorage.setItem('gameSession', dataFromServer); sessionStorage.setItem('roomKey', res.data.roomKey); if (res.data.hasOwnProperty('pathname')) { const { origin } = location; location.href = `${origin}${res.data.pathname}`; } if (res.data.hasOwnProperty('messages')) { this.setState({ messages: res.data.messages }); document.getElementById('joinButton').disabled = false; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleJoin() {\r\n\tlet username = document.getElementById(\"username\").value.trim();\r\n\tlet roomCode = document.getElementById(\"room\").value.trim();\r\n\t\r\n\t/* If username and roomCode are unique and valid, then send\r\n\totherwise, give alert */\r\n\tconsole.log(Object.keys(roomState));\r\n\tcon...
[ "0.59071743", "0.5896275", "0.5782543", "0.55590796", "0.5541714", "0.549114", "0.548365", "0.541844", "0.54121923", "0.54058146", "0.53827566", "0.5348435", "0.5311451", "0.5307633", "0.52914846", "0.52890784", "0.5260069", "0.525477", "0.52518773", "0.5243138", "0.5239067",...
0.0
-1
Updates React state for form inputs and form selection on every key change.
handleChange(event) { const { name, value } = event.target; this.setState({ [name]: value }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_handleInputChange(key, newValue) {\n this.setState({\n [key]: newValue\n });\n }", "setInput(event, key) {\n this.setState({\n [key]: event.target.value\n })\n }", "handleInputChange(key, value) {\n this.setState({ [key]: value });\n }", "onChangeHandler(evt, key) {...
[ "0.72033924", "0.711367", "0.70271236", "0.6890326", "0.6872219", "0.6866646", "0.6862103", "0.6843475", "0.67587394", "0.67333305", "0.67212856", "0.67141265", "0.6685463", "0.6677062", "0.6628439", "0.6600364", "0.65959126", "0.659498", "0.65865105", "0.6564752", "0.6558083...
0.0
-1
initializa database if not already there
async function init() { try { await db.initPool(); const result = await db.get('sqlite_master', { type: 'table', name: 'effort' }); if (result.length === 0) { log.debug('New system, initialising schema'); dbInit.init(); } } catch (err) { log.fatal(err); process.exit(1); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n db = window.openDatabase(DB_NAME, \"\", DB_TITLE, DB_BYTES);\n createTables();\n }", "async init() {\n if (!await this.exists()) {\n // Create the database and the tables\n await this.create();\n await this.createTables();\n } else {\n await this.updateTables(...
[ "0.78450817", "0.7554678", "0.75233257", "0.75221646", "0.7464243", "0.7331118", "0.7285826", "0.7265469", "0.72620314", "0.72260076", "0.7220602", "0.7218683", "0.71674615", "0.7147075", "0.71426725", "0.71379924", "0.7110893", "0.70918804", "0.7083366", "0.7068792", "0.7058...
0.72013354
12
parse the current path
parsePath (url) { let currentPath = url || '/' let paths = currentPath.split('/').filter(item => { return (item != '') }) let nextPathState = [pathNames.dashboard] paths.forEach(p => { console.log(` -> path: `, p) if (!(p === 'dashboard') && (Object.keys(pathNames).includes(p))) { nextPathState.push(pathNames[p]) } }) this.setState({paths: nextPathState}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parsePath() {\n\t\tvar reversePath = reverseString($location.path()),\n\t\t\tremoveFromFirstSlash = deleteFrom(reversePath, reversePath.indexOf('/')),\n\t\t\trestoredPath = reverseString(removeFromFirstSlash);\n\t\t\n\t\treturn restoredPath;\n\t}", "function extractCurrentPath(path){\r\n\tvar result = \...
[ "0.68003976", "0.6535013", "0.6451523", "0.6004998", "0.59130275", "0.58941865", "0.58845973", "0.58791375", "0.5851786", "0.5750613", "0.57372856", "0.5664637", "0.56320786", "0.5627999", "0.56000936", "0.559557", "0.5587674", "0.556962", "0.5557939", "0.5553969", "0.5404697...
0.5381613
23
Returns the specific filter categories which were selected by the user on the checkboxes
function findIfFilters(filter_type) { let choices = []; const checkboxes = document.getElementById(`${filter_type}-filter`).getElementsByTagName('input'); for (let i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked === true) { choices.push(checkboxes[i].parentElement.textContent.slice(2)); } } return choices; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSelectedCateFilterItems() {\n let i = 0;\n let selected = [];\n $('#catFilter input:checked').each(function () {\n selected[i++] = $(this).val();\n });\n return selected;\n }", "filterByCategory(category) {\n\t\tconsole.log(this.selectedCategories);\n\t}", "function getSelected...
[ "0.76508474", "0.72420746", "0.7092698", "0.70620507", "0.698249", "0.6687905", "0.6657451", "0.66384304", "0.6612879", "0.6597912", "0.6577332", "0.6496379", "0.6468213", "0.63815016", "0.638109", "0.63311845", "0.63201123", "0.6318747", "0.62960666", "0.6282335", "0.618099"...
0.62709415
20
Hides the weather filter container and displays all of the recipes in a grid format
function display_selected_recipes() { document.querySelector('#weather-filter-container').style.display = 'none'; document.querySelector('#select-filters').style.display = 'block'; document.querySelector('#recipes-title').style.display = 'block'; document.querySelector('#grid-container').style.display = 'grid'; window.recipes.forEach(recipe => { if (recipe['weather']) { recipe.style.display = 'block'; } else { recipe.style.display = 'none'; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayIngrList() { /*to show the all ingredient list*/\n loadFilteredIngr();\n document.getElementById(\"suggIngr\").style.display = \"flex\"; /*flex to allow suggIngr to appear in column*/\n document.querySelector(\"#ingrFilter .fa-chevron-up\").style.display = \"block\";\n document.querySel...
[ "0.6289912", "0.62474346", "0.61873883", "0.61683863", "0.60603213", "0.60547364", "0.6029845", "0.6022186", "0.59941155", "0.5990943", "0.5966412", "0.5952374", "0.5940943", "0.58968645", "0.5891171", "0.5885731", "0.58802897", "0.5872718", "0.58692014", "0.5861815", "0.5840...
0.75827295
0
Displays all recipes for all kinds of weather if the user presses the 'View All' button
function display_all(recipes) { recipes.forEach(recipe => { recipe['weather'] = true; }); display_selected_recipes(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function display_selected_recipes() {\n document.querySelector('#weather-filter-container').style.display = 'none';\n document.querySelector('#select-filters').style.display = 'block';\n document.querySelector('#recipes-title').style.display = 'block';\n document.querySelector('#grid-container').style....
[ "0.7695121", "0.67280036", "0.6695334", "0.6673275", "0.65193284", "0.64262086", "0.63547933", "0.6335299", "0.6321468", "0.6240727", "0.61586416", "0.6144569", "0.613548", "0.6102514", "0.6085036", "0.60047305", "0.5994358", "0.5990088", "0.59569544", "0.5951428", "0.5897981...
0.7840708
0
Selects the correct recipes for that kind of weather
function select_by_weather(recipes) { recipes.forEach(recipe => { recipe['weather'] = false; }); let selectedChoices = findIfFilters("weather"); if (selectedChoices.length === 0) { document.querySelector('#no-filter-chosen').style.display = 'block'; } else { filter("weather", selectedChoices); display_selected_recipes(); history.pushState({ recipes: 'loaded', weather_types: selectedChoices }, ``, '/recipes'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function display_selected_recipes() {\n document.querySelector('#weather-filter-container').style.display = 'none';\n document.querySelector('#select-filters').style.display = 'block';\n document.querySelector('#recipes-title').style.display = 'block';\n document.querySelector('#grid-container').style....
[ "0.6771611", "0.6606252", "0.6393852", "0.63582134", "0.6188069", "0.5998609", "0.59640473", "0.5918877", "0.5855814", "0.58337325", "0.57372856", "0.57350427", "0.57020134", "0.5688214", "0.56846714", "0.56714064", "0.5651607", "0.56362104", "0.56162107", "0.55725336", "0.55...
0.77564096
0
Updates all the filter properties of all the recipe objects in window.recipes depending on the filters chosen by the user, so that the recipes can be selected based on these and either hidden or displayed
function filter(filter_type, choices) { window.recipes.forEach(recipe => { if (choices.length === 0) { recipe[`${filter_type}`] = true; } if (filter_type === 'weather') { let recipeProperties = recipe.getElementsByTagName('ul')[0].children; for (let i = 0; i < recipeProperties.length; i++) { if (choices.length === 0) { recipe[`${filter_type}`] = true; } else { for (let j = 0; j < choices.length; j++) { if (recipeProperties[i].innerHTML === choices[j]) { recipe[`${filter_type}`] = true; } } } } } else { for (let i = 0; i < choices.length; i++) { var typeTag = recipe.getElementsByClassName(`${choices[i]}`); if (typeTag.length === 1) { recipe[`${filter_type}`] = true; } if (filter_type === 'diet') { if (choices[i] === 'Everything') { recipe[`${filter_type}`] = true; } } } } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function display_all(recipes) {\n recipes.forEach(recipe => {\n recipe['weather'] = true;\n });\n display_selected_recipes();\n}", "function display_selected_recipes() {\n document.querySelector('#weather-filter-container').style.display = 'none';\n document.querySelector('#select-filters')...
[ "0.6702223", "0.67011803", "0.65662676", "0.6565148", "0.637609", "0.6240561", "0.6228511", "0.6197171", "0.61527103", "0.6106958", "0.6099209", "0.6076114", "0.6076114", "0.6076114", "0.6076114", "0.6076114", "0.6076114", "0.6076114", "0.6076114", "0.6076114", "0.60743695", ...
0.6978485
0
Changes display of recipes results depending on how many recipes are to be shown
function display_settings(counter) { // Displays a message saying there are no matches if there are no selected recipes for those chosen filters if (counter === 0) { document.querySelector('#no-matches').style.display = 'block'; } // If there is only one recipe to be displayed, sets the width to being wider than normal, so it looks good on the screen if (counter === 1) { window.recipes.forEach(recipe => { if (recipe.style.display !== 'none') { recipe.style.width = '60vw'; } else { recipe.style.width = 'auto'; } }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function showRecipes(recipes) {\n\n for (let rec of recipes) {\n await generateRecipeHTML(rec);\n }\n currentMealList = recipes;\n }", "function showResults() {\n let bigString = \"\";\n\n for (let i = page; i < page + 10; i++) {\n let result = results[i];\n\n let smallUR...
[ "0.69451636", "0.68298835", "0.67835325", "0.6755989", "0.67546386", "0.6746854", "0.6688006", "0.66744494", "0.66073257", "0.6595526", "0.6547616", "0.6538706", "0.645038", "0.6387835", "0.6350526", "0.63436663", "0.6338856", "0.63351727", "0.63134176", "0.62954134", "0.6276...
0.66434205
8
only accepts characters, underscore and numbers yet.
function checkSignupUsername(username) { var pattern = /^\w+$/; if (!username.match(pattern)) { $("#signup-error").html('<span style="font-weight: bold">Username is not valid</span><br>It should only contains underline and characters'); return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is_alphaDashUnderscore(str)\n{\n \n regexp = /[a-zA-Z_\\-]/;\n\n if (regexp.test(str))\n {\n alert(\"Correct Pattern\");\n }\n else\n {\n alert(\"Incorrect Pattern\");\n }\n}", "function check_string(input) {\r\n var re = new RegExp('[^a-zA-Z0-9-_]+');\r\n if ...
[ "0.7363362", "0.6985202", "0.6966864", "0.6946876", "0.68596256", "0.6846935", "0.68157315", "0.67987156", "0.6755555", "0.673196", "0.66813016", "0.66783214", "0.66766286", "0.667411", "0.665587", "0.66484576", "0.6640965", "0.66202766", "0.66202766", "0.66202766", "0.662027...
0.0
-1
Promises with ASYNC and AWAIT key word
async function rainbow(){ await delayColorChange('red', 1000) await delayColorChange('orange', 1000) await delayColorChange('yellow', 1000) await delayColorChange('green', 1000) await delayColorChange('blue', 1000) await delayColorChange('indigo', 1000) await delayColorChange('violet', 1000) return "ALL DONE!!!"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getAsync() {\n return new Promise(function (resolve, reject) {\n setTimeout(() => resolve('Request Completed'), 1000)\n // setTimeout(() => reject(new Error('Time Out not able to process')))\n })\n}", "async function wait() {\n return new Promise((resolve, reject) => {\n setTimeo...
[ "0.6553737", "0.6383381", "0.638172", "0.6263895", "0.62584543", "0.62299913", "0.62268287", "0.62250835", "0.6224844", "0.61918145", "0.6190504", "0.6133515", "0.6083388", "0.6041018", "0.602841", "0.60243505", "0.60241455", "0.6023793", "0.6015646", "0.60151815", "0.5991325...
0.0
-1
document.getElementById("name").value = ""; document.getElementById("email").value = ""; document.getElementById("text").value = ""; }
function signup(){ console.log("hello") let name=document.getElementById('firstname').value let email=document.getElementById("email").value let password=document.getElementById("password").value console.log(email,password) firebase.auth().createUserWithEmailAndPassword(email, password) .then(function(user) { Swal.fire('Registration Successful') setTimeout(function() { window.location.href = "../login/index.html" }, 5000) }) .catch(function(error) { Swal.fire({ icon: 'error', title: 'Abe teri...', text: error.message }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clear() {\r\n\tdocument.getElementById(\"fName\").value = \"\";\r\n\tdocument.getElementById(\"lName\").value = \"\";\r\n\tdocument.getElementById(\"email\").value = \"\";\r\n\tdocument.getElementById(\"pNo\").value = \"\";\r\n}", "clearField() {\n document.querySelector('#name').value = '';\n ...
[ "0.8624978", "0.8609421", "0.8574828", "0.8385752", "0.8380449", "0.8374699", "0.8349204", "0.83260137", "0.8325959", "0.8288185", "0.826313", "0.8252528", "0.82156146", "0.82105815", "0.8157145", "0.81267375", "0.8124559", "0.8055372", "0.8040568", "0.8038331", "0.8024494", ...
0.0
-1
! Ender: open module JavaScript framework (clientlib) License MIT
function e(e,n){var r;if(this.length=0,"string"==typeof e&&(e=t._select(this.selector=e,n)),null==e)return this;if("function"==typeof e)t._closure(e,n);else if("object"!=typeof e||e.nodeType||(r=e.length)!==+r||e==e.window)this[this.length++]=e;else for(this.length=r=r>0?~~r:0;r--;)this[r]=e[r]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "GetAppCode(Site, User=\"null\", UserId=\"null\", Admin=false){\n let MyApp = new Object()\n MyApp.JS = \"\"\n MyApp.CSS = \"\"\n\n let fs = require('fs')\n let os = require('os')\n\n // Ajout des modules de CoreX\n MyApp.JS += fs.readFileSync(__dirname + \"/Client_C...
[ "0.5637077", "0.5629852", "0.5554947", "0.5504847", "0.5489356", "0.5489356", "0.5489356", "0.5489356", "0.5489356", "0.5489356", "0.54746765", "0.54699135", "0.54481375", "0.54475206", "0.54434663", "0.5411888", "0.5411888", "0.5407574", "0.540615", "0.5405467", "0.5398997",...
0.0
-1
0. Scale the joint position data to fit the screen 1. Move it to the center of the screen 2. Flip the xvalue to mirror 3. Return it as an object literal
function scaleJoint(joint) { return { x: (-joint.cameraX * SCL) + width / 2, y: (joint.cameraY * SCL) + height / 2, z: (joint.cameraZ * SCL), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scaleJoint(joint) {\n return {\n x: (joint.cameraX * width / 2) + width / 2,\n y: (-joint.cameraY * width / 2) + height / 2,\n z: joint.cameraZ * 100\n }\n}", "function scaleJoint(joint) {\n return {\n x: (joint.cameraX * width / 2) + width / 2,\n y: (-joint.cameraY * width / 2) + heig...
[ "0.64083064", "0.63995034", "0.6389567", "0.60185826", "0.60147846", "0.5989663", "0.5948652", "0.5942682", "0.5913443", "0.58959705", "0.58735716", "0.5813914", "0.58093786", "0.58027977", "0.5793415", "0.575732", "0.5743842", "0.57390165", "0.57107085", "0.5709181", "0.5703...
0.6286707
4
This function searches for anaphores in the text and forms an array with them.
function getAnaphoraCount() { text = workarea.textContent; anaphora_candidates = []; first_index = 0; last_index = 0; for(i=0; i < sentences.length-1; i++) { if(sentences[i] == "`I must.") debugger; first_word = sentences[i].match(/\S+/)[0]; check_higher_case = first_word.match(/[A-ZА-ЯЁ]/); if(check_higher_case == null) { continue; } if(first_word.match("Chapter") != null || first_word.toLowerCase() == "a" || first_word.toLowerCase() == "an" || first_word.toLowerCase() == "the") { continue; } first_index = i; last_index = first_index; for(j=i+1; j<sentences.length; j++) { if(first_word == sentences[j].match(/\S+/)[0]) { last_index = j; } else { break; } } if(last_index > first_index) { tmp = []; for(first_index; first_index <= last_index; first_index++) { tmp.push(sentences[first_index]); } anaphora_candidates.push([first_word, tmp]); i = last_index; } } flag = true; if(anaphora_candidates.length !=0) { while(flag) { control_array = []; for(i=0; i<anaphora_candidates.length; i++) { first_words = new RegExp(anaphora_candidates[i][0].replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\)/g, "[)]").replace(/\(/g,"[(]") + "((\\.|\\!){3}|\\.|\\?|\\!){0,1}\\s\\S+"); if(anaphora_candidates[i][1][0].match(first_words) != null) { first_words = anaphora_candidates[i][1][0].match(first_words)[0]; tmp = []; for(j=0; j < anaphora_candidates[i][1].length; j++) { if(anaphora_candidates[i][1][j].match(first_words.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\)/g, "[)]").replace(/\(/g,"[(]")) != null) { tmp.push(true); } else { tmp.push(false); } } control_array.push(tmp); if(tmp.indexOf(false) == -1) { anaphora_candidates[i][0] = first_words; } } } for(i=0; i<control_array.length; i++) { if(control_array[i].indexOf(false) != -1) { control_array[i] = false; } else { control_array[i] = true; } } if(control_array.indexOf(false) != -1){ flag = false; } else { flag = true; } } flag = true; while(flag) { control_array = []; for(i=0; i<anaphora_candidates.length; i++) { first_words = new RegExp(anaphora_candidates[i][0].replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\)/g, "[)]").replace(/\(/g,"[(]") + "((\\.|\\!){3}|\\.|\\?|\\!){0,1}\\s\\S+"); if(anaphora_candidates[i][1][0].match(first_words) != null) { first_words = anaphora_candidates[i][1][0].match(first_words)[0]; tmp = []; for(j=0; j < anaphora_candidates[i][1].length; j++) { if(anaphora_candidates[i][1][j].match(first_words.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\)/g, "[)]").replace(/\(/g,"[(]")) != null) { tmp.push(true); } else { tmp.push(false); } } control_array.push(tmp); if(tmp.indexOf(false) == -1) { anaphora_candidates[i][0] = first_words; } } } for(i=0; i<control_array.length; i++) { if(control_array[i].indexOf(false) != -1) { control_array[i] = true; } else { control_array[i] = false; } } if(control_array.indexOf(false) == -1){ flag = false; } else { flag = true; } } } temp = []; for(i=0; i<anaphora_candidates.length; i++) { anaphora_length = anaphora_candidates[i][0].split(" ").length; count = 0; for(j=0; j<anaphora_candidates[i][1].length; j++) { if(anaphora_candidates[i][1][j].split(" ").length == anaphora_length && anaphora_length < 5) { count++; } } if (count!=anaphora_candidates[i][1].length) { temp.push(anaphora_candidates[i]) } } anaphora_candidates = temp; for(i=0; i<anaphora_candidates.length; i++) { if(anaphora_candidates[i][0][anaphora_candidates[i][0].length-1] == ".") { anaphora_candidates[i][0] = anaphora_candidates[i][0].substring(0, anaphora_candidates[i][0].length-1); } } result = anaphora_candidates; return result.length }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function anagram(arrs) {\n var result = [];\n arrs.forEach((arr) => {\n // char to remove space from array\n var char = arr.replace(/\\s/g, '');\n var word = char.split('').sort().join(''); // eopr\n\n //check whether the object has the specified property\n if (!result.hasO...
[ "0.5588051", "0.53818357", "0.5325225", "0.5282684", "0.50899565", "0.5088381", "0.5072979", "0.5035645", "0.5030829", "0.50273424", "0.5017766", "0.5016493", "0.49978402", "0.49876705", "0.49868843", "0.49556953", "0.49533612", "0.4944792", "0.4932088", "0.49320322", "0.4931...
0.6046376
0
This function searches for epiphoras in the text and forms an array with them.
function getEpiphoraCount() { text = workarea.textContent; epiphora_candidates = []; first_index = 0; last_index = 0; for(i=0; i < sentences.length-1; i++) { if(sentences[i].match(/\S+$/) == null) { last_word = sentences[i].match(/\S+\s$/)[0]; } else { last_word = sentences[i].match(/\S+$/)[0]; } if(last_word.match("said")) { continue; } first_index = i; last_index = first_index; for(j=i+1; j<sentences.length; j++) { if(last_word == sentences[j].match(last_word.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\*/g, "[*]").replace(/\?/g,"[?]").replace(/\)/g, "[)]").replace(/\(/g,"[(]"))) { last_index = j; } else { break; } } if(last_index > first_index) { tmp = []; tmp2 = []; for(first_index; first_index <= last_index; first_index++) { tmp.push(sentences[first_index]); tmp2.push(first_index); } epiphora_candidates.push([last_word, tmp, tmp2]); i = last_index; } } flag = true; if(epiphora_candidates.length != 0) { while(flag) { control_array = []; for(i=0; i<epiphora_candidates.length; i++) { last_words = new RegExp("\\S+\\s" + epiphora_candidates[i][0].replace(/\)/g, "[)]").replace(/\(/g,"[(]").replace(/\?/g,"[?]")); if(epiphora_candidates[i][1][0].match(last_words) != null) { last_words = epiphora_candidates[i][1][0].match(last_words)[0]; tmp = []; for(j=0; j < epiphora_candidates[i][1].length; j++) { if(epiphora_candidates[i][1][j].match(last_words.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\)/g, "[)]").replace(/\(/g,"[(]").replace(/\?/g,"[?]")) != null) { tmp.push(true); } else { tmp.push(false); } } control_array.push(tmp); if(tmp.indexOf(false) == -1) { epiphora_candidates[i][0] = last_words; } } } for(i=0; i<control_array.length; i++) { if(control_array[i].indexOf(false) != -1) { control_array[i] = false; } else { control_array[i] = true; } } if(control_array.indexOf(false) != -1){ flag = false; } else { flag = true; } } flag = true; while(flag) { control_array = []; for(i=0; i<epiphora_candidates.length; i++) { last_words = new RegExp("\\S+\\s" + epiphora_candidates[i][0].replace(/\)/g, "[)]").replace(/\(/g,"[(]").replace(/\?/g,"[?]")); if(epiphora_candidates[i][1][0].match(last_words) != null) { last_words = epiphora_candidates[i][1][0].match(last_words)[0]; tmp = []; for(j=0; j < epiphora_candidates[i][1].length; j++) { if(epiphora_candidates[i][1][j].match(last_words.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\)/g, "[)]").replace(/\(/g,"[(]").replace(/\?/g,"[?]")) != null) { tmp.push(true); } else { tmp.push(false); } } control_array.push(tmp); if(tmp.indexOf(false) == -1) { epiphora_candidates[i][0] = last_words; } } } for(i=0; i<control_array.length; i++) { if(control_array[i].indexOf(false) != -1) { control_array[i] = true; } else { control_array[i] = false; } } if(control_array.indexOf(false) == -1){ flag = false; } else { flag = true; } } } for(i=0; i < epiphora_candidates.length; i++) { delete epiphora_candidates[i].pop() } temp = []; for(i=0; i<epiphora_candidates.length; i++) { epiphora_length = epiphora_candidates[i][0].split(" ").length; count = 0; for(j=0; j<epiphora_candidates[i][1].length; j++) { if(epiphora_candidates[i][1][j].split(" ").length == epiphora_length && epiphora_length < 5) { count++; } } if (count!=epiphora_candidates[i][1].length) { temp.push(epiphora_candidates[i]) } } epiphora_candidates = temp; result = epiphora_candidates; return result.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function text_to_array(text, array)\n{\n\tvar array = array || [], i = 0, l;\n\tfor (l = text.length % 8; i < l; ++i)\n\t\tarray.push(text.charCodeAt(i) & 0xff);\n\tfor (l = text.length; i < l;)\n\t\t// Unfortunately unless text is cast to a String object there is no shortcut for charCodeAt,\n\t\t// and if text is...
[ "0.58446383", "0.5692288", "0.5643362", "0.5239981", "0.5211952", "0.52095336", "0.51864654", "0.5185215", "0.5150428", "0.51325995", "0.5126138", "0.5120027", "0.51147413", "0.5112623", "0.51062834", "0.5054987", "0.50448465", "0.50188386", "0.50021935", "0.4973537", "0.4964...
0.638656
0
This function searches for simplokas in the text and forms an array with them.
function getSimplokaCount() { flag = true; for(i=0; i<anaphora_examples.length; i++) { for(j=0; j<epiphora_examples.length; j++) { flag = true; if(anaphora_examples[i][1].length == epiphora_examples[j][1].length) { for(t=0; t<anaphora_examples[i][1].length; t++) { if(anaphora_examples[i][1][t] != epiphora_examples[j][1][t]) { flag = false; break; } } } else flag = false; if(flag) { let tmp_array = anaphora_examples[i].slice(); tmp_array[1] = anaphora_examples[i][1].slice(); simploka_examples.push(tmp_array); simploka_examples[simploka_examples.length - 1][2] = epiphora_examples[j][0]; } } } result = simploka_examples; return result.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wave(text){\n let finalArray = []\nfor ( let i = 0; i < text.length; i++) {\n let arr = text.split('')\n if (arr[i] === ' ') {\n continue;\n }\n arr[i] = arr[i].toUpperCase()\n\n finalArray.push(arr.join(''))\n}\n return finalArray\n}", "function soloUnaVez(texto) {\n\n //Def...
[ "0.60870373", "0.60269594", "0.59192", "0.5849376", "0.58275753", "0.5768264", "0.5749284", "0.57174265", "0.5680814", "0.5671406", "0.5647099", "0.5616993", "0.560509", "0.5601543", "0.5584168", "0.55694354", "0.5465506", "0.5458776", "0.54506093", "0.5445655", "0.5445542", ...
0.0
-1
This function searches for anadiplosises in the text and forms an array with them.
function getAnadiplosisCount() { text = workarea.textContent; search_string = "[a-zA-Zа-яА-ЯёЁ]+[.?!;]{1,3}\\s[a-zA-Zа-яА-ЯёЁ]+"; middle_words = text.match(/[a-zA-Zа-яА-ЯёЁ]+[.?!;]{1,3}\s[a-zA-Zа-яА-ЯёЁ]+/g); new_phrases = []; result = []; if(middle_words != null) { for (i=0; i < middle_words.length; i++) { phrase = middle_words[i]; phrase = phrase.toLowerCase(); near_space = phrase.match(/[.?!;]{1,3}\s/)[0]; phrase = phrase.split(near_space); if(phrase[0] == phrase[1]) { new_phrases.push(middle_words[i]); } } result = new_phrases; tmp = []; for(key in result) { if(tmp.indexOf(result[key]) == -1) { tmp.push(result[key]); } } result = tmp; count = 0; search_string = "([a-zA-Zа-яА-ЯёЁ]+\\s){0}" + search_string + "(\\s[a-zA-Zа-яА-ЯёЁ]+){0}"; while(new_phrases.length != 0) { middle_words = []; count++; search_reg = new RegExp("\\{"+(count-1)+"\\}", 'g'); search_string = search_string.replace(search_reg, "{"+count+"}"); middle_words = text.match(new RegExp(search_string,"g")); new_phrases = []; if(middle_words != null) { for (i=0; i < middle_words.length; i++) { phrase = middle_words[i]; phrase = phrase.toLowerCase(); near_space = phrase.match(/[^a-zA-Zа-яА-ЯёЁ]{1,3}\s/)[0]; phrase = phrase.split(near_space); temp = middle_words[i].split(near_space); for(j=0; j<phrase.length-1; j++) { if(phrase[j] == phrase[j+1]) { new_phrases.push(temp[j] + near_space + temp[j+1]); } } } for(key in new_phrases) { result.push(new_phrases[key]); } } } tmp = []; for(key in result) { if(tmp.indexOf(result[key]) == -1) { tmp.push(result[key]); } } result = tmp; } return result.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "autoMode(text) {\n let array = [];\n let splitText = text.split(' ').filter((sub) => (sub !== ''));\n \n if (!splitText) {\n console.error('Something was wrong.');\n return;\n }\n \n while (splitText.length > 0) {\n // split every letter by the spaces x\n ...
[ "0.6204852", "0.6001508", "0.57278365", "0.5597251", "0.559294", "0.5583341", "0.5498596", "0.5487748", "0.545751", "0.5437609", "0.5430904", "0.53967434", "0.53967434", "0.5389876", "0.5381494", "0.5379707", "0.5378722", "0.53712404", "0.5366531", "0.53577995", "0.5356049", ...
0.5616537
3
This function searches for simple repeats in the text and forms an array with them.
function getSrepeatCount() { srepeat_examples = []; srepeats_for_sentences = []; result = []; for(i=0; i<sentences.length; i++) { sentence = []; sentence = sentences[i].replace(/[^a-zA-Zа-яА-ЯёЁ \n']/g, " "); sentence = sentence.replace(/\s+/g, " "); sentence = sentence.toLowerCase(); sentence = sentence.substring(0,sentence.length-1); sentence = sentence.split(" "); sub_result = sentence.reduce(function (acc, el) { acc[el] = (acc[el] || 0) + 1; return acc; }, {}); tmp = []; for(key in sub_result) { if(sub_result[key] > 1 && unions.indexOf(key) == -1 && prepositions.indexOf(key) == -1) { tmp.push(key); result.push(key); } } srepeat_examples.push([sentences[i], tmp]); } tmp = [] for(key in srepeat_examples) { tmp = [] for(i=0; i<srepeat_examples[key][1].length; i++){ if(srepeat_examples[key][1].length != 0) { if(srepeat_examples[key][1][i] != "'" || srepeat_examples[key][1][i] == "i") { tmp.push(srepeat_examples[key][1][i]) } } } srepeat_examples[key][1] = tmp; } count = 0; for(i=0; i<srepeat_examples.length; i++) { if(srepeat_examples[i][1].length != 0) { for(j=0; j<srepeat_examples[i][1].length; j++) { count++; } } } return count; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findRepeats(arr) {\n // -------------------- Your Code Here --------------------\n\n // create an object to keep track of how many times we've seen words\n var words = {};\n\n // create the array we're going to be returning\n var repeated = [];\n\n // iterate through the argument\n for (var i=0; i<...
[ "0.6958735", "0.64222807", "0.6331934", "0.6170416", "0.61667466", "0.61284775", "0.6078105", "0.5999959", "0.59810376", "0.586233", "0.58150953", "0.57941115", "0.5761154", "0.57425857", "0.57424694", "0.57424694", "0.57400084", "0.569317", "0.5684552", "0.5593503", "0.55921...
0.6033629
7
Notice how we attach a function that prints out "this.name". In other words print out this object's name property. So when the function is fired "this" refers to the person object. Let's try making the greet function seperate and put it on 2 objects.
function sayName(){ return this.name }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function greet(greeter){\n this.greeting =\"My name is \";\n this.greeter = greeter;\n this.speak = function(){\n console.log(this.greeting + this.greeter);\n }\n}", "function GreetMe(name) {\n\tthis.greeting = 'Hi ';\n\tthis.name = name;\n\tthis.greet = function() {\n\t\tconsole.log(this.gree...
[ "0.81145114", "0.8088825", "0.80641264", "0.805648", "0.80442566", "0.79936177", "0.7968379", "0.7763049", "0.7719687", "0.77051866", "0.77020144", "0.76614314", "0.7623538", "0.7622498", "0.76172704", "0.7616044", "0.7562745", "0.7542427", "0.7527346", "0.74970603", "0.74721...
0.0
-1
Logging out just requires removing the user's id_token and profile
function logout() { deferredProfile = $q.defer(); localStorage.removeItem('id_token'); localStorage.removeItem('profile'); authManager.unauthenticate(); userProfile = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logout() {\n deferredProfile = $q.defer();\n localStorage.removeItem('id_token');\n localStorage.removeItem('profile');\n authManager.unauthenticate();\n userProfile = null;\n $state.go('login');\n }", "function logOut() {\n localStorage.removeItem('idToken');\n localS...
[ "0.8138171", "0.7940114", "0.7839028", "0.77994376", "0.7772085", "0.77600163", "0.7719196", "0.7713605", "0.77088034", "0.76964545", "0.7678932", "0.76670045", "0.7623212", "0.76101196", "0.76044714", "0.7587714", "0.75530845", "0.75442195", "0.7542217", "0.7535465", "0.7534...
0.80604535
1
Set up the logic for when a user authenticates This method is called from app.run.js
function registerAuthenticationListener() { lock.on('authenticated', function (authResult) { localStorage.setItem('id_token', authResult.idToken); authManager.authenticate(); lock.getProfile(authResult.idToken, function (error, profile) { if (error) { return console.log(error); } localStorage.setItem('profile', JSON.stringify(profile)); deferredProfile.resolve(profile); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleSignIn() {\n // Sign in the user -- this will trigger the onAuthStateChanged() method\n\n }", "handleLogin() {\n this.authenticate();\n }", "OnAuthenticated(string, string) {\n\n }", "__defineHandlers__() {\n self = this;\n this.auth.onAuthStateChanged(\n function (use...
[ "0.7097865", "0.6990949", "0.6927303", "0.67903537", "0.67364424", "0.66616005", "0.65672374", "0.6538084", "0.65217555", "0.65087587", "0.64923614", "0.6491029", "0.648261", "0.6472623", "0.64602834", "0.64599615", "0.64492184", "0.6449078", "0.6443769", "0.64278877", "0.639...
0.0
-1
helper function to prevent Objective C bleed over into javascript
function bool2ObjC(value) { if(value === true) { return 'YES'; } else if(value === false) { return 'NO' } return value.toUpperCase(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fixbadjs(){\n\ttry{\n\t\tvar uw = typeof unsafeWindow !== \"undefined\"?unsafeWindow:window;\n\t\t// breakbadtoys is injected by jumpbar.js from TheHiveWorks\n\t\t// killbill and bucheck are injected by ks_headbar.js from Keenspot\n\t\tvar badFunctions = [\"breakbadtoys2\", \"killbill\", \"bucheck\"];\n\t...
[ "0.60332656", "0.57387924", "0.57141984", "0.571187", "0.5650697", "0.55610585", "0.5542587", "0.5507383", "0.5507383", "0.5507383", "0.5505065", "0.5505065", "0.5505065", "0.5455108", "0.5409075", "0.5409075", "0.5409075", "0.5409075", "0.5409075", "0.5307336", "0.5307336", ...
0.0
-1
A tagged template literal function for standardizing the path.
function standardizePath(stringParts) { var expressions = []; for (var _i = 1; _i < arguments.length; _i++) { expressions[_i - 1] = arguments[_i]; } var result = []; for (var i = 0; i < stringParts.length; i++) { result.push(stringParts[i], expressions[i]); } return exports.util.standardizePath(result.join('')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function crawl(path) {\n if (path.is(\"_templateLiteralProduced\")) {\n crawl(path.get(\"left\"));\n crawl(path.get(\"right\"));\n } else if (!path.isBaseType(\"string\") && !path.isBaseType(\"number\")) {\n path.replaceWith(t.callExpression(t.identifier(\"String\"), [path.node]));\n }\n}", "function...
[ "0.6084438", "0.6084438", "0.6063626", "0.6063626", "0.5886935", "0.5838477", "0.56317085", "0.55815536", "0.5528784", "0.5472838", "0.53872675", "0.53872675", "0.53806967", "0.53602475", "0.53537834", "0.5333158", "0.53139424", "0.53079045", "0.5307276", "0.5291785", "0.5283...
0.49986362
49
Static Functions are Contextual
static ClassStaticFunc() { // use "this" as the reference to the Point Class Object return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static staticMethod() {\n \t\n \t}", "static method(){}", "static staticHi(){\n console.log('i am static method');\n \n }", "static staticMethod() {\n return 'I am visible only when invoked as statis method';\n }", "function _____SHARED_functions_____(){}", "static hello(){...
[ "0.7468231", "0.68855435", "0.66818535", "0.66607684", "0.6625587", "0.6594218", "0.6593899", "0.65331405", "0.65331405", "0.6499937", "0.64893997", "0.6418954", "0.6384909", "0.6336142", "0.63249564", "0.63143194", "0.63115174", "0.62964374", "0.6274496", "0.62606615", "0.62...
0.0
-1
draw executes each frame
function draw() { // Only If the window is in focus ... if (mouseX != 0 && mouseY != 0) { mousepos.set(mouseX, mouseY); // Normalizing the result means a slow approch to the endpoint direction = mousepos.sub(midpoint).normalize(); midpoint.add(direction); createProjection(width / 2, height / 2, midpoint.x, midpoint.y) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "draw() {\n this.loop(DrawableArray.drawFunction);\n }", "draw() {\n this.loop(DrawableArray.drawFunction);\n }", "draw() {\n this.loop(DrawableArray.drawFunction);\n }", "function draw() {\n\t\tfor (var i = 0; i < loop.graphics.length; i++) {\n\t\t\tloop....
[ "0.81096524", "0.81096524", "0.81096524", "0.80829144", "0.79170305", "0.7911917", "0.7895798", "0.78491086", "0.78491086", "0.7770451", "0.77563846", "0.77563846", "0.77563846", "0.7756033", "0.7749644", "0.7746734", "0.77258253", "0.7711054", "0.77058536", "0.7686585", "0.7...
0.0
-1
Custom function that handles the projection effect
function createProjection(x1, y1, x2, y2) { // Creating two vector objects var startVector = createVector(x1, y1); var endVector = createVector(x2, y2); // Get the direction from strat to end var dirVector = endVector.copy().sub(startVector); // Save the magnitude = length of the distance var magnitude = dirVector.mag(); // Reduce to unit vector of length 1, then divide the 10 logos in dirVector.normalize(); dirVector.mult(magnitude / 10); // This makes all no sense but is working nicely for (var i = 0; i < projection.length; i++) { startVector.add(dirVector); var tempLogo = select('#logo' + i); tempLogo.position((startVector.x - LOGOHALF), startVector.y - LOGOHALF); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ProjectionOverlay() {\n\t\t\t}", "function WoWMapProjection(){}", "function CanvasProjectionOverlay(){}", "function applyProjection(p, m) {\n\t var x = p.x,\n\t y = p.y,\n\t z = p.z;\n\t var e = m.elements;\n\t var w = e[3] * x + e[7] * y + e[11...
[ "0.77571934", "0.74693274", "0.7116867", "0.7026151", "0.69559216", "0.6946876", "0.67370814", "0.6711519", "0.66908246", "0.6643252", "0.66186327", "0.65798026", "0.64972615", "0.6494067", "0.64783114", "0.6438363", "0.6384972", "0.63781357", "0.63355273", "0.6334939", "0.63...
0.59893095
50
Copyright (C) 2002 2023 CERN Indico is free software; you can redistribute it and/or modify it under the terms of the MIT License; see the LICENSE file for more details.
function _revert_element(ui) { // make element assume previous size if (ui.originalSize) { ui.helper.height(ui.originalSize.height); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "transient private protected internal function m182() {}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constr...
[ "0.599635", "0.5771029", "0.5695821", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566046", "0.566...
0.0
-1
handle the resize event from the body
function resize(){ myp5.resize(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleResize(){\r\n console.log(\"I've been resized\")\r\n}", "function handleResize(event) {\r\n console.log(event);\r\n}", "onResize () {}", "resizeListener() {\n this.windowWidth = global.innerWidth;\n this._checkFixedNeeded();\n }", "onResize_() {\n dispatcher.getInst...
[ "0.80259335", "0.7839376", "0.7693922", "0.765212", "0.75670177", "0.75613886", "0.7552233", "0.74986714", "0.74927205", "0.7467986", "0.7463169", "0.7463169", "0.74587214", "0.745521", "0.74495757", "0.7447943", "0.74395967", "0.74326617", "0.74325967", "0.741904", "0.740533...
0.0
-1
A clickable object inBounds returns true if coordinates are within the bounds of the object optional `canMouseOver` allowing a function to state whether an object can be moused over or not. The `canMouseOver` function should return a boolean.
function GameObject(x1, x2, y1, y2, wall, click, canMouseOver) { this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; this.wall = wall; this.click = click || function() {}; this.inBounds = function(x, y) { return (this.x1 <= x && this.x2 >= x && this.y1 <= y && this.y2 >= y); }; this.canMouseOver = canMouseOver || function() {return true;}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isWithinBounds(bbox) {\n return (\n this.mouseX >= bbox.left &&\n this.mouseX <= bbox.left + bbox.width &&\n this.mouseY >= bbox.top &&\n this.mouseY <= bbox.top + bbox.height\n );\n }", "function inBounds(xMouse, yMouse, x,y,width, height){\r\n if(xMouse > x &&\r\n xMouse < ...
[ "0.6698562", "0.6658099", "0.66138625", "0.6549332", "0.6488192", "0.6417664", "0.6412365", "0.6389542", "0.6364141", "0.6336381", "0.62612385", "0.625429", "0.6120905", "0.6113942", "0.6091119", "0.6088137", "0.6075966", "0.6065227", "0.60071784", "0.60041547", "0.5974089", ...
0.57125205
32
Using axios send a GET request to the address: Once the data is returned console.log it and review the structure. Iterate over the topics creating a new Tab component and add it to the DOM under the .topics element. The tab component should look like this: topic here
function tabMaker(topic) { const tab = document.createElement("div"); tab.classList.add("tab"); tab.textContent = topic; return tab; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTabData (url) {\n\n // Get tab data from url\n axios.get(url)\n .then( response => {\n\n // Get topics \n let topicContent = []; \n topicContent = response[\"data\"][\"topics\"];\n topicContent.unshift(\"all\")\n console.log(\"topic content:\", top...
[ "0.82546663", "0.8196486", "0.6542136", "0.6262952", "0.62627894", "0.616717", "0.61024225", "0.6070294", "0.602745", "0.60201603", "0.59739614", "0.59730846", "0.5967334", "0.5948629", "0.59043455", "0.5881514", "0.57357734", "0.57004434", "0.56584704", "0.56515044", "0.5632...
0.61195356
6
Function for drawing a card on the screen using the url of the card for the background image;
function drawCard(url, classname = null, value = null, append = true) { str = "<span class='card' style='background-image: url(" + url + ");'" if (value) { str += "num='" + value } str += "'></span>"; if (append) { $("." + classname).append(str); } else { return str } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawCard(card) {\n\tlet cardHolder = document.createElement('div');\n\tcardHolder.classList.add('card');\n\n\tlet backCard = document.createElement('div');\n\tbackCard.classList.add('backCard');\n\tcardHolder.appendChild(backCard);\n\t// There are no images for all cards (no imageUrl)\n\tlet image = docum...
[ "0.7138788", "0.70901823", "0.68538374", "0.65749055", "0.65520597", "0.649731", "0.6435146", "0.6351824", "0.6321167", "0.6316964", "0.6283189", "0.62705356", "0.62604505", "0.62524587", "0.62488306", "0.6237338", "0.6226093", "0.6209804", "0.61972326", "0.6174994", "0.61652...
0.6997925
2
A notify function that automatically fades out any notifications over 3s
function notify(text) { var el = $('<div class="tn-box tn-box-color-1"><p class="notification-message">' + text + '</p><button class="closebutton btn btn-success">OK</button></div>') $(".notifications").append(el); setTimeout(function() { el.addClass("tn-box-active"); el.fadeOut(3000, function() { $(this).remove(); }); }, 300); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function notify(message, fadeout = true) {\n if (fadeout) {\n $(\"#message\").html(message).fadeTo(500, 1).delay(6000).fadeTo(500, 0);\n }\n else {\n $(\"#message\").html(message).fadeTo(500, 1);\n }\n}", "function notification(title, image, msg) {\n // Assign the notification as act...
[ "0.7105446", "0.6994876", "0.6845799", "0.68172574", "0.67991275", "0.6772484", "0.6587236", "0.65394646", "0.652646", "0.64807427", "0.64807427", "0.64807427", "0.64616525", "0.64438975", "0.64139354", "0.6297589", "0.6243184", "0.6225442", "0.61984", "0.61618817", "0.614977...
0.6483222
9
This is called every time something is updated in the store.
stateChanged(state) { this._quantity = cartQuantitySelector(state); this._error = state.shop.error; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updated() {}", "function update() {\n // ... no implementation required\n }", "updated(){\n console.log('Updated');\n }", "update() {\n // Subclasses should override\n }", "onStoreUpdate({ changes, record }) {\n const { editorContext } = this;\n\n if (editorContext && editorCont...
[ "0.7161957", "0.70259964", "0.69527143", "0.6894755", "0.68237233", "0.6793203", "0.67704964", "0.67704964", "0.67649806", "0.66785806", "0.66757315", "0.665823", "0.6655085", "0.66368276", "0.6634629", "0.657258", "0.65575594", "0.65575594", "0.65575594", "0.65575594", "0.65...
0.0
-1
BAD SESSION KILLER For cases when shop tries to reinstall us. ref to solution hack:
async function badSessionKillerReInstall(ctx, _next) { if (ctx.request.header.cookie) { if ( (ctx.request.url.split('?')[0] === '/' && ctx.request.querystring.split('&') && ctx.request.querystring.split('&')[0].split('=')[0] === 'hmac' && ctx.request.querystring.split('&')[1].split('=')[0] !== 'locale') || (ctx.request.url.split('?')[0] === '/auth/callback' && ctx.request.querystring.split('&') && ctx.request.querystring.split('&')[1].split('=')[0] === 'hmac') ) { console.log( `Killing bad session: url: ${ctx.request.url}, cookie: ${ctx.request.header.cookie}`, ); reportEvent( ctx.request.header.cookie.shopOrigin, 'bad_session_killed', { value: 'reinstall' }, ); ctx.request.header.cookie = ctx.request.header.cookie .split(' ') .filter( (item) => ['koa:sess', 'koa:sess.sig'].indexOf(item.split('=')[0]) === -1, ) .join(' '); } } await _next(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function badSessionKillerRedirect(ctx, next) {\n const { shop: shopOrigin } = ctx.session;\n\n const queryData = url.parse(ctx.request.url, true);\n const requestPath = ctx.request.url;\n if (\n shopOrigin &&\n queryData.query.shop &&\n shopOrigin !== queryData.query.shop\n ) {\n if (!reques...
[ "0.67468977", "0.66138935", "0.59475714", "0.57612824", "0.5756241", "0.56617385", "0.5651538", "0.56376326", "0.5597882", "0.5528068", "0.5514786", "0.54664284", "0.54555815", "0.54440224", "0.5432712", "0.54175544", "0.54167455", "0.54066914", "0.5403808", "0.5399567", "0.5...
0.74862444
0
BAD SESSION KILLER Case there's a bad session kill it and redirect to auth flow
async function badSessionKillerRedirect(ctx, next) { const { shop: shopOrigin } = ctx.session; const queryData = url.parse(ctx.request.url, true); const requestPath = ctx.request.url; if ( shopOrigin && queryData.query.shop && shopOrigin !== queryData.query.shop ) { if (!requestPath.match(/^\/script|^\/product/g)) { console.debug('🎤 Dropping invalid session'); ctx.session.shopOrigin = null; ctx.session.accessToken = null; reportEvent(shopOrigin, 'bad_session_killed', { value: 'multiple_shops', secondShop: queryData.query.shop, }); ctx.redirect('/auth'); } } await next(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function badSessionKillerReInstall(ctx, _next) {\n if (ctx.request.header.cookie) {\n if (\n (ctx.request.url.split('?')[0] === '/' &&\n ctx.request.querystring.split('&') &&\n ctx.request.querystring.split('&')[0].split('=')[0] === 'hmac' &&\n ctx.request.querystring.split('&')...
[ "0.64195216", "0.6397031", "0.6393355", "0.631766", "0.6306464", "0.626547", "0.6236522", "0.62076956", "0.6199399", "0.61959356", "0.614851", "0.6135205", "0.61322796", "0.6127965", "0.61026806", "0.60913616", "0.6071165", "0.60692495", "0.60609317", "0.6057303", "0.60517454...
0.77617174
0
Removes the physics body colliders from the sprite but not overlap sensors.
removeColliders() { this._collides = {}; this._colliding = {}; this._collided = {}; this._removeFixtures(false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onRemoveFromWorld() {\n //game.physicsEngine.world.removeBody(this.physicsObj);\n }", "function removeOutOfBoundObj() {\n gameState.enemies.getChildren().forEach(enemy => {\n if (enemy.x > config.width + HALF_OBJ_PIXEL || enemy.x < -HALF_OBJ_PIXEL) {\n gameState.enemies.remove(enem...
[ "0.64641505", "0.63221043", "0.6303872", "0.6266476", "0.62528527", "0.61161864", "0.6047687", "0.6042808", "0.5715037", "0.5688946", "0.56785524", "0.5659047", "0.5656989", "0.5647188", "0.56171954", "0.5594845", "0.55844414", "0.55761814", "0.555861", "0.55491245", "0.55395...
0.7001257
0
Removes overlap sensors from the sprite.
removeSensors() { this._overlap = {}; this._overlaps = {}; this._overlapping = {}; this._overlapped = {}; this._removeFixtures(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeOutOfBoundObj() {\n gameState.enemies.getChildren().forEach(enemy => {\n if (enemy.x > config.width + HALF_OBJ_PIXEL || enemy.x < -HALF_OBJ_PIXEL) {\n gameState.enemies.remove(enemy);\n }\n });\n gameState.platformsEven.getChildren().forEach(platform => {\n i...
[ "0.63742995", "0.5886565", "0.58457756", "0.56442356", "0.5600117", "0.5546436", "0.5516453", "0.5513831", "0.55122197", "0.5511275", "0.55017287", "0.5484007", "0.54440993", "0.5440689", "0.54392076", "0.5438434", "0.54377514", "0.54259807", "0.542194", "0.54074645", "0.5404...
0.7171138
0
removes sensors or colliders
_removeFixtures(isSensor) { let prevFxt; for (let fxt = this.fixtureList; fxt; fxt = fxt.getNext()) { if (fxt.m_isSensor == isSensor) { let _fxt = fxt.m_next; fxt.destroyProxies(this.p.world.m_broadPhase); if (!prevFxt) { this.body.m_fixtureList = _fxt; } else { prevFxt.m_next = _fxt; } } else { prevFxt = fxt; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeSensors() {\r\n\t\t\tthis._overlap = {};\r\n\t\t\tthis._overlaps = {};\r\n\t\t\tthis._overlapping = {};\r\n\t\t\tthis._overlapped = {};\r\n\t\t\tthis._removeFixtures(true);\r\n\t\t}", "removeColliders() {\r\n\t\t\tthis._collides = {};\r\n\t\t\tthis._colliding = {};\r\n\t\t\tthis._collided = {};\r\n\t\t\tth...
[ "0.72755295", "0.6683488", "0.65936196", "0.65030766", "0.64949393", "0.6344875", "0.6318425", "0.6316633", "0.6276058", "0.62344694", "0.6206997", "0.61592376", "0.61512053", "0.61511254", "0.6080284", "0.6074063", "0.6061584", "0.6045986", "0.6041882", "0.6041493", "0.60349...
0.5753151
60
Clones the collider's props to be transferred to a new collider.
_cloneBodyProps() { let body = {}; let props = [...spriteProps]; let deletes = [ 'w', 'h', 'width', 'height', 'shape', 'd', 'diameter', 'dynamic', 'static', 'kinematic', 'collider', 'heading', 'direction' ]; for (let del of deletes) { let i = props.indexOf(del); if (i >= 0) props.splice(i, 1); } for (let prop of props) { body[prop] = this[prop]; } return body; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set collider(value) {}", "get collider() {}", "clone() {\n const triggerMesh = super.clone();\n triggerMesh.material = this.material.clone();\n triggerMesh.hover = this.hover;\n triggerMesh.exit = this.exit;\n triggerMesh.select = this.select;\n triggerMesh.release = this.release;...
[ "0.62071186", "0.58772564", "0.55298156", "0.5427527", "0.5330955", "0.53114337", "0.5295751", "0.5263874", "0.52562857", "0.52020776", "0.5182577", "0.51588017", "0.51169986", "0.50910705", "0.50370175", "0.49785072", "0.49250054", "0.48856843", "0.48817328", "0.48814154", "...
0.5001389
15
Returns the first node in a linked list of the planck physics body's fixtures.
get fixture() { return this.fixtureList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get fixtureList() {\r\n\t\t\tif (!this.body) return null;\r\n\t\t\treturn this.body.getFixtureList();\r\n\t\t}", "first(returnNode) {\n let node = this[this._start][this._next];\n return returnNode ? node : node.data;\n }", "getFirst () {\n\t\treturn this.head;\n\t}", "getFirst () {\n\t\tret...
[ "0.566847", "0.5550254", "0.5545852", "0.5545852", "0.5545852", "0.5455136", "0.53845984", "0.53845984", "0.52773535", "0.5271643", "0.5260438", "0.5231135", "0.51783586", "0.5177588", "0.5154129", "0.51494235", "0.5114569", "0.51121306", "0.50545233", "0.4988757", "0.4954843...
0.5673129
0
Returns the first node in a linked list of the planck physics body's fixtures.
get fixtureList() { if (!this.body) return null; return this.body.getFixtureList(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get fixture() {\r\n\t\t\treturn this.fixtureList;\r\n\t\t}", "first(returnNode) {\n let node = this[this._start][this._next];\n return returnNode ? node : node.data;\n }", "getFirst () {\n\t\treturn this.head;\n\t}", "getFirst () {\n\t\treturn this.head;\n\t}", "getFirst () {\n\t\treturn t...
[ "0.5670101", "0.55511737", "0.5548006", "0.5548006", "0.5548006", "0.54578245", "0.5386264", "0.5386264", "0.52783704", "0.5273938", "0.52637506", "0.5232764", "0.5180677", "0.5178833", "0.5155045", "0.5152204", "0.51153433", "0.51133215", "0.50559485", "0.49911925", "0.49553...
0.56664073
1
TODO make this work for other shapes
_resizeCollider(scale) { if (!this.body) return; if (typeof scale == 'number') { scale = { x: scale, y: scale }; } else { if (!scale.x) scale.x = 1; if (!scale.y) scale.y = 1; } if (this.shape == 'circle') { let fxt = this.fixture; let sh = fxt.m_shape; sh.m_radius *= scale.x; } else { // let bodyProps = this._cloneBodyProps(); // this.removeColliders(); // this.addCollider(); // for (let prop in bodyProps) { // this[prop] = bodyProps[prop]; // } for (let fxt = this.fixtureList; fxt; fxt = fxt.getNext()) { if (fxt.m_isSensor) continue; let sh = fxt.m_shape; for (let vert of sh.m_vertices) { vert.x *= scale.x; vert.y *= scale.y; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Shape4(){}", "dibujar_p() {\n push();\n stroke('black');\n strokeWeight(3);\n translate(this.posx-((this._shape[0].length*this.longitud)/2),this.posy-((this._shape.length*this.longitud)/2));\n for (var i = 0; i < this._shape.length; i++) {\n for (var j = 0; j < this._shape[i].leng...
[ "0.6834569", "0.67508847", "0.67137176", "0.66884226", "0.66126215", "0.6551367", "0.6542498", "0.6489623", "0.6489623", "0.6425789", "0.6369453", "0.63574725", "0.6321959", "0.63140684", "0.6231218", "0.6221039", "0.6193941", "0.61394536", "0.61325413", "0.60903955", "0.6089...
0.0
-1
You can set the sprite's update function to your own custom update function that will be run after every draw call or when the updateSprites function is called.
get update() { return this._update; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(){\r\n this.sprite.y += this.staticVelY;\r\n }", "update()\n {\n this.baseTexture.update();\n }", "update() {\n this.baseTexture.update();\n }", "setSprite() {\n\n // Flip sprite if moving in a direction\n if (this.body.velocity.x > 0) {\n this.sprite.setFlipX(fa...
[ "0.71677786", "0.7020461", "0.6896807", "0.6890285", "0.6825497", "0.67206305", "0.6705654", "0.6673887", "0.6673887", "0.66632324", "0.66557133", "0.66557133", "0.66557133", "0.66440326", "0.6636744", "0.6593263", "0.6575519", "0.65735847", "0.65674996", "0.6554387", "0.6515...
0.0
-1
Updates the sprite. Called automatically at the end of the draw cycle.
_update() { if (this.animation) this.animation.update(); if (!this.body) { this.rotation += this._rotationSpeed; this.x += this.vel.x; this.y += this.vel.y; } if (this.xLock) this.x = this.previousPosition.x; if (this.yLock) this.y = this.previousPosition.y; for (let prop in this.mouse) { if (this.mouse[prop] == -1) this.mouse[prop] = 0; } let a = this; for (let event in eventTypes) { for (let entry of this[event]) { let contactType; let b = entry[0]; let f = entry[1] + 1; this[event].set(b, f); if (f == 0) { this[event].delete(b); continue; } else if (f == -1) { contactType = eventTypes[event][2]; } else if (f == 1) { contactType = eventTypes[event][0]; } else { contactType = eventTypes[event][1]; } if (b instanceof Group) continue; let cb = _findContactCB(contactType, a, b); if (typeof cb == 'function') cb(a, b, f); } } if (this._customUpdate) this._customUpdate(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateSprite () {\n this.setDirState(null, null)\n }", "render () {\r\n ctx.drawImage(Resources.get(this.sprite), this.x-50, this.y-100);\r\n }", "update()\n {\n this.baseTexture.update();\n }", "render() {\n\n \tctx.drawImage(Resources.get(this.sprite), ...RENDER_AT_POSITION(th...
[ "0.73472536", "0.7111969", "0.70612484", "0.7026377", "0.7026377", "0.70218617", "0.69890344", "0.69890344", "0.6981303", "0.6976661", "0.6918003", "0.69150317", "0.69030774", "0.68898034", "0.68898034", "0.68881875", "0.68689126", "0.68689126", "0.68689126", "0.68689126", "0...
0.0
-1
Displays the Sprite with rotation and scaling applied before the sprite's draw function is called.
_display() { let x = this.p.width * 0.5 - this.p.world.origin.x + this.x * this.tileSize; let y = this.p.height * 0.5 - this.p.world.origin.y + this.y * this.tileSize; // skip drawing for out-of-view bodies, but // edges can be very long, so they still should be drawn if ( this.shape != 'chain' && this.p.camera.active && (x + this.w < this.p.camera.bound.min.x || x - this.w > this.p.camera.bound.max.x || y + this.h < this.p.camera.bound.min.y || y - this.h > this.p.camera.bound.max.y) ) { return; } x = fixRound(x); x -= (this.w * this.tileSize) % 2 ? 0.5 : 0; y = fixRound(y); y -= (this.h * this.tileSize) % 2 ? 0.5 : 0; // x += this.tileSize * 0.015; // y += this.tileSize * 0.015; this.p.push(); this.p.imageMode(p5.prototype.CENTER); this.p.rectMode(p5.prototype.CENTER); this.p.ellipseMode(p5.prototype.CENTER); this.p.translate(x, y); if (this.rotation) this.p.rotate(this.rotation); this.p.scale(this._mirror.x, this._mirror.y); this.p.fill(this.color); this._draw(); this.p.pop(); this.p.p5play.autoDrawSprites = false; this._cameraActiveWhenDrawn = this.p.camera.active; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render () {\r\n ctx.drawImage(Resources.get(this.sprite), this.x-50, this.y-100);\r\n }", "render() {\n const x = this.x - spriteWidth / 2;\n const y = this.y - spriteHeight / 2;\n ctx.drawImage(Resources.get(this.sprite), x, y);\n }", "render() {\n const x = this.x - s...
[ "0.716745", "0.71599424", "0.71599424", "0.71472746", "0.71472746", "0.7103905", "0.7103905", "0.7088447", "0.7082064", "0.7020843", "0.7020843", "0.7020843", "0.7020843", "0.70060194", "0.70060194", "0.6974374", "0.6974374", "0.6974374", "0.6974374", "0.6974374", "0.6974374"...
0.0
-1
Draws a fixture. Used to draw the sprite's physics body.
_drawFixture(fxt) { const sh = fxt.m_shape; if (sh.m_type == 'polygon' || sh.m_type == 'chain') { if (sh.m_type == 'chain') { this.p.push(); this.p.noFill(); } let v = sh.m_vertices; this.p.beginShape(); for (let i = 0; i < v.length; i++) { this.p.vertex(v[i].x * plScale, v[i].y * plScale); } if (sh.m_type != 'chain') this.p.endShape(p5.prototype.CLOSE); else { this.p.endShape(); this.p.pop(); } } else if (sh.m_type == 'circle') { const d = sh.m_radius * 2 * plScale; this.p.ellipse(sh.m_p.x * plScale, sh.m_p.y * plScale, d, d); } else if (sh.m_type == 'edge') { this.p.line( sh.m_vertex1.x * plScale, sh.m_vertex1.y * plScale, sh.m_vertex2.x * plScale, sh.m_vertex2.y * plScale ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "draw() {\n let sprite = this.sprite;\n if (sprite == null)\n return;\n ctx.drawImage(sprite.sprite, sprite.animationFrame * sprite.width, 0, sprite.width, sprite.height, this.rect.x + sprite.xOffset, this.rect.y + sprite.yOffset, this.rect.width * sprite.xStretch, this.rect.height *...
[ "0.5845516", "0.5777772", "0.5775472", "0.57509124", "0.5714409", "0.5713729", "0.5693236", "0.5692172", "0.56509733", "0.56364477", "0.5627966", "0.5584947", "0.55848265", "0.5582253", "0.5577812", "0.55737764", "0.55628854", "0.55615073", "0.5527821", "0.5527139", "0.552402...
0.71356446
0
Removes the Sprite from the sketch. The removed Sprite will not be drawn or updated anymore.
remove() { if (this.body) this.p.world.destroyBody(this.body); this.removed = true; //when removed from the "scene" also remove all the references in all the groups while (this.groups.length > 0) { this.groups[0].remove(this); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "remove() {\n\t\tthis.destroy();\n\t\tthis.engine.scene.removeSprite(this);\n\t}", "function removeSprite(sprite) {\n sprite.parent.removeChild(sprite);\n}", "removeFrom (stage) {\n const curStage = stage\n\n curStage.sprites = stage.sprites.filter((item) => item !== this)\n this.element ? this.elem...
[ "0.77431214", "0.75477993", "0.69690484", "0.6940142", "0.68978834", "0.6861231", "0.67769843", "0.66638386", "0.65098506", "0.64735377", "0.64435333", "0.6405962", "0.6400886", "0.6400886", "0.63380367", "0.6259134", "0.6221261", "0.62026954", "0.60520804", "0.6036639", "0.6...
0.0
-1
Returns the sprite's unique identifier
toString() { return 's' + this.idNum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUniqueIdentifier(item) {\n if (item.info) {\n return item.info.id;\n }\n return item.label;\n }", "masterSprite() {\n let type = this.sprites.images['idle'] ? 'idle' : 'go';\n return this.sprites ? this.sprites.images[type][0] : null;\n }", "getUuid(path, type) {\n pa...
[ "0.6376276", "0.6334066", "0.63036495", "0.6285816", "0.62337476", "0.6224971", "0.6204668", "0.60802", "0.60688955", "0.601888", "0.6006288", "0.598085", "0.59690684", "0.59662044", "0.5959477", "0.5951692", "0.5930449", "0.59182614", "0.59182614", "0.5916017", "0.5913496", ...
0.0
-1
Plays the animation, starting from the specified frame.
play(frame) { this.playing = true; if (frame !== undefined) this.frame = frame; this.targetFrame = -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "play() {\n this.frame = window.requestAnimationFrame(()=>this.firstFrame());\n }", "animate_start(frame) {\r\n this.sprite.animate = true;\r\n }", "function playAnimation(sequenceArray) {\n\n //Reset any possible previous animations\n reset();\n\n //Figure out how many frames...
[ "0.74509704", "0.7062324", "0.69954747", "0.68558973", "0.6678242", "0.663272", "0.6590897", "0.6588616", "0.6556551", "0.64773655", "0.64632434", "0.6458551", "0.6437455", "0.64117974", "0.63575435", "0.63106775", "0.62889117", "0.6288061", "0.6278835", "0.6277658", "0.62776...
0.72535974
1
Plays the animation backwards. Equivalent to ani.goToFrame(0)
rewind() { this.looping = false; this.goToFrame(0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function backward(){\n //alert(\"cur \"+curFrame);\n if(curFrame == 0){\n if(!isBlackOut){\n curFrame = frames.length-1;\n }else if(isBlackOut){\n curFrame = frames.length;\n }\n }\n \n if(!isBlackOut && curFrame >= 3){\n curFrame = curFrame-4;\n ...
[ "0.73574317", "0.7228817", "0.7186079", "0.67603755", "0.67092985", "0.6707286", "0.6694453", "0.66923225", "0.6545906", "0.6538831", "0.65234387", "0.6487065", "0.64786786", "0.647234", "0.64350504", "0.6393924", "0.6383703", "0.63565725", "0.63535786", "0.63356227", "0.6320...
0.6893616
3
Plays the animation forwards and loops it.
loop() { this.looping = true; this.playing = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animate() {\n if (PLAY_STATUS != PlayStatus.PLAYING) {\n return;\n } else {\n stepAndAnimate()\n }\n}", "function anim() {\r\n Loop();\r\n requestAnimFrame(anim);\r\n }", "play(){this.__stopped=!0;this.toggleAnimation()}", "function animationLoop() {\n\trequestA...
[ "0.722313", "0.7166568", "0.7005895", "0.698627", "0.695377", "0.692371", "0.6906607", "0.6900058", "0.6893759", "0.68574816", "0.6846399", "0.6833086", "0.6811631", "0.67335105", "0.67173463", "0.67035335", "0.6629723", "0.6599515", "0.6592861", "0.6589526", "0.65759677", ...
0.6896506
8
Prevents the animation from looping
noLoop() { this.looping = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "stop() {\n this._enableAnimation = false;\n }", "function stop() {\r\n animating = false;\r\n }", "stop() {\n this.renderer.setAnimationLoop(null);\n }", "animate_stop() {\r\n this.sprite.animate = false;\r\n }", "stop(){this.__stopped=!1;this.toggleAnimation...
[ "0.7715218", "0.77071416", "0.76263696", "0.7431299", "0.736073", "0.73198", "0.7312543", "0.72387207", "0.7229728", "0.72188836", "0.70974183", "0.7068261", "0.70324355", "0.7025615", "0.7012021", "0.70109195", "0.70048773", "0.70048773", "0.70048773", "0.69861346", "0.69726...
0.72637546
7
Goes to the next frame and stops.
nextFrame() { if (this.frame < this.length - 1) this.frame = this.frame + 1; else if (this.looping) this.frame = 0; this.targetFrame = -1; this.playing = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "gotoNextFrame() {\n // Loop back to beginning if gotoNextFrame goes past the last frame\n var nextFramePlayheadPosition = this.playheadPosition + 1;\n\n if (nextFramePlayheadPosition > this.length) {\n nextFramePlayheadPosition = 1;\n }\n\n this.gotoFrame(nextFramePlayheadPosition);\n }", "f...
[ "0.7810864", "0.77806795", "0.76269764", "0.7540845", "0.74758345", "0.7405974", "0.7398673", "0.7348175", "0.7302317", "0.71408546", "0.7054813", "0.7054813", "0.69301367", "0.6919115", "0.68607724", "0.6757489", "0.66500217", "0.6545627", "0.6534263", "0.6526923", "0.647710...
0.75547886
3
Goes to the previous frame and stops.
previousFrame() { if (this.frame > 0) this.frame = this.frame - 1; else if (this.looping) this.frame = this.length - 1; this.targetFrame = -1; this.playing = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "gotoPrevFrame() {\n var prevFramePlayheadPosition = this.playheadPosition - 1;\n\n if (prevFramePlayheadPosition <= 0) {\n prevFramePlayheadPosition = this.length;\n }\n\n this.gotoFrame(prevFramePlayheadPosition);\n }", "previousFrame() {\n\t\t\t\tif (this.frame > 0) this.frame = this.frame - ...
[ "0.7906292", "0.7812864", "0.7554695", "0.74963164", "0.74026585", "0.7373975", "0.73246425", "0.73246425", "0.72755533", "0.7262534", "0.7188262", "0.70223796", "0.69566983", "0.692452", "0.69226867", "0.6881791", "0.68798035", "0.68631", "0.6861956", "0.6858386", "0.6824034...
0.79477596
0
Removes all sprites from the group and destroys the group.
removeAll() { this.remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "destroy()\n\t{\n\t\tthis.parentGroup.removeSprite(this);\n\t}", "destroy()\n\t{\n\t\tthis.parentGroup.removeSprite(this);\n\t}", "remove() {\n\t\t\t\tthis.removed = true;\n\n\t\t\t\t//when removed from the \"scene\" also remove all the references in all the groups\n\t\t\t\twhile (this.groups.length > 0) {\n\t\...
[ "0.7577594", "0.7577594", "0.70399153", "0.6899509", "0.6813291", "0.67943746", "0.67491615", "0.67185056", "0.6617081", "0.66065913", "0.658787", "0.6560618", "0.6471316", "0.63515043", "0.63313603", "0.62978095", "0.6255875", "0.6246734", "0.6238546", "0.6200532", "0.615621...
0.0
-1
Activates the camera. The canvas will be drawn according to the camera position and scale until camera.off() is called
on() { if (!this.active) { this.p.push(); this.p.scale(this.zoom); this.p.translate(-this.x + this.p.world.hw / this.zoom, -this.y + this.p.world.hh / this.zoom); this.active = true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Init() {\n // Get context handles\n CanvasHandle = document.getElementById(\"canvas\");\n CanvasHandle.width = ratioX * scale;\n CanvasHandle.height = ratioY * scale;\n ContextHandle = CanvasHandle.getContext(\"2d\");\n CanvasWidth = ContextHandle.canvas.clientWidth;\n CanvasHeight = ...
[ "0.7285187", "0.68756026", "0.6855489", "0.6664887", "0.66572964", "0.65980726", "0.65882474", "0.65183896", "0.6493812", "0.6490164", "0.64655685", "0.64650613", "0.64584136", "0.6451031", "0.6436904", "0.63811916", "0.6379562", "0.6360839", "0.63311535", "0.62957096", "0.62...
0.0
-1
Deactivates the camera. The canvas will be drawn normally, ignoring the camera's position and scale until camera.on() is called
off() { if (this.active) { this.p.pop(); this.active = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetCamera()\r\n{\r\n control.reset();\r\n}", "off() {\n\t\t\t\tif (this.active) {\n\t\t\t\t\tcameraPop.call(this.p);\n\t\t\t\t\tthis.active = false;\n\t\t\t\t}\n\t\t\t}", "function stopPreview() {\r\n isPreviewing = false;\r\n\r\n // Cleanup the UI\r\n var previewVidTag = doc...
[ "0.658506", "0.6497503", "0.6454346", "0.63176316", "0.62996215", "0.62899226", "0.62899226", "0.6285392", "0.62831795", "0.6243367", "0.6235605", "0.60777104", "0.60646755", "0.6027615", "0.6012857", "0.60096276", "0.5999399", "0.5989519", "0.59323305", "0.59309286", "0.5920...
0.0
-1
Attempt to autocorrect the user's input. Inheriting classes override this method.
ac(inp) { return inp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function correct(word) {\n \n}", "function processInputCommand()\n {\n var inputText = my.html.input.value\n var goodChars = my.current.correctInputLength\n\n if (inputCommandIs('restart') || inputCommandIs('rst')) {\n location.href = '#restart'\n } else if (inputComman...
[ "0.60294694", "0.5871783", "0.57992005", "0.5740757", "0.5704669", "0.5678286", "0.5678057", "0.5664019", "0.5634184", "0.56306237", "0.55914766", "0.55678153", "0.55529815", "0.5546386", "0.55341995", "0.5522246", "0.5518581", "0.55161273", "0.55161273", "0.5500051", "0.5482...
0.0
-1
end poliline /================================================= /=================================================
function polyline_s_get(shapes_get){ console.log(shapes_get); is_click = 0; for(l=0;l<shapes_get.length;l++) { shapes_get[l] = new google.maps.LatLng(shapes_get[l].lat,shapes_get[l].lon); } map.panTo(shapes_get[0]); flight_Pathh = new google.maps.Polyline({ path: shapes_get, geodesic: true, fillColor:'#41CDF5', fillOpacity : .09 , strokeColor: '#41CDF5', strokeOpacity: 1, strokeWeight: 4 , }); flight_Pathh.setMap(map); if(markers.length > 0) setAllMap(null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function goalLinesClose()\n{\n goalLineDifference = goalLineDifference - 1;\n}", "onLineEnd() { }", "exitParagraph(ctx) {\n\t}", "voidLine() {\r\n\t\treturn null\r\n\t}", "unvoidLine() {\r\n\t\treturn null\r\n\t}", "exitParagraphParameters(ctx) {\n\t}", "exitParagraphParameter(ctx) {\n\t}", "functio...
[ "0.62188065", "0.62069523", "0.6029324", "0.58228755", "0.57981294", "0.57160443", "0.56648725", "0.55986667", "0.5519689", "0.54824555", "0.54824555", "0.545843", "0.545479", "0.5441369", "0.5438032", "0.54349434", "0.54304796", "0.54107267", "0.53996074", "0.5386422", "0.53...
0.0
-1