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 android.graphics.Bitmap; | |
import android.support.v4.util.LruCache; | |
import com.android.volley.toolbox.ImageLoader.ImageCache; | |
public class BitmapCache extends LruCache<String, Bitmap> implements ImageCache | |
{ | |
public static final int SIZE = 10 * 1024 * 1024; | |
public BitmapCache() | |
{ |
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
folder="bin/classes/" | |
package="$1" | |
inotifywait -m -q -e close_write "$folder" | while read f; do | |
# take only the filename | |
f=`awk '{print $3}' <<< "$f"` | |
# rebuild the full path | |
path="$folder$f" |
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
// https://github.com/deebloo/rxjs-worker | |
var observable = Observable.of([0, 1, 2, 3, 4]); | |
observable | |
.map(function (data) { | |
return data.concat([5, 6, 7, 8, 9]); | |
}) | |
.workerMap(function (data) { | |
return data.concat([10,11,12,13,14]);; | |
}) |
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
require 'sinatra' | |
require 'sinatra/param' | |
require 'sinatra/json' | |
set :raise_sinatra_param_exceptions, true | |
set :show_exceptions, false | |
get '/hi' do | |
param :param1, Float, required: true | |
param :param2, Float, required: true |
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 android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Path; | |
import android.util.AttributeSet; | |
import android.widget.FrameLayout; | |
public class ClipRevealFrame extends FrameLayout{ | |
private Path mRevealPath; |
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
(use 'clojure.core.async) | |
(defprotocol ISendable | |
(channel [this])) | |
(defn async-agent [state] | |
(let [c (chan Long/MAX_VALUE) ;; <<-- unbounded buffers are bad, but this matches agents | |
a (atom state)] | |
(go-loop [] | |
(when-let [[f args] (<! c)] |
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
(ns spy.core) | |
(defn- get-hostname [] | |
(.. java.net.InetAddress getLocalHost getHostName)) | |
(def debug? | |
"ADAPT ME!!" | |
(delay (or (= "dev" (System/getProperty "nomad.env")) | |
(= (get-hostname) "sky")))) |
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 rx.android.observables; | |
import rx.Observable; | |
import rx.Observable.OnSubscribe; | |
import rx.Subscriber; | |
import rx.android.subscriptions.AndroidSubscriptions; | |
import rx.functions.Action0; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; |
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
class TodoList < Array | |
def self.load(file) | |
# read the file, create a list, create items, add them to the list, return the list | |
list = TodoList.new | |
File.read(file).each_line do |line| | |
list << line.chomp | |
end | |
list | |
end |
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
class Option<A> { | |
protected Option() { } | |
} | |
interface App<F, A> { | |
F proof(); | |
} | |
class OptionF { | |
private OptionF() {} | |
private static class AppOption<A> implements App<OptionF, A> { |
OlderNewer