This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getNeighbour = (pipesInposition, directionPipe) => { | |
let indexNextPipe = -1; | |
const posibleDirections = [ | |
[[2], [2], [1, 2, 3], [1, 2], [0, 2]], | |
[[3], [3], [0, 2, 3], [2, 3], [1, 3]], | |
[[0], [0], [0, 1, 3], [0, 3], [0, 2]], | |
[[1], [1], [0, 1, 2], [0, 1], [1, 3]] | |
][directionPipe]; | |
if (pipesInposition.length !== 0) { | |
for (let indexPipe of pipesInposition) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getDirections = [ | |
[[1, 0], [0, -1], [-1, 0], [0, 1]], //Figura Inicio (1) y línea (5) | |
[ | |
//Figura tipo T (3) | |
[[2, 0, -1, 1, 0, 1, 3], [3, 1, 0, 0, 0, 1, 3], [1, 1, 0, 0, 0, -1, 1]], | |
[ | |
[3, -1, 0, 2, 1, 0, 0], | |
[2, 0, -1, 1, -1, 0, 2], | |
[0, 0, -1, 1, 1, 0, 0] | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Se carga la imagen en el canvas copia... | |
ctxCopy.clearRect(0, 0, 100, 100); | |
ctxCopy.drawImage(figures[dataPipe[2] - 1].i, 0, 0, width, width); | |
//Se aplica el color si es necesario... | |
if (dataPipe[4] !== "") { | |
ctxCopy.globalCompositeOperation = "source-atop"; | |
//Color a aplicar... | |
ctxCopy.fillStyle = dataPipe[4]; | |
ctxCopy.fillRect(0, 0, width, width); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (dataPipe[3] !== dataPipe[5]) { | |
const indexRotate = pipesRotate.map(v => v[0]).indexOf(index); | |
if (indexRotate >= 0) { | |
const newAngule = angles[dataPipe[5]] === 0 ? 360 : angles[dataPipe[5]]; | |
if (pipesRotate[indexRotate][1] + 15 <= newAngule) { | |
pipesRotate[indexRotate][1] += 15; | |
angle = pipesRotate[indexRotate][1]; | |
} else { | |
angle = newAngule; | |
pipesRotate.splice(indexRotate, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createSHFile = (test) => { | |
return new Promise((resolve, reject) => { | |
const fileSH = `${APK_DIRECTORY}/${test.idapk}/${test.token_apk}.sh`; | |
//Se debe renombrar el archivo... | |
try { | |
const stream = fs.createWriteStream(fileSH); | |
stream.once('open', (fd) => { | |
stream.write("#!/bin/sh\n"); | |
stream.write(`cd ${APK_DIRECTORY}/${test.idapk}\n`); | |
//Renombrar el archivo de features que existe... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sockets = require('./sockets'); | |
const exec = require('child-process-promise').exec; | |
const { | |
ADB_DIRECTORY, | |
AAPT_DIRECTORY, | |
} = require('../config').adb; | |
//Ejecuta acciones ADB shell.. | |
exports.processADB = (command, typeAction = ADB_DIRECTORY, props = {}) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PRECACHE = 'trivia-precache-v12'; | |
const RUNTIME = 'runtime'; | |
const PRECACHE_URLS = [ | |
'/', | |
'/game/img/loader4.gif', | |
'/game/css/all.css', | |
'/game/js/build.min.js', | |
'/game/sound/sounds.mp3', | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let conectaDB = (query, callback) => | |
{ | |
//Realiza la operación de conexión a una base de datos por ejemplo... | |
callback(false, data); | |
}; | |
//Invocar la función.... | |
conectaDB(query, (err, data) => | |
{ |