Skip to content

Instantly share code, notes, and snippets.

View ahx's full-sized avatar

Andreas Haller ahx

View GitHub Profile
@ahx
ahx / bench.md
Last active June 10, 2024 10:02
openapi_first v1 vs v2

Related to ahx/openapi_first#262

Version 2 (main)

(git)-[main]- benchmarks % b ruby benchmarks.rb apps/openapi_first.ru 
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
Warming up --------------------------------------
apps/openapi_first.ru
                         1.000 i/100ms
@ahx
ahx / datavshash.rb
Created June 6, 2024 14:31
Comparing performance of Data vs Hash in Ruby
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'benchmark-ips'
gem 'benchmark-memory'
end
@ahx
ahx / throwvsraise.rb
Created June 6, 2024 14:30
Comparing performance of throw vs raise in Ruby
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'benchmark-ips'
gem 'benchmark-memory'
end
@ahx
ahx / cursor-pagination.md
Last active November 17, 2022 21:13
Example implementation of cursor-based pagination

Example implementation of cursor-based pagination

This shows how one can paginate throug a list of tenants with id and name using two different sortings. The limit is always 2.

Data used

Table: tenants

id name
1 a
@ahx
ahx / results.md
Last active June 24, 2024 09:18
openapi_first benchmark comparison

Check out openapi_first: https://github.com/ahx/openapi_first

These are the results running these benchmarks (code).

openapi_first 2.0.0

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
Warming up --------------------------------------
 ./apps/committee.ru     1.000 i/100ms
@ahx
ahx / openapi_first-committee-comparison.md
Last active June 24, 2024 09:08
Comparing openapi_first and committee

This is a feature comparison of openapi_first and committee

I will try to keep this updated. Please create an issue if you see something wrong/missing here.

JSON Schema validation

Most of these differences are because openapi_first uses json_schemer, which has build in support for OpenAPI 3.1 where committee/openapi_parser currently ships it's own implementation.

Feature openapi_first committee

Keybase proof

I hereby claim:

  • I am ahx on github.
  • I am ahx (https://keybase.io/ahx) on keybase.
  • I have a public key ASBSrbMPKIOib3rD_NwUTx_Q2NdBDg6VrachPzYVumBF9go

To claim this, I am signing this object:

JSON:API

Your anti bikeshedding weapon.

By following shared conventions, you can increase productivity, take advantage of generalized tooling, and focus on what matters: your application.

jsonapi.org


{
@ahx
ahx / object.js
Created April 23, 2015 06:07
How to make Ember never auto-generate ObjectControllers (deprecated), but normal Controllers
// Add this file: app/controllers/object.js – Done.
// Ember.ObjectController will be removed in Ember 2.0 and auto-generated ObjectControllers
// cause deprecation warning since Ember 1.11.
// This file is here so ember does not generate ObjectControllers anymore.
// See https://github.com/emberjs/ember.js/blob/06e41ad7ccd28558dd4e651aa070bc06f7757821/packages/ember-routing/lib/system/generate_controller.js#L11-L26
import Ember from 'ember';
export default Ember.Controller;