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
#!/usr/bin/ruby1.8 | |
# | |
# This file was generated by RubyGems. | |
# | |
# The application 'rails' is installed as part of a gem, and | |
# this file is here to facilitate running it. | |
# | |
require 'rubygems' |
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 'net/http' | |
require 'uri' | |
def _post(url, params) | |
url+="/" unless url =~ /\/$/ | |
Net::HTTP.post_form(URI.parse(url),params) | |
end |
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
Hash.class_eval do | |
def deep_select(key) | |
res=[] | |
res << self[key] | |
values.select{|v| v.is_a?(Hash)}.each do |h| | |
children=h.deep_select(key) | |
res += children if children | |
end | |
res.compact! | |
res.empty? ? nil : res |
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
namespace :mysql do | |
# Parameter 'days' indicates maximum inactivity days before deletion. Default is 30 | |
desc "cleanup old sessions from the database" | |
task :expire_sessions => :environment do | |
days = ENV['days'] || 30 | |
ActiveRecord::Base.connection.execute "delete from sessions where datediff(utc_date(),updated_at) > #{days}" | |
puts "Sessions idle more than #{days} days expired" | |
puts "Anonymous sessions expired" | |
end #task do |
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
module RouteTranslation | |
mattr_accessor :translations | |
mattr_accessor :reverse_translations | |
rf=File.join(RAILS_ROOT,'config','route_translation.yml') | |
self.translations=YAML.load_file(rf) | |
self.reverse_translations=Hash.new | |
translations.keys.each do |key| | |
self.reverse_translations.merge! translations[key].invert |
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 'irb/completion' | |
ARGV.concat [ "--readline", "--prompt-mode", "simple" ] | |
require 'irb/ext/save-history' | |
IRB.conf[:SAVE_HISTORY] = 100 | |
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history" | |
begin | |
# load wirble | |
require "rubygems" |
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
/* ----------------------------------------------------------------------- | |
Blueprint CSS Framework 0.8 | |
http://blueprintcss.org | |
* Copyright (c) 2007-Present. See LICENSE for more info. | |
* See README for instructions on how to use Blueprint. | |
* For credits and origins, see AUTHORS. | |
* This is a compressed file. See the sources in the 'src' directory. |
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
/* ----------------------------------------------------------------------- | |
Blueprint CSS Framework 0.8 | |
http://blueprintcss.org | |
* Copyright (c) 2007-Present. See LICENSE for more info. | |
* See README for instructions on how to use Blueprint. | |
* For credits and origins, see AUTHORS. | |
* This is a compressed file. See the sources in the 'src' directory. |
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
/* ----------------------------------------------------------------------- | |
Blueprint CSS Framework 0.8 | |
http://blueprintcss.org | |
* Copyright (c) 2007-Present. See LICENSE for more info. | |
* See README for instructions on how to use Blueprint. | |
* For credits and origins, see AUTHORS. | |
* This is a compressed file. See the sources in the 'src' directory. |