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
$('.themeBox').children().map(function(){return $(this).attr('title');}); |
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
(* Checks if the two given int lists are the same, regardless of their order *) | |
(* val permEqual : int list -> int list -> bool = <fun> | |
# permEqual [] [];; | |
- : bool = true | |
# permEqual [1] [2];; | |
- : bool = false | |
# permEqual [1;2;3;4] [2;3;1;4];; | |
- : bool = true | |
# permEqual [1;2;3;4] [2;2;3;4];; | |
- : bool = false |
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
/* | |
//Human readable version: | |
var frame = document.querySelectorAll('frame')[1].contentWindow.document; | |
var list = Array.prototype.slice.call(frame.querySelectorAll('center tr')); | |
list = list.slice(1); | |
list.map(function(tr) { | |
return parseFloat(tr.querySelectorAll('td:nth-child(4)')[0].innerText); | |
}).reduce(function(pre, cur){ | |
return pre + cur; |
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
(* Checks if the two given int lists are the same, regardless of their order *) | |
(*val permEqual = fn : int list * int list -> bool | |
- permEqual([1,2,3,4,5], [1,2,3,4,5]); | |
val it = true : bool | |
- permEqual([1,5,4,2,3], [1,2,3,4,5]); | |
val it = true : bool | |
- permEqual([1,2,3,4],[5,3,6,2]); | |
val it = false : bool | |
- permEqual([], []); | |
val it = true : bool |
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
data DoorState = Open | Closed deriving (Show, Eq) | |
switch Open = Closed | |
switch Closed = Open | |
initial = map (\n -> (n, Closed)) [1..100] | |
visitMult xs n = map change xs | |
where mult x y = x `mod` y == 0 | |
change (x, st) = (x, if x `mult` n then switch st else st) |
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
List.app (fn x => print( | |
if (x mod 15) = 0 then "FizzBuzz\n" else | |
if (x mod 3) = 0 then "Fizz\n" else | |
if (x mod 5) = 0 then "Buzz\n" else | |
(Int.toString x) ^ "\n")) (tl (List.tabulate(100, (fn 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
import Data.List | |
import Data.List.Split | |
import Data.Maybe | |
import Data.Function (on) | |
up = ['A','B','C','Ç','D','E','F','G','Ğ','H','I','İ','J','K','L','M','N','O','Ö','P','R','S','Ş','T','U','Ü','V','Y','Z'] | |
low = ['a','b','c','ç','d','e','f','g','ğ','h','ı','i','j','k','l','m','n','o','ö','p','r','s','ş','t','u','ü','v','y','z'] | |
lower xs = map single xs | |
where single x = case (x `elemIndex` up) of |
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
-- ghc --make -O2 -threaded setInterval.hs | |
import Control.Concurrent (forkIO, putMVar, takeMVar, | |
newEmptyMVar, threadDelay) | |
import Control.Exception (finally) | |
setInterval :: IO a -> Int -> IO () | |
setInterval action microsecs = do | |
mvar <- newEmptyMVar | |
_ <- forkIO $ loop `finally` putMVar mvar () | |
takeMVar mvar |
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.Maybe (isNothing, fromJust) | |
import Data.Char (isAlpha, toLower) | |
import Data.List (findIndex) | |
-- charAt xs i = Just x, where x character at index i | |
-- Nothing, is i is out of bounds | |
charAt :: String -> Int -> Maybe Char | |
charAt xs i = if length xs > i then Just (xs !! i) else Nothing | |
-- isVowel x = True if x is a vowel, |
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
;; My packages installed: evil, evil-leader, undo-tree, evil-surround (not in MELPA), color-theme-wombat, haskell-mode. | |
;; packages | |
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") | |
("org" . "http://orgmode.org/elpa/") | |
("marmalade" . "http://marmalade-repo.org/packages/") | |
("melpa-stable" . "http://melpa-stable.milkbox.net/packages/"))) | |
(add-to-list 'load-path "~/.emacs.d") | |
(package-initialize) | |
(evil-mode 1) |
OlderNewer