View

Outlook deletes iCalendar ICS eMails and moves them to trash folder

We sometimes send calender data or tasks using iCalendar (ICS) via eMail as specified in RFC 5545.

Recently, a customer noticed that Outlook automatically moved eMails containing such ICS data to deleted items folder and shows the events as tentative on calendar.
This problem is reported on TechNet, for example.

It …

Use bundle open to open a gem's code in your $EDITOR

bundle open BUNDLED_GEM will open the BUNDLED_GEM's source code in your default editor.

Consul 0.10.0 allows multiple power mappings for nested resources

Consul 0.10.0 now allows multiple power mappings for nested resources.


When using nested resources you probably want two power
checks and method mappings: One for the parent resource, another for the child resource.

Say you have the following routes:

resources :clients do
  resources :notes
end

And the following power definitions:

class Power
  ...

  power :clients do
    Client.active if si...

Spreewald 0.6.1 makes it easier to inspect form values

The new version of Spreewald makes it easier to inspect form values.

Testing the value of any type of input control

  • When the step Then the "foo" field should contain "bar" is applied to a <select>, it now tests against option labels, not option values.
  • This is now consistent with Then "bar" should be selected for "foo".
  • This means you can now use Then the "foo" field should contain "bar" is applied to a <select> for all types of input …

Output for custom migrations

When you're writing migrations that do more than changing tables (like, modify many records) you may want some output. In Rails > 3.1 you have two methods at hand: announce and say_with_time.

In the migration:

```
class AddUserToken < ActiveRecord::Migration

class User < ActiveRecod::Base; end

def up
add_column :users, :token, :string

announce "now generating tokens"
User.find_in_batches do |users|
  say_with_time "For users ##{users.first.id} to ##{users.last.id}" do
    users.each do |user|
    ...

Git & Mac: Working with Unicode filenames

I had some problems with Git and the file spec/fixtures/ČeskýÁČĎÉĚÍŇÓŘŠŤÚŮÝŽáčďéěíňóřšťúůýž. After pulling the latest commits, it would show that file as untracked, but adding and committing it would throw error: pathspec 'check in unicode fixture file once again' did not match any file(s) known to git.

Solution

Install Git version > 1.8.2 using homebrew and set

git config --global core.precomposeunicode true

Done.

Reason

According to the linked Stackoverflow post …

… the cause is the different im…

Custom RSpec matcher for allowed values (or assignable_values)

In contrast to RSpec's included allow_value matcher, the attached matcher will also work on associations, which makes it ideal for testing assignable_values.

Usage example

```
describe Unit do

subject { FactoryGirl.build(:unit) }

describe '#building' do

it 'should only allow buildings that a user has access to' do
  user = FactoryGirl.build(:user)
  granted_building = FactoryGirl.create(:building)
  denied_building = FactoryGirl.create(:building)

  Power.with_power(Power.new(user)) do
    P...

Raise when there's a I18n translation missing

The translation method translate and its alias t have bang brothers: translate! and t!. They will raise I18n::MissingTranslationData on a missing translation instead of printing a string like translation missing: de.custom.failure.

To turn on raising globally, you need to replace the default exception handler. The attached initializer makes I18n just raise any exception (in a development or test environment).

External content

Font Awesome: List of Unicode glyphs and HTML entities

A list of FontAwesome icons in the form of copyable Unicode characters or HTML entities.

You might prefer to use FontAwesome by simply typing out these characters instead of using CSS classes. Of course you need to then give the containing element as style:

font-family: FontAwesome
External content

Font sizing with rem - Snook.ca

CSS3 comes with new unit rem. It works like em but it is always relative to the <html> element instead of the parent element.

rem units are supported by all browsers and IE9+.

The "private" modifier does not apply to class methods or define_method

Ruby's private keyword might do a lot less than you think.

"private" does not apply to class methods defined on self

This does not make anything private:

class Foo

  private

  def self.foo
    'foo'
  end
  
end

You need to use private_class_method instead:

class Foo

  def self.foo
    'foo'
  end
  
  private_class_method :foo
  
end

"private" does not apply to define_method ——————————–…

Capybara: Trigger requests with custom request method

Preface: Normally, you would not need this in integrations tests (probably that's why it is so hard to achieve), because it is no actual "integration testing". If you use this step, know what you are doing.


Destroying a record with Capybara is not as easy as calling visit user_path(user, method: :delete), because RackTest's visit can only perform GET requests.

With this step you can destroy a records using either Selenium or RackTest. Ex…

External content

Parallel gem installing using Bundler

Bundler 1.4.0 (still beta) can install gems in parallel, making a run of bundle install much faster.

Getting rid of space between inline-block elements

When two elements with display: inline-block are sitting next to each other, whitespace between becomes a space character.

Solutions, in decreasing order of awesomeness:

  1. Don't have whitespace between two elements! See Whitespace Removal in Haml if you're using Haml.
  2. Don't use inline-block. Use floating elements instead (don't forget to clear them!).
  3. Try to compensate for the space with a negative margin. Unfortunately you will never be able to negate …

Nested controller routes (Rails 2 and 3)

In order to keep the controllers directory tidy, we recently started to namespace controllers. With the :controller option you can tell Rails which controller to use for a path or resource. For nested resources, Rails will determine the view path from this option, too.

That means the following code in routes.rb

resources :users do
  resource :profile, controller: 'users/profiles' #[1]
end

… makes Rails expect the following directory structure:

```
app/
controllers/
users/
profiles_controller.rb
users_control…

External content

Simple Naming for Modular CSS Class Names ··· Nico Hagenburger

An opinion how to implement BEM. I don't agree with all of Nico's choices, but I applaud his approach to compile a simple and short list of rules.

Firefox file upload breaks after a few megabytes

  • A short browsing revealed that this may be a current firefox issue
  • Current workaround: use another browser
  • If you have further helpful information, please notify me
View
3474 cards