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
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
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
#!/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
@font-face { | |
font-family: 'Essays1743Italic'; | |
src: url('Essays1743-Italic.eot'); | |
src: local('☺'), url('Essays1743-Italic.ttf') format('truetype'); | |
} | |
@font-face { | |
font-family: 'Essays1743Medium'; | |
src: url('Essays1743.eot'); | |
src: local('☺'), url('Essays1743.ttf') format('truetype'); |
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 Categorizable | |
module ClassMethods | |
def acts_as_categorizable | |
has_many :audience_scopes, :as => :audienciable | |
has_many :audience_categories, :through => :audience_scopes | |
has_many :areas, :through => :audience_scopes |
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
google.pacman||function(){ | |
var a = true, e = false, g = {}, i = [1, 4, 2, 8], l = { | |
0: { | |
axis: 0, | |
increment: 0 | |
}, | |
1: { | |
axis: 0, | |
increment: -1 |
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
#kaminari uses different method names than will:paginate, but with a small add-on | |
#we can use it for paginating thinking sphinx results | |
ThinkingSphinx::Search.class_eval do | |
def num_pages | |
total_pages | |
end | |
def limit_value | |
per_page | |
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
#!/usr/bin/env ruby | |
# jazzfonica.rb for Mac OS X | |
# Scans the visible networks for JAZZTEL_XXXX or WLAN_XXXX and calculates the password | |
# Ported from PHP example at http://kz.ath.cx/wlan/codigo.txt | |
# Download and execute with ruby (e.g. ruby jazzfonica.rb) from a Terminal | |
#ported to ubuntu from https://gist.github.com/1024587 | |
#it will ask for sudo privileges. | |
#if your wlan card is not "wlan0" change the "my_wifi_card" variable |
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
... | |
<td class="Text13Grey numeric"> | |
<span id="invoice_paid_status_<%= invoice.url_id %>"> <%= partial_payment_in_redbox(invoice) %></span> | |
</td> | |
... |