Skip to content

Instantly share code, notes, and snippets.

Brad Armstrong hashbrown

  • Code 42 Software
  • Minneapolis, MN USA
Block or report user

Report or block hashbrown

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hashbrown
hashbrown / RXAuthenticator.java
Last active Oct 18, 2015
Caching and invalidating replayable observables
View RXAuthenticator.java
Stack<AuthenticationRequestHolder> cachedRequest = new Stack<>();
public Observable<AuthenticationResult> login(final AuthenticationRequest request) {
AuthenticationRequestHolder cached = cachedRequest.isEmpty()?null:cachedRequest.pop();
if (cached != null && cached.request.equals(request)) {
cachedRequest.push(cached);
return cached.result;
}
@hashbrown
hashbrown / latency.markdown
Created Jun 1, 2012 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
Round trip within same datacenter ...... 500,000 ns  = 0.5 ms
@hashbrown
hashbrown / button_bar_layout.xml
Created Apr 10, 2012 — forked from romannurik/button_bar_layout.xml
How to make a proper button bar on ICS
View button_bar_layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="?android:attr/dividerHorizontal"
android:showDividers="middle">
<TextView android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
You can’t perform that action at this time.