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
| """ | |
| a alguns dias acompanhei pela lista brasileira do Web2py que alguns usu谩rios estavam | |
| com dificuldades com envio de email no GAE, hoje passei por isso :( segue dica para | |
| quem tamb茅m estiver com dificuldades no envio de email pelo GAE. | |
| Em um modelo ex: "models/db.py" inclua o c贸digo abaixo: | |
| """ | |
| from gluon.tools import Mail |
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
| Um m茅todo para otimizar as conex玫es com o banco de dados 茅 estabelecer um pool de conex茫o, caso sua aplica莽茫o | |
| n茫o fa莽a isto nativamente voc锚 pode usar alguma ferramenta como o pgbouncer [1]. | |
| O principal motivo para manter um pool de conex玫es ativas com o banco de dados, 茅 que o processo | |
| de criar uma conex茫o com o banco de dados e posteriormente elimina-la gasta recursos e leva algum tempo, | |
| o que pode ser pouco para uma conex茫o, mas para apps onde a conex茫o / desconex茫o ocorre com muita | |
| frequ锚ncia (como em aplica莽玫es web) manter um pool de conex玫es ativas, pode economizar algum tempo | |
| entre cada solicita莽茫o. | |
| Um pool de conex玫es trabalha de maneira muito simples, ap贸s a aplica莽茫o criar e usar a conex茫o com o |
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
| print gravatar_image_tag('[email protected]', 32, {'class' : 'avatar', 'alt' : 'your gravatar'}) | |
| <img src="http://www.gravatar.com/avatar/3b4d33514d78047bf86307ab354658df?size=32" alt="your gravatar" class="avatar" /> |
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
| #!/usr/bin/env ruby | |
| def output_config | |
| puts <<-END | |
| graph_category App | |
| graph_title passenger status | |
| graph_vlabel count | |
| sessions.label sessions | |
| max.label max processes |
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
| #!/usr/bin/env ruby | |
| # put in /etc/munin/plugins and restart munin-node | |
| # by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin | |
| # NOTE: you might need to add munin to allow passwordless sudo for passenger-memory-stats | |
| def output_config | |
| puts <<-END | |
| graph_category App | |
| graph_title Passenger memory stats | |
| graph_vlabel count |
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
| # to use this gist execute: $ rm -f 1506695 && wget https://raw.github.com/gist/1506695 && sh 1506695 | |
| # refs to http://www.alfajango.com/blog/how-to-monitor-your-railspassenger-app-with-munin/ | |
| echo "Installing munin..." | |
| sudo apt-get install munin munin-node -y | |
| echo ; | |
| echo "Removing previous links for passenger_status and passenger_memory_stats..." | |
| sudo rm /etc/munin/plugins/passenger_memory_stats | |
| sudo rm /etc/munin/plugins/passenger_status |
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
| # sem linhas em branco, c贸digo n茫o t茫o junto | |
| if current_user.has_role('admin') | |
| cases = cases.of_product(product) | |
| elif current_user.has_role('employee') | |
| cases = cases.of_product_accessible_by_employee(product, current_user) | |
| elif current_user.has_role('customer') | |
| cases = cases.of_product_accessible_by_customer(product, current_user) |
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
| // jquery | |
| var $checkboxes = $("input[type='checkbox']"); | |
| $checkboxes.change(function(){ | |
| $checkboxes.not(this).removeAttr('checked'); | |
| }); |
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
| find -type f -iname "*~" -exec rm -f {} \; |
OlderNewer