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 demo.app | |
// 从雪山大虫scalaz example改写为使用cats | |
import cats.Functor | |
import cats.data.{Coproduct, Reader, Xor} | |
import cats.free.{Free, Inject} | |
import cats._ | |
import cats.std.all._ | |
import cats.syntax.all._ | |
import scala.io.StdIn |
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
name := "star-one-fire" | |
version := "0.0.1" | |
organization := "com.starworking" | |
scalaVersion := "2.10.2" | |
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 chapter1 | |
object FunctionUtil { | |
def testFunction(f: Int => Int): Int = f(5) | |
val list = (1 to 100).toList | |
def filter(func: Int => Boolean): List[Int] = | |
list.filter(func) | |
} |
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
class Bill < ActiveRecord::Base | |
set_table_name "ads" | |
has_many :bill_edit_histories | |
has_many :bill_display_dates, :dependent => :destroy, :foreign_key => 'bill_id' | |
has_many :bill_display_times, :dependent => :destroy | |
has_many :mem_integrals | |
belongs_to :bill_type | |
belongs_to :bill_brand | |
has_one :bill_last_display_date, :class_name=>'BillDisplayDate', :order => 'edates desc' # todo 这个地方好像有错 | |
has_many :attachments, :as => :container, :dependent => :destroy |
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 math | |
object Statistics1 { | |
// 中位数(又称中值,英语:Median),统计学中的专有名词,代表一个样本、种群或概率分布中的一个数值, | |
// 其可将数值集合划分为相等的上下两部分。对于有限的数集,可以通过把所有观察值高低排序后找出正中间的一个作为中位数。 | |
// 如果观察值有偶数个,则中位数不唯一,通常取最中间的两个数值的平均数作为中位数。 | |
def median(xs: Vector[Double]): Double = xs(xs.size / 2) | |
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
/* | |
// Setting this in bootstrap.liftweb.Boot.scala | |
// Use HTML5 for rendering | |
LiftRules.htmlProperties.default.set((r: Req) => | |
new StarXHtmlInHtml5OutProperties(r.userAgent)) | |
*/ | |
package bootstrap.liftweb | |
import java.io.InputStream |
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 star.oa.util.parsing | |
import scala.util.parsing.combinator._ | |
import scala.util.matching.Regex | |
case class Table(name: String, alias: Option[String]) | |
case class Join(tableName: String, alias: Option[String], leftTable: String, leftField: String, rightTable: String, rightField: String) | |
case class Column(table: Option[String] = None, | |
field: Option[String] = None, | |
formula: Option[String] = None, | |
asTitle: Option[String] = None) { |
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 ch19.sec02 | |
import scala.util.parsing.combinator._ | |
class ExprParser extends RegexParsers { | |
val number = "[0-9]+".r | |
def expr: Parser[Any] = term ~ opt("+" | "-") ~ expr | |
def term: Parser[Any] = factor ~ rep("*" ~ factor) | |
def factor: Parser[Any] = number | "(" ~ expr ~ ")" | |
} |
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
;; Put autosave files (ie #foo#) and backup files (ie foo~) in ~/.emacs.d/. | |
(custom-set-variables | |
'(auto-save-file-name-transforms '((".*" "~/.emacs.d/autosaves/\\1" t))) | |
'(backup-directory-alist '((".*" . "~/.emacs.d/backups/")))) | |
;; create the autosave dir if necessary, since emacs won't. | |
(make-directory "~/.emacs.d/autosaves/" t) | |
;;(setq load-path (cons "~/.emacs.d/emacs-rails" load-path)) | |
;;(require 'rails) |
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
#!/usr/bin/env clisp | |
(setf *bookpaths* '( | |
("platform/architecture" "book") | |
("platform/requirements" "book") | |
("zszj/userGuide/agents" "book"))) | |
(setf *root* (namestring (cd))) | |
(defun make-books (paths) | |
(if (null paths) |
NewerOlder