Skip to content

Instantly share code, notes, and snippets.

View sleexyz's full-sized avatar

Sean Lee sleexyz

View GitHub Profile
{-# 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.
{-# 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.
{-# 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
{-# 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
@sleexyz
sleexyz / flowbug.js
Created July 9, 2017 18:36
callable classes cannot be extended
/* @flow */
declare class Callable<A, B> {
(A): B
}
class WithFoo<A, B> extends Callable<A, B> {
foo() {
}
}
@sleexyz
sleexyz / test_isolation_spec.rb
Created July 7, 2017 04:54
rspec test isolation
# 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
#!/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
{-# LANGUAGE GADTs #-}
module Jam_2017_05_21 where
import Util
output = toProgram $ bb
where
bb = bbF (texture2D backBuffer) uvN
// @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)) {
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