Posts Tagged ruby
Alt+F2
I just wrote a class in ruby for the backend for the ALT+F2 replacement i’m working on.
here is the class in ruby
#! /usr/bin/ruby
require 'pathname'
class Doer
def initialize
path=ENV['PATH'].to_s.split(":")
@li=""
@cmdlst=[]
@command=Hash.new()
path.each do |indpath|
inpath=Pathname(indpath)
files=inpath.children(false)
files.each do |fls|
testval=FileTest::executable?(File.join(indpath,fls))
if testval
cmdpth=File.join(indpath,fls).to_s
cmd=fls.to_s
@command.store(cmd,cmdpth)
@cmdlst.push(cmd+"\n")
end
end
end
@cmdlst=@cmdlst.join
end
def updatefind(str)
pattern=Regexp.compile("#{str}.*",Regexp::IGNORECASE)
@li=@cmdlst.scan(pattern)
return @li
end
end
You can try it by passing a string to the updatefind function for getting the list of commands similar to the give string.
For eg:
x=Doer.new()
puts x.updatefind(ARGV[0])
if you are passing the string from command line..
Hope ppl find this useful!!
will update soon with the Qt front end as soon i’m done with it.
Add comment April 12, 2009
Brainfuck++ Interpreter
Having fun coding on brainfuck and ruby for sometime, here is the result.
Jared Derinsk, had published a white paper on adding features to brainfuck. Having published his white paper for about 3 years (more…)
Add comment March 19, 2009


