Skip to content

Instantly share code, notes, and snippets.

View Fristi's full-sized avatar

Mark Fristi

View GitHub Profile
@kings13y
kings13y / MinimalSoapServer.scala
Created February 2, 2011 21:53
Minimal Soap Server using Scala and JDK6 annotations
import javax.jws.WebService
import javax.jws.soap.SOAPBinding
import javax.jws.soap.SOAPBinding.Style
import javax.xml.ws.Endpoint
@WebService(targetNamespace="org.scalabound.test", name="org.scalabound.test", portName="test", serviceName="WSTest")
private class MinimalSoapServer {
@SOAPBinding(style = Style.RPC)
def test(value : String) = "Hi " + value
@Peratryn
Peratryn / achievement.json
Last active October 24, 2018 17:24
WoW Community API Json Examples
{
"accountWide": true,
"criteria": [
{
"description": "To Honor One's Elders",
"id": 7553,
"max": 1,
"orderIndex": 0
},
{
@haf
haf / Topshelf.FSharp.fs
Last active October 11, 2017 13:23
Configure TopShelf in F#
namespace Topshelf
[<AutoOpen>]
module Topshelf =
open System
open Topshelf.HostConfigurators
open Topshelf.Runtime
let configureTopShelf f =
@philcleveland
philcleveland / GetEventStoreEventDispatcher.cs
Last active June 8, 2016 23:04
Event dispatcher which receives events from the GetEventStore after they are saved. It takes the saved events and publishes them to the passed in Event Bus. This ensures that events are not published until they are saved in the GetEventStore. Big thanks to Andrii for all the reviews and coding help to get this thing working.
public class GetEventStoreEventDispatcher
{
private const int RECONNECT_TIMEOUT_MILLISEC = 5000;
private const int THREAD_KILL_TIMEOUT_MILLISEC = 5000;
private const int READ_PAGE_SIZE = 500;
private const int LIVE_QUEUE_SIZE_LIMIT = 10000;
private readonly IEventBus _eventBus;
private readonly EventStoreConnection _store;
import Data.Char
strong = and . sequence conditions
where conditions = [ (>14) . length
, any isUpper
, any isLower
, any isDigit
]
{-
@tpolecat
tpolecat / gist:5672105
Last active December 17, 2015 21:08
making scala stm look like haskell stm
package util
import scalaz.effect.IO
import scalaz._
import Scalaz._
import scala.concurrent.stm.{ retry => stmRetry, _ }
object X {
type STM[+A] = ReaderT[IO, InTxn, A]
@nh2
nh2 / time-natural.hs
Created March 1, 2014 01:33
Natural time in Haskell: `2 hours + 4 seconds`
{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving #-}
newtype TimeUnit = TimeUnit Integer -- how many microseconds
deriving (Eq, Show, Num)
instance Num (TimeUnit -> TimeUnit) where
fromInteger n = \(TimeUnit scale) -> TimeUnit (n * scale)
-- a + b = ... -- task for you
@pchiusano
pchiusano / finallytagless.scala
Last active March 13, 2018 11:28
Finally tagless encoding of GADTs in Scala
trait ConsoleAlg[F[_]] {
def readLine: F[Option[String]]
def printLine(line: String): F[Unit]
}
trait Console[+A] {
def run[F[+_]](F: ConsoleAlg[F]): F[A]
}
object Console {
@octonato
octonato / type-classs-derivation.scala
Created June 11, 2015 16:34
Writer/Reader (Shapeless workshop ScalaDays 2015)
/*
* Copyright (c) 2015 Miles Sabin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
def treeDoc(t: Tree): Doc = t match {
case PackageDef(mods, pid, xs) => mods <> "package" <+> pid <+> xs.inBracesBlock
case Import(expr, selectors) => "import" <+> expr <> dot <> selectors
case NamedImport(name) => name
case TypeIdent(pre, name) => (pre :+ name).joinDotted
case TermIdent(pre, name) => (pre :+ name).joinDotted
case ClassDef(mods, keyword, name, tparams, vparamss, impl) => linebreak <> mods <> keyword <+> name <> tparams <> tight(vparamss) <> doTemplate(line <> "extends", impl)
case TypeParam(mods, name, tparams, constraints) => mods <> name <> tparams <> constraints
case ValueParam(mods, name, tpt, defaultValue) => mods <> name <> tpt <> opt(space <> assign, defaultValue)
case x: Name => x.value