'ruby' Tag

  • Programming Blog

    November 18, 2008

    I have started a programming blog here.

  • Ruby 1.9 on Openmoko!!

    August 10, 2008

    Managed to compile and package Ruby 1.9.0-3 for Openmoko!!!
    Download: ruby19-complete_190-3_armv4t
    [Update]
    Here’s the ruby package without dev and documentation (this would be smaller and more appropriate on the phone) – ruby19_190-3_armv4t

  • Rubygame 3 on Ruby 1.9

    April 2, 2008

    Creating a Ruby 1.9 sandbox
    1. mkdir /home/user/ruby19 (example folder)
    2. cd /home/user/ruby19
    3. mkdir src
    4. cd src
    5. wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.0-1.tar.bz2
    6. tar -jxvf ruby-1.9.0-1.tar.bz2
    7. cd ruby-1.9.0-1
    8. ./configure –prefix=/home/user/ruby19
    9. make
    10. make install
    Now you can switch to this sandbox at any time by executing ‘export PATH=/home/user/ruby19/bin:$PATH’ in a shell.
    Chipmunk Installation
    Chipmunk is required for Rubygame 3
    1. wget http://files.slembcke.net/chipmunk/release/ChipmunkLatest.tgz
    2. tar -zxvf ChipmunkLatest.tgz
    3. cd [...]

  • Building an “include” graph

    August 6, 2006

    How easy would it be to build include graphs in ruby?
    Here's my first attempt:
    PLAIN TEXT
    RUBY:

    $list_of_files = Hash.new

    $list_of_files.each {|node|

    node = Array.new

    }

    def store_includes(pathname)

    lines = IO.readlines(pathname)

    lines.each {|line|

    if line.include? "#include"

    include_file = line[line.index("#include")+"#include".size,line.size]

    fidx = 0

    sidx = 0

     

    if include_file.include?("\"")

    fidx = include_file.index("\"") + 1

    sidx = include_file.index("\"",fidx+1) - 1

    end

     

    if include_file.include?('<')

    fidx = include_file.index('<') + 1

    sidx = include_file.index('>') - 1

    end

     

    include_file = include_file[fidx..sidx]

    $list_of_files[pathname].add(include_file)

    end

    }

    end

     

    def iterate_files(pathname)

    list = [] [...]

  • File extensions in ruby

    August 6, 2006

    Is there a more efficient way to extract the file extensions in ruby? I currently do the following.
    PLAIN TEXT
    RUBY:

    ext = File.basename(filepath).reverse.split('.')[0].reverse

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org