Skip to content

Instantly share code, notes, and snippets.

View dferrandizmont's full-sized avatar
🏠
Working from home

Daniel Mont Ferrandiz dferrandizmont

🏠
Working from home
  • Terrassa, Barcelona.
  • 10:49 (UTC +02:00)
View GitHub Profile
@dferrandizmont
dferrandizmont / directives.md
Created December 16, 2018 10:37
[Directives] #angular

Directives

Use a directive to augment a DOM node:

  • To transform its contents in a regular manner.
  • To add a behaviour that is general and reusable.

Do not use a directive:

  • To augment or manipulate shared scope (use a controller instead).
  • To allow a partial to include another partial specific to your application (this is not composable, use nested states instead).
@dferrandizmont
dferrandizmont / composition.md
Last active December 17, 2018 14:39
[Composition] #angular

Composition

It is important not to hide composition. It should be done centrally, at the root of the application.

In angular there are 2 different resources we must compose in order to build an application

  • Using a composition root we map directives, controllers, and services into the injector.

  • Using routing we compose views from HTML partials and controllers for each different application state.

@dferrandizmont
dferrandizmont / Java cheatsheet.md
Last active December 17, 2018 15:24
[Java cheatsheet] #java
Operation Code
New List List<Integer> x = new ArrayList<Integer>();
Copy List List<Integer> x = new ArrayList<Integer>(y);
Add an element to the List x.add(element)
Get an elemenet from the List x.get(index)
Clear the list x.clear()
New HashMap HashMap<Integer, String> x = new HashMap<Integer, String>();
Add element to the map x.put(key, value)
Get an element from the map x.get(key)
@dferrandizmont
dferrandizmont / flexbox-cheatsheet.md
Created December 17, 2018 15:45
[Flexbox cheatsheet] #flex
@dferrandizmont
dferrandizmont / coses-adria.md
Last active January 7, 2019 13:11
[Scripts / Text / Anotacions Adrià] #Other

ENTRAR DENTRO DEL CONTENEDOR

docker exec -it confident_mccarthy bash

REALIZAR COPIA DE SEGURIDAD

mysqldump --user root --password=Set-ting88 lfportal > liferay_2018_07_03.sql

RESTAURAR COPIA DE SEGURIDAD

mysql -u root -p produccio < produccio_2018_07_03.sql

COPIA DE SEGURIDAD ENTRE SERVIDOR Y LOCAL

@dferrandizmont
dferrandizmont / ReactiveBean.java
Created January 7, 2019 13:17
[ReactiveBean] JavaServer Faces with rxJava. #rxjava
package com.reactive;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import rx.Observable;
import rx.Subscriber;
@dferrandizmont
dferrandizmont / HelloWorld.java
Created January 7, 2019 13:18
[Hello World] JavaServer Faces with rxJava #rxjava
package learnrxjava.examples;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.schedulers.Schedulers;
public class HelloWorld {
@dferrandizmont
dferrandizmont / why-rx.md
Last active January 8, 2019 14:25
[PART 1.0 - Getting started] Why Rx #rxjava #rxjavaguide

PART 1 - Getting started

Why Rx

Users expect real time data. They want their tweets now. Their order confirmed now. They need prices accurate as of now. Their online games need to be responsive. As a developer, you demand fire-and-forget messaging. You don't want to be blocked waiting for a result. You want to have the result pushed to you when it is ready. Even better, when working with result sets, you want to receive individual results as they are ready. You do not want to wait for the entire set to be processed before you see the first row. The world has moved to push; users are waiting for us to catch up. Developers have tools to push data, this is easy. Developers need tools to react to push data

Welcome to Rx. This book is based on Rx.NET's www.introtorx.com and it introduces beginners to RxJava, the Netflix implementation of the original Microsoft library. Rx is a powerful tool that enables the solutio

@dferrandizmont
dferrandizmont / lifetime-management.md
Last active January 8, 2019 14:25
[PART 1.2 Lifetime management] #rxjava #rxjavaguide

Lifetime management

The idea behind Rx is that it is unknown when a sequence emits values or terminates, but you still have control over when you begin and stop accepting values. Subscriptions may be linked to allocated resources that you will want to release at the end of a sequence. Rx provides control over your subscriptions to enable you to do that.

Subscribing

There are several overloads to Observable.subscribe, which are shorthands for the same thing.

Subscription subscribe()