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
# Controller | |
module Admin | |
class UsersController < AdminController | |
def edit | |
@user = User.find(params[:id]) | |
end | |
def update | |
if request.put? | |
@user = User.find(params[:id]) |
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
# Horario de Verao Brasileiro em Ruby | |
# | |
# Dado um ano retorna o dia de inicio e termino do horario de verao brasileiro | |
# seguindo o decreto Nº 6.558, de 8 de setembro de 2008 | |
# disponivel em: http://www.planalto.gov.br/ccivil_03/_ato2007-2010/2008/decreto/d6558.htm | |
# Valido a partir do ano de 2009 | |
# | |
# Baseado no seguinte codigo em C#: | |
# http://blog.inspira.com.br/2009/03/algoritmo-para-inicio-e-fim-do-horario.html | |
# ou http://gist.github.com/75851 |
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
# =Split Reuters-21578 | |
# =(Found at: http://www.daviddlewis.com/resources/testcollections/reuters21578/) | |
# =SGML files into separate TXT files | |
# | |
# Documents selected are those from LEWIS SPLIT that have at least one topic. | |
# Documents (only the body of text) are put in directories according to their type (train/test) and topic. | |
# Documents with more than one topic are written in more than one folder. | |
# Only documents that have a topic listed in 'used_topics' Array are selected. | |
# This pre-processing is useful for text categorization applications. | |
# |
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 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
doc = Hpricot(open("http://www.nomedojogo.com/2008/08/08/pesquisa-quantos-anos-voce-tem/")) | |
class Array | |
def sum | |
inject(0){ |sum,x| sum ? sum+x : x } | |
end |