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) …
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%; } }
…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
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.
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 …
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 …
…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 …
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
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
[Module] Mixins (in Programming Ruby)
Extending Objects (in Programming Ruby)
Adding module behavior with module_eval (in Programming Ruby)
Fun with Ruby's instance_eval and class_eval (by Brian Morearty)
OAuth Integrations
Google OAuth for Web Applications
Tools
Taylor Singletary's (@ episod) OAuth Dancer Tool
…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 …