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
group :db do | |
gem 'ruby-odbc', :require => 'odbc' | |
gem 'tiny_tds' | |
gem 'activerecord-sqlserver-adapter', '~> 3.1.0' | |
end | |
group :development do | |
gem 'rails' | |
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
class String | |
def to_len_lines(len=80) | |
self.dup.to_len_lines!(len) | |
end | |
def to_len_lines!(len=80) | |
((self.length/len.to_f).ceil).times{|i| self[i*len,0] = $/ } | |
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
class ApiKey < ActiveRecord::Base | |
belongs_to :user | |
around_create :generate_api_key | |
def generate_api_key | |
self.api_key = "" | |
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-.," |
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 |
NewerOlder