Search_spinner Cross_grey Magnifier
help

Search syntax

  • Search for repeating cards with repeats:yes
  • Search for unfinished cards with unfinished:yes
  • Search for cards in a certain topic with topic:"name"
  • Search for phrases with "a phrase"
  • Exclude a word from search: -word
  • Exclude a phrase from search: -"a phrase"
  • Exclude a topic from search: -topic:"name"

Opening images with 100% zoom in Photoshop

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:

  • pressing Ctrl-Alt-0 (on Windows; for Mac it’s Meta-Alt-0)
  • or double-clicking the magnifier tool icon.

External content

gammons/fake_arel - GitHub

Gem to get Rails 3’s new ActiveRecord query interface (where, order) and the new scope syntax (chaining scope definitions) in Rails 2.

You also get #to_sql for scopes.

How to install a specific version of RubyGems (and how to downgrade)

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:

sudo 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:

sudo 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 it…

Git: What to do when "git log" does not show commits that touch a file

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.

Note that tig also understands --follow.


Kudos to Julien…

How to organize and execute cucumber features (e.g. in subdirectories)

In cucumber you are able to run features in whatever directory you like. This also includes executing features in subdirectories. There are only some things you have to take care of.

By default, cucumber loads all *.rb files it can find (recursively) within the directory you passed as argument to cucumber.

$ cucumber # defaults to directory "features"
$ cucumber features
$ cucumber my/custom/features/dir

So, if you would like to organize features in subdirectories, you won’t have *any problems when running the whole test…

How to create Excel sheets with spreadsheet gem and use number formats for cells like money or date

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...
External content

HTML5 Please: Use the new and shiny responsibly

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.

External content

marcandre/backports - GitHub

Gem to get Ruby 1.9 features in Ruby 1.8.

External content

jQuery UI Bootstrap

Twitter’s Bootstrap CSS blueprint as a jQuery UI theme. Even if you don’t want to use Bootstrap as a CSS framework, this theme looks better than jQuery UI’s default theme.

External content

A very brief primer to thinking in XPath

A short tutorial for XPath. It’s the first XPath introduction that ever stuck with me.

How to print Github wiki pages

I have no idea how it’s supposed to work (or why the don’t have a print CSS), but this works for pages written with Markdown:

  1. “Edit” the wiki page
  2. Copy all text
  3. Run a Markdown interpreter and pipe its result, e.g.: kramdown > /tmp/github.html
  4. Paste your markdown
  5. Press Ctrl-D to finalize your input
  6. Open the generated HTML file and print it.

O_o

Using Solr with Sunspot

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
 ...

Enabling view rendering for controller specs

Views are normally (for good reason) not rendered in controller specs. If you need it to happen, use:

RSpec 1 (Rails 2):
integrate_views
RSpec 2 (Rails 3):
render_views

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...
External content

colszowka/simplecov - GitHub

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.

New geordi script: migrate-all

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:migrate if parallel_tests does not exist in your Gemfile
  • Otherwise it runs b rake db:migrate and then executes b rake parallel:prepare if parallel_tests was found in your Gemfile.

How to revert features for deployment, merge back, and how to stay sane

Removing features and merging those changes back can be painful. Here is how it worked for me.\ tl;dr: Before merging back: reinstate reverted features in a temporary branch, then merge that branch.

Scenario

Consider your team has been working on several features in a branch, made many changes over time and thus several commits for each feature.\
Now your client wants you to deploy while there are still stories that were rejected previously and can’t be deployed. …

Repeat an element on every printed page with CSS

Firefox, Opera and Internet Explorer will repeat elements with position: fixed on every printed page (see attached example).

The internet knows no way to do this in Webkit browsers (Chrome, Safari). These browsers will only render the element on the first printed page.

2827 cards