Skip to content

Instantly share code, notes, and snippets.

View shadaj's full-sized avatar

Shadaj Laddad shadaj

View GitHub Profile
Physics({ timestep: 4 }, function (world) {
var viewWidth = window.innerWidth
,viewHeight = window.innerHeight
,edgeBounce
,renderer
;
// create a renderer
renderer = Physics.renderer('canvas', {
object Example {
import scala.collection.IndexedSeqLike
trait BaseLike
class DNABase extends BaseLike
trait BioSequence[B <: BaseLike] extends IndexedSeq[B]
class DNA extends BioSequence[DNABase] with IndexedSeqLike[DNABase, DNA] {

steamworks-calculator

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.7.0")
enablePlugins(ScalaJSBundlerPlugin)
resolvers += "Apollo Bintray" at "https://dl.bintray.com/apollographql/maven/"
libraryDependencies += "com.apollographql" %%% "react-apollo-scalajs" % "0.1.0"
libraryDependencies += "me.shadaj" %%% "slinky-web" % "0.1.0"
npmDependencies in Compile += "react" -> "15.6.1"
npmDependencies in Compile += "react-dom" -> "15.6.1"
package com.apollographql.scalajs
import me.shadaj.slinky.web.ReactDOM
import me.shadaj.slinky.web.html._ // imports tags, such as "h1"
import scala.scalajs.js.JSApp
import org.scalajs.dom.{document, html}
import scala.scalajs.js
query AllPosts {
posts {
id
title
votes
}
}
package com.apollographql.scalajs
import me.shadaj.slinky.core.StatelessComponent
import me.shadaj.slinky.core.facade.ReactElement
import me.shadaj.slinky.web.html._
import scala.scalajs.js
import scala.scalajs.js.annotation.ScalaJSDefined
object PostsView extends StatelessComponent {
val client = ApolloClient(ApolloClientOptions(
networkInterface = Some(createNetworkInterface(NetworkInterfaceOptions(
uri = Some("https://1jzxrj179.lp.gql.zone/graphql")
)))
))
ReactDOM.render(
ApolloProvider(ApolloProvider.Props(client))(
div(
PostsView.WithData(()) // we pass in () because there are no variables for the query
)
),
reactContainer
)