Skip to content

Instantly share code, notes, and snippets.

View ScalaWilliam's full-sized avatar
🏠
Working from home

ScalaWilliam ScalaWilliam

🏠
Working from home
View GitHub Profile
package features
class FeatureConfigurator() extends FeatureConfiguratorMBean {
val platformMBeanServer = ManagementFactory.getPlatformMBeanServer
val objectName = new ObjectName("app:type=FeatureConfigurator")
platformMBeanServer.registerMBean(this, objectName)
def stop(): Unit = {
platformMBeanServer.unregisterMBean(objectName)
}
def getFeatureLevel: String = ???
def setFeatureLevel(name: String): Unit = ???
package features
trait FeatureConfiguratorMBean {
def getFeatureLevel: String
def setFeatureLevel(name: String): Unit
}
class AdvancedFeature(staticFeature: StaticFeature)
extends Feature {
def execute(inputXml: Elem): Future[Result] = {
Future(blocking(AdvancedFeature.process(inputXml)))
.recoverWith {
case NonFatal(e) => staticFeature.execute(inputXml)
}
}
}
object AdvancedFeature {
class StaticFeature extends Feature {
def execute(inputXml: Elem): Future[Result] = {
Future.successful(StaticFeature.staticResult)
}
}
object StaticFeature {
val staticResult: Result = ???
}
trait Feature {
def execute(inputXml: Elem): Future[Result]
}
useradd -m work
ln -s /home/work/config/nginx.work.conf /etc/nginx/conf.d/nginx.work.conf
server {
listen 80;
listen 443 ssl http2;
ssl on;
ssl_certificate /etc/letsencrypt/live/git.work/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/git.work/privkey.pem;
<!doctype html>
<html>
<head>
<title>Git Watch</title>
<style>
body {
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif ;
margin-left:7em;
line-height:1.6;
}
extends NotificationBroadcasterSupport
val acn = new AttributeChangeNotification(
this,
ts,
ts,
"Msg",
"Name",
"String[]",
oldValue,
Finding an ID for the current repository:
```
$ git remote -v | sed -E -n -e 's/^.*https:\/\/(github|bitbucket)[^/]+\/([^/]+)\/([^/]+)\.git \(fetch\)/\1\/\2\/\3/p' -e 's/^.*git@(github|bitbucket)[^:]+:([^/]+)\/(.*)\.git \(fetch\)/\1\/\2\/\3/p' | head -n 1
github/ScalaWilliam/git.watch
```
@ScalaWilliam
ScalaWilliam / build.sbt
Created May 28, 2016 07:52
Automatic type class instance derivation using cats & kittens.
libraryDependencies += "org.typelevel" %% "cats" % "0.6.0"
libraryDependencies += "org.typelevel" %% "kittens" % "1.0.0-M3"