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 #-} | |
{-# LANGUAGE RebindableSyntax #-} | |
import Prelude | |
import Sound.Tidal.Context | |
import qualified Foreign.Store as ForeignStore | |
import Data.Word (Word32) | |
import Data.String (fromString) | |
import Control.Arrow ((>>>)) | |
-- Runs computation once. Persists across ghci sessions. |
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 #-} | |
{-# LANGUAGE RebindableSyntax #-} | |
import Prelude | |
import Sound.Tidal.Context | |
import qualified Foreign.Store as ForeignStore | |
import Data.Word (Word32) | |
import Data.String (fromString) | |
import Control.Arrow ((>>>)) | |
-- Runs computation once. Persists across ghci sessions. |
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 #-} | |
{-# LANGUAGE RebindableSyntax #-} | |
import Prelude | |
import Sound.Tidal.Context | |
import Data.Function ((&)) | |
import qualified Foreign.Store as ForeignStore | |
import Data.Word (Word8, Word32) | |
import Control.Monad.Writer.Lazy | |
import Data.String (fromString) | |
import Control.Arrow |
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 #-} | |
{-# LANGUAGE RebindableSyntax #-} | |
import Prelude | |
import Sound.Tidal.Context | |
import Data.Function ((&)) | |
import qualified Foreign.Store as ForeignStore | |
import Data.Word (Word8, Word32) | |
import Control.Monad.Writer.Lazy | |
import Data.String (fromString) | |
import Control.Arrow |
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
/* @flow */ | |
declare class Callable<A, B> { | |
(A): B | |
} | |
class WithFoo<A, B> extends Callable<A, B> { | |
foo() { | |
} | |
} |
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
# 1. tests should not leak to sibling describe blocks | |
describe "asdf" do | |
describe "inner 1" do | |
it "works" do | |
expect(defined? @foo).to eql nil | |
end | |
end | |
it "(mutation)" do | |
@foo = true | |
end |
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
#!/usr/bin/env stack | |
-- stack --resolver lts-8.0 --install-ghc runghc --package hspec -- -Wall -Werror | |
import Test.Hspec | |
import Data.IORef | |
-- * test should be isolated from other tests - Pass (expected: Pass) ✔ | |
main :: IO () | |
main = hspec $ do |
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 GADTs #-} | |
module Jam_2017_05_21 where | |
import Util | |
output = toProgram $ bb | |
where | |
bb = bbF (texture2D backBuffer) uvN |
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
// @flow | |
type $Output<A> = $ObjMap<A, <O>(mixed => O) => O>; | |
export const Record = <A: {}>(record: A): (mixed => $Output<A>) => (x) => { | |
if (typeof(x) !== 'object' || x === null) { | |
throw new Error('not object'); | |
} | |
for (const key in record) { | |
if (!(key in x)) { |
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
import sys | |
# Splits stdin into separate files, each of which contains {chunkBy} unique prefixes. | |
# as the first {charactersToCompareBy} characters of a line | |
def chunkByLinePrefix(outputPrefix, chunkBy, prefixLength): | |
counter = 0 # updated every line | |
lastChunk = None # the last prefix | |
fileCounter = 0 # updated every file | |
f = open(outputPrefix + str(fileCounter).zfill(4), 'a') # updated every file |