Skip to content

Instantly share code, notes, and snippets.

@ErnestK
ErnestK / index.html
Created July 26, 2016 12:37
Really Responsive Tables using CSS Flexbox (complex)
<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">
@ErnestK
ErnestK / index.html
Created July 26, 2016 13:30
Really Responsive Tables using CSS Flexbox (complex)
<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 / flexbox-table-with-const-header.markdown
Created July 27, 2016 12:21
Flexbox table with const header
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)
@ErnestK
ErnestK / api_controller.rb
Created November 21, 2018 11:36
Service example
# 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
This file has been truncated, but you can view the full file.
{
"openapi": "3.0.1",
"info": {
"title": "Api Documentation",
"description": "Api Documentation",
"termsOfService": "urn:tos",
"contact": {},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
Response Body:
################################################
data: {"id":"chatcmpl-907Yz9w2QY6XP2unCzOVC1OH5SeCq","object":"chat.completion.chunk","created":1709816101,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-907Yz9w2QY6XP2unCzOVC1OH5SeCq","object":"chat.completion.chunk","created":1709816101,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Sure"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-907Yz9w2QY6XP2unCzOVC1OH5SeCq","object":"chat.completion.chunk","created":1709816101,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":","},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-907Yz9w2QY6XP2unCzOVC1OH5SeCq","object":"chat.completion.chunk","created":1709816101,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" let"},"logprobs":nu