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/bash | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" | |
rvm use ruby-1.8.7 | |
echo "Ruby 1.8.7" | |
ruby -v | |
echo $1 | |
time ruby $1.rb |
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
# | |
# PHP is an HTML-embedded scripting language which attempts to make it | |
# easy for developers to write dynamically generated webpages. | |
# | |
LoadModule php5_module modules/libphp5.so | |
# | |
# Cause the PHP interpreter to handle files with a .php extension. | |
# |
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
~/Sites/testapp > rvm gem install sqlite3-ruby | |
Building native extensions. This could take a while... | |
/bin/sh: line 1: 2487 Abort trap /Library/Frameworks/MacRuby.framework/Versions/0.9/usr/bin/macruby extconf.rb 2>&1 | |
ERROR: Error installing sqlite3-ruby: | |
ERROR: Failed to build gem native extension. | |
/Library/Frameworks/MacRuby.framework/Versions/0.9/usr/bin/macruby extconf.rb | |
checking for sqlite3.h... *** extconf.rb failed *** | |
Could not create Makefile due to some reason, probably lack of | |
necessary libraries and/or headers. Check the mkmf.log file for more |
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
Build time: 153.22826 seconds | |
1: LD vm/vm | |
/home/mrbrdo/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -S rake -r /home/mrbrdo/.rvm/src/rbx-head/config.rb -r /home/mrbrdo/.rvm/src/rbx-head/rakelib/ext_helper.rb -r /home/mrbrdo/.rvm/src/rbx-head/rakelib/dependency_grapher.rb build:mri | |
GEN lib/compiler/opcodes.rb | |
GEN lib/compiler/generator_methods.rb | |
(in /home/mrbrdo/.rvm/src/rbx-head/lib/ext/melbourne) | |
Building Melbourne for MRI | |
CXX bstrlib.c | |
CXX var_table.cpp | |
CXX visitor.cpp |
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
NoMethodError in PagesController#home | |
undefined method `reverse_merge!' for #<Array:0x5203e0c6> | |
Rails.root: /Users/apple/testapp | |
Application Trace | Framework Trace | Full Trace | |
refinerycms-i18n (0.9.9.15) lib/refinery/i18n-js.rb:25:in `export!' | |
refinerycms-i18n (0.9.9.15) lib/refinery/i18n-js.rb:24:in `each' | |
refinerycms-i18n (0.9.9.15) lib/refinery/i18n-js.rb:24:in `export!' | |
refinerycms-i18n (0.9.9.15) lib/refinery/i18n.rb:25:in `_callback_before_45' |
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
Running: cd "/Users/apple/reftest" && /Users/apple/.rvm/rubies/ruby-1.8.7-p334/bin/ruby -S rails generate refinerycms | |
/Users/apple/.rvm/gems/ruby-1.8.7-p334/gems/refinerycms-core-0.9.9.10/lib/generators/refinerycms_generator.rb:16:in `generate': undefined method `root' for Refinery:Module (NoMethodError) | |
from /Users/apple/.rvm/gems/ruby-1.8.7-p334/gems/thor-0.14.6/lib/thor/task.rb:22:in `send' | |
from /Users/apple/.rvm/gems/ruby-1.8.7-p334/gems/thor-0.14.6/lib/thor/task.rb:22:in `run' | |
from /Users/apple/.rvm/gems/ruby-1.8.7-p334/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task' | |
from /Users/apple/.rvm/gems/ruby-1.8.7-p334/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all' | |
from /Users/apple/.rvm/gems/ruby-1.8.7-p334/gems/thor-0.14.6/lib/thor/shell.rb:14:in `map' | |
from /Users/apple/.rvm/gems/ruby-1.8.7-p334/gems/thor-0.14.6/lib/thor/core_ext/ordered_hash.rb:75:in `each' | |
from /Users/apple/.rvm/gems/ruby-1.8.7-p334/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map' | |
from /Users/apple/.rvm/ |
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
mrbrdo@zephyrus:~/rails$ rails new browsercmstest -m http://browsercms.org/templates/demo.rb | |
create | |
create README | |
create Rakefile | |
create config.ru | |
create .gitignore | |
create Gemfile | |
create app | |
create app/controllers/application_controller.rb | |
create app/helpers/application_helper.rb |
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 :by_rating, :lambda do |order| | |
order ||= "ASC" | |
previous_scope = ? | |
all_scores = previous_scope.where("num_scores > ?", 0).sum('score') | |
num_of_all_scores = previous_scope.where("num_scores > ?", 0).sum('num_scores') | |
site_avg = all_scores.to_f / num_of_all_scores.to_f | |
site_avg = 0 if num_of_all_scores <= 0 # this is the reason I'd like to do it this way instead of the normal way | |
min_votes = 5 | |
previous_scope.where("num_scores > ?", 0).order("((num_scores / (num_scores + #{min_votes})) * (score / num_scores) + (#{min_votes} / (num_scores + #{min_votes})) * #{site_avg}) #{order}") |
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
ruby-1.8.7-p334 :021 > p.professor_at_programmes.by_rating("ASC").includes(:professor).to_sql => "SELECT \"professor_at_programmes\".* FROM \"professor_at_programmes\" WHERE (\"professor_at_programmes\".programme_id = 1) AND (num_scores > 0) ORDER BY ((num_scores / (num_scores + 1.0)) * (score / num_scores) + (1.0 / (num_scores + 1.0)) * 3.16666666666667) ASC" |
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 :get_professors, lambda { | |
all.map(&professor) | |
} | |
ruby-1.8.7-p334 :002 > Programme.first.professor_at_programmes.by_rating("ASC").includes(:professor).get_professors | |
=> [] | |
ruby-1.8.7-p334 :003 > Programme.first.professor_at_programmes.by_rating("ASC").includes(:professor).map(&:professor) | |
=> [#<Professor id: 2, slug: "B", name: "B", surname: "B", created_at: "2011-04-02 21:52:01", updated_at: "2011-04-02 21:52:01">, #<Professor id: 3, slug: "C", name: "C", surname: "C", created_at: "2011-04-02 21:52:04", updated_at: "2011-04-02 21:52:04">, #<Professor id: 1, slug: "A", name: "A", surname: "A", created_at: "2011-04-02 21:51:57", updated_at: "2011-04-02 21:51:57">] |
OlderNewer