Skip to content

Instantly share code, notes, and snippets.

View shadowmaru's full-sized avatar
:shipit:
Ship it!

Ricardo Shiota Yasuda shadowmaru

:shipit:
Ship it!
View GitHub Profile
class UserPasswordCryptMD5
def self.encrypt(*tokens)
Digest::MD5.hexdigest(*tokens)
end
def self.matches?(crypted_password, *tokens)
encrypt(*tokens) == crypted_password
end
end
acts_as_authentic do |c|
c.transition_from_crypto_providers = [UserPasswordCryptSHA, UserPasswordCryptMD5]
end
location /atendimento.php {
rewrite /atendimento.php http://www.smartfit.com.br/atendimento permanent;
}
location /franquias.php {
rewrite /franquias.php http://www.smartfit.com.br/franchises/new permanent;
}
location /unidades.php {
rewrite /unidades.php http://www.smartfit.com.br/unidades permanent;
Redirect /atendimento.php http://www.smartfit.com.br/atendimento
Redirect /unidades.php http://www.smartfit.com.br/unidades
Redirect /franquias.php http://www.smartfit.com.br/franchises/new
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/a-smartfit.php$
RewriteCond %{QUERY_STRING} ^idUnidade=1$
RewriteRule ^.*$ http://www.smartfit.com.br/unidades/brasilia? [L,R=301]
RewriteCond %{REQUEST_URI} ^/a-smartfit.php$
RewriteCond %{QUERY_STRING} ^idUnidade=2$
#!/usr/local/bin/ruby
videos = Dir.glob("Glee*.avi")
videos.each do |file|
file_parts = file.split(".")
file_parts.pop
filename = file_parts.join(".")
nfo = File.new("#{filename}.nfo", "w+")
nfo.puts("<musicvideo>
>> extend Hirb::Console
=> main
>> view Page.find_by_name('About Us'), :class => :parent_child_tree, :type => :directory
About Us
|-- Contact
|-- Our History
|-- Mission
|-- Privacy Policy
`-- Terms of Use
>> Post.all :limit => 5
+----+---------------+---------------+---------------+---------------+---------+---------------+---------------+-----------+---------------+
| id | name | body | published_at | permalink | user_id | created_at | updated_at | published | comments_c... |
+----+---------------+---------------+---------------+---------------+---------+---------------+---------------+-----------+---------------+
| 74 | Manipuland... | Uma das d?... | 2009-06-09... | manipuland... | 1 | 2009-06-09... | 2009-08-11... | true | 3 |
| 73 | Limpando o... | !/system/a... | 2009-04-22... | limpando-o... | 1 | 2009-04-22... | 2009-08-11... | true | 0 |
| 72 | Why's (poi... | <img src="... | 2009-04-09... | why-s-poig... | 1 | 2009-04-09... | 2009-08-11... | true | 0 |
| 70 | Evento: Ru... | No dia 4 d... | 2009-03-10... | evento-rub... | 1 | 2009-03-10... | 2009-08-10... | true | 1 |
| 68 | Dica r
if ENV['RAILS_ENV']
require 'rubygems'
require 'hirb'
Hirb.enable
end
$ script/console
Loading development environment (Rails 2.3.4)
>> require 'hirb'
=> []
>> Hirb.enable
=> nil
DIRECTORIES = %w(Users/username)
TO = '/path/for/backup'
OPTIONS = { :rsync => '--progress -varRu', :remote => false }
rsync DIRECTORIES, nil, TO, OPTIONS