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
runRandom :: State StdGen a -> IO a | |
runRandom x = do | |
g <- newStdGen | |
return $ evalState x g |
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 qualified Data.Vector as V | |
steppingPrimeGenerator :: (V.Vector Int, Int) -> (V.Vector Int, Int) | |
steppingPrimeGenerator (ps, x) | V.null $ V.filter ((==0) . (mod x)) ps = (V.snoc ps x, succ x) | |
| otherwise = (ps, succ 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
li = [...] | |
try: | |
while True: | |
c = li.next() | |
if condition(c): | |
break | |
except StopIteration: | |
# Not found... |
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 #-} | |
-- If we aren't careful, the monomorphism restriction will bite our backs. | |
module Magic where | |
magic :: (Monad m) => Int -> Int -> m Int | |
magic a b = return $ a + b | |
main = magic 7 3 |
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
O | |
-|- | |
||| | |
||| | |
- | |
||| | |
| | | |
- - | |
http://www.youtube.com/watch?v=vTnSf8OjYQ0 |
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
# Lets build a dictionary of people, like this: | |
names = [u'{} {}'.format(f.lower(),e.lower()) for (f,e) in Participant.objects.values_list('fname', 'ename').order_by('fname', 'ename')] | |
autocompletion_tree = defaultdict(list) | |
for (i,n) in enumerate(names): | |
s = '' | |
for c in n: | |
s += c | |
autocompletion_tree[s].append(i) | |
# Purge it! |
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<h1>My web page</h1> | |
This document has a heading and some text. <em>This sentence is emphasized.</em> | |
<script src="main.js" type="text/javascript"></script> | |
</body> | |
</html> |
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
( 33/185) upgrading firefox [#######################################################] 100% | |
New optional dependencies for firefox | |
gstreamer0.10-bad-plugins: aac, vp8 and opus decoding [installed] | |
gstreamer0.10-base-plugins: vorbis decoding, ogg demuxing [installed] | |
gstreamer0.10-good-plugins: webm and mp4 demuxing [installed] | |
gstreamer0.10-ugly-plugins: h.264 decoding |
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 Main where | |
data FzBz = Fizz | Buzz | FizzBuzz | N Int | |
instance Show FzBz where | |
show Fizz = "Fizz" | |
show Buzz = "Buzz" | |
show FizzBuzz = "FizzBuzz" | |
show (N x) = show 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
" Inget pip goddamit! | |
set visualbell | |
syntax on | |
set autoindent | |
set nosmartindent | |
set tabstop=4 | |
set expandtab | |
set shiftwidth=4 | |
set hlsearch " Higliht searched words |