Since RubyMine 3.1 you can drag tabs across panes/windows and out of the main window to create new windows.
For any version below 3.1 do it like this (will only allow dragging tabs inside their pane, not across panes):
Seriously.
sudo apt-get install i8kutils
i8kmon
Setting the fan speed to high (2) will only work shortly as the fan is somehow controlled automatically.\
This helps you out in bash:
while true; do i8kfan - 2; sleep 0.2; done
There should be a better solution and it will be posted as soon as it's found.
Call with the server's hostname (and user if you have no SSH agent), e.g.
install-gems-remotely my.server.com
# or without agent:
install-gems-remotely me@my.server.com
When you call it from a rails directory, it uploads your Gemfile
, Gemfile.lock
as well as the gemspecs of all vendored gems in to a temporary folder on the server and does a bundle install
there.
If you need to install gems from anothere Gemfile, just do it like this:
BUNDLE_GEMFILE=Gemfile.something; install-gems-remotely my.server.com
This scri...
WMD is a simple, lightweight HTML editor for blog comments, forum posts, and basic content management. You can add WMD to any textarea with one line of code. Add live preview with one line more. WMD works in nearly all modern browsers, and is now completely free to use.
The following Haml will do:
%head{ :profile => 'http://www.w3.org/2005/10/profile' }
%link{ :href => image_path('favicon.ico'), :rel => 'icon', :type => 'image/vnd.microsoft.icon' }
Note that while you can link to icon formats other than .ico
, Internet Explorer is too stupid for that.
If you want to exclude your staging site from Google using robots.txt
without running the risk to forget deleting the file once you go live, name the file robots.exclude.txt
instead.
In your Apache Vhost config, rewrite requests for the staging server only:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^staging\.project\.com$
RewriteRule ^robots\.txt$ /robots.exclude.txt
Your robots.exclude.txt
looks like this:
# This file is returned for /robots.txt on staging servers
User-agent: *
Disallow: /
**Important ...
Our gem Mail Magnet allows you to override e-mail recipients in ActionMailer so all mails go to a given address.
This is useful for staging environments where you want to test production-like mail delivery without sending e-mails to real users.
This raises "Could not find first Keyword":
describe Keyword do
it { should validate_uniqueness_of(:text) }
end
Do this instead:
describe Keyword do
it 'should have a unique #text' do
Keyword.make
should validate_uniqueness_of(:text)
end
end
This is the intended behavior.
There will probably be better solutions as we become more experienced with using Bundler, and more command line tools become Bundler-aware.
b
will use bundle exec
if there is a Gemfile
in the working directory, and run the call without Bundler otherwise.
b spec spec
This script is part of our geordi gem on github.
A jQuery plugin that sets a div or span to show a countdown to a given time
This post explains, in some detail, how we will implement a nice performance boost for Rails developers. Understanding the details might help gain the full benefits of the optimization, but you will gain some benefits even if you have no idea how it works.
Capistrano task for Bundler.
Captify is a plugin for jQuery written by Brian Reavis (@brianreavis) to display simple, pretty image captions that appear on rollover
This gem is designed to provide CSS views to Rails, and a process to concatenate and minify these files to one file for production.
Physical servers worked, EC2 did not.
If you added a file by mistake, you can unstage it (but keep local changes) by saying
git reset HEAD path/to/file
This is also what git status
will tell you.
NB: It works for conflicts, too, if git checkout -- <file>
does not (although git tells you it would).
The ECB has an XML feed with EURO exchange rates to other currencies. It is updated daily.
Put
def task_with_hoptoad_notification(options)
task(options) do
begin
yield
rescue Exception => e
Airbrake.notify(e)
raise e
end
end
end
at the top of the Rakefile, and replace all relevant
task :my_task => :environment do
do_something
end
with
task_with_hoptoad_notification :my_task => :environment do
do_something
end
This will use the usual notification rules, i.e. you won't get anything in the development or test environments.
...
In a great post about named routes in Rails, path vs. url, Viget Labs ponders which variant is best used.<br />
<br />
Most often we use foo_path, which when used in Rails URL helpers will generate a relative path, where foo_url generates a full URL. In most cases the path makes most sense, but not always.
The box shadows created rendered in IE by CSS3PIE look darker and are blurred differently than in browsers that render box-shadow
natively.
If possible, try to be OK with this. If not, make an IE-only stylesheet that uses a different color and blur radius:
// Real browsers:
+box_shadow("0 4px 10px #bbb")
// IE with PIE:
+box_shadow("0 5px 15px #888")
We should try to package this solution in a neat way so we don't need different stylesheets.
See also this [cross-browser box-shadow comparison]...
The state_machine gem ships with a scope with_state
. This scope has some problems in complex queries or scope chains.
Use this instead:
named_scope :having_state, lambda { |*state_or_states|
state_or_states = Array.wrap(state_or_states).map(&:to_s)
{ :conditions => [ 'articles.state IN (?)', state_or_states ] }
}
If you want a scope with hash options (with the side effects you should know about):
named_scope :having_st...
Cached fonts WILL caused an unstyled flash of text.
Bundler requires Rubygems >= 1.3.6. Run gem update --system
if you have an older version.
It also is not compatible with older versions of passenger, so bring that up to date as well (2.2.15 works).
If you installed RubyGems through apt (which you should never do!), you may see a message giving you a hint to use apt to update.
Some people advise to install the 'rubygems-update-1.3.7' gem on Ubuntu systems if you used apt to install RubyGems.
I did that - and lost all...
This might eventually be fixed by Rails itself.\
Right now this is the way to have the rails_xss plugin not escape the body of ActionMailer mails.
Put this into config/initializers/mailers_without_rails_xss.rb
: