List of Compass Mixins
Since we are migrating from our homegrown mixins.sass
and helpers.sass
to Compass, here is a list of all the mixins provided by Compass.
Responsive Elements - Helps you build better responsive websites
Responsive elements makes it possible for any element to adapt and respond to the area they occupy.
This is different from media queries which always refer to the screen width, not the element's width.
dusen and edge_rider gems no longer depend on Rails
dusen 0.4.8 and edge_rider 0.2.3 no longer depend on Rails (they still depend on ActiveRecord). That means you can use them e.g. with Sinatra.
Building Custom Text Strikethroughs with CSS
Did you know you can color your line-throughs or underline, or make them wavy like spell-checkers do?
Normalising Designs For Better Quality CSS
Awesome slide deck about taking liberties with design requirements in order to keep the CSS simple.
Concerned about Concerns?
With Rails 4, Concerns have become the “official” solution to the big-models problem. However, there’s a fair amount of controversy about this topic in the community. Not everyone is convinced that Concerns are the “right“ solution to the problem of AR models becoming too big.
In this talk we will see what Rails Concerns are and how can we use them to keep our models fit. More interestingly, we’ll discuss the trade-offs of this technique, the different views in the community and a couple of alternatives.
What are the best programming fonts?
Long list of fonts suitable for coding. With screenshots.
4 Lessons Learned Doing Angular on Rails
We’ve been working on one of our first Angular projects with a Rails backend. It’s been a great experience. I wanted to share a few things we learned that we hope are helpful to others building Angular on Rails apps.
.rvmrc deprecated in favor of .ruby-version and .ruby-gemset
Do not use .rvmrc
files to specify Ruby version and gemset configuration any longer, it's deprecated and not considered by other Ruby version managers such as rbenv.
If you want to migrate an existing .rvmrc
you can use rvm rvmrc to .ruby-version
.
Put gemset specification into .ruby-gemset
.
Creating the .ruby-version
file on your own, just make a file containing e.g.
1.8.7
Attention: Don't clutter other developers rvms with several unecessary ruby patch levels
When you use the rvm command
rvm --ruby-version use 1....
redshift
For all late night coders:
The program "redshift" changes your monitors' white balance according to your position on the planet and your local time. This is supposed to put less strain on your eyeballs than staring at a "daylight white" screen all day and night.
The program is in the Ubuntu repositories, so a simple "sudo apt-get install gtk-redshift" transfers it onto your hard drive.
I find the effect rather pleasing and so I have set the following alias on my computer:
alias rdshft='gtk-redshift -l 48.3714407:10.8982552 -t 6500:4200 &'...
"cannot load such file -- nokogiri/nokogiri" (or any other Gem with native extensions on rvm and Ruby >= 2)
After running bundler / gem install I could not load nokogiri lately. It died with cannot load such file -- nokogiri/nokogiri
.
This is not a problem of the gem but is due to a broken native extensions installation routine.
When installing nokogiri manually and with verbose output by using gem install -V nokogiri -v 1.5.6
, you can see the problem scrolling by when the native extension is built:
/usr/bin//install -c -m 0755 nokogiri.so /home/thomas/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.5.6/lib/home/thomas/.rvm/rubies/ruby-2.0.0-p...
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 ...
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...
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.
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).
Parallel gem installing using Bundler
Bundler 1.4.0 (still beta) can install gems in parallel, making a run of bundle install
much faster.
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...
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:
- Don't have whitespace between two elements! See Whitespace Removal in Haml if you're using Haml.
- Don't use
inline-block
. Use floating elements instead (don't forget to clear them!). - Try to compensate for the space with a negative margin. Unfortunately you will never be able to negate ...
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
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...
Rails: Output helpers for 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|
...
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+.
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.