Skip to content

Instantly share code, notes, and snippets.

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

Fausto Bencosme fbencosme

🏠
Working from home
View GitHub Profile
@fbencosme
fbencosme / gist:0f2502721ef9bef6da07
Last active August 29, 2015 14:24
using java 8 options and streams vs list and null checking
List<Class<?>> assignables = Arrays.asList(Request.class, Response.class, HttpServletRequest.class, HttpServletResponse.class);
void callMethod(final Method me, final HttpServletRequest request, final HttpServletResponse response) {
Optional.ofNullable(me).ifPresent(m -> {
Optional<Class<?>[]> typesStream = Optional.of(m.getParameterTypes());
typesStream
.filter(ctypes -> ctypes.length == 1)
.map(types -> types[0])
@fbencosme
fbencosme / gist:b4fb545f234bfcb771ce
Last active August 29, 2015 14:19
something I saw in devDom
/**
var image = images.memeloperCompilingImage;
for(var day = 0; day < days.length; day++) {
if(day === 5 && !isMemeloperTodayPublushed(image)) {
// Public this memeloper every friday.
memeloperTopics.push(image);
}
}
**/