Skip to content

Instantly share code, notes, and snippets.

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
import React from 'react'
import './shared.css'
import InplaceEditable from './InplaceEditable'
export class InplaceEditableText extends Component{
/**
* @override
* @type {string}
*/
import React, {Component} from 'react'
import {Button} from 'antd'
import './shared.css'
/**
* abstract base class
* subclasses should implement
* const componentClassnamePrefix
* method renderNormal
* method renderEditing
package com.gtan.turing
import akka.shapeless.HNil
import org.parboiled2._
import scala.util.Try
/**
* Created by zhang on 2015/7/14.
*/
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,
import scalaz._
import Scalaz._
import argonaut._
import Argonaut._
/**
* Created by tldeti on 14-9-23.
*/
object Tags {
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)){
@tldeti
tldeti / gist:4187382
Created December 2, 2012 06:42
example
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