Skip to content

Instantly share code, notes, and snippets.

@bollwyvl
bollwyvl / README.md
Last active September 9, 2017 18:43
IPython Notebook Javascript Editor Enhancements

Jupyter Notebook JS Authoring mode

Try it now!

%%javascript
require(
  ["https://cdn.rawgit.com/bollwyvl/10440652/raw/70b237937b40481a07a7766d5d5a2076bb0cbaab/nbjscmp.js"],
  function(nbjscmp){ nbjscmp.load_ipython_extension(); }
);
@qzchenwl
qzchenwl / LLRBTree.hs
Last active December 11, 2015 05:39
Implemention of Left Leaning Red Black Tree, see http://www.cs.princeton.edu/~rs/talks/LLRB/RedBlack.pdf
{-# 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
@datagrok
datagrok / git-branch-simplify.md
Last active April 16, 2024 17:26
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

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.

@snoyberg
snoyberg / reverse-proxy.hs
Created August 5, 2012 15:50
A minimalist reverse HTTP proxy using conduit
{-# 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
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@tsyber1an
tsyber1an / index.html
Created April 2, 2012 07:42
Slider example implementation in SVG
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<style type="text/css">
svg {
background: #333;
}
@qzchenwl
qzchenwl / simple-schema.hs
Created February 26, 2012 10:42
implement sub schema in haskell
{-# 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)
@leino
leino / glinv.hs
Created January 19, 2012 10:08
Slight extension of http://blog.sigfpe.com/2011/10/quick-and-dirty-reinversion-of-control.html, which adds input capabilities
{--
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.
--}
@nicerobot
nicerobot / chrome-cookies.sh
Created December 7, 2011 16:59
Convert Google Chrome sqlite Cookies into cookies.txt. Useful for utilities like curl.
sqlite3 -separator ' ' ${COOKIES:-Cookies} \
'select host_key, "TRUE", path, "FALSE", expires_utc, name, value from cookies'
@qzchenwl
qzchenwl / gist:1136647
Created August 10, 2011 11:57
最大质因子
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)