I'm using JetBrains Rubymine for developing Rails applications. It's a great IDE but unfortunately I didn't find how to format the hTML or Ruby code.
Any suggestiongs?
Ctrl + Alt + I for Auto-indent line(s)
For more keymaps.
In OS X keymap try this one: ⌘+Alt+L
Code | Reformat Code... (Ctrl+Alt+L in Windows default keymap).
Related
This is my code for drop down selection using ruby:
ruby version is 2.4.3
watir version 6.8.4
cucumber version 3.01
firefox version 47
b.select(id: 'curLocation').option(text: 'Chennai').select
This code is not working for me.
require 'watir'
b = Watir::Browser.start 'bit.ly/watir-webdriver-demo'
s = b.select_list id: 'entry_1000001'
s.select'Ruby'
s.selected_options
Reference: watir
select_from_list = browser.select_list(:xpath, "xpath")
.option(:text => opts[:yourjson])
select_from_list.select
Its for example.
I hope it will help you
Exactly - you can use .option(:xpath, "xpath")
or .option(code: "xpath")
You are using #select wrong. Take a look at the specs for more examples, but all you have to do is:
b.select(id: 'curLocation').select('Chennai')
Also, Firefox 47 isn't a supported version any longer. Please update to the latest version of Firefox, and the latest geckodriver. Also your title says Watir 6.8.4, but you list 5.1.4, which is deprecated.
keyboard shortcut to find/search and open file using file name in IntelliJ idea in Mac?
I tried following, but they are not working with latest version...
cmd+shift+n
[or]
ctrl+shift+n
Press Shift twice and then type name. I'm not sure if you are asking about this but that's my guess. Or maybe you are asking about command + Shift + O ;> There you have list:
https://resources.jetbrains.com/assets/products/intellij-idea/IntelliJIDEA_ReferenceCard_mac.pdf
How to format/beautify rails erb code. The view code is a mix of erb and JS.
I tried using the following tool as well, but it didn't help
https://github.com/katgironpe/rails-erb-lint
A good IDE to format/beautify rails is RubyMine.
RubyMine is able to reformat many types of files, like Ruby, HTML, JavaScript, CSS, etc.
example for reformat erb file:
Before:
After:
You can set the code style in the Preferences / Editor / Code Style
The tool which you already used, i.e., rails-erb-lint, checks only for the validity of you ERB and doesn't help with beautifying the ERB code. I don't know which editor you are using, but you can try either Sublime Text 3 or Github's Atom. Both of these have 3rd party packages to beautify Ruby and ERB code. Moreover, the indentation and trailing whitespace removing ability of these editors are enough to beautify/format the ERB files, though they have menu items/ shortcuts to do this on-demand/selectively too.
If you are using Sublime Text, check out this "Sublime Text 2 & 3 Plugin to BeautifyRuby":
https://github.com/CraigWilliams/BeautifyRuby
Once installed via Sublime's Package Control System you can use the shortcut ctrl + alt + k (on Windows + Linux) or ctrl + cmd + k (on OS X) to beautify your Ruby and erb-files manually - or configure the plugin to do that automatically before saving any Ruby- and erb-file. Configuration is easy - you find the config-file here (via the Sublime- menu):
Preferences > Package Settings > BeautifyRuby > Settings - Default:
{
// Specify your ruby interpreter (below). (Note, if you are using a linux distro with Rbenv instead of RVM, then try the following path: "ruby": "~/.rbenv/shims/ruby")
"ruby": "~/.rvm/bin/rvm-auto-ruby",
// Use 2 Spaces instead of tabs:
"translate_tabs_to_spaces": true,
"tab_size": 2,
// You can change the file patterns handled by this plugin:
"file_patterns": ["\\.html\\.erb", "\\.rb", "\\.rake", "Rakefile", "Gemfile", "Vagrantfile"],
"html_erb_patterns": ["\\.html\\.erb"],
// This package offers a pre-save hook; when activated, your ruby and erb files will
// be reformatted automatically before saving (deactivated by default)
"run_on_save": false,
// The sublime command "beautify_ruby" performs a save after formatting.
// (activated by default)
"save_on_beautify": false
}
BeautifyRuby depends on the Ruby gem htmlbeautifier, which needs to be installed on your system first. Otherwise the plugin throws an error each time you try to beautify your code. Make sure, the ruby-interpreter-setting in the config file shown above points to the correct ruby which holds the htmlbeautifier-gem...
I know that question has been asked and answered before, I have the code I think is the right, but I can't figure it out the right syntax, I think is about the quotes and double quotes.
I'm using phonegap version 2.9, in version 2.2 I could open an external link in Safari, but I had to upgrade to 2.9 or apple won't accept my app. and of course the external links will open inside the app without the back button.
This is an app that links to a mysql database with php trough Json.
This is the part I'm having problems:
if (employee.web) {
$('#actionList').append('<li><a href="#" onclick="window.open("http://' + employee.web + '", "_system");"><h3>Website</h3> ' +
'<p>' + employee.web + '</p></a></li>');
}
This worked perfect without the onclick option (but of course in phonegap version 2.9 it opens inside the application and get stuck there).
But now is just not doing anything when I click on it.
I've been many days trying to solve this problem and is the only thing I need to complete my application.
Yeah, your quotes are a bit messed up. Doing this inline can get hairy to say the least. I would separate my HTML from my JS by creating a separate function. Try something like the below:
if (employee.web) {
$('#actionList').append('<li><h3>Website</h3><p>' + employee.web + '</p></li>');
}
function openLink(url){
window.open('http://' + url, '_system');
}
I desperately need a solution for this... I m using Blackberry JDE 5.0. In documentation it shows net.rim.device.api.util.MathUtilities.pow ( double double ) is added form 4.6. But i couldnt get pow function when i use Math.pow().
I need to get this value...float fSecondFactor=(float) (Math.pow(1+fRatePerMonth,fNumberofMonths)-1);
Can anyone tell me how to achieve this...Plzz....
i blogged about this a while ago- posted a link there to a good article on it
http://bryanallott.net/blog/2010/01/to-the-power-of-by-hand.html
Thanks MAX for ur support.... as you said, MathUtilities.pow, instead of Math.pow worked...