Skip to content

Instantly share code, notes, and snippets.

Avatar

Ernest ErnestK

View GitHub Profile
View api_controller.rb
# project/app/controllers/api_controller.rb
class ApiController
def render_response(serializer:, result:)
if result.success?
render json: serializer.new(result.value!).serializable_hash
else
render json: { errors: [result.failure] }
end
end
end
View operation.rb
class OperationService
attr_reader :errors, :params
# always run
def sstep!(action)
begin
result = method(action).call
add_errors(step_name: action, errors: result) if NEGATIVE_RESULTS.include? result
rescue => ex
add_errors(step_name: action, errors: ex.message)
View flexbox-table-with-const-header.markdown
@ErnestK
ErnestK / index.html
Created Jul 26, 2016
Really Responsive Tables using CSS Flexbox (complex)
View index.html
<div class="page">
<div class="page-header">
<div class="table-row">
<div class="column index">#</div>
<div class="wrapper attributes">
<div class="wrapper title-comment-module-reporter">
<div class="wrapper title-comment">
<div class="column title">Title</div>
<div class="column comment">Comment</div>
@ErnestK
ErnestK / index.html
Created Jul 26, 2016
Really Responsive Tables using CSS Flexbox (complex)
View index.html
<div class="container-fluid">
<div class="table-row header">
<div class="column index">#</div>
<div class="wrapper attributes">
<div class="wrapper title-comment-module-reporter">
<div class="wrapper title-comment">
<div class="column title">Title</div>
<div class="column comment">Comment</div>
</div>
<div class="wrapper module-reporter">