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
class Integration < Remote | |
has_many :queries | |
has_many :clicks, :finder_sql => 'SELECT DISTINCT clicks.* FROM clicks c, queries q WHERE c.query_id = q.id AND q.integration_id = #{id}' | |
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
function scroll(direction) { | |
var newsHeight = ($('#home_news_list').height()); | |
var newsContainerHeight = 190; | |
if (direction == "up"){ | |
topVal += increment; | |
if (topVal > 0){ | |
topVal = 0; | |
var stop = true; |
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
class String | |
def to_path | |
return self.gsub('http://', '').gsub(/[@\.]/, '_').gsub(/[^a-zA-Z0-9_]/, '').strip.downcase | |
end | |
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
module Indexes | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
module ClassMethods | |
def indexes | |
@indexes ||= ActiveRecord::Base.connection.indexes(table_name).map(&:name) | |
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
# expires_at '21:30', :public => true, :private => false | |
# will set max-age to the amount of seconds between now and tomorrow at 9:30PM | |
module ExpiresAt | |
def self.included(base) | |
base.send(:include, InstanceMethods) | |
end | |
module InstanceMethods |
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
class Tag < ActiveRecord::Base | |
attr_accessor :name | |
def self.localized_tags(type) | |
@localized_tags ||= {} | |
@localized_tags[:tags] ||= find(:all, :select=> "`key`, 'name', `tag_type`") | |
language = I18n.locale.to_sym | |
if @localized_tags[language].nil? | |
@localized_tags[language] ||= [] | |
@localized_tags[:tags].each do |tag| |
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
def start(&block) | |
raise ServerError, "already started." if @status != :Stop | |
server_type = @config[:ServerType] || SimpleServer | |
server_type.start{ | |
@logger.info \ | |
"#{self.class}#start: pid=#{$$} port=#{@listeners[0].addr[1]}" | |
call_callback(:StartCallback) | |
thgroup = ThreadGroup.new |
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
// NOTE: all the form items call make_ssid(); onChange | |
function true_false(value){ | |
if (value == false) | |
return '0' | |
else | |
return '1' | |
} | |
function make_ssid(){ |
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
class Team | |
def self.nickname_by_id(id=nil) | |
return 'n/a' unless id | |
@nicknames ||= ["Orioles", | |
"Red Sox", | |
"Yankees", | |
"Rays", | |
"Blue Jays", | |
"White Sox", |
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/ruby | |
apps = %w(my-audi my-bmw my-ferrari my-ford my-jeep my-landrover my-toyota my-volvo myacura mycadillac mychevrolet mychrysler mydodge mygmc myhonda myhummer myjaguar mylexus mylotus mymaserati mymazda mymercedes-benz mymini mymitsubishi mynissan myporsche myrover mysaab mysmart mysubaru myvolkswagen) | |
if File.exist?('/home/etozzato/my/logs/feed.id') | |
feed_id = File.read('/home/etozzato/my/logs/feed.id').to_i | |
`echo '#{feed_id + 1}' > /home/etozzato/my/logs/feed.id` | |
if feed_id > webs.size-1 | |
feed_id = 0 | |
`echo '#{feed_id + 1}' > /home/etozzato/my/logs/feed.id` |