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
CASE | |
WHEN (SPECIES2 IS NOT NULL) THEN tostring( toint(2013 % YR_ORIGIN) ) || '\n' || tostring(SPECIES1)||'/'||tostring(SPECIES2 ) | |
WHEN (SPECIES1 IS NOT NULL) THEN tostring( toint(2013 % YR_ORIGIN) ) || '\n' || tostring(SPECIES1) | |
ELSE | |
tostring( toint(2013 % YR_ORIGIN) ) | |
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
if RUBY_VERSION >= "1.9" and RUBY_VERSION <= "2.0" | |
begin | |
require "ruby_core_source" | |
rescue LoadError | |
require 'rubygems/user_interaction' # for 1.9.1 | |
require 'rubygems/dependency_installer' | |
installer = Gem::DependencyInstaller.new | |
installer.install 'ruby_core_source' | |
Gem.refresh |
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
s/\/\/(.*http:\/\/.*)$/\/* \1 *\//g | |
t | |
s/(http:\/\/.*)$/\1/g | |
t | |
s/\/\/(.*)$/\/* \1 *\//g |
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 DelegateDefault | |
def self.included base | |
base.send :extend, ClassMethods | |
end | |
module ClassMethods | |
def delegate_default args_hsh | |
include InstanceMethods | |
args_hsh.each do |attr,parent| | |
define_method attr 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
package FICSBot; | |
use strict; | |
use warnings; | |
use base qw( Bot ); | |
use IO::Select; | |
our $VERSION = "1.0.0"; | |
our $DEBUG = 0; |
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 UndefinedMethodOddity | |
def foo | |
bar 1 | |
bar 2 | |
end | |
def bar(arg) | |
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
def self.active | |
s = arel_table | |
where( | |
s[:begins_at].lteq(Time.now.utc).or(s[:begins_at].eq(nil)).and( | |
s[:ends_at].gt(Time.now.utc).or(s[:ends_at]).eq(nil)) | |
) | |
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
scope :voted_since, lambda{|since| | |
joins(:votes) | |
.where("`votes`.created_at >= ? AND `votes`.project_id = `users`.project_id", since.to_s(:db)) | |
.group("`votes`.user_id") | |
.order("COUNT(`votes`.user_id) DESC") | |
} |
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 last_activity_description(date, user_id) | |
user_activity = UserActivity.find(:first, :conditions => ["Date(updated_at) <= ? and user_id = ?", dat | |
e, user_id], :order => 'updated_at DESC') | |
user_activity.activity.description | |
end | |
# better | |
def last_activity(date, user_id) | |
UserActivity.find(:first, :conditions => ["Date(updated_at) <= ? and user_id = ?", dat | |
e, user_id], :order => 'updated_at DESC').activity |
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 last_activity(date, user_id) | |
active_id = UserActivity.find(:first, :conditions => ["Date(updated_at) <= ? and user_id = ?", dat | |
e, user_id], :order => 'updated_at DESC').activity_id | |
end |
NewerOlder