This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// | |
//// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
Benchmark.bm do |bm| | |
bm.report('ruby:') do | |
100000.times { 8.factorial } | |
end | |
bm.report('c:') do | |
100000.times { CFactorial.factorial(8) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails Cheat Sheet | |
# and list of helpers worth keeping | |
# command line | |
script/generate controller | |
# route | |
map.root :controller => "controller_name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Quake 3 | |
// config for iMac 2.4 GHz Core 2 Duo | |
// custom aspect ratio for 1680x1050 wide-screen | |
// | |
seta r_mode "-1" | |
seta r_fullscreen "1" | |
seta r_customheight "1050" | |
seta r_customwidth "1680" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void *c_core(void*root){ | |
//evaluates root (scripting language with byte input) | |
return null; | |
} | |
/* // eg | |
c_core(); // crash / null -> undefined | |
c_core(null); // | |
c_core("puts hello world"); // scan for \0, puts (report) findings | |
c_core("console"); // initialize screen and open console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# Generic TCP Server Example | |
require "GServer" | |
class Root < GServer | |
def initialize(port=10001, *args) | |
super(port, *args) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# check for collisions between two circles | |
# we can compare the squared radius/distance instead of comparing squareroots because of math. | |
def circles_collide (x1, y1, radius1, x2, y2, radius2) | |
# compare the distance to combined radii | |
distance_x = x2 - x1 | |
distance_y = y2 - y1 |
NewerOlder