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
// I was just browsing the code, and there's a lot of this repetition. | |
if (!options.AreAllEnabled(Options.IgnoreKeys)) | |
{ | |
foreach (var val in ForeignKeys.CompareWith(target.ForeignKeys, options)) | |
{ | |
yield return val.AddContext(this); | |
} | |
} |
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
var foos = new List<int>{1,2,3,4}; | |
var bars = new List<int>(); | |
foreach(var foo in foos) { | |
Console.WriteLine("hello"); | |
bars.Add(x*2); | |
} | |
// versus. |
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
warpingPath :: Array (Int,Int) Int -> [(Int,Int)] | |
warpingPath arr = go (w,h) [] | |
where | |
(_,(w,h)) = bounds arr | |
go p@(x,y) xs | |
| x == 0 && y == 0 = p : xs | |
| otherwise = go minVal (minVal : xs) | |
where | |
minVal = minimumBy (comparing (arr !)) [down,downLeft,left] | |
down = (max 0 (x-1),max 0 y) |
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
dtwWin :: V.Vector a -> V.Vector a -> (a -> a -> Int) -> Int -> Array (Int,Int) Int | |
dtwWin x y cost window = runSTArray $ do | |
let n = V.length x | |
m = V.length y | |
maxCost = maxBound | |
w = max window (abs (n - m)) -- constrain window size | |
d <- newArray ((0,0),(m,n)) maxCost | |
writeArray d (0,0) 0 | |
forM_ [1..n] $ \i -> | |
forM_ [max 1 (i-w) .. min m (i+w)] $ \j -> 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
dtw :: V.Vector a -> V.Vector a -> (a -> a -> Int) -> Array (Int,Int) Int | |
dtw x y cost = runSTArray $ do | |
let n = V.length x | |
m = V.length y | |
maxcost = maxBound | |
d <- newArray ((0,0),(m,n)) 0 | |
forM_ [1..n] (\i -> writeArray d (0,i) maxcost) | |
forM_ [1..m] (\i -> writeArray d (i,0) maxcost) | |
forM_ [1..n] $ \i -> | |
forM_ [1..m] $ \j -> 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 Data.List | |
import Data.Maybe | |
stableMatch :: (Eq m, Eq w) => [(m,[w])] -> [(w,[m])] -> [(m,w)] | |
stableMatch ms ws = stableMatch' [] | |
where | |
stableMatch' ps = case unmarried ms ps of | |
Just unmarriedMan -> stableMatch' (findMatch unmarriedMan ws ps) | |
Nothing -> ps | |
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
@mixin border { | |
border: 1px solid #333; | |
} | |
article.post { | |
background: #eee; | |
@include border; | |
} | |
ul.menu { | |
background: #ccc; | |
@include border; |
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
private LiveDatabase RefreshLiveDatabase(LiveDatabase source, int whichDatabase) | |
{ | |
source.Cleanup(); | |
var original = whichDatabase == 1 ? m_DB1Original : m_DB2Original; | |
return original.ToLive(); | |
} |
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
AOAKN HVPKD FNFJW YIDDC | |
RQXSR DJHFP GOVFN MIAPX | |
PABUZ WYYNP CMPNW HJRZH | |
NLXKG MEMKK ONOIB AKEEQ | |
WAOTA RBQRH DJOFM TPZEH | |
LKXGH RGGHT JRZCQ FNKTQ | |
KLDTS FQIRW AOAKN 27 1525/6 |
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 FactorsAndMultiples where | |
import Data.List | |
import Data.Ord (comparing) | |
isFom :: Int -> Int -> Bool | |
isFom x y = x `mod` y == 0 || y `mod` x == 0 | |
isSequenceValid :: [Int] -> Bool | |
isSequenceValid [] = True |