Warning: chmod(): Operation not permitted in /var/www/wanderwort/wp-includes/nav-menu.php on line 502 Warning: file_put_contents(/var/www/wanderwort/wp-includes/../.htaccess): failed to open stream: Permission denied in /var/www/wanderwort/wp-includes/nav-menu.php on line 503 Warning: chmod(): Operation not permitted in /var/www/wanderwort/wp-includes/nav-menu.php on line 504 Warning: touch(): Utime failed: Operation not permitted in /var/www/wanderwort/wp-includes/nav-menu.php on line 508 Wanderwort by Roman Ernst

Using Zurb Foundation with Middleman

April 11th, 2013

I became quite a fan of Zurbs latest Foundation (version 4). Now I’ve had a situation I wanted to use it within a Middleman app. The installation works mostly as it would for a Rails app and is well documented.

But when it comes to sprockets and load paths you likely fail requiring foundation in all.js:

//= require foundation
//  Is correct but will likely fail.

This is because sprockets doesn’t know where the javascript files of foundation are located. You therefore have to manually set it in your config.rb:

foundation_path = Gem::Specification.find_by_name('zurb-foundation').gem_dir
set :js_assets_paths, [File.join(foundation_path, 'js', 'foundation')]

Résumé einer Bahnfahrt

January 8th, 2013

Seitdem ich heute morgen um 6Uhr in den Zug gestiegen bin, beschäftige ich mich damit, dass ich kurz nach Fahrtantritt vom Zugbegleiter um 117€ erleichtert wurde, obwohl ich eine Fahrkarte für 135€ erstanden habe und diese (in elektronischer Form – und damit nicht AGB konform) vorgezeigt habe.

Read the rest of this entry »

Die Bahn, Herr L. und Betrug nach Paragraph

January 8th, 2013

Aktualisiert: Dieser Eintrag behandelt eine erste emotionale Reaktion auf Geschehnisse vom 08. Januar in einem ICE der Deutschen Bahn. Mittlerweile gibt es auch ein Résumé des gesamten Tages. Hier der erste Beitrag:

Read the rest of this entry »

En/De keyboard layout for programmers

November 20th, 2012

Because programming really sucks on german keyboards I ordered the international / english one this time. Despite the advancement in general hacking I really like to write some german texts without going through ‘press-key-for-10-seconds-while-holding-that-other-key’ mess.

That was the reason for writing this Layout using Ukelele.

Find it within the according Github Gist

Read the rest of this entry »

Real-time postgres activity tracking

July 9th, 2012

Keeping track of postgres activity in real-time is easy:

Postgres automatically tries to fetch it’s password from different sources:

Either save your password in an environment variable (which might be security issue)

$ export PGPASSWORD=#your-psql-password#

2. Or save it in ~/.pgpass

And use Unix’ watch to get contents from pg_stat_activity every 2 seconds:

$ watch "echo \"SELECT * FROM pg_stat_activity;\" | psql #your-database#"

Done. (Thanks Lee!)

Der Mob & direkte digitale Demokratie

January 21st, 2011

Kameraüberwachung in Dresden (Bildquelle)Die politische Elite steht unter Druck, am Stammtisch und im digitalen Netzwerk radikalisieren sich die Meinungen. Zeitweise beherrschen Knüppel und Blut vielerorts deutsche Strassen.
Seitdem 1992 Politikverdrossenheit zum Wort des Jahres erklärt wurde, passte das lange zu unserem allgemeinen Selbstverständnis als deutscher Michel. Politik: das wollten wir nicht, das konnten wir nicht, dafür war uns die Zeit zu schade. Facetten einer US-Amerikanern zugeschriebenen Eigenschaft blühten in deutschen Einfamilienhäusern. Im Land der unbegrenzten Möglichkeiten, wie nun hier, liege es zu allererstes in unserer eigenen, direkten Verantwortung wie wir leben und wie es uns geht. Repräsentanten des Volkes wurden offenbar einzig auf die Funktion ihrer internationalen und medialen Repräsentation degradiert.

Umso verhängnisvoller muss das Erlebnis einer zusammenbrechenden Finanzwelt in unsere Köpfe geprescht sein. Read the rest of this entry »

Dynamic model based styles for Paperclip

October 29th, 2010

One might want to set up dynamic attachment dimensions (or other styles) when generating images with thoughtbot’s paperclip. Styles in paperclip are basically represented in the :styles hash of has_attached_file:

class File
    :styles => { :thumb => "100x100" }

Building a related size model in rails might look the following:

class File < ActiveRecord::Base
  has_many :sizes, :class_name => "FileSize", :dependent => :destroy
    :styles => # styles through FileSize model
  def styles
   self.sizes.inject({ :thumb => "100x100" }) do |sizes, size|
      sizes[:"#{size.id}"] = "#{size.width}x#{size.height}"; sizes
class FileSize < ActiveRecord::Base
  belongs_to :file

Using a Proc we can fetch sizes from our FileSize model:

    :styles => Proc.new { |clip| clip.instance.styles }

Clip is the Paperclip instance which holds an instance-method to get back to the calling Class.

As a last issue one might want to reprocess / regenerated images after creating or destroying sizes:

class FileSize < ActiveRecord::Base
  belongs_to :file
  after_create  :reprocess
  after_destroy :reprocess
  def reprocess

Iterate over Associative Arrays in Bash

June 24th, 2010

Probably because many people think Bash is outdated it’s that hard to find proper resources digging into this Shell. Now we’ll have a look at an associative array and use each key to rename a file defined in value one got via wget.

Beware: Take a look at the OS X issues at the end of this article if working on a Mac!

unset array; declare -A array # the -A attributes stands for associative
array["spaced string"]="foo bar"
for i in ${!array[@]}
  # do something

This is how an iteration could look like. Have a look at bash-hackers.org to get more information. Thanks to Dennis Williamson solving this topic.

To get a file from the given URL perform the following command in the loop:

wget "${array[$i]}" -O "${i}.jpg"

The attribute -O renames the file.

Using variables outside Strings obviate the need for curly brackets so that $i would work as well.
Go on reading if you’re using a Mac:
Read the rest of this entry »

Cross-Domain with Sinatra / Rack and JSONP

March 25th, 2010

There are several situations one might want to do cross-domain (/cross-site) AJAX-requests. Probably you experience the security borders of modern browsers very fast.
JSONP is a hack for JSON that provides a great workaround. It means sending a callback with the URL (eg. ?callback=sampleFunction). Server-sided we setup our application to respond with a JSON body wrapped in a function named like our callback function. In this case

  "ourData": [{
    "title": "is an array"
    "title": "..."

What we have to do (Sample)

JS-Frameworks like jQuery are smart enough to send such requests with ease. Lets write a simple function with jQuery:

  type: 'get',
  url: 'file.json',
  dataType: 'jsonp',
  success: function(data) {

Let’s see how to setup the server:
Using Ruby and Rack it becomes very simple to beautifully provide regular JSON for non-JSONP clients and JSONP for jQuery & Co.
Simply use the rack middleware rack-contrib by Ryan Tomayko

gem install rack-rack-contrib --source=http://gems.github.com/

If you’re using pure rack, put this in your config.ru

require 'rack/contrib/jsonp'
use Rack::JSONP

Using Sinatra, I’d put it somewhere with my config files.
Let’s see how a sample Sinatra application could look like:

require 'sinatra'
require 'json'
require 'rack/contrib/jsonp'
use Rack::JSONP
before do
  content_type :json
get '/posts' do

That simple, this powerful.

InDesign: Sprache für ganzes Dokument ändern

March 8th, 2010

InDesign Es gibt zwei Möglichkeiten die Sprache für das Text- und Absatzformat in InDesign zu ändern. Wenn wir allerdings nicht für jedes Textfeld die Sprache ändern wollen, müssen wir uns eines Workarounds bedienen. Schließlich gibt es kein “Sprache für Dokument ändern”. Dann wollen wir mal:
Read the rest of this entry »