Skip to content

Instantly share code, notes, and snippets.

Text(
"The key idea is your requirements doc is your source of truth, not your tickets. You create units of" +
" work based on the doc. Edits are versioned and create new units of work. You can get context on" +
" anything you are working on by 'zooming out' to where it is in your docs."
)
val Features = listOf(
Feature(
"Document",
"The primary view of your requirements. Lets you see the current 'state of the world' in one" +
@evant
evant / advent1.sparkle
Created December 7, 2021 18:47
Advent of Code 1a
Dear Princess Celestia: Advent of Code 1.
Today I learned how to calculate how quickly my submarine depth increases.
Did you know that the found depths have the numbers 0 and 0?
Did you know that the number of measurements is a number?
Did you know that the last measurement was a number?
Here's what I did,
I heard the last measurement.
// cue export --out text fizzbuzz.cue
import "strings"
_numbers: [1,2,3,4,5,6,7,8,9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,

Keybase proof

I hereby claim:

  • I am evant on github.
  • I am evant (https://keybase.io/evant) on keybase.
  • I have a public key ASCeFjmQU8VV-Elouees8rKTCkk8tO7qjDFQBzL1J3umqgo

To claim this, I am signing this object:

@evant
evant / EvictableSingleCache.java
Last active May 14, 2017 17:03
A single cache that allows evicting the value or error. Subscriptions after the value is evicted will re-trigger the upstream observer.
/**
* Copyright (c) 2016-present, RxJava Contributors.
*
* 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 distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
@evant
evant / README.md
Created November 29, 2016 21:04
RxDiffUtil

Usage

Given a stream of collection of items to show, provide a diff callback which determines the size and differences in that collection.

Observable<List<String>> observable1 ...;
observable1.compose(RxDiffUtil.diff(new RxDiffUtil.Callback<List<String>>() {
    @Override
    public int getSize(List<String> list) {
        return list.size();
 }
public static void hideKeyboard(Activity context) {
View currentFocus = context.getCurrentFocus();
if (currentFocus != null) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
}
}
}

Suggestions for the new Transform Api

Possibly the biggest issue I see with the current api is that it is very hard to extend it in the future without breaking current implementations. For example, I asked to be provided the LoggingManager for the task so I can redirect stdout output inside the transform. This cannot be done without changing the api. I have a couple suggestions to fix this issue, it would be better to do it now while it's still in beta.

  1. Provide the gradle task that performs the transform to the transform method.
@evant
evant / AppBackgroundChecker.java
Created September 3, 2015 14:04
Check when app is in forground/background (api 14+)
public class AppBackgroundChecker implements Application.ActivityLifecycleCallbacks, ComponentCallbacks2 {
private boolean isBackground;
public void register(Application application) {
application.registerActivityLifecycleCallbacks(this);
application.registerComponentCallbacks(this);
}
@Override
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
/**
* Abuse loaders to retain some state across rotations for a Fragment or Activity.
*/
public class RetainStateManager {