This file contains hidden or 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
| public function collect($function) | |
| { | |
| $result = array(); | |
| foreach ($this as $key => $value) { | |
| array_push($result,call_user_func(array($value,$function),$value)); | |
| } | |
| return $result; | |
| } |
This file contains hidden or 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
| [color] | |
| diff = auto | |
| status = auto | |
| branch = auto | |
| interactive = auto | |
| ui = true | |
| pager = true | |
| [color "branch"] | |
| current = yellow reverse |
This file contains hidden or 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 < ActiveRecord::Base | |
| has_many :friends, :through => :friendships | |
| has_many :friendships, :dependent => :destroy | |
| def getMutualFriendsWith user | |
| intersection = friends() & user.friends() | |
| end | |
| def getNumberOfMutualFriendsWith user | |
| getMutualFriendsWith(user).length() |
NewerOlder