Mac OS X 10.6 (Snow Leopard) has VIM pre-installed (version 7.2), which is great.
It also has Ruby pre-installed (version 1.8.7) which is great too.
However, I want Ruby autocompletion in VIM. Looking up the VIM version (vim --version) shows -ruby (i.e. ruby support isn't enabled).
How to enable ruby for my VIM installation?
...
Is there currently a plugin that you ruby on rails developers that are also using macvim/gvim/vim that allows you to take a quick block of code and create a partial from it? I know that TextMate does this, figured someone has ported it by now to vim also.
...
Hi all,
I'm switching to Ruby for a project due to its excellent meta-programming support.
As a Scala guy, I'd use buildr or Maven to manage my project. I could have it generate a skeleton directory structure, add my dependencies, then when I build, the dependencies are downloaded automagically.
How would I use this workflow in Ruby? T...
I would like to get machinist, machinist_mongo, mongo_mapper, cucumber and pickle to play nice together.
Currently I have machinist with all my blueprints configured and am using cucumber to do BDD. So far so good. My problem is I am having to write custom cucumber steps for all of my machinist blueprints. It is not really a problem per...
My Application has a lot of modules like profiles, places, comments etc. So Inorder to send a mail when something interesting happens like a new comment, a new place, do I need to create many mailer classes(ProfileMailer, PlaceMailer, CommentMailer) and also corresponding observer classes to implement mail?
...
Given a search term, how to search the attributes of nodes in an XML and return the XML which contains only those nodes that match the term along with their parents all the way tracing to the root node.
Here is an example of the input XML:
<root>
<node name = "Amaths">
<node name = "Bangles"/>
</node>
<node name = "C">
...
Hey,
I am trying to write a ruby script which will look in a directory and its subdirectories for HTML files, open those HTML files and insert the following line just above the closing head tag:
<link rel="stylesheet" href="styles.css" type="text/css" />
I am trying to do this with Ruby because its the only language I am familar with...
I use Object#freeze to freeze the value of an object. I can write a function to deep-freeze a complex object structure. But neither will prevent me from assigning a new value to an object.
$O=cl()
$O.thorough_freeze
$O[:file] = "makefile" # => TypeError
$O[:commands][0] = "clean" # => TypeError
$O = "reticulate" # => Typ...
I typed up a simple Ruby code for a tutorial question, as shown below.
#Grandma is deaf!
puts "Hey Sonny! It's your lovely Grandmother! How are you?"
response = gets.chomp
while response != "BYE"
if response != response.upcase
puts "Huh?! I CAN'T HEAR YOU!"
else
puts "NO! NOT SINCE " + (1930 + rand(21)).to_s +...
I would like to use Sanitize in my ruby app. I'm working with a few friends on this project, so making sure the code works when they git it is important too.
Anyways, on the console I did
>gem install nokogiri
Building native extensions.
This could take a while...
Successfully installed nokogiri-1.4.2
1 gem installed
Installi...
How do I do it? E.g.,
<span class="selected" id="hi">HELLO</span>
should become
<span id="hi">HELLO</span>
...
Hi, I've been confused by the definition of block binding in ruby. Here are two samples:
def redfine_a(&block)
a = 2
puts eval("a", block.binding)
block.call
end
a = "hello"
puts redfine_a {a}
This one could run with the expected result, while the second one:
def redefine_a(&block)
a= 2
puts eval("a", block.binding)
block...
I'm authoring a gem and would like to copy template files that are packaged in my gem into the local directory that the gem is being called from.
...
Hi,
I am sending data via get and I need to put it into a int array to be used in a find.
here is my code :
@found = Array.new
params['candidate'].each do |c|
@found << c.to_i
end
My url looks like this
http://localhost:3000/export/candidate?candidate[]=3&candidate[]=4&commit=Export
If it makes any difference I am u...
I need a way of extracting the main text from any webpage that displays an article. Similar to the way that Readability can find the main text on any website that it's run on.
I'm using Ruby on Rails, so I think Hpricot is my best bet. Is what I'm looking for possible in Hpricot? Is there an example somewhere? Thanks for reading.
...
Hi,
How can I debug rspec specs with an IDE? specifically I'm using the following:
* Ubuntu 10.04
* ruby 1.9.2-dev built with rvm
* rails3-beta4
* NetBeans 6.9
I have installed the ruby-debug19 and the ruby-debug-ide91 gems, but NetBeans doesn't recognize my fast-debugger. Besides trying to debug a spec in NetBeans gives the follow...
Why does rails use @poop object instance variables instead of just a local poop variable in the generated code? Is there some foreseen common situation where it's useful rather than simply using a local variable here? I would think it makes sense to use a local variable and not attach something to the object namespace unless you need it ...
I don't have much programming experience. But to me, Struct seems somewhat similar to Hash.
What tasks does Struct do very good?
Is there anything Struct can do, but Hash cannot do?
After googling, the concept of Struct is important in C, but I don't know much about C.
...
Does Ruby stdlib have any objects that represent difference between two timestamps? Subtracting two Time object from each other returns a float number of seconds - is there any object for that, with methods like hours, minutes etc., and most of all decent to_s?
I've coded half-assed methods for that far too many time, am I doing it wron...
Hello again,
This time I have problem with access control tables. I have 2 tables like these:
Menu Table
-------------------------------------------------------------------------
| id | parent | caption | link |
-------------------------------------------------------------------------
| mc_tra...