Instantly share code, notes, and snippets.

View *scratch*.el
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
View TenStrings.idr
module TenStrings
import Decidable.Order
%default total
-----------------------------------------------
-- Copied from tpsinnem/libs-misc
-----------------------------------------------
View *ansi-term*.txt
mathijs@bluebook xorg% cd /home/mathijs/Repositories/nix/nixpkgs/pkgs/servers/x11/xorg next 0
mathijs@bluebook ~% cd tmp /home/mathijs 0
mathijs@bluebook tmp% ls -l /home/mathijs/tmp 0
total 6840
drwxr-xr-x 1 mathijs users 14 24 feb 23:17 agda
-rw-r--r-- 1 mathijs users 4905 29 apr 13:59 bla2.js.gz
-rw-r--r-- 1 mathijs users 113719 4 mei 13:11 bla.bc
-rw-r--r-- 1 mathijs users 164560 4 mei 13:13 bla.c
-rw-r--r-- 1 mathijs users 137972 4 mei 13:22 bla.js
drwxr-xr-x 1 mathijs users 18 20 mei 23:58 channel
View count-ajax.js
!function() {
var count = 0;
$(document).ajaxSend(function() { count++; report(); });
$(document).ajaxComplete(function() { count--; report(); });
function report() { if (count > 1) { console.warn('' + count + ' simultaneous ajax calls!'); }}
}();
View hello2.agda
module hello2 where
data ℕ : Set where
zero :
suc :
one :
one = suc zero
View gist:3356516
mathijs@bluebook uhc-stuff% ls -l
total 12
drwxr-xr-x 3 mathijs users 4096 13 aug 18:22 platforms
-rw-r--r-- 1 mathijs users 79 15 aug 07:26 Test.hs
drwxr-xr-x 3 mathijs users 4096 15 aug 07:31 vendor
mathijs@bluebook uhc-stuff% cd vendor
mathijs@bluebook vendor% ./fetchdeps
View gist:2350944
diff --git a/reactive-banana/src/Reactive/Banana/Internal/CompileModel.hs b/reactive-banana/src/Reactive/Banana/Internal/CompileModel.hs
index a9b78df..c3e07e8 100644
--- a/reactive-banana/src/Reactive/Banana/Internal/CompileModel.hs
+++ b/reactive-banana/src/Reactive/Banana/Internal/CompileModel.hs
@@ -27,12 +27,15 @@ import Reactive.Banana.Model
data InputToEvent = InputToEvent (forall a. InputChannel a -> Event a)
type Compile a b = (InputToEvent -> IO (Event a,b)) -> IO (Automaton a,b)
+
+data Box a = Box { unBox :: a }
View gist:2295402
once :: Event t a -> Event t a
once e = let b = stepper True (False <$ e)
in whenE b e
changes' :: Eq a => Event t (a, a) -> Event t a
changes' e = fst <$> filterE (uncurry (/=)) e
stepperP :: a -> Event t a -> (Event t (a, a), Behavior t a)
stepperP acc e = mapAccum acc (withPrev <$> e)
where withPrev x acc = ((x, acc), x)
View gist:2292308
interpretModel :: (forall t. Event t a -> Event t b) -> [[a]] -> [[b]]
interpretModel f xs = map toList $ (unE . f . E) (map Just xs)
where toList :: Maybe [a] -> [a]
toList Nothing = []
toList (Just xs) = xs
runner :: (forall t. Event t a -> Event t b) -> IO ([a] -> IO [[b]])
runner network = do inbox <- newIORef [] -- ref to write events into
outbox <- newIORef . interpretModel network =<< toEvents inbox
return $ step inbox outbox
View config.nix
{
packageOverrides = pkgs:
let
haskell = pkgs.haskellPackages_ghc704;
emacs = pkgs.emacs23Packages;
lowPrio = pkgs.lib.lowPrio;
hiPrio = pkgs.lib.hiPrio;
# uhc = haskell.uhc.override {useJSBackend = true; };
uhc = haskell.uhc; # js backend is enabled by default nowadays