24 April 2014

The Ruby Reflector

Topic

Mixins

  Source Favicon
Email

Using Sass 3.2 block mixins, Neat makes it extremely easy to build responsive layouts. The breakpoint() mixin allows you to change the total number of columns in the grid for each media query. You can store these values in project-wide variables to DRY up your code: $mobile: max-width 480px 4;

When used as a breakpoint() argument, $mobile instructs Neat to use a 4 column grid in mobile-size viewports: .my-class { @ include breakpoint($mobile) { @ include span-columns(2) …

robots.thoughtbot.com Read
  Source Favicon
Email

Sass 3.2 has finally come out last week as a stable release, bringing in a slew of new features to help you write cleaner and more maintainable stylesheets. Here are some modern web development techniques that leverage these features.

Content blocks

Mixins can now accept blocks of content using the new @ content syntax. This opens the doors to DRY up your media queries and browser hacks. What used to be: article { width: 70%;

@ media screen and (min-width: 54em) { width: 100%; } }

robots.thoughtbot.com Read
  Source Favicon
On ZURB almost 2 years ago.
Email

Christmas, so to speak. But we do want to give you a head's up as to what's to come. Here's a few things you can expect:

New tab styles

New button styles

Semantic grid mixins

CSS3 triangle mixin

New UI Elements

We're really excited to be able to finally release Foundation 3 into the wild. Most of all, we can't wait to hear what all of you think about it and see what you do with it.

zurb.com Read
  Source Favicon
By Justin Leitgeb of Justin Leitgeb almost 2 years ago.
Email

About Mixins

Before going into the disadvantages of Mixins as a method of code organization, it's important to understand their intended use in Ruby and other languages. Mixins are intended to provide a mechanism for multiple inheritance without some of the complexity that this brings into a programming language. The notion of mixins isn't new in Ruby, and the idea of using groups of related methods that are injected into a class was widely discussed before Matz starting …

justinleitgeb.com Read
  Source Favicon
By Peter Cooper of Ruby Inside almost 3 years ago.
Email

Modules and Mixins

Files and IO

YAML

Marshal

Regular Expressions

Threads

Debugging and Testing

Ruby on Rails

Dynamic Programming

In Conclusion

It's pleasant to read Huw's writing. He panders to the reader just the right amount and strikes a good balance between being over-familiar and dull. You'll enjoy his explanations and find his pacing pleasant for the most part, even if the depth isn't always there. As Steve Klabnik said on a ruby-talk …

rubyinside.com Read
  Source Favicon
Email

…inheritance and interface implementation) and Ruby (through class inheritance and multiple mixins).

Mixins, coupling issues and the single responsibility principle

The example of "over usage" of inheritance and mix-ins: Rails has greatly improved web applications productivity due to its Convention over Configuration approach. Still, its internal design choices show some famous object oriented design issues. Between those, one that is easily spotted is the need to inherit …

guilhermesilveira.wordpress.com Read
  Source Favicon
By Peter Cooper of Ruby Inside 3 years ago.
Email

Use Modules As Mixins

Use Blocks To Iterate

Execute Around With A Block

Save Blocks To Execute Later

Use Hooks To Keep Your Program Informed

Use method_missing For Flexible Error Handling

Use method_missing For Delegation

Use method_missing To Build Flexible APIs

Update Existing Classes With Monkey Patching

Create Self Modifying Classes

Create Classes That Modify Their Subclasses

Invent Internal DSLs

Build External DSLs For Flexible Syntax

rubyinside.com Read
  Source Favicon
By techarch of The "Tech. Arch." almost 4 years ago.
Email

Intro

It is pretty common nowadays for web applications and sites to expose a developer API to allow consumers to integrate their data with other application. Examples: Twitter, LinkedIn, Bit.ly, etc.

Although there are various options for implementing web services, as of 2010, the REST protocol seems to have achieved a comfortable lead over other approaches for Internet -based resource-oriented services.

RESTstop is a Ruby library making it easy to implement REST services

blog.monnet-usa.com Read
  Source Favicon
By techarch of The "Tech. Arch." almost 4 years ago.
Email
  Source Favicon
On Developing with Style almost 5 years ago.
Email

…inherit from another class would involve you having to create a complicated chain of inheritance. Mixins eliminate that need. Just create a class, inherit from another class, and then mixin as many modules as you want.

RUBY module Movement def run puts "I'm running!" end def walk puts "I'm walking a bit briskly!" end def crawl puts "I'm so slowwww!" end end

class Man include Movement def jump puts "I'm …

developingwithstyle.com Read