Skip to content

Instantly share code, notes, and snippets.

View leozc's full-sized avatar

Leo Liang leozc

View GitHub Profile
@leozc
leozc / gist:6126556
Last active December 20, 2015 11:49
Host this php on php-fpm + nginx, each page hit creates TWO Pairs of connections to replicaset, FOUR Authentication done (primary + secondary) * 2
<?
// simple mongoclient dumpper
$a=getMongo();
$b=getMongo();
var_dump($a->getConnectionss());
print("===================================SECOND MONGO CONN REQUEST ===================================\n");
var_dump($b->getConnectionss());
function getMongo(){//{{{
@leozc
leozc / Run ScalaTest From CLI
Last active August 29, 2015 14:06
Run ScalaTest From CLI, great for play ground activities
#Example
scala -cp ~/.ivy2//cache/org.scalatest/scalatest_2.10/jars/scalatest_2.10-2.1.5.jar
scala> import org.scalatest._
scala> Seq(1,2,3) must contain (1)
scala> Seq(1,2,3) must contain (5)
org.scalatest.exceptions.TestFailedException: List(1, 2, 3) did not contain element 5
at org.scalatest.MatchersHelper$.newTestFailedException(MatchersHelper.scala:160)
at org.scalatest.MustMatchers$MustMethodHelper$.mustMatcher(MustMatchers.scala:6141)
at org.scalatest.MustMatchers$AnyMustWrapper.must(MustMatchers.scala:6187)