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 GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Main where | |
import Control.Monad.Trans.Writer | |
import Data.String (IsString (..)) | |
newtype ListBuilder e a = ListBuilder { runListBuilder :: Writer [e] a } | |
deriving (Functor, Applicative, Monad) |
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
#!/bin/bash | |
# First install XQuartz, then... | |
brew install freetype fontconfig libpng | |
ln -s /opt/X11/include/X11 /usr/local/include/X11 | |
git clone [email protected]:mono/libgdiplus | |
cd libgdiplus | |
./autogen.sh | |
make install |
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 ForeignFunctionInterface #-} | |
module Adder where | |
import Foreign.C | |
adder :: CInt -> CInt -> IO CInt | |
adder x y = return $ x + y | |
foreign export ccall adder :: CInt -> CInt -> IO CInt |
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 A where |
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
#!/usr/bin/env ruby | |
# Run from the destination root (somedevice/music/): | |
# .../music.rb audiosource/artist1/album1 audiosource/artist2/album2 ... | |
require 'fileutils' | |
ARGV.each do |dir| | |
dir = File.absolute_path(dir) | |
album = File.basename(dir) |
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 JavaScriptFFI #-} | |
module Main where | |
import Control.Concurrent | |
import Control.Monad | |
-- | Very simple, no exception safety. Intended for async JS functions. | |
parallel :: [IO a] -> IO [a] | |
parallel fs = do | |
vars <- forM fs $ \f -> do |
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
{- | | |
No attempt made to golf, but I did throw some alternate solutions in. | |
-} | |
module HW3 where | |
import Data.List (transpose) | |
skips :: [a] -> [[a]] | |
skips xs = zipWith const (map (f xs) [0..]) xs where | |
-- "zipWith const" clamps the first list to be no longer than the second. |
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
{- | | |
Extracts and injects files from the game Vagante's data.vra. | |
The format (after a 0x18-byte-long header) is a simple repeating pattern: | |
- length of filename (4 bytes little-endian) | |
- filename | |
- length of file data (4 bytes little-endian) | |
- file data | |
The files themselves are all nice standard formats: | |
OGG, WAV, PNG, JSON, TTF, and OpenGL fragment shader. | |
-} |
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
Music_TitleScreen_Ch1:: | |
tempo 130 | |
volume 7, 7 | |
toggleperfectpitch | |
duty 0 | |
notetype 6, 15, 7 | |
octave 4 | |
E_ 1 | |
F_ 1 | |
notetype 12, 15, 7 |
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
Music_TitleScreen_Ch1:: | |
tempo 150 | |
octave 2 | |
notetype 1, 10, 0 | |
C_ 1 | |
endchannel | |
Music_TitleScreen_Ch2:: | |
Music_TitleScreen_Ch3:: | |
Music_TitleScreen_Ch4:: |
NewerOlder