Skip to content

Instantly share code, notes, and snippets.

View rfermontero's full-sized avatar
:octocat:

Roberto Fernández rfermontero

:octocat:
View GitHub Profile
@rfermontero
rfermontero / influencersEngad.kt
Created August 31, 2020 15:35
influencersEngad.kt
private fun numberOfLikes(user: User) = user.timeLineMedia.edges.sumBy { it.node.likes.count }
private fun numberOfComments(user: User) = user.timeLineMedia.edges.sumBy { it.node.comments.count }
private fun calculateEngagement(user: User) = if (user.isPrivate) 0f else
BigDecimal((numberOfLikes(user) + numberOfComments(user)))
.divide(
BigDecimal(user.followers.count),
3,
RoundingMode.HALF_DOWN
)
.multiply(BigDecimal.TEN)
val assistantResponses: Observable<Either<AssistantError, AssistantResponse>>
get() {
Logger.i(TAG, "getAssistantResponses")
val activityObservable = readyObservable
.observeOn(Schedulers.io())
.flatMap<Either<Throwable, Conversation>> { startConversation() }
.flatMap<Either<SocketEvent, ActivitySet>> { connectConversation(it) }
.filter { socketNotOpened(it) }
.map<Either<AssistantError, ActivitySet>> { mapSocketEventToDomainModel(it) }
.flatMapIterable<Either<AssistantError, Pair<Activity, String>>> { flatMapIterable(it) }
@rfermontero
rfermontero / vscode
Created February 13, 2020 00:42
vscode
.
{"v":"4.10.1","fr":29.9700012207031,"ip":0,"op":75.0000030548126,"w":1080,"h":1080,"nm":"Bloobing Effect","ddd":0,"assets":[{"id":"comp_12","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Mic","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":46,"s":[100],"e":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":54,"s":[0],"e":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":249,"s":[0],"e":[100]},{"t":252.00001026417}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[337.5,524.5,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[2108.128,2108.128,100],"ix":6}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"f","pt":{"a":0,"k":{"i":[[-0.028,-0.527],[0,0],[0,0],[0.581,-0.028],[0.028,0.581],[-0.002,0.037],[0,0],[0,0],[-0.579,-0.035]],"o":[[0,0],[0,0],[0.028,0.581],[-0.581,0.028],[-0.002,-0.038],[0,0],[0,0],[0.035,-0.58],[0
package com.uned;
import java.util.Arrays;
import java.util.Random;
/**
* Se dispone de n cubos indentificados del 1 a n. Cada cubo tiene en una de sus caras una letra distinta. Se india
* una palabra de n letras.
* Colocar los n cubos uno a continuacion del otro de forma que con esa disposicion se forme la palabra dada.
public class Api {
private static String BASE_URL = "";
private static final int DEFAULT_TIMEOUT = 30 * 1000;
private static AsyncHttpClient client = new AsyncHttpClient();
static {
client.setUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120427 Firefox/15.0a1");