- Search for repeating cards with
- Search for unfinished cards with
- Search for cards in a certain topic with
- Search for phrases with
- Exclude a word from search:
- Exclude a phrase from search:
- Exclude a topic from search:
In order to chain greps on log files that are opened via
tail -f test.log you have to use the
--line-buffered command line option for
Imagine you have the following content in your log file.
# content for log/test.log test foo bar test foo bar baz bla
Now if you would like to grep for lines that contain foo but not bar, you can use the following command chain:
$ tail -f log/test.log | grep --line-buffered "foo" | grep -v "bar" Output: test foo
The following snippet demonstrates how you could create excel files (with spreadsheet gem) and format columns so that they follow a specific number format like currencies or dates do.
require 'rubygems' require 'spreadsheet' Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => 'test' money_format = Spreadsheet::Format.new :number_format => "#,##0.00 [$€-407]" date_format = Spreadsheet::Format.new :num...
Look up HTML5 features, know if they are ready for use, and if so find out you should use them – with polyfills, fallbacks or as they are.
Gem to get Ruby 1.9 features in Ruby 1.8.
If you want to move a complete commit from one repository to another (and you don't want to add it as a remote), you can use these steps:
Create a patch
In the source repository, create a patch based on the commit by running
git format-patch SHA1_OF_COMMIT~..SHA1_OF_COMMIT
This will create a
.patch file that describes this commit.
Apply the patch
In the target repository, apply the patch with
git apply PATH_TO_PATCH
If the patch does not apply cleanly, git will not do anything. I…
git diff only shows unstaged changes against
HEAD (or any hash or branch you supplied) but leaves out files you already staged for the next commit.
To diff your added changes, say:
git diff --cached
Effectively, this gives you the changes you will commit when you run
git commit without the
This describes all the steps you'll need to get Solr up and running for your project using the Sunspot gem.
Prepare Sunspot on your development machine
What you want in your Gemfile:
gem 'sunspot_rails' gem 'sunspot_solr' gem 'progress_bar' # for sunspot:solr:reindex
Now define what should be indexed within Solr from your ActiveRecord models, e.g.,
class Article << ActiveRecord::Base searchable do text :title ...
Views are normally (for good reason) not rendered in controller specs. If you need it to happen, use:
Note that you can't use that inside
it blocks but need to put it in the nesting example group, like this:
describe '#update' do context 'when ren...
Code coverage for Ruby 1.9 with a powerful configuration library and automatic merging of coverage across test suites.
Note that rcov won't ever have support for Ruby 1.9, you're supposed to use rcov for 1.8 and simplecov for 1.9.
Use the command
geordi migrate-all to migrate your databases and to prepare them before running tests. The abbrevation
geordi m works as well.
- It will run
power-rake db:migrateif parallel_tests does not exist in your Gemfile
- Otherwise it runs
b rake db:migrateand then executes
b rake parallel:prepareif parallel_tests was found in your Gemfile.
If you defined your association via
class Article belongs_to "category" end
and you try
Article.scoped(:include => :category)
you will get an error message
in `preload_one_association': Association named 'category' was not found; perhaps you misspelled it? (ActiveRecord::ConfigurationError)
Always define your assocations via symbol
class Article belongs_to :category end
You want Photoshop to always open files with "full" (100%) zoom and not try to fit them to your screen?
Tough luck – there is no setting for this.
But, after opening the file, you can zoom to 100% by:
0(on Windows; for Mac it's
- or double-clicking the magnifier tool icon.
Gem to get Rails 3's new ActiveRecord query interface (
order) and the new scope syntax (chaining scope definitions) in Rails 2.
You also get
#to_sql for scopes.
Sometimes you want one distinct version of RubyGems to be installed to replicate the same behavior across multiple servers.
Usually would do this to update your RubyGems, but this always takes you to the latest version:
gem update --system
While there are ways around the interwebs that use the
rubygems-update package and call its
setup.rb, there is an undocumented switch you can use:
gem update --system 1.3.7
This updates to the given version, 1.3.7 in the above case, by walking the
rubygems-update package way itself.
Let's say you have commits that change a file (and looking at the commit details show you the changes, etc). Now, when you do a
git log you see them, but when you say
git log that.file these commits don't show up? This is for you.
The reason is that the file got deleted deleted/re-added/renamed (any or all of those).
Instead of …
git log master -- some.file
… you need to say:
git log --follow master -- some.file
Then your commits will show up.
tig also understands
Kudos to Julien…