Skip to content

Instantly share code, notes, and snippets.

View igkuz's full-sized avatar

Igor Kuznetsov igkuz

  • Tiny
  • Valencia, Spain
View GitHub Profile
b_email:
padding_top: 95
padding_left: 25
padding_right: 275
padding_bottom: 100
margin_bottom: 200
module A
class B
c = C.new
end
end
module A
class B
class C
end
chef.json = {
:rvm => {
:user_installs => [{
:user => 'vagrant',
:default_ruby => 'ruby-1.9.3-p194',
:rubies => ['ruby-1.9.3-p194'],
:global_gems => [{ :name => 'bundler'}]
}],
:vagrant => {
:system_chef_solo => '/var/lib/gems/1.8/bin/chef-solo'
includes:
- styles/paginator.yml
- styles/buttons.yml
- styles/table.yml
- styles/menu.yml
- styles/pages.yml
- styles/player.yml
- styles/inputs.yml
class ErrorsController < ApplicationController
respond_to :json, :html
def not_found
# some code here
end
def internal_error
respond_with(...)
def not_found
respond_with({:message => "Not Found"}, :status => :not_found)
end
def internal_error
respond_with({:message => "Internal Server Error"}, :status => :internal_server_error)
end
def unprocessable_entity
respond_with({:message => "Unprocessable Entity"}, :status => :unprocessable_entity)
match '/404', :to => "errors#not_found"
match '/500', :to => "errors#internal_error"
match '/422', :to => "errors#unprocessable_entity"
config.exceptions_app = self.routes
@igkuz
igkuz / schema.json
Last active December 18, 2015 11:38
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Product",
"description": "List object",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "integer"
},
json.meta do |json|
json.total @lists.total_count
json.num_pages @lists.num_pages
json.per_page @per_page
end
json.items @lists do |json, list|
json.partial! "maillist", maillist: list
end