$ rails g model User
belongs_to
has_one
### | |
Disclaimer: | |
This gist is opinionated. It favors the usage of dashes over underscores. | |
http://stackoverflow.com/questions/7560813/why-are-dashes-preferred-for-css-selectors-html-attributes | |
License: | |
Free, Opensource, MIT | |
http://opensource.org/licenses/MIT | |
Usage: | |
Your HTML should be something like: | |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
/*-- credits: http://jsfiddle.net/josedvq/38Tnx/ --*/ | |
.square-box{ | |
position: relative; | |
width: 50%; | |
overflow: hidden; | |
background: #4679BD; | |
} | |
.square-box:before{ | |
content: ""; |
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
end |
activate :blog do |blog| | |
blog.prefix = 'blog' | |
blog.defaultextension = '.markdown' | |
blog.sources = 'articles/{category}/{title}' | |
blog.permalink ='{category}/{title}' | |
blog.summary_separator = /(READMORE)/ | |
blog.layout = '/blog/bloglayout' | |
blog.tagtemplate = 'tag.html' | |
blog.calendartemplate = 'calendar.html' | |
# Enable pagination |
#http://stackoverflow.com/questions/4150782/using-yaml-with-variables | |
key : 'This is the foobar var : %{foobar}' | |
content = file['key'] | |
modified_content = content % { :foobar => foobar } |
def before_render(&block) | |
(@_before_render ||= []) << block | |
end | |
def render() | |
@_before_render.each(&:call) | |
end |