Skip to content

Instantly share code, notes, and snippets.

View schell's full-sized avatar
🥑
mmm

Schell Carl Scivally schell

🥑
mmm
View GitHub Profile
@schell
schell / test output
Created April 2, 2014 23:24
./runtests.sh - Mac OS X 10.9.2, ghc 7.8.0.20140228, cabal-install 1.18.0.3, Cabal 1.18.1.3
Running test Arr...
cat: TestDriver.tmp: No such file or directory
cat: TestDriver.tmp: No such file or directory
GHC disagrees with hastec output!
GHC says '[0,0,0,0,0,999,1041,0,0,0]', but hastec says ''
GHC disagrees with hastec -O2 output!
GHC says '[0,0,0,0,0,999,1041,0,0,0]', but hastec says ''
Running test BitOps...
cat: TestDriver.tmp: No such file or directory
cat: TestDriver.tmp: No such file or directory
{-# LANGUAGE OverloadedStrings #-}
module Web.Parsers where
import Data.Attoparsec.Text as A
import Data.Text
import Control.Applicative
import Data.Char
convertUnicode :: Text -> Either String Text
@schell
schell / loadCharacter
Created January 17, 2014 02:16
loadCharacter (into atlas)
-- | Loads a character into our atlas.
-- It does so by rendering a glyph to a texture then draws the original
-- atlas and the glyph texture into a framebuffer that is used as the new
-- atlas.
loadCharacter :: TextShaderProgram -> Atlas -> Char -> IO Atlas
loadCharacter tsp a char = do
let fp = _atlasFontFilePath a
px = _atlasPxSize a
(aW, aH) = _atlasTextureSize a
aTex = _atlasTextureObject a
@schell
schell / Onomatopentameters
Created December 16, 2013 03:54
Onomatopentameters
Onomatopentameter
=================
Onomatopentameters are words that when spoken make drum beats or some other cool musiclike pattern. The words themselves sound like the different drums in a trap set or a drum machine but the words themselves also make some kind of sense when put together as opposed to just patterns of onomatopoea. Here are some examples (and jokes).
Big Cat Little Cat
------------------
Old man: "Punk music is all about cats."
Young punk: "No way old man, it's about drugs and dirt and spikes."
Old man: "Then why are the drums always like - big cat little cat, big cat little cat?"
@schell
schell / Matrix.hs
Last active December 19, 2015 13:29
Matrix ops
module Geometry.Matrix where
import Data.List ( intercalate )
import Data.Maybe ( fromJust, fromMaybe )
import qualified Data.List as L
{- The Matrix -}
type Matrix a = [Vector a]
@schell
schell / readerSeq.hs
Last active December 19, 2015 00:59
Using Reader to sequence a thing over a list functions to produce a list of things.
toTriangleRect :: Rectangle -> [GLfloat]
toTriangleRect (Rectangle (x,y) (w,h)) = concat [tl, bl, br, br, tl, tr]
where tl = [x,y]
tr = [x+w,y]
bl = [x,y+h]
br = [x+w,y+h]
@schell
schell / reinversion.3.hs
Created June 18, 2013 20:03
reinversion of control, part 3 - down the rabbit hole
module Main where
import Graphics.UI.GLFW
import Control.Monad.Cont
import System.Exit ( exitSuccess )
data GameState = GameState { keys :: [Key]
, wSize:: (Int, Int)
, mPos :: (Int, Int)
@schell
schell / reinversion.2.hs
Created June 18, 2013 07:03
reinversion of control, part 2
module Main where
import Graphics.UI.GLFW
import Control.Monad.Cont
import System.Exit ( exitSuccess )
main :: IO ()
main = do
putStrLn "Running glfw-cont-test."
module Main where
import Graphics.UI.GLFW
import Control.Monad.Cont
import System.Exit ( exitSuccess )
main :: IO ()
main = do
putStrLn "Running glfw-cont-test."
@schell
schell / reinversion.1.hs
Last active December 18, 2015 13:49
Re-inversion of control. Part 1.
module Main where
import Graphics.UI.GLFW
import Control.Monad.Cont
import System.Exit ( exitSuccess )
main :: IO ()
main = do
putStrLn "Running glfw-cont-test."