View

Xfce: Configure multiple monitors

If you don't want to mess around with arcane incantations inside xorg.conf, you can use the graphical arandr tool:

sudo apt-get install arandr
arandr

If all your monitors are stacked in the same space, the space is not wide enough and you can't really move them, you need to switch to a proprietary driver. If it works with the open source driver for you, do not bother using another one.

For ATI cards:
  • install fglrx and fglrx-amdcccle
  • reboot
  • run the ATI configuration tool (amdcccle; if the binary is unavail…

How to find out a pixel's transparency with Gimp

If you have a PNG and want to know a pixel's alpha channel value, you can use Gimp:

  • Use the color picker tool
  • Hold the Shift key while clicking the pixel

A window will appear, containing color information, including the alpha channel.

External content

Freetile.js

Freetile is a plugin for jQue­ry that en­ables the or­ganiza­tion of web­page con­tent in an ef­ficient, dynamic and re­spon­sive layout. It can be applied to a con­tain­er ele­ment and it will at­tempt to ar­range it's childr­en in a layout that makes opt­im­al use of scre­en space, by "pack­ing" them in a tight ar­range­ment

Capybara 2.0 has been released

The gem author Jonas Nicklas highlights in a Google Groups post that the release

  • is not backwards compatible to 1.x versions of Capybara
  • does not support Ruby 1.8.x anymore
  • removes confusion with Rails' built in integration tests (you put capybara rspec integration tests into the spec/feature/... folder) and the :type metadata has been changed from :request to :feature
  • throws exceptions when trying to interact with an element whose identifier is…

uninitialized constant MysqlCompat::MysqlRes (NameError)

If you get a stacktrace complaining about uninitialized constant MysqlCompat::MysqlRes a system library update might broke your gem.

Try fully removing and re-installing the gem:

gem uninstall mysql
gem install mysql

Setup an Ubuntu mirror that enables local release upgrades

Setup the mirror by following the steps described here.

If you want to enable OS upgrades using do-release-upgrade make sure you include $release-proposed packages in the mirror script, e.g., precise-proposed. Additionally, you have to add main/dist-upgrader-all to the $section in your script as debmirror silently ignores some directories.

I attached our modified script to include current releases

Enable Ubuntu release upgrade from the local mirror ————————————–…

Xfce: Take a screenshot with the "Print" key

  • Go to Settings Manager / Keyboard / Application Shortcuts
  • Add a shortcut for the Print key that calls xfce4-screenshooter -f

This may be configured for you by default.

How to change the mouse pointer in Xfce

Unlike in Gnome, there is no graphical tool to set a mouse cursor in Xfce. Run this on a terminal instead:

sudo update-alternatives --config x-cursor-theme

You need to sign out and back in for your changes to have an effect.

Zeus promises to make rails development faster

I am talking about development speed. When your application starts growing and you start adding gems, it starts to take really long to start up, be it the server, console or just running a single spec.

Zeus is smart, you don’t have to put it in your Gemfile or run it with Bundler, all you need to do is create a JSON config file via zeus init and then start the server zeus start.

After that, you’re ready to go, all you need to do is prefix every command with zeus. That means rails server becomes zeus server, `rails console…

Andand and SimpleDelegator

The very useful andand gem does not play very nice with Ruby's SimpleDelegator (or vice versa).

This following will not work:

class MyDecorator < SimpleDelegator
  def foo
  end
end

MyDecorator.new(Object.new).andand.foo

The reasons are a bit subtle, basically SimpleDelegator will "force" some methods to be delegated, so the andand method is called on the wrapped object, not the delegator.

You can fix it like this:

class Decorator < SimpleDelegator
  def an...

Xfce: How to change the default program for a file extension

This is super stupid:

  • In the Thunar file manager, select the file
  • Go to File / Properties / Open With (WTF!)
  • Select the preferred application from the list and hit "Set default"

This setting will apply to all files with that extension.

How to set the default monospace font on Xfce (Xubuntu)

While you can set your own font in your terminal or other tools, it will not change the default "Monospace" font that some applications use.

To change that, edit ~/.fonts.conf and add settings for the "monospace" family. Here is how it looks on my machine now:

```

monospace DejaVu Sans Mono

Rails 2: Calling instance_eval on a scope will trigger a database query

In Rails 2, when calling instance_eval or instance_exec on a scope, the scope will fetch its records from the database.

This has been fixed in Rails 3+.

External content

imgAreaSelect - image selection/cropping jQuery plugin

imgAreaSelect is a jQuery plugin for selecting a rectangular area of an image. It allows web developers to easily implement image cropping functionality, as well as other user interface features, such as photo notes (like those on Flickr).

A jQuery plugin for producing bar charts from tables.

As the title says: this jQuery plugin creates bar charts from HTML tables. It comes in some different flavors.

Check the examples page: http://alphagov.github.com/magna-charta/.

External content

Using sets for many-to-many relationships

A technique to vastly reduce the number of join model records that need to be stored in the database.

The technique is only effective when there is a high redundancy in your data, e.g. combinations of the same 20 tags are used to label thousands of books.

The technique is also limited in that your join models cannot have additional logic, such as attributes or callbacks.

Ther has-many-with-set gem is an implementation of this technique.

How to move a window to the next monitor on Xfce (Xubuntu)

Unfortunately, Compiz does not play nice with Xfce for me and Xfce itself does not offer a way to move a window to the next monitor.

Since I use this a lot in my daily work and there were no scripts working properly for me, I made one myself.
It's actually not bound to Xfce but should work on any window manager (haven't tried it, though).

Installation

  1. If you don't yet have xdotool, install it:

    sudo apt-get install xdotool
    
  2. If you don't yet have wmctrl, install it:

    sudo apt-get install wmctrl
    
  3. Store the att…

CSS: Vertically center with display: table-cell

Note: We have card with all CSS centering options. You probably want to head over there and get an overview over what techniques are available for your use case and browser requirements.


The classical scenario: There's a parent div element and you want to center some arbitrary child element vertically inside of it. Here's how you do it (also try this jsfiddle).

The children need to be block e…

View
3197 cards