Skip to content

Instantly share code, notes, and snippets.

View alexwen's full-sized avatar

Alex Wenckus alexwen

View GitHub Profile
@alexwen
alexwen / keybase.md
Created September 9, 2014 16:39
keybase

Keybase proof

I hereby claim:

  • I am alexwen on github.
  • I am alexwen (https://keybase.io/alexwen) on keybase.
  • I have a public key whose fingerprint is 0C86 5360 CE0D 4432 822D E8F7 2DE4 5ADF DBFB D556

To claim this, I am signing this object:

@alexwen
alexwen / gist:252645b47c1784055674
Created December 2, 2014 07:00
Papertrail DNS Error
2014-12-01_22:52:48.24749 2014-12-01T22:52:48.247Z - error: Error: getaddrinfo ENOTFOUND
2014-12-01_22:52:48.24751 at errnoException (dns.js:37:11)
2014-12-01_22:52:48.24752 at Object.onanswer [as oncomplete] (dns.js:124:16)
/*
* Copyright (C) 2014 Square, Inc.
*
* 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
@alexwen
alexwen / gist:4b337bc669509a696b5b
Created April 25, 2015 15:59
OkHttp Observable Callback
public Observable<FilesWrapper> download(List<Thing> things) {
return Observable.from(things)
.flatMap(thing -> {
File file = new File(getExternalCacheDir() + File.separator + thing.getName());
if (file.exists()) {
return Observable.just(file);
}
Request request = new Request.Builder().url(thing.getUrl()).build();
@alexwen
alexwen / TestPredicateWindow.java
Last active January 5, 2016 19:23 — forked from gjesse/TestPredicateWindow.java
example of using distinctUntilChanged and window to segment an ordered observable into discrete buckets.
package net.loshodges;
import org.junit.Test;
import rx.Observable;
import rx.observers.TestSubscriber;
import rx.schedulers.Schedulers;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadLocalRandom;