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
# Dalvik VM specific | |
-dontpreverify | |
# Dev-only | |
-dontobfuscate | |
-dontoptimize | |
# My stuff | |
-keep public class golly.** { public protected *; } | |
-keep public class com.beardedlogic.** { public protected *; } |
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
protected static final int IGNORE_BACKGROUND_WIDTH_CHANGES = 1 << 1; | |
protected static final int IGNORE_BACKGROUND_HEIGHT_CHANGES = 1 << 2; | |
private View globalLayoutView; | |
protected int globalLayoutWidth = -1, globalLayoutHeight = -1; | |
private int globalLayoutFlags = 0; | |
protected void addGlobalLayoutListener(View globalLayoutView) { | |
addGlobalLayoutListener(globalLayoutView, 0); | |
} |
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
@Override | |
protected void onStop() { | |
// Release memory held by background bitmaps | |
AndroidUtils.releaseBackgroundImageMemory(root); | |
AndroidUtils.releaseBackgroundImageMemory(decorFrame); | |
super.onStop(); | |
} |
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
case class Person(name: String) | |
case class Guitar(strings: Int, tuning: String, gauges: List[Double]) | |
case class Band(name: String, | |
members: Map[Person, Guitar], | |
otherPeopleWhoSupportTheGuitarists: Set[Person]) // Just ask Yngwie | |
// Sample data |
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
val bandNameL = lensg[Band, String](b => n => b.copy(name = n), _.name) | |
val guitarTuningL = lensg[Guitar, String](g => t => g.copy(tuning = t), _.tuning) | |
// KeyedLens #1: Here Person is a key. | |
val guitarL = KeyedLens[Band, Person, Guitar]( | |
b => p => newValue => b.copy(members = b.members + (p -> newValue)), | |
b => p => b.members(p)) | |
// KeyedLens #2: Here Int is the key. |
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 scalaz.{LensFamily, Lens} | |
import Lens.{lensg, lensFamilyg} | |
object LensFns { | |
/** | |
* A lens that requires a key be provided to extract B from A. | |
* | |
* @tparam A The record type. | |
* @tparam K The field key type. |
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
object `^_^` { | |
trait Token | |
trait Value extends Token | |
trait P[A <: Token, B <: Value] extends Token | |
trait I[T <: Token] | |
// Conversions | |
implicit def AB_A[A <: Value, B <: Value](i: I[P[A, B]]): I[A] = i.asInstanceOf[I[A]] | |
implicit def AB_B[A <: Token, B <: Value](i: I[P[A, B]]): I[B] = i.asInstanceOf[I[B]] |
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
object ForScalaz { | |
type CoyonedaF[F[_]] = ({type A[α] = Coyoneda[F, α]}) | |
def FG_to_CFG[F[_], G[_] : Functor, A](t: F ~> G): (CoyonedaF[F]#A ~> G) = { | |
type CF[A] = Coyoneda[F, A] | |
type CG[A] = Coyoneda[G, A] | |
val m: (CF ~> CG) = FG_to_CFCG(t) | |
val n: (CG ~> G) = CF_to_F | |
val o: (CF ~> G) = n compose m |
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 scalaz.stream.merge | |
import scalaz.\/ | |
import scalaz.stream.merge.Junction._ | |
import scalaz.stream.Process._ | |
object JunctionExperiment { | |
val debug = !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
case class Username(value: String) | |
implicit val usernameCodec = implicitly[CodecJson[String]].xmap(Username.apply)(_.value) | |
// ------------------------------------------------------------------------------------------------ | |
// Would like to eventually like to do something like this: | |
// (Basically a replacement the {@@, T with U} hack which has caused me too many problems) | |
trait TaggedType { type U; def value: U } | |
trait TaggedTypeCtor[T <: TaggedType] { def apply(u: T#U): T } |