- Introductions
- Name, company, kind of development, etc.
- Discussion
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
// Comparison of using `null` vs `None` to represetn NAs | |
val csvtext = "1,4,5,6,,9,12" | |
val tokens = csvtext.split(",").toList | |
// Null NA Approach | |
val nullNAs = tokens.map(t => if(t.isEmpty) null else t) | |
val numFromNulled = for { | |
t <- nullNAs | |
num = if(t == null) null else t.toInt |
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
// NB: Requires SBT >= 0.13.5 | |
package pomhelpers | |
import sbt._ | |
import Keys._ | |
import sbt.complete.Parser | |
import sbt.complete.DefaultParsers._ | |
object ExtractMvnDependencies extends AutoPlugin { | |
override def trigger = allRequirements |
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 akka.actor._ | |
import akka.stream.actor.ActorPublisher | |
import akka.stream.scaladsl._ | |
import akka.stream.{ FlowMaterializer, MaterializerSettings } | |
import akka.testkit._ | |
import org.scalatest.FunSpecLike | |
import scala.concurrent.Future | |
import scala.concurrent.duration._ | |
class FutureMergeTest extends TestKit(ActorSystem()) with FunSpecLike with ImplicitSender { |
Here's one way of brute-force converting a bunch of Java code to Scala without too much concern for correctness.
Hard stuff is done by scalagen
.
If the project is Maven-based with an existing pom.xml
, all you need to do is run the scalagen
Maven plugin:
mvn com.mysema.scalagen:scalagen-maven-plugin_2.10.1:0.3.2:main -DtargetFolder=target/scala
You have to have a pom.xml
file for this to work. If your project is configured with sbt (or have no project!), use the sbt makePom
task to create one:
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 sbt._ | |
import sbt.Keys.commands | |
object OpenFolderHere extends AutoPlugin { | |
override def trigger = allRequirements | |
override lazy val projectSettings = Seq( | |
commands += Command.command("openHere") { (state: State) => | |
"open .".! | |
state | |
} | |
) |
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
addCommandAlias("package", "collectPackages") | |
addCommandAlias("stage", "universal:stage") | |
enablePlugins(GitBranchPrompt) | |
enablePlugins(JavaAppPackaging) | |
// TODO: Need to figure out how to look this up from the outer project | |
version in ThisBuild := "0.2.1-SNAPSHOT" |
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
"More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason-including blind stupidity." | |
--W. A. Wulf |
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
#!/bin/bash | |
# Poor man's resource compiler | |
# Converts given file into compilable byte stream via | |
# C code header and implementation files. | |
# Based on original by http://www.linuxjournal.com/users/mitch-frazier | |
# | |
if [[ $# -ne 1 ]]; then | |
echo "Usage: $0 FILENAME" | |
exit 1 |
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
<!-- Fragment from an Ant build.xml file for creating a disk image with bells and whistles. --> | |
<property name="dmgname" value="${build.dir}/install-${name}.dmg" /> | |
<property name="tmpdmg" value="/tmp/${app.name}-installer-tmp.dmg" /> | |
<property name="volname" value="${app.name}-${VERSION}-Install" /> | |
<delete file="${tmpdmg}" quiet="yes" failonerror="false" /> | |
<!-- Create the temporary image --> | |
<echo>Making initial image...</echo> |
OlderNewer