Skip to content

Instantly share code, notes, and snippets.

// 3 sequential async calls
for {
aaa <- WS.url("http://aaa.com").get()
bbb <- WS.url("http://bbb.com").get()
ccc <- WS.url("http://ccc.com").get()
} yield {
// Construct th result using aaa, bbb, and ccc
}
@jonjack
jonjack / GitHub.Color.Scheme.for.IntelliJ.icls
Created September 25, 2017 08:19
GitHub Color Scheme for IntelliJ
<scheme name="GitHub.Color.Scheme.for.IntelliJ" version="142" parent_scheme="Default">
<option name="FONT_SCALE" value="1.0" />
<metaInfo>
<property name="created">2017-09-15T15:53:07</property>
<property name="ide">Idea</property>
<property name="ideVersion">2017.2.4.0.0</property>
<property name="modified">2017-09-25T09:19:23</property>
<property name="originalScheme">GitHub</property>
</metaInfo>
<option name="LINE_SPACING" value="1.1" />
@jonjack
jonjack / create-sbt-project.sh
Last active October 6, 2017 08:37
Create a skeleton SBT project for Scala. Tested on OSX only.
#!/bin/sh
VERSION="0.1-SNAPSHOT"
SCALA_VERSION="2.12.3"
echo "Do you wish to use the current directory for the project root? (y/n)?"
echo "Note: If (n) then the project will be created in a sub-directory of the current one."
read answer
@jonjack
jonjack / EcTest.scala
Created August 20, 2018 23:29
Demo of specifying an explicit Execution Context to a method to override a default implicit one.
object EcTest extends App {
import scala.concurrent.Future
import scala.concurrent.ExecutionContext
import java.util.concurrent.Executors
val default = scala.concurrent.ExecutionContext.Implicits.global
def test(comp: String)(implicit exc: ExecutionContext = default): Future[String] = Future {

Assumes High Sierra+

CMD + SHIFT + .      - shows all files/folders in Finder a window
@jonjack
jonjack / scala-for-comprehension-with-futures.md
Last active September 14, 2018 09:21
Scala for comprehension with Futures

Some ideas I gathered from various places for working with Futures in for comprehensions.

Import what we need for all the examples.

import scala.concurrent.{Await, Future}
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
@jonjack
jonjack / scala-library-metric-comparison.md
Last active September 28, 2018 19:58
Some comparison metrics for some of the popular Scala frameworks/libraries.

Metrics last collected 28.09.2018

Library GitHub stars Contract jobs (last 6 months)
Source: itjobswatch.co.uk
Description
Play 10737 290 Fullstack web framework.
Akka 9054 222 For highly concurrent, distributed, and resilient message-driven applications on the JVM.
Scalatra 2321 2 Microframework port of Ruby’s Sinatra
Lift 1170
@jonjack
jonjack / shell-function-get-absolute-path.md
Created October 1, 2018 10:58
Shell function to return the absolute path of some arbitrary one
#!/bin/sh
function abspath() {
pushd . > /dev/null;
if [ -d "$1" ]; then cd "$1"; dirs -l +0;
else cd "`dirname \"$1\"`"; cur_dir=`dirs -l +0`;
if [ "$cur_dir" == "/" ]; then echo "$cur_dir`basename \"$1\"`";
else echo "$cur_dir/`basename \"$1\"`"; fi; fi; popd > /dev/null;
}
@jonjack
jonjack / git-setup-osx.md
Last active October 10, 2018 18:44
Git configuration on Mac.

Set your global user details.

git config --global user.name "Your Name"
git config --global user.email your.email@elasticpath.com

Set your line feed settings.

@jonjack
jonjack / .bash_profile
Created October 12, 2018 18:40 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management