Skip to content

Instantly share code, notes, and snippets.

View javier's full-sized avatar

javier ramírez javier

View GitHub Profile
#!/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'
require 'net/http'
require 'uri'
def _post(url, params)
url+="/" unless url =~ /\/$/
Net::HTTP.post_form(URI.parse(url),params)
end
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
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
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
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"
/* -----------------------------------------------------------------------
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.
/* -----------------------------------------------------------------------
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.
/* -----------------------------------------------------------------------
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.
We couldn’t find that file to show.