Skip to content

Instantly share code, notes, and snippets.

View trbngr's full-sized avatar

Chris Martin trbngr

  • Phoenix, AZ, USA
View GitHub Profile
@trbngr
trbngr / install.sh
Last active September 19, 2018 23:36 — forked from jeherve/install.sh
Installing my favorite apps on a new machine https://jeremy.hu/homebrew-cask-automate-mac-install/
#!/bin/sh
echo Install all AppStore Apps at first!
# If you are looking into a solution to automate AppStore installs,
# check mas https://github.com/argon/mas
# I installed XCode, Forklift.
read -p "Press any key to continue... " -n1 -s
echo '\n'
# Install Homebrew
@trbngr
trbngr / Syntax.cs
Last active September 14, 2017 06:42
experiments in graphql-dotnet syntax
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using GraphQL;
using GraphQL.Builders;
using GraphQL.Resolvers;
using GraphQL.Types;
using LanguageExt;
using static LanguageExt.Prelude;
@trbngr
trbngr / EventStoreService.cs
Last active July 4, 2017 21:29
EventStore as a windows service w/ TopShelf
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
namespace EventStoreService
{
public class EventStoreService
{
@trbngr
trbngr / build.sbt
Last active January 11, 2017 02:31
name := "eff-study"
version := "1.0"
scalaVersion := "2.12.1"
scalacOptions ++= Seq(
"-Ypartial-unification",
"-language:postfixOps",
"-language:implicitConversions",
"-language:higherKinds"
)
package com.company
import akka.actor.ActorSystem
import akka.http.scaladsl.model.StatusCodes._
import akka.http.scaladsl.model.Uri
import akka.util.Timeout
import com.company.Crawler.Destination
import com.company.model.AliasRequest
import scala.concurrent.duration._
@trbngr
trbngr / !usage.cs
Last active September 25, 2016 00:51
Custom configs for Akka.net
private static ActorSystem CreateActorSystem(string systemName)
{
var config = ConfigurationFactory.Load()
.WithFallback(CustomConfig.Create(systemName))
.WithFallback(ClusterSingletonManager.DefaultConfig())
.WithFallback(RedisPersistence.DefaultConfig());
var path = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "akka.generated.conf"));
File.WriteAllText(path, config.ToString(true));
object Protocol extends TopicOneSupport with TopicTwoSupport {
/*can't be sealed now*/ trait PMessage
}
@trbngr
trbngr / ADTMacros.scala
Created September 1, 2016 01:04
Json4s Custom Serializer Macro
package com.company.macros
import scala.reflect.macros.blackbox
class ADTMacros(val c: blackbox.Context) {
import c.universe._
def customSerializer[T: c.WeakTypeTag]: Tree = {
generate[T] { (tpe, symbols) =>
@trbngr
trbngr / JsonSerializer.scala
Created August 30, 2016 20:50
json4s serializer for [EventStore.Akka.Persistence](https://github.com/EventStore/EventStore.Akka.Persistence)
package com.company.serialization
import java.nio.ByteBuffer
import java.nio.charset.Charset
import akka.actor.{ActorRef, ExtendedActorSystem}
import akka.persistence.PersistentRepr
import akka.persistence.eventstore.EventStoreSerializer
import akka.persistence.eventstore.snapshot.EventStoreSnapshotStore.SnapshotEvent
import akka.persistence.journal.Tagged
import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.ExecutionContext.Implicits.global
object ModelReaders {
implicit object UserReader extends ModelReader[User] {
def read(repo: Repo, id: Int) = repo.getUser(id)
}
implicit object RoomReader extends ModelReader[Room] {
def read(repo: Repo, id: Int): Future[Option[Room]] = repo.getRoom(id)
}