Skip to content

Instantly share code, notes, and snippets.

View ahoy-jon's full-sized avatar
🐋
Thinking!

Jonathan Winandy ahoy-jon

🐋
Thinking!
View GitHub Profile
│ pom.xml
├───src
│ ├───main
│ │ └───antlr3
│ │ └───com
│ │ └───example
│ │ └───dsi_ms
│ │ └───tql
% Initial Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
% Copyright (c) 2008, Gael Varoquaux
% License: BSD Style.
% Author : Alexis Guéganno
% Author : Jonathan Winandy
%%%%%%%%% RST2NEW-LATEX STYLESHEET %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ahoy-jon
ahoy-jon / gist:807693
Created February 2, 2011 13:49
IRC LOG #ECN sur Freenode
[14:34] <Benjamin_V> Raffa: Je trouve pas le nom des modules, c'est vraiment bizarre
[14:34] <Niicoolaas> metrokid: Hum ?
[14:34] <Benjamin_V> Raffa: C'est censé être des add-ons pour ArchiMate ?
[14:34] <bthorent> \o_
[14:34] <bthorent> \o_
[14:34] <bthorent> \o/
[14:34] <bthorent> _o/
[14:34] <beinje> \o_
[14:34] <beinje> \o/
[14:35] <beinje> _o/
@ahoy-jon
ahoy-jon / gist:1068327
Created July 6, 2011 21:07
ça gère bien les ressources Scala
object Control {
def using[Closeable <: {def close(): Unit}, B](closeable: Closeable)(useCloseable: Closeable => B): B =
try {
useCloseable(closeable)
} finally {
closeable.close()
}
}
abstract sealed class C(a: A, b: B) extends Product2[A, B] {
def _1 = a
def _2 = b
}
case class D(a: A, b:B, e:E) extends C(a,b)
object D extends MyTrait
@ahoy-jon
ahoy-jon / gist:1073928
Created July 9, 2011 20:21
Choose your poison !
// HOW TO READ 2 LINES FROM A FILE IN SCALA.
// with an Iteratee
getFileLines(new File("/somefile/.txt")) (head >>= ((b1:Option[String]) => head.map(b2 => (b1,b2)))).
map(_.run).
unsafePerformIO
// standard
scalaVersion := "2.9.0-1"
libraryDependencies ++= Seq( "org.scalaz" %% "scalaz-core" % "6.0.1")
@ahoy-jon
ahoy-jon / MyPlugins.scala
Created November 24, 2011 11:00
Quelques plugins pour SBT
import sbt._
// à mettre dans ~/.sbt/plugins/project/
object MyPlugins extends Build {
lazy val root = Project("root", file(".")) dependsOn (
uri("https://github.com/steppenwells/sbt-sh.git"),
uri("https://github.com/eed3si9n/sbt-inspectr.git")
)
@ahoy-jon
ahoy-jon / ImapTest.scala
Created December 5, 2011 07:49
Test de connexion IMAP en Scala avec Javax.Mail
package imaptest
import javax.mail._
object ImapTest extends App {
val props = System.getProperties()
props.setProperty("mail.store.protocol", "imaps")
@ahoy-jon
ahoy-jon / gist:1432844
Created December 5, 2011 08:24
Scala Community
Runar Bjarnason
11 oct.
Re: [scala-debate] Re: questioning FP
On Tuesday, October 11, 2011 11:26:43 AM UTC-4, Ittay Dror wrote:
> Sure, then fetchUser is mostly non-IO, but needs to return IO[User]. Similarly, the functions that use fetchUser will
> also need to return IO[Something]. So a small implementation detail in a function can change its signature and forces
> it to be used differently (inside a for comprehension).