Skip to content

Instantly share code, notes, and snippets.

View funrep's full-sized avatar

Karl-Oskar Rikås funrep

View GitHub Profile
<Player>:
canvas:
Rectangle:
pos: root.center
size: 40, 40
<Screen>:
Player
@funrep
funrep / errors
Last active August 29, 2015 13:56
*Main> main
> NICK tob
> USER tob 0 * :tob
:irc.codetalk.io NOTICE AUTH :*** Looking up your hostname...
failed to parse
:irc.codetalk.io NOTICE AUTH :*** Couldn't resolve your hostname; using your IP address instead
failed to parse
PING :D433C6EE
failed to parse
^CInterrupted.
@funrep
funrep / lispmonad.hs
Last active August 29, 2015 13:55
crazy and most likely stupid idea i got on the bus
Note to self: possible to write a Lisp-like DSL within Haskell using Writer monad?
main = runLisp $ do
def "f" $ do
args $ do
"x"
"y"
body $ do
"x" + "y"
lispPrint $ "f" $ do
@funrep
funrep / stuff.md
Last active January 4, 2016 19:49
Stuff to learn
@funrep
funrep / gist:8301310
Last active January 2, 2016 12:09
Weird behaviour by the Parser params
params :: Parser Params
params = do
ps <- takeWhile (notInClass ":\r") `sepBy` space
%{
#define YYSTYPE double /* data type of yacc stack */
%}
%token NUMBER
%left '+' '-' /* left associative, same precedence */
%left '*' '/' /* left assoc., higher precedence */
%left UNARYMINUS
%%
list: /* nothing */
| list '\n'
{-# LANGUAGE OverloadedStrings #-}
module Tob.Parser where
-- (maybe ':') (maybe adress) (command) (params) (maybe ':') (maybe stuff)
import Prelude hiding (takeWhile)
import Control.Applicative ((<|>))
import Data.Text (Text)
import Data.Char (isUpper)
import Data.Attoparsec.Text
@funrep
funrep / weird.md
Last active January 1, 2016 23:38
pipe inp s = inp >>= \x -> sh $ T.concat ["echo ", "\"", x, "\"", " | ", s]
DotHellRC.hs:37:33:
    Couldn't match expected type `Data.Text.Lazy.Internal.Text'
                with actual type `T.Text'
    In the return type of a call of `T.concat'
 In the second argument of `($)', namely
{-# LANGUAGE RecordWildCards, OverloadedStrings #-}
import Prelude hiding (Either(..))
import Data.IntMap (IntMap)
import qualified Data.IntMap as IM
import System.IO (Handle)
import Network (withSocketsDo, listenOn, accept, PortID(..))
import qualified Data.ByteString.Lazy as B
import Data.Aeson
import Control.Applicative
{-# LANGUAGE RecordWildCards #-}
import Prelude hiding (Either(..))
import Data.IntMap (IntMap)
import qualified Data.IntMap as IM
import System.IO (Handle)
import Network (withSocketsDo, listenOn, accept, PortID(..))
import qualified Data.ByteString as B
import Data.Aeson