Skip to content

Instantly share code, notes, and snippets.

View jhegedus42's full-sized avatar

jhegedus42

  • Helsinki
View GitHub Profile
@jhegedus42
jhegedus42 / gist:9fe7acc2ca2282b9ee9a960cc33ba047
Created February 17, 2021 10:07
scalajs-react-bridge linking errors after upgrading versions
sbt:client> fastOptJS::webpack
[info] Compiling 126 Scala sources to /Users/joco/dev/im/github_private/im2020/modules/client/target/scala-2.12/classes ...
[info] Fast optimizing /Users/joco/dev/im/github_private/im2020/modules/client/target/scala-2.12/scalajs-bundler/main/client-fastopt.js
[error] Referring to non-existent method japgolly.scalajs.react.CallbackTo.japgolly$scalajs$react$CallbackTo$$f()scala.Function0
[error] called from com.payalabs.scalajs.react.bridge.package$.callbackToWriter(com.payalabs.scalajs.react.bridge.JsWriter)com.payalabs.scalajs.react.bridge.JsWriter
[error] called from client.ui.compositeWidgets.specific.visualHint.rect.ReactCropScalajsReactBridge$.apply(scala.scalajs.js.UndefOr,scala.scalajs.js.UndefOr,scala.scalajs.js.UndefOr)com.payalabs.scalajs.react.bridge.WithPropsNoChildren
[error] called from client.ui.compositeWidgets.specific.visualHint.rect.HintCropEditorWidget$Backend.render(client.ui.compositeWidgets.specific.visualHint.rect.HintCropperProp,scala.Option)japgoll
@jhegedus42
jhegedus42 / gist:2917d9ebdc50f911d5a1688d6408046b
Created July 26, 2019 22:20
css-dsl - for irie - trying to get it resolved - no luck
Jozsefs-MBP:irie joco$ sbt
[info] Loading global plugins from /Users/joco/.sbt/1.0/plugins
[info] Loading settings for project irie-build from plugins.sbt ...
[info] Loading project definition from /Users/joco/dev/im/irie/project
[info] Loading settings for project irie from build.sbt ...
[info] Set current project to IM root project (in build file:/Users/joco/dev/im/irie/)
[info] sbt server started at local:///Users/joco/.sbt/1.0/server/bacc02467050f0642b40/sock
sbt:IM root project> clean
[success] Total time: 0 s, completed Jul 27, 2019 1:17:18 AM
sbt:IM root project> reload
@jhegedus42
jhegedus42 / gist:4d5adb1806ea2a99c03e09c2ec2fc592
Created July 26, 2019 21:16
css-dsl trying to get it run
Jozsefs-MBP:irie joco$ sbt clean update
[info] Loading global plugins from /Users/joco/.sbt/1.0/plugins
[info] Loading settings for project irie-build from plugins.sbt ...
[info] Loading project definition from /Users/joco/dev/im/irie/project
/Users/joco/dev/im/irie/build.sbt:28: warning: lazy value CrossType in object AutoImport is deprecated (since 0.6.23): The built-in cross-project feature of sbt-scalajs is deprecated. Use the separate sbt plugin sbt-crossproject instead: https://github.com/portable-scala/sbt-crossproject
(crossProject.crossType( CrossType.Pure ) in file(
^
[info] Loading settings for project irie from build.sbt ...
[info] Set current project to IM root project (in build file:/Users/joco/dev/im/irie/)
[success] Total time: 0 s, completed Jul 27, 2019 12:13:41 AM
this call:
val f: Future[XMLHttpRequest] = Ajax.put(url_str, json_line)
generates:
OPTIONS /Line HTTP/1.1
Content-Type: text/plain;charset=UTF-8
Referer: http://localhost/
User-Agent: Node.js (linux; U; rv:v6.11.0) AppleWebKit/537.36 (KHTML, like Gecko)
object ClientRestAJAX {
import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue
def getEntity[E <: Entity: ClassTag: Decoder](
ref: Ref[E]): Future[HttpGetRequestResult[E]] = {
val url: GetURL = ref
val url_str = url.toURLWithHostAsString
val f: Future[XMLHttpRequest] = Ajax.get(url_str)
package app.client.reactComponents._experiments
import app.client.reactComponents._experiments.InnerComp.{
ICType,
PropsWithState
}
import japgolly.scalajs.react.CompScope.DuringCallbackU
import japgolly.scalajs.react.ReactComponentB.{P, PSB}
import japgolly.scalajs.react.ReactComponentC.ReqProps
@jhegedus42
jhegedus42 / Implicit.scala
Created April 8, 2017 20:08
playing around with implicits
import MyProducers.MapProducer
trait Entity
case class Ref[T](id: String)
case class IntEntity(int: Int)
case class StringEntity(s: String)
trait RefResolver {
@js.native
trait Props extends js.Object {
var value: String = js.native
var index: Int = js.native
var key: String = js.native
}
case class ScalaProps(val value:String, val index:Int, val key:String)
// how do i convert ScalaProps to Props ?
module Main where
import Prelude
import Data.Foldable (for_)
import Data.String (length, fromCharArray)
import Data.Unfoldable (replicate)
import Control.Monad.Eff
import Control.Monad.Eff.Console (log)
In Scala:
@js.native
trait Props extends js.Object {
val value: String = js.native
val items: scala.collection.mutable.Seq[String] = js.native
}
@JSExport
val TestCompB: ReqProps[Props, Unit, Unit, TopNode] =