Skip to content

Instantly share code, notes, and snippets.

View javiergamarra's full-sized avatar
😠

Javier Gamarra javiergamarra

😠
View GitHub Profile

New Headless API strategy

As some of you already know, we are focusing our efforts on a new headless API strategy.

This past year we have tested several approaches to simplify API development and offer our users powerful APIs: from extending JAX-RS, through a heavily-typed builder, to using annotations similar to JAX-RS. Along the way, several alternative approaches appeared, pure JAX-RS approaches, GraphQL or OpenAPI-first designs.

Having several API initiatives at the same time, although great for maximizing learning, also meant a difficult time offering a consistent and uniform experience for developers and end users.

That's why Brian decided to unify them in a common approach, trying to get the best of each of them. As of today, the common approach for APIs under liferay will be an OpenAPI first design, with JAX-RS endpoints created by a gradle/java generator. This new approach will be lead by Brian Chan and Peter Shin.

@javiergamarra
javiergamarra / profile.json
Last active May 22, 2018 09:13
Example Profile
{
"title": "Liferay Portal API",
"description": "A set of APIs that allows you to consume all of Liferay Portal resources",
"@context": {
"hydra": "https://www.w3.org/ns/hydra/core#",
"ApiDocumentation": "hydra:ApiDocumentation",
"property": {
"@id": "property",
"@type": "@id"
},
@javiergamarra
javiergamarra / hola.component.ts
Created March 12, 2018 21:38
Observable.fromEvent in angular5
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
@Component({
selector: 'app-hola',
template: `
<p>
hola works!
<button #hola>Hola!</button>
import {
Component, ComponentFactoryResolver, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild,
ViewContainerRef
} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'app-talk',
styles: [
@javiergamarra
javiergamarra / nativescript.md
Created November 23, 2017 01:37
Requisitos del curso de Nativescript

AVISO

Es importante llevar el entorno instalado, el SDK de Android ocupa más de 1GB, no se puede descargar para instalación offline y es más que probable que la red no soporte descargas de ese tamaño.

Requisitos

  • Instalar Node (la última LTS vale)
  • Instalar Nativescript:

npm install -g nativescript

@javiergamarra
javiergamarra / android_things.md
Last active March 9, 2018 09:57
Requisitos para el taller de Android Things

Importante

Tenemos material para 30 personas aproximadamente (en parejas), si hay más asistentes nos organizaremos en grupos de 3.

El requisito principal es llevar instalado Android Studio 3.0 con el SDK de Android.

Requisitos

Es muy importante que lleves el entorno montado, ocupa 2GB y será difícil bajarlo de la red en el momento.

@javiergamarra
javiergamarra / gist:1f5cc859ce70eff7d86be22548f17697
Created September 20, 2017 06:30
Playing with kotlin and functional concepts
import java.util.function.Consumer
data class User(val name: String, val password: String, val age: Int, var organizationId: Int?)
fun addUser(name: String, password: String, age: Int): Result<User, UserError> {
val user = User(name, password, age, 0)
val userValidator: Validator = compose(compose(validateAge, nameValidator), validatePassword)
//Child component
@Output()
artistClicked:EventEmitter = new EventEmitter(); //does not need type
click() {
this.artistClicked.emit(this.artist);
}
//html
<spotify-artist [artist]="artista" (artistClicked)="receive($event)"></spotify-artist>
@javiergamarra
javiergamarra / dagger2.md
Created February 2, 2016 14:05
Dagger2 DI

"Don't use Dagger for unit tests; just instantiate the class being tested and pass its dependencies manually."

  • "By building on standard javax.inject annotations (JSR 330), each class is easy to test. You don't need a bunch of boilerplate just to swap the RpcCreditCardService out for a FakeCreditCardService." -- Dagger Home Page
@javiergamarra
javiergamarra / AddDeliciousInteractorImpl.java
Created December 11, 2015 13:08
Example of a custom interactor
package com.liferay.mobile.screens.bookmark.interactor;
import com.liferay.mobile.screens.base.interactor.BaseRemoteInteractor;
import com.liferay.mobile.screens.util.EventBusUtil;
import com.liferay.mobile.screens.util.LiferayLogger;
import com.squareup.okhttp.Headers;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import java.io.IOException;