Skip to content

Instantly share code, notes, and snippets.

View stanch's full-sized avatar

Nick stanch

  • Product Manager at @snowplow
  • Lisbon, Portugal
View GitHub Profile
l[LinearLayout](
w[TextView] ~> text("Howdy?") ~> TextSize.large ~>
// this will automatically use LinearLayout.LayoutParams
layoutParams(MATCH_PARENT, WRAP_CONTENT),
w[ImageView] ~> hide ~> { x ⇒
// custom initialization
x.setScaleType(ImageView.ScaleType.FIT_START)
x.setAdjustViewBounds(true)
}
l[ScrollView](
l[LinearLayout](
w[TextView],
w[Button],
l[LinearLayout](
w[ImageView],
w[ImageView]
),
// this will use ProgressBar(context, attrs, defStyle); context is passed for you automatically!
w[ProgressBar](null, android.R.attr.progressBarStyleLarge)
@stanch
stanch / gist:6421641
Created September 3, 2013 09:31
Annotation-based API for scala-workflow
/* Basic example */
@workflow[List] val x = List(1, 2) * List(4, 5)
/* Using @context */
@context[Option] val x = {
$(Some(42) + 1) should equal (Some(43))
$(Some(10) + Some(5) * Some(2)) should equal (Some(20))
}
@context[List] val x = {