Skip to content

Instantly share code, notes, and snippets.

View tdammers's full-sized avatar

Tobias Dammers tdammers

View GitHub Profile
@tdammers
tdammers / This.hs
Created April 17, 2019 08:11
import This
{-#LANGUAGE TemplateHaskell #-}
module This where
import Language.Haskell.TH
$(do
runIO $ putStrLn "The Eightfold Path To Monad Satori, by Stephen Diehl"
runIO $ putStrLn ""
runIO $ putStrLn "1. Don't read the monad tutorials."
runIO $ putStrLn "2. No really, don't read the monad tutorials."
Hi Sir/Madam,
So the guard of the Dover mail thought to himself, that Friday night in
November,
Glad to hear that you're on the market for furniture, we specialize in FRP
Grating field for 10 years, with the strength of ERU&USA ANTIQUE FURNITURE,
with good quality and pretty competitive price. and were now making a general
pretence of being asleep.
god helps those who help themselves. I own, and I laugh at them whenever I
can. -- But these, I suppose, are precisely what you are without.
Also we have our own professional designers to meet any of your requriements.
#!/usr/bin/env bash
if [ "$2" ]
then EXTENSION=".$2"
else EXTENSION=""
fi
PID="$$"
TMPFILE="/tmp/$PID$EXTENSION"
cat >"$TMPFILE"
if [ "$3" == "detach" ]
then
commit ca377c4ef297f0d6ed21f2a93a2bcbee3f2c12ca
Author: Tobias Dammers
Date: Thu Jun 21 18:29:49 2018 +0200
Expose holding point data in nasal
diff --git a/src/Scripting/NasalPositioned.cxx b/src/Scripting/NasalPositioned.cxx
index 22953bb2b..0d5fda303 100644
--- a/src/Scripting/NasalPositioned.cxx
+++ b/src/Scripting/NasalPositioned.cxx
commit e26d8ff3b706951caa64af44a6e00e25485abd6e
Author: Tobias Dammers
Date: Sun Mar 18 20:10:23 2018 +0100
Fix: chat messages from MP list captured kbd forever
diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas
index b58e35cc9..00ddd13c7 100644
--- a/Nasal/multiplayer.nas
+++ b/Nasal/multiplayer.nas
commit c8c7fe024ee78a464a6b0cfd870439883371092c
Author: Tobias Dammers
Date: Sun Mar 18 20:10:23 2018 +0100
Fix: chat messages from MP list captured kbd forever
diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas
index b58e35cc9..3015f805a 100644
--- a/Nasal/multiplayer.nas
+++ b/Nasal/multiplayer.nas
@tdammers
tdammers / fizzbuzz.hs
Last active September 14, 2017 09:32
import Data.Monoid
import qualified Data.Set as Set
import Data.Set (Set)
import Control.Monad (forM_)
-- | A rule is expressed as a function from a number to a set of words to say
-- instead of the number. If the set is empty, the convention is to say the
-- number itself.
type Rule a b = a -> Set b
@tdammers
tdammers / oop-why-not.markdown
Last active April 8, 2017 20:37
OOP, Why Not?

This makes no sense to me. If the code design is bad there ought to be a concrete, unambiguous way to show this. If it's not possible to show this, how was there ever a problem in the first place?

It is possible to show in a concrete, unambiguous way, but unfortunately, the cases where the problems become clearly apparent tend to be large - way too large for a casual forum reply or a blog post.

I'll still take a stab at trying to explain what the problem is.

First, we have to define object-oriented programming, which isn't easy, because everyone seems to have their own ideas about the subject. They all do seem to agree that there should be a notion of objects, being things that have state (called "fields" or "properties") as well as associated behavior (called "methods"); further, objects form identities, that is, each object is identical to itself and only to itself, and has some sort of unique identifier (typically an ID, a memory address, or some sort of abstract handle or reference). Another fe

@tdammers
tdammers / def-varargs-class
Created July 1, 2015 13:13
def context -> different varargs seq impl
user=> (defn foo [& args] (println (class args)))
#'user/foo
user=> (foo 1 2 3)
clojure.lang.ArraySeq
nil
user=> (def bar (foo 1 2 3))
clojure.lang.PersistentVector$ChunkedSeq
#'user/bar
@tdammers
tdammers / def-strict
Created July 1, 2015 10:54
def thwarting laziness?
user=> (defn foo [& fns] (fn [] (->> fns (map #(%)) (filter (comp not nil?)) (first))))
#'user/foo
user=> ((foo (fn [] nil) (fn [] "OK") (fn [] (do (print "NONONO") "NO"))))
"OK"
user=> (def blah (foo (fn [] nil) (fn [] "OK") (fn [] (do (print "NONONO") "NO"))))
#'user/blah
user=> (blah)
NONONO"OK"