Skip to content

Instantly share code, notes, and snippets.

View qxjit's full-sized avatar

David Vollbracht qxjit

  • Flipstone Technology Partners, Inc
View GitHub Profile
@qxjit
qxjit / stack-output.text
Created December 15, 2022 17:08
Verbose output of `stack repl` not respecting `default-language`
Version 2.9.1, Git revision 409d56031b4240221d656db09b2ba476fe6bb5b1 x86_64 hpack-0.35.0
2022-12-15 11:06:14.483184: [debug] Checking for project config at: /home/qxjit/work/heb/stack-bug-test/stack.yaml
2022-12-15 11:06:14.483328: [debug] Loading project config file stack.yaml
2022-12-15 11:06:14.486134: [debug] (SQL) SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2022-12-14 17:06:14.486109085 UTC]
2022-12-15 11:06:14.486406: [debug] Using package location completions from a lock file
2022-12-15 11:06:14.487679: [debug] Loaded snapshot from Pantry database.
2022-12-15 11:06:14.644524: [debug] Running hpack on /home/qxjit/work/heb/stack-bug-test/package.yaml
2022-12-15 11:06:14.646648: [debug] hpack output unchanged in /home/qxjit/work/heb/stack-bug-test/stack-bug-test.cabal
2022-12-15 11:06:14.646781: [debug] Prefetching git repos: []
2022-12-15 11:06:14.646803: [debug] []
@qxjit
qxjit / StockLiquorT.hs
Created April 15, 2020 21:19
StockLique Monad Transformer
{-
Goal:
- Recover from OverpricedDrinkErrors and continue charging for drinks
- Simulate a NetworkError
- Use finally to ensure the CreditCardAPIConnection is closed in the event
of an error
-}
module StockLiquorT where
@qxjit
qxjit / StockLiquor.hs
Created April 1, 2020 21:23
StockLiquore State monad
{-
Goal: Turn this bar into a liquor stock market
## Add Feature
- Get prices from the a market
- define the market
- pass it through everywhere
- Adjust the market based on orders
@qxjit
qxjit / RelationalMapExample.hs
Created September 19, 2018 18:43
A simple example of mapping a Haskell field to multiple columns in Orville
module RelationalMapExample where
import qualified Data.Int as Int
import qualified Data.Text as Text
import qualified Database.Orville as O
data Update key = Update
{ updateId :: key
, updateLocation :: Text.Text
@qxjit
qxjit / keybase.md
Created June 4, 2018 17:07
keybase.md

Keybase proof

I hereby claim:

  • I am qxjit on github.
  • I am qxjit (https://keybase.io/qxjit) on keybase.
  • I have a public key ASCALGoHUAO-MjrvhbXp6a4UHaKnvz1x62r6Z70FYIh6RAo

To claim this, I am signing this object:

@qxjit
qxjit / romeo.idr
Created May 2, 2014 17:32
Romeo & Juliet made safe
data Health = JustFine | LooksDead | IsDead
record Character : Type where
MkCharacter : (name:String) ->
(health:Health) ->
Character
instance Show Health where
show IsDead = "is dead"
show LooksDead = "looks dead"
class Array
alias_method :>>, :delete
end
a = []
a << 1
a << 2
a << 3
@qxjit
qxjit / foo.rb
Created March 6, 2012 16:22 — forked from jbrechtel/foo.rb
foo
def foo(nums)
h = Hash.new([])
nums.each { |n| h[n] << n }
puts h.inspect
puts h['foo']
end
#YETANOTHERREASONMUTABLESTATEISTERRIBLE
@qxjit
qxjit / class_variable_hijack.rb
Created February 7, 2012 18:19
Please tell me this is a bug
# ruby -v
# ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.8.0]
#
# note that you shouldn't use class variables anyhow...
class Foo
@@in_foo = 2
def self.in_foo; @@in_foo; end
end
@qxjit
qxjit / Boca Golf 2011-01-19
Created January 20, 2011 01:43
qxjit's Golfed solution for sanitize
def sanitize(w,s)s.tr('/*-._\\','').sub(/#{w}/i,'*'*w.size)end