Skip to content

Instantly share code, notes, and snippets.

View guersam's full-sized avatar

Jisoo Park guersam

  • Seoul, South Korea
View GitHub Profile
@runarorama
runarorama / gist:9422453
Last active August 29, 2015 13:57
Suggestion for the new representation of `IO` in Scalaz.
import scalaz._
import \/._
import Free._
import scalaz.syntax.monad._
import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.CountDownLatch
object Experiment {
sealed trait OI[A] {
def map[B](f: A => B): OI[B]
@ceejbot
ceejbot / proposal.md
Last active November 25, 2015 21:13
monitoring proposal

Go here for the latest + some code.

numbat

An alerting engine for a metrics & monitoring system.

This is the same approach I wanted in my initial spike, only instead of writing a custom collector & using an existing alerting engine (riemann), I'm proposing using an existing collector (hekad) and writing the alerting engine.

The system

trait ReflectionUtils {
def constructor(u: scala.reflect.api.Universe) = {
import u._
DefDef(
Modifiers(),
nme.CONSTRUCTOR,
Nil,
Nil :: Nil,
TypeTree(),
@milessabin
milessabin / gist:6185537
Created August 8, 2013 15:18
shapeless records ... current state of play ...
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_21).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import shapeless._ ; import SingletonTypes._ ; import Record._
import shapeless._
import SingletonTypes._
import Record._
scala> :paste
@ryanlecompte
ryanlecompte / gist:7287415
Last active December 27, 2015 07:18
Immutable PrefixMap
import scala.collection.generic.CanBuildFrom
import scala.collection.immutable.MapLike
import scala.collection.mutable
/**
* Immutable version of the PrefixMap demonstrated in the Scala collections
* guide here: http://www.scala-lang.org/docu/files/collections-api/collections-impl_6.html
*
* This version also has a smarter remove method (doesn't leave behind dead nodes with empty values)
*/
@dyross
dyross / futureBad.scala
Created October 2, 2012 03:05
Scaling the Klout API with Scala, Akka, and Play
def blockingAndVerbose: Profile = {
val futureName = name()
val futureScore = score()
val futureFriends = Friends()
val nameResult = Await.result(futureName, 10 seconds)
val scoreResult = Await.result(futureScore, 10 seconds)
val friendsResult = Await.result(futureFriends, 10 seconds)
Profile(nameResult, scoreResult, friendsResult)
@aappddeevv
aappddeevv / workflow-mess-for-web-apps.md
Last active January 12, 2016 11:02
how to create a web app manually using popular web app workflow and build tools

Web App Development Issues

Web app development and workflow is pretty much a messy exercise that has few standards. I am trying to document the messiness and suggest one way around it that smoothly scales from a small project to a large project without using yet another workflow layer (YAWL).

I am assuming that you are using tools such as node, grunt and bower. While it is possible to use other tools such as makefiles or generators such as lineman or brunch, the issues that bring such complexity to the workflow process are built into the very nature of web protocols and application deployment model. Unlike java, which has standardized packaging and deployment models, web apps can take on a wide variety of packaging and deployment models based on several factors such as organizational process ("this is the way we do it"), bandwidth/latency constraints, dev debugging needs as well as application model (client heavy, SPA or server heavy).

There is a lively ecosystems to help manage this complexity as ment

@cobbal
cobbal / monad.swift
Last active April 6, 2016 04:40
Monad protocol in swift
protocol Monad {
typealias F
typealias U
class func bind<M : Monad where M.U == U>(Self, F -> M) -> M
class func `return`(F) -> Self
}
extension Array : Monad {
typealias F = T
@przemek-pokrywka
przemek-pokrywka / hello-coursier-ammonite-play.sh
Last active May 7, 2016 22:55
Serve a webpage using Play framework with a simple script. Nothing more, than Linux and Java required. Thanks to brilliant work of Alexandre Archambault, @li_haoyi and Play developers.
#!/bin/bash
test -e ~/.coursier/cr || (mkdir -p ~/.coursier && wget -q -O ~/.coursier/cr https://git.io/vgvpD && chmod +x ~/.coursier/cr)
CLASSPATH="$(~/.coursier/cr fetch -q -p \
\
com.typesafe.play:play-netty-server_2.11:2.5.0 \
com.typesafe.play:play_2.11:2.5.0 \
com.lihaoyi:ammonite-repl_2.11.7:0.5.2 \
\
)" java \
-Dplay.crypto.secret=foo.bar.baz \
@ilguzin
ilguzin / nginx_storage_spray.conf
Last active June 6, 2016 13:33
spray + nginx: serve static with storage API endpoint
server {
listen 443 ssl;
server_name hostname;
ssl on;
ssl_certificate /etc/nginx/ssl_certs/hostname.bndl.crt;
ssl_certificate_key /etc/nginx/ssl_certs/hostname.key;
ssl_session_timeout 5m;