Skip to content

Instantly share code, notes, and snippets.

View macournoyer's full-sized avatar

Marc-André Cournoyer macournoyer

View GitHub Profile
# Lighter -- Campfire from the command line
# usage: ruby lighter.rb subdomain "Main Room" macournoyer@gmail
require "rubygems"
require "tinder"
require "readline"
require "highline/import"
class Lighter
def initialize(room)
@room = room
class PusherWare
def initialize(app)
@app = app
@pusher = Pusher::App.new
end
def call(env)
if env["PATH_INFO"] ~= /\/pusher/
@pusher.call(env)
else
# Rack middleware to concatenate and serve sprocket files
# Usage:
#
# use Rack::Sprockets, :path => "/all.js", # URL to serve
# :load_path => ["src"], # Sprockets Secretary options
# :source_files => ["src/my_lib.js"]
#
require "sprockets"
module Rack
diff --git a/vm/gc.c b/vm/gc.c
index baec8c5..88a462d 100644
--- a/vm/gc.c
+++ b/vm/gc.c
@@ -1,17 +1,17 @@
#include "tr.h"
-OBJ GC_alloc(void* type){
- OBJ data = calloc(1, sizeof(type));
+OBJ GC_alloc(int size){
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xc0000007
0x00183463 in st_lookup (table=0x458c810, key=2889, value=0xbffe8d8c) at st.c:250
250 hash_val = do_hash(key, table);
(gdb) bt
#0 0x00183463 in st_lookup (table=0x458c810, key=2889, value=0xbffe8d8c) at st.c:250
#1 0x001939fe in classname (klass=52968440) at variable.c:151
#2 0x00193f2f in rb_class_path (klass=52968440) at variable.c:190
#3 0x00194091 in rb_class2name (klass=3221225475) at variable.c:301
#4 0x001129fa in rb_check_type (x=52968500, t=34) at error.c:276
@macournoyer
macournoyer / example.io
Created April 23, 2009 13:36
mio -- a lil tiny subset of Io all in Ruby
Xzibit = Object clone do(
dawg = method(what,
"yo dawg" print.
what print.
"clone" print.
self
).
so_you_can = method(
"so you can print" print.
Nice = Object clone do(
yo = method(
"yo"
).
is = method(
"indeed"
).
).
diff --git a/vm/string.c b/vm/string.c
index 64fa97e..9e8dd3e 100644
--- a/vm/string.c
+++ b/vm/string.c
@@ -1,3 +1,4 @@
+#include <alloca.h>
#include <stdarg.h>
#include <stdio.h>
#include "tr.h"
@@ -124,14 +125,11 @@ OBJ tr_sprintf(VM, const char *fmt, ...) {
_STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno-exceptions -fno-common -Woverloaded-virtual -mmacosx-version-min=10.5 -Wall -W -Wwrite-strings -Wunused -Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -arch i386 -arch x86_64 -c TimeValue.cpp -o /Users/marc/projects/llvm/llvm/lib/System/Release/TimeValue.o
llvm[1]: Building Release Archive Library libLLVMSystem.a
make[1]: *** [/Users/marc/projects/llvm/llvm/Release/lib/libLLVMSystem.a] Error 1
make: *** [all] Error 1
./tinyrb -d -e "1 + 2"
; block definition: 0x219f80 (level 0)
; 2 registers ; 0 nested blocks
; 0 args
.value 1 ; 0
.value 2 ; 1
[000] add 0 256 257
[001] return 0 0 0
; block end