Skip to content

Instantly share code, notes, and snippets.

@Qqwy
Qqwy / doctest-minitest.rb
Created March 9, 2022 23:38
Example of how to integrate doctests with Ruby Minitest
# Example of how to integrate doctests with Ruby Minitest
#
# Besides depending on `minitest`,
# this functionality depends on the `doctest-core` gem, c.f. https://www.rubydoc.info/gems/doctest-core/
class YourAppName::TestCase < MiniTest::Test
# To be used inside the body of a tests-class
# It will automatically create test cases for all
# 'documentation test' snippets that exist in the comments
@Janiczek
Janiczek / Main.elm
Last active September 11, 2023 00:27
Free Monad + Interpreter in Elm
module Main exposing (..)
{-| Free monad + interpreter in Elm
-}
import Dict exposing (Dict)
{-| Dict String Int-like structure
@Qqwy
Qqwy / benchmarks.exs
Last active July 21, 2024 08:39
Elixir benchmark of different implementations of the 'subarray sum' problem
Mix.install([
:benchee,
{:okasaki, "~> 1.0"}, # <- used by Qqwy's Okasaki solution
:nx, # <- used by Qqwy's Nx solution
{:exla, "~> 0.5"}, # <- used by Qqwy's Nx solution
],
config: [nx: [default_backend: EXLA.Backend]] # <- used by Qqwy's Nx solution
)
inputs = %{
@niku
niku / .README.md
Last active February 17, 2024 20:48
a sample repository of prop_check with test-unit

This repository is working sample of prop_check with test-unit.

$ ruby run_test.rb
Loaded suite 6dec8e397943cdc372b969fff26299e7
Started
E
================================================================================================================================================
Error: test_that_it_returns_an_integer_for_any_input(TestNaiveAverage):
 ZeroDivisionError:
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- | N-argument currying and uncurrying for functions.
module Curry(Callable(..), IsTuple(..), Params, Output, Single(..)) where
import Data.Aeson qualified as Aeson
import Data.Vector qualified as Vector
import Control.DeepSeq (NFData)