Skip to content

Instantly share code, notes, and snippets.

View Watson1978's full-sized avatar

Watson Watson1978

View GitHub Profile
@Watson1978
Watson1978 / method.rb
Created October 24, 2010 12:11
Need the implementation on intern.h with MacRuby.
# Usage:
# $ cd src/MacRuby/
# $ ruby methods.rb include/ruby/intern.h
file = ARGV[0]
puts "Implementation is necessary."
File.open(file) {|f|
f.each_line do |line|
if(line =~ /^([^ \t\/\{\}#]+) ([^(;]+)/)
type = $1
@Watson1978
Watson1978 / gist:643493
Created October 24, 2010 12:12
Need the implementation with MacRuby.
* ruby.h
rb_objc_undef_method
rb_eval_string_protect
rb_eval_string_wrap
rb_catch
rb_catch_obj
ruby_init_stack
ruby_init_stack
rb_cISeq
rb_cEnv
@Watson1978
Watson1978 / method.d
Created November 18, 2010 14:46
DTrace Script: output the using methods within Ruby.
/* requirement : Mac OS X 10.5, ruby 1.8.6
* usage : $ sudo dtrace -qs method.d -c "ruby test.rb"
*/
function-entry
{
printf("[DTRACE]%s#%s\n", copyinstr(arg0), copyinstr(arg1));
}
filename = ARGV[0]
unless(filename)
puts "usage: #{$0} filename"
exit
end
list = {}
File.open(filename) {|f|
f.each_line do |line|
line.strip!
@Watson1978
Watson1978 / perf_result.txt
Created December 16, 2010 12:21
#1048 : [script 1] google-perftools result
Total: 180 samples
30 16.7% 16.7% 32 17.8% _rb_vm_yield_under
29 16.1% 32.8% 29 16.1% ___workq_kernreturn
23 12.8% 45.6% 23 12.8% _rb_vm_get_opaque_data
15 8.3% 53.9% 15 8.3% _strlen
10 5.6% 59.4% 137 76.1% _rb_vm_dispatch
7 3.9% 63.3% 17 9.4% Auto::Admin::thread_cache_allocate
7 3.9% 67.2% 7 3.9% _rb_objc_class_sync_version
7 3.9% 71.1% 22 12.2% _st_numhash
6 3.3% 74.4% 60 33.3% _rb_ary_equal
$ rake spec:library
(in /Users/watson/src/MacRuby)
rm -rf rubyspec_temp
./mspec/bin/mspec ci -B ./spec/macruby.mspec :library
MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64]
............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................E............................................................................................................................................................................................................
@Watson1978
Watson1978 / tscreen.rb
Created December 30, 2010 12:48
Homebrew formula for tscreen.
require 'formula'
class Tscreen <Formula
url 'http://www.steve.org.uk/Software/tscreen/dist/tscreen-0.4.9.tar.gz'
homepage 'http://www.steve.org.uk/Software/tscreen/'
md5 '12303c84a93a78f1c44441323ba38845'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
if [[ -s "/Library/Frameworks/MacRuby.framework/Versions/0.5" ]] ; then
alias macruby05="/Library/Frameworks/MacRuby.framework/Versions/0.5/usr/bin/macruby"
fi
if [[ -s "/Library/Frameworks/MacRuby.framework/Versions/0.6" ]] ; then
alias macruby06="/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/bin/macruby"
fi
if [[ -s "/Library/Frameworks/MacRuby.framework/Versions/0.7" ]] ; then
alias macruby07="/Library/Frameworks/MacRuby.framework/Versions/0.7/usr/bin/macruby"
fi
if [[ -s "/Library/Frameworks/MacRuby.framework/Versions/0.8" ]] ; then
Apple Inc. (NASDAQ: AAPL; previously Apple Computer, Inc.) is an American multinational corporation that designs and markets consumer electronics, computer software, and personal computers. The company's best-known hardware products include the Macintosh line of computers, the iPod, the iPhone and the iPad. Apple software includes the Mac OS X operating system; the iTunes media browser; the iLife suite of multimedia and creativity software; the iWork suite of productivity software; Aperture, a professional photography package; Final Cut Studio, a suite of professional audio and film-industry software products; Logic Studio, a suite of music production tools; and iOS, a mobile operating system. As of August 2010, the company operates 301 retail stores[5] in ten countries,[6] and an online store where hardware and software products are sold.
Established on April 1, 1976 in Cupertino, California, and incorporated January 3, 1977,[7] the company was previously named Apple Computer, Inc., for its first 30 years, b
@Watson1978
Watson1978 / backtrace.txt
Created January 18, 2011 09:20
tikets 704: segfault if change print message before "@values[name] = value"
(gdb) r
Starting program: /Users/watson/src/macruby-trunk-svn/miniruby /Users/watson/tmp/test_singleton.rb
Reading symbols for shared libraries .++++++++................... done
Reading symbols for shared libraries . done
method : 2.12264622838802e-314
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x00007fff81d2f700 in _class_getSuperclass ()
(gdb) bt