Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Logica/Logica/1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var string = "bsjq"
var array = ["bsjq", "qbsj", "sjqb", "jqbs"];


//Ejemplo 1
console.log(contain_all_rots(string, array))

//Ejemplo 2
console.log(contain_all_rots("Ajylvpy", ["Ajylvpy", "ylvpyAj", "jylvpyA", "lvpyAjy", "pyAjylv", "vpyAjyl", "ipywee"]))

function contain_all_rots(strng, arr) {
console.log("String:" + strng)
console.log("Array:" + arr)

var c = 0

var arrStringOrder = Array.from(string).sort()

arr.every(function (element) {


var ss = Array.from(element).sort();

if (JSON.stringify(ss) === JSON.stringify(arrStringOrder)) {
c = 0
} else {
c = 1

}
return JSON.stringify(ss) === JSON.stringify(arrStringOrder)
});




if (c == 0) {
return true
} else {
return false
}
}
5 changes: 5 additions & 0 deletions Logica/Logica/10.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function gooseFilter(birds) {
let geese = ["African", "Roman Tufted", "Toulouse", "Pilgrim", "Steinbacher"];
return birds.filter(b => !geese.includes(b));
};
gooseFilter(["Mallard", "Hook Bill", "African", "Crested", "Pilgrim", "Toulouse", "Blue Swedish"]);
10 changes: 10 additions & 0 deletions Logica/Logica/12.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function duckDuckGoose(player, turn) {
if (player.length >= turn) {
return player[turn - 1];
} else if (turn % player.length === 0) {
return player[player.length - 1];
} else {
let yourTurn = turn % player.length;
return player[yourTurn - 1];
}
};
15 changes: 15 additions & 0 deletions Logica/Logica/14.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Hero {
constructor(name, position, health, damage, experience) {
this.name = name;
this.position = position;
this.health = health;
this.damage = damage;
this.experience = experience;
}
}

function createHero(name, position, health, damage, experience) {

return new Hero(name, position, health, damage, experience)
};
createHero('Hero', '00', 100, 5, 0);
16 changes: 16 additions & 0 deletions Logica/Logica/15.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Ball {
constructor(...type) {
if (type.length == 0) {
this.ballType = "Regular";
}
else {
this.ballType = type.toString();
}
}
};

var ball1 = new Ball();
var ball2 = new Ball("Super");

ball1.ballType
ball2.ballType
79 changes: 79 additions & 0 deletions Logica/Logica/17.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
var lang = {
english: 'Welcome',
czech: 'Vitejte',
danish: 'Velkomst',
dutch: 'Welkom',
estonian: 'Tere tulemast',
finnish: 'Tervetuloa',
flemish: 'Welgekomen',
french: 'Bienvenue',
german: 'Willkommen',
irish: 'Failte',
italian: 'Benvenuto',
latvian: 'Gaidits',
lithuanian: 'Laukiamas',
polish: 'Witamy',
spanish: 'Bienvenido',
swedish: 'Valkommen',
welsh: 'Croeso'
};


function welcome(language) {
switch (language) {
case 'english':
return lang.english;
break;
case 'czech':
return lang.czech;
break;
case 'danish':
return lang.danish;
break;
case 'dutch':
return lang.dutch;
break;
case 'estonian':
return lang.estonian;
break;
case 'finnish':
return lang.finnish;
break;
case 'flemish':
return lang.flemish;
break;
case 'french':
return lang.french;
break;
case 'german':
return lang.german;
break;
case 'irish':
return lang.irish;
break;
case 'italian':
return lang.italian;
break;
case 'latvian':
return lang.latvian;
break;
case 'lithuanian':
return lang.lithuanian;
break;
case 'polish':
return lang.polish;
break;
case 'spanish':
return lang.spanish;
break;
case 'swedish':
return lang.swedish;
break;
case 'welsh':
return lang.welsh;
break;
default:
return lang.english;
break;
}
};
18 changes: 18 additions & 0 deletions Logica/Logica/2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function pelicula(tarjeta, boleto, descuento) {
let n = 1;
let precio_boleto;
let temp = boleto;
let total = 0;
while (true) {
precio_boleto = boleto * n;
temp *= descuento;
total += temp;
if (precio_boleto > Math.ceil(total + tarjeta)) {
break;
}
n++;
}
return n;

}
console.log(pelicula(12, 4, .90));
15 changes: 15 additions & 0 deletions Logica/Logica/3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function wallpaper(l, w, h) {
if (l > 0 && w > 0 && h > 0) {
let area = 2 * ((l * h) + (w * h));
let roll = area / (0.52 * 10);
var order = Math.ceil(roll + (roll * 0.15));
}
else {
order = 0;
}

let numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty'];

var final = numbers[order];
return final;
};
8 changes: 8 additions & 0 deletions Logica/Logica/4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function potatoes(p0, w0, p1) {
let dryPercent = (100 - p0) / 100;
let dryPotatoes = w0 * dryPercent;
let final = dryPotatoes / ((100 - p1) / 100);
return Math.trunc(final)
};

potatoes(99, 100, 98)
13 changes: 13 additions & 0 deletions Logica/Logica/5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function closestToZero(...nums) {
let closest = 0
for (let i = 0; i < nums.length; i++) {
if (closest === 0) {
closest = nums[i]
} else if (nums[i] > 0 && nums[i] <= (closest)) {
closest = nums[i]
} else if (nums[i] < 0 && -nums[i] < (closest)) {
closest = nums[i]
}
}
return closet
};
10 changes: 10 additions & 0 deletions Logica/Logica/6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function getUrlParameter(busqueda) {
let llave = busqueda.slice(busqueda.indexOf('?') + 1).split('&');
let parametro = {}
llave.map(hash => {
let [key, val] = hash.split('=')
parametro[key] = decodeURIComponent(val)
})
return parametro;
}
console.log(getUrlParams(window.location.busqueda))
16 changes: 16 additions & 0 deletions Logica/Logica/7.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function bubbleSort(list) {
if (list.length < 2) {
return false;
} else {
for (var i = 0; i < list.length; i++) {
for (var j = 0; j < list.length - i - 1; j++) {
if (list[j] < list[j + 1]) {
var temp = list[j];
list[j] = list[j + 1];
list[j + 1] = temp;
}
}
}
}
return list;
};
13 changes: 13 additions & 0 deletions Logica/Logica/8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function volDiff([a, b, c], [d, e, f]) {
let volCub1 = a * b * c;
let volCub2 = d * e * f;
let diff = 0
if (volCub1 > volCub2) {
diff = volCub1 - volCub2;
} else {
diff = volCub2 - volCub1;
}
return diff
};

volDiff([2, 2, 3], [5, 4, 1]);
20 changes: 20 additions & 0 deletions Logica/Logica/9.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function remove(s) {
var stringToConvert = s;
var convertedArray = [...stringToConvert];
function remove1(valor) {
return valor !== "¡";
}
function remove2(valor2) {
return valor2 !== "!";
}
var remove = convertedArray.filter(remove1);
var removeDos = remove.filter(remove2);


removeDos.push("!")

var string = removeDos.join('');
console.log(string);
}

remove("¡Hi!");
13 changes: 13 additions & 0 deletions Usabilidad/clones/Angular/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
39 changes: 39 additions & 0 deletions Usabilidad/clones/Angular/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db
27 changes: 27 additions & 0 deletions Usabilidad/clones/Angular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Angular

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
Loading