Gemfile
gem 'rails_config'
config/settings/development.yml
mailer:Gemfile
gem 'rails_config'
config/settings/development.yml
mailer:This post shows how to make sitemap.xml for your web site. The sitemap will be accessible by URL http://mysite.com/sitemap.xml
Myrails::Application.routes.draw doBy default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.
| /** | |
| * IE 5.5+, Firefox, Opera, Chrome, Safari XHR object | |
| * | |
| * @param string url | |
| * @param object callback | |
| * @param mixed data | |
| * @param null x | |
| */ | |
| function ajax(url, callback, data, x) { | |
| try { |
This gist provides a simple JavaScript implementation of the non-standard WebKit method scrollIntoViewIfNeeded that can be called on DOM elements.
Just use the code in index.js in your app or website. You can see usage in the test page test.html.
The parent element will only scroll if the element being called is out of the view. The boolean can force the element to be centered in the scrolling area.
| (function() { | |
| // Do not use this library. This is just a fun example to prove a | |
| // point. | |
| var Bloop = window.Bloop = {}; | |
| var mountId = 0; | |
| function newMountId() { | |
| return mountId++; | |
| } |
| var dom = Bloop.dom; | |
| var Box = Bloop.createClass({ | |
| getInitialState: function() { | |
| return { number: 0 }; | |
| }, | |
| updateNumber: function() { | |
| this.state.number++; | |
| }, |