Skip to content

Instantly share code, notes, and snippets.

View marcoow's full-sized avatar
🙈
🙉🙊

Marco Otte-Witte marcoow

🙈
🙉🙊
View GitHub Profile
// application library 1
namespace App\Lib1;
const MYCONST = 'App\Lib1\MYCONST';
function MyFunction() {
return __FUNCTION__;
}
class MyClass {
[request setRelationshipKeyPathsForPrefetching:[NSArray arrayWithObjects:@"articles", @"articles.features", nil]];
Basket.all(:include => { :articles => :features})
sudo gem install do_mysql -- --with-mysql-dir=/usr/local/mysql
class ShoppingBasket < ActiveRecord::Base
def initialize(items = [])
self.items = items
end
end
$ excellent shopping_basket.rb
Excellent result:
test.rb
* Line 1: ShoppingBasket does not validate any attributes.
* Line 1: ShoppingBasket defines initialize method.
* Line 1: ShoppingBasket does not specify attr_accessible.
Found 3 warnings.
$ gem install excellent
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 74 | 57 | 4 | 6 | 1 | 7 |
| Helpers | 32 | 23 | 0 | 2 | 0 | 9 |
| Models | 497 | 319 | 13 | 22 | 1 | 12 |
| Libraries | 499 | 282 | 5 | 35 | 7 | 6 |
| Model specs | 942 | 658 | 0 | 5 | 0 | 129 |
| View specs | 0 | 0 | 0 | 0 | 0 | 0 |
| Controller specs | 471 | 315 | 0 | 6 | 0 | 50 |
class ArbitraryModel < DataMapper::Type
primitive String
def self.dump(value, property)
"#{value.class}/#{value.id}" unless value.nil?
end
def self.load(value, property)
case value
class SomeModel
include DataMapper::Resource
property :id, Serial
property :details, ArbitraryModel
end