%%javascript
require(
["https://cdn.rawgit.com/bollwyvl/10440652/raw/70b237937b40481a07a7766d5d5a2076bb0cbaab/nbjscmp.js"],
function(nbjscmp){ nbjscmp.load_ipython_extension(); }
);
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
{-# LANGUAGE BangPatterns #-} | |
module LLRBTree where | |
import Data.List (foldl', nub, (\\)) | |
import qualified Data.List as L | |
import Data.Maybe | |
import System.Cmd | |
import Prelude hiding (minimum) | |
import Debug.Trace | |
import Test.QuickCheck |
I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.
Imagine a long-running development branch periodically merges from master. The
git log --graph --all --topo-order
is not as simple as it could be, as of git version 1.7.10.4.
It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.
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
{-# LANGUAGE OverloadedStrings #-} | |
import Data.Conduit | |
import Data.Conduit.List (peek) | |
import Data.Conduit.Network | |
import qualified Data.ByteString.Char8 as S8 | |
import Data.Char (toLower, isSpace) | |
import Network (withSocketsDo) | |
import Control.Monad.IO.Class | |
import Control.Concurrent (forkIO) | |
import Network.Wai |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
<style type="text/css"> | |
svg { | |
background: #333; | |
} |
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
{-# LANGUAGE ExistentialQuantification #-} | |
module Main where | |
import Debug.Trace(traceShow) | |
import System.Environment | |
import Text.ParserCombinators.Parsec hiding (spaces) | |
import Control.Applicative ((<$>)) | |
import Control.Monad.Error | |
import Data.IORef | |
import IO hiding (try) |
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
{-- | |
This file is a slight extension of Sigfpe's "Quick and dirty reinversion of control": | |
http://blog.sigfpe.com/2011/10/quick-and-dirty-reinversion-of-control.html | |
I only added input capabilities: yieldInput + modification to yield | |
and of course the lines in imperative (i.e. our re-captured "main loop") which have to do with getting input. | |
--} |
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
getD n = getD' n 2 where | |
getD' n factor | n == factor = factor | |
| n `mod` factor == 0 = getD' (n `div` factor) factor | |
| otherwise = getD' n (succ factor) |