Tag: javascript

Execute a command line binary with Node.js

I am in the process of porting a CLI library from Ruby over to Node.js. In my code I execute several third party binaries when necessary. I am not sure how best to accomplish this in Node. Here’s an example in Ruby where I call PrinceXML to convert a file to a PDF: cmd = […]

How do I use Mechanize to process JavaScript?

I’m connecting to a web site, logging in. The website redirects me to new pages and Mechanize deals with all cookie and redirection jobs, but, I can’t get the last page. I used Firebug and did same job again and saw that there are two more pages I had to pass with Mechanize. I took […]

int((0.1+0.7)*10) = 7 in several languages. How to prevent this?

Recently I came across a bug/feature in several languages. I have a very basic knowledge about how it’s caused (and I’d like some detailed explanation), but when I think of all the bugs I must have made over the years, the question is how can I determine “Hey, this might cause a riddiculous bug, I’d […]

How to force Showoff to not add a margin-top to the .content div

Scott Chacon’s Showoff gem is a great alternative to Powerpoint/Keynote… but the fact that it always centers content vertically is annoying. Sometimes you want to force content to the top of the slide. Additionally, there seems to be a bug in that incremental content with images isn’t considered when calculating margin-top, which results in incremental […]

Lists in Rails sites

Is there a special way to create lists from models in rails that allows for special/dynamic sorting or reording/responding live as users interact with them? (Editing text, reording, etc…). All I could find online was this: https://github.com/javve/list which is in javascript. Are there any rails specific plugins or gems I haven’t found yet? If no […]

Highlighting Words in Document Displayed in WebPage

I have a Rails 3 application that queries a Oracle database that stores documents. My Rails application can store the document id but not any content or other meta-data from the document. I also have to send the document number to another webserver (not controlled by my Rails application) to display the document. I wonder […]

How do I keep static assets from a bundled gem in-sync in my Rails 2.3 app?

I am working on a Rails 2.3 application and would like to refactor some of my static assets (JS, CSS) into a separate gem. The problem is that Rails 2.3 engines don’t have the support for public directories that Rails 3 engines do, so the only way to access these files from the app is […]

Rails Gem Client Side Validations html struct

My project use Twitter Bootstrap CSS Framework,so my html like this. <div class=”control-group “> <label class=”control-label” for=”user_name”>Username</label> <div class=”controls”> <input data-validate=”true” id=”user_name” name=”user[name]” size=”30″ type=”text”> </div> </div> When validate failed, Client Side Validation change it to: <div class=”control-group “> <div class=”field_with_errors”> <label class=”control-label” for=”user_name”>Username</label> </div> <div class=”controls”> <div class=”field_with_errors”> <input data-validate=”true” id=”user_name” name=”user[name]” size=”30″ type=”text”> […]

Front-end Visual XPath Identification

I am looking for JS or Ruby library which allows me visually (user front-end) select page elements and identify theirs XPath for further use.

Rails 3 JavaScript resource pipeline management

I was wondering what the differences are between using a Ruby gem to include a JavaScript library into a Rails project versus including the JavaScript file yourself. I do know that you can lock down a version of the js library using bundler or alternatively, update all of your js libraries through bundler with one […]

Ruby is the best programming language in the world - Ruby on Rails.