Skip to content

Instantly share code, notes, and snippets.

BY DEFAULT, these layouts apply:
magento.test/app/design/frontend/base/default/layout
This is overridden by theme layouts on a per-file basis:
magento.test/app/design/frontend/base/theme042/layout
These can be overridden by layouts stored on a per-page basis in the database. These are accessed through:
admin backend > CMS > Pages > *A Page* > Design > *The top box*
mv magento.test magento.test.WORKING
git clone [email protected]:53cr/Magento.git
mv Magento magento.test
cd magento.test
git pull origin cityjewellers
select{margin-bottom:1px; height:21px;}
input{height:15px;}
.full-width{width:100%;}
.ie-fix{width:100%; position:relative;}
.container{width:100%; overflow:hidden;}
.clear{clear:both;}
.radio, checkbox{border:0; background:0;}
.pages-indent{padding:17px;}
$.getJSON("<%=raw @yt_request%>", function(data) {
<!-- markup structure -->
<table>
<tbody>
<tr>
<td>*CONTENT ONE*</td>
<td>*CONTENT TWO*</td>
</tr>
</tbody>
</table>
<!-- html snippet -->
<div class="wrapper_div">
This is some text that I do not want to see in the output
<div class="inner_div">
This is some text that I want to see in the output
</div>
</div>
## routes.rb
match "blog" => "blog#index"
match "blog/:year/:month" => "blog#by_date", :constraints => {:year => /\d{4}/, :month => /\d{2}/}, :as => 'blog'
match "blog/:tag" => "blog#by_tag", :as => 'blog'
##a view:
= link_to "Foo", blog_path(:tag => "bar")
##it tries to route it to the second route, realizes the bound params don't match what the route specifies, and shits
class Post < ActiveRecord::Base
scope :date_counts, lambda {
group('DATE_FORMAT(created_at, "%Y/%m")').count
}
##Post.date_counts GENERATES ERROR: ArgumentError: Unknown key(s): 2009/01, 2009/02, 2009/03, 2009/04, 2009/06 ... etc
def self.date_counts
self.group('DATE_FORMAT(created_at, "%Y/%m")').count
end
##in view:
link_to "TEST", blog_path(:year => 2010, :month => 09)
##when routes looks like:
match 'blog', => 'blog#index'
match 'blog(/:year/:month)' => 'blog#index'
@eqdw
eqdw / heredoc.rb
Created November 4, 2010 21:04
scary ruby syntax!
string = [<<ONE, <<TWO, <<THREE]
the first thing
ONE
the second thing
TWO
and the third thing
THREE
# evaluates to:
# ["the first thing", "the second thing", "and the third thing"]