Skip to content

Instantly share code, notes, and snippets.

@nobuoka
nobuoka / generic_test_coverage.ja.markdown
Last active March 24, 2021 08:27
generic_test_coverage.rb (fastlane action)

generic_test_coverage.rb

概要

  • fastlane のアクション
  • iOS プロジェクトのビルド結果である result bundle (.xcresult 拡張子) に含まれるカバレッジ情報から SonarQube の Generic Coverage を生成する
  • 内部では xccov コマンドが使用される
@andymatuschak
andymatuschak / States-v3.md
Last active May 1, 2024 12:32
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

import android.support.v4.view.animation.PathInterpolatorCompat;
import android.view.animation.Interpolator;
/**
* Cheatsheet: http://easings.net/
*/
public class EasingsConstants {
public static final Interpolator easeInSine = PathInterpolatorCompat.create(0.47f, 0f, 0.745f, 0.715f);
public static final Interpolator easeOutSine = PathInterpolatorCompat.create(0.39f, 0.575f, 0.565f, 1f);
public static final Interpolator easeInOutSine = PathInterpolatorCompat.create(0.445f, 0.05f, 0.55f, 0.95f);
@josh-burton
josh-burton / MergeRecyclerAdapter
Created August 26, 2014 20:38
A Merge Adapter for the RecyclerView. Based on CommonsWare cwac-merge and the MergedAdapter in the android sdk.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
@jboner
jboner / latency.txt
Last active May 21, 2024 18:29
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD