This file contains hidden or 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
{-# LANGUAGE PackageImports #-} | |
module Main where | |
import "pipes-core" Control.Pipe | |
import Control.Pipe.Network | |
import Control.Monad | |
import Control.Monad.Trans | |
import Control.Concurrent (forkIO) | |
import qualified Data.ByteString.Char8 as B |
This file contains hidden or 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
{-# LANGUAGE TypeFamilies, QuasiQuotes, TemplateHaskell #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleContexts, EmptyDataDecls, GADTs #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Yesod | |
import Database.Persist.Sqlite | |
import Data.Text | |
data TodoList = TodoList ConnectionPool |
This file contains hidden or 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
var listhead = $$(".datelisthead"); | |
var sumScoreRank = 0; | |
var sumPoint = 0; | |
for (var i = listhead.nextSibling; i.nodeName == "TR"; i = i.nextSibling) { | |
var score = parseFloat(i.childNodes[4].innerHTML); | |
var point = parseFloat(i.childNodes[8].innerHTML); | |
if (isNaN(score)) continue; | |
sumScoreRank += score * scoreToRank(score); | |
sumPoint += point; |
This file contains hidden or 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
module Path where | |
data Tree a = Empty | |
| Node a (Tree a) (Tree a) | |
deriving (Eq, Show) | |
paths Empty = [] | |
paths (Node x Empty Empty) = [[x]] | |
paths (Node x l r) = concat [ map (x:) (paths l), map (x:) (paths r)] |
This file contains hidden or 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
{-# LANGUAGE TypeFamilies, MultiParamTypeClasses #-} | |
{-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings #-} | |
{-# LANGUAGE FlexibleContexts, GADTs #-} | |
import Yesod | |
import Yesod.Form | |
import Database.Persist | |
import Database.Persist.Sqlite | |
import Database.Persist.TH | |
import Data.Time |
This file contains hidden or 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 java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
import javax.swing.event.*; | |
import java.util.HashMap; | |
public class LoginValidate extends JFrame { | |
//db存放用户名和喜闻乐见的明文密码 | |
private HashMap<String, String> db; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Calc</title> | |
</head> | |
<body> | |
<APPLET code="Calc.class" WIDTH="400" HEIGHT="300"> | |
This is where HelloWorld.class runs.</APPLET></P> | |
</body> |
This file contains hidden or 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 day : Type := | |
| monday : day | |
| tuesday : day | |
| wendnesday : day | |
| thursday : day | |
| friday : day | |
| saturday : day | |
| sunday : day. | |
Definition next_weekday (d:day) : day := |
This file contains hidden or 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
{-# LANGUAGE OverloadedStrings #-} | |
import Network.HTTP.Conduit | |
import Data.Conduit | |
import Data.Conduit.Binary (sinkFile) | |
import Data.Conduit.Attoparsec (sinkParser) | |
import Data.Aeson.Parser (json) | |
import Control.Monad (when) | |
import qualified Data.ByteString.Lazy as L | |
import Control.Monad.IO.Class (liftIO) |
This file contains hidden or 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
module String50 where | |
import Data.List (inits, tails) | |
removeDuplicate [] = [] | |
removeDuplicate [x, y] = if x == y then [x] else [x, y] | |
removeDuplicate (x:y:ys) | |
| x == y = removeDuplicate (y:ys) | |
| otherwise = x : removeDuplicate (y:ys) |