This file contains 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
<?php | |
namespace App\Filters; | |
use CodeIgniter\HTTP\RequestInterface; | |
use CodeIgniter\HTTP\ResponseInterface; | |
use CodeIgniter\Filters\FilterInterface; | |
class Auth implements FilterInterface{ | |
This file contains 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
<?php | |
class MY_Form_validation extends CI_Form_validation { | |
public function __construct() { | |
parent::__construct(); | |
} | |
public function file_check($str){ | |
$CI = $get_instance(); | |
$allowed_mime_type_arr = array('application/pdf','image/gif','image/jpeg','image/pjpeg','image/png','image/x-png'); |
This file contains 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
<?php | |
class MY_Form_validation extends CI_Form_validation{ | |
public $ci; | |
public function __construct($config = array()){ | |
parent::__construct($config); | |
$this->ci =& get_instance(); | |
} | |
function edit_unique($value, $params) { |
This file contains 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
class UI { | |
static displayElements() { | |
//let elements = Store.getElements().then(r => {return r}); | |
let elements = Store.getElements() | |
.then((data)=> {return data}); | |
console.log(elements); | |
elements.forEach(function(element) { | |
UI.addElementsToDom(element) | |
}); | |
} |
This file contains 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
var runCronCorteEmpresa = new CronJob({ | |
cronTime: '00 00 00 * * 0-6', | |
onTick: function() { | |
mongoose.connect('mongodb://heroku_g0l82g29:h3t4299755taqigahev14nnp1k@ds121906.mlab.com:21906/heroku_g0l82g29', { useNewUrlParser: true }) | |
.then( async () => { | |
debugS('Conectado a la base de datos') | |
const result = await run(); | |
disconnect(result); | |
}) | |
.catch(err => { debugF('Algo salio mal', err ); disconnect(); }); |
This file contains 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
/*code*/ | |
exports.index = (req, res, next) => { | |
let empresasId = req.user.empresas; | |
Incidencia.find({}) | |
.populate('Historial') | |
.exec() | |
.then(incidencias =>{ | |
res.json({ | |
incidencias | |
}); |
This file contains 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
Historial.findById(req.params.id) | |
.populate("incidencia") | |
.exec() | |
.then(incidencias =>{ | |
if (!incidencias) { | |
return res.status(404).json({ | |
message: "No hay incidencias..." | |
}); | |
} | |
Incidencia.populate(incidencias.incidencia.cupon, {path:"cupones"}, function(err, info) { console.log('cupones',info) }); |
This file contains 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
exports.editarPost = async (req, res, next) => { | |
let data = req.body; | |
req.checkBody('respuesta', 'Campo obligatorio, compuesto de minimo 15 carácteres.').optional({ checkFalsy: true }).isLength({min:16}); | |
let errors = req.validationErrors(); | |
if(errors){ | |
res.json({ | |
ok:false, | |
errors | |
}); | |
}else{ |
This file contains 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
'use strict' | |
function select2Action(id_selector,max_selection,placeholder,multiple) { | |
var arr = []; | |
$(`#${id_selector}`).select2({ | |
maximumSelectionLength: max_selection, | |
language: "es", | |
placeholder: placeholder, | |
width: '100%', | |
minimumInputLength: 3, |
This file contains 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
//Ejercicio 1 | |
var arr = ["Acoxpa - Auditorio", "Polanco - Santa Fe", "Acoxpa - Auditorio", "Reforma - Coacalco", "Acoxpa - Auditorio", "Polanco - Santa Fe"]; | |
function count(arr){ | |
arr.sort(); | |
var result = []; | |
var current; | |
var count = 0; | |
for (var i = 0; i <= arr.length; i++){ | |
if (arr[i] != current) { |
NewerOlder