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
-------------------------------------------------------------------------------- | |
-- Is List or NonEmpty "simpler"? Neither: | |
type NonEmpty a = Fix (Compose ((,) a) Maybe) | |
type List a = Fix (Compose Maybe ((,) a)) | |
-------------------------------------------------------------------------------- | |
newtype Fix f = Fix {unFix :: f (Fix f)} |
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 (unless) | |
import qualified System.Directory as Directory | |
import System.Environment (getArgs) | |
import qualified System.Process as Process | |
import Text.Read (readMaybe) | |
newtype W3mImageDisplay = W3mImageDisplay FilePath deriving (Show) | |
findW3mImageDisplay :: IO W3mImageDisplay | |
findW3mImageDisplay = 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
def test01 | |
a = 32 | |
b = 2 | |
i = 2 | |
a /b/i | |
end | |
def test02 | |
def a(x) | |
x |
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 OverloadedStrings #-} | |
module Main | |
( main | |
) where | |
-------------------------------------------------------------------------------- | |
import Control.Concurrent (forkIO) | |
import Control.Monad (forever, unless) |
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 (unless) | |
import Data.IORef | |
data Resource = Resource | |
{ resourceName :: String | |
, resourceClosed :: IORef Bool | |
} | |
mkResource :: String -> IO Resource | |
mkResource name = 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
Dump of assembler code for function hashable_siphash24_sse2: | |
0x088ed150 <hashable_siphash24_sse2+0>: push %ebp | |
0x088ed151 <hashable_siphash24_sse2+1>: xor %eax,%eax | |
0x088ed153 <hashable_siphash24_sse2+3>: mov %esp,%ebp | |
0x088ed155 <hashable_siphash24_sse2+5>: and $0xfffffff0,%esp | |
0x088ed158 <hashable_siphash24_sse2+8>: push %ebx | |
0x088ed159 <hashable_siphash24_sse2+9>: sub $0x2c,%esp | |
0x088ed15c <hashable_siphash24_sse2+12>: mov 0x1c(%ebp),%ebx | |
0x088ed15f <hashable_siphash24_sse2+15>: movq 0x8(%ebp),%xmm2 | |
0x088ed164 <hashable_siphash24_sse2+20>: movq 0x10(%ebp),%xmm1 |
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
... | |
Library | |
... | |
If(os(windows)) | |
Include-dirs: | |
../SDL-1.2.15/include | |
../SDL_mixer-1.2.12 |
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', maximumBy) | |
import Data.Map (Map) | |
import qualified Data.Map as M | |
import Data.Maybe (catMaybes, fromMaybe, listToMaybe) | |
import Data.Ord (comparing) | |
-------------------------------------------------------------------------------- | |
data Player = X | O |
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/ruby | |
require 'digest' | |
require 'fileutils' | |
entries = Dir.entries('.').select { |x| File.file? x } | |
hashes = {} | |
entries.each do |entry| | |
hash = Digest::MD5.file(entry).to_s |
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
hash1 = {:foo => 1, :bar => 2} | |
hash2 = {:bar => 2, :foo => 1} | |
# #to_s is probably a bad example, but I like | |
# it when x == y implies that f x == f y | |
puts hash1 == hash2 | |
puts hash1.to_s == hash2.to_s |