Skip to content

Instantly share code, notes, and snippets.

// A remember() that can survive recompositions and config changes but not process death.
@Composable
inline fun <T: Any> rememberRetained(
key: String = currentCompositeKeyHash.toString(36), // Copied from rememberSaveable()
crossinline init: @DisallowComposableCalls () -> T
): T {
if (retainedStore[key] == null) {
retainedStore[key] = init()
}
val activity = LocalContext.current.findActivity()
import java.util.*;
interface Node {}
class LeafNode implements Node {
String operand;
public LeafNode(String o) {
operand = o;
}
public String toString() {

confirmation page

final Observable<String> o = Observable.create(new ObservableOnSubscribe<String>() {
@Override
public void subscribe(ObservableEmitter<String> e) throws Exception {
for(int i=0; i<10; i++) {
if(e.isDisposed()) break;
// make request here...
e.onNext(String.valueOf(i));
try {
Thread.sleep(1000);
} catch(InterruptedException ie) {}
var data = [[1, 2, 3], [4, 5, 6]]
var index = 0
print(data[0])
print(data[1])
index = 0
data[index].remove(at:0)
print(data[0])
import java.util.concurrent.*;
public class App {
public static void main(String[] args) throws InterruptedException, ExecutionException {
final int poolSize = 2;
final ExecutorService executorService =
Executors.newFixedThreadPool(poolSize);
final CompletionService<String> completionService =
new ExecutorCompletionService<>(executorService);
//2014.4.11 ken initial version. modified from https://alastaira.wordpress.com/2013/10/25/animal-crossing-curved-world-shader/
Shader "Custom/CurvedWorld" {
Properties {
// Diffuse texture
_MainTex ("Base (RGB)", 2D) = "white" {}
// Degree of curvature
_Curvature ("Curvature", Float) = 0.001
_HorizontalCurvature ("Horizontal Curvature", Float) = 0.001
_RelativePos ("Relative Position", Vector) = (0, 0, 0, 0)
sum : Tree Int -> Int
sum tree =
case tree of
Empty -> 0
Node v left right ->
v + sum left + sum right
flatten : Tree a -> List a
flatten tree =
case tree of
1.
Khan Academy | Mountain View, CA or REMOTE | full-time and internships
We're a small, non-profit tech startup bringing a free, world-class education
to anyone, anywhere.
Millions of people use our free educational platform to learn every month. The
testimonials at <https://www.khanacademy.org/stories> will give you a feel for
just how intense an impact Khan Academy has on the lives of folks in all sorts
of varied situations.
package ken;
import rx.*;
import java.util.concurrent.TimeUnit;
enum MotionEvent { Down, Move, Up };
class Main {
public static void test1() {
Observable.just("Hello")
.map(s -> s+"!!!")