Skip to content

Instantly share code, notes, and snippets.

Avatar

Will Sargent wsargent

View GitHub Profile
View gist:8877238

Useful Scalac Flags

So, there have been some discussions and angry tweets recently about irritating Scala "features" (like value discarding and auto-tupling) that can actually be turned off by selecting the right compiler flag in conjunction with -Xfatal-warnings. I highly recommend a set of options something like those below.

scalacOptions ++= Seq(
  "-deprecation",           
  "-encoding", "UTF-8",       // yes, this is 2 args
  "-feature",                
  "-language:existentials",
View keybase.md

Keybase proof

I hereby claim:

  • I am wsargent on github.
  • I am will_sargent (https://keybase.io/will_sargent) on keybase.
  • I have a public key whose fingerprint is CD69 70B7 2D00 E5BE 9A33 0EF3 C1E8 BF06 2BC6 C4B7

To claim this, I am signing this object:

@wsargent
wsargent / gentrustanchor.sh
Last active Aug 29, 2015
Creates a JKS keystore that uses exampleCA as a trust anchor.
View gentrustanchor.sh
#!/bin/bash
export PW=`cat password`
# Create a JKS keystore that trusts the example CA, with the default password.
# This is used by the client.
keytool -import -v \
-alias exampleca \
-file exampleca.crt \
-keypass:env PW \
View app.env.PLAY_OPTS
fooapp@srv:~$ cat app/env/PLAY_OPTS
export DATABASE_URL="jdbc:postgresql://127.0.0.1/foobar"
# We could wire a different configuration file here
# or set up a different database on the fly
export PLAY_OPTS="-DapplyEvolutions.default=true -DapplyDownEvolutions.default=true -Ddb.default.url="$DATABASE_URL" -Ddb.default.user=fooapp -Ddb.default.password=fooapppw -Ddb.default.driver=org.postgresql.Driver"
View URL
https://docs.google.com/a/typesafe.com/presentation/d/1QBhMeRRq5Gs5UfgaqvZ_3-LaxC-fQviLbPi5O8fA71c/edit?usp=sharing
View sbt
#!/usr/bin/env bash
#
# A more capable sbt runner, coincidentally also called sbt.
# Author: Paul Phillips <paulp@typesafe.com>
# todo - make this dynamic
declare -r sbt_release_version=0.13.5
declare -r sbt_unreleased_version=0.13.5
declare -r buildProps=project/build.properties
@wsargent
wsargent / gist:655724
Created Oct 30, 2010
Want to do a callback
View gist:655724
def setupMocks(onSubmitFunc(): => acm:ApplicationContextMock): Unit = {
val acm: ApplicationContextMock = new ApplicationContextMock
onSubmitFunc(acm)
tester = new WicketTester(new Application {
protected override def getSpringInjector: SpringComponentInjector = {
return new SpringComponentInjector(this, acm, true)
}
})
@wsargent
wsargent / building_base_vagrant_boxes.txt
Created Oct 3, 2011
Building a base vagrant box with RHEL / CentOS ISOs
View building_base_vagrant_boxes.txt
[Provide gist to the building of base boxes below:]
http://vault.centos.org/4.0/isos/i386/
http://vault.centos.org/5.4/isos/x86_64/
http://vault.centos.org/5.1/isos/x86_64/
Vagrant documentation: http://vagrantup.com/docs/base_boxes.html
Building a base box: https://gist.github.com/354734
[Creating base boxes for RHEL 4 and RHEL 5 - 80 GB dynamic disks]
[Note that there is no easy way to change disk sizes - but you can add more]
@wsargent
wsargent / gist:1489171
Created Dec 17, 2011
Maven repositories suck.
View gist:1489171
[20:00:08] wsargent:framework git:(master*) $ ./build
Getting Scala 2.9.1 (for sbt)...
:: problems summary ::
:::: WARNINGS
module not found: org.fusesource.jansi#jansi;1.4
==== local: tried
/Users/wsargent/work/Play20/framework/./../repository/local/org.fusesource.jansi/jansi/1.4/ivys/ivy.xml
@wsargent
wsargent / gist:1492217
Created Dec 18, 2011
UNRESOLVED DEPENDENCIES
View gist:1492217
[18:55:51] wsargent:framework git:(master*) $ ./build
Getting Scala 2.9.1 (for sbt)...
:: problems summary ::
:::: WARNINGS
module not found: org.fusesource.jansi#jansi;1.4
==== local: tried
/Users/wsargent/work/Play20/framework/./../repository/local/org.fusesource.jansi/jansi/1.4/ivys/ivy.xml