Skip to content

Instantly share code, notes, and snippets.

View kubaracek's full-sized avatar
🇨🇿

Jakub Ráček kubaracek

🇨🇿
  • Pleo.io
  • Innsbruck, Austria
View GitHub Profile
checkCoord :: Board -> Coord -> Bool
checkCoord board (x,y) =
all (==True) [
validateVector $ getRow x board
, validateVector $ getCol y board
]
module Sudoku where
import Data.List (length, nub)
import Data.Matrix (Matrix, fromLists, safeSet, getRow, getCol)
import Data.Vector (Vector, filter, uniq)
type Board = Matrix (Maybe Int)
type Coord = (Int, Int)
validateVector :: Vector (Maybe Int) -> Bool
useWord :: Game.Word -> AvailableChars -> Maybe AvailableChars
useWord [] [] = Just []
useWord (a) [] = Nothing
useWord [] (a) = Just a
useWord (x:xs) (y)
| elem x y = useWord xs $ deleteFirst x y
| otherwise = Nothing
-- |
module Game where
import Data.List (isInfixOf, sort, nub, any)
newtype Available = Available String deriving (Show, Eq)
type Word = [Char]
data WordError = NothingAvailable | CharNotAvailable Char deriving (Show)
deleteFirst _ [] = []
validWords (Round (Player "Kuba") (Available "abcd") [(Guess "a"), (Guess "abb"), (Guess "ab"), (Guess "d")] [YellowCard])
-- ["a","ab","d"]
validWords (Round (Player "Kuba") (Available "abcd") [(Guess "a"), (Guess "abb"), (Guess "ab"), (Guess "d")] [YellowCard, YellowCard])
-- ["a","ab"]
validWords (Round (Player "Kuba") (Available "abcd") [(Guess "a"), (Guess "abb"), (Guess "ab"), (Guess "d")] [RedCard])
-- ["a","ab"]

Keybase proof

I hereby claim:

  • I am kubaracek on github.
  • I am kubaracek (https://keybase.io/kubaracek) on keybase.
  • I have a public key whose fingerprint is 9E62 6ABB A0B7 87E1 3385 DF6D 2BCC 6FC9 E9EA 8CB8

To claim this, I am signing this object:

irb(main):141:0> data
=> [{:id=>"197466", :category=>"section", :schema_id=>"invoice_info_section", :children=>[{:id=>"197467", :category=>"datapoint", :schema_id=>"invoice_number", :page=>1, :position=>[916, 168, 1190, 222], :value=>"FV103828806S", :validation_sources=>["score"], :type=>"string"}, {:id=>"197468", :category=>"datapoint", :schema_id=>"date_due", :page=>1, :position=>[938, 618, 1000, 654], :value=>"12/22/2018", :validation_sources=>["score"], :type=>"date"}, {:id=>"197469", :category=>"datapoint", :schema_id=>"amount_due", :page=>1, :position=>[1134, 1050, 1190, 1080], :value=>"55.20", :validation_sources=>["human"], :type=>"number"}]}, {:id=>"197500", :category=>"section", :schema_id=>"line_items_section", :children=>[{:id=>"197501", :category=>"multivalue", :schema_id=>"line_items", :children=>[{:id=>"198139", :category=>"tuple", :schema_id=>"line_item", :children=>[{:id=>"198140", :category=>"datapoint", :schema_id=>"item_desc", :page=>1, :position=>[173, 883, 395, 904], :value=>"Red Rose",

Keybase proof

I hereby claim:

  • I am kubaracek on github.
  • I am kubaracek (https://keybase.io/kubaracek) on keybase.
  • I have a public key whose fingerprint is 8BE5 91DA 145D 62DE D043 B0B8 DCFA DC3C 1622 2144

To claim this, I am signing this object:

authorizedCallback :: MonadIO m => Maybe TL.Text -> Maybe TL.Text -> AppT m (Authorized)
authorizedCallback mc ms = do
case (mc, ms) of
(Just code, Just state) -> do
cache <- asks configCache
let eitherIdpApp = parseIDP (TL.takeWhile (/= '.') state)
case eitherIdpApp of
Right (IDPApp idp) -> fetchTokenAndUser cache code idp
Left _ -> throwError err400
resource "helm_release" "smaply" {
name = "smaply-${var.name_suffix}"
chart = "${path.module}/files/charts/smaply"
namespace = var.namespace
timeout = 600
wait = true
set {
name = "smaply.host"
value = var.host