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
rm -f /private/var/folders/*/*/*/com.apple.DeveloperTools/*/Xcode/PlugInCache-Debug.xcplugincache | |
rm -rf /private/var/folders/*/*/*/com.apple.DeveloperTools/*/Xcode/PlugInCache.xcplugincache |
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
{-# LANGUAGE FlexibleContexts #-} | |
import Control.Monad.Writer | |
listify :: Writer [a] () -> [a] | |
listify = execWriter | |
item x = tell [x] | |
main = do |
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 Control.Monad.State | |
import System.Random | |
type Range = (Int, Int) -> Int | |
rangify :: Int -> Range | |
rangify x (lo, hi) = x `mod` (hi - lo + 1) + lo | |
getRandomsR :: RandomGen g => State g [Range] | |
getRandomsR = map rangify . randoms <$> state split |
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
{-# LANGUAGE NoMonomorphismRestriction #-} | |
module KMP3 (buildKMP , matchKMP , State) where | |
data State a = | |
State (State a) (State a) a -- State next fail char | |
| Aux (State a) -- Aux next | |
| Finish (State a) -- Finish fail | |
nextOf :: Eq a => State a -> a -> State a |
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
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} |
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
module Calculus where | |
import Control.Monad (liftM2) | |
import Data.List (sort, permutations, nub) | |
import Data.Char (chr) | |
import Debug.Trace | |
data Formula = Formula Int | |
| Not Formula |
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
% http://www.tutorialspoint.com/execute_matlab_online.php | |
n = 8; | |
N = zeros(n+1); | |
c = linspace(1,n+1,n+1); | |
for i=1:n+1 | |
for j=1:n+1 | |
N(i,j)= ((j-1)/n)^(i-1); | |
end | |
c(i)=1/c(i); | |
end |
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
{-# LANGUAGE | |
UndecidableInstances, RankNTypes, TypeOperators, TypeFamilies, | |
StandaloneDeriving, DataKinds, PolyKinds, DeriveFunctor, DeriveFoldable, | |
DeriveTraversable, LambdaCase, PatternSynonyms, TemplateHaskell #-} | |
import Control.Monad | |
import Control.Applicative | |
import Data.Singletons.TH | |
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
#C++ 吧的吧友看过来 | |
头疼如何共享代码嘛?来使用 Github 的 Gist 吧…… | |
首先你需要一个 Github 的账号,不知道何为 Github 的现在就去搜索,这太可怕了。嗯嗯! | |
然后访问 gist dot github dot com,按照指示去做就可以了。方便吧…… | |
最后记着防度娘抽风哦! |
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
logOnPageTarget = document.getElementById('log-on-page-target'); | |
function resetOnPageLog () { | |
logOnPageTarget.innerText = ''; | |
} | |
function logOnPage (text) { | |
logOnPageTarget.innerText = text + '\n' + logOnPageTarget.innerText; | |
} |