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
# Monday is 26/01/2009, Sunday is 01/02/2009 | |
# I have to use a constand because RSpec can not access variables outside of "it" blocks ... | |
TWENTY_SIX_OF_JANUARY_20009 = "26/01/2009".to_date_with_european_date_format | |
describe "On going events" do | |
before :each do | |
@event = create_ongoing_event_for_barcelona( | |
:starts_at => TWENTY_SIX_OF_JANUARY_20009, | |
:ends_at => "01/02/2009".to_date_with_european_date_format) |
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
script/cucumber features/_balloon_day/a_register_campaign.feature --drb | |
/Library/Ruby/Gems/1.8/gems/cucumber-0.3.9.3/lib/cucumber/rails/world.rb:97: undefined method `World' for main:Object (NoMethodError) | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' | |
from /Users/jeanmichel/Projects/betterplace/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in `require' | |
from /Users/jeanmichel/Projects/betterplace/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in' | |
from /Users/jeanmichel/Projects/betterplace/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in `require' | |
from /Users/jeanmichel/Projects/betterplace/trunk/features/support/env.rb:18 | |
from /Library/Ruby/Gems/1.8/gems/bmabey-spork-0.4.4/bin/../lib/spork.rb:15:in `each_run' | |
from /Users/jeanmichel/P |
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
/* Mozilla Ubiquity Command for Diigo, currently only support add bookmark. | |
* Some code from https://ubiquity.mozilla.com/standard-feeds/social.js | |
*/ | |
var store = Application.storage; | |
const DIIGO_CUR_LOGIN = "ubiquity_diigo_cur_login"; | |
var Choices = {"yes": "yes", "no": "no"}; | |
var noun_type_share = { | |
_name: "yes/no", |
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 'benchmark' | |
$require_level = 0 | |
module Kernel | |
alias require_without_timing require | |
def require(path) | |
result = seconds = nil | |
begin | |
$require_level += 1 |
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 THIS IS some hackety hack code without tests. CodeStatistics class could be rewritten to be more configurable ... | |
task :stats => [:statsetup, :stats_assets] | |
# Setup specs / cuke & js for stats | |
task :statsetup do | |
require 'code_statistics' | |
class CodeStatistics | |
alias calculate_statistics_orig calculate_statistics |
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 ActiveRecord::Migration | |
def self.fast_add_columns(table_name, new_columns_count) | |
tmp_table_name = "#{table_name}_tmp" | |
execute "DROP TABLE IF EXISTS #{tmp_table_name}" | |
execute "CREATE TABLE #{tmp_table_name} LIKE #{table_name}" | |
yield tmp_table_name | |
execute("INSERT INTO #{tmp_table_name} SELECT * #{', NULL' * new_columns_count} FROM #{table_name}") |
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 "fileutils" | |
img =Dir.glob("**/*.jpg")+Dir.glob("**/*.png")+Dir.glob("**/*.gif") | |
data=Dir.glob("**/*.htm*")+Dir.glob("**/*.css")+Dir.glob("**/*.js") | |
puts "#{img.size} images found & #{data.size} files found to search against" | |
content="" | |
data.each do |f| | |
content+=File.open(f, 'r').read |
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 Statistics | |
def initialize | |
@configuration = Configuration.new(self) | |
end | |
delegate :for_caller, | |
:rtp_errors, | |
to: :@configuration |
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 defined? RSpec | |
task(:spec).clear | |
desc "Run all specs in spec directory starting with js specs" | |
RSpec::Core::RakeTask.new(:spec => ['konacha:run', 'db:test:prepare']) do |t| | |
t.pattern = './spec/**/*{_spec.rb,.feature}' | |
end | |
namespace :spec do | |
desc "Run the code examples in spec/acceptance" |
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 'action_view/helpers/number_helper' | |
require 'rails-i18n' | |
class FastPresenter | |
include ActionView::Helpers::NumberHelper | |
def initialize(value) | |
@value = value | |
end |
OlderNewer