Skip to content

Instantly share code, notes, and snippets.

@rhnasc
rhnasc / linktree.md
Last active October 22, 2023 18:58
Link tree
# good
## deploy 1, by Mariah
Rails.cache.fetch ['v1', 'entities', id, timestamp] do
SomeCustomDataStructure.new
end
## deploy 2, John incremented the version :)
Rails.cache.fetch ['v2', 'entities', id, timestamp] do
SomeCustomDataStructureOpsIChanged.new
end
# very BAD
## deploy 1, by Mariah
Rails.cache.fetch ['entities', id, timestamp] do
SomeCustomDataStructure.new
end
## deploy 2, John just introduced a cache bug!
Rails.cache.fetch ['entities', id, timestamp] do
SomeCustomDataStructureOpsIChanged.new
end
entity.touch
=> true
entity.cache_key
=> stores/170519-20170127070432006502000
# stale key was ...62728637756000
entity = Entity.last
=> #<Entity:0x007f8f40739ca0
id: 170519,
created_at: Wed, 11 Jan 2017 19:00:24 UTC +00:00,
updated_at: Fri, 27 Jan 2017 06:27:28 UTC +00:00>
entity.cache_key
=> "entities/170519-20170127062728637756000"
# "#{collection_name}/#{id}-#{updated_at}"
@rhnasc
rhnasc / functional_chemicals.elm
Last active November 9, 2016 22:15
Sorting an electrosphere with functional programming - elm
import Html exposing (text)
import Array
arr =
Array.fromList [ Array.fromList ["1s2"]
, Array.fromList ["2s2", "2p6"]
, Array.fromList ["3s2", "3p6", "3d10"]
, Array.fromList ["4s2", "4p6", "4d10", "4f14"]
, Array.fromList ["5s2", "5p6", "5d10", "5f14"]
, Array.fromList ["6s2", "6p6", "6d10"]