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
if (typeof window.console == "undefined" || typeof window.console.log == "undefined") { | |
window.console = { | |
log: function() { | |
}, | |
info: function() { | |
}, | |
warn: function() { | |
} | |
}; | |
} |
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 _idUnico = function(secuencia, separador) { | |
//valores por defecto | |
secuencia = typeof(secuencia) != 'undefined' ? secuencia : 1; | |
separador = typeof(separador) != 'undefined' ? separador : '-'; | |
var id = '', | |
a=1; | |
for (var i = 0; i < secuencia; i++) { |
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
db.personas.update( { identificador: '14026086' }, { $inc: { age : 1 } } ); |
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
function validaCodigo (nuevoCodigo) { | |
var codigosExistentes = ['codigo', 'codigoDOS']; | |
for(i=0;i< codigosExistentes.length;i++) { | |
if(nuevoCodigo == codigosExistentes[i]){ | |
valido = false; | |
console.log('codigo existe : ' + nuevoCodigo + ' ID: ' + i); | |
break; | |
}else{ | |
valido = true | |
} |
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 color = function() { | |
var hex = '0123456789ABCDEF', | |
color = '#'; | |
for (i=0;i<6;i++){ | |
color+=hex.charAt(parseInt(Math.floor(Math.random() * hex.length))); | |
} | |
return color; | |
} |
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 lista = [[1,3],['a'],[4,5]] | |
var perm = (array, prefix = '')=>{ | |
if (!array.length) { | |
return prefix | |
} | |
let resultado = array[0].reduce((resultado, valor) => { | |
return resultado.concat(perm(array.slice(1), prefix + valor)) | |
}, []); | |
return resultado |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
numero = 0 | |
lista = [] | |
while len( lista ) <= 59: | |
numero += 1 | |
validar = 0 | |
if numero % 10 == 7: |
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'; | |
// This class is used for logins | |
class Login { | |
constructor(hash) { | |
this.sessions = []; | |
this.users = []; | |
this.passwords = []; | |
Object.keys(hash).map(user => this.registerUser(user, hash[user])) | |
} |
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 | |
$dbconn = pg_connect("host=localhost port=5432 dbname=nombreBaseDeDatos user=postgres password=xxxxxxx"); | |
$estado = pg_connection_status($dbconn); | |
echo ($estado === PGSQL_CONNECTION_OK) ? 'Estado de la conexión ok' : 'No se ha podido conectar' ; | |
echo '<br>'; | |
$resultado = pg_query($dbconn, "SELECT nombre FROM usuario"); | |
$resultadoQuery = (!$resultado) ? "Ops! Imposible Ejecutar Query" : "Query Ok..." ; | |
echo $resultadoQuery; | |
echo '<br>'; |
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
#!/bin/sh | |
# Cambia el Nombre de un Branch de forma Local y Remota | |
echo "Nombre Rama Actual?" | |
read old_branch | |
echo "Nombre Nueva Rama?" | |
read new_branch | |
echo "Cambiaras la rama actual: $old_branch por $new_branch" |
OlderNewer