This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Ammonite script to rename images. | |
* | |
* This script will lower case the file names and replace all the spaces and dots by `_`. | |
* | |
* Source dir and destination dir have to be different because some file systems don't consider the cases. | |
* So a file name `ABC.png` will not be renamed `abc.png` if the source and destination are the same...s | |
*/ | |
import $ivy.`com.github.pathikrit::better-files:3.8.0` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.effect.ExitCode | |
import monix.eval.{Task, TaskApp} | |
import monix.execution.atomic.Atomic | |
class MtCache[A](ref: Atomic[Map[String, Task[A]]]) { | |
def cache(key: String)(task: () => A): Task[A] = { | |
ref.transformAndExtract { current => | |
current.get(key) match { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.effect.ExitCode | |
import monix.eval.{Task, TaskApp} | |
import monix.execution.atomic.Atomic | |
class MtCache[A](ref: Atomic[Map[String, Task[A]]]) { | |
def cache(key: String)(task: () => A): Task[A] = { | |
ref.transformAndExtract { current => | |
current.get(key) match { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2019-04-24T08:32:52.164Z [Ruby-0-Thread-16@puma 014: /usr/src/app/vendor/bundle/jruby/2.5.0/gems/puma-3.12.1-java/lib/puma/thread_pool.rb:57] INFO MetaClass : | |
java.lang.Exception: singleton creation stack trace | |
at org.jruby.dist/org.jruby.MetaClass.logSingleton(MetaClass.java:67) | |
at org.jruby.dist/org.jruby.MetaClass.<init>(MetaClass.java:56) | |
at org.jruby.dist/org.jruby.RubyBasicObject.makeMetaClass(RubyBasicObject.java:553) | |
at org.jruby.dist/org.jruby.RubyClass.toSingletonClass(RubyClass.java:479) | |
at org.jruby.dist/org.jruby.RubyBasicObject.getSingletonClass(RubyBasicObject.java:538) | |
at org.jruby.dist/org.jruby.RubyBasicObject.instance_exec(RubyBasicObject.java:2678) | |
at usr.src.app.vendor.bundle.jruby.$2_dot_5_dot_0.gems.activesupport_minus_4_dot_2_dot_11_dot_1.lib.active_support.callbacks.RUBY$block$make_lambda$3(/usr/src/app/vendor/bundle/jruby/2.5.0/gems/activesupport-4.2.11.1/lib/active_support/callbacks.rb:441) | |
at org.jruby.dist/org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This test shows that without a fork, execution is purely mono-fiber and sequential. | |
*/ | |
object TestZioExecSemantic { | |
val rt = new DefaultRuntime {} | |
trait LOG { | |
def apply(s: String): UIO[Unit] | |
} | |
def makeLog = UIO(new LOG { | |
val zero = System.currentTimeMillis() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.{immutable, mutable, GenTraversableOnce} | |
import scala.collection.generic.CanBuildFrom | |
object GroupableOps { | |
implicit class ToGroupable[A, Coll[X] <: GenTraversableOnce[X]](coll: Coll[A]) { | |
// https://github.com/scala/scala/blob/v2.13.0-M5/src/library/scala/collection/Iterable.scala#L578 | |
def groupMap[K, B, To](key: A => K)(f: A => B) | |
(implicit bf: CanBuildFrom[Coll[A], B, To]): immutable.Map[K, To] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread "main" java.lang.ExceptionInInitializerError | |
at org.torquebox.mojo.mavengem.wagon.MavenGemWagon.rubygemsFactory(MavenGemWagon.java:88) | |
at org.torquebox.mojo.mavengem.wagon.MavenGemWagon.newConnection(MavenGemWagon.java:102) | |
at org.torquebox.mojo.mavengem.wagon.MavenGemWagon.fillInputData(MavenGemWagon.java:64) | |
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:126) | |
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88) | |
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61) | |
at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:567) | |
at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:435) | |
at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:412) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2019-03-29 17:33:39 | |
"Ruby-0-Fiber-25" - Thread t@1172 | |
java.lang.Thread.State: WAITING | |
at java.base@11.0.2/jdk.internal.misc.Unsafe.park(Native Method) | |
- parking to wait for <4e7da9fc> (a java.util.concurrent.SynchronousQueue$TransferStack) | |
at java.base@11.0.2/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) | |
at java.base@11.0.2/java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460) | |
at java.base@11.0.2/java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:361) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2019-03-29 16:46:51 | |
"Ruby-0-Fiber-286" - Thread t@363 | |
java.lang.Thread.State: WAITING | |
at java.base@11.0.2/jdk.internal.misc.Unsafe.park(Native Method) | |
- parking to wait for <69439394> (a java.util.concurrent.SynchronousQueue$TransferStack) | |
at java.base@11.0.2/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) | |
at java.base@11.0.2/java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460) | |
at java.base@11.0.2/java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:361) | |
at java.base@11.0.2/java.util.concurrent.SynchronousQueue.put(SynchronousQueue.java:873) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This piece of commented code aims to clarify some | |
misconceptions between several advanced concepts | |
in pure functional programming/category theory: | |
free monads, finally tagless approach, algebraic | |
effects. | |
These concepts are actually very close. They rely | |
on similar concepts and even represent the "same" | |
object (up to isomorphism!) from the theoretical |