Skip to content

Instantly share code, notes, and snippets.

View jakedouglas's full-sized avatar

Jake Douglas jakedouglas

View GitHub Profile
merb-action-args (0.9.9)
merb-assets (0.9.9)
merb-auth (0.9.9)
merb-auth-core (0.9.9)
merb-auth-more (0.9.9)
merb-auth-slice-password (0.9.9)
merb-cache (0.9.9)
merb-core (0.9.9)
merb-gen (0.9.9)
merb-haml (0.9.9)
my(@vars) = ($foo, $bar);
foreach(@vars) {
print "The name of my variable is: <how do I do that?>";
}
irb(main):001:0> @foo = "abc"
=> "abc"
irb(main):002:0> @bar = "def"
=> "def"
irb(main):003:0> @baz = "ghi"
=> "ghi"
irb(main):004:0> ["foo", "bar", "baz"].each do |var|
irb(main):005:1* puts "Hi my name is " + var + " and my value is " + instance_variable_get("@#{var}")
irb(main):006:1> end
Hi my name is foo and my value is abc
class Foo < ?
def initialize(klass)
# make '?' = klass
end
end
ruby187
0.040000 0.000000 0.040000 ( 0.037320) < - method
0.090000 0.000000 0.090000 ( 0.089523) < - proc
ruby19
0.020000 0.000000 0.020000 ( 0.020401) < - method
0.040000 0.000000 0.040000 ( 0.037964) < - proc
diff --git a/ext/rubymain.cpp b/ext/rubymain.cpp
index 892f0fd..f0cf588 100644
--- a/ext/rubymain.cpp
+++ b/ext/rubymain.cpp
@@ -20,6 +20,7 @@ See the file COPYING for complete licensing information.
#include "project.h"
#include "eventmachine.h"
#include <ruby.h>
+#include <st.h>
#include <pthread.h>
#include <stdio.h>
#include <ruby.h>
#include "thrqueue.h"
static VALUE cThreadTest;
void *produce(struct Queue *q)
{
char *ptr = "foo";
@jakedouglas
jakedouglas / gist:135109
Created June 24, 2009 09:04
Simple UDP Growl packets in Lua
require "luarocks.require"
require "pack"
require "socket"
require "md5"
Growl = {version = 1, registration = 0, notification = 1}
function Growl.new(hostname, appname)
local mysock = assert(socket.udp())
@jakedouglas
jakedouglas / mach64.diff
Created September 21, 2009 02:13
make google perftools work on snow leopard
cd /path/to/google-perftools-1.4
patch -p0 < /path/to/mach64.diff
CFLAGS="-D_XOPEN_SOURCE" CXXFLAGS="-D_XOPEN_SOURCE" ./configure
make, make install, blah blah etc
diff --git a/ext/cmain.cpp b/ext/cmain.cpp
index a75417c..2922338 100644
--- a/ext/cmain.cpp
+++ b/ext/cmain.cpp
@@ -783,12 +783,12 @@ extern "C" int evma_send_file_data_to_connection (const unsigned long binding, c
evma_start_proxy
*****************/
-extern "C" void evma_start_proxy (const unsigned long from, const unsigned long to)
+extern "C" void evma_start_proxy (const unsigned long from, const unsigned long to, const unsigned long bufsize)