Skip to content

Instantly share code, notes, and snippets.

View rwoeber's full-sized avatar

Richard Wöber rwoeber

  • Würzburg, Germany
View GitHub Profile
@rwoeber
rwoeber / canine.rb
Created August 10, 2012 09:17 — forked from h0rs3r4dish/canine.rb
Canine, an easy Ruby "binary" library
class Canine
VERSION = '1.3'
def initialize(&block)
@commands = Hash.new
@default = @latest = :commands
@empty = nil
@auto = {
:commands => hash_command("commands","Show a list of commands",Proc.new {
@commands.each { |cmd| c = cmd[1]
name = c[:name].to_s
@rwoeber
rwoeber / 0-readme.md
Created November 25, 2012 12:25 — forked from burke/0-readme.md
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@rwoeber
rwoeber / benchmark
Created February 20, 2013 20:49 — forked from danneu/benchmark
# I'm no benchmark guru. Just did a bunch of:
$ time ruby <filename>
# Note: This is just an 80mb XML file with 38,000 nodes.
ox_dom.rb 4.56s user 0.78s system 93% cpu 5.714 total (550mb)
ox_dom.rb 4.58s user 0.79s system 87% cpu 6.126 total (550mb)
ox_dom.rb 4.60s user 0.80s system 87% cpu 6.140 total (550mb)
nokigiri_dom.rb 11.75s user 1.02s system 94% cpu 13.518 total (895mb)
nokigiri_dom.rb 11.36s user 1.02s system 93% cpu 13.211 total (895mb)
radians = (n) ->
n * (Math.PI / 180)
# Operates similarly to Ruby's `Enumerable.invoke`
invoke = (a, f) ->
for n in a
memo = f memo, n
memo
# Returns the sum of an array of numeric items
@rwoeber
rwoeber / maven.plugin.zsh
Last active August 13, 2019 12:01 — forked from evelyne24/README
oh-my-zsh Plugin to colorize Maven. Put in `${OH_MY_ZSH_HOME}/custom/plugins/maven` and add to plugins array in `.zshrc`
# Original from https://gist.github.com/evelyne24/7714094
# Notes
# In MacOS, + does not work for regex, nor -E flag.
# Instead I used \{1,\} for char repetition.
# Formatting constants
bold=`tput bold`
red=`tput setaf 1`
bg_red=`tput setab 1`
green=`tput setaf 2`
@rwoeber
rwoeber / log.txt
Last active August 29, 2015 14:06 — forked from steveklabnik/log.txt
$ history | awk {'print $2, $3, $4'} | sort | uniq -c | sort -k1 -rn | head -n 30
610 git status
568 git commit -m
491 git add .
252 git push origin
176 bundle
138 rails s
128 ls
120 git commit --amend
114 git reset --hard
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
@rwoeber
rwoeber / mix.exs
Created January 16, 2016 15:56 — forked from jeffweiss/mix.exs
Retrieving application version number in mix.exs from git describe
defmodule MyApp.Mixfile do
use Mix.Project
def project do
[app: :my_app,
version: get_version,
elixir: "~> 1.0",
elixirc_paths: elixirc_paths(Mix.env),
compilers: Mix.compilers,
build_embedded: Mix.env == :prod,
@rwoeber
rwoeber / .latexmkrc
Last active February 25, 2016 07:15 — forked from davegurnell/.latexmkrc
Sample latexmk file to provide continuous compilation and preview with MacTex on OS X
# Sample latexmk configuration to use xelatex and Preview on OS X.
# Should help if you want to use latexmk with MacTeX.
#
# 1. Install MacTeX
# 2. Put this file in ~/.latexmkrc
# 3. Continuously recompile and preview your document with the command:
# latexmk -pvc myfile.tex
$pdflatex = 'xelatex -interaction=nonstopmode %O %S';
$pdf_previewer = 'open -a Preview "%S"';
@rwoeber
rwoeber / menu.html
Created March 16, 2016 12:12 — forked from jgoyon/menu.html
Horizontal menu, full width sub menu
<div id="menu">
<ul id="nav">
<li><a href="#">Menu 1</a>
<ul>
<li><a href="#">Menu 1 Submenu item 1</a></li>
<li><a href="#">Menu 1 Submenu item 2</a></li>
<li><a href="#">Menu 1 Submenu item 3</a></li>
</ul>
</li>