Skip to content

Instantly share code, notes, and snippets.

Simon Michael simonmichael

Block or report user

Report or block simonmichael

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:6c5b11ed12695f40809f
~/src/hledger$ git l -1000 hledger-0.23.3..master
2014-09-07 2227997 revert an unnecessary "fix" in efe7c7a that broke tests (HEAD, origin/master, origin/HEAD, master)
2014-09-07 a65116a fix func. test numbering
2014-09-12 42a22be tools: fix tagrelease
2014-09-12 5d403c2 doc: changelogs (resolve conflicts)
2014-09-12 53aee0e resolve conflict
2014-09-12 d7f1733 remove text upper bound, allowing 1.2+ (fixes #207)
2014-09-06 efe7c7a journal: dates should be followed by whitespace or newline
2014-08-14 2992ce0 web: add form ignores trailing blank fields
2014-08-14 8d1ceb0 web: increase initial add form postings to four
@simonmichael
simonmichael / iXpenseIt.csv.rules
Last active Dec 24, 2015 — forked from anonymous/gist:6859060
hledger CSV conversion rules for iXpenseIt phone app
View iXpenseIt.csv.rules
skip 1
fields Date,Type,Category,Subcategory,Vendor,Payment,Currency,Amount,Note
description %vendor
account1 assets:%payment
account2 expenses:%type:%category:%subcategory
comment %note
@simonmichael
simonmichael / gist:6525372
Last active Dec 22, 2015 — forked from anonymous/gist:6525360
darcs diff shows correct change, darcs whatsnew does not
View gist:6525372
$ darcs diff lib/smarty.inc
diff -rN -u lib/smarty.inc lib/smarty.inc
--- lib/smarty.inc 2013-09-11 08:36:05.000000000 -0700
+++ lib/smarty.inc 2013-09-11 08:36:05.000000000 -0700
@@ -26,6 +27,7 @@
}
}
+global $__template_register_outputfilter;
$__template_register_outputfilter = array();
View hledger-income-statements.mk
YEAR:=$(shell date +%Y)
MONTH:=$(shell date +%m)
MONTHS:=$(shell ghc -e "(putStr . unwords . map show) [1..$(MONTH)]")
# quick income statement for specified (single-word) period
INCOMESTATEMENTACCTS=^income ^expenses ^draw
INCOMESTATEMENTOPTS=--cost --effective --depth 1 #--flat --drop 1
income-statement-%:
@printf "\nincome statement for $*:\n"
$(HLEDGER) balance $(INCOMESTATEMENTACCTS) --period '$*' $(INCOMESTATEMENTOPTS)
@simonmichael
simonmichael / gist:5005481
Last active Dec 14, 2015 — forked from anonymous/gist:5005479
http-conduit issues
View gist:5005481
-- | Fetch the contents of a uri, which must be an ascii string.
-- Redirects, authentication, https: and file: uris are supported.
readUri :: Manager -> String -> Opts -> IO String
readUri manager s opts =
case parseURI' s of
Just URI{uriScheme="file:",uriPath=f} -> readFeedFile f
Just _ -> do
r <- parseUrl s
let cachecontrol = cache_control opts
r' | null cachecontrol = r
@simonmichael
simonmichael / gist:4354506
Last active Dec 10, 2015 — forked from anonymous/gist:4354489
hledger --width design notes
View gist:4354506

The --width/-w options adjusts the width of the output. By default, register's output is 80 characters wide. To allow more space for long descriptions and account names, use -w to increase the width to 120 characters, or -wN to set any desired width (at least 45 recommended). The date and amount fields have fixed width, and the remainder is split between description and account.

With multiple comma-separated values, -w sets the respective field widths:

-w 10,20,30,10,10

A total width or field width of auto means be as wide as necessary to avoid clipping data. If a current terminal width can be detected, the total width will be limited to this. Eg:

View gist:779023
-- | Apply a function the specified number of times.
applyN :: Int -> (a -> a) -> a -> a
applyN n f = (!! n) . iterate f
View gist:658846
-- frame-based animation, SDL
mainloop1 :: Game -> IO ()
mainloop1 game@Game{fpsmgr=fpsmgr,time=t0} = do
t1 <- SDL.getTicks
game' <- handleEvents game
let game'' = step game'
t2 <- SDL.getTicks
sdlRender game''
t3 <- SDL.getTicks
Framerate.delay $ fpsmgr
View gist:658811
-- test for hsSDL unknown symbol issue on mac OSX leopard
--
-- with macports sdl libs and hackage SDL libs installed,
-- this script compiles and runs via ghc --make, but via
-- runhaskell gives an error like:
-- /Users/simon/.cabal/lib/SDL-0.6.2/ghc-6.12.3/HSSDL-0.6.2.o: unknown symbol `_SDL_FreeSurface'
import Graphics.UI.SDL (getTicks)
main = do
You can’t perform that action at this time.