start new:
tmux
start new with session name:
tmux new -s myname
//http://daily-scala.blogspot.com/2010/01/regular-expression-3-regex-matching.html | |
val date = "11/01/2010" | |
val Date = """(\d\d)/(\d\d)/(\d\d\d\d)""".r | |
val Date(day, month, year) = date | |
println(day) | |
println(month) |
import javax.script.ScriptEngine; | |
import javax.script.ScriptEngineManager; | |
import scala.tools.nsc.interpreter.IMain; | |
import scala.tools.nsc.settings.MutableSettings.BooleanSetting; | |
public class ScalaTest { | |
public static void main(String[] args) throws Exception{ | |
ScriptEngine engine = new ScriptEngineManager().getEngineByName("scala"); | |
((BooleanSetting)(((IMain)engine).settings().usejavacp())).value_$eq(true); |
alias gbr='git for-each-ref --sort="-authordate:iso8601" --format=" %(color:green)%(authordate:iso8601)%09%(color:white)%(refname:short)" refs/heads' |
Chromium OS is cool. Chromium OS with crouton is cooler. Chromium OS with Docker is even cooler. This is specifically a guide for the Chromebook Pixel 2 (2015), but I can't think of any reason it wouldn't work with other devices.
Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.
Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.
The map
function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o
I was reviewing some documents on the graalvm and its truffle languages and it occured to me that one could write a go ast to LLVM IR emitter. Go has pretty good support for ast operations, thus it looked feasable at least. Obviously next thing I did was to check and see if someone had already done this. And yes.There is a project doing exactly that.
The support for the language is not all there yet and honestly I don't think this is the most sustainable approach but it was fun to play with it. I got some minimal go(tre) code running through graal's lli pretty fast