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
require_relative 'boot' | |
require 'rails/all' | |
# Require the gems listed in Gemfile, including any gems | |
# you've limited to :test, :development, or :production. | |
Bundler.require(*Rails.groups) | |
module Voluntari | |
class Application < Rails::Application |
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
newtype Identity a = | |
Identity { runIdentity :: a } | |
deriving (Eq, Show) | |
newtype Compose f g a = | |
Compose { getCompose :: f (g a) } | |
deriving (Eq, Show) | |
instance (Functor f, Functor g) => | |
Functor (Compose f g) where |
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
fromIndex :: Int -> [a] -> Maybe a | |
fromIndex 0 (x:xs) = | |
Just x | |
fromIndex index [] = | |
Nothing | |
fromIndex index (x:xs) = | |
fromIndex (index - 1) xs |
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
userLogin :: EitherIO LoginError Text | |
userLogin = do | |
token <- getToken | |
userpw <- maybe (liftEither (Left NoSuchUser)) | |
return (Map.lookup token users) | |
password <- liftIO ( | |
T.putStrLn "Enter your password:" >> | |
T.getLine | |
) |
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
approveOtp :: | |
Session -> | |
Session | |
approveOtp (Session session) = let approveOtpV = execState (do | |
modify_ ((\{ approved } -> | |
{ approved: "F" | |
})) | |
if Array.any (\(Event e) -> | |
String.toLower (fromMaybe "null" e.label) == "approve_otp") session.events | |
then modify_ ((\{ approved } -> |
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
:set -DDEVELOPMENT | |
:set -i./src:./test | |
:set -fobject-code | |
:set -O0 | |
:set +s | |
:set -freverse-errors | |
:set -Wall | |
:set -Wincomplete-uni-patterns | |
:set -Wincomplete-record-updates | |
:set -Widentities |
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
let | |
compiler = "ghc843"; | |
config = import ./pkgconfig.nix { inherit compiler; }; | |
pkgs = import (import ./nixpkgs.nix) { inherit config; }; | |
hpkgs = pkgs.haskell.packages.${compiler}; | |
pkg = hpkgs.callPackage (import ./riskbook.nix) {}; | |
in | |
{}: pkgs.lib.overrideDerivation pkg.env (old: { | |
buildInputs = old.buildInputs ++ [ |
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
-- | Running your app inside GHCi. | |
-- | |
-- To start up GHCi for usage with Yesod, first make sure you are in dev mode: | |
-- | |
-- > cabal configure -fdev | |
-- | |
-- Note that @yesod devel@ automatically sets the dev flag. | |
-- Now launch the repl: | |
-- | |
-- > cabal repl --ghc-options="-O0 -fobject-code" |
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
{ config, pkgs, lib, ... }: | |
let | |
knowledgeStorePort = 8080; | |
publicWikiPort = 9000; | |
in | |
{ | |
imports = [ | |
./hardware-configuration.nix | |
./networking.nix # generated at runtime by nixos-infect | |
./service.nix |
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
let | |
nixpkgs = builtins.fetchTarball { | |
name = "nixos-20.03"; | |
url = "https://github.com/nixos/nixpkgs/archive/a84b797b28eb104db758b5cb2b61ba8face6744b.tar.gz"; | |
sha256 = "0f3s0m3bdd857s7zrgghl6vmj3hjqfaqcnd7sg33fzwakagwy0fp"; | |
}; | |
nixos = import "${nixpkgs}/nixos" { | |
configuration = { | |
imports = [ | |
./configuration.nix |
OlderNewer