Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@runpaint
runpaint / gist:181199
Created September 4, 2009 22:48
Blah <code>class</code>
class H
def [](k) k end
def []=(k, v) [k, v] end
end
a = H.new
a[123] = 2
p (a[123] += 2)
%w{a b}.each do |name|
File.open(name,'w') do |f|
10000.times {|n| f.puts n }
end
end
a = File.open('a')
b = File.open('b')
a.reopen(b)
a.gets
a.reopen(b)
a = File.open('a')
b = File.open('b')
a.reopen(b)
a.gets
a.reopen(b)
p a.gets
/* 'Alnum': [[:Alnum:]] */
static const OnigCodePoint CR_Alnum[] = {
471,
0x0030, 0x0039,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
0x00b5, 0x00b5,
0x00ba, 0x00ba,
/* 'C': Major Category */
static const OnigCodePoint CR_C[] = {
25,
000000, 0x001f,
0x007f, 0x009f,
0x00ad, 0x00ad,
0x0600, 0x0603,
0x06dd, 0x06dd,
0x070f, 0x070f,
0x17b4, 0x17b5,
/* 'C': Major Category */
static const OnigCodePoint CR_C[] = {
25,
000000, 0x001f,
0x007f, 0x009f,
0x00ad, 0x00ad,
0x0600, 0x0603,
0x06dd, 0x06dd,
0x070f, 0x070f,
class Object
def backtrace
Backtrace.new
end
end
class Backtrace
class Line
attr_reader :file, :line, :name
def initialize(line)
From 47db9f7a55d8f938648c5751c0092cd3c2ae9558 Mon Sep 17 00:00:00 2001
From: Run Paint Run Run <runrun@runpaint.org>
Date: Wed, 5 Aug 2009 06:45:31 +0100
Subject: [PATCH] unicode.c: Add U+2064 (INVISIBLE PLUS) to Cf category
---
enc/unicode.c | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/enc/unicode.c b/enc/unicode.c
h = {'foo' => 'bar'}
h.compare_by_identity
p h.compare_by_identity? #=> true
h['foo'] = 'glark'
p h #=> {"foo"=>"bar", "foo"=>"glark"}
j = h.dup
p j #=> {"foo"=>"glark"}
doc(String, :slice, :[]) do
<<EOF
(Fixnum offset) => String or nil
Returns a substring of one character from _offset_. If _offset_ is
negative it's counted from the end of _self_. Returns _nil_ if _offset_
falls outside of _self_.