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
BEGIN { | |
while(1) { | |
ch = 0 | |
while(++ch < ARGC) | |
if ( getline < ARGV[ch] ) | |
} | |
} |
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/jjs | |
function cstTime(unixTime) { | |
var instant = java.time.Instant.ofEpochSecond(unixTime); | |
var zoned = instant.atZone(java.time.ZoneId.of("America/New_York")); | |
return java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.format(zoned); | |
} | |
java.nio.file.Files.lines( | |
java.nio.file.Paths.get("/dev/stdin") | |
).map(JSON.parse) |
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/jjs | |
function isoTime(unixTime) { | |
var instant = java.time.Instant.ofEpochSecond(unixTime); | |
return java.time.format.DateTimeFormatter.ISO_INSTANT.format(instant); | |
} | |
java.nio.file.Files.lines( | |
java.nio.file.Paths.get("/dev/stdin") | |
).map(function (line) line.split(",", -1)) | |
.map(function(columns) { columns.unshift(isoTime(columns[0])); return columns }) |
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 com.eclipsesource.v8.JavaCallback; | |
import com.eclipsesource.v8.NodeJS; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
public class Mapp { | |
private static String NODE_SCRIPT = "var http = require('http');\n" |
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 com.eclipsesource.v8.JavaCallback; | |
import com.eclipsesource.v8.NodeJS; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
public class Mapp { | |
private static String NODE_SCRIPT = "var http = require('http');\n" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 com.amazonaws.ClientConfiguration | |
import com.typesafe.config.{ConfigBeanFactory, ConfigFactory} | |
object FailApp extends App { | |
ConfigBeanFactory.create(ConfigFactory.empty(), classOf[ClientConfiguration]) | |
} |
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
# SBT + 2.11.8 gives us an IMain | |
$ sbt | |
> set scalaVersion := "2.11.8" | |
> console | |
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111). | |
scala> new javax.script.ScriptEngineManager().getEngineByName("scala") | |
res0: javax.script.ScriptEngine = scala.tools.nsc.interpreter.IMain@52f09302 | |
# Loading SBT + 2.12.1 gives us a null | |
$ sbt |
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 game | |
import scala.collection.JavaConverters._ | |
case class Game(teams: List[String], winner: Option[String]) { g => | |
// todo turn this into a macro | |
final class JythonGame { | |
def getWinner(): String = g.winner.orNull | |
def getAsScala(): Game = g | |
def getTeams(): java.util.List[String] = teams.asJava | |
def __iter__(): org.python.core.PyObject = new org.python.core.PyIterator { |
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 ComplexFeature(serviceA: ServiceA, serviceB: ServiceB, | |
advancedFeature: AdvancedFeature) | |
extends Feature { | |
def execute(inputXml: Elem): Future[Result] = { | |
Future(ComplexFeature.process(serviceA, serviceB)) | |
.recoverWith { | |
case NonFatal(e) => advancedFeature.execute(inputXml) | |
} | |
} | |
} |