Skip to content

Instantly share code, notes, and snippets.

View dzackgarza's full-sized avatar
🎯
Focusing

D. Zack Garza dzackgarza

🎯
Focusing
View GitHub Profile
class CustomClass a where
add :: a -> a -> a
mul :: a -> a -> a
newtype ZModZ7 = ZModZ7 Integer deriving (Eq, Show)
instance CustomClass ZModZ7 where
add a b = mod (a + b) 7 -- Here, 'a' matches an entire (ZModZ7 i), and mod won't function on the custom type.
mul a b = mod (a * b) 7 -- Based on discussion with monochrom@Freenode, equivalent to
-- = mod ( (ZModZ7 a') * (ZModZ7 b') )
@dzackgarza
dzackgarza / hackage & cabal repl
Last active August 29, 2015 14:21
Cabal repl recompiles after install
--------------- First Terminal ------------------------------
╰─$ cabal install -j --enable-tests
Resolving dependencies...
Configuring hackage-server-0.5.0...
Building hackage-server-0.5.0...
Preprocessing executable 'hackage-server' for hackage-server-0.5.0...
line-map.c: file "<command-line>" left but not entered
line-map.c: file "<command-line>" left but not entered
[123 of 123] Compiling Main ( Main.hs, dist/dist-sandbox-56da88b/build/hackage-server/h
ackage-server-tmp/Main.o )
@dzackgarza
dzackgarza / hackage-docker-cabal_repl
Last active August 29, 2015 14:21
Hackage and cabal repl in docker container
---------------- Terminal 1 ----------------------------
╰─$ sudo docker -d
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
INFO[0000] [graphdriver] using prior storage driver "devicemapper"
INFO[0000] Loading containers: start.
................
INFO[0001] Loading containers: done.
INFO[0001] Daemon has completed initialization
INFO[0001] Docker daemon commit=628c396 execdriver=native-0.2 graphdriver=devicemapper version=1.7.0-dev
INFO[0016] POST /v1.19/containers/create
@dzackgarza
dzackgarza / votes.hs
Last active August 29, 2015 14:22
IO/Monad Issues
------------------------------------------------
Version that works:
------------------------------------------------
-- | Resources passed to featureResources in constructor
getVoteResource = (resourceAt "/packages/vote") {
resourceDesc = [(GET, "Get the number of votes a package has.")],
resourceGet = [("json", returnOne)]
}
-- | Trivial json response
@dzackgarza
dzackgarza / docase.hs
Created June 18, 2015 11:08
Trying to move a do block within a case assignment
someMaybe :: UserID
someVariable :: Html
simpleRenderFunction :: (Int -> String) -> Html
-- For example, string is a user name: is this a known user?
testCondition :: MonadIO m => String -> m Bool
-- Takes into account the result from the testCondition function.
complicatedRenderFunction :: (Int -> String -> Bool) -> Html
complicatedRenderFunction a s b = case b of ....
@dzackgarza
dzackgarza / Latex Workshop.md
Last active June 6, 2018 05:20
Latex Workshop

Intro

  • Typesetting language
  • Tex is greek 'chi', pronounced "ch" as in "Loch Ness"
  • Not exactly WYSIWYG
  • Handles position, text wrapping, flowing images around text. You describe the structure, it handles the layout
  • Advantages:
    • Easy way to type math
    • Professional templates and layouts (journals, theses)
    • Allows for complex structure - footnotes, references, TOC, bibliographies
@dzackgarza
dzackgarza / 1-13-2017-minutes.md
Last active January 16, 2017 01:02
SUMS Unofficial Meeting Minutes (1/13/2017)

Meeting Agenda:

  1. Get club business moving
  2. Discuss future events, get feedback from attendees

Item 1: Club Business

  • The club's current status: some efforts were made in October/November 2016 to push things forward, but no further information was available.
  • Reasons to have an "official" student organization:
    • Math club vaccuum
  • Since SUMS ended last year, there is no "official" math student organization
@dzackgarza
dzackgarza / README.md
Last active January 25, 2017 00:21 — forked from eesur/README.md
d3 | Force layout with images (Fixed)
@dzackgarza
dzackgarza / README.md
Created January 26, 2017 23:45 — forked from brattonc/README.md
D3 Liquid Fill Gauge

Liquid Fill Gauge v1.1 - 7/14/2015

Changes:

  • Added support for updating the gauge value after loading is complete. The loadLiquidFillGauge method now returns an object with an update method which allows the gauge value to be changed. Click any of the gauges above to randomly update their value.

Configurable features include:

  • Changeable min/max values.
  • All colors.
@dzackgarza
dzackgarza / gist:97041a177837082c1ca717e54ff3dc7b
Last active April 9, 2017 08:12
Possible Topics for Next Latex Workshop