Skip to content

Instantly share code, notes, and snippets.

View diegodurs's full-sized avatar
💭
Developing the best connected urban e-bike

Diego d'Ursel diegodurs

💭
Developing the best connected urban e-bike
View GitHub Profile
@diegodurs
diegodurs / benchmark_hash.rb
Created June 16, 2015 12:50
Benchmark with_indifferent_access & symbolize_keys Hash
require 'active_support/core_ext/hash'
require 'benchmark'
Benchmark.bm do |x|
x.report("string") do
1_000.times do
data_str = {
"id" => "06e99a1b-4020-4380-ab27-1a3e0c5e557c",
"type" => "Person",
"score" => "100",
@diegodurs
diegodurs / db_artists.md
Last active December 5, 2015 16:25
What the heck is EventSourcing & CQRS ? SQL tables
id name
1111 The Beatles
@diegodurs
diegodurs / db_events.md
Created December 5, 2015 16:26
What the heck is EventSourcing & CQRS ? Event table
event id event name payload
1234 artist_was_created artist_id: 1111, name: 'Beatles'
1235 artist_name_was_corrected artist_id: 1111, new_name: 'The Beatles'
1236 performance_was_claimed_on_recording performance_claim_id: 7171, user_id: 2222, recording_id: 3131, performance: 'singer'
@diegodurs
diegodurs / google_key_val.rb
Created January 9, 2018 12:02
KeyVal on Google Datastore
require 'google/cloud/datastore'
module Ruba
# This use the Google Datastore as a key value storage.
# One could argue that Memcache would be more appropriate.
# usage:
#
## class DoSomething
## include GoogleKeyVal
##