This file contains 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
module Main where | |
import Control.Monad (replicateM) | |
import Control.Monad.Trans (lift) | |
import Control.Monad.Reader (ReaderT, ask, runReaderT) | |
import Control.Monad.Random (Rand, getRandomR, evalRand) | |
import System.Random (getStdGen, StdGen) | |
import Text.Printf | |
op :: ReaderT Int (Rand StdGen) String |
This file contains 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
#include <iostream> | |
#include <functional> | |
// Polymorphic Maybe type. | |
template <typename T> | |
class Maybe | |
{ | |
public: | |
// Returns True if Maybe contains a value. | |
virtual bool isJust() = 0; |
This file contains 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
{- | |
Minimum distance for ray intersection to be considered important. | |
This is due to limited numerical precision with floating point numbers. A ray could be reflected and then be immediately registered as intersecting with the object it just bounced off. | |
-} | |
epsilon :: Scalar | |
epsilon = 0.1 | |
{-| | |
Defines a mathematical sphere. | |
-} |
This file contains 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
-- | Instantiates the WebCore singleton with a set of configuration parameters. | |
initialize :: Config -> IO () | |
initialize conf | |
| conf == defaultConfig = awe_webcore_initialize_default | |
| otherwise = go conf | |
where | |
go :: Config -> IO () | |
go = do | |
-- Operating in the (->) monad. | |
a <- fmap fromBool pluginsEnabled |
This file contains 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 #-} | |
module BlazeHelpers where | |
import Text.Blaze ((!)) | |
import Text.Blaze.Html5 | |
import qualified Text.Blaze.Html5 as H | |
import Text.Blaze.Html5.Attributes | |
import qualified Text.Blaze.Html5.Attributes as A | |
import Text.Blaze.Renderer.Pretty |
This file contains 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 | |
# Clone the repo | |
git clone https://github.com/tcsavage/pangolin.git . | |
# Ensure we're on uopcomputing | |
git checkout uopcomputing | |
# Setup config | |
cp config.sample.php config.php |
This file contains 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
<?php | |
header("Content-type: text/plain"); | |
foreach (apache_request_headers() as $k => $v) | |
{ | |
echo("$k: $v\n"); | |
} | |
?> |
This file contains 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
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
private void Form1_Load(object sender, EventArgs e) | |
{ | |
comboBox1.DataSource = Enum.GetValues(typeof(MyEnum)); |
This file contains 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
string outputString = ""; | |
foreach (var e in enumList) | |
{ | |
outputString += e.ToString() + ", "; | |
} |
This file contains 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/runhaskell | |
module Main where | |
-- As with many programming languages, the main function is the entry point for execution. | |
main :: IO () | |
main = do -- "do notation" is a way of sequencing functions in haskell to simulate imperitive programming. | |
inp <- getContents -- Here we bind the resulting thunk from getContents to the name 'inp'. | |
putStrLn $ reverse inp -- Here we reverse the evaluated value of 'inp' and send it to stdout. |