This file contains hidden or 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 ((gmod-have-package (featurep 'package))) | |
(defun gmod-install-package-el () | |
(let (buf (url-retrieve-synchronously | |
"http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/emacs-lisp/package.el")) | |
(save-excursion | |
(set-buffer buf) | |
(goto-char (point-min)) | |
(re-search-forward "^$" nil 'move) | |
(eval-region (point) (point-max)) | |
(kill-buffer (current-buffer))))) |
This file contains hidden or 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
(defun clm*flymake-colors () | |
(custom-set-faces | |
'(flymake-errline ((((class color)) (:underline "Red")))) | |
'(flymake-warnline ((((class color)) (:underline "Orange")))))) | |
(load (expand-file-name "~/emacs/haskell-mode/haskell-site-file.el")) | |
(require 'inf-haskell) | |
(load (expand-file-name "~/clones/ghc-mod/elisp/ghc")) | |
(add-hook 'haskell-mode-hook (lambda nil | |
(clm*flymake-colors) |
This file contains hidden or 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
(ql:quickload 'hunchentoot) | |
(ql:quickload 'cl-who) | |
(ql:quickload 'routes) | |
(ql:quickload 'css-lite) | |
(defpackage :rss-view | |
(:use :cl :hunchentoot :cl-who :css-lite) | |
(:export :rss-start :rss-stop)) | |
(in-package :rss-view) |
This file contains hidden or 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
class TimelineController < ApplicationController | |
def index | |
@messages = Message.order("status_id DESC") | |
@newest_id = newest_id | |
end | |
# Just do a simple update to the timeline for the latest | |
# greatest messages. | |
# | |
# 1. Pull 100 messages |
This file contains hidden or 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
module BST where | |
import Data.Time | |
import Control.Concurrent.STM | |
data Account = Account { aemail :: String | |
, apass :: String | |
, auid :: String } | |
deriving (Show) | |
This file contains hidden or 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
I have two interviews coming up with the real-deal companies where 'real-deal' | |
means that I'm fairly confident that I have to have my shit together to make | |
an impression on them and thus get offered a job. This is my boning-up | |
scratchpad. | |
Note that this is a brain-dump and not a carefully edited how-to, tutorial, or | |
otherwise. | |
> module Merge where |
This file contains hidden or 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
module Solution where | |
import List | |
solution :: String -> IO () | |
solution a = | |
case reduce a of | |
[] -> putStrLn "No repeating characters!" | |
(x:_) -> putStrLn $ "Solution: " ++ x |
This file contains hidden or 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
data LoginF = LoginF String String | |
login :: Application () | |
login = do | |
fx <- eitherSnapForm login_form "login-form" | |
case fx of | |
Left s -> heistLocal (bindSplices s) $ render "login" | |
Right (LoginF email passw) -> do | |
us <- account_by_email $ B.pack email | |
maybe e404 ((huser $ B.pack passw) . snd) us | |
where |
This file contains hidden or 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
roundp :: (RealFrac a1, Integral a, Floating a1) => a1 -> a -> a1 | |
roundp n s = fromIntegral (round (n * factor)) / factor | |
where | |
shift = s - (floor (logBase 10 n) + 1) | |
factor = 10 ** fromIntegral shift |
This file contains hidden or 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
migrate = runQ $ runMigration migrateAll | |
runQ :: MonadControlIO m => SqlPersist m a -> m a | |
runQ a = | |
withPostgresqlConn "host=localhost password=fart user=postgres dbname=fart" $ | |
runSqlConn $ do a | |
share [mkPersist, mkMigrate "migrateAll"] [persist| |