class ApplicationController < ActionController::Base
def index
@a = url_for(:action => :index)
@b = url_for(:action => :index, :only_path => true)
end
end
This file contains 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 Numeric | |
def parity | |
(self.to_i % 2) == 0 ? 'even' : 'odd' | |
end | |
end | |
class Fixnum | |
LONG_MAX = ( (2 ** (64 - 2)) - 1 ) | |
INT_MAX = ( (2 ** (32 - 2)) - 1 ) |
This file contains 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
=begin | |
Util.relative_path('/any/path/to/root/foo/bar/a.png', :from => '/any/path/to/root') #=> 'foo/bar/a.png' | |
=end | |
module Util | |
require 'pathname' | |
require 'map' | |
This file contains 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
## | |
# cap production fast:deploy # taks about 3 seconds! | |
# | |
namespace :fast do | |
task :deploy do | |
run "cd #{ current_path } && git pull origin master 2>&1 && bundle install >/dev/null 2>&1 && touch tmp/restart.txt" | |
end | |
end |
This file contains 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
# hash ordering, combined with conversion, is very fragile | |
# | |
[1] pry(Site::Page)> attributes = args.extract_options!.to_options! | |
=> {:_id=>"54c004cab5b417316f000011", | |
:title=>"Atque cum ullam aliquid omnis aut.", | |
:path=>"atque-cum-ullam-aliquid-omnis-aut", | |
:body=> | |
"![itaque](/fake/images/tumblr_lu5gt565uZ1qe2jero1_1280.png \"Explicabo voluptatum expedita voluptatem voluptates dignissimos ipsum.\")\r\n\r\nlist\r\n------\r\n\r\n* one\r\n* two\r\n* three\r\n\r\nhttp://dojo4.com\r\n\r\n\r\nOmnis in est dicta amet non. Laudantium voluptatibus placeat officiis non commodi maxime aut. Aut deserunt omnis quod et quo velit. Dignissimos optio laboriosam iusto quia neque quisquam. At sed et.\r\n\r\nAlias neque non sint ipsum itaque. Consectetur unde nesciunt fuga atque. Voluptas dolores aut pariatur laboriosam.\r\n\r\n# heading 1\r\n## heading 2\r\n### heading 3\r\n \r\nhttp://dojo4.com\r\n\r\n\r\nIusto et assumenda beatae optio deleniti provident. Est laborum id voluptatem. Harum quas a possimus nemo |
This file contains 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
a:~ $ cat a.rb | |
(cb=proc{|*a| a.size < 42 ? cb.call('cb(', *a, ')') : a.join }).call(ARGV.shift).display | |
a:~ $ ruby a.rb 42 | |
cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(cb(42))))))))))))))))))))) |
This file contains 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
a-2:~/git/ahoward/fucking_favicons $ gem push pkg/fucking_favicons-1.0.0.gem | |
Pushing gem to https://rubygems.org... | |
<html> | |
<head><title>500 Internal Server Error</title></head> | |
<body bgcolor="white"> | |
<center><h1>500 Internal Server Error</h1></center> | |
<hr><center>nginx</center> | |
</body> | |
</html> |
This file contains 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
a-2:~/git/ahoward/systemu $ gem push pkg/systemu-2.6.5.gem | |
Pushing gem to https://rubygems.org... | |
Successfully registered gem: systemu (2.6.5) |