This file contains hidden or 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
| # This file has been auto-generated by i3-config-wizard(1). | |
| # It will not be overwritten, so edit it as you like. | |
| # | |
| # Should you change your keyboard layout some time, delete | |
| # this file and re-run i3-config-wizard(1). | |
| # | |
| # i3 config file (v4) | |
| # | |
| # Please see http://i3wm.org/docs/userguide.html for a complete reference! |
This file contains hidden or 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
| from forbiddenfruit import curse, reverse | |
| # add method to int type | |
| def words_of_wisdom(self): | |
| return self * "blah " | |
| curse(int, "words_of_wisdom", words_of_wisdom) | |
| # add classmethod | |
| def hello(self): |
This file contains hidden or 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
| from types import MethodType | |
| class MyObj(object): | |
| def __init__(self, val): | |
| self.val = val | |
| def new_method(self, value): | |
| return self.val + value | |
| obj = MyObj(3) |
This file contains hidden or 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
| from functools import partial | |
| class Infix(object): | |
| def __init__(self, func): | |
| self.func = func | |
| def __or__(self, other): | |
| return self.func(other) | |
| def __ror__(self, other): | |
| return Infix(partial(self.func, other)) | |
| def __call__(self, v1, v2): |
This file contains hidden or 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 InstanceSigs #-} | |
| -- http://blog.tmorris.net/posts/20-intermediate-haskell-exercises/ | |
| -- Functor | |
| class Fluffy f where | |
| furry :: (a -> b) -> f a -> f b | |
| instance Fluffy [] where | |
| furry :: (a -> b) -> [a] -> [b] |
This file contains hidden or 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
| alias ghci-core="ghci -ddump-simpl -dsuppress-idinfo \ | |
| -dsuppress-coercions -dsuppress-type-applications \ | |
| -dsuppress-uniques -dsuppress-module-prefixes" |
This file contains hidden or 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
| :set prompt "\ESC[1;34m%s\n\ESC[0;34mλ: \ESC[m" | |
| :def hoogle \s -> return $ ":!hoogle --count=15 \"" ++ s ++ "\"" | |
| :def doc \s -> return $ ":!haskell-docs " ++ s | |
| :set -XOverloadedStrings | |
| :set -XFlexibleContexts |
This file contains hidden or 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 #-} | |
| -- Translated from https://upload.wikimedia.org/wikipedia/commons/b/b7/Vamos_matroid.svg | |
| -- For an absolutely amazing collection of Mathematical illustrations take a | |
| -- look at https://commons.wikimedia.org/wiki/User:David_Eppstein/Gallery | |
| import Graphics.Svg | |
| svg :: Element -> Element | |
| svg content = |
This file contains hidden or 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 #-} | |
| import Graphics.Svg | |
| svg :: Element -> Element | |
| svg content = doctype | |
| <> with (svg11_ content) [Version_ <<- "1.1", Width_ <<- "300", Height_ <<- "200"] | |
| contents :: Element | |
| contents = |
This file contains hidden or 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 InstanceSigs #-} | |
| -- Rose Trees | |
| data Tree a = | |
| a :> [Tree a] | |
| deriving (Eq, Show) | |
| singleton :: a -> Tree a | |
| singleton = (:> []) |