Skip to content

Instantly share code, notes, and snippets.

package com.example.http4splayground.services
import java.util.Date
import java.util.concurrent.TimeUnit
import cats._
import cats.data.StateT
import cats.effect.{ExitCode, IO, IOApp}
import cats.implicits._
import cats.mtl.MonadState
-- | The Halogen component eval effect monad.
newtype HalogenM' s act ps o m a = HalogenM (Free (HalogenF s act ps o m) a)
-- | The Halogen component eval effect monad, for components constructed with
-- | the `component` smart constructor. This is more constrained than
-- | `HalogenM'` as it only allows for query algebra actions (kind
-- | `Type -> Type` rather than `Type`).
type HalogenM s act = HalogenM' s (act Unit)
eval :: Query ~> H.HalogenM State Query () Output Aff
eval (LoginRequest next) = do
s <- H.get
responseRaw <- H.liftAff $ AX.post AXResponse.json ("http://localhost:8080/api/users/login") (mkRequest s)
responseE <- pure $ parseResponse $ responseRaw.response
pure next
module Main where
import Prelude
data Foo = Foo { bar :: String }
fun1 :: Foo -> String
fun1 f = f.bar
module Kata.CubeFinder where
-- Your task is to construct a building which will be a pile of n cubes. The cube at the bottom will have a volume of n^3, the cube above will have volume of (n-1)^3 and so on until the top which will have a volume of 1^3.
-- You are given the total volume m of the building. Being given m can you find the number n of cubes you will have to build?
-- The parameter of the function findNb (find_nb, find-nb, findNb) will be an integer m and you have to return the integer n such as n^3 + (n-1)^3 + ... + 1^3 = m if such a n exists or -1 if there is no such n.
-- Examples:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@vilu
vilu / gist:0e754f55f8619a03dcfb
Created September 23, 2014 08:17
Elran javascript code
<!-- begin SnapEngage code -->
<script type="text/javascript">
(function() {
var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
se.src = '//storage.googleapis.com/code.snapengage.com/js/38ca6012-8851-42d7-956b-8b99871c94f9.js';
var done = false;
se.onload = se.onreadystatechange = function() {
if (!done&&(!this.readyState||this.readyState==='loaded'||this.readyState==='complete')) {
done = true;
/* Place your SnapEngage JS API code below */
----- Build.scala
import sbt._
import Keys._
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import com.mojolly.scalate.ScalatePlugin._
import ScalateKeys._
object CaptureBuild extends Build {
> compile
[info] Generating /Users/viktorlund/code/scala/analytics/target/scala-2.10/resource_managed/main/rebel.xml.
[info] Compiling Templates in Template Directory: /Users/viktorlund/code/scala/analytics/src/main/webapp/WEB-INF/templates
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[info] Compiling 2 Scala sources to /Users/viktorlund/code/scala/analytics/target/scala-2.10/classes...
[error] /Users/viktorlund/code/scala/analytics/src/main/scala/ScalatraBootstrap.scala:5: object mongodb is not a member of package com
[error] import com.mongodb.casbah.Imports._
[error] ^
"pool-8-thread-5"@11,895 in group "main": RUNNING
<init>():8, AnalyticsServlet {com.github.vilu.analytics}
init():7, ScalatraBootstrap
configureCycleClass():67, ScalatraListener {org.scalatra.servlet}
contextInitialized():23, ScalatraListener {org.scalatra.servlet}
callContextInitialized():771, ContextHandler {org.eclipse.jetty.server.handler}
callContextInitialized():424, ServletContextHandler {org.eclipse.jetty.servlet}
startContext():763, ContextHandler {org.eclipse.jetty.server.handler}
startContext():249, ServletContextHandler {org.eclipse.jetty.servlet}
startContext():1250, WebAppContext {org.eclipse.jetty.webapp}