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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
public static class id extends Function { | |
public Closure enter(StgContext context) { | |
// context.R(2) is the first argument of the function | |
// All id simply does is evaluate the argument - | |
// it cannot do much more! | |
return context.R(2).evaluate(context); | |
} | |
public int arity() { return 1; } | |
} |
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
# Credit http://stackoverflow.com/a/2514279 | |
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r |
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
case class IO[A](unsafePerformIO: () => A) { | |
def map[B](ab: A => B): IO[B] = IO(() => ab(unsafePerformIO())) | |
def flatMap[B](afb: A => IO[B]): IO[B] =IO(() => afb(unsafePerformIO()).unsafePerformIO()) | |
def tryIO(ta: Throwable => A): IO[A] = | |
IO(() => IO.tryIO(unsafePerformIO()).unsafePerformIO() match { | |
case Left(t) => ta(t) | |
case Right(a) => a | |
}) | |
} | |
object IO { |
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
trait EntityBase { | |
def id: String | |
} | |
trait Repository { | |
type Entity <: EntityBase | |
def get(id: String): Option[Entity] | |
} |
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
/** | |
* Created by pedrofurla on 26/03/14. | |
*/ | |
package slicks.docs | |
import slicks.docs.dao.{Entity, IdentifiableTable, CrudComponent, Profile} | |
case class User(id: Option[Long], first: String, last: String) extends Entity[Long] | |
trait UserComponent extends CrudComponent { outer: Profile => |
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
object Function1Stuff { | |
def flatMap[T, A, B]: Function1[T, A] => (A => Function1[T, B]) => Function1[T, B] = | |
sys.error("todo") | |
} |
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
trait Bar { def bar(msg:String):Unit } | |
trait Qux extends Bar { | |
abstract override def bar(msg:String="Qux Says Hello") = { | |
super.bar(msg) | |
println("qux: " + msg) | |
} | |
} | |
class Foo extends Bar { |