Skip to content

Instantly share code, notes, and snippets.

View everpeace's full-sized avatar
🏠

Shingo Omura everpeace

🏠
View GitHub Profile
@halcat0x15a
halcat0x15a / TwitterMachine.scala
Last active December 15, 2015 00:28
Twitter User Streams with scala-machines!
import scala.language.postfixOps
import java.io._
import scalaj.http._
import scalaz._, Scalaz._
import scalaz.effect._, Effect._, IO._
import scalaz.concurrent.Promise
@abe4tawa8
abe4tawa8 / github-setup.rb
Created April 22, 2012 00:30
git-dojo setup script
#!/usr/bin/env ruby
require 'octokit'
require 'csv'
user_login = 'username'
user_password = 'password'
organization = 'git-dojo'
csv_file = ARGV.first || abort("Usage: #{$0} <csv-file>")
def index(id:String) = Action {
getFirstData(id)
}
private def getFirstData(id:String) = {
Cache.get(id) match {
case Some(id2) => getSecondData(id2)
case None => NotFound
}
}
private def getSecondData(id2:String) = {
@j5ik2o
j5ik2o / gist:1611868
Created January 14, 2012 15:58
AOPを使わなくても処理の始まりと終わりにログを出力するtrait
import scala.util.DynamicVariable
import scala.collection.immutable
import grizzled.slf4j.Logging
trait LoggingEx extends Logging {
private val msgs = new DynamicVariable[Seq[String]](immutable.Queue.empty)
private def withScope[T](msg: String, logger: (=> Any, => Throwable) => Unit, f: => T): T = {
val newMsgs = msgs.value :+ msg