oh hai.

CSS Global Clear with SASS

Posted: October 23rd, 2008 | Author: Nick | Filed under: css, sass | Tags: , , , | 1 Comment »

I’m a big fan of Haml and Sass, they basically spring clean your views. I always use a global clear in my main CSS file and went ahead and transferred the regular CSS code over to Sass. Only took 5 minutes but comes in handy for future uses so that you can have everything in one file.

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6,
p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del,
dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub,
sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td
  :margin 0
  :padding 0
  :border 0
  :outline 0
  :font-weight inherit
  :font-style inherit
  :font-size 100%
  :font-family inherit
  :vertical-align baseline
  :background transparent


MerbCamp: Day 1, first half

Posted: October 11th, 2008 | Author: Nick | Filed under: merb | Tags: , | No Comments »

Ezra’s Keynote - Talks about the original pastie of Merb and what it is now.  Goes through the core pieces of Merb and the reason why everything is separated.  Modularity is one of the key features of Merb, remove what you don’t need, add in what you do.  This philosophy helps to keep merb fast and get out of your way, no code is faster than no code. Also talks about how competition is good, but it’s not about saying “my framework can kick your framework’s ass”. Merb 1.0RC is also going to be dropping tomorrow and once any of the bugs are worked out the full release will be pushed. Merb-stack is going to be a more rails approach to merb.  The merb-stack will include things like jquery and datamapper with it.  I believe it is still in the works but this should be a good  jump start for noobs to merb. Nanite is a new project that Ezra is working on that looks like it is going to be really promising, basically it helps balance the load between the frontend processes and the running applications which will help with scaling.

Merb plumbing (routes) - Saw some really cool routing examples, very excited about this. A couple key points.

  • You can have optional parameters
  • You can do lookups in your route and then direct to an action such as login without even hitting the controller.  Saves overhead.
  • Added a way to define routes for subdomains
  • Lots of nesting and blocks

MerbSlices - This is going to be amazing. Basically it is a mini merb app within an application.  For instance with a CMS you could throw in a slice for your Press Room that handles everything specific to that.  We should be able to get to the point where we can have our main application and then throw in 10 slices to complete our application.  The main app will coordinate everything between the different slices.  With slices you can clone over the assets(images/javascript/css) and define routes for any slice so if you have a slice for your press room then you could define a route that is /press and the slice would actually exists in /merb.root/slices/press_slice

Testing Merb Apps - Katz talked about how we need to be doing testing based on what the url in question should return.  Not  through a certain helper or controller but more based on if we ping /users/do_login we should get back a User object.

MerbAuth - This is going to be a very much used slice.  Basically with this slice in place it integrates all of the login functionality you would normally have to program for each application. Once it is put in place you can do things like session.authenticated?, session.abandon, and session.authenticate

I’ll post more links from within each talk when I get a chance. back to more merbcamp.


Merb - generate sample database.yml file

Posted: October 7th, 2008 | Author: Nick | Filed under: merb | Tags: | No Comments »

If your merb version doesn’t generate a sample database.yml file you can do it manually by running the following rake command.

rake dm:db:database_yaml


Merb Generators - Resource, Resource Controller, and Layouts

Posted: October 7th, 2008 | Author: Nick | Filed under: merb | Tags: | No Comments »

Merb has some handy generators via merb-gen and I wanted to provide further clarification on a couple of them, merb-gen resource, merb-gen resource_controller, and merb-gen layout.

  • Resource Controller - Generates a controller, empty helper file, and associated views. The controller comes with the standard actions index, show, new, edit, delete, create, update, destroy with just the render command in each action.
  • Resource - Does the same as the resource controller but adds the model into the equation.
  • Layout - With Merb you can generate layout files, the nice thing is that it generates all of the standard html you need such as the doctype declaration, the html frame and catch_content.  The merb-gen layout also takes a look at which templating system you are using.  For instance if you are using haml, which I highly recommend it will generate the layout in haml instead of erb or regular html.

For resource and resource controller if you have your ORM specified it will fill in all of the regular code that goes along with the typical methods.  So for the new action Merb will go ahead and write out everything that is needed for a basic approach to that method.  This is a great starting point for your typical controllers but when you need something more custom you might as well go with your standard controller generator.

To destroy any of your generations just rerun the command that you used to generate it and add the -d trigger to the end of your command.  This is the mirror of script/generate destroy.


Free Pass to MerbCamp

Posted: September 24th, 2008 | Author: Nick | Filed under: merb | Tags: , | No Comments »

I just won a free pass to MerbCamp from Engine Yard!  See everyone in San Diego!