Skip to content

Instantly share code, notes, and snippets.

Rails.application.config.session_store :cookie_store, {
:domain => '.rails.local',
:key => '_sso_session'
}
Rails.application.config.secret_token = 'the same really long hex string'
class Host < ActiveRecord::Base
has_one :operating_system
attr_accessor :matched_on
end
class OperatingSystem < ActiveRecord::Base
belongs_to :host
def self.search(term)
t = OperatingSystem.arel_table
match_on = [:name,:version,:service_pack]
matches = match_on.map {|m| "IF(#{t[m].matches("%#{term}%").to_sql},operating_systems.#{m.to_s},NULL)" }
matching_string = "CONCAT_WS(' ', #{matches.join(",")}) as matched_on"
SQL (0.1ms) BEGIN
Issue Load (0.1ms) SELECT `issues`.* FROM `issues` WHERE (`issues`.`resolution` IS NULL) AND (`issues`.`description` = '') AND (`issues`.`name` = 'something') ORDER BY start_at DESC LIMIT 1
SQL (0.2ms) SELECT COUNT(*) AS count_id FROM `comments`
SQL (18.6ms) INSERT INTO `comments` (`body`, `commentable_id`, `commentable_type`, `created_at`, `updated_at`, `user_id`) VALUES ('Duplicate attempted to open', 3370, 'Issue', '2010-11-03 14:36:12', '2010-11-03 14:36:12', 1)
SQL (47.5ms) ROLLBACK
@dpmcnevin
dpmcnevin / pivotal.rb
Created March 30, 2011 23:28
Git post-receive hook to modify stories in Pivotal Tracker
require 'rubygems'
require 'mail'
require 'pivotal_tracker'
require 'git'
class Pivotal
attr_reader :story, :project
@dpmcnevin
dpmcnevin / _.md
Created November 26, 2012 15:54
Another Inlet
#!/usr/bin/env ruby
require 'git'
require 'logger'
g = Git.open(Dir.pwd)
if ARGV.include?("-h") || ARGV.include?("--help")
puts <<-EOF
USAGE: git bump [options]