Skip to content

Instantly share code, notes, and snippets.

View romaefGit's full-sized avatar
馃幆
Focusing

Romario romaefGit

馃幆
Focusing
View GitHub Profile
@romaefGit
romaefGit / FlexVerticalAlign.scss
Last active October 19, 2020 21:29
This is usefull when you had something to put in the center with every height
.main-container {
background: #ddddd;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
&__box {
background: white;
@romaefGit
romaefGit / generaNuevoConsecutivo.js
Created October 29, 2019 20:06
JavaScript - Genera el consecutivo de cualquier n煤mero tipo String
// JS
/**
* Autor - Romario Augusto Estrada Fl贸rez -romarioestrada.ff@hotmail.com
* [generaConsecutivo Genera el consecutivo de cualquier cifra con ceros antes del valor o no.
* Ejemplo: 002, genera el string 003, si viene 999, genera el 1000, si viene 099, genera el 100.]
* @param {[String]} ultimoConsecutivo [el consecutivo en string.]
* @return {[String]} [el consecutivo sumado en uno.]
*/
function generaNuevoConsecutivo(ultimoConsecutivo) {
var cantidadCaracteresConsecutivo = ultimoConsecutivo.length;
@romaefGit
romaefGit / existTheValue.js
Created October 29, 2019 20:05
JavaScript - Reviza si existe un valor en una variable de cualquier tipo
/**
* Autor - Romario Augusto Estrada Fl贸rez -romarioestrada.ff@hotmail.com
* [existTheValue reviza que una variable no est茅 vac铆a.]
* @param {[Array, String, Integer, Float...]} value [El valor de la variable]
* @return {[Boolean]} [Returna true si existe, false si no]
*/
var existTheValue = function(value) {
if ((value == '') || (value == null) || (value == undefined) || (value == [])) {
return false;
@romaefGit
romaefGit / recursividad.js
Created October 29, 2019 20:04
JavaScript - Recursividad con javascript
var empleadosByUser = [];
var termino = false;
/**
* Autor - Romario Augusto Estrada Fl贸rez -romarioestrada.ff@hotmail.com
* [recursividad Esta funci贸n hace que se vayan agregando empleados a un usuario, cada vez que en cuentre uno dentro de otro.
Ejemplo JSON = {
"Usuario": "Moni",
"Area": "Sistemas",
"Jefe": "Sopo",
"IdUsuario": "8",
@romaefGit
romaefGit / uniquesArraySimply.js
Created October 29, 2019 20:04
JavaScript - Arreglo 煤nico de indices normales
/**
* [uniquesArraySimply Duvelve un arreglo sencillo sin items repetidos:
example : arreglo ENVIADO = ['1',0,1,'2']
arreglo RETURN = [0,1,'2']]
* @param {[Array]} arr [El areglo normalito.]
* @return {[Array]} [El arreglo sin indices repetidos]
*/
var function = uniquesArraySimply(arr) {
var a = [];
for (var i = 0, l = arr.length; i < l; i++)
@romaefGit
romaefGit / quitarItemsRepetidos.js
Created October 29, 2019 20:03
Javascript - Quitar items repetidos de un arreglo de objetos
/**
* Autor - Romario Augusto Estrada Fl贸rez - romarioestrada.ff@hotmail.com
* [quitarItemsRepetidos quita los items repetidos de un array con indice de tipo JSON seg煤n
el campo que tu digas que debe ser 煤nico.
* var data = [{ "name": "Lenovo Thinkpad 41A4298", "website": "google" },
{ "name": "Lenovo Thinkpad 41A2222", "website": "google" },
{ "name": "Lenovo Thinkpad 41Awww33", "website": "yahoo" },
{ "name": "Lenovo Thinkpad 41A424448", "website": "google" },
{ "name": "Lenovo Thinkpad 41A429rr8", "website": "ebay" },
{ "name": "Lenovo Thinkpad 41A429ff8", "website": "ebay" },
@romaefGit
romaefGit / generaCodigo.js
Created October 29, 2019 20:02
JavaScript - Funci贸n que genera c贸digos alfanum茅ricos
/**
* Autor - Romario Augusto Estrada Fl贸rez -romarioestrada.ff@hotmail.com
* [generaCodigo genera c贸digo aleatorio alfanum茅rico.]
* @param {[int]} longitud [Se dice de que longitud quiere el c贸digo]
* @return {[string]} [el codigo generado]
*/
function generaCodigo(longitud) {
var caracteres = "abcdefghijkmnpqrtuvwxyzABCDEFGHIJKLMNPQRTUVWXYZ2346789";
var contrasena = "";
for (i = 0; i < longitud; i++) contrasena += caracteres.charAt(Math.floor(Math.random() * caracteres.length));
@romaefGit
romaefGit / quitSpacesOfAstring.js
Created October 29, 2019 20:02
quitSpacesOfAstring.js
/*
* Romario Augusto Estrada Fl贸rez - romarioestrada.ff@hotmail.com
* [quitSpacesOfAstring Convierte una linea de string a una cadena sin espacios.]
* @param {[String]} str [la cadena de texto a la que se quiere quitar los espacios]
* @return {[String]} [retrna cadena de string sin espacios]
*/
var quitSpacesOfAstring = function(str) {
var cadena = '';
var arrayString = str.split(' ');
for (var i = 0; i < arrayString.length; i++) {
@romaefGit
romaefGit / ArrayMakeStringCSV.js
Created October 29, 2019 20:01
JavaScript - Crea un array de items tipo Object en un String
/**
* Romario Augusto Estrada Fl贸rez - romarioestrada.ff@hotmail.com
* [ArrayMakeStringCSV esta funci贸n recibe un arreglo y el nombre de la propiedad,
* de la cual quiere armar un string separado por comas.
* example : recibe -> [{id: 2, nombre:'algo'}, {id: 1, nombre:'algo 2'}]]
* si envian ese arreglo y le dicen el nombre del campo 'id' (arrerglo, 'id'),
* devolver谩: '2,1';
* @param {[Array]} arreglo [El arreglo de items tipo Object]
* @param {[String]} nombreCampo [el nombre de la propiedad]
* @return {[String]} [Una cadena separada por comas]
@romaefGit
romaefGit / desbarataFecha.js
Created October 29, 2019 20:01
JavaScript - desbarata fecha
/**
* Autor - Romario Estrada - romarioestrada.ff@hotmail.com
* [desbarataFecha recibe fecha en formato mes / dia / a帽o -> 3/12/2017]
* @param {[String]} fecha [fecha]
* @return {[JSON]} [fecha partida en un JSON]
*/
var desbarataFecha = function(fecha) {
var respuesta = { day: null, month: null, year: null };
arrayFecha = fecha.split("/");
respuesta.day = parseInt(arrayFecha[1]);