OverloadedString
extension is applied.- The following modules are imported.
- Control.Applicative
- Data.Attoparsec.Text
- Data.Char
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 hibernatevalidator.constraints; | |
import javax.validation.Constraint; | |
import javax.validation.Payload; | |
import javax.validation.ReportAsSingleViolation; | |
import javax.validation.constraints.Pattern; | |
import java.lang.annotation.Documented; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.Target; |
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 hibernatevalidator.constraints; | |
import javax.validation.Constraint; | |
import javax.validation.Payload; | |
import javax.validation.ReportAsSingleViolation; | |
import javax.validation.constraints.Pattern; | |
import java.lang.annotation.Documented; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.Target; |
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 os | |
import traceback | |
# Write a message to /var/log/hoge.log | |
os.system("echo `date '+%Y/%m/%d %H:%M:%S.%N'` 'Some message' >> /var/log/hoge.log") | |
# Write a traceback to /var/log/hoge.log | |
os.system("echo `date '+%Y/%m/%d %H:%M:%S.%N'` '" + traceback.format_exc() + "' >> /var/log/hoge.log") |
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 clientwithproxy | |
import akka.util.Timeout | |
import spray.can.Http.ClientConnectionType | |
import scala.util.{Success, Failure} | |
import scala.concurrent.duration._ | |
import akka.actor.ActorSystem | |
import akka.pattern.ask | |
import akka.event.Logging |
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
Inductive term : Type := | |
| Ttrue : term | |
| Tfalse : term | |
| Tifthenelse : term -> term -> term -> term. | |
Inductive evaluate : term -> term -> Prop := | |
| Eiftrue : forall t2 t3, evaluate (Tifthenelse Ttrue t2 t3) t2 | |
| Eiffalse : forall t2 t3, evaluate (Tifthenelse Tfalse t2 t3) t3 | |
| Eif : forall t1 t1' t2 t3, evaluate t1 t1' -> evaluate (Tifthenelse t1 t2 t3) (Tifthenelse t1' t2 t3). |
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
Inductive term : Type := | |
| Ttrue : term | |
| Tfalse : term | |
| Tifthenelse : term -> term -> term -> term. | |
Inductive evaluate : term -> term -> Prop := | |
| Eiftrue : forall t2 t3, evaluate (Tifthenelse Ttrue t2 t3) t2 | |
| Eiffalse : forall t2 t3, evaluate (Tifthenelse Tfalse t2 t3) t3 | |
| Eif : forall t1 t1' t2 t3, evaluate t1 t1' -> evaluate (Tifthenelse t1 t2 t3) (Tifthenelse t1' t2 t3). |
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
Inductive term : Type := | |
| Ttrue : term | |
| Tfalse : term | |
| Tifthenelse : term -> term -> term -> term. | |
Inductive evaluate : term -> term -> Prop := | |
| Eiftrue : forall t2 t3, evaluate (Tifthenelse Ttrue t2 t3) t2 | |
| Eiffalse : forall t2 t3, evaluate (Tifthenelse Tfalse t2 t3) t3 | |
| Eif : forall t1 t1' t2 t3, evaluate t1 t1' -> evaluate (Tifthenelse t1 t2 t3) (Tifthenelse t1' t2 t3). |
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 Data.List (foldl', intercalate) | |
import Test.HUnit (Test(..), runTestTT, (~=?)) | |
process :: String -> String | |
process = intercalate "," . map show . take 10 . foldl' transf [1..] | |
isSquare n = let x = sqrt (fromIntegral n) in x - fromIntegral (floor x) == 0 | |
--isCube n = let x = (fromIntegral n) ** (1 / 3) in x - fromIntegral (floor x) == 0 | |
isCube n = round (fromIntegral n ** (1 / 3)) ^ 3 == n |
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
Require Import List Arith ZArith Program. | |
Class Monoid {A} (dot : A -> A -> A) (zero : A) := { | |
monoid_1st_law : forall a, dot a zero = a; | |
monoid_2nd_law : forall a, dot zero a = a; | |
monoid_3rd_law : forall a b c, dot (dot a b) c = dot a (dot b c) | |
}. | |
Instance nat_plus_Monoid : Monoid plus 0. | |
split; auto with arith. |