(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| import scala.concurrent.duration._ | |
| import scala.concurrent.ExecutionContext | |
| import scala.concurrent.Future | |
| import akka.pattern.after | |
| import akka.actor.Scheduler | |
| /** | |
| * Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown, | |
| * in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through | |
| * the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure. |
| package org.lucasr.transition.samples; | |
| import android.support.v7.app.ActionBarActivity; | |
| import android.os.Bundle; | |
| import android.transition.TransitionManager; | |
| import android.view.LayoutInflater; | |
| import android.view.Menu; | |
| import android.view.MenuItem; | |
| import android.widget.ListView; |
| package com.example.android_transition_samples.app; | |
| import android.animation.Animator; | |
| import android.animation.AnimatorSet; | |
| import android.animation.ObjectAnimator; | |
| import android.animation.PropertyValuesHolder; | |
| import android.content.Context; | |
| import android.graphics.Rect; | |
| import android.util.AttributeSet; | |
| import android.view.View; |
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "strconv" | |
| "strings" | |
| ) | |
| func main() { |
| /* | |
| * Copyright 2014 Chris Banes | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| import android.text.SpannableStringBuilder; | |
| import java.util.ArrayDeque; | |
| import java.util.Deque; | |
| import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE; | |
| /** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */ | |
| public class Truss { | |
| private final SpannableStringBuilder builder; | |
| private final Deque<Span> stack; |
| package org.lucasr.layoutsamples.canvas; | |
| import android.os.Build; | |
| import android.text.Layout.Alignment; | |
| import android.text.StaticLayout; | |
| import android.text.TextDirectionHeuristic; | |
| import android.text.TextDirectionHeuristics; | |
| import android.text.TextPaint; | |
| import android.text.TextUtils.TruncateAt; | |
| import android.util.Log; |
| # NPM CheatSheet. | |
| # Super easy intall: npm comes with node now. | |
| # To create your own npm package: https://www.npmjs.org/doc/misc/npm-developers.html | |
| # More: https://www.npmjs.org/doc/ | |
| # 1. NPM Command Lines. | |
| # Local mode is the default. | |
| # Use --global or -g on any command to operate in global mode instead. |
| // [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (: | |
| Array.prototype.flatMap = function(lambda) { | |
| return Array.prototype.concat.apply([], this.map(lambda)); | |
| }; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.