Skip to content

Instantly share code, notes, and snippets.

View parzibyte's full-sized avatar
💻
Coding

Parzibyte parzibyte

💻
Coding
View GitHub Profile
const COLUMNS = 7,
ROWS = 6,
EMPTY_SPACE = " ",
PLAYER_1 = "o",
PLAYER_2 = "x",
PLAYER_CPU = PLAYER_2,
CONNECT = 4; // <-- Change this and you can play connect 5, connect 3, connect 100 and so on!
<table class="table table-bordered">
<thead>
<tr>
<th v-for="i in COLUMNS">
<button :disabled="!canPlay" @click="makeMove(i)" class="btn btn-warning">Make move
here&nbsp;<i class="fa fa-arrow-down"></i></button>
</th>
</tr>
</thead>
<tbody>
<style>
td {
background-color: #638CFF;
border: 0px !important;
padding: 5px !important;
}
.img-player{
max-width: 100px;
}
</style>
const obtenerNumeroAleatorioEnRango = (min, max) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
const obtenerNumeroAleatorioEnRango = (min, max) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Probar con 10 números aleatorios entre 1 y 100
for(let i = 0; i < 9; i++){
const numeroAleatorio = obtenerNumeroAleatorioEnRango(1, 100);
console.log("Aleatorio: ", numeroAleatorio);
}
[
{
"id": 13,
"nombre": "Luis",
"createdAt": "2020-07-30T04:57:03.202Z",
"updatedAt": "2020-07-30T04:57:03.202Z",
"oficinaId": 62,
"oficina": {
"id": 62,
"nombre": "Sala",
const trabajadores = await modeloTrabajador.findAll({
// Queremos que incluya la relación "oficina"
include: [
{
association: modeloTrabajador.Oficina
}
]
});
const trabajadores = await modeloTrabajador.findAll({
// Queremos que incluya la relación "oficina"
include: [
{
association: modeloTrabajador.Oficina
}
]
});
// Nota: es "oficinaId" porque así le llama a la columna Sequelize
const trabajadorRegistrado = await modeloTrabajador.create({
"nombre": peticion.body.nombre,
"oficinaId": peticion.body.idOficina,
});
// Definimos nuestro modelo
class Trabajador extends Model { }
Trabajador.init(
{
// Los campos del modelo:
nombre: DataTypes.STRING,
},
{
sequelize: sequelize,
modelName: "trabajadores"