Jumat, 11 April 2014

Rails (Rack::Utils) HTTP Status Codes and Symbols

ruby -e 'require "rack/utils"; puts Rack::Utils::SYMBOL_TO_STATUS_CODE.map{|s,c| "|" + c.to_s.center(5) + "|" + s.inspect.center(60) + "|" + Rack::Utils::HTTP_STATUS_CODES[c].to_s.center(60) + "|"}.join("\n")'
| 100 |                         :continue                          |                          Continue                          |
| 101 |                    :switching_protocols                    |                    Switching Protocols                     |
| 102 |                        :processing                         |                         Processing                         |
| 200 |                            :ok                             |                             OK                             |
| 201 |                          :created                          |                          Created                           |
| 202 |                         :accepted                          |                          Accepted                          |
| 203 |               :non_authoritative_information               |               Non-Authoritative Information                |
| 204 |                        :no_content                         |                         No Content                         |
| 205 |                       :reset_content                       |                       Reset Content                        |
| 206 |                      :partial_content                      |                      Partial Content                       |
| 207 |                       :multi_status                        |                        Multi-Status                        |
| 208 |                     :already_reported                      |                      Already Reported                      |
| 226 |                          :im_used                          |                          IM Used                           |
| 300 |                     :multiple_choices                      |                      Multiple Choices                      |
| 301 |                     :moved_permanently                     |                     Moved Permanently                      |
| 302 |                           :found                           |                           Found                            |
| 303 |                         :see_other                         |                         See Other                          |
| 304 |                       :not_modified                        |                        Not Modified                        |
| 305 |                         :use_proxy                         |                         Use Proxy                          |
| 306 |                         :reserved                          |                          Reserved                          |
| 307 |                    :temporary_redirect                     |                     Temporary Redirect                     |
| 308 |                    :permanent_redirect                     |                     Permanent Redirect                     |
| 400 |                        :bad_request                        |                        Bad Request                         |
| 401 |                       :unauthorized                        |                        Unauthorized                        |
| 402 |                     :payment_required                      |                      Payment Required                      |
| 403 |                         :forbidden                         |                         Forbidden                          |
| 404 |                         :not_found                         |                         Not Found                          |
| 405 |                    :method_not_allowed                     |                     Method Not Allowed                     |
| 406 |                      :not_acceptable                       |                       Not Acceptable                       |
| 407 |               :proxy_authentication_required               |               Proxy Authentication Required                |
| 408 |                      :request_timeout                      |                      Request Timeout                       |
| 409 |                         :conflict                          |                          Conflict                          |
| 410 |                           :gone                            |                            Gone                            |
| 411 |                      :length_required                      |                      Length Required                       |
| 412 |                    :precondition_failed                    |                    Precondition Failed                     |
| 413 |                 :request_entity_too_large                  |                  Request Entity Too Large                  |
| 414 |                   :request_uri_too_long                    |                    Request-URI Too Long                    |
| 415 |                  :unsupported_media_type                   |                   Unsupported Media Type                   |
| 416 |              :requested_range_not_satisfiable              |              Requested Range Not Satisfiable               |
| 417 |                    :expectation_failed                     |                     Expectation Failed                     |
| 422 |                   :unprocessable_entity                    |                    Unprocessable Entity                    |
| 423 |                          :locked                           |                           Locked                           |
| 424 |                     :failed_dependency                     |                     Failed Dependency                      |
| 425 | :reserved_for_webdav_advanced_collections_expired_proposal | Reserved for WebDAV advanced collections expired proposal  |
| 426 |                     :upgrade_required                      |                      Upgrade Required                      |
| 509 |                        :unassigned                         |                         Unassigned                         |
| 428 |                   :precondition_required                   |                   Precondition Required                    |
| 429 |                     :too_many_requests                     |                     Too Many Requests                      |
| 431 |              :request_header_fields_too_large              |              Request Header Fields Too Large               |
| 500 |                   :internal_server_error                   |                   Internal Server Error                    |
| 501 |                      :not_implemented                      |                      Not Implemented                       |
| 502 |                        :bad_gateway                        |                        Bad Gateway                         |
| 503 |                    :service_unavailable                    |                    Service Unavailable                     |
| 504 |                      :gateway_timeout                      |                      Gateway Timeout                       |
| 505 |                :http_version_not_supported                 |                 HTTP Version Not Supported                 |
| 506 |         :"variant_also_negotiates_(experimental)"          |           Variant Also Negotiates (Experimental)           |
| 507 |                   :insufficient_storage                    |                    Insufficient Storage                    |
| 508 |                       :loop_detected                       |                       Loop Detected                        |
| 510 |                       :not_extended                        |                        Not Extended                        |
| 511 |              :network_authentication_required              |              Network Authentication Required               |

Rabu, 02 April 2014

uninstall all gems linux

curl -Ls https://gist.github.com/nixpulvis/5042764/raw/7daa611e707f1884eb701551464bfd1dc9e7a953/gem-reset | ruby

Sabtu, 06 Juli 2013

Sharing gems (or any files really) from lubuntu to windows

Continuing from my previous post about developing rails using lubuntu vm as rails server, I need to have access to gem files inside lubuntu from windows for viewing its sources..

At first I tried to use virtual box shared folders to store rbenv/gems files but it cause many problems in ruby or at the very least it result in a very slow performance (especially when gems are loading)

After many many sleepless nights (dramatization) I finally succeed by using samba and sharing the gems via (virtual) network with the following steps..

Jumat, 28 Juni 2013

Developing Rails in Windows using Linux Server



Developing rails/ruby app in windows is painful as many gems aren't compatible or optimized for windows. But windows is OS that I'm most comfortable with.. Linux (ubuntu) lack some tools that I need and I simply hate OSX (stupid keyboard layout and hardware restriction), so I prefer dealing with gem problems rather than changing OS..

But then it occurred to me, why not just use virtual machine with linux for server? And turns out it's pretty neat.. And I think some people are too use windows as main OS so I posted here the step for setting up linux vm for rails..