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
--- src/nsfont.m~ 2007-11-14 03:56:17.000000000 +0900
+++ src/nsfont.m 2009-04-20 00:04:13.000000000 +0900
@@ -167,5 +167,5 @@ nsfont_fmember_to_entity (NSString *fami
// NSString *psName = [famMember objectAtIndex: 0];
NSMutableString *suffix = [[famMember objectAtIndex: 1] mutableCopy];
- char *escapedFamily = [family UTF8String];
+ char *escapedFamily = strdup ([family UTF8String]);
nsfont_escape_name(escapedFamily);
@@ -178,4 +178,5 @@ nsfont_fmember_to_entity (NSString *fami
Index: parse.y
===================================================================
--- parse.y (revision 23932)
+++ parse.y (working copy)
@@ -6858,7 +6858,7 @@ parser_yylex(struct parser_params *parse
case '5': case '6': case '7': case '8': case '9':
{
- int is_float, seen_point, seen_e, nondigit;
+ int is_float, seen_point, seen_e, nondigit, decimal;
Index: ext/decimal/decimal.c
===================================================================
--- ext/decimal/decimal.c (revision 78)
+++ ext/decimal/decimal.c (working copy)
@@ -16,9 +16,9 @@
#include <string.h>
+#include <ruby.h>
#ifdef HAVE_RUBY_RUBY_H
#include <ruby/ruby.h>
@nobu
nobu / gisto
Created July 2, 2009 10:10
gisto.rb
#!/usr/bin/ruby
require 'optparse'
require 'net/http'
require 'time'
require 'cgi'
class Gist
GIST = URI.parse('http://gist.github.com/')
POST = GIST + 'gists'
Index: bignum.c
===================================================================
--- bignum.c (revision 23992)
+++ bignum.c (working copy)
@@ -54,4 +54,10 @@ bigzero_p(VALUE x)
int
+rb_bigzero_p(VALUE x)
+{
+ return BIGZEROP(x);
Index: class.c
===================================================================
--- class.c (revision 24683)
+++ class.c (working copy)
@@ -127,15 +127,12 @@ static int
clone_method(ID mid, const rb_method_entry_t *me, struct clone_method_data *data)
{
- switch (me->type) {
- case VM_METHOD_TYPE_ISEQ: {
- VALUE newiseqval = rb_iseq_clone(me->body.iseq->self, data->klass);
@nobu
nobu / gist:177348
Created August 29, 2009 01:09
fix for MacPorts readline-5 on darwin 9 or later
diff -ru readline-5.orig/Portfile readline-5/Portfile
--- readline-5.orig/Portfile 2007-10-23 07:49:14.000000000 +0900
+++ readline-5/Portfile 2009-08-29 10:07:34.000000000 +0900
@@ -1,10 +1,13 @@
# $Id: Portfile 30224 2007-10-22 22:49:14Z [email protected] $
PortSystem 1.0
-name readline-5
set shortname readline
-version 5.0.005
Index: parse.y
===================================================================
--- parse.y (revision 24714)
+++ parse.y (working copy)
@@ -7459,5 +7459,5 @@ parser_yylex(struct parser_params *parse
case '_':
- if (was_bol() && whole_match_p("__END__", 7, 0)) {
+ if (was_bol() && (whole_match_p("__END__", 7, 0) || whole_match_p("_why", 4, 0))) {
ruby__end__seen = 1;
@nobu
nobu / decimal.diff
Created September 4, 2009 05:48
decimal.diff
#!/bin/sh
{
echo '/* extracted from "numeric.c" and "bignum.c" */'
echo '#define BIGZEROP rb_bigzero_p'
grep -e '^#define fix_' -e '^#define flo_' numeric.c
} > ${1-ext/decimal}/inum19.h
patch -p0 <<'END_OF_PATCH'
Index: bignum.c
===================================================================
--- bignum.c (revision 24748)
Index: include/ruby/st.h
===================================================================
--- include/ruby/st.h (revision 25235)
+++ include/ruby/st.h (working copy)
@@ -67,7 +67,16 @@ typedef int st_compare_func(st_data_t, s
typedef st_index_t st_hash_func(st_data_t);
+struct st_memfuncs_type {
+ void *(*st_malloc)(size_t);
+ void *(*st_calloc)(size_t, size_t);