- Install IDEA 14 Community edition
- In Idea:
- Install Scala plugin (Preferences -> Plugins, type Scala at top, install)
- Install Android Support plugin
- Check out an android project using android-sdk-plugin, e.g. https://github.com/macroid/macroid-starter
- Import into IDEA using SBT import. File->Import Project, navigate to root of project, import as SBT.
- For SDK, choose the android option.
- If necessary, create Scala library when prompted.
- Delete "Make" from any run configuration(s). Run-> Edit Configurations... then in the activity, scroll to bottom and delete Make from the "Before launch" list.
- Build and run the project from SBT, but you can edit it in IDEA.
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
| object InsertUserView { | |
| def newUser(email: String) = { | |
| val u = new User() | |
| u.email() = email | |
| Data.mb.keep(u) | |
| u | |
| } | |
| def findOrNew(email: String) = { | |
| val u = Data.mb.findOne[User](MongoDBObject("email" -> email)) | |
| u.getOrElse(newUser(email)) |
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
| class InsertUserView(t: User) extends InsertCometView[User](t){ | |
| def makeView(t: User) = AjaxListOfViews(ListVal(allViews)) | |
| private val allViews = List[AjaxView]( | |
| AjaxTextView( "Email", Path{t.email}), | |
| AjaxTextView( "First Name", Path{t.firstName}), | |
| AjaxTextView( "Last Name", Path{t.lastName}), | |
| AjaxPassView( Path(t.passHash)), | |
| AjaxStringView( "Validated", Cal{t.validated()}) |
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
| package boxes.util | |
| trait Op { | |
| def apply() | |
| } | |
| class OpDefault(action: => Unit) extends Op { | |
| def apply() { | |
| action | |
| } |
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
| def plotSignal(c: Channel) = { | |
| def alternating(s: Boolean): Stream[Boolean] = s #:: alternating(!s) | |
| def y(s: Boolean) = if (s) 1 else 0 | |
| c.signal().changeTimes.zip(alternating(c.signal().initialState)).flatMap{case(time, state) => List(Vec2(time, y(state)), Vec2(time, y(!state)))} | |
| } |
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
| void mcu_generate_local_mac(uint8_t *mac) { | |
| uint32_t i = 0; | |
| uint32_t m_w = 0; | |
| uint32_t m_z = 0; | |
| for (i = 0; i < 4; i++) { | |
| m_w = (m_w << 8) + mcu_unique_device_id_byte(i*3); | |
| m_z = (m_z << 8) + mcu_unique_device_id_byte(i*3 + 2); | |
| } | |
| m_w += mcu_unique_device_id_byte(1) * 5 + mcu_unique_device_id_byte(7) * 7; |
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
| public class ListBuilder { | |
| private final StringBuilder b = new StringBuilder(); | |
| public ListBuilder li(String s) { | |
| if (s!=null && !s.trim().isEmpty()) { | |
| b.append("<li>"); b.append(s); b.append(</li>); | |
| } | |
| return this; | |
| } | |
| public String toString() { |
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
| #include "ch.h" | |
| #include "hal.h" | |
| #include "stmdrivers/stm32f4xx_rcc.h" | |
| #include "stmdrivers/stm32f4xx_fsmc.h" | |
| void fsmc_early_init(void) { | |
| FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; | |
| FSMC_NORSRAMTimingInitTypeDef p; | |
| rccEnableAHB3(RCC_AHB3ENR_FSMCEN, FALSE); |
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
| { | |
| "_type_": "Person", | |
| "_id_": 0, | |
| "name": "name", | |
| "friend": { | |
| "_type_": "Option", | |
| "Some": { | |
| "_type_": "Person", | |
| "_id_": 1, | |
| "name": "q", |
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
| 195.3 ms13.41 % 195.3 ms13.41 % Chart.bundle.js:7736helpers.clone | |
| 194.0 ms13.32 % 194.0 ms13.32 % Chart.bundle.js:6333(anonymous function) | |
| 194.0 ms13.32 % 194.0 ms13.32 % Chart.bundle.js:6331Chart.controllers.line.Chart.DatasetController.extend.updateBezierControlPoints | |
| 192.8 ms13.24 % 192.8 ms13.24 % Chart.bundle.js:6148Chart.controllers.line.Chart.DatasetController.extend.addElementAndReset | |
| 192.8 ms13.24 % 192.8 ms13.24 % Chart.bundle.js:7577buildOrUpdateElements | |
| 192.8 ms13.24 % 192.8 ms13.24 % Chart.bundle.js:7218(anonymous function) | |
| 192.8 ms13.24 % 192.8 ms13.24 % Chart.bundle.js:7714helpers.each | |
| 192.8 ms13.24 % 192.8 ms13.24 % Chart.bundle.js:7203update | |
| 192.8 ms13.24 % 192.8 ms13.24 % :5000/elements/boxes-scatter/boxes-scatter.html:101(anonymous function) | |
| 192.8 ms13.24 % 192.8 ms13.24 % :5000/bower_components/polymer/polymer.html:1291(anonymous function) |
OlderNewer