Skip to content

Instantly share code, notes, and snippets.

View strobe's full-sized avatar

strobe strobe

View GitHub Profile
@strobe
strobe / InSlickUserService.scala
Last active January 3, 2016 20:29
Simple Play 2, Slick 1.x UserService for SecureSocial
package service
import play.api.{Logger, Application}
import securesocial.core._
import securesocial.core.providers.Token
import models._
import models.UserIdentity
import models.UserToken
import scala.Some
@strobe
strobe / Add Force Impulse to Actor
Last active February 15, 2016 20:55
UE4 snippets
const FVector Impulse = FVector(0.f, 0.f, JumpImpulse);
Ball->AddImpulse(Impulse);
[root@broker ~]# oo-diagnostics
No request sent, we did not discover any nodes.FAIL: test_node_profiles_districts_from_broker
No node hosts found. Please install some,
or ensure the existing ones respond to 'oo-mco ping'.
OpenShift cannot host gears without at least one node host responding.
FAIL: run_script
oo-accept-broker had errors:
--BEGIN OUTPUT--
class RouterActor extends Actor with ActorLogging {
// Our worker Actor handles the work of the request.
var router = Router(RoundRobinRoutingLogic(), Vector.empty)
def receive = {
// router related handlers
case AddRoutee1(actor: ActorRef) =>
val a: ActorRefRoutee = ActorRefRoutee(actor)
router = router.addRoutee(a)
@strobe
strobe / BackendApp.scala
Last active August 29, 2015 14:09
Akka Clustering issue with per node communication
object BackendApp {
def main(args: Array[String]): Unit = {
// Override the configuration of the port when specified as program argument
val port = if (args.isEmpty) "0" else args(0)
val config = ConfigFactory.parseString(s"akka.remote.netty.tcp.port=$port").
withFallback(ConfigFactory.parseString("akka.cluster.roles = [backend]")).
withFallback(ConfigFactory.load())
val system = ActorSystem("ClusterSystem", config)
system.actorOf(Props[BackendWorkerActor], name = "backend")
@strobe
strobe / .emacs
Last active August 6, 2016 17:00
osx emacs config for scala
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; !! General Settings !!
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@strobe
strobe / lenses.scala
Last active October 29, 2015 07:39
monocle automatically generated lenses example
package monocle
import monocle.macros.{GenLens, Lenses}
import shapeless.test.illTyped
class LensMonoExample extends MonocleSuite {
// @Lenses generate Lens automatically in the companion object
@Lenses case class Address(streetNumber: Int, streetName: String)
@Lenses case class Person(name: String, age: Int, address: Address)
@strobe
strobe / jargon.md
Created November 19, 2015 05:37 — forked from cb372/jargon.md
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@strobe
strobe / build.sbt
Created April 14, 2016 02:15
SBT TIPS
// explicitly set up plugin scala version
libraryDependencies += sbtPluginExtra(
m = "com.x" % "sbt-x" % "1.5.1", // Plugin module name and version
sbtV = "0.13.11",
scalaV = "2.11.8" // Scala version compiled the plugin
)
// bintray resolver
resolvers += Resolver.url(
"bintray-strobe-sbt-plugins",
@strobe
strobe / cassandra-group.json
Last active June 13, 2016 22:32
DCOS Marathon Multi-node Docker-Cassandra
{
"id": "/cassandra",
"groups": [
{
"id": "/cassandra/cassandra-seed-group",
"apps": [
{
"id": "/cassandra/cassandra-seed-group/cassandra1",
"cmd": null,
"cpus": 0.5,