Skip to content

Instantly share code, notes, and snippets.

Avatar

Michal Faber michalfaber

  • Kraków, Poland
View GitHub Profile
@michalfaber
michalfaber / example00.scala
Created Jul 23, 2015
Flat structure -> chierarchy
View example00.scala
def comments(postId: Int) : Future[Seq[CommentNode]] = {
val query = for {
comment <- Comments if comment.objectId === postId
author <- Users if author.id === comment.userId
} yield (author, comment)
val comments: Future[Seq[Comment]] = for {
result <- db.run(query.result)
} yield result.map { case (author, comment) =>
Comment(comment.id, comment.replyToId, author.name, author.site, comment.date, comment.body, comment.bodyHtml)
@michalfaber
michalfaber / fadeinfadeout.java
Created Nov 18, 2014
Universal FadeIn FadeOut for Android
View fadeinfadeout.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void fadeOut(final View view) {
int sdk = android.os.Build.VERSION.SDK_INT;
if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
AlphaAnimation alpha = new AlphaAnimation(1f, 0f);
alpha.setDuration(mShortAnimationDuration);
alpha.setFillAfter(true);
view.startAnimation(alpha);
} else {
view.animate()
You can’t perform that action at this time.