Project

General

Profile

unexist.dev

Assorted tidbits and projects

Snippets » History » Version 1

Anonymous, 05/30/2009 11:38 PM

1 1
h1. Recipes\015\012\015\012This page shows small snippets that might be useful:\015\012\015\012{{>toc}}\015\012\015\012h2. Rotate\015\012\015\012This will rotate the windows on the current view clockwise.\015\012\015\012<pre><code class="ruby">\015\012"S-KP_Divide" => lambda {\015\012  current_view.clients.each do |c|\015\012    c.gravity = \015\012      case(c.gravity)\015\012        when 7: 8\015\012        when 8: 6\015\012        when 9: 6\015\012        when 6: 2\015\012        when 3: 2\015\012        when 2: 4\015\012        when 1: 4\015\012        when 4: 8\015\012      end\015\012  end  \015\012}\015\012</code></pre>\015\012\015\012h2. Swap\015\012\015\012This two snippets toggle the gravity mode of two windows\015\012\015\012<pre><code class="ruby">\015\012"S-KP_Add" => lambda {\015\012  current_view.clients.each do |c|\015\012    c.gravity = \015\012      case(c.gravity)\015\012        when 4: 4.to_mode33.to_horz\015\012        when 6: 6.to_mode66.to_horz\015\012        when 8: 8.to_mode33.to_vert\015\012        when 2: 2.to_mode66.to_vert          \015\012      end\015\012  end\015\012}\015\012</code></pre>\015\012\015\012<pre><code class="ruby">\015\012"S-KP_Subtract" => lambda {\015\012  current_view.clients.each do |c|\015\012    c.gravity = \015\012      case(c.gravity)\015\012        when 4: 4.to_mode66.to_horz\015\012        when 6: 6.to_mode33.to_horz\015\012        when 8: 8.to_mode66.to_vert\015\012        when 2: 2.to_mode33.to_vert\015\012      end\015\012    end\015\012}\015\012</code></pre>