Skip to content

Instantly share code, notes, and snippets.

View nobu's full-sized avatar

Nobuyoshi Nakada nobu

  • Nihon Ruby-no-Kai
  • Kanuma, Tochigi, Japan
  • X @n0kada
View GitHub Profile
Index: include/ruby/io.h
===================================================================
--- include/ruby/io.h (revision 25257)
+++ include/ruby/io.h (working copy)
@@ -167,4 +167,9 @@ int rb_io_read_pending(rb_io_t*);
void rb_read_check(FILE*);
+char *rb_enc_path_next(const char *s, const char *e, rb_encoding *enc);
+char *rb_enc_path_skip_prefix(const char *path, const char *end, rb_encoding *enc);
+char *rb_enc_path_last_separator(const char *path, const char *end, rb_encoding *enc);
@nobu
nobu / gist:212503
Created October 18, 2009 00:36
svn_ps1.sh
We couldn’t find that file to show.
Index: ext/syck/emitter.c
===================================================================
--- ext/syck/emitter.c (revision 25425)
+++ ext/syck/emitter.c (working copy)
@@ -535,4 +535,64 @@ void syck_emit_indent( SyckEmitter *e )
#define SCAN_DOCSEP 8192
+static const unsigned long utf8_limits[] = {
+ 0x0, /* 1 */
+ 0x80, /* 2 */
@nobu
nobu / Ruby-git.mk
Created November 5, 2009 15:12
ruby-build files
inside-work-tree := $(git rev-parse --is-inside-work-tree)
ifeq ($(inside-work-tree),true)
branches := $(shell git branch -l | sort | sed 's/\*//')
gitdir = .git
backupdir = $(gitdir)
backup = git.tar.bz2
backuparg =
else
gitdir = .
backupdir := $(notdir $(shell pwd))
@nobu
nobu / example
Created November 6, 2009 07:31
Locale module
$ ./ruby -rlocale -e 'p ENV.values_at(*%w[LC_ALL LC_TIME LANG]);
t = Time.now
puts t
Locale.all=""
puts t
Locale.time="C"
puts t'
[nil, nil, "ja_JP.UTF-8"]
Fri Nov 06 16:38:50 +0900 2009
金 11 06 16:38:50 +0900 2009
@nobu
nobu / extconf.rb
Created December 21, 2009 05:17
security/keychain for MacOSX
require 'mkmf'
if have_header('CoreFoundation/CFString.h') and have_header('Security/SecKeychain.h')
$LDFLAGS << ' -framework CoreFoundation -framework Security'
$LIBS << ' -LCoreFoundation -LSecurity'
create_makefile('security/keychain')
end
We couldn’t find that file to show.
We couldn’t find that file to show.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.ruby-lang.svn.update</string>
<key>OnDemand</key>
<true/>
<key>WorkingDirectory</key>
<string>/Users/nobu/src/ruby/svn</string>
@nobu
nobu / 0001-vm_method.c-drop-include_all-flag.patch
Created January 22, 2013 06:34
wrong number argument in rubyspec/core/marshal/dump_spec.rb
From dca0ef157f59f199ded8ab836e7ea20247c1a2f5 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Tue, 22 Jan 2013 15:25:02 +0900
Subject: [PATCH 1/2] vm_method.c: drop include_all flag
* vm_method.c (rb_obj_respond_to): drop optional include_all flag if
respond_to? method is defined in old style.
---
test/ruby/test_marshal.rb | 12 ++++++++++++
vm_method.c | 8 +++++++-