Create an .htaccess file in the webroot:
AuthUserFile /app/www/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user
Create a .htpasswd file:
htpasswd -c /app/www/.htpasswd [username]
| module ControllerHacks | |
| def get(action, parameters = nil, session = nil, flash = nil) | |
| process_action(action, parameters, session, flash, "GET") | |
| end | |
| # Executes a request simulating POST HTTP method and set/volley the response | |
| def post(action, parameters = nil, session = nil, flash = nil) | |
| process_action(action, parameters, session, flash, "POST") | |
| end |
| class RackSessionTestMiddleware | |
| class << self | |
| def session_data | |
| @@session_data||={} | |
| end | |
| def session_data=(value) |
| function getQueryVariable(variable) { | |
| var query = window.location.search.substring(1); | |
| var vars = query.split('&'); | |
| for (var i = 0; i < vars.length; i++) { | |
| var pair = vars[i].split('='); | |
| if (decodeURIComponent(pair[0]) == variable) { | |
| return decodeURIComponent(pair[1]); | |
| } | |
| } | |
| console.log('Query variable %s not found', variable); |
| # Render Partials in ECO-Templates like in Rails-ERB | |
| # | |
| # usefull to clean up structure in spine.js and other js-mvc´s like backbone | |
| # | |
| # usage: | |
| # <%- render_partial 'path/to/partial' %> .. will render ../spine-app/views/path/to/_partial.jst.eco | |
| # <%- render_partial 'path/to/partial', foo: 'bar' %> .. will render ../spine-app/views/path/to/_partial.jst.eco .. locals = @foo | |
| # | |
| window.render_partial = ( path, options = {} ) -> | |
| # add the leading underscore (like rails-partials) |
| namespace :assets do | |
| task :check => :environment do | |
| paths = ["app/assets", "lib/assets", "vendor/assets"] | |
| paths.each do |path| | |
| dir_path = Rails.root + path | |
| if File.exists?(dir_path) | |
| dir_files = File.join(dir_path, "**") |
Create an .htaccess file in the webroot:
AuthUserFile /app/www/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user
Create a .htpasswd file:
htpasswd -c /app/www/.htpasswd [username]
| require 'nokogiri' | |
| module ActionView | |
| module TemplateHandlers | |
| class Nokogiri < TemplateHandler | |
| include Compilable | |
| def compile template | |
| <<-eotemplate | |
| _set_controller_content_type(Mime::XML) |
| #Deploy and rollback on Heroku in staging and production | |
| class RakeHerokuDeployer | |
| def initialize app_env | |
| @app = ENV["#{app_env.to_s.upcase}_APP"] | |
| end | |
| def run_migrations | |
| push; turn_app_off; migrate; restart; turn_app_on; tag; | |
| end |
| # RSpec matcher to spec delegations. | |
| # | |
| # Usage: | |
| # | |
| # describe Post do | |
| # it { should delegate(:name).to(:author).with_prefix } # post.author_name | |
| # it { should delegate(:month).to(:created_at) } | |
| # it { should delegate(:year).to(:created_at) } | |
| # end |
| # This module allows you to prepend a version prefix to your Sinatra URLs | |
| # Example: | |
| # | |
| # require 'rubygems' | |
| # require 'sinatra/base' | |
| # | |
| # class App < Sinatra::Base | |
| # register Versioned | |
| # | |
| # set :version, 'v1' |