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
sealed trait Ref[T]{ | |
def get:T | |
def registWatcher(f:()=>Unit):Unit | |
} | |
case class ElemRef[T](var v:T) extends Ref[T]{ | |
override def get: T = v | |
var callbacks:Vector[()=>Unit] =Vector() | |
def set(x:T) = { | |
v = x |
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 React from 'react' | |
import './shared.css' | |
import InplaceEditable from './InplaceEditable' | |
export class InplaceEditableText extends Component{ | |
/** | |
* @override | |
* @type {string} | |
*/ |
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 React, {Component} from 'react' | |
import {Button} from 'antd' | |
import './shared.css' | |
/** | |
* abstract base class | |
* subclasses should implement | |
* const componentClassnamePrefix | |
* method renderNormal | |
* method renderEditing |
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
package com.gtan.turing | |
import akka.shapeless.HNil | |
import org.parboiled2._ | |
import scala.util.Try | |
/** | |
* Created by zhang on 2015/7/14. | |
*/ |
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
package com.gtan.turing.model.rel | |
import play.api.libs.json._ | |
import play.api.libs.functional.syntax._ | |
/** | |
* 用户 | |
* Created by Yang Jing ([email protected]) on 2014-12-16. | |
*/ | |
case class User(id: String, |
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 scalaz._ | |
import Scalaz._ | |
import argonaut._ | |
import Argonaut._ | |
/** | |
* Created by tldeti on 14-9-23. | |
*/ | |
object Tags { |
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
def lazyFoldRight[A,B](as: List[A], z: B)(f: (A, =>B) => B): B = | |
as match { | |
case Nil => z | |
case x :: xs => f(x, lazyFoldRight(xs, z)(f)) | |
} | |
def findWithPriority[T](xs: List[T], high: T => Boolean, low: T => Boolean): Option[T] = { | |
val t = lazyFoldRight(xs,(None,None):(Option[T],Option[T]))((x,result)=> | |
if(high(x)) (Some(x),None) | |
else if(low(x)){ |
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
package org.tldeti | |
import shapeless._ | |
import Nat._ | |
trait Business[T<:Nat] | |
object Business { | |
def fromData[T<:Nat](n:Int,t:T)(implicit witness:Int=>Business[T]): Business[T] = n |