The initial spark for Virtual Sales Lab was conceived during a late-night dinner with one of my business mentors.
The exquisit but now defunct restaurant Margaretha's in Oudenaarde/Belgium was where it all happened
import Control.Monad (when) | |
import Data.Char (toLower) | |
import Data.List (transpose) | |
import System.Random (randomIO) | |
wordsPath :: FilePath | |
wordsPath = "words.txt"-- "/usr/share/dict/words" | |
data GameState = GameState | |
{ _wordToGuess :: String |
defmodule Lab05 do | |
@doc """ | |
My take on [the histogram exercise] | |
(http://computing.southern.edu/halterman/Courses/Fall2013/124/Labs/lab05_F13.html) | |
mentioned in [this newsgroup post] | |
(https://groups.google.com/d/msg/elixir-lang-talk/TTSjV0iy9yA/hpiGDZOk6DkJ) | |
""" | |
def main(), do: parse_pars(System.argv, nil) | |
defp parse_pars([],nil), do: histogram() |
using System.IO; | |
using System; | |
using System.Linq; | |
public class Anagram | |
{ | |
// I am aware about, but have no intention on using | |
// `string.Equals(a, b, StringComparison.OrdinalIgnoreCase)` | |
// as that is longer | |
public static string[] Detect(string subject, string[] Candidates) |
The initial spark for Virtual Sales Lab was conceived during a late-night dinner with one of my business mentors.
The exquisit but now defunct restaurant Margaretha's in Oudenaarde/Belgium was where it all happened
class MyConverter : Newtonsoft.Json.Converters.CustomCreationConverter<IDictionary<string, object>> | |
{ | |
public override IDictionary<string, object> Create(Type objectType) | |
{ | |
return new Dictionary<string, object>(); | |
} | |
public override bool CanConvert(Type objectType) | |
{ | |
// in addition to handling IDictionary<string, object> |
module Tests | |
open canopy | |
open Utils | |
open System | |
let veranda (rootPath) = (rootPath + ": Veranda") &&& fun () -> | |
let clickNext expected fn = | |
click ".verandawizard.selected input[type=submit]" |
// In C# we can't enforce generic classes in interfaces, so we can't use interfaces to define the contract. | |
// I can only give examples of the minimal code it needs to implement. | |
class FunctorImpl<T> { | |
FunctorImpl<T> Pure(T val); | |
FunctorImpl<S> Apply<S>(Func<T, S> fn); | |
// Requirement: Pure(val).Apply(x=>x) == Pure(val) | |
} | |
class ApplicativeImpl<T> where { |
When a user registers with a unique username | |
Then that registration should be approved | |
Given a user registration with a certain username was approved | |
When a new user registers with the same username | |
Then that registration should be rejected |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Web.Scotty | |
import Network.Wai.Middleware.RequestLogger(logStdoutDev) | |
import Data.Aeson ( (.:),(.:?),decode,FromJSON(..),Value(..)) | |
import Data.Text.Lazy (pack) | |
import Control.Applicative ((<$>), (<*>)) | |
import qualified Data.ByteString.Lazy.Char8 as BS |