You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
💜
James Harton
jimsynz
💜
I love writing software, making things and sailing boats around in circles.
Principal consultant at @team-alembic and @ash-project core team member.
A half-finished blog post about using recursive CTEs with Ash.
Relationships to recursive common table expressions
Let me lead by saying that this is a probably a bad idea and if you're
starting from scratch you should instead look at using a Postgres extension
like ltree instead.
Recently I was working on a client's application and they have a Location
resource which represents a physical location. Locations are a tree - ie they
have a belongs_to :parent_location, Location relationship that if loaded
essentially performs a self-join on the locations table. Likewise it has a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to use Semantic UI's visibility module with Semantic UI Ember.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Weighted reference counting is more efficient than traditional reference counting because you don't have to update the reference counted object every time a reference is taken (potentially meaning updating the object on the heap and blowing the processor cache). Weighted reference counting only updates the referenced object when a reference is dropped or when weight is exhausted.
Weight Reference Counting is also really good for concurrent systems because the number of synchronisations needed is much lower than normal reference counting.
Algorithm overview:
Allocate a new reference counted object with a default weight (a tunable power of two - usually around 1 << 16 for a real implementation). An initial reference is allocated which points to the object and the weight value is copied into it. Every time the reference is cloned, the weight is split in two (shifting one bit to the right is the same as dividing by two) and one half allocated to the existing reference and one
Try and guess where to push branches to based on convention.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters