This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import XMonad.Layout.IM | |
| import XMonad.Layout.PerWorkspace | |
| import XMonad.Layout.Reflect | |
| main = do | |
| xmonad defaultConfig | |
| { layoutHook = onWorkspace "gimp" gimp } | |
| where | |
| gimp = withIM (0.11) (Role "gimp-toolbox") $ | |
| reflectHoriz $ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Array | |
| def <=(value) | |
| size_self = self.size | |
| size_value = value.size | |
| return false if self.size > value.size | |
| return true if self.size < value.size | |
| if size > 1000 | |
| value = value[0..10] | |
| end | |
| value.each_with_index do |v, i| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Array | |
| def <=(value) | |
| size_self = self.size | |
| size_value = value.size | |
| return false if self.size > value.size | |
| return true if self.size < value.size | |
| value.each_with_index do |v, i| | |
| return false if v < self[i] | |
| end | |
| return true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Array | |
| def <=(value) | |
| size_self = self.size | |
| size_value = value.size | |
| return false if self.size > value.size | |
| return true if self.size < value.size | |
| value.each_with_index do |value, i| | |
| return false if value < self[i] | |
| end | |
| return true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| desc 'Print out all unused routes' | |
| task :unused => :environment do | |
| all_routes = ActionController::Routing::Routes.routes | |
| routes = all_routes.collect do |route| | |
| name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s | |
| verb = route.conditions[:method].to_s.upcase | |
| segs = route.segments.inject("") { |str,s| str << s.to_s } | |
| segs.chop! if segs.length > 1 | |
| reqs = route.requirements.empty? ? "" : route.requirements.inspect | |
| {:name => name, :verb => verb, :segs => segs, :reqs => reqs} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| desc 'Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.' | |
| task :routes => :environment do | |
| all_routes = ENV['CONTROLLER'] ? ActionController::Routing::Routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : ActionController::Routing::Routes.routes | |
| routes = all_routes.collect do |route| | |
| name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s | |
| verb = route.conditions[:method].to_s.upcase | |
| segs = route.segments.inject("") { |str,s| str << s.to_s } | |
| segs.chop! if segs.length > 1 | |
| reqs = route.requirements.empty? ? "" : route.requirements.inspect | |
| {:name => name, :verb => verb, :segs => segs, :reqs => reqs} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class String | |
| def compute | |
| @size = self.size | |
| @even = @size % 2 == 0 | |
| if @even | |
| @pos1 = (@size/2)-1 | |
| @pos2 = @pos1+1 | |
| else | |
| @pos1 = (((@size+1)/2)-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class String | |
| def compute | |
| @size = self.size | |
| @even = @size % 2 == 0 | |
| if @even | |
| @pos1 = (@size/2)-1 | |
| @pos2 = @pos1+1 | |
| else | |
| @pos1 = (((@size+1)/2)-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #SIGABRT | |
| class Palindrome | |
| def compute(value) | |
| @size = value.size | |
| @even = @size % 2 == 0 | |
| if @even | |
| @pos1 = (@size/2)-1 | |
| @pos2 = @pos1+1 | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Array | |
| def <=(value) | |
| @self_size = self.size | |
| @value_size= value.size | |
| return false if @self_size > @value_size | |
| tmp = true | |
| for iterator in @self_size-1..0 | |
| tmp = false if self[iterator] > value[iterator] | |
| end |