Skip to content

Instantly share code, notes, and snippets.

View michaeljklein's full-sized avatar

Michael J Klein michaeljklein

View GitHub Profile
├── LICENSE: 29 lines
├── README.md: 12 lines
├── Setup.hs: 2 lines
├── app
│   └── Main.hs: 5 lines
├── git-details.cabal: 82 lines
├── src
│   ├── Data
│   │   ├── Attoparsec
│   │   │   └── Text
let configpath = '/Users/michaelklein/.cvimrc'
let homedirectory = '/Users/michaelklein'
set localconfig
let vimcommand = 'urxvt -e vim'
imap <C-o> editWithVim
set smoothscroll
" set noautofocus
set cncpcompletion
#!/bin/sh
# To squash the last three commits: git squash 3
# It will open an interactive editor so you can
# more easily combine the comments
source "$(git --exec-path)/git-sh-setup"
USAGE="COMMITS"
function _squash() {
unless Rails.env.production?
require 'ftpd'
require 'tmpdir'
puts "****** loading tmp_ftp *********"
class TmpFtp
def initialize(temp_dir)
@temp_dir = temp_dir
end
#!/bin/bash
# Create a post-checkout hook to show stashed changes
cd .git/hooks&&("#!/bin/sh\nexec git stash list --pretty=oneline --abbrev-commit">post-checkout)&&chmod +x post-checkout
class Mock
attr_accessor :mock_original_name, :mock_call_stack
def self.on(x)
x.instance_eval do
def method_missing(symbol, *args)
puts "mocking #{self}.${symbol}(#{args.inspect})"
@mock_call_stack ||= []
@mock_call_stack << [symbol, args]
Comparison:
from: markdown, to: Fixnum, file: test2.md, sum bytes : 525983.2 i/s
from: markdown, to: Fixnum, file: test.md, sum bytes : 127658.3 i/s - 4.12x (± 0.14) slower
from: org, to: Fixnum, file: format.org, sum bytes : 123568.3 i/s - 4.26x (± 0.14) slower
from: markdown, to: Fixnum, file: format.markdown, sum bytes : 104980.1 i/s - 5.01x (± 0.33) slower
from: rst, to: Fixnum, file: format.rst, sum bytes : 98854.8 i/s - 5.32x (± 0.32) slower
from: textile, to: Fixnum, file: format.textile, sum bytes : 97966.4 i/s - 5.36x (± 0.29) slower
from: latex, to: Fixnum, file: format.latex, sum bytes : 87885.2 i/s - 5.98x (± 0.32) slower
from: latex, to: Fixnum, file: bomb.tex, sum bytes : 32267.8 i/s - 16.28x (±
These benchmarks take about 45 minutes to run and perform a total of ~350k conversion (on my machine).
Here is the only significant win by pandoc-ruby:
Calculating -------------------------------------
from: latex, to: latex, file: bomb.tex, pandoc_rb
0.020 (± 0.0%) i/s - 1.000 in 49.770525s
from: latex, to: latex, file: bomb.tex, pandoc-ruby (read file)
21.586 (± 3.4%) i/s - 104.000 in 5.025571s

 Obj <- _ -> Obj <- _ -> Nat <- _ -> Nat          Nat <- _ -> Nat <- _ -> Lit <- _ -> Lit
 ^           ^           ^           ^            ^           ^           ^           ^
 |           |           |           |            |           |           |           |
 _           _           _           _            _           _           _           _
 |           |           |           |            |           |           |           |
 v           v           v           v            v           v           v           v
 Obj <- _ -> Obj <- _ -> Nat <- _ -> Nat          Nat <- _ -> Nat <- _ -> Lit <- _ -> Lit
 ^           ^           ^           ^            ^           ^           ^           ^