Skip to content

Instantly share code, notes, and snippets.

@josepereza
josepereza / angular-infinite-scroll-cdk.md
Created October 2, 2020 13:42
Infinite Virtual Scroll with the Angular CDK

title: Infinite Virtual Scroll with the Angular CDK lastmod: 2018-10-21T18:16:07-07:00 publishdate: 2018-10-21T18:16:07-07:00 author: Jeff Delaney draft: false description: Build an Infinite Virtual Scroll with the Angular CDK tags: - angular

  • animation
const fetch = require('node-fetch')
/**********************************************************************************
OPCION TRADICIONAL
**********************************************************************************/
function getNombre(username){
const url = `https://api.github.com/users/${username}`
fetch(url)
.then( res => res.json() )
.then( json => { console.log(json.name) })
@josepereza
josepereza / GIT -guia rapida
Created March 18, 2020 07:38
GIT guia rapida
==========================================================================================
========== GIT – Guía rápida ==========
==========================================================================================
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------

How to use Materialize CSS in Angular 7-8-9

  • Install the materialize-css node package in your application.
npm install materialize-css --save
  • Open angular.json file & add below styles & scripts.
  "styles": [
         "./node_modules/materialize-css/dist/css/materialize.css",
@josepereza
josepereza / routing-lxc-container-ports.md
Last active December 8, 2019 08:57
Routing lxc container ports

Routing ports for lxc containers

Reference: Forward port to LXC guest using UFW, answer by Steve Zahn. March 17, 2014.

The lxd service can be used to manage lxc system containers on Linux hosts, very much like Docker does for application containers. One Docker feature that LXD lacks is a native parameter for routing container ports so they can be accessed on the network beyond the lxd host. Routing using the iptables command

On an lxd host protected by the standard iptables kernel firewall, the following command will route external traffic to a specific port of a specific container:

$ sudo iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 8080 -j DNAT --to 10.1.0.5:80

@josepereza
josepereza / node js - materialize.md
Last active November 17, 2019 18:34
node js - materialize

*Primero se instala:

npm install materialize-css.
  • En el archivo index.html
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
@josepereza
josepereza / vuex.txt
Created November 17, 2019 09:32
¿Por qué usar Vuex?
Al crear aplicaciones de gran tamaño, como las aplicaciones de una sola página (SPA), que suelen constar de muchos componentes reutilizables, se pueden volver difíciles de construir y mantener rápidamente. El intercambio de datos y el estado entre estos componentes también puede descomponerse rápidamente y ser difícil de depurar y mantener.
Al utilizar un almacén de datos de aplicaciones centralizado, el estado completo de la aplicación se puede representar en un solo lugar, lo que hace que la aplicación esté más organizada. Mediante el uso de un flujo de datos unidireccional, las mutaciones y el acceso a los datos del componente de alcance solo a los datos requeridos, se vuelve mucho más sencillo razonar sobre el rol del componente y cómo debe afectar el estado de la aplicación.
Los componentes de VueJS son entidades separadas y no pueden compartir datos entre sí fácilmente. Para compartir datos sin vuex necesitamos emit evento con datos y luego escuchar y capturar ese evento con on .
componente 1
this.
@josepereza
josepereza / vue js - bootstrap.md
Last active October 11, 2019 08:38
vue js - bootstrap - Integracion de bootstrp 4.3 en vue.js

The very short version

I recommend reading through the whole post below at least once. But if you’re just here to get this set up as fast as possible, the short version is this:

 npm i bootstrap jquery popper.js
Add to src/main.js:
    import 'bootstrap'; 
 import 'bootstrap/dist/css/bootstrap.min.css';
@josepereza
josepereza / vue js- materialize
Last active February 14, 2024 18:00
Integracion de materializecss en vue js.
npm install materialize-css
o
yarn add materialize-css@next
//Agregar en el archivo main.js
import Vue from 'vue';
import VueRouter from "vue-router";
import App from './App.vue';
@josepereza
josepereza / vue js - start
Created October 5, 2019 17:23
vue js - empezando con vue js
sfsf