Skip to content

Instantly share code, notes, and snippets.

View gist:a04d8e0c61690aebf78a
2015-10-12 17:07:44
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.60-b23 mixed mode):
"RMI TCP Connection(5)-169.254.231.226" #1211 daemon prio=5 os_prio=0 tid=0x0000000023555000 nid=0x29bc runnable [0x0000000043aee000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
View gist:105fbd8201f0d3e19dbe
### Keybase proof
I hereby claim:
* I am mcamou on github.
* I am mcamou (https://keybase.io/mcamou) on keybase.
* I have a public key whose fingerprint is 6923 124D 0475 7E5E 5B49 5657 8640 C728 35D2 7E03
To claim this, I am signing this object:
View gist:7453224
scala> class DomainObject
defined class DomainObject
scala> trait UpdateView[D <: DomainObject, V <: UpdateView[V,D]] {
| self: V =>
| def id: Option[String]
| def withId(newId: String): V
| def withNewId: V = if (id.isEmpty) this.withId("xxx")
| else this
| }
@mcamou
mcamou / JsonRepository.scala
Last active Dec 21, 2015
No Manifest available for List[T]
View JsonRepository.scala
trait JsonLoader[T <: DomainObject] extends Loader[T] {
self: Repository[T] with JsonCommonDefinitions[T] =>
implicit def ev: Manifest[T]
def load {
atomic { implicit txn =>
val parsed = parse(new FileReader(jsonPath.toFile))
parsed.extract[List[T]].foreach { obj => add(obj, false) }
View gist:6132740
def wrap[T](obj: Any)(implicit tag: ClassTag[T]): T = {
obj match {
case t: T => t
case jrObj: JRubyObject if tag.runtimeClass == classOf[RubyObject] => new RubyObject(jrObj)
case _ if tag.runtimeClass == classOf[Nothing] || tag.runtimeClass == classOf[Unit] => null:T
case _ => throw new IllegalTypeConversion(obj.getClass, tag.runtimeClass)
}
}
def send[T](target: JRubyObject, name: Symbol, args: Any*)(implicit tag: ClassTag[T]): T = {
@mcamou
mcamou / gist:5058109
Last active Dec 14, 2015
Ejemplos para el debate sobre ORM de MadridJUG
View gist:5058109
##### JPA - embedding
@Embeddable
public class AuditInfo implements Serializable {
protected static final long serialVersionUID = 1L;
@Temporal(TemporalType.TIMESTAMP)
@Column(nullable = false)
private Date createdAt;
View gist:1156792
mario@tumbolia ~ 1 % scala
Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.
scala> def x(a:Int,b:Int,c:Int,d:Int = 0) = println(a,b,c,d)
x: (a: Int, b: Int, c: Int, d: Int)Unit
scala> x(a=1,b=2,c=3)
(1,2,3,0)
View gist:1156559
import akka.amqp._
import AMQP._
...
val connection = AMQP.newConnection(ConnectionParameters(host = Config.amqpHost,
port = Config.amqpPort,
virtualHost = Config.amqpVhost,
username = Config.amqpUser,
password = Config.amqpPasword,
View gist:990811
$ ruby --version
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10]
$ irb
irb(main):001:0> f = File.new("/tmp/x")
=> #<File:/tmp/x>
irb(main):002:0> f.flock(File::LOCK_EX)
=> 0
$ java -jar jruby-complete-1.6.2.jar -S irb
View gist:206186
"class: NilClass"
"eql: true"
"equal: true"
"==: true"
"NilClass hash: 11, contents.class.hash: 11"
"class: Symbol"
"eql: false"
"equal: false"
"==: false"
"NilClass hash: 11, contents.class.hash: 25"