Skip to content

Instantly share code, notes, and snippets.

ToJans / directus_extensions_endpoints_filestorage_index.js
Last active Oct 21, 2021
Quick hack: Redirect to asset by URL - Endpoint extension for
View directus_extensions_endpoints_filestorage_index.js
// Quick hack: Redirect to asset by URL - Endpoint extension for
// =========================================================================
// 2021 - ToJans - Public Domain
// *** Don't hold me liable if it breaks anything! Quick hack, might expose all your data!
// You can use this endpoint extension to access assets via the folder and file structure
// you used in the file module, so you don't need to reference assets by guid anymore.
View Chess.cs
using System;
using System.Collections.Generic;
using System.Linq;
Chess: potential moves etc by @ToJans
Spiked in a couple of hours of late-night code for a tweet by @gregyoung
ToJans / fpexplained.cs
Last active Jul 25, 2020
This is a C# implementation showing what functors, applicatives and monads look like.
View fpexplained.cs
using System;
namespace FPExplained
// This is a C# implementation showing what functors, applicatives and monads look like.
// ----><8-----------------------------------
// ***********************************
// For a maybe monad, all these constructs look a bit redundant; their reason of existance is more obvious
ToJans / AggregateRootStore.cs
Created Sep 1, 2010
combining CQRS, Event sourcing and BDD
View AggregateRootStore.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace SimpleCQRS2.Framework.Services
public class AggregateRootStore : IAggregateRootStore
public IAggregateRoot GetAggregateRoot(Type aggregateRootType, Guid aggregateRootId)
ToJans / hangman.hs
Last active Sep 28, 2019
A haskell implementation of the hangman game
View hangman.hs
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
ToJans / histogram.exs
Last active May 8, 2019
To run, > elixir histogram.exs
View histogram.exs
defmodule Lab05 do
@doc """
My take on [the histogram exercise]
mentioned in [this newsgroup post]
def main(), do: parse_pars(System.argv, nil)
defp parse_pars([],nil), do: histogram()
ToJans / anagram.cs
Last active Apr 30, 2018
Anagram in golang vs anagram in elixir-lang ; am I missing something obvious here?
View anagram.cs
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)
ToJans / InventoryItems.hs
Last active Mar 26, 2018
Haskell implementation of Greg Young's CQRS sample: Love the sheer elegance of Haskell; no need for all that infrastructure crap
View InventoryItems.hs
module InventoryItems(Command(..), Event(..), handle) where
import Data.Maybe(isJust)
type Id = String
type Name = String
type Amount = Int
data Command = CreateInventoryItem Id
| RenameInventoryItem Id Name

The story behind Virtual Sales Lab

The initial seed of the idea

The initial spark for Virtual Sales Lab was conceived during a late-night dinner with one of my business mentors.

Margareta's The exquisit but now defunct restaurant Margaretha's in Oudenaarde/Belgium was where it all happened