This file contains hidden or 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
| /* "a123b45c" → ["a", 123, "b", 45, "c"] */ | |
| function nat(x) { | |
| // digit-parts | |
| var d = x.split(/[^0-9]+/); // ["", "123", "45, ""] | |
| // alpha-parts | |
| var a = x.split(/[0-9]+/); // ["a", "b", "c"] | |
| // helpers | |
| function nonEmpty(x) { return x != "" } | |
| function toInt(x) { return x - 0 } | |
| // the one that does not start with a "" goes first |
This file contains hidden or 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 rx1 = Var(1) | |
| val rx2 = Var(2) | |
| val rx3 = Rx { rx1() + rx2() } | |
| // ... | |
| val style = TextSize.large + padding(all = 16 dp) | |
| def rxText(rx: Rx[Int]) = rx.map(_.toString).map(text) |
This file contains hidden or 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
| // -- in the activity: | |
| var navSlot = slot[ListView] | |
| var drawerSlot = slot[DrawerLayout] | |
| // -- in onCreate: | |
| // ListView tweaks | |
| def checkItem(pos: Int) = Tweak[ListView](_.setItemChecked(pos, true)) | |
| val singleNoDivider = Tweak[ListView] { lv ⇒ |
This file contains hidden or 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.util.Log | |
| import android.view.{View, ViewGroup} | |
| import macroid.AppContext | |
| import macroid.MediaQueries._ | |
| object Spec { | |
| def apply(size: Int, mode: Int) = | |
| View.MeasureSpec.makeMeasureSpec(size, mode) |
This file contains hidden or 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
| @active | |
| class A { | |
| // all non-@active locals | |
| // will be made private | |
| var y = 0 | |
| def bar(x: Int) = x + 5 | |
| @active // should return Unit | |
| def foo(x: Int) = { | |
| y = bar(x) |
This file contains hidden or 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
| // some other android imports here | |
| ... | |
| import android.support.v4.app.{ Fragment, FragmentManager, FragmentPagerAdapter } | |
| import android.support.v4.view.ViewPager | |
| import com.viewpagerindicator.TitlePageIndicator | |
| import macroid._ | |
| import macroid.FullDsl._ | |
| import macroid.contrib._ | |
| import macroid.contrib.Layouts._ |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| import os | |
| import re | |
| import sys | |
| import fnmatch | |
| entities = {} | |
| relations = {} |
This file contains hidden or 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
| # In ~/.config/fish/config.fish | |
| set fish_greeting | |
| set __fish_git_prompt_showdirtystate 'yes' |
This file contains hidden or 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 scalatags.JsDom.all._ | |
| object ScalaJSExample extends js.JSApp { | |
| def main() = { | |
| } | |
| } |