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 AddProjectIdToVotes < ActiveRecord::Migration | |
def self.up | |
# add_column :votes, :project_id, :integer | |
DbCluster.each do |c| | |
puts "Executing in #{c.connection_name}" | |
Line::Version.find(:all).each do |line_version| | |
Vote.find(:all, :conditions => { :voteable_type => 'Line::Version', :voteable_id => line_version.id }).each do |vote| | |
if line_version.project_id |
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
!= check_box_tag 'hoy', 'hoy2', false, :class => 'rtoggler', :title => '#testing' | |
#testing.hide | |
Testing | |
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 BlackHoleStore | |
def logger | |
Rails.logger | |
end | |
def fetch( *args ) | |
yield | |
end | |
def read( *args ) |
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/local/lib/ruby/gems/1.9.1/gems/rufus-tokyo-0.1.12/lib/rufus/tokyo/cabinet/table.rb:606: [BUG] Segmentation fault | |
ruby 1.9.1p0 (2009-01-30 revision 21907) [x86_64-linux] | |
-- control frame ---------- | |
c:0047 p:---- s:0150 b:0150 l:000149 d:000149 CFUNC :tclistnum | |
c:0046 p:0019 s:0146 b:0146 l:000145 d:000145 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rufus-tokyo-0.1.12/lib/rufus/tokyo/cabinet/table.rb:606 | |
c:0045 p:0015 s:0143 b:0142 l:000141 d:000141 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rufus-tokyo-0.1.12/lib/rufus/tokyo/cabinet/table.rb:615 | |
c:0044 p:---- s:0139 b:0139 l:000138 d:000138 FINISH | |
c:0043 p:---- s:0137 b:0137 l:000136 d:000136 CFUNC :collect | |
c:0042 p:0011 s:0134 b:0134 l:000133 d:000133 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rufus-tokyo-0.1.12/lib/rufus/tokyo/cabinet/table.rb:631 |
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 HomeController < ApplicationController | |
def index | |
if (@target_url = params["url"]) && !@target_url.blank? | |
@target_url = @target_url =~ %r{^http://} ? @target_url : "http://#{@target_url}" | |
filter_if_length_less_than = 40 | |
@page = open(@target_url).read | |
doc = Nokogiri::HTML.parse(@page) | |
content = doc.search("h1,p,.comment") | |
content = content.reject { |node| node.text.gsub(/\W/,'').strip.length < filter_if_length_less_than } | |
content = content.reject { |node| (%w[noscript li] & node.ancestors.map { |e| e.name }).length > 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
#! /bin/sh | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/mongodb/bin | |
DAEMON=/opt/mongodb/bin/mongod | |
PIDFILE=/var/log/mongodb/mongodb.pid | |
LOGFILE=/var/log/mongodb/mongod.log | |
NAME=mongodb | |
DESC=mongodb | |
test -x $DAEMON || exit 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
module Suggestions | |
def self.included( base ) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
# USAGE: | |
# | |
# class Doctor | |
# # this model should have the typical Sunspot.setup clause somewhere else |
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 User | |
module DeprecatedPasswordCheck | |
def valid_password?( attempted_password, check_against_database = check_passwords_against_database? ) | |
if valid_legacy_password?( attempted_password ) | |
return true | |
else | |
super | |
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
require 'rubygems' | |
require 'action_controller' | |
require 'action_controller/test_process' | |
def upload( path, mime ) | |
ActionController::TestUploadedFile.new( path, mime ) | |
end | |
event = Event.find(100) |
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 'open-uri' | |
require 'tempfile' | |
class Downloadable | |
# The filename, *not* including the path, of the "uploaded" file | |
attr_reader :original_filename | |
# The content type of the "uploaded" file | |
attr_accessor :content_type |
OlderNewer