Skip to content

Instantly share code, notes, and snippets.

View martinus's full-sized avatar
😎
warp! Help, I'm trapped in a time

Martin Leitner-Ankerl martinus

😎
warp! Help, I'm trapped in a time
View GitHub Profile
@martinus
martinus / CachedProxy.java
Created December 22, 2008 21:23
Create cached proxy automatically
package com.ankerl.proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;
/**
* Creates an intermediate proxy object for a given interface. All calls are
@martinus
martinus / anagrams-fast.rb
Created August 9, 2008 10:01
Two Word Anagram Finder Algorithm (in Ruby)
#!/usr/bin/ruby
# created by Martin Ankerl http://martin.ankerl.com/
class String
# creates an array of characters
def letters
unpack("c*")
end
end
@martinus
martinus / e.rb
Created July 24, 2008 17:35
extract any archive
#!/usr/bin/ruby
# The program e is a command line utility that extracts lots of
# different archives. It is very simple and can be extended very easily.
#
# It is inspired by how firewall use their rulesets, and works like this:
#
# * For each file that has to be extracted, the rules are matched one after the other.
# * When a rule matches (either by the filetype or filename), the command is executed.
# * If the command does not return an error code the extraction is considered successful,
# otherwise the next rules are matched.