Questions tagged [mixins]

A mixin is a way to enhance an object with properties or methods from another object.

11 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
77 views

Creating companion classes that are `inherited` onto any sub-classes

The idea for the code I have written came about due to the acts_as_versioned gem which automatically nests a Version class onto ...
3
votes
0answers
71 views

Boilerplate-free mixin pattern for a TypeScript charting library

The TypeScript handbook provides a mixin pattern but it requires a bunch of boilerplate, doesn't work for getters/setters and doesn't support defining default values (or any constructor work) in the ...
3
votes
0answers
117 views

Extracting dynamic behaviors of state machines to modules

This is my initial class. (I am not trying to reinvent state-flows again, just practicing) As you can see straight forward, it dynamically generates methods like .recommend,.recommend!, ....
2
votes
0answers
78 views

Copy-on-write in Ruby

I need to return private collection and avoid calling code modifying them avoiding copying overhead if possible So I thought of returning copy-on-write arrays, hashes, and sets. I couldn't find any ...
2
votes
0answers
56 views

ActiveAdmin menu-generating mixin

I've written an ActiveAdmin mixin, such that you can include it and call simple_menu_for Foo, to reduce duplicate code when working with simple models. Here is the ...
2
votes
0answers
187 views

Mixin implementation helper

While implementing things like repositories we often can see that reading and writing parts can be done totally independently. The same time client side will win from the single reference (who wants ...
2
votes
0answers
130 views

Modification of the headline line-height in the Compass vertical rhythm module

One thing nagged me about the compass vertical rhythm module; in the case the headline is too long and it occupies more than one line the line-height between the two lines looks way too massive and ...
2
votes
0answers
261 views

Blade (similar to Jade) template with SCSS

I have this blade template with a main.scss file: ...
1
vote
1answer
111 views

Applying a set of styles both with a media query and with nested rules

I am working on an application which responds to different screen resolutions. At a certain minimum DPI, we want to apply a set of styles. We also want to apply that same set of styles if the class <...
1
vote
0answers
29 views

Sass-Mixin for to attach a text-shadow animation upon HTML-elements

I've make these mixins by using SCSS-Sass. Any hints and tipps concerning improvements are welcomed. ...
1
vote
0answers
38 views

IUnitTest, INonCopyable, and IMapKey mixins

I am creating a boiler-plate namespace that will allow me to ensure proper coding practices are followed and avoid gotchas. Looking over my code below; can you see any "no-no's" or gotchas? Can you ...