Skip to content
View git.plugin.zsh
# Aliases
alias g='git'
compdef g=git
alias gst='git status'
compdef _git gst=git-status
alias gl='git pull'
compdef _git gl=git-pull
alias gup='git fetch && git rebase'
compdef _git gup=git-fetch
alias gp='git push'
View gist:6437400
weave∙partition≡id : ∀ {A} {m n m+n : ℕ} {mn-proof : m + n ≅ m+n}
fn (vec : Vec A (m + n)) →
weave (partition {A} {m} {n} fn vec) ≅ vec
weave∙partition≡id {A} {0} fn [] = refl
weave∙partition≡id {A} {suc m} {0} fn (x ∷ xs) =
cong (_∷_ x) (weave∙partition≡id {A} {m} {_} {_} {+0 m} fn xs)
weave∙partition≡id {A} {0} {suc n} fn (x ∷ xs) =
cong (_∷_ x) (weave∙partition≡id {A} {0} {_} {_} {refl} fn xs)
weave∙partition≡id {A} {suc m} {suc n} fn (x ∷ xs) with fn x
... | true = cong (_∷_ x) (weave∙partition≡id {A} {m} {_} {_} {refl} fn xs)
View gist:5041169
# coding: utf-8
$:.unshift 'lib'
require 'prawn'
Prawn::Document.generate 'test_table.pdf' do
table [["Label:", 'text']], :cell_style => {:size => 10, :background_color => "000000", :border_width => 0} do
columns(0).text_color = "9a9a9a"
columns(1).text_color = "FFFFFF"
end
View gist:4684255
module PatientHelpers
include ActionController::Base.helpers
include Haml::Helpers
init_haml_helpers
end
def h
h ||= Object.new.extend(PatientHelpers)
end
View gist:4552523
(defn make-registry []
(doto (carbonite.api/default-registry)
(.setClassLoader (clojure.lang.DynamicClassLoader.))))
View carbon.rb
require 'formula'
class Carbon < Formula
homepage 'http://graphite.wikidot.com/'
url 'http://pypi.python.org/packages/source/c/carbon/carbon-0.9.10.tar.gz'
md5 '1d85d91fe220ec69c0db3037359b691a'
depends_on 'python'
depends_on 'twisted' => :python
depends_on 'whisper'
View gist:4137531
#!/usr/bin/env ruby
hits_ = nil
misses_ = nil
loop do
`redis-cli info | grep keyspace` =~ /hits:(\d+).*misses:(\d+)/m
hits, misses = $1.to_i, $2.to_i
if hits_
View gist:4118335
foreground-vim() {
fg %vim
}
zle -N foreground-vim
bindkey '^Z' foreground-vim
View gist:2045188
table = pdf.make_table([["foo", "bar"],
["baz\n"*18, "quux"]], :position => :center)
pdf.move_down((pdf.bounds.height - table.height) / 2.0)
table.draw
View gist:1865527
obj = %{<< /Rect [ 330.521 116.285 346.958 128.321 ] /F 4 /T (Check Box1) /Subtype
/Widget /P 3 0 R /MK 139 0 R /AP 140 0 R /H /P /V / /AS /Off /FT /Btn /Type
/Annot >>}
buf = PDF::Reader::Buffer.new(StringIO.new(obj))
parser = PDF::Reader::Parser.new(buf, nil)
parser.parse_token
# => {:Rect=>[330.521, 116.285, 346.958, 128.321], :F=>4, :T=>"Check Box1", :Subtype=>:Widget, :P=>#<PDF::Reader::Reference:0x000000012afd40 @id=3, @gen=0>, :MK=>#<PDF::Reader::Reference:0x000000012ad298 @id=139, @gen=0>, :AP=>#<PDF::Reader::Reference:0x000000012accd0 @id=140, @gen=0>, :H=>:P, :V=>:"", :AS=>:Off, :FT=>:Btn, :Type=>:Annot}
Something went wrong with that request. Please try again.