@Test fun list() {
println(measureTimeMillis {
println((0..10000000)
.filter { it % 2 == 0}
.map { it * it }
.map { it - 10 }.size)
})
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MutableErrorLiveData<T> : MutableLiveData<Notification<T>>() { | |
fun observe(owner: LifecycleOwner, onNext: (T) -> Unit, onError: (Throwable) -> Unit) { | |
observe(owner, Observer { notification -> | |
notification ?: return@Observer | |
if (notification.isOnNext) { | |
onNext(notification.value!!) | |
} else if (notification.isOnError) { | |
onError(notification.error!!) | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NonNull | |
@Override public Observable<User> getUser(int id) { | |
return localDataSource.getUser(id) | |
.onErrorResumeNext( | |
remoteDataSource.getUser(id).doOnNext(new Action1<User>() { | |
@Override public void call(User user) { | |
localDataSource.saveUser(user); | |
} | |
}) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11:16:31.008 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: .gradle/native | |
11:16:31.378 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Waiting for daemons with canceled builds to become available | |
11:16:34.476 [INFO] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing 0 daemon stop events from registry | |
11:16:34.482 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Previous Daemon (34088) stopped at Thu Jun 08 10:54:41 UTC 2017 other compatible daemons were started and after being idle for 0 minutes and not recently used | |
11:16:34.496 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Starting daemon process: workingDir = .gradle/daemon/4.0-milestone-1, daemonArgs: [/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home | |
11:16:34.515 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'Gradle build daemon'. Working directory: .gradle/daemon/4.0-milestone-1 Comma |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "log" | |
type Object struct { | |
} | |
func (o Object) value() { | |
log.Println(o, "call value receiver") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"auto_complete": true, | |
"auto_complete_delay": 50, | |
"auto_indent": true, | |
"auto_match_enabled": true, | |
"bold_folder_labels": true, | |
"caret_style": "phase", | |
"default_encoding": "UTF-8", | |
"disable_formatted_linebreak": true, | |
"draw_indent_guides": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"auto_complete": true, | |
"auto_complete_delay": 50, | |
"auto_indent": true, | |
"auto_match_enabled": true, | |
"bold_folder_labels": true, | |
"caret_style": "phase", | |
"default_encoding": "UTF-8", | |
"disable_formatted_linebreak": true, | |
"draw_indent_guides": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img.grayscale.disabled { | |
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale"); | |
-webkit-filter: grayscale(0%); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en" ng-app="myApp"> | |
<head> | |
<meta charset="UTF-8"> | |
<script src="src/vendor/jquery.js"></script> | |
<script src="src/vendor/angular.js"></script> | |
<script src="src/app.js"></script> | |
<script src="src/filters.js"></script> | |
<script src="src/controllers.js"></script> |