Skip to content

Instantly share code, notes, and snippets.

View banister's full-sized avatar
🇳🇱

John Mair banister

🇳🇱
View GitHub Profile
def check_bounds
if @y > Common::SCREEN_Y*3 || @y < -Common::SCREEN_Y || @x >Common::SCREEN_ X*3 || @x < -Common::SCREEN_X then
@expired = true
end
end
this error:
require 'rubygems'
require 'object2module'
class Object
include Object2module
def gen_extend(*objs)
objs.each_with_index { |v, i|
if !v.instance_of?(Module) then
(defun rotate-windows-helper(x d)
(if (equal (cdr x) nil) (set-window-buffer (car x) d)
(set-window-buffer (car x) (window-buffer (cadr x))) (rotate-windows-helper (cdr x) d)))
(defun rotate-windows
(rotate-windows-helper (window-list) (window-buffer (car (window-list)))))
john@johnlinux /etc $ lspci
00:00.0 Host bridge: Intel Corporation 82845 845 [Brookdale] Chipset Host Bridge (rev 03)
00:01.0 PCI bridge: Intel Corporation 82845 845 [Brookdale] Chipset AGP Bridge (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 12)
00:1f.0 ISA bridge: Intel Corporation 82801BA ISA Bridge (LPC) (rev 12)
00:1f.1 IDE interface: Intel Corporation 82801BA IDE U100 Controller (rev 12)
00:1f.2 USB Controller: Intel Corporation 82801BA/BAM USB Controller #1 (rev 12)
00:1f.3 SMBus: Intel Corporation 82801BA/BAM SMBus Controller (rev 12)
00:1f.4 USB Controller: Intel Corporation 82801BA/BAM USB Controller #1 (rev 12)
00:1f.5 Multimedia audio controller: Intel Corporation 82801BA/BAM AC'97 Audio Controller (rev 12)
C = Class.new
def hello
m = Module.new do
def fren; puts "fren!"; end
end
C.class_eval do
include m
end
end
2.3 Built-in Types
The following sections describe the standard types that are built into the interpreter. Historically, Python's built-in types have differed from user-defined types because it was not possible to use the built-in types as the basis for object-oriented inheritance. With the 2.2 release this situation has started to change, although the intended unification of user-defined and built-in types is as yet far from complete.
Ruby is a language designed in the following steps:
* take a simple lisp language (like one prior to CL).
* remove macros, s-expression.
* add simple object system (much simpler than CLOS).
* add blocks, inspired by higher order functions.
* add methods found in Smalltalk.
* add functionality found in Perl (in OO way).
So, Ruby was a Lisp originally, in theory.
class EventController
def initialize
@event_hash = {}
end
def register_listener(event_name, lsr)
@event_hash[event_name] ||= []
@event_hash[event_name] << lsr
end
inline do |builder|
builder.prefix %{
VALUE
intersect(VALUE s, VALUE o) {
float x, y, y_offset, x_offset, ox, oy, ox_offset, oy_offset;
x = rb_iv_get(s, "@x");
y = rb_iv_get(s, "@y");
x_offset = rb_iv_get(s, "@x_offset");
y_offset = rb_iv_get(s, "@y_offset");
require 'rubygems'
require 'inline'
class Fren
inline do |builder|
builder.c %{
VALUE bink() {
return Qtrue;
}
}, :method_name => "fren?"