This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_filter :newer_browser_required | |
def newer_browser_required | |
# ref http://pastie.org/203799 | |
# reject MSIE 5.0 and MSIE 6.0 | |
browser_access_denied if request.user_agent =~ /msie\s+[5,6]\.\d+/i | |
end | |
def browser_access_denied |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= f.error_messages | |
%div{:style=>"padding-bottom:20px"} | |
%div | |
= f.label :name, 'Nombre del producto' | |
%br | |
= f.text_field :name, :size => 70 | |
#clientdesc | |
%div | |
= f.label :excerpt, 'Resumen del producto' | |
%br |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# God please, | |
# | |
# Generic Monitor | |
# | |
def generic_monitoring(w, options = {}) | |
w.interval = 30.seconds # default | |
w.start_if do |start| | |
start.condition(:process_running) do |c| | |
c.interval = 10.seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
# url dsl -- the ultimate url dsl! | |
# | |
# You just can't beat this: | |
# | |
# $ irb -r url_dsl | |
# >> include URLDSL | |
# => Object | |
# >> http://github.com/defunkt.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- # app/views/posts/_post.html | |
%h1= post.title | |
... | |
%p Actions: | |
%ul | |
- # checking the authorizations on the view... | |
%li= edit_post_path(post) if current_user.can?(:update, post) | |
%li= post_path(post) if current_user.can?(:read, post) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
recent_photographs GET /photographs/recent(.:format) {:action=>"recent", :controller=>"photographs"} | |
photographs GET /photographs(.:format) {:action=>"index", :controller=>"photographs"} | |
photograph GET /photographs/:id(.:format) {:action=>"show", :controller=>"photographs"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if RAILS_ENV == 'production' | |
Paperclip.options[:command_path] = "/usr/bin" | |
else | |
Paperclip.options[:command_path] = "/usr/local/bin" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "should return a string as a latitude and longitude csv" do | |
it {should respond_to(:latlong)} | |
@p = Factory.create(:store) | |
@p.latlong.should equal("10.502792,-66.842322") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// geo-location bridge | |
function getLocation(callback){ | |
if (getLocation.cache) return callback(getLocation.cache); | |
if (Modernizr.geolocation) { | |
var geocallback = function(position) { | |
callback(getLocation.cache = { | |
"lat": position.coords.latitude, | |
"lon": position.coords.longitude, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
task :start do; end | |
task :stop do; end | |
desc "restart passenger server" | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | |
end | |
OlderNewer