- Praktiskt:
- Gist
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
#!/bin/bash | |
# This script will install the latest version of Dist | |
# See also https://github.com/hanshoglund/dist | |
VERSION=1.3.1 | |
wget "https://github.com/downloads/hanshoglund/dist/dist-unix-${VERSION}.tar.gz" | |
tar -xvzf "dist-unix-${VERSION}.tar.gz" |
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
# - Dynamic let-bindings | |
# Mainly useful for temporary updating global variables | |
# | |
# Examples: | |
# | |
# set ( X "foo" ) | |
# message ( ${X} ) # X has value 'foo' | |
# let ( X "bar" ) | |
# message ( ${X} ) # X has value 'bar' | |
# let ( X "baz" ) |
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 runhaskell | |
-- Converts inline Lisp documentation to Markdown | |
-- Requires the Haskell platform + pandoc and pandoc-types from hackage.org | |
-- Copyright (c) Hans Hoglund 2012 | |
import Control.Monad | |
import Data.Monoid | |
import System.Environment (getArgs) |
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 qualified Data.List | |
import qualified Data.Monoid | |
-- | Divide a list into parts of maximum length n. | |
divideList :: Int -> [a] -> [[a]] | |
divideList n xs | |
| length xs <= n = [xs] | |
| otherwise = [take n xs] ++ (divideList n $ drop n xs) | |
-- | Break up a list into parts of maximum length n, inserting the given list as separator. |
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
#!/bin/bash | |
# Drop in replacement for Dotty on OS X | |
# Renders a diagram as a PDF using 'dot' and opens the resultant file | |
DIR=/tmp/dotviewer | |
FILE=$DIR/$$.pdf | |
rm -r $DIR | |
mkdir -p $DIR |
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
/* | |
* @nolint | |
* Test implementation of Time notator | |
* | |
* This code generates a collection of possible notations for a given duration, | |
* according to notations options defined in the environment. | |
* | |
* A notation is a simple structure consisting of a list of durations or nested | |
* notations of a relative length, determined by the multiplier property. | |
* |
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
// Interpolera slumpmässiga värden mellan 0 och 200 | |
// Börja från mitten | |
final int SIZE = 230; | |
final int BALL_SIZE = 30; | |
Generator x = new RandomInterpolation(SIZE/2, 0, SIZE - BALL_SIZE, new Line(50)); | |
Generator y = new RandomInterpolation(SIZE/2, 0, SIZE - BALL_SIZE, new Line(10)); |
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
with :: b -> a -> b | |
with x _ = x | |
fix :: a -> (a -> b) -> a | |
fix x _ = x | |
fix1 :: (a -> b) -> (a -> a) -> a -> b | |
fix1 x _ = x | |
int :: Int -> Int | |
int = id |
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
x.slice() ==> x0,x1 ... xn | |
x.slice(a,b) ==> x0,x1 ... xn | |
OlderNewer