confirmation page
This file contains 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
// 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() |
This file contains 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
import java.util.*; | |
interface Node {} | |
class LeafNode implements Node { | |
String operand; | |
public LeafNode(String o) { | |
operand = o; | |
} | |
public String toString() { |
This file contains 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
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) {} |
This file contains 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
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]) |
This file contains 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
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); |
This file contains 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
//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) |
This file contains 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
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 |
This file contains 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
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. |
This file contains 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 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+"!!!") |
NewerOlder