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
Functions Go to Signup
function profileToggle(){ loginCol.classList.toggle("d-none"); signupCol.classList.toggle("d-none"); signupEmail.value=loginEmail.value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signup(username, password) {\n // TODO: create new user\n}", "function signUp(){\r\n var email = document.getElementById(\"email\");\r\n var password = document.getElementById(\"password\");\r\n //const promise = auth.createUserWithEmailAndPassword(email.value, password.value);\r\n //promise.catch(...
[ "0.7787759", "0.76665205", "0.76568913", "0.7620571", "0.7596127", "0.7596127", "0.7474521", "0.74422026", "0.7407385", "0.73960644", "0.7393686", "0.7358576", "0.7355898", "0.73410326", "0.73321825", "0.73268634", "0.73255634", "0.73199177", "0.7286087", "0.72587436", "0.724...
0.0
-1
Password 2 validation (has to match password 1)
function signupValidatePassword2() { let signupPass2Value = signupPass2.value; if (signupPass2Value.match(signupPass.value) && signupPassValid === true) { signupPass2.className = "form-control is-valid"; signupPass2Valid = true; //console.log("pass2ok"); } else { signupPass2.className = "form-control is-invalid"; signupPass2Valid = false; //console.log("pass2error"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function passwordsMatch(input1, input2) {\n if (input1.value !== input2.value) {\n showError(input2, \"Paswords do not match\");\n }\n}", "function checkPasswordMatch(input1, input2) {\n\tif (input1.value !== input2.value) {\n\t\tshowError(input2, 'Passwords do not match');\n\t}\n}", "function checkPasswo...
[ "0.82231057", "0.8121289", "0.8047425", "0.79598457", "0.7911197", "0.7901465", "0.7889488", "0.7658186", "0.7609218", "0.7566691", "0.75638205", "0.7530028", "0.7473751", "0.7416909", "0.7415139", "0.7383347", "0.7327652", "0.7319845", "0.731709", "0.7277179", "0.7188719", ...
0.6809256
43
Province validation (can't be empty)
function signupValidateProvince() { let signupProvValue = signupProv.value; if (signupProvValue !== "") { signupProv.className = "browser-default custom-select is-valid"; signupProvValid = true; //console.log("provok"); } else { signupProv.className = "browser-default custom-select is-invalid"; signupProvValid = false; //console.log("proverror"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateProvince() {\nlet provValue = prov.value;\nif (provValue != \"\") {\n prov.className = \"browser-default custom-select is-valid\";\n isProvValid = true;\n //console.log(\"provok\");\n} else {\n prov.className = \"browser-default custom-select is-invalid\";\n isProvValid = false;\n ...
[ "0.6978302", "0.6485312", "0.62608373", "0.6251504", "0.62093073", "0.61184615", "0.6112493", "0.6112493", "0.606515", "0.5969102", "0.59423846", "0.592389", "0.5922719", "0.5921367", "0.5905196", "0.5889689", "0.58868885", "0.5867619", "0.5853295", "0.584024", "0.5809986", ...
0.67521983
1
Onsubmit validation only if email and password are valid!
function validateLogin() { if (loginEmailValid === true && loginPassValid === true) { return true; } else { loginValidateEmail(); loginValidatePassword(); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateForm() {\n if (email.value && password.value) {\n fieldvalidate = true;\n } else {\n submit.disabled = true\n submit.classList.add('false');\n }\n}", "function validateFields() {\n\tlname = document.getElementById(\"lname\").value;\n\tfname = document.getElementById...
[ "0.77973723", "0.73340476", "0.729534", "0.72840893", "0.7278112", "0.7206739", "0.7162547", "0.7151993", "0.7134877", "0.7102971", "0.70591193", "0.7054292", "0.70416254", "0.70369434", "0.7016654", "0.69814956", "0.6975606", "0.6973842", "0.694773", "0.69462395", "0.6929474...
0.0
-1
Onsubmit validation only if all are valid, if not, show errors
function validateSignup() { if ( signupEmailValid === true && signupPassValid === true && signupPass2Valid === true && signupProvValid === true ) { return true; } else { signupValidateEmail(); signupValidatePassword(); signupValidatePassword2(); signupValidateProvince(); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validateOnSubmit(e) {\n // validate the entire form\n return this.runValidation(false);\n }", "function validateForm() {\n validateFirstName();\n validateLastName();\n validateStreet();\n validateCity();\n validateZipCode();\n}", "function onSubmitValidation(event) {\r\n var ...
[ "0.7404984", "0.73002553", "0.72314644", "0.72235465", "0.71858704", "0.71672356", "0.7150017", "0.714041", "0.7106865", "0.70938456", "0.705753", "0.7029675", "0.6995237", "0.69675875", "0.69248253", "0.6919939", "0.68882567", "0.6882748", "0.6878283", "0.685837", "0.6856179...
0.0
-1
Render a horizontal bar.
renderBar(studentCount, options = {}) { const scaleFactor = options.scaleFactor || 0.5; const percentage = (studentCount === 0) ? 0 : studentCount * scaleFactor; const width = (percentage > 100) ? '100%' : percentage + '%'; const padding = percentage === 0 ? 0 : 3; const backgroundColor = options.backgroundColor || (percentage > 100 ? '#666' : '#ccc'); const color = percentage > 100 ? 'white' : 'black'; const text = percentage === 0 ? '\u00A0' : studentCount; return <div style={{...styles.bar, padding, width, color, backgroundColor}}>{text}</div>; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function HorizontalBar(props){\n return (\n <div className=\"DataVis-graph-horizontal-bar\" onMouseOver={props.onHover} style={{width: props.width}}>\n {props.label}\n </div>\n );\n}", "function DrawHorizontalBarChart() {\n let chartHeight = (1000/25) * values.length;\n\n\n new Chartist.Bar('#...
[ "0.688223", "0.67351127", "0.66020066", "0.62778544", "0.62000453", "0.61316174", "0.6121383", "0.6013297", "0.6010947", "0.59679705", "0.57191104", "0.5707842", "0.5706709", "0.56823784", "0.56585217", "0.5635633", "0.5634586", "0.5632011", "0.56319195", "0.56319195", "0.562...
0.546268
32
first message for Supervisor
function welcome() { inquirer.prompt([ { name: "action", type: "list", choices: ["View Product Sales By Department", "Create New Department", "Exit"], message: "Please select one of the following options:" }, ]).then(function(response) { if (response.action === "View Product Sales By Department") { viewSales(); } else if (response.action === "Create New Department") { createDepartment(); } else if (response.action === "Exit") { exit(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get firstNewMessage()\n\t{\n\t\treturn true;\n\t}", "function start(msg) {\n return { target: msg.chat.id, message: START_MESSAGE };\n}", "function first () {\n if (!called) {\n called = true;\n const args = Array.from(arguments);\n process.nextTick(function () {\n cb.apply(null, args...
[ "0.6382236", "0.5776285", "0.57412416", "0.5697925", "0.55882126", "0.5566498", "0.55237067", "0.5498378", "0.54861045", "0.5469194", "0.5408982", "0.5403816", "0.536361", "0.53589743", "0.5344426", "0.53336877", "0.53309566", "0.5318209", "0.53169554", "0.53158736", "0.53091...
0.0
-1
VIEW PRODUCT SALES BY DEPARTMENT
function viewSales() { var joinQuery = "SELECT department_id, departments.department_name, over_head_costs," + " SUM(product_sales) AS product_sales," + " SUM(product_sales) - over_head_costs AS total_profit "; joinQuery += "FROM departments INNER JOIN products "; joinQuery += "ON departments.department_name = products.department_name "; joinQuery += "GROUP BY department_id "; connection.query(joinQuery, function(error, results) { if (error) throw error; consoleTableProfit("\nDepartmental Profit", results); welcome(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function viewDeptSales() {\n salesByDept();\n}", "function viewProductSales() {\n connection.query(\n 'SELECT department_id, departments.department_name, over_head_costs, sum(product_sales) as product_sales, sum(product_sales) - over_head_costs as total_profit FROM products right join departments on product...
[ "0.73143655", "0.6945227", "0.67257595", "0.67063105", "0.6671034", "0.64403594", "0.6351933", "0.63117343", "0.6233876", "0.6195034", "0.61863494", "0.6104656", "0.6087469", "0.6056663", "0.59479785", "0.5918486", "0.5865052", "0.5803506", "0.57875526", "0.5777948", "0.57525...
0.68389195
2
console table for adding new dept
function consoleTableDept(title, results) { var values = []; for (var i = 0; i < results.length; i++) { var resultObject = { ID: results[i].department_id, Department: results[i].department_name, over_head_costs: "$" + results[i].over_head_costs.toFixed(2), }; values.push(resultObject); } console.table(title, values); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addDept() {\n prompt([\n {\n type: \"input\",\n name: \"deptName\",\n message: \"New Department Name:\",\n validate: inputStr => {\n if (inputStr) return true;\n else return false;\n }\n },\n ]).then(deptData => {\n db.addDepartment(deptData.deptName)\n ...
[ "0.75624824", "0.71538717", "0.7078191", "0.70726883", "0.70241344", "0.6968065", "0.6941845", "0.69293267", "0.6919195", "0.6898692", "0.6882417", "0.68685496", "0.6844499", "0.68383944", "0.6828091", "0.6820019", "0.6818449", "0.6801586", "0.6767039", "0.67622197", "0.67557...
0.63033473
58
Constructor function creates the object a koopa has two animation sprites, so two images must be refered to in the parameters
constructor(img1, img2, xPos, yPos) { this.img1 = img1; this.img2 = img2; this.xPos = xPos; this.yPos = yPos; this.pic = 1; this.counter = 0; this.frames = 8; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() { //initializes objects within class\n this.sprite = 'images/'; //targets image folder\n this.x = 2;\n this.y = 5;\n }", "create() {\n this.hero = this.matter.add.sprite(this.game.config.width / 2, this.game.config.height / 2, 'hero');\n this.hero.depth = 1200;\n\n this.m...
[ "0.7134549", "0.68747884", "0.6856599", "0.6834679", "0.67721814", "0.6759674", "0.6745981", "0.6735408", "0.6706429", "0.67043114", "0.6691438", "0.6632302", "0.66067713", "0.6601587", "0.65867394", "0.65856683", "0.6576728", "0.6572616", "0.65671897", "0.6563973", "0.652479...
0.74034387
0
Imposta la mappa correntemente visualizzata. Imposta le variabili globali di questo file con le caratteristiche della mappa indicata.
function setCurrentMap(element) { currentMap = element; mapSize = {width:element.style.width.slice(0, -2), height:element.style.height.slice(0, -2)}; refreshServicesLayer(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function indovina(){\n\n gino = get(posIniX, posIniY, beholder.width, beholder.height);\n classifier.classify(gino, gotResult);\n mappa = aCheAssimiglia(gino, daMappare);\n\n}", "function caricaModello() {\n // CARICA MAPPA DISPLACEMENT\n mappaTemp = mappa;\n //mappaTemp.filter(BLUR, oggetto.Smooth);\n\n...
[ "0.5562075", "0.5368311", "0.49783838", "0.4940044", "0.49340236", "0.4899862", "0.48984042", "0.48893934", "0.48822057", "0.48210415", "0.4804024", "0.47807515", "0.47615236", "0.47570205", "0.4729219", "0.47286013", "0.47242296", "0.46756524", "0.46644023", "0.4657177", "0....
0.0
-1
Sposta la mappa in base alla posizione del mouse.
function dragMap(mousePos) { // statusMessage("Mouse:" + mousePos.x + ',' + mousePos.y); // statusObject.innerHTML += ' Da:'+dragObject.offsetLeft+','+dragObject.offsetTop; var new_top = mousePos.y - mouseOffset.y + lastMapPosition.y; var new_left = mousePos.x - mouseOffset.x + lastMapPosition.x; // statusObject.innerHTML += ' D '+(mousePos.x - mouseOffset.x)+','+(mousePos.y - mouseOffset.y); currentMap = dragObject; drawMapAt(new_left, new_top); return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set Mouse0(value) {}", "function mouseMoved() {\n cursor(ARROW);\n opa = 0;\n nomeLocale = '';\n distanzaLocale = '';\n um = '';\n for (var i in localiMilano) {\n localiMilano[i].moved();\n }\n}", "function mousePressed() {\n nuova_poesia();\n}", "set Mouse1(value) {}", "function mouse(kind, pt,...
[ "0.7118633", "0.69903094", "0.69525546", "0.69123244", "0.6824024", "0.67732954", "0.67559654", "0.67509335", "0.6749141", "0.6697264", "0.6687916", "0.66382813", "0.66358054", "0.6582989", "0.6540222", "0.6515328", "0.65101033", "0.6464583", "0.6454228", "0.642441", "0.63971...
0.0
-1
Disegna la mappa ingrandita alla posizione indicata. Se la posizione non e' valida, viene corretta in modo che una parte della mappa sia sempre visibile. Richiede che mapSize e currentMap siano inizializzati.
function drawMapAt(new_left, new_top) { // statusMessage(' A:'+new_left+' / ' + mapSize.width + ' ,'+new_top); // troppo a destra if (-new_left + MAP_AREA_WIDTH > mapSize.width) { new_left = MAP_AREA_WIDTH - mapSize.width; } // troppo a sinistra if (new_left > 0) { new_left = 0; } // troppo in basso if (-new_top + MAP_AREA_HEIGHT > mapSize.height) { new_top = MAP_AREA_HEIGHT - mapSize.height; } // troppo in alto if (new_top > 0) { new_top = 0; } currentMap.style.top = new_top + 'px'; currentMap.style.left = new_left + 'px'; currentMapPosition = {x:new_left, y:new_top}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function indovina(){\n\n gino = get(posIniX, posIniY, beholder.width, beholder.height);\n classifier.classify(gino, gotResult);\n mappa = aCheAssimiglia(gino, daMappare);\n\n}", "function calculateInitialMapNavigatorSettings(){\n\t\tvar mnwMap = $('mnwMap');\n\t\tvar mnwCurrentView = $('mnwCurrentView');\n\t\...
[ "0.5889256", "0.5756008", "0.5748465", "0.5611763", "0.55691624", "0.5565757", "0.55072284", "0.55067295", "0.548058", "0.54759985", "0.54734784", "0.5439932", "0.5439477", "0.5426575", "0.53887004", "0.53814554", "0.53613955", "0.5334128", "0.53325444", "0.5323804", "0.53184...
0.56406814
3
Quando termina il trascinamento della mappa.
function dragMapStop() { if (dragging) { lastMapPosition = currentMapPosition; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "terminating() {}", "function Main() {\n if (currentToken() == \"metodo\") {\n nextToken();\n if (currentToken() == \"principal\") {\n currentMethodId = 'principal';\n nextToken();\n MethodParams(); // Main have empty params list\n if (currentToken() == ':') {\n n...
[ "0.5534917", "0.53917974", "0.53441525", "0.49848086", "0.49381906", "0.49377504", "0.49182162", "0.4916956", "0.488143", "0.48322448", "0.48155698", "0.4804637", "0.47683692", "0.475814", "0.47414905", "0.47344565", "0.47067383", "0.46999332", "0.46943146", "0.46832153", "0....
0.0
-1
Fa apparire il layer corrispondente al servizio selezionato. La mappa attuale e' letta dalla variabile currentMap. Il servizio attivo e' letto dalla variabile activeService.
function refreshServicesLayer() { if ((!currentMap) || (!activeService)) { // Sanity check return; } var currentMapId = currentMap.id; // Accendiamo il solo layer giusto. for (i = 0; i < SERVICES.length; i++) { var service = SERVICES[i]; var element = document.getElementById(currentMapId + "-" + service); if ((SERVICES[i] == activeService) && (element)) { element.style.display = ""; } else { if (element != null) { element.style.display = "none"; } } } // For sui servizi }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iniciarmapa() {\n\t\n\t\n\t\n vector = new OpenLayers.Layer.Vector(\"Vector Layer\", {});\n tapetes = new OpenLayers.Layer.Vector(\"Tapetes Layer\", {});\n carrera.kmlayer = new OpenLayers.Layer.Vector(\"Layer\", {});\n ruta_layer = new OpenLayers.Layer.Vector(); \n\n\t//carrera.geosalida = ne...
[ "0.6041067", "0.58429295", "0.58237344", "0.5769705", "0.57498026", "0.557698", "0.5548231", "0.55145276", "0.5510567", "0.54791963", "0.5475966", "0.54692197", "0.54571754", "0.5453897", "0.540028", "0.53521776", "0.53401756", "0.531895", "0.531619", "0.53136617", "0.5307683...
0.613104
0
Expand the node (with the given child rule) Make children if the node has any
expandChildren(childRule, preventRecursion) { this.children = [] this.finishedText = '' // Set the rule for making children, // and expand it into section this.childRule = childRule if (this.childRule === undefined) { // In normal operation, this shouldn't ever happen this.errors.push('No child rule provided, can\'t expand children') console.warn('No child rule provided, can\'t expand children') } else { const sections = Parser.parse(childRule) // Add errors to this if (sections.errors.length > 0) { this.errors = this.errors.concat(sections.errors) } sections.forEach((section, i) => { this.children[i] = new EpuresNode(this, i, section) if (!preventRecursion) { this.children[i].expand(preventRecursion) } // Add in the finished text this.finishedText += this.children[i].finishedText }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "decorateChildren() {\n this.forEachChild(aChild => {\n var element = this.getDomHelper().getElement(aChild.getId());\n if (element) {\n aChild.decorate(element);\n }\n });\n }", "add_child(node) {\n this.add_child_no_propagation(node);\n this.propagate_children_count(node.get_t...
[ "0.58339405", "0.57834166", "0.5781947", "0.5772468", "0.57266563", "0.56836873", "0.5679065", "0.56179726", "0.56079644", "0.55745816", "0.55084455", "0.5478811", "0.5471258", "0.5459611", "0.5459611", "0.5453229", "0.54441553", "0.5442059", "0.5433409", "0.54229283", "0.539...
0.71496874
0
Expand this rule (possibly creating children)
expand(preventRecursion) { if (!this.isExpanded) { this.isExpanded = true this.expansionErrors = [] // Types of nodes // -1: raw, needs parsing // 0: Plaintext // 1: Tag ("#symbol.mod.mod2.mod3#" or "#[pushTarget:pushRule]symbol.mod") // 2: Action ("[pushTarget:pushRule], [pushTarget:POP]", more in the future) switch (this.type) { // Raw rule case -1: this.expandChildren(this.raw, preventRecursion) break // Plaintext, do nothing but copy text into finsihed text case 0: this.finishedText = this.raw break // Tag case 1: { // Parse to find any actions, and figure out what the symbol is this.preactions = [] this.postactions = [] const parsed = Parser.parseTag(this.raw) // Break into symbol actions and modifiers this.symbol = parsed.symbol this.modifiers = parsed.modifiers // Create all the preactions from the raw syntax parsed.preactions.forEach((preaction, i) => { this.preactions[i] = new NodeAction(this, preaction.raw) }) // Make undo actions for all preactions (pops for each push) this.preactions.forEach(pa => { if (pa.type === 0) { this.postactions.push(pa.createUndo()) } }) // Activate all the preactions this.preactions.forEach(pa => pa.activate()) this.finishedText = this.raw // Expand (passing the node, this allows tracking of recursion depth) const selectedRule = this.grammar.selectRule(this.symbol, this, this.errors) this.expandChildren(selectedRule, preventRecursion) // Apply modifiers this.modifiers.forEach(modName => { let modParams = [] if (modName.indexOf('(') > 0) { const regExp = /\(([^)]+)\)/ const results = regExp.exec(modName) if (results && results.length >= 2) { modParams = results[1].split(',') modName = modName.substring(0, modName.indexOf('(')) } } const mod = this.grammar.modifiers[modName] // Missing modifier? if (mod) { this.finishedText = mod(this.finishedText, modParams) } else { this.errors.push('Missing modifier ' + modName) this.finishedText += '((.' + modName + '))' } }) // Perform post-actions this.postactions.forEach(pa => pa.activate()) break } case 2: // Just a bare action? Expand it! this.action = new NodeAction(this, this.raw) this.action.activate() // No visible text for an action this.finishedText = '' break default: } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "expandChildren(childRule, preventRecursion) {\n this.children = []\n this.finishedText = ''\n\n // Set the rule for making children,\n // and expand it into section\n this.childRule = childRule\n if (this.childRule === undefined) {\n // In normal operation, this shouldn't ever happen\n ...
[ "0.6554786", "0.5971226", "0.5688395", "0.5547575", "0.5547575", "0.5512633", "0.5477365", "0.547535", "0.54587495", "0.5410104", "0.5406938", "0.5370141", "0.53616136", "0.53261757", "0.52407646", "0.51841414", "0.5175142", "0.5163919", "0.516161", "0.51360625", "0.5128049",...
0.60383654
1
Load Game and append to req
function load(req, res, next, id) { Game.get(id).then((game) => { req.game = game; // eslint-disable-line no-param-reassign next(); }).error((e) => next(e)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getGame() {\n return this.__request(`${this.api_url}/game/start`, \"POST\");\n }", "function startGameRequest() {\n\n var create_game_callback = function(json) {\n window.gameID = parseInt(json);\n console.log(\"created new game with gameID: \" + gameID);\n sendToTicker(\"...
[ "0.6211857", "0.6126062", "0.5934646", "0.5840731", "0.5799337", "0.5746652", "0.5663466", "0.56548005", "0.5628111", "0.55975467", "0.55939734", "0.5577671", "0.5568673", "0.55614096", "0.5516825", "0.5513034", "0.54994535", "0.5479766", "0.5471277", "0.5460641", "0.54582477...
0.6873634
0
cache parsed config object
function config () { if (cache) { return cache; } var path = process.cwd() + '/config.json' , content; //load and merge object content = fs.readFileSync(path, 'utf-8'); try { cache = JSON.parse(content); log.info('config file ' + path + ' loaded.'); } catch(e) { log.error('could not parse config file: ' + path); throw e; } return cache; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseConfig (json, cacheKey) {\n var configMap = json.data.configMap;\n var processed = preProcessJson(configMap);\n cache[cacheKey] = processed;\n return processed;\n }", "function getConfig() {\n if (Date.now() - lastCache > 10000) {\n cach...
[ "0.701395", "0.6928701", "0.67437273", "0.6413513", "0.63028", "0.61956316", "0.61699945", "0.608119", "0.599038", "0.59258044", "0.59253776", "0.5915819", "0.59088254", "0.5902001", "0.589082", "0.58899724", "0.587048", "0.5823641", "0.5818629", "0.5812218", "0.5798256", "...
0.7593662
0
import ProjectCard5 from "../projectCard/projectCard5";
function Portfolio() { return ( <div> <Navbar /> <Hero backgroundImage="https://images.wallpaperscraft.com/image/cosmonaut_astronaut_space_suit_137404_3840x2160.jpg"> <h1>Rayna K. Williams</h1> <h2>Full Stack Web Developer</h2> </Hero> <div> <ProjectCard1 /> <ProjectCard2 /> <ProjectCard3 /> <ProjectCard4 /> {/* <ProjectCard5 /> */} </div> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ProjectCard(props) {\n return (\n <Card className=\"project-card-view\">\n <Card.Header className=\"header\">{props.header}</Card.Header>\n <Card.Body >\n <Card.Img src={props.imgPath} className=\"image-card\" /> \n <Card.Title class=\"card-title\">{props.title}</Card.Title>\n...
[ "0.5994047", "0.5911598", "0.5815382", "0.57075834", "0.56326747", "0.5627799", "0.5625638", "0.55765307", "0.55422103", "0.5539443", "0.54699254", "0.54436934", "0.5421947", "0.5317393", "0.53070426", "0.5304003", "0.5299108", "0.52889216", "0.52782947", "0.5244845", "0.5166...
0.48543012
40
Create a new instance
constructor(path, value, uid, id) { this.path = path; this.value = value; this.uid = uid ? uid : null; this.id = id ? id : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static create () {}", "static create(params) {\n return {type: `${this.prefix}${this.name}`, _instance: new this(params)}; //eslint-disable-line\n }", "create() {}", "create() {}", "create () {}", "create () {}", "function _createInstance(instance) {\n return Object.assign({\n ...
[ "0.76954013", "0.7324774", "0.7269754", "0.7269754", "0.7236284", "0.7236284", "0.72130114", "0.7172156", "0.69614613", "0.6917826", "0.68730485", "0.67519486", "0.67519486", "0.67519486", "0.67519486", "0.67519486", "0.67519486", "0.66620797", "0.66467375", "0.661923", "0.66...
0.0
-1
Process this token with a regex and return true if it matched. If possible, extract a uid for this token from the path.
match(id, regex) { var match = false; var matches = this.path.match(regex); if (matches) { this.id = id; if (matches.length > 1) { this.uid = matches[1]; } match = true; } return match; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lookup( path ) {\n\t\t\tvar i, re,\n\t\t\t\tdata = properties[ path.join( \"/\" ) ];\n\n\t\t\tfor ( i in data ) {\n\t\t\t\tre = new RegExp( \"^\" + data[ i ] );\n\t\t\t\tif ( re.test( value ) ) {\n\t\t\t\t\ttoken.value = i;\n\t\t\t\t\treturn tokenRe = new RegExp( data[ i ] );\n\t\t\t\t}\n\t\t\t}\n\t\t\tre...
[ "0.5434234", "0.5110512", "0.49547535", "0.48878807", "0.48615125", "0.4848644", "0.48464763", "0.48126134", "0.47948828", "0.47948828", "0.47633854", "0.47633854", "0.47633854", "0.47633854", "0.4755162", "0.4755162", "0.4755162", "0.4755162", "0.4755162", "0.47479805", "0.4...
0.6581221
0
Create a clone of this token to own
clone() { return new Token(this.path, this.value, this.uid, this.id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clone() {\n\t\tlet data = JSON.parse(JSON.stringify(this.Serialize()));\n\t\treturn new this.constructor(data);\n\t}", "clone() {\n return new this.constructor(this);\n }", "static clone(scope) {\n const newScope = new Scope();\n if (scope) {\n newScope._breadcrumbs = [...scope._breadcrumbs];\n ...
[ "0.6218622", "0.6186806", "0.604567", "0.6034622", "0.60241276", "0.60078615", "0.6001775", "0.6001775", "0.5984051", "0.595189", "0.5838016", "0.58067316", "0.58067316", "0.58067316", "0.58067316", "0.5763902", "0.5749831", "0.5737132", "0.57201767", "0.5717641", "0.5717641"...
0.83719844
0
Used to detect whether the users browser is an mobile browser
function isMobile() { if (sessionStorage.desktop) /* desktop storage */ return false; else if (localStorage.mobile) /* mobile storage */ return true; /* alternative */ var mobile = ['iphone','ipad','android','blackberry','nokia','opera mini','windows mobile','windows phone','iemobile']; for (var i in mobile) if (navigator.userAgent.toLowerCase().indexOf(mobile[i].toLowerCase()) > 0) return true; /* nothing found.. assume desktop */ return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function detectMobile(){\n\tif(navigator.userAgent.match(/Android/i)\n\t\t\t || navigator.userAgent.match(/webOS/i)\n\t\t\t || navigator.userAgent.match(/iPhone/i)\n\t\t\t || navigator.userAgent.match(/iPad/i)\n\t\t\t || navigator.userAgent.match(/iPod/i)\n\t\t\t || navigator.userAgent.match(/BlackBerry/i)\n\t\t\t...
[ "0.8400894", "0.8264003", "0.82547116", "0.8245609", "0.82187575", "0.8198819", "0.8143824", "0.8133033", "0.8125884", "0.8125874", "0.81188077", "0.811613", "0.8099614", "0.8089032", "0.8077295", "0.8068926", "0.8059168", "0.80572224", "0.7996547", "0.7957747", "0.7952642", ...
0.78173405
37
phone book trie class contacts : is an array of contacts in the other they are in trie : is the trie structure with keys as followed
function PhoneBookTrie(){ var t = this; var uuid = 1; t.contacts = []; t.trie = new TrieNode();//prefix $ for address, # for number, @ for name var insertTrieNode = function (key, val){ var cur = t.trie; for (var i = 0; i < key.length; i++){ //already there, then traverse down if (typeof cur.lookup[key[i]] == 'undefined'){ cur.lookup[key[i]] = new TrieNode(); } cur = cur.lookup[key[i]]; } cur.val.push(uuid); } var searchTrieNode = function (key){ var cur = t.trie; for (var i = 0; i < key.length; i++){ if (typeof cur.lookup[key[i]] == 'undefined'){ return [];//nothing like this } cur = cur.lookup[key[i]]; } return cur.val;//return matching uuid } t.add = function (name, phone, address){ t.contacts[uuid] = {name : name, phone : phone, address : address}; //work on the trie; //name name = '@' + name; insertTrieNode(name); //phone phone = '#' + phone; insertTrieNode(phone); //address address = '$' + address; insertTrieNode(address); uuid++; } t.search = function(category, searchTerm){ switch(category.toLowerCase()){ case 'name': searchTerm = '@' + searchTerm; break; case 'phone': searchTerm = '#' + searchTerm; break; case 'address': searchTerm = '$' + searchTerm; break; } var matches = searchTrieNode(searchTerm); //uuid var ret = []; for (var i = 0; i < matches.length; i++){//lookup for contact from uuid for name ret.push(t.contacts[matches[i]]); } return ret; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Trie(){\n\tthis.word = null;\n\tthis.children = {};\n}", "function Trie() {\n\t}", "function trie (arr, itemToTokens) {\n const map = new Map();\n for (const item of arr) {\n const tokens = itemToTokens(item);\n for (const token of tokens) {\n let currentMap = map;\n for (let i = 0; ...
[ "0.58253497", "0.58040035", "0.5803537", "0.56999886", "0.5697964", "0.56910306", "0.5688914", "0.56153136", "0.5470733", "0.54263145", "0.5307313", "0.52863944", "0.5252589", "0.5246136", "0.5243802", "0.522956", "0.51908535", "0.5180295", "0.5177391", "0.5158725", "0.514469...
0.8099619
1
phone book trie class contacts : is an array of contacts in the other they are in trie : is the trie structure with keys as followed
function PhoneBookTrie(){ var t = this; var uuid = 1; t.contacts = []; t.trie = new TrieNode();//prefix $ for address, # for number, @ for name var insertTrieNode = function (key, val){ var cur = t.trie; for (var i = 0; i < key.length; i++){ //already there, then traverse down if (typeof cur.lookup[key[i]] == 'undefined'){ cur.lookup[key[i]] = new TrieNode(); } cur = cur.lookup[key[i]]; } cur.val.push(uuid); } var searchTrieNode = function (key){ var cur = t.trie; for (var i = 0; i < key.length; i++){ if (typeof cur.lookup[key[i]] == 'undefined'){ return [];//nothing like this } cur = cur.lookup[key[i]]; } return cur.val;//return matching uuid } t.add = function (name, phone, address){ t.contacts[uuid] = {name : name, phone : phone, address : address}; //work on the trie; //name name = '@' + name; insertTrieNode(name); //phone phone = '#' + phone; insertTrieNode(phone); //address address = '$' + address; insertTrieNode(address); uuid++; } t.search = function(category, searchTerm){ switch(category.toLowerCase()){ case 'name': searchTerm = '@' + searchTerm; break; case 'phone': searchTerm = '#' + searchTerm; break; case 'address': searchTerm = '$' + searchTerm; break; } var matches = searchTrieNode(searchTerm); //uuid var ret = []; for (var i = 0; i < matches.length; i++){//lookup for contact from uuid for name ret.push(t.contacts[matches[i]]); } return ret; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Trie(){\n\tthis.word = null;\n\tthis.children = {};\n}", "function trie (arr, itemToTokens) {\n const map = new Map();\n for (const item of arr) {\n const tokens = itemToTokens(item);\n for (const token of tokens) {\n let currentMap = map;\n for (let i = 0; i < token.length; i++) {\n ...
[ "0.5824923", "0.58051974", "0.5803916", "0.5700077", "0.5698136", "0.56904846", "0.5688616", "0.5616329", "0.5470682", "0.5427127", "0.5307126", "0.52866936", "0.5253028", "0.5246945", "0.52440655", "0.5229373", "0.5190896", "0.5180394", "0.5176953", "0.5157817", "0.5144703",...
0.8099989
0
Function to create chart containing all collected data for supermarket ready meals
function AllDataChart(){ // Create arrays for our variables let allLabels = []; let allFatData = []; let allSaltData = []; let allCarbohydrateData = []; let allSugarData = []; let allProteinData = []; let allEnergyData = []; // Import csv's with d3 // MORRISONS d3.csv(morrisonsForOne, function(morrisonsForOne) { allLabels.push(morrisonsForOne.Title); allFatData.push(morrisonsForOne.Fat); allEnergyData.push(morrisonsForOne.Energy); allSaltData.push(morrisonsForOne.Salt); allCarbohydrateData.push(morrisonsForOne.Carbohydrate); allSugarData.push(morrisonsForOne.Sugars); allProteinData.push(morrisonsForOne.Protein); }) // SAINSBURYS d3.csv(sainsburysForOne, function(sainsburysForOne) { allLabels.push(sainsburysForOne.Title); allFatData.push(sainsburysForOne.Fat) allEnergyData.push(sainsburysForOne.Energy); allSaltData.push(sainsburysForOne.Salt) allCarbohydrateData.push(sainsburysForOne.Carbohydrate) allSugarData.push(sainsburysForOne.Sugars) allProteinData.push(sainsburysForOne.Protein) }); // WAITROSE d3.csv(waitroseForOne, function(waitroseForOne) { allLabels.push(waitroseForOne.Title); allFatData.push(waitroseForOne.Fat) allEnergyData.push(waitroseForOne.Energy); allSaltData.push(waitroseForOne.Salt) allCarbohydrateData.push(waitroseForOne.Carbohydrate) allSugarData.push(waitroseForOne.Sugars) allProteinData.push(waitroseForOne.Protein) }); // TESCO d3.csv(tescoForOne, function(tescoForOne) { allLabels.push(tescoForOne.Title); allFatData.push(tescoForOne.Fat) allEnergyData.push(tescoForOne.Energy); allSaltData.push(tescoForOne.Salt) allCarbohydrateData.push(tescoForOne.Carbohydrate) allSugarData.push(tescoForOne.Sugars) allProteinData.push(tescoForOne.Protein) }); // Prepare initial chart let chart; d3.csv(tescoForOne, function(tescoForOne) { if (chart) chart.chart.destroy(); chart = new Chart('chart', { type: 'line', options: allProductChatOptions, data: { labels: allLabels, datasets: [ { label:"Salt", data: allSaltData, backgroundColor:"rgba(255, 166, 48, 0.8)" }, { label:"Sugar", hidden:true, data: allSugarData, backgroundColor:"rgba(215, 232, 186, 0.8)" }, { label:"Fat", hidden:true, data: allFatData, backgroundColor:"rgba(255, 99, 143, 0.8)" }, { label:"Protein", hidden:true, data: allProteinData, backgroundColor:"rgba(77, 161, 169, 0.8)" }, { label:"Carbohydrates", hidden:true, data: allCarbohydrateData, backgroundColor:"rgba(255, 138, 138, 0.8)" }, { label:"Calories", hidden:true, data: allEnergyData, backgroundColor:"rgba(255, 126, 46, 0.6)" }, ] } }); }); let allProductChatOptions = { hover: { onHover: function(e) { var point = this.getElementAtEvent(e); if (point.length) e.target.style.cursor = 'pointer'; else e.target.style.cursor = 'default'; } }, plugins: { datalabels: { // hide datalabels for all datasets display: false } }, legend:{ onHover: function(e) { e.target.style.cursor = 'pointer'; }, display:true, labels:{ fontColor: '#FF638F', } }, scales: { yAxes: [{ barThickness: 4, categoryPercentage: 1.0, barPercentage: 1.0, ticks: { fontColor:'#FF638F', display:true, } }], xAxes:[{ ticks:{ display:false } }] } } return( <canvas id="chart"></canvas> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toChartData() {\n let days = [];\n let restaurants = [];\n let dataSetArray = [];\n for (var i = 0; i < this.data.length; i ++) {\n if (!restaurants.includes(this.data[i].name)) {\n restaurants.push(this.data[i].name)\n }\n if (!days.includes(this.data[i].reportDat...
[ "0.6634163", "0.6567358", "0.65666723", "0.65331084", "0.65331084", "0.64904416", "0.64669484", "0.64644897", "0.6441544", "0.6428741", "0.63845015", "0.63683325", "0.6361004", "0.63004786", "0.6286896", "0.62724626", "0.6260908", "0.6251874", "0.6235121", "0.6219837", "0.619...
0.57672846
74
Function for getting an individual file
async function getFile() { const myFile = await fleekStorage.get({ apiKey: 'my-key', apiSecret: 'my-secret', key: 'filename-on-fleek', getOptions: [ 'data', 'bucket', 'key', 'hash', 'publicUrl' ], }) console.log('myFile', myFile) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getFile(id) {\n var file = await db.readDataPromise('file', { id: id })\n return file[0];\n}", "static io_getfile(filename, fcn) {\n if (window.Settings.enableLog)\n WebUtils.log(\"Web.io_getfile({0})\".format(filename));\n Database.getfile(filename, fcn);\n }", ...
[ "0.70690346", "0.68359876", "0.6664836", "0.66529846", "0.6500819", "0.6489748", "0.64168316", "0.6390485", "0.6366067", "0.6346036", "0.6341797", "0.6340426", "0.63265216", "0.6325997", "0.6317268", "0.63048714", "0.62643766", "0.62479764", "0.62321293", "0.6190619", "0.6149...
0.5765054
53
Don't use the .endsWith() method. HELPFUL LINKS: The second argument to substring is the index to stop at (but not include); if missing, goes until the end The second argument to substr is the maximum length to return. USING SUBSTRING() substring(index start (first char to include; here, 6 aka "n"), index end here, substring (71);
function confirmEnding(str, target) { var targetLength = target.length; var ending = str.substring(str.length-targetLength); return ending === target; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function solution(str, ending){\n // TODO: complete\n return str.endsWith(ending)\n}", "function solution(str, ending){\n return str.endsWith(ending)\n}", "function solution(str, ending){\n return str.endsWith(ending);\n}", "function solution(str, ending){\n return str.endsWith(ending);\n}", "...
[ "0.68598336", "0.6857395", "0.68516237", "0.68516237", "0.6783619", "0.6712437", "0.6681021", "0.6626726", "0.651541", "0.650991", "0.6463187", "0.6396401", "0.6368197", "0.6362634", "0.6338008", "0.6320932", "0.6242094", "0.6241597", "0.6241597", "0.62368065", "0.6193008", ...
0.0
-1
input element onchange event handler to update state
onChange(event) { const target = event.target; const value = parseFloat(target.value); const name = target.name; this.setState({ [name]: value, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onchange() {}", "onChange() {\n triggerEvent(this.input, 'input');\n triggerEvent(this.input, 'change');\n }", "function onChange() {\n\n // hide and show input elements for which this is necessary\n setVisibility();\n\n // update preview considering the changed input value\n ...
[ "0.75302863", "0.7425992", "0.7345869", "0.7345869", "0.7336219", "0.73283315", "0.73283315", "0.72238064", "0.70464706", "0.69496524", "0.69446987", "0.69294465", "0.6870009", "0.6857769", "0.68558836", "0.68498194", "0.6823378", "0.681408", "0.6795248", "0.6793949", "0.6790...
0.0
-1
function to calculate monthly payments parameters use desctructuring updates state: output if click event handler is triggered
calculate({ balance, rate, term, period }) { if (rate === 0) { return; } const monthlyInterest = (rate * 0.01) / 12; const months = term * 12; const expression = (1 + monthlyInterest) ** months; const result = balance * ((monthlyInterest * expression) / (expression - 1)); this.setState({ output: ` $${parseFloat(result.toFixed(2))}`, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update() {\n updateMonthly(calculateMonthlyPayment(getCurrentUIValues()));\n}", "function update() {\n calculateMonthlyPayment(values);\n updateMonthly(monthlyPayment);\n }", "function update() {\n const currentReqValues = getCurrentUIValues();\n updateMonthly(calculateMonthlyPayment(currentReqVa...
[ "0.7202287", "0.71418935", "0.6992992", "0.6990123", "0.68399566", "0.68137", "0.6664389", "0.6613709", "0.6575878", "0.6509075", "0.63771534", "0.63621736", "0.63377225", "0.632536", "0.6320026", "0.62468356", "0.6202225", "0.6181071", "0.61758596", "0.61697435", "0.61695105...
0.5439871
44
Define a function to run once for each feature in the features array bind a popup describing the place and time of each earthquake
function onEachFeature(feature, layer) { layer.bindPopup( // for state text "<p class='state-text'>" + feature.properties.place.split(", ")[1] + "</p>" + "<hr>" + "<dl>" + // for location text "<dt class='popUp-title'>Location:</dt>" + "<dd class'popUp-val'>" + feature.properties.place.split(", ")[0] + "</dd>" + "</dt><br>" + // for magnitude text "<dt class='popUp-title'>Magnitude:</dt>" + "<dd class'popUp-val'>" + feature.properties.mag + " Richter</dd>" + "</dt><br>" + // for time text "<dt class='popUp-title'>Time:</dt>" + "<dd class'popUp-val'>" + new Date(feature.properties.time) + " Richter</dd>" + "</dt>\ </dl>" ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onEachFeature(feature, layer) {\n // Give each feature a popup describing the place and time of the earthquake\n layer.bindPopup(`<h3> ${feature.properties.place} </h3> <hr> <p> ${Date(feature.properties.time)} </p>`);\n }", "function onEachFeature(feature, layer) {\n // does this feat...
[ "0.81454265", "0.78756", "0.7781189", "0.7771678", "0.77703357", "0.77654797", "0.7746855", "0.7746748", "0.77016103", "0.7699561", "0.76960605", "0.76880056", "0.76880056", "0.76880056", "0.7685641", "0.7666784", "0.76654994", "0.76651704", "0.76543266", "0.7648453", "0.7642...
0.7179201
46
limpia los valores del formulario
function clearForm() { $('#clave').val(""); $('#usuario').val(""); $('#password').val(""); $("#numeroEmpleado").val("0").change(); $('input[type=search]').val(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getValues() {\n return {\n description: Form.description.value, \n amount: Form.amount.value,\n date: Form.date.value\n }\n }", "getValues() {\n return {\n description: Form.description.value,\n amount: Form.amount.value,\n date: Form.date.value...
[ "0.7252782", "0.70764536", "0.7057447", "0.6885303", "0.6845335", "0.6715986", "0.6630791", "0.660821", "0.65957856", "0.65893555", "0.65828675", "0.6549645", "0.6528558", "0.65275306", "0.6444972", "0.6441563", "0.6396685", "0.6365112", "0.63479525", "0.6329102", "0.6323801"...
0.0
-1
If import is successful, trigger "completed" and reload the page after 800ms.
onSuccess() { Radio.trigger('components/importExport', 'completed'); window.setTimeout(() => document.location.reload(), 800); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadDone() {\n return true;\n }", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "function loadComplete() {\n if (++docsLoad...
[ "0.6418801", "0.63642937", "0.63642937", "0.63642937", "0.63642937", "0.62059766", "0.61288226", "0.6116786", "0.58759737", "0.5859792", "0.58537364", "0.5794822", "0.57850343", "0.57789326", "0.5776228", "0.57382846", "0.57163465", "0.5715653", "0.5713039", "0.5707896", "0.5...
0.7271098
0
:: first: string; last: string;
constructor(first /*: string */, last /*: string */) { this.first = first; this.last = last; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(first, last) {\n this.first = first;\n this.last = last;\n }", "function fullName2(first, last) {\n return first + \" \" + last;\n}", "function printName2(first, last) {\n console.log(first + \" \" + last)\n}", "function combineNames(first,last) {\n return `${first} ${last...
[ "0.6915124", "0.67556626", "0.6513084", "0.63991654", "0.6238873", "0.62131447", "0.6168731", "0.6078372", "0.60631084", "0.60281205", "0.60135126", "0.6004888", "0.58821124", "0.58812714", "0.5870726", "0.58311486", "0.5805098", "0.57619363", "0.57511514", "0.5688302", "0.56...
0.8130865
0
Called when the subscription is ready for use on the server
disconnected() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async onSubConnected() {\n if (process.env.NODE_ENV === \"development\")\n console.log(\"[Subscription] connected\");\n\n this.dispatch(appOperations.setSubscribed({ isSubscribed: true }));\n }", "async initSubscriptions() {\n\n }", "function subscribe(){\n performance.mark('subscribing');\n c...
[ "0.72273105", "0.7138689", "0.70842105", "0.69783443", "0.68616843", "0.68069595", "0.678704", "0.6707494", "0.6694112", "0.6685425", "0.66689354", "0.6645919", "0.663792", "0.6617189", "0.66029894", "0.66022515", "0.65721023", "0.6561352", "0.65561926", "0.655096", "0.650768...
0.0
-1
Called when the subscription has been terminated by the server
received(message) { // Called when there's incoming data on the websocket for this channel return store.dispatch(addMessage(message)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSubscriptionEnded() {\n session = null;\n }", "disconnectedCallback() {\n unsubscribe(this.subscription);\n this.subscription = null;\n }", "async onSubDisconnected() {\n if (process.env.NODE_ENV === \"development\")\n console.log(\"[Subscription] disconnected\");\...
[ "0.80204034", "0.7148923", "0.6761779", "0.6729372", "0.66981536", "0.6585904", "0.6566137", "0.6556459", "0.6505515", "0.6466902", "0.6440199", "0.6437818", "0.642988", "0.6426252", "0.64025134", "0.63683915", "0.6368129", "0.63636863", "0.63636863", "0.63636863", "0.6363267...
0.0
-1
Showing time and date with leading zeros if necessary / Could have been a single function with different variables. Might change that later
function minutes_with_leading_zeros(dt) { return (dt.getMinutes() < 10 ? '0' : '') + dt.getMinutes(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formatTime(time) {\n return (time < 10) ? `0${time}` : time;\n }", "formatTime(time) {\n return (time >= 10) ? time : `0${time}`;\n }", "function addLeadingZeroes(time) {\n if (time < 10) {\n return `0${time}`;\n } else {\n return time;\n }\n }", "function addLeadingZeroes(time) {...
[ "0.7260968", "0.7256906", "0.7228072", "0.7226984", "0.7179556", "0.7161993", "0.71199846", "0.7081905", "0.70445406", "0.70263195", "0.69964427", "0.6972579", "0.6970238", "0.69692755", "0.6968216", "0.69618696", "0.69533634", "0.6921472", "0.6918976", "0.6884001", "0.688030...
0.0
-1
Update the progress of the circle and the values
function updateCircle(){ steps.text = today.adjusted.steps; cals.text = today.adjusted.calories; floors.text = today.adjusted.elevationGain; batteryp.text = battery.chargeLevel; csteps = today.adjusted.steps; ccals = today.adjusted.calories; cfloors = today.adjusted.elevationGain; if(csteps > goal){ cone = 360; }else{ cone = (csteps / goalo)*3.6; }; if(ccals > goalc){ ctwo = 360; }else{ ctwo = (ccals / goalt)*3.6; }; if(cfloors > goalf){ cthree = 360; }else{ cthree = (cfloors / goalth)*3.6; }; arcSweep.sweepAngle = cone; arcSweepC.sweepAngle = ctwo; arcSweepF.sweepAngle = cthree; arcSweepB.sweepAngle = battery.chargeLevel * 3.6; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateProgressCircle(circle, percent){\n circle.removeClass('p'+ percent -1).addClass('p' + percent);\n circle.find('span').text(percent + '%');\n}", "function updateProgress() {\n // To Update Progress Circle\n circles.forEach((circle, index) => {\n if (index < currentActive) {\n circle...
[ "0.7361117", "0.7354367", "0.7085506", "0.7082298", "0.70655334", "0.6890237", "0.68895185", "0.6840408", "0.6812873", "0.6802857", "0.6774821", "0.6729545", "0.66958386", "0.66518766", "0.6579227", "0.6436034", "0.6435063", "0.64039564", "0.6396665", "0.6388138", "0.6374024"...
0.71568716
2
Update time and date
function updateClock() { let today = new Date(); time = hours_with_leading_zeros(today) + ":" + minutes_with_leading_zeros(today); clockLabel.text = time; datum.text = dateview; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTime() {\n let updatedTime = new Date().toLocaleTimeString();\n setTime(updatedTime);\n }", "function updateTime() {\n\n}", "function updateTime() {\n const newTime = new Date().toLocaleTimeString();\n setTime(newTime);\n }", "function updateTime() {\n element.text(dat...
[ "0.76255494", "0.75386393", "0.7446813", "0.7429026", "0.7363747", "0.7363747", "0.7329258", "0.7313451", "0.7299319", "0.72971725", "0.72785825", "0.7238492", "0.7162296", "0.7158282", "0.7142217", "0.71220905", "0.70797336", "0.7063143", "0.7053305", "0.7010975", "0.7005984...
0.6222146
95
========================================================================= LOCAL SIGNUP ============================================================ =========================================================================
function generateHash(password) { return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signup() {\n var email = prompt(\"Give us an email address and\\nwe'll send you news about the site\", '');\n if (email)\n wt_async_request('/bin/subscribe.cgi?email=' + encodeURI_more(email), 'SUBSCRIBE',\n\t\t\t\t\t\tfunction(s) { alert(s.replace(/\\n/g,'') + ' subscribed. Thanks.') });\n}", "fu...
[ "0.5756907", "0.5631831", "0.5578613", "0.54090977", "0.5323717", "0.5322961", "0.5197673", "0.51872665", "0.5182155", "0.51788366", "0.5165768", "0.5165175", "0.5159073", "0.5142282", "0.5130138", "0.5123001", "0.511428", "0.5106195", "0.50906706", "0.50789356", "0.5076671",...
0.0
-1
This function will be used to check if a valid image is selected
function file_com_img(img){ var files=$(img)[0].files; var filename= files[0].name; var extension=filename.substr(filename.lastIndexOf('.')+1); var allowed=["jpg","png","jpeg"]; if(allowed.lastIndexOf(extension)===-1){ $.alert({ title:'Error on file type!', content:'The file type selected is not of jpg , jpeg or png. Please select a valid image/photo', type:'red', typeAnimated:true, buttons:{ ok:{ text:'Ok', btnClass:'btn-red', action:function() { img.value=""; $('#label-span').html('Select photo/image'); /* $('#upload_image_view').attr({src:"assets/img/default-icon-1024.png"}).show(); $('#hidden_pre_div').hide();*/ } } } }); }else{ if(img.files && img.files[0]) { var filereader = new FileReader(); filereader.onload=function(evt) { //Hide the default image/photo //$('#upload_image_view').hide(); //Show the image selected and add an img element to the div element //$('#hidden_pre_div').show().html('<img src="'+evt.target.result+'" width="200" height="200" />'); //set label text $('#label-span').html(''+filename); }; filereader.readAsDataURL(img.files[0]); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_image() {\n var im = document.getElementById(\"image_form\").elements.namedItem(\"image_src\").value;\n\n var image = new Image();\n image.src = im;\n\n image.onload = function() {\n if (this.width > 0) {\n alert(\"IMAGE SRC OK - CLICK 'ADD IMAGE' TO SUBMIT\"); }};\n\n ima...
[ "0.7027609", "0.6980305", "0.6831885", "0.6830929", "0.67566407", "0.674375", "0.67273265", "0.66135293", "0.6603978", "0.65306056", "0.6455938", "0.6424027", "0.6352899", "0.6335041", "0.6302146", "0.63014454", "0.628591", "0.6269516", "0.6265114", "0.6222214", "0.6189747", ...
0.6237262
19
function to update food Stock and last fed time
feedDog() { dog.addImage(happyDog); foodObj.updateFoodStock(foodObj.getFoodStock()-10); database.ref('/').update ({ Food:foodObj.getFoodStock(), FeedTime:hour() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readStock(data){ \n foodS=data.val();\n foodObj.updateFoodStock(foodS);\n } //function to update food stock and last fed time", "function updateStock() {\n\t\t\t\t\t\tupdatedStock = selectedProductDetails.stock_quantity - answer.quantity;\n\t\t\t\t\t}", "function feeddog(x) {\n\ndog.addImage(happ...
[ "0.80084306", "0.6829535", "0.66199505", "0.6589105", "0.6532042", "0.6441472", "0.64410555", "0.64312696", "0.64105386", "0.6395103", "0.6395103", "0.6395103", "0.6395103", "0.6392337", "0.63772297", "0.63665843", "0.63665843", "0.63665843", "0.6350927", "0.63301396", "0.632...
0.6163284
34
Load the current journal entries once the app has mounted
componentDidMount() { $.ajax({ type: "get", url: "/json/journal", dataType: "json", success: (responseData) => { // TESTING - DEV console.log(responseData); // Sort the items by timestamp, newest first let items = responseData.payload; items.sort((a, b) => Math.sign(b.timestamp - a.timestamp)); this.setState({ items: items }) } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static loadJournal() {\n fetch(`${baseURL}/entries`)\n .then(resp => resp.json())\n .then(entries => {\n entries.forEach(entry => {\n let newEntry = new Entry(entry, entry.word, entry.user) \n Entry.all.push(newEntry)\n newEntry.display()\n })\n })\n }", "f...
[ "0.7150386", "0.6580812", "0.62729865", "0.6182427", "0.6159832", "0.6039786", "0.596504", "0.5865863", "0.5851588", "0.58296674", "0.5806959", "0.5750966", "0.56596315", "0.56416476", "0.5625136", "0.56160456", "0.5608297", "0.55814886", "0.5580971", "0.55640674", "0.5548839...
0.0
-1
Set the publicity of a journal entry
setPublicity(id, publicity) { const data = { id: id, public: publicity }; submitDataAsync(data, "journal/publicity", false, (responseData) => { console.log(responseData); if (responseData.success === true) { this.setState(prevState => ({ items: prevState.items.map((item) => { if (item._id.$oid === id) { item.public = publicity; } return item; }) })); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function publish(book){\n// return book.set(\"isPublished\",true);\nreturn produce(book,draftBook=>{ // immer library\n draftBook.isPublished=true;\n})\n}", "_updatePublisher(uPCs) {\t\t\n\t\tvar key = this._loaderAndLoads(uPCs);\t\t\t \n\t\tif(key !== null && uPCs[key].situation === \"CONTRIBUTING\"){\n\...
[ "0.53639084", "0.52458656", "0.51209664", "0.5063708", "0.50479555", "0.50266033", "0.5014022", "0.4914085", "0.4895055", "0.4881235", "0.48652253", "0.48590454", "0.48167673", "0.4793418", "0.47915107", "0.4745217", "0.4693576", "0.46904704", "0.46869975", "0.46375576", "0.4...
0.58801407
0
Delete a journal entry from the list
deleteItem(id) { if (confirm("Delete this entry forever?")) { submitDataAsync({id: id}, "/journal/delete", false, (responseData) => { console.log(responseData); if (responseData.success === true) { this.setState(prevState => ({ items: prevState.items.filter((item) => { return item._id.$oid !== id; }) })); } }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteEntry(ENTRY){\n ENTRY_LIST.splice(ENTRY.id,1)\n updateUI()\n}", "deleteAnEntry() {\n document.querySelector(\".entryLog\").addEventListener(\"click\", function (e) {\n console.log(e.target.id)\n if (event.target.id.startsWith(\"delete-button\")) {\n const entryToDelete = ...
[ "0.76668525", "0.7132705", "0.6908506", "0.66884905", "0.66210204", "0.6615762", "0.65002716", "0.64919823", "0.6340714", "0.6336769", "0.6326799", "0.63260984", "0.6283648", "0.62835544", "0.6263643", "0.6213029", "0.619204", "0.6154836", "0.61360115", "0.6108261", "0.609178...
0.61541134
18
Add a journal entry to the list
handleSubmit(e) { e.preventDefault(); if (this.state.text.length === 0) { return; } const newItem = { text: this.state.text, latitude: 0, longitude: 0 }; submitDataAsync(newItem, "/journal/add", true, (responseData) => { console.log(responseData); // Add the item to the front of the list this.setState(prevState => ({ items: [responseData.payload].concat(prevState.items), text: '', public: false })); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static addEntryToList(entry) {\n const list = document.querySelector('#journal-list');\n\n const row = document.createElement('tr');\n\n row.innerHTML = `\n <td>${entry.date}</td>\n <td>${entry.title}</td>\n <td>${entry.post}</td>\n `;\n\n list.ap...
[ "0.71372205", "0.65638274", "0.6483626", "0.64641976", "0.63878584", "0.63791764", "0.62874204", "0.62684035", "0.62009656", "0.61697346", "0.6137324", "0.61347187", "0.6066048", "0.6061513", "0.6051595", "0.60349727", "0.6009567", "0.6007311", "0.5967642", "0.5959905", "0.59...
0.0
-1
create moons and rocks
function createMoons() { let bright = new THREE.MeshBasicMaterial({ color: accentColor }); let dark = new THREE.MeshBasicMaterial({ color: mainColor }); let rockGeometry = new THREE.SphereGeometry(0.05, 20, 20); let moonGeometry = new THREE.SphereGeometry(0.08, 25, 25); let moons = new THREE.Group(); let rock1 = new THREE.Mesh(rockGeometry.clone(), bright); rock1.position.set(-1.3, 0, -0.3); moons.add(rock1); let rock2 = new THREE.Mesh(rockGeometry.clone(), bright); rock2.position.set(-0.9, 0.4, -0.8); moons.add(rock2); let rock3 = new THREE.Mesh(rockGeometry.clone(), bright); rock3.position.set(0.9, -0.2, 0.3); moons.add(rock3); let rock4 = new THREE.Mesh(rockGeometry.clone(), bright); rock4.position.set(0.9, 0.3, -0.8); moons.add(rock4); let rock5 = new THREE.Mesh(rockGeometry.clone(), bright); rock5.position.set(-1.5, 0.2, 0.5); moons.add(rock5); let rock6 = new THREE.Mesh(rockGeometry.clone(), bright); rock6.position.set(-0.9, -0.4, 0.8); moons.add(rock6); let moon1 = new THREE.Mesh(moonGeometry.clone(), dark); moon1.position.set(-1.2, 0.2, -0.7); moons.add(moon1); let moon2 = new THREE.Mesh(moonGeometry.clone(), dark); moon2.position.set(0.5, 0.2, -1.6); moons.add(moon2); let moon3 = new THREE.Mesh(moonGeometry.clone(), dark); moon3.position.set(1.2, 0.2, 0.7); moons.add(moon3); let moon4 = new THREE.Mesh(moonGeometry.clone(), dark); moon4.position.set(-1.5, -0.8, 0.7); moons.add(moon4); return moons; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "makeMoons(lib) {\n for (var i=0;i<7;i++) {\n let newMoon = {\n s: Math.random()*12,\n x: Math.random()*(lib.width),\n y: lib.randomNumber(50, lib.height - 50),\n r: 62+lib.randomNumber(0,50),\n g: 39+lib.randomNumber(0,30)...
[ "0.6811464", "0.63147223", "0.627289", "0.6015108", "0.5972452", "0.5929267", "0.58844453", "0.5877934", "0.5832125", "0.578988", "0.5777931", "0.57223433", "0.57140654", "0.5670986", "0.5625472", "0.5624902", "0.56245315", "0.5621228", "0.55639887", "0.5531652", "0.5520419",...
0.678634
1
create the planets texture
function createTexture() { let dashTextureCanvas = document.createElement('canvas'); let ctx = dashTextureCanvas.getContext('2d'); dashTextureCanvas.width = 1024; dashTextureCanvas.height = 1024; let lineThickness = 26; ctx.fillStyle = backgroundColorS; ctx.fillRect(0, 0, dashTextureCanvas.width, dashTextureCanvas.height); ctx.lineWidth = lineThickness; ctx.lineCap = 'round'; ctx.strokeStyle = mainColorS; ctx.beginPath(); let ammoutOfRows = dashTextureCanvas.height / lineThickness - 4; let middle = Math.floor(ammoutOfRows / 2) + 2; for (let i = -middle - 1; i < middle; i += 3) { let level = arcify(i) / 150 + 1; let currentLength = randomBetween(20, 130), topOffset = (i + middle) * lineThickness; while (true) { ctx.moveTo(currentLength, topOffset); let to = currentLength += randomBetween(50, 170) / level; if (to + 5 < dashTextureCanvas.width) ctx.lineTo(to, topOffset); else break; currentLength += randomBetween(70, 150); } } ctx.stroke(); return dashTextureCanvas; function randomBetween(small, large) { return (Math.random() * large | 0) + small; } function arcify(x) { if (x == 0) return Math.pow(x + 2, 2); else return Math.pow(Math.abs(x), 2) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createTilesetsAndWaterTextures() {\n let tilesets = this.tilesetTextures;\n let tilesetsCount = tilesets.length;\n let canvas = document.createElement('canvas');\n let ctx = canvas.getContext('2d');\n\n canvas.width = 2048;\n canvas.height = 64 * (tilesetsCount + 1); // 1 is added for a black til...
[ "0.6824247", "0.68157905", "0.6758097", "0.67094475", "0.6596511", "0.6484472", "0.6419287", "0.63978904", "0.6377019", "0.63676596", "0.63548845", "0.6346432", "0.63142586", "0.62737244", "0.6256454", "0.62202555", "0.6203168", "0.61902535", "0.6177953", "0.6170509", "0.6165...
0.0
-1
Counts the length of the chars.
function charCount(char_count, value, max_length) { const lng = value.length; const remainingLengthInPercentage = lng / max_length * 100; char_count.hide(); if (remainingLengthInPercentage > 80) { char_count.show(); char_count.html(lng + ' van de 100 maximale karakters') } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function charactersOccurencesCount() {\n \n}", "function charactersOccurencesCount() {\n \n}", "function charactersOccurencesCount() {\n \n}", "function charactersOccurencesCount() {\n \n}", "function charactersOccurencesCount() {\n\n}", "function charactersOccurencesCount() {\n\n}", "function char...
[ "0.7814583", "0.7814583", "0.7814583", "0.7814583", "0.7699608", "0.7699608", "0.7699608", "0.7699608", "0.7699608", "0.7654744", "0.7489463", "0.7466491", "0.7422657", "0.7316714", "0.70430076", "0.69747096", "0.6937205", "0.6907629", "0.690308", "0.6806129", "0.6802802", ...
0.0
-1
Checks if the passwords are equal.
function checkPasswordMatch() { const password = $("#password").val(); const confirmPassword = $("#password2").val(); const feedback = $("#divCheckPasswordMatch"); if (password !== confirmPassword) { feedback.html("Wachtwoorden zijn niet gelijk!").removeClass('text-success').addClass('text-danger'); return; } feedback.html("Wachtwoorden zijn gelijk.").removeClass('text-danger').addClass('text-success'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkPasswordsMatch() {\n\tif (password.value !== confirmPassword.value) {\n\t\tshowError(confirmPassword, 'Passwords do not match')\n\t}\n}", "function comparePassword() {\n\t\tvar newPassword = $(\"#txtNewPassword\").val();\n\t\tvar newPasswordConfirm = $(\"#txtNewPasswordConfirm\").val();\n\t\t// com...
[ "0.76633227", "0.7540629", "0.75229776", "0.7435838", "0.74159724", "0.7369158", "0.73600066", "0.7355525", "0.7290427", "0.7289019", "0.72394514", "0.7204006", "0.7195499", "0.71844983", "0.7146898", "0.71146715", "0.6984364", "0.69512767", "0.6944213", "0.6938736", "0.69235...
0.7202244
12
console.log("feature collection is", featureCollection);
function closeUnclosedCoastlineFeatures(featureCollection) { featureCollection.features.filter(NOT(isClosed)).forEach(function(feature) { console.log("unclosed coastline:", feature); var lineCoordinates = feature.geometry.coordinates[0]; var bounds = lineCoordinates.reduce(function(prev, cur) { if (cur[0] < prev.left) { prev.left = cur[0]; } if (cur[0] > prev.right) { prev.right = cur[0]; } if (cur[1] < prev.bottom) { prev.bottom = cur[1]; } if (cur[1] > prev.top) { prev.top = cur[1]; } return prev; }, {left: Number.MAX_VALUE, right: -Number.MAX_VALUE, bottom: Number.MAX_VALUE, top: -Number.MAX_VALUE}); console.log("bounded by", bounds); var startPoint = lineCoordinates[0]; var endPoint = lineCoordinates[lineCoordinates.length-1]; var boundOrder = ['bottom', 'left', 'top', 'right']; function closestBound(lonlat) { var distances = boundOrder.map(function(boundKey) { switch (boundKey) { case 'left': case 'right': return Math.abs(lonlat[0] - bounds[boundKey]); case 'bottom': case 'top': return Math.abs(lonlat[1] - bounds[boundKey]); } }); var shortestIndex = distances.reduce(function(shortestIndex, distance, index) { return distance < distances[shortestIndex] ? index : shortestIndex; }, 0); console.log("distances are", distances, "shortest at", shortestIndex); return boundOrder[shortestIndex]; } var endPointClosestBound = closestBound(endPoint); var startPointClosestBound = closestBound(startPoint); var boundIndex = boundOrder.indexOf(endPointClosestBound); console.log("closest bounds are", endPointClosestBound, "to", startPointClosestBound, "; starting at index", boundIndex); var boundTrack = []; while (boundOrder[boundIndex] != startPointClosestBound) { boundTrack.push(boundOrder[boundIndex]); boundIndex = (boundIndex + 1) % boundOrder.length; if (boundTrack.length > boundOrder.length * 2) { // there was an error here. break; } } boundTrack.push(boundOrder[boundIndex]); console.log("will track bounds", boundTrack); function closestPointOnBound(fromPoint, bound) { switch(bound) { case 'left': case 'right': return [bounds[bound], fromPoint[1]]; case 'bottom': case 'top': return [fromPoint[0], bounds[bound]]; } } boundTrack.forEach(function(boundName) { lineCoordinates.push(closestPointOnBound(lineCoordinates[lineCoordinates.length-1], boundName)); }); lineCoordinates.push(lineCoordinates[0]); }); return featureCollection; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function og(){ci()(this,{$featuresCollection:{enumerable:!0,get:this.getFeaturesCollection}})}", "function fc() {\n return {\n type: 'FeatureCollection',\n features: []\n };\n }", "constructor() {\n this.features_ = {};\n }", "toJson() {\n return {\n type: \"featu...
[ "0.71069616", "0.6663685", "0.6510594", "0.6262348", "0.62418085", "0.62418085", "0.61887753", "0.6051434", "0.603166", "0.59492934", "0.59492934", "0.5942334", "0.5939428", "0.59221935", "0.5912105", "0.5897768", "0.5884864", "0.5865433", "0.5819898", "0.58147013", "0.576327...
0.0
-1
Create the Repository Class
function AccountTypeRepository(modelDefinition, config, defaultAppMode, dataSourceFactory, injectedDataSource) { BaseRepository.call(this, modelDefinition, config, defaultAppMode, dataSourceFactory, injectedDataSource); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createRepo() {\n taskRepo = new Object();\n return taskRepo\n }", "function RepositoryWrapper(manager, metadata) {\n\t\t\t\t\tRepository.apply(this, [manager, metadata]);\n\n\t\t\t\t\t// this allows user defined repositories to ignore the manager and metadata in their constructors\n\t\t\t\t\trepo...
[ "0.7140641", "0.63237435", "0.62711453", "0.626653", "0.6218414", "0.61922383", "0.6171869", "0.6159824", "0.6129383", "0.61080146", "0.5963476", "0.58927727", "0.5882506", "0.5851852", "0.5781349", "0.5745824", "0.5718264", "0.56675553", "0.56675553", "0.56277126", "0.562523...
0.5260335
39
Starts an express server for slash commands
function startServer (config, controller) { // TODO port will be required for multi-team auth if (config.port) { controller.setupWebserver(config.port) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "startWebServer() {\n express.listen(this.master.CLA.port, () => console.log(`Running on port ${this.master.CLA.port}`))\n this.loadRoutes()\n }", "function startServer () {\n // Enable CORS for all requests\n app.use(require('cors')());\n\n // Note: the order which we add middleware to Expres...
[ "0.7082146", "0.7027671", "0.6897448", "0.67825377", "0.66946405", "0.66768146", "0.6635018", "0.6613002", "0.6612314", "0.65605867", "0.649937", "0.64574367", "0.6403853", "0.63922787", "0.63824445", "0.63772255", "0.6366926", "0.63656735", "0.63492167", "0.6319437", "0.6311...
0.0
-1
Adds all help listeners for plugins
function addHelpListeners (controller, plugins) { _.forEach(plugins, function (plugin) { if (_.get(plugin, 'help.text') && _.get(plugin, 'help.command')) { registerHelpListener(controller, plugin.help) } }) controller.hears('^help$', 'direct_mention,direct_message', function (bot, message) { let helpCommands = _.chain(plugins) .filter((plugin) => !!_.get(plugin, 'help.command')) .map((plugin) => '`@' + bot.identity.name + ' help ' + _.get(plugin, 'help.command') + '`') .value() .join('\n') if (!helpCommands.length) { return bot.reply(message, 'I can\'t help you with anything right now. I still like you though :heart:') } return bot.reply(message, 'Here are some things I can help you with:\n' + helpCommands) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function registerHelpListener (controller, helpInfo) {\n controller.hears('^help ' + helpInfo.command + '$', 'direct_mention,direct_message', function (bot, message) {\n let replyText = helpInfo.text\n\n if (typeof helpInfo.text === 'function') {\n let helpOpts = _.merge({botName: bot.identity.name}, _...
[ "0.6600582", "0.61788136", "0.61536866", "0.61536866", "0.61066115", "0.59435326", "0.5918944", "0.58046377", "0.57392347", "0.57364315", "0.5709877", "0.5705624", "0.5668277", "0.5662392", "0.5646811", "0.56132394", "0.5595348", "0.5594614", "0.5583859", "0.55775535", "0.557...
0.75997305
0
Adds a single help listener for a plugin
function registerHelpListener (controller, helpInfo) { controller.hears('^help ' + helpInfo.command + '$', 'direct_mention,direct_message', function (bot, message) { let replyText = helpInfo.text if (typeof helpInfo.text === 'function') { let helpOpts = _.merge({botName: bot.identity.name}, _.pick(message, ['team', 'channel', 'user'])) replyText = helpInfo.text(helpOpts) } bot.reply(message, replyText) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addHelpListeners (controller, plugins) {\n _.forEach(plugins, function (plugin) {\n if (_.get(plugin, 'help.text') && _.get(plugin, 'help.command')) {\n registerHelpListener(controller, plugin.help)\n }\n })\n\n controller.hears('^help$', 'direct_mention,direct_message', function (bot, messa...
[ "0.676042", "0.5684966", "0.566419", "0.5652563", "0.56465024", "0.5621818", "0.55474514", "0.5544842", "0.55405694", "0.5535002", "0.5513129", "0.551219", "0.5512027", "0.55072033", "0.5464571", "0.54353446", "0.5431577", "0.5414223", "0.53818804", "0.5356573", "0.5350121", ...
0.72513807
0
Convenience method to log errors
function logError (controller, err, message) { controller.log(message) controller.log(err) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static logError(error) {\r\n console.log(`[ERROR] Something did not work - \\n`, error);\r\n }", "function logError (err) {\n util.log('error:', err)\n}", "function error() {\n var args = [];\n for (var _i = 0; _i < (arguments.length - 0); _i++) {\n args[_i] = arguments[_i + 0];\n...
[ "0.7693803", "0.7652971", "0.7643914", "0.75835603", "0.7496876", "0.74918157", "0.7420783", "0.74180055", "0.7405857", "0.738006", "0.73769176", "0.7319415", "0.7318267", "0.72418493", "0.72299457", "0.71783066", "0.7147489", "0.7111585", "0.7104678", "0.70816344", "0.707447...
0.71208805
17
update jump velocity after time dt
update(entity,dt,level,audioContext){ //gravity entity.velocity.y +=this.acc_y * dt; if(this.requestTime >0){ if(this.ready){ entity.audio.playAudio('jump'); this.jumpTime=this.duration; this.requestTime =0; } this.requestTime-= entity.mass *dt; } if(this.jumpTime>0){ //entity.velocity.y -= entity.acc; entity.velocity.y -= this.jump_velocity; //jump upward this.jumpTime -= entity.mass * dt; } //when update the new entity, set to false this.ready=false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "jump() {\n if(this.onGround) {\n this.vy -= jumpVelocity;\n this.onGround = false;\n }\n }", "jump() {\n this.time = -this.terminalVelocity;\n }", "function jump() {\n\n //instant increase in velocity Y (go up)\n player.velY = -2 * player.speed;\n playe...
[ "0.75887346", "0.75862485", "0.7338045", "0.71538514", "0.7147042", "0.7084217", "0.6947548", "0.6868959", "0.6847015", "0.6834792", "0.6817516", "0.6794661", "0.6750414", "0.67262256", "0.67002475", "0.6692113", "0.66456205", "0.663781", "0.658576", "0.6556035", "0.6554303",...
0.6908547
7
The internal function to add a class to a DOM element.
function _addClass(element, className) { var classes; classes = element.className.split(' '); if (classes.indexOf(className) === -1) { classes.push(className); element.className = classes.join(' ').trim(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addClass(element, cls) {\n element.classList.add(cls);\n}", "setClass(el, classname) {\n el.className += ' ' + classname;\n }", "function addClass(element, cls) {\n element.className +=cls+' ';\n}", "function elementAddClass(className, selector) {\n$(selector).addClass(className);\n}", "...
[ "0.7825334", "0.77965605", "0.7680096", "0.7647689", "0.7637954", "0.7637954", "0.76291764", "0.75559247", "0.75420535", "0.75338197", "0.7506034", "0.7454994", "0.74348986", "0.7432446", "0.7429004", "0.7427031", "0.74059147", "0.74036837", "0.73846084", "0.7379288", "0.7368...
0.7347343
22
return bytes.reduce((p, b) => p + String.fromCharCode(b), "");
function byteArrayToString(bytes) { var str = ""; if (bytes != null && bytes != undefined) { for (var i = 0; i < bytes.length; i++) { str += String.fromCharCode(bytes[i]); } } return str; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bytesToString(bytes) {\r\n\t let s = '';\r\n\t for (let i = 0; i < bytes.length; i += 1) {\r\n\t s += String.fromCharCode(bytes[i]);\r\n\t }\r\n\r\n\t return s;\r\n\t}", "function convertBytesToString ( bytes ) {\n\n var string = [],\n pos = 0,\n c = 0;\n\n while (\n po...
[ "0.6726667", "0.66859424", "0.66396517", "0.6450776", "0.6441175", "0.64235175", "0.6371401", "0.63028675", "0.63011664", "0.62464905", "0.62334573", "0.62299293", "0.62299293", "0.6228888", "0.6228888", "0.6228888", "0.6208565", "0.6207479", "0.61998975", "0.61775684", "0.61...
0.5895658
65
Taken from 6th grade algebra
function distance(x1, y1, x2, y2) { return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function es( g , nu )\n {\n\n return ( k( g , nu ) + ((4.0 / 3.0) * g) );\n\n }", "function R(e, t, n, r, o, i, a, s) {\n for (var u, l, c, p, d, f, h, m, g = [], v = [ [], [] ], y = 0; y < 2; ++y) if (0 == y ? (l = 6 * e - 12 * n + 6 * o, \n u = -3 * e + 9 * n - 9 * o + 3 * a, c = 3 * n -...
[ "0.5923579", "0.5816902", "0.57825613", "0.57713246", "0.57466793", "0.57118165", "0.5699939", "0.56855327", "0.56742805", "0.56238", "0.56213313", "0.5586164", "0.5578137", "0.5578004", "0.55747837", "0.5571238", "0.5540127", "0.5514773", "0.5511776", "0.5507228", "0.5498045...
0.0
-1
Attempts to locate an alignment pattern in a limited region of the image, which is guessed to contain it. overallEstModuleSize estimated module size so far estAlignmentX coordinate of center of area probably containing alignment pattern estAlignmentY y coordinate of above allowanceFactor number of pixels in all directions to search from the center
function findAlignmentInRegion(overallEstModuleSize, estAlignmentX, estAlignmentY, allowanceFactor, image) { estAlignmentX = Math.floor(estAlignmentX); estAlignmentY = Math.floor(estAlignmentY); // Look for an alignment pattern (3 modules in size) around where it should be var allowance = Math.floor(allowanceFactor * overallEstModuleSize); var alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance); var alignmentAreaRightX = Math.min(image.width, estAlignmentX + allowance); if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { return null; } var alignmentAreaTopY = Math.max(0, estAlignmentY - allowance); var alignmentAreaBottomY = Math.min(image.height - 1, estAlignmentY + allowance); return alignment_finder_1.findAlignment(alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, image); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AlignmentPattern(posX, posY, estimatedModuleSize)\r\n{\r\n\tthis.x=posX;\r\n\tthis.y=posY;\r\n\tthis.count = 1;\r\n\tthis.estimatedModuleSize = estimatedModuleSize;\r\n\t\r\n\tthis.__defineGetter__(\"EstimatedModuleSize\", function()\r\n\t{\r\n\t\treturn this.estimatedModuleSize;\r\n\t}); \r\n\tthis.__de...
[ "0.6874053", "0.66919404", "0.66338426", "0.6466172", "0.57354194", "0.5114524", "0.5044666", "0.48943785", "0.48560306", "0.47541577", "0.46912557", "0.46429765", "0.46381676", "0.46337447", "0.46068656", "0.45935106", "0.45466596", "0.45453006", "0.45367014", "0.44856912", ...
0.818658
0
Computes the dimension (number of modules on a size) of the QR Code based on the position of the finder patterns and estimated module size.
function computeDimension(topLeft, topRight, bottomLeft, moduleSize) { var tltrCentersDimension = Math.round(distance(topLeft.x, topLeft.y, topRight.x, topRight.y) / moduleSize); var tlblCentersDimension = Math.round(distance(topLeft.x, topLeft.y, bottomLeft.x, bottomLeft.y) / moduleSize); var dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7; switch (dimension & 0x03) { // mod 4 case 0: dimension++; break; // 1? do nothing case 2: dimension--; break; } return dimension; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeDimension(topLeft, topRight, bottomLeft, matrix) {\n var moduleSize = (sum(countBlackWhiteRun(topLeft, bottomLeft, matrix, 5)) / 7 + // Divide by 7 since the ratio is 1:1:3:1:1\n sum(countBlackWhiteRun(topLeft, topRight, matrix, 5)) / 7 +\n sum(countBlackWhiteRun(bottomLeft, topLef...
[ "0.65384746", "0.60086787", "0.5908827", "0.5684075", "0.5587406", "0.54986596", "0.54790145", "0.5448537", "0.53718317", "0.53554606", "0.53298867", "0.5306322", "0.5273099", "0.526163", "0.5245542", "0.5222601", "0.517767", "0.51723564", "0.51645786", "0.5144787", "0.513965...
0.62702376
1
Deduces version information purely from QR Code dimensions.
function getProvisionalVersionForDimension(dimension) { if (dimension % 4 != 1) { return null; } var versionNumber = (dimension - 17) >> 2; if (versionNumber < 1 || versionNumber > 40) { return null; } return version_1.getVersionForNumber(versionNumber); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "decideVersion(){\n var length = messageString.length;\n for(var i = 0; i < 40; i++){\n if(character_capacities[i] >= length){\n qrVersion = i + 1;\n break;\n }\n }\n }", "allocateFormatAndVersionInformation() {\n for (let i = 0; i...
[ "0.61766094", "0.5745111", "0.54826546", "0.54667926", "0.5380512", "0.53733057", "0.5328263", "0.5227578", "0.5225389", "0.5190459", "0.5170953", "0.515189", "0.5143611", "0.5141125", "0.51349056", "0.51349056", "0.51349056", "0.51349056", "0.51042026", "0.5073934", "0.50547...
0.5416508
4
This method traces a line from a point in the image, in the direction towards another point. It begins in a black region, and keeps going until it finds white, then black, then white again. It reports the distance from the start to this point. This is used when figuring out how wide a finder pattern is, when the finder pattern may be skewed or rotated.
function sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY, image) { fromX = Math.floor(fromX); fromY = Math.floor(fromY); toX = Math.floor(toX); toY = Math.floor(toY); // Mild variant of Bresenham's algorithm; // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm var steep = Math.abs(toY - fromY) > Math.abs(toX - fromX); if (steep) { var temp = fromX; fromX = fromY; fromY = temp; temp = toX; toX = toY; toY = temp; } var dx = Math.abs(toX - fromX); var dy = Math.abs(toY - fromY); var error = -dx >> 1; var xstep = fromX < toX ? 1 : -1; var ystep = fromY < toY ? 1 : -1; // In black pixels, looking for white, first or second time. var state = 0; // Loop up until x == toX, but not beyond var xLimit = toX + xstep; for (var x = fromX, y = fromY; x != xLimit; x += xstep) { var realX = steep ? y : x; var realY = steep ? x : y; // Does current pixel mean we have moved white to black or vice versa? // Scanning black in state 0,2 and white in state 1, so if we find the wrong // color, advance to next state or end if we are in state 2 already if ((state == 1) === image.get(realX, realY)) { if (state == 2) { return distance(x, y, fromX, fromY); } state++; } error += dy; if (error > 0) { if (y == toY) { break; } y += ystep; error -= dx; } } // Found black-white-black; give the benefit of the doubt that the next pixel outside the image // is "white" so this last point at (toX+xStep,toY) is the right ending. This is really a // small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this. if (state == 2) { return distance(toX + xstep, toY, fromX, fromY); } // else we didn't find even black-white-black; no estimate is really possible return NaN; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function line(x0, y0, x1, y1) {\n let dx = Math.abs(x1-x0);\n let dy = Math.abs(y1-y0);\n let sx = (x0 < x1) ? 1 : -1; // Step direction for pixels\n let sy = (y0 < y1) ? 1 : -1;\n let err = dx-dy; // Keep track of err as we go\n console.log(dx, dy);\n\n while(true) {\n ...
[ "0.62139547", "0.61954993", "0.6179459", "0.60642296", "0.60226446", "0.59796935", "0.5974374", "0.5972752", "0.5943547", "0.59431183", "0.58777785", "0.5847808", "0.5822344", "0.58144855", "0.5797529", "0.57889766", "0.57707244", "0.57664996", "0.5708701", "0.5691311", "0.56...
0.5739863
18
Computes the total width of a finder pattern by looking for a blackwhiteblack run from the center in the direction of another point (another finder pattern center), and in the opposite direction too.
function sizeOfBlackWhiteBlackRunBothWays(fromX, fromY, toX, toY, image) { var result = sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY, image); // Now count other way -- don't run off image though of course var scale = 1; var otherToX = fromX - (toX - fromX); if (otherToX < 0) { scale = fromX / (fromX - otherToX); otherToX = 0; } else if (otherToX >= image.width) { scale = (image.width - 1 - fromX) / (otherToX - fromX); otherToX = image.width - 1; } var otherToY = (fromY - (toY - fromY) * scale); scale = 1; if (otherToY < 0) { scale = fromY / (fromY - otherToY); otherToY = 0; } else if (otherToY >= image.height) { scale = (image.height - 1 - fromY) / (otherToY - fromY); otherToY = image.height - 1; } otherToX = (fromX + (otherToX - fromX) * scale); result += sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY, image); return result - 1; // -1 because we counted the middle pixel twice }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countBlackWhiteRun(origin, end, matrix, length) {\n var rise = end.y - origin.y;\n var run = end.x - origin.x;\n var towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2));\n var awayFromEnd = countBlackWhiteRunTowardsPoint(origin, { x: origin.x - run, y: origi...
[ "0.649426", "0.62279093", "0.5698632", "0.5365985", "0.527906", "0.527906", "0.52629113", "0.5153313", "0.5132754", "0.51157504", "0.50945956", "0.50812924", "0.5035681", "0.5011034", "0.50109863", "0.49814257", "0.49036807", "0.48977312", "0.48894203", "0.4883083", "0.487474...
0.6303991
1
Computes an average estimated module size based on estimated derived from the positions of the three finder patterns.
function calculateModuleSize(topLeft, topRight, bottomLeft, image) { return (calculateModuleSizeOneWay(topLeft, topRight, image) + calculateModuleSizeOneWay(topLeft, bottomLeft, image)) / 2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeDimension(topLeft, topRight, bottomLeft, moduleSize) {\r\n\t\t var tltrCentersDimension = Math.round(distance(topLeft.x, topLeft.y, topRight.x, topRight.y) / moduleSize);\r\n\t\t var tlblCentersDimension = Math.round(distance(topLeft.x, topLeft.y, bottomLeft.x, bottomLeft.y) / moduleSize);\r\...
[ "0.57280034", "0.5540435", "0.53792703", "0.52424026", "0.5117586", "0.5117586", "0.5070961", "0.5068654", "0.50404084", "0.49998394", "0.49994612", "0.49917972", "0.4977473", "0.49752748", "0.49266025", "0.4909818", "0.4899954", "0.48816302", "0.48655826", "0.48574534", "0.4...
0.5978173
0
returns true if the proportions of the counts is close enough to the 1/1/1 ratios used by alignment patterns to be considered a match
function foundPatternCross(stateCount, moduleSize) { var maxVariance = moduleSize / 2; for (var i = 0; i < 3; i++) { if (Math.abs(moduleSize - stateCount[i]) >= maxVariance) { return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkCounts(){\n\tfor(cat in landmarks){\n\t\tif(landmarks[cat].length != targetCounts[cat]){\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}", "compareDNA(pAeq2){\n let count = 0;\n dna.forEach((base1, index) => {\n const base2 = pAeq2.dna[index];\n if(base1 == base2){\n ...
[ "0.58984965", "0.5873701", "0.5846635", "0.58114964", "0.58030957", "0.57344806", "0.5690995", "0.5646999", "0.563571", "0.5550344", "0.5445501", "0.54425097", "0.54248667", "0.5385541", "0.5372878", "0.5366242", "0.5363819", "0.5352206", "0.5316015", "0.53134966", "0.5311252...
0.56132394
9
Given a count of black/white/black pixels just seen and an end position, figures the location of the center of this black/white/black run.
function centerFromEnd(stateCount, end) { var result = (end - stateCount[2]) - stateCount[1] / 2; if (helpers_1.isNaN(result)) { return null; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countBlackWhiteRun(origin, end, matrix, length) {\n var rise = end.y - origin.y;\n var run = end.x - origin.x;\n var towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2));\n var awayFromEnd = countBlackWhiteRunTowardsPoint(origin, { x: origin.x - run, y: origi...
[ "0.6693089", "0.626105", "0.60249573", "0.5923096", "0.57945", "0.5737114", "0.5688535", "0.5610086", "0.5545497", "0.5544482", "0.53885883", "0.53602487", "0.5351306", "0.5348422", "0.5330814", "0.53264034", "0.52810115", "0.5271384", "0.525986", "0.52412474", "0.52239156", ...
0.6282014
1
After a horizontal scan finds a potential alignment pattern, this method "crosschecks" by scanning down vertically through the center of the possible alignment pattern to see if the same proportion is detected. startI row where an alignment pattern was detected centerJ center of the section that appears to cross an alignment pattern maxCount maximum reasonable number of modules that should be observed in any reading state, based on the results of the horizontal scan originalStateCountTotal The original state count total
function crossCheckVertical(startI, centerJ, maxCount, originalStateCountTotal, moduleSize, image) { var maxI = image.height; var stateCount = [0, 0, 0]; // Start counting up from center var i = startI; while (i >= 0 && image.get(centerJ, i) && stateCount[1] <= maxCount) { stateCount[1]++; i--; } // If already too many modules in this state or ran off the edge: if (i < 0 || stateCount[1] > maxCount) { return null; } while (i >= 0 && !image.get(centerJ, i) && stateCount[0] <= maxCount) { stateCount[0]++; i--; } if (stateCount[0] > maxCount) { return null; } // Now also count down from center i = startI + 1; while (i < maxI && image.get(centerJ, i) && stateCount[1] <= maxCount) { stateCount[1]++; i++; } if (i == maxI || stateCount[1] > maxCount) { return null; } while (i < maxI && !image.get(centerJ, i) && stateCount[2] <= maxCount) { stateCount[2]++; i++; } if (stateCount[2] > maxCount) { return null; } var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2]; if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) { return null; } return foundPatternCross(stateCount, moduleSize) ? centerFromEnd(stateCount, i) : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handlePossibleCenter(stateCount, i, j, moduleSize) {\r\n\t\t var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\r\n\t\t var centerJ = centerFromEnd(stateCount, j);\r\n\t\t if (centerJ == null) {\r\n\t\t return null;\r\n\t\t }\r\n\t\t var cent...
[ "0.556877", "0.55510575", "0.550457", "0.54952186", "0.5485731", "0.54697144", "0.5401432", "0.53315246", "0.5296665", "0.52186847", "0.519853", "0.5159309", "0.51492774", "0.51125616", "0.5105361", "0.5051013", "0.5049619", "0.50307536", "0.4978565", "0.49664906", "0.4953451...
0.7157436
0
This is called when a horizontal scan finds a possible alignment pattern. It will cross check with a vertical scan, and if successful, will see if this pattern had been found on a previous horizontal scan. If so, we consider it confirmed and conclude we have found the alignment pattern. stateCount reading state module counts from horizontal scan i where alignment pattern may be found j end of possible alignment pattern in row
function handlePossibleCenter(stateCount, i, j, moduleSize) { var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2]; var centerJ = centerFromEnd(stateCount, j); if (centerJ == null) { return null; } var centerI = crossCheckVertical(i, Math.floor(centerJ), 2 * stateCount[1], stateCountTotal, moduleSize, image); if (centerI != null) { var estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3; for (var i2 in possibleCenters) { var center = possibleCenters[i2]; // Look for about the same center and module size: if (aboutEquals(center, estimatedModuleSize, centerI, centerJ)) { return combineEstimate(center, centerI, centerJ, estimatedModuleSize); } } // Hadn't found this before; save it var point = { x: centerJ, y: centerI, estimatedModuleSize: estimatedModuleSize }; possibleCenters.push(point); } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function crossCheckVertical(startI, centerJ, maxCount, originalStateCountTotal, moduleSize, image) {\r\n\t\t var maxI = image.height;\r\n\t\t var stateCount = [0, 0, 0];\r\n\t\t // Start counting up from center\r\n\t\t var i = startI;\r\n\t\t while (i >= 0 && image.get(centerJ, i) && stateCount[1] <...
[ "0.5969984", "0.5400206", "0.53992504", "0.52994275", "0.52473944", "0.51983064", "0.5144702", "0.50957656", "0.5084866", "0.49859744", "0.49690977", "0.49683338", "0.49647772", "0.49170303", "0.49112752", "0.49109912", "0.48912933", "0.4882949", "0.48457623", "0.48057747", "...
0.4417581
77
Taken from underscore JS
function isNaN(obj) { return Object.prototype.toString.call(obj) === '[object Number]' && obj !== +obj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function baseLodash() {}", "function baseLodash() {}", "function baseLodash() {}", "function baseLodash() {}", "function baseLodash() {}", "function baseLodash(){}", "function baseLodash() {// No operation performed.\n}", "function baseLodash() {// No operation performed.\n}", "function baseLodash(...
[ "0.6445014", "0.6445014", "0.6445014", "0.6445014", "0.6445014", "0.62266994", "0.61520755", "0.61520755", "0.60981864", "0.60981864", "0.60981864", "0.60981864", "0.60981864", "0.60981864", "0.60981864", "0.60981864", "0.60676235", "0.60676235", "0.60676235", "0.60676235", "...
0.0
-1
Takes in a byte array, a qr version number and an error correction level. Returns decoded data.
function decodeQRdata(data, version, ecl) { var symbolSequence = -1; var parityData = -1; var bits = new bitstream_1.BitStream(data); var result = { val: [] }; // Have to pass this around so functions can share a reference to a number[] var fc1InEffect = false; var mode; while (mode != TERMINATOR_MODE) { // While still another segment to read... if (bits.available() < 4) { // OK, assume we're done. Really, a TERMINATOR mode should have been recorded here mode = TERMINATOR_MODE; } else { mode = modeForBits(bits.readBits(4)); // mode is encoded by 4 bits } if (mode != TERMINATOR_MODE) { if (mode == FNC1_FIRST_POSITION_MODE || mode == FNC1_SECOND_POSITION_MODE) { // We do little with FNC1 except alter the parsed result a bit according to the spec fc1InEffect = true; } else if (mode == STRUCTURED_APPEND_MODE) { if (bits.available() < 16) { return null; } // not really supported; but sequence number and parity is added later to the result metadata // Read next 8 bits (symbol sequence #) and 8 bits (parity data), then continue symbolSequence = bits.readBits(8); parityData = bits.readBits(8); } else if (mode == ECI_MODE) { // Ignore since we don't do character encoding in JS var value = parseECIValue(bits); if (value < 0 || value > 30) { return null; } } else { // First handle Hanzi mode which does not start with character count if (mode == HANZI_MODE) { //chinese mode contains a sub set indicator right after mode indicator var subset = bits.readBits(4); var countHanzi = bits.readBits(mode.getCharacterCountBits(version)); if (subset == GB2312_SUBSET) { if (!decodeHanziSegment(bits, result, countHanzi)) { return null; } } } else { // "Normal" QR code modes: // How many characters will follow, encoded in this mode? var count = bits.readBits(mode.getCharacterCountBits(version)); if (mode == NUMERIC_MODE) { if (!decodeNumericSegment(bits, result, count)) { return null; } } else if (mode == ALPHANUMERIC_MODE) { if (!decodeAlphanumericSegment(bits, result, count, fc1InEffect)) { return null; } } else if (mode == BYTE_MODE) { if (!decodeByteSegment(bits, result, count)) { return null; } } else if (mode == KANJI_MODE) { } else { return null; } } } } } return result.val; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function QR8bitByte(data) {\n this.mode = QRMode.MODE_8BIT_BYTE;\n this.data = data;\n this.parsedData = [];\n\n // Added to support UTF-8 Characters\n for (var i = 0, l = this.data.length; i < l; i++) {\n var byteArray = [];\n var code = this.data.charCodeA...
[ "0.60470945", "0.6000193", "0.6000193", "0.6000193", "0.59892744", "0.5986568", "0.59758204", "0.5876389", "0.5847092", "0.58175814", "0.5387994", "0.5387994", "0.5336766", "0.5256566", "0.52518564", "0.52518564", "0.52463794", "0.52461064", "0.5236617", "0.5228752", "0.52287...
0.65863824
0
Output the file creation details to the specified file
function outputFileCreationInfo(file) { // Add the build information and header to the output file ccdd.writeToFileLn(file, "# Created : " + ccdd.getDateAndTime() + "\n# User : " + ccdd.getUser() + "\n# Project : " + ccdd.getProject() + "\n# Script : " + ccdd.getScriptName()); // Check if any table is associated with the script if (ccdd.getTableNumRows() != 0) { ccdd.writeToFileLn(file, "# Table(s): " + [].slice.call(ccdd.getTableNames()).sort().join(",\n# ")); } // Check if any groups is associated with the script if (ccdd.getAssociatedGroupNames().length != 0) { ccdd.writeToFileLn(file, "# Group(s): " + [].slice.call(ccdd.getAssociatedGroupNames()).sort().join(",\n# ")); } ccdd.writeToFileLn(file, ""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function outputFileCreationInfo(file)\n{\n // Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"/* Created : \" + ccdd.getDateAndTime() + \"\\n User : \" + ccdd.getUser() + \"\\n Project : \" + ccdd.getProject() + \"\\n Script : \" + ccdd.getScriptName());\n\n ...
[ "0.7589007", "0.6463051", "0.6254441", "0.6184719", "0.6148196", "0.6126077", "0.611571", "0.6045737", "0.5959177", "0.594336", "0.5943259", "0.58981055", "0.5860408", "0.5773959", "0.5757392", "0.57503754", "0.5746891", "0.5734899", "0.573418", "0.57076967", "0.56968117", ...
0.76575094
0
Determine if the row containing the specified variable is not an array definition. A row in a table is an array definition if a value is present in the Array Size column but the variable name does not end with a ']'
function isVariable(variableName, arraySize) { // Only output non-array variables or array members (i.e., skip array // definitions) return variableName != null && arraySize != null && (arraySize.isEmpty() || variableName.endsWith("]")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrayLike (data) {\n return assigned(data) && greaterOrEqual(data.length, 0);\n }", "function typeIsArray(instance_var) {\n return getType(instance_var).includes(\"[]\") || getName(instance_var).includes(\"[]\");\n}", "function isDataArray(x) {\n return Array.isArray(x);\n}", "function isD...
[ "0.62658256", "0.6088386", "0.6051291", "0.6051291", "0.6051291", "0.60416573", "0.6009855", "0.59947145", "0.59820694", "0.59604335", "0.59486055", "0.5947597", "0.5918841", "0.59055036", "0.588324", "0.588324", "0.588324", "0.58347255", "0.58346623", "0.579784", "0.577385",...
0.6629437
0
Convert an array member variable name by replacing left square brackets with underscores and removing right square brackets (example: a[2] becomes a_2)
function convertArrayMember(variableName) { return variableName.replaceAll("[\\[]", "_").replaceAll("[\\]]", ""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function underscore (name) {\n return varname.split(name).join('_');\n}", "function underscore (name) {\n return varname.split(name).join('_');\n}", "function normalize_dataset_name(name) { // 214\n\treturn name.replace(/[\\]\\[\...
[ "0.6083765", "0.6083765", "0.6016209", "0.59452313", "0.5863515", "0.56995344", "0.5670354", "0.55625224", "0.5526872", "0.54653025", "0.5438944", "0.53927195", "0.53881425", "0.5387266", "0.53272283", "0.5309225", "0.5305594", "0.52917945", "0.5289355", "0.5289287", "0.52698...
0.8395666
0
Adjust the row counter to the next row. If the number of rows exceeds the maximum start a new column
function nextRow(pageFile, variableName, fullVariableName, row) { // Check if the row counter is at the maximum if (rowCount >= maxNumRows) { // Step through the rows in the data that have been processed for (; row >= 0; row--) { // Get the header (structure) name for this row var headerName = fullHeaderNames[row]; // Check if the variable belongs to the same structure if (headerName != "" && fullVariableName.equals(headerName + "_" + variableName)) { // Update the column header lastSubStructureName = headerNames[row]; } } // Go to the next column columnCount++; ccdd.writeToFileLn(pageFile, "## col_max_len going from " + maxColumnLength + " back to " + columnStep); rowCount = 1; columnOffset = +columnOffset + +maxColumnLength + 2; maxColumnLength = columnStep; // Check if the current variable is a member within an array if (inMiddleOfArray) { ccdd.writeToFileLn(pageFile, "array_fmt(1, " + columnOffset + ",\"" + nextColumnHeader + "\")"); } // Not a variable within an array else { ccdd.writeToFileLn(pageFile, "(1, " + columnOffset + ",\"" + lastSubStructureName + "\")"); } } // Not at the maximum row else { rowCount++; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render_next_row() {\n\n current_row = (current_row + 1) % DataManager.imported_data.length;\n render_row(current_row);\n\n}", "function getNextEditableRow() {\r\n\t\t\trowNum = parseInt(rowNum) + 1;\r\n\t\t\teditableFieldsList = getEditableFieldListInOrder(nmsp, rowNum);\r\n\t\t\tvar maxVisibleRow...
[ "0.6844505", "0.6307189", "0.62610507", "0.6174487", "0.611505", "0.60943776", "0.6078653", "0.6068298", "0.5975301", "0.58927864", "0.58509856", "0.58067775", "0.5770341", "0.5749379", "0.55931467", "0.5588367", "0.5585682", "0.5549195", "0.5530309", "0.5527462", "0.5525426"...
0.53259367
37
Check if the supplied array size contains a value
function isArrayElement(arraySize) { return arraySize != null && !arraySize.isEmpty(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get hasValues() {\n return this.arrayWidth > 0 && this.arrayHeight > 0;\n }", "validateArraySize (req, array) {\n const FREEMIUM_INPUT_SIZE = 20\n const PRO_INPUT_SIZE = 20\n\n if (req.locals && req.locals.proLimit) {\n if (array.length <= PRO_INPUT_SIZE) return true\n } else if (array...
[ "0.67656267", "0.6722253", "0.6622202", "0.6506073", "0.64943284", "0.64565045", "0.64473206", "0.63594013", "0.63058066", "0.6303271", "0.6277014", "0.62455976", "0.62435305", "0.6223165", "0.6206438", "0.6189157", "0.6183994", "0.61791366", "0.61791366", "0.6156779", "0.614...
0.7749507
0
Get the array index value from the variable name
function getIndex(name) { // Split the variable name on the underscores and use the last part as the // array index var parts = name.split("_"); return parts[parts.length - 1]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "variableAt(index) {\n\t\treturn this._vars[index];\n\t}", "function nthArray(arrayName, number) {\n\n return arrayName[number];\n}", "function index(arr, name) {\n return _.findIndex(arr, matchName(name));\n}", "function getVarValue(index){\n return varList[index].value;\n}", "function getIndexByNam...
[ "0.66877156", "0.6651087", "0.640118", "0.6385651", "0.63771635", "0.63339627", "0.619989", "0.6096024", "0.6087681", "0.6075198", "0.6040069", "0.59576315", "0.5896634", "0.5833155", "0.5832128", "0.58292294", "0.57799965", "0.5752793", "0.57407445", "0.57022464", "0.5697944...
0.8149556
0
Selects the format arguments to use for a particular ITOS type, based on its type
function setITOSFormatFlag(itosEncode) { var itosFormat = ""; var withSign = 0; modNum = modNumDefault; // Select based on the data type character (F, I, U, S) switch (itosEncode.substr(0, 1)) { // Floating point case 'F': // Get the number of bytes that define the floating point var numBytes = itosEncode.length() - 1; // Check if the number of bytes is greater than 4 (i.e., it's a // double precision floating point) if (numBytes > 4) { // Set the format string and parameters for a double itosFormat = "%13.3f"; numITOSDigits = 14; modNum = modNumDefault / 2; } // The number of bytes is equal to or less than 4 (i.e., it's a // single precision floating point) else { // Set the format string and parameters for a float itosFormat = "%6.3f"; numITOSDigits = 7; modNum = modNumDefault / 2; } break; // Signed integer case 'I': // Set the value to add a space for the sign withSign = 1; // Unsigned integer case 'U': // Get the number of bytes that define the (unsigned) integer var numBytes = itosEncode.length() - 1; // Determine the number of digits required to display the largest // possible value for the (unsigned) integer with the specified // number of bytes var nDigits = 2 * numBytes + 1 + Math.floor(numBytes / 4); // Add a digit for a +/- if signed integer nDigits += +withSign; // Set the format string and parameters for a (unsigned) integer itosFormat = "%" + nDigits.toString() + "d"; numITOSDigits = nDigits; // Check if the number of bytes is greater than 2 if (numBytes > 2) { // Set the format parameter modNum = modNumDefault / 2; } break; // Character or string case 'S': // Set the format string and parameters for a character or string itosFormat = "%s"; numITOSDigits = 10; modNum = modNumDefault / 2; break; default: break; } return itosFormat; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function asPrintFormat(type)\n{\n if (StringHelper.isString(type)) {\n return '%s';\n }\n\n function fn(pkgId)\n {\n const options = { 'hash' : {} };\n return zclHelper.asUnderlyingZclType.call(this, type, options).then(zclType => {\n const basicType = ChipTypesHelper.asBasicType(zclType);\n ...
[ "0.54740864", "0.545433", "0.5341621", "0.5326154", "0.5245996", "0.5173307", "0.5153685", "0.5115746", "0.51004386", "0.5072338", "0.5057002", "0.50463784", "0.5003069", "0.49909866", "0.49246162", "0.4914578", "0.4914578", "0.4887306", "0.48745137", "0.48443437", "0.4844343...
0.5289269
4
Output a single mnemonic definition
function outputMnemonic(pageFile, row, fltCompName) { var isOutput = false; var itosFormat = ""; var variableName = ccdd.getStructureVariableName(row); var dataType = ccdd.getStructureDataType(row); // Get the ITOS encoded form of the data type var itosEncode = ccdd.getITOSEncodedDataType(dataType, "BIG_ENDIAN"); // Check if this data type is a recognized base type or structure if (itosEncode != null) { // Check if the data type is a primitive (not a structure) if (!itosEncode.equals(dataType)) { // Get the ITOS output format string based on the encoding itosFormat = setITOSFormatFlag(itosEncode); } // Get the variable name and array size var arraySize = ccdd.getStructureArraySize(row); var fullVariableName = ccdd.getFullVariableName(row); // See if this row would exceed the maximum. If so start another column nextRow(pageFile, variableName, fullVariableName, row); // Get the full variable name (including the variable's structure path) var tmp = ccdd.getFullVariableName(row, " "); // Find number of spaces (i.e. " ") in tmp and makes prepad a string // containing only that many spaces var prepad = new java.lang.String(String(tmp.match(/ /g))).replaceAll("[\\,]", ""); var len = 0; // Only output non-array variables or array members (i.e., skip array // definitions) if (isVariable(variableName, arraySize)) { // In case this is an array member replace the square brackets variableName = convertArrayMember(variableName); // Create the mnemonic definition var fullVariableName2 = prepad + fltCompName + fullVariableName; len = prepad.length() + variableName.length(); // Check if the data type is a structure if (itosEncode.equals(dataType)) { nextColumnHeader = prepad + variableName; lastSubStructureName = nextColumnHeader; headerNames[row] = lastSubStructureName; fullHeaderNames[row] = fullVariableName; ccdd.writeToFileLn(pageFile, "(+, " + columnOffset + ", \"" + nextColumnHeader + "\")"); } // Not a structure; it's a primitive type else { if (isArrayElement(arraySize)) { var maxDigits = Math.ceil(Math.log(arraySize) / Math.LN10); var digitPad = new Array(maxDigits + 1).join(" "); // Output number with leading spaces var index = getIndex(variableName); var indexPadded = index.toString().padLeft(maxDigits); inMiddleOfArray = true; var arrayPad = 13; // This item is first on a row if (index % modNum != 0) { ccdd.writeToFileLn(pageFile, fullVariableName2 + "(=, +, \" :v" + itosFormat + ":\", raw)"); len = 0; } // This array item is NOT first item on a row else { var lastIndex = Math.min(arraySize - 1, +index + +modNum - 1).toString().padLeft(digitPad); var arrayMessage = new java.lang.String(String(prepad + "[" + indexPadded + "-" + lastIndex + "]")); len = arrayMessage.length() + (numITOSDigits + 1) * Math.min(modNum, arraySize); ccdd.writeToFileLn(pageFile, fullVariableName2 + "(+, " + columnOffset + ", \"" + arrayMessage + " :v" + itosFormat + ":\", raw)"); } if (index != +arraySize - 1 && (+index + 1) % modNum != 0) { rowCount = +rowCount - 1; } if (index == (+arraySize - 1)) { inMiddleOfArray = false; nextColumnHeader = lastSubStructureName; } } // Not an array item, print normally else { ccdd.writeToFileLn(pageFile, fullVariableName2 + "(+, " + columnOffset + ", \"" + prepad + variableName + " :v" + itosFormat + ":\", raw)"); len = prepad.length() + variableName.length() + numITOSDigits + 2; } } isOutput = true; } else { nextColumnHeader = prepad + variableName + "[" + arraySize + "] - " + itosEncode; len = new java.lang.String(String(nextColumnHeader)).length(); ccdd.writeToFileLn(pageFile, "array_fmt(+, " + columnOffset + ", \"" + nextColumnHeader + "\")"); } if (maxColumnLength < +len) { ccdd.writeToFileLn(pageFile, "## col_max_len is now = " + len + " (was " + maxColumnLength + ")"); maxColumnLength = +len; } } else { ccdd.writeToFileLn(pageFile, "#### NOT printing " + variableName); } return isOutput; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateMnemonic() {\n const mnemonic = bip39.generateMnemonic();\n return mnemonic.split(\" \").slice(0, 3).join(\" \");\n}", "function outputMnemonics(pageFile, fltCompName)\n{\n ccdd.writeToFileLn(pageFile, \"# Mnemonics\");\n\n // Step through each of the structure table rows\n for (var r...
[ "0.63409716", "0.6065563", "0.5815374", "0.5640102", "0.562062", "0.5616697", "0.54599607", "0.54352874", "0.5415095", "0.536314", "0.5349442", "0.53401595", "0.5324772", "0.52343404", "0.5215487", "0.5205382", "0.51888996", "0.51871806", "0.51363534", "0.51294446", "0.511768...
0.58402765
2
Output all of the mnemonic for display
function outputMnemonics(pageFile, fltCompName) { ccdd.writeToFileLn(pageFile, "# Mnemonics"); // Step through each of the structure table rows for (var row = 0; row < ccdd.getStructureTableNumRows(); row++) { // Initialize the header name array values to blanks fullHeaderNames[row] = ""; headerNames[row] = ""; } // Step through each row in the table for (row = 0; row < ccdd.getStructureTableNumRows(); row++) { // Output the mnemonic for this row in the data table var isOutput = outputMnemonic(pageFile, row, fltCompName); // Check if a mnemonic definition was output to the file if (isOutput) { // Add an end of line to file to get ready for next line ccdd.writeToFileLn(pageFile, ""); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showAll (text) {\n\n\tasciify.getFonts(function (err, fonts) {\n\t\tif (err) { return console.error(err); }\n\n\t\tvar padSize = ('' + fonts.length).length;\n\n\t\tfonts.forEach(function(font, index) {\n\t\t\tvar opts = {\n\t\t\t\tfont: font,\n\t\t\t\tcolor: argv.color\n\t\t\t};\n\n\t\t\tasciify(exampleTe...
[ "0.6431226", "0.617171", "0.61614263", "0.59077364", "0.59055066", "0.5897718", "0.5867943", "0.5835313", "0.58263713", "0.57487714", "0.56595045", "0.5656799", "0.55863965", "0.5564248", "0.55637693", "0.5557289", "0.55472785", "0.5522315", "0.55000573", "0.54943234", "0.548...
0.60421604
3
Output the page file
function outputPageFile(fltCompName) { // Initialize the name, row, and column parameters nextColumnHeader = fltCompName + ccdd.getRootStructureTableNames()[0]; lastSubStructureName = nextColumnHeader; columnStep = 20; maxColumnLength = columnStep; columnOffset = -columnStep - 1; maxNumRows = 46; rowCount = maxNumRows; columnCount = 0; inMiddleOfArray = false; // Check if structure data is provided if (numStructRows != 0) { // Build the page file name and open the page output file var baseName = "auto_" + fltCompName + ccdd.getRootStructureTableNames()[0]; var pageFileName = ccdd.getOutputPath() + baseName + ".page"; var pageFile = ccdd.openOutputFile(pageFileName); // Check if the page output file successfully opened if (pageFile != null) { // Begin building the page display. The "page" statement must be on // the first row ccdd.writeToFileLn(pageFile, "page " + baseName); ccdd.writeToFileLn(pageFile, ""); outputFileCreationInfo(pageFile); ccdd.writeToFileLn(pageFile, "color default (orange, default)"); ccdd.writeToFileLn(pageFile, "color mnedef (text (white, black) )"); ccdd.writeToFileLn(pageFile, "color subpage (lightblue, blue)"); ccdd.writeToFileLn(pageFile, "color array_fmt (royalblue, black)"); ccdd.writeToFileLn(pageFile, ""); // Output the telemetry display definitions outputMnemonics(pageFile, fltCompName); // Close the page output file ccdd.closeFile(pageFile); } // The page output file cannot be opened else { // Display an error dialog ccdd.showErrorDialog("<html><b>Error opening telemetry output file '</b>" + pageFileName + "<b>'"); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeOut(page) {\n var n = Math.floor(fs.readdirSync(getFolder()).length / subreddits.length);\n n = n === 0 ? 1 : n;\n // save the text version of this page for your viewing pleasure\n fs.writeFile(\n // file name\n getFolder() + String(n)...
[ "0.681531", "0.65952015", "0.6562266", "0.651069", "0.6413979", "0.64132905", "0.6406398", "0.6222543", "0.62222046", "0.6132307", "0.6039272", "0.59967875", "0.59938", "0.59888405", "0.59466743", "0.5833676", "0.5822087", "0.5819268", "0.57932734", "0.5791793", "0.5779447", ...
0.6541599
3
Method to return data
function resolveEndpoint(response, service) { let res = null; response.set("Content-Type", service.response.contentType); response.status(service.response.status); if (service.response.file) { try { // External file res = fs.readFileSync(`${mockPath}/${service.response.file}`, "utf8"); } catch (err) { // Error reading file console.log( `Unable to read file content ${mockPath}/${service.response.file}: ${err}` ); const contentType = service.response.contentType.toLowerCase(); res = contentType === "application/json" ? { error: "Unhandled error" } : contentType === "text/xml" ? "<?xml version='1.0' encoding='UTF-8'?><error>Unhandled error</error>" : "Unhandled error"; } } else { // Mock body res = service.response.body || ""; } // Return response if (logsMode === "responses" || logsMode === "all") { console.log("Response", res); } response.send(res); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_data() {}", "getData(){}", "GetData() {}", "function getData(data) {\n return data;\n}", "function getData(data) {\n return data;\n}", "getData () {\n }", "function simpleDataReturn(result) {\n\t\treturn result.data;\n\t}", "get data() {\n return this.getData();\n ...
[ "0.79327536", "0.7849613", "0.771991", "0.75519276", "0.75127596", "0.7270598", "0.7153728", "0.70752484", "0.6996639", "0.69907176", "0.69789064", "0.69585544", "0.69585544", "0.6925951", "0.69102114", "0.68731236", "0.6861913", "0.6827667", "0.67981476", "0.6709817", "0.667...
0.0
-1
Turn on audio for marker in close proximity
TurnOnMarkerAudio(filename){ const {FadeInVolume, FadeOutVolume} = this; const url = serverURL[0].url; //if there is media file attached to marker if(filename!=='none'){ FadeOutVolume(()=>{ this.audio.pause() // pause background audio const src = `${url}${filename}` this.markerAudio.src = src; //Set marker's audio's source this.markerAudio.volume = 0;// Initial marker's audio volume this.markerAudio.play(); //Play marker's audio FadeInVolume(()=>{return},50,0.01,1,"marker"); //Gradually increase marker's audio volume //When marker's audio ends this.markerAudio.onended = () => { this.audio.play() FadeInVolume(()=>{return},10, 0.01, 1,"main") //Graudually increase background audio volume } },10, 0.01,"main" ) //Fade Out Volume of background } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateAudioForLocation(lat, lng) {}", "function playSound(marker)\n{ console.log(marker.data);\n if(marker.id!==isThis)\n {\n let notiOS=true;\n if (device==='iPad'||device==='iPhone'||device==='iPod'===true)\n {\n notiOS=false;\n }\n if(sound!==undefined){soun...
[ "0.7011543", "0.6692145", "0.61068994", "0.6084379", "0.6030354", "0.6030354", "0.5947804", "0.5937005", "0.5917849", "0.5901378", "0.5892711", "0.5856441", "0.5830479", "0.58228517", "0.58228004", "0.58221316", "0.5796113", "0.5795161", "0.5789441", "0.57812077", "0.57784516...
0.6923207
1
call draw method on all flowers
function drawFlowers() { for (let i = 0; i < flowers.length; i++) { flowers[i].draw(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n\t\tfor (var i = 0; i < loop.graphics.length; i++) {\n\t\t\tloop.graphics[i](graphics, 0.0);\n\t\t}\n\t}", "draw() {\n\n for (let i = 0; i < this.belt.length; i++) {\n this.belt[i].draw();\n }\n }", "draw() {\n this.loop(DrawableArray.dr...
[ "0.7339453", "0.7263549", "0.7232819", "0.7232819", "0.7232819", "0.7089712", "0.7030468", "0.6987068", "0.69428116", "0.6938341", "0.6901095", "0.6898949", "0.6890323", "0.68310916", "0.682752", "0.67846096", "0.6748135", "0.6743789", "0.6735853", "0.6720965", "0.6703261", ...
0.8836986
0
call draw method on all moveables
function drawMoveables() { for (let i = 0; i < moveables.length; i++) { moveables[i].draw(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n // draws background rooms and handles movement from one to another\n adventureManager.draw();\n clickablesManager.draw();\n\n for( let i = 0; i < clickables.length; i++ ) {\n clickables[i].visible = false;\n }\n\n if( gDebugMode == true ) {\n drawDebugInfo();\n }\n}", "draw() {\n...
[ "0.74547124", "0.737334", "0.73551196", "0.72698575", "0.7235449", "0.7233821", "0.71460575", "0.7132533", "0.70798904", "0.70558506", "0.7053185", "0.7053185", "0.7053185", "0.69858325", "0.69764304", "0.6968767", "0.69512206", "0.6936371", "0.69245255", "0.692414", "0.69082...
0.8923036
0
generate a color with random rgb values
function generateRandomColor() { let r = Math.floor(Math.random() * 255); let g = Math.floor(Math.random() * 255); let b = Math.floor(Math.random() * 255); let color = "rgba(" + r + "," + g + "," + b + "," + 1 + ")"; return color; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gencolor() {\n len = _COLOR.length;\n rand = Math.floor(Math.random()*len); \n return _COLOR[rand];\n }", "function getRandomColorRGB() {\n return 'rgb(' + calcRndGen(255, true).toString() + \",\" + calcRndGen(255, true).toString() + \",\" + calcRndGen(255, true).toString() + ')...
[ "0.86590654", "0.86356455", "0.86168754", "0.8548868", "0.85040265", "0.8493826", "0.8480507", "0.8451141", "0.8409714", "0.83886814", "0.83798206", "0.8379079", "0.8376525", "0.8366138", "0.83315784", "0.83217067", "0.83207554", "0.8310129", "0.82981056", "0.8272868", "0.825...
0.8111069
68
refresh page (called by click on refresh button)
function refresh() { window.location.reload(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function refreshPage()\n\t\t\t{\n\t\t\t\twindow.location.reload(true);\n\t\t\t}", "function pageRefresh() {\n\tlocation.reload();\n}", "function refresh () {\r\n window.location.reload(true);\r\n}", "function refreshPage() {\n setTimeout(\"location.reload(true);\",0);\n }", "fu...
[ "0.8514916", "0.84528846", "0.8304804", "0.8283872", "0.8282947", "0.8273043", "0.8260663", "0.82455134", "0.82455134", "0.82455134", "0.823502", "0.8229787", "0.8216325", "0.81969965", "0.81398815", "0.81083155", "0.80973935", "0.8089189", "0.807985", "0.8032232", "0.8013077...
0.8535902
0
draw part of background, mountains
function drawMountains() { L10_Super.crc2.beginPath(); let gradient = L10_Super.crc2.createLinearGradient(0, 0, 0, L10_Super.crc2.canvas.height); gradient.addColorStop(0, "whitesmoke"); gradient.addColorStop(0.5, "darkslategrey"); L10_Super.crc2.fillStyle = gradient; L10_Super.crc2.moveTo(500, 500); L10_Super.crc2.quadraticCurveTo(100, -100, -200, 500); L10_Super.crc2.moveTo(1500, 500); L10_Super.crc2.quadraticCurveTo(700, -200, 300, 500); L10_Super.crc2.fill(); L10_Super.crc2.strokeStyle = "whitesmoke"; L10_Super.crc2.lineWidth = 2; L10_Super.crc2.stroke(); L10_Super.crc2.closePath(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n drawbackground();\n drawHoles();\n }", "function drawBackground() {\n // sky\n skyTop.tesselate(HORIZONTAL, 0);\n skyBackground.tesselate(HORIZONTAL, skyTop.height);\n\n // grass blades\n groundHeight = HEIGHT - grass.height * 2;\n for (var pos in grassBladePositions)...
[ "0.7498021", "0.7350515", "0.7229753", "0.7229088", "0.7076119", "0.7064383", "0.70610946", "0.70516884", "0.703864", "0.70018566", "0.6972767", "0.6968439", "0.6956943", "0.69028753", "0.6870621", "0.68359506", "0.681328", "0.6805117", "0.6802679", "0.67905474", "0.6759651",...
0.6818139
16
draw sun in random location in the sky
function drawSun() { L10_Super.crc2.beginPath(); L10_Super.crc2.arc(Math.random() * width + 100, height / 4, 100, 0, 2 * Math.PI); L10_Super.crc2.fillStyle = "#FFFF66"; L10_Super.crc2.fill(); L10_Super.crc2.closePath(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sun (yPos) {\n fill(\"#f7cb39\"); // Yellow color\n circle(250, yPos, 50);\n}", "function sky(x, y, r, g, b, a) { //input 6 random values for every unique ellipse\n ellipseMode(CENTER);\n noStroke();\n fill(r, g, b, a);\n var diam = random(30);\n ellipse(x, y, diam, diam);\n}", "function up...
[ "0.76427907", "0.73669904", "0.72002107", "0.68546826", "0.67772126", "0.6686576", "0.66750973", "0.64924186", "0.64907587", "0.64816463", "0.64057523", "0.63944376", "0.6379517", "0.6342701", "0.631193", "0.6224635", "0.6220528", "0.6158347", "0.6134893", "0.61311525", "0.61...
0.817499
0
Polling transport polymorphic constructor. Decides on xhr vs jsonp based on feature detection.
function polling(opts) { var xhr var xd = false var xs = false opts.xdomain = xd opts.xscheme = xs return new XHR(opts) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LongPollingTransport() {\n var _super = new org.cometd.LongPollingTransport();\n var that = org.cometd.Transport.derive(_super);\n\n that.xhrSend = function (packet) {\n return $.ajax({\n url: packet.url,\n async: packet.sync !== true,\n type: \"POST\",\n contentT...
[ "0.7308519", "0.7286786", "0.72286385", "0.72286385", "0.7202566", "0.7158869", "0.7158869", "0.7158869", "0.6479727", "0.64629453", "0.6436861", "0.6436861", "0.64278656", "0.64278656", "0.64278656", "0.6380751", "0.6380751", "0.6380751", "0.6380751", "0.6380751", "0.6377234...
0.5942718
93
Remove all falsy values from an array. Falsy values in JavaScript are false, null, 0, "", undefined, and NaN. Solution:
function bouncer(arr) { return arr.filter(Boolean); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeFalsy(arr) {\r\n return arr.filter(a => !!a);\r\n }", "function filterOutFalsy(array) {\n var result = [];\n for (var i = 0; i < array.length; i++) {\n if (array[i]) {\n result[result.length] = array[i];\n }\n }\n return result;\n}", "function removeFalsy...
[ "0.8715977", "0.8510027", "0.8418151", "0.8347382", "0.80667627", "0.79442424", "0.7571476", "0.75634205", "0.7542532", "0.7405202", "0.7393069", "0.73711216", "0.7367117", "0.732526", "0.7209689", "0.71225905", "0.71225905", "0.71225905", "0.71225905", "0.71225905", "0.71225...
0.6882298
32
Code Explanation: The Array.prototype.filter method expects a function that returns a Boolean value which takes a single argument and returns true for truthy 456 value or false for falsy value. Hence we pass the builtin Boolean function. Beginer Code Solution:
function isGood(val){ return val !== false && val !== null && val !== 0 && val !== "" && val !== undefined && !Number.isNaN(val); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterExample(arr) {\n const even = (num) => {\n if (num % 2 == 0) {\n return num\n }\n };\n const odd = (num) => {\n if (num % 2 != 0) {\n return num\n }\n };\n console.log(arr.filter(even));\n console.log(arr.filter(odd));\n\n}", "fun...
[ "0.728264", "0.71547383", "0.71156996", "0.71049404", "0.70489216", "0.704323", "0.7006432", "0.69838524", "0.6922213", "0.6892954", "0.68747336", "0.6810381", "0.67904097", "0.6789595", "0.6787079", "0.6778886", "0.67781246", "0.67709213", "0.67709213", "0.67709213", "0.6770...
0.0
-1
what part of the shield
rayintersect(i, maxi) { let a = this.bearing1 + (i / maxi) * this.fov; let x = this.playerpos.x + Math.cos(a); let y = this.playerpos.y + Math.sin(a); //console.log(x,y) return new Point(x, y); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shield() {\n\t\n}", "function drawShield(x, y){\n if (shield == 1) {\n graphics.drawImage(redshield, x, y, 50, 50);\n } else if (shield == 2) {\n graphics.drawImage(greenshield, x, y, 50, 50);\n }\n }", "get info() {\n if (this.sick) {\n return 'not feeling well...
[ "0.69179016", "0.5645263", "0.5541232", "0.5385604", "0.5379282", "0.5372021", "0.53716284", "0.53414696", "0.53219104", "0.5306511", "0.529019", "0.5244987", "0.52338725", "0.52242315", "0.5157053", "0.51509607", "0.51467013", "0.51407987", "0.5140209", "0.5133609", "0.51266...
0.0
-1
>>>>> Ciclo para guardar los datos ingresados
function render(leads) { let listItem = ""; for(let i = 0; i < leads.length; i++) { // console.log(myLeads[i]); // 1) == Primera forma == /* ulEl.textContent += myLeads[i]; */ /* ulEl.innerHTML += `<li>${myLeads[i]}</li>`; */ /* ulEl.style.fontSize = `20px`; */ /* ulEl.style.fontWeight = "700"; */ // 2) ===== forma de hacer / CREAR UN ELEMENTO ==== : /* const li = document.createElement(`li`); */ /* li.textContent = myLeads[i]; */ /* // == Method / element == */ /* ulEl.append(li); */ // 3 ) == extra forma == // < ==== Se llama TEMPLATE STRING = `${}` === > listItem += `<li><a href="${leads[i]}" target="_blank">${leads[i]}</a></li>`; //listItem += "<li><a target='_blank' href='" + myLeads[i] + "'>" + myLeads[i] + "</a></li>" console.log(listItem); ulEl.innerHTML = listItem; ulEl.style.fontSize = `20px`; ulEl.style.fontWeight = "700"; ulEl.style.margin = `20px 0`; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function guardarDatosDetalles( id_proceso_masivo ){\n\t\t\tlet data_det = {};\n\t\t\tlet tblProcesosDetalles = sql.define({\n\t\t\t name: 'procesos_masivos_detalles',\n\t\t\t columns: [\n\t\t\t 'numero_remito',\n\t\t\t 'numero_lote',\n\t\t\t 'cantidad_actas',\n\t\t\t 'notificada',\n\t\t\t 'zona',\...
[ "0.65867466", "0.65676874", "0.650246", "0.63669145", "0.6219115", "0.6211952", "0.6130465", "0.6113292", "0.6102723", "0.6090414", "0.60738873", "0.59655225", "0.5959617", "0.59210974", "0.59088826", "0.5907218", "0.5900235", "0.5899711", "0.58931845", "0.5886742", "0.587665...
0.0
-1
Restores select box and checkbox state using the preferences stored in chrome.storage.
function restore_options() { chrome.storage.sync.get({ darkMode: true, hideLargeSig: true, largeSignatures: 600, resizeLargeImages: true, largeImages: 40.781, WYSIWYGCheckbox: false, addEdited: false, showSickles: true, banMeMillisec: 0, lockBan: false, colors: false }, function(items) { document.getElementById("darkSwitch").checked = items.darkMode; document.getElementById("hideLargeSig").checked = items.hideLargeSig; document.getElementById("largeSigInput").value = items.largeSignatures; if(items.hideLargeSig) { document.getElementById("largeSigInput").style.display = "initial"; document.getElementById("resetLargeSig").style.display = "initial"; } document.getElementById("resizeLargeImages").checked = items.resizeLargeImages; document.getElementById("largeImgInput").value = items.largeImages; if(items.resizeLargeImages) { document.getElementById("largeImgInput").style.display = "initial"; document.getElementById("resetLargeImg").style.display = "initial"; } document.getElementById("WYSIWYGCheckbox").checked = items.WYSIWYGCheckbox; document.getElementById("addEdited").checked = items.addEdited; document.getElementById("showSickles").checked = items.showSickles; if((new Date()).getTime() < items.banMeMillisec) { document.getElementById("cancelBanDIV").innerHTML = (items.lockBan ? "הבאן הנוכחי נעול." : "<button id='cancelBan'>בטל באן פעיל</button>"); // Yes, it will be pretty easy to remove the ban even if its locked. Self control is important, people. // But I challenge you to remove it without using that button :) (Its possible!) if(items.lockBan) { document.getElementById("cancelBanDIV").innerHTML = ("הבאן הנוכחי נעול."); } else { document.getElementById("cancelBanDIV").innerHTML = ("<button id='cancelBan'>בטל באן פעיל</button>"); document.getElementById("cancelBan").addEventListener("click", function () { if(confirm("את/ה בטוח/ה שאת/ה רוצה לבטל את הבאן?")) { chrome.storage.sync.set({ banMeMillisec: 0 }); document.getElementById("cancelBanDIV").innerHTML = "הבאן בוטל, יש לטעון מחדש את העמוד."; } }); } } else { document.getElementById("cancelBanDIV").innerHTML = "אין באן פעיל"; } if(items.colors != false) { } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restore_options() {\n $('#options-list input[type=\"checkbox\"]').each(function() {\n var obj = {};\n var check = $(this);\n obj[$(this).attr('id')] = 1;\n chrome.storage.sync.get(obj,\n function(item) {\n $(\"#\" + check.attr('id')).prop(\"checked\", item[check.attr('id')]);\n ...
[ "0.81281036", "0.7955493", "0.7952804", "0.79513884", "0.78100187", "0.7808064", "0.77839416", "0.77807534", "0.7736412", "0.7689603", "0.7679494", "0.767728", "0.76685506", "0.76565903", "0.76448274", "0.76442367", "0.763711", "0.7631986", "0.7629453", "0.7624296", "0.759981...
0.0
-1
Save options to chrome storage
function save_options() { var darkSwitchCheckbox = document.getElementById("darkSwitch").checked; var hideLargeSig = document.getElementById("hideLargeSig").checked; var largeSignaturesInput = document.getElementById("largeSigInput").value; var resizeLargeImages = document.getElementById("resizeLargeImages").checked; var largeImagesInput = document.getElementById("largeImgInput").value; var WYSIWYGCheckbox = document.getElementById("WYSIWYGCheckbox").checked; var addEdited = document.getElementById("addEdited").checked; var showSickles = document.getElementById("showSickles").checked; chrome.storage.sync.get( { banMeMillisec: 0 }, function(data) { if(data.banMeMillisec == 0) { var banMeMillisec = new Date(document.getElementById("banMe").value).getTime(); var lockBan = document.getElementById("lockBan").checked; chrome.storage.sync.set({ banMeMillisec: banMeMillisec, lockBan: lockBan }); } }); chrome.storage.sync.set({ darkMode: darkSwitchCheckbox, hideLargeSig: hideLargeSig, largeSignatures: largeSignaturesInput, resizeLargeImages: resizeLargeImages, largeImages: largeImagesInput, WYSIWYGCheckbox: WYSIWYGCheckbox, addEdited: addEdited, showSickles: showSickles, colors: colorList }, function() { // Update status to let user know options were saved. var optionsSaved = document.getElementById('optionsSaved'); optionsSaved.textContent = 'Options saved.'; setTimeout(function() { optionsSaved.textContent = ''; }, 1000); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveSettings() {\n\n chrome.storage.local.set({\n\n words: wordArray,\n pages: pagesArray\n\n }, function() {\n\n \t//**********************************\n\t// OPTIONS SAVED INTO LOCAL STORAGE\n\t//**********************************\n\n });\n\n}", "function saveOptions() {\n var backgroundCol...
[ "0.8208671", "0.81641334", "0.81333387", "0.80997515", "0.80605656", "0.8034787", "0.79931915", "0.7969695", "0.7967973", "0.79387176", "0.7916807", "0.78878933", "0.78403693", "0.7832415", "0.7831214", "0.7822175", "0.7817581", "0.7812492", "0.7789036", "0.77857316", "0.7781...
0.7567182
33
Maybe registered with undefined type accidentally if the user has typo in a constant type
undefined(state, n) { state.a += n; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Defined(type)\n{\n\treturn (type !== \"undefined\");\n}", "unknownType() {\n console.log(this.type, this.type !== 'free', this.type !== 'premium');\n if (this.type !== 'free' && this.type !== 'premium') {\n throw new Error('type column has to be free or premium.');\n }\n ...
[ "0.58754563", "0.57643586", "0.5762996", "0.5723538", "0.56492496", "0.5619613", "0.5619613", "0.56042075", "0.5596396", "0.5582464", "0.5554941", "0.5518423", "0.5518423", "0.5504347", "0.55030054", "0.54974097", "0.5473238", "0.5473238", "0.5392887", "0.5392577", "0.5375938...
0.0
-1
marks the end of the klyng app
function end() { process.exit(0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onEnd() {\n\t\t\tif ( ++counter === total ) {\n\t\t\t\tif ( clbk ) {\n\t\t\t\t\tclbk();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function endApp() {\n console.log(\n chalk.red(\n figlet.textSync(\"Goodbye!\", {\n font: \"Doom\",\n horizontalLayout: \"fitted\",\n verticalLayout: \"fitt...
[ "0.6194811", "0.61424464", "0.6139903", "0.6139903", "0.6123729", "0.6100736", "0.6020073", "0.6016448", "0.601313", "0.60096794", "0.5990767", "0.59701395", "0.59687465", "0.59394526", "0.5926859", "0.58457094", "0.5839421", "0.58145016", "0.5811134", "0.58100903", "0.578583...
0.0
-1