Skip to content

Instantly share code, notes, and snippets.

View heftig's full-sized avatar
🦄
Horsing around

Jan Alexander Steffens heftig

🦄
Horsing around
View GitHub Profile
### Keybase proof
I hereby claim:
* I am heftig on github.
* I am heftig (https://keybase.io/heftig) on keybase.
* I have a public key whose fingerprint is 8218 F888 49AA C522 E94C F470 A5E9 288C 4FA4 15FA
To claim this, I am signing this object:
diff --git i/Rakefile w/Rakefile
index d1bbfa6..ecf10bb 100644
--- i/Rakefile
+++ w/Rakefile
@@ -52,7 +52,7 @@ end
load_configuration
-unless BUILD_CONFIG[:config_version] == 179
+unless BUILD_CONFIG[:config_version] == 180
def caseperm(str, num)
str.each_char.map.with_index do |c,i|
if num[i] == 0
c.downcase
else
c.upcase
end
end.join
end
class Hash
def map_value
each_pair.with_object({}) { |(key, value), result| result[key] = yield value }
end
def map_key
each_pair.with_object({}) { |(key, value), result| result[yield key] = value }
end
def map_pair(&blk)
escape_char /
comment_char %
% Locale for English locale in Germany, using period decimal seperator
LC_IDENTIFICATION
title "English locale for Germany"
source ""
address ""
contact ""
email ""
require 'benchmark'
class A
attr_accessor :foo
def initialize
@foo = 0
end
def test_direct
class ErrorRounder
def initialize
@error = 0.0
end
def round(x, n=0)
out = (x - @error).round(n)
@error += out - x
out
end
def replace_line_in_file(old,new,file)
File.open(file) do |f|
File.open(file + ".new", "w") do |f2|
f.each_line do |line|
f2.puts line.gsub(old, new)
end
end
end
File.rename(file + ".new", file)
end
filename="foobar"
File.open(filename, "r") do |fr|
File.open(filename + "~nop", "w") do |fw|
fr.each_line do |line|
fw.write line.gsub(".", "")
end
File.rename(filename + "~nop", filename)
end
end
require 'socket'
sockpath = "/tmp/foosock"
if ARGV.first == "server"
socket = UNIXServer.new sockpath
begin
while client_sock = socket.accept do
Thread.start do
puts "New connection"