Skip to content

Instantly share code, notes, and snippets.

View oneup's full-sized avatar

Florian Hufsky oneup

View GitHub Profile
#!/usr/local/bin/ruby
#
# IRC Client Example
require "socket"
# Don't allow use of "tainted" data by potentially dangerous operations
$SAFE=1
# The irc class, which talks to the server and holds the main event loop
////
//// OpenGL based server that streams images to screen from multiple clients
//// maybe someone can use this / have fun playing with it
using System;
using System.Text;
using System.Collections;
using System.Threading;
using System.IO;
using System.Net.Sockets;
@oneup
oneup / coldec.rb
Created October 15, 2009 12:09
rails styles find_by_* automethods
# make on_collision_with()
def self.register_collision_classes
result = instance_methods.grep(/^#{COLLISION_HANDLER_PREFIX}/).map do |method_name|
name_of_handled = method_name[/^#{COLLISION_HANDLER_PREFIX}_?(.*)/,1]
Game.referee.track(self.underscore_name,name_of_handled.empty? ? :any : name_of_handled)
end
end
@oneup
oneup / httpd.conf.snip
Created December 10, 2009 14:01
apache2 redirect everything to index.html prevent loop
# apache 2 mod_rewrite no infinite redirect loops
RewriteEngine on
# still keep /static folder
RewriteCond %(REQUEST_URI) !^(\/static) [NC]
# don't rewrite index.html (prevents infinite loop)
RewriteRule !index\.html - [C]
# rewrite everything to index
RewriteRule .* /index.html [R]