This file contains hidden or 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
| # cria a chamada aos arquivos js na seção head do seu html. | |
| # Para usa-lo acrescente <%= yield(:javascripts) %> na tag head do | |
| # html, depois chame o método em qualquer view, por exemplo: | |
| # <% javascript "jquery.collapsible", "jquery.datepick" %> | |
| def javascript(*files) | |
| content_for(:javascripts) { javascript_include_tag(*files) } | |
| end | |
| # semelhante a método javascript, cria uma chamada a <link rel... | |
| # incorporando folhas de estilo ao html. |
This file contains hidden or 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
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
| <html> | |
| <head> | |
| <title>CSS Tooltip</title> | |
| <style type="text/css"> | |
| a.tip { text-decoration:none;} | |
| a.tip:hover{ position:relative; z-index:100; } | |
| a.tip span{ display:none; } |
This file contains hidden or 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
| def help_tooltip(text) | |
| content = image_tag("layout/button_help.png", :style=>"vertical-align:middle;") | |
| content << content_tag(:span,text) | |
| content_tag(:a, content, :href=>"#", :onclick=>"return false;", :class => "tip") | |
| end |
This file contains hidden or 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 File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
| describe ApplicationHelper do | |
| it "should create tooltip for possible doubts" do | |
| tip = helper.help_tooltip("Explain the possible doubt.") | |
| tip.should have_tag("a[class=help_tooltip]") do | |
| with_tag("img[src^=?]", "/images/layout/button_help.png") | |
| with_tag("span", :text=>"Explain the possible doubt.") |
This file contains hidden or 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 IE 6]> | |
| <script type="text/javascript"> | |
| /*Load jQuery if not already loaded*/ if(typeof jQuery == 'undefined'){ document.write("<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js\"></"+"script>"); var __noconflict = true; } | |
| var IE6UPDATE_OPTIONS = { | |
| icons_path: "http://static.ie6update.com/hosted/ie6update/images/", | |
| message:"Este site não suporta o seu navegador atual. Clique aqui e atualize-o para Internet Explorer 8" | |
| } | |
| </script> | |
| <script type="text/javascript" src="http://static.ie6update.com/hosted/ie6update/ie6update.js"></script> | |
| <![endif]--> |
This file contains hidden or 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
| file = "" | |
| IO.foreach("log.csv") do |line| | |
| line = line.sub(/(18.*,)/, "") | |
| line = line.sub(/^Entrada,/, "") | |
| line = line.sub(/Saida,/, "") | |
| file << line | |
| end | |
| File.open( "users.txt", "w" ) do |f| |
This file contains hidden or 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
| # Basic auth with name, pass and ip region | |
| require "ipaddr" | |
| def login_from_basic_auth | |
| net = IPAddr.new(AppConfig['admin_network']) # something like 201.62.0.0/16 | |
| authenticate_with_http_basic do |username, password| | |
| username == AppConfig['admin_user'] && | |
| password == AppConfig['admin_password'] && | |
| net.include?(IPAddr.new(request.remote_ip)) | |
| end |
This file contains hidden or 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
| #CAPISTRANO TASK TO UPLOAD AND SYMLINK YOUR SSL FILES | |
| #For it works you should have a ssl folder with all certs and key inside your app | |
| namespace :ssl do | |
| desc "symlink ssl.cert and ssl.key from shared to release folder" | |
| task :symlink, :roles =>:app do | |
| run "test -d #{current_path}/ssl || mkdir #{current_path}/ssl" | |
| run "test -L #{current_path}/ssl/meusite.com.key || ln -s #{shared_path}/ssl/meusite.com.key #{current_path}/ssl/meusite.com.key" | |
| run "test -L #{current_path}/ssl/meusite.com.crt || ln -s #{shared_path}/ssl/meusite.com.crt #{current_path}/ssl/meusite.com.crt" | |
| run "test -L #{current_path}/ssl/bundle.crt || ln -s #{shared_path}/ssl/bundle.crt #{current_path}/ssl/bundle.crt" |
This file contains hidden or 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 :assets do | |
| task :symlink, :roles => :app do | |
| assets.create_dir | |
| run <<-CMD | |
| rm -rf #{current_path}/public/images/upload && | |
| ln -nfs #{shared_path}/upload #{release_path}/public/images/upload | |
| CMD | |
| end | |
| task :create_dir, :roles => :app do |
This file contains hidden or 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
| ~/todo/ssl $ openssl genrsa -out todo.local.key 1024 | |
| ~/todo/ssl $ chmod 600 todo.local.key | |
| ~/todo/ssl $ openssl req -new -key todo.local.key -out todo.local.csr | |
| ~/todo/ssl $ openssl x509 -in todo.local.csr -out todo.local.crt -req -signkey todo.local.key -days 1000 |