Skip to content

Instantly share code, notes, and snippets.

Working from home

Adrián G mrroot5

Working from home
Block or report user

Report or block mrroot5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mrroot5 / vue-domcontentloaded.vue
Created Sep 11, 2019
Vue DOMContentLoaded: usar vue como si fuera el DOMContentLoaded de JavaScript
View vue-domcontentloaded.vue
<div>{{ asyncText }}</div>
export default {
data: () => ({
asyncText: 'Mi componente'
// Usamos el mounted como punto de inicio
mrroot5 /
Created Aug 12, 2019
Nuxt vuex-persistedstate no guarda el estado en el localstorage


Al actualizar el store de Vuex usando Nuxt con el plugin vuex-persistedstate no se actualiza el LocalStorage del navegador.


La clave radica en establecer que primero cargue nuxt y después actualice el Storage. Un simil sería el "onReadY" de jQuery para el navegador.

mrroot5 / cssgrid-avoid-content-overflow.css
Created Jul 21, 2019
Evitar desbordamiento del contenido en css grid. Avoid css grid content overflow
View cssgrid-avoid-content-overflow.css
.highligth {
color: red;
.grid-container {
display: grid;
grid-template-columns: minmax(0, auto) minmax(0, auto) minmax(0, auto);
grid-template-rows: minmax(0, auto);
grid-gap: 0 1rem;
border: 2px solid black;
mrroot5 /
Created Jun 27, 2019
Obtener las ramas que no se le ha hecho merge a develop
git log --pretty=oneline --merges --grep="into 'develop'" master..develop | cut -d "'" -f2
mrroot5 /
Last active Jun 5, 2019
Instalar entorno de desarrollo


wget -qO- | bash
nvm install --lts
pip3 install docker-compose
pip3 install pylint


mrroot5 /
Last active May 30, 2019
Instalar requirements.apt desde la terminal usando apt-get


Queremos instalar todos los requirements de un fichero llamado requirements.apt.

Método 1: tr

sudo apt-get -y install $(tr '\n' ' ' < requirements.apt)
# -y: instalacion automatica sin preguntas

Método 2: cat

mrroot5 /
Last active May 18, 2019
What is functional programming?


Functional programming is a paradigm in which programs are built in a declarative manner using pure functions that avoid shared state and mutable data. Functions that always return the same value for the same input and don't produce side effects are the pillar of functional programming. Many programmers consider this to be the best approach to software development as it reduces bugs and cognitive load.

  • Cleaner, more concise development experience
  • Simple function composition
mrroot5 / rgb2hex.js
Created May 14, 2019
RGB a hexadecimal
View rgb2hex.js
const RGBToHex = (r, g, b) => ((r << 16) + (g << 8) + b).toString(16).padStart(6, '0');
RGBToHex(255, 165, 1); // 'ffa501'
mrroot5 /
Created May 8, 2019
Capitalize string
def capitalize(string, lower_rest=True):
return string[:1].upper() + (string[1:].lower() if lower_rest else string[1:])
capitalize('fooBar') # 'Foobar'
capitalize('fooBar', False) # 'FooBar'
mrroot5 /
Last active May 27, 2019
Mantenimiento de Ubuntu, actualización ap, snap y eliminación de paquetes obsoletos
sudo apt update && sudo apt full-upgrade && sudo snap refresh && sudo apt autoclean && sudo apt clean && sudo apt autoremove --purge
# Update packages list
# Upgrade packages
# Upgrade snap packages
# Remove old unnecessary apt packages.
# --purge delete all config files, etc. BECAREFUL!!!
You can’t perform that action at this time.